aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdelete_poll.rb22
-rwxr-xr-xerror.cgi2
-rw-r--r--vcs_bzr.rb16
-rw-r--r--vcs_git.rb26
-rw-r--r--vcs_test.rb2
5 files changed, 34 insertions, 34 deletions
diff --git a/delete_poll.rb b/delete_poll.rb
index 059a941..36d4564 100755
--- a/delete_poll.rb
+++ b/delete_poll.rb
@@ -36,7 +36,7 @@ if $cgi.include?("confirmnumber")
CONFIRM = $cgi["confirmnumber"].to_i
if USERCONFIRM == QUESTIONS[CONFIRM]
Dir.chdir("..")
- `mv #{$d.urlsuffix} /tmp/#{$d.urlsuffix}.#{rand(9999999)}`
+ File.move($d.urlsuffix, "/tmp/#{$d.urlsuffix}.#{rand(9999999)}")
if $cgi.include?("return")
$d.html.header["status"] = "REDIRECT"
$d.html.header["Cache-Control"] = "no-cache"
@@ -52,7 +52,7 @@ if $cgi.include?("confirmnumber")
wikipediastr = _("Browse Wikipedia")
googlestr = _("Search something with Google")
- $d.html << <<SUCCESS
+ $d.html << %{
<p class='textcolumn'>
#{deleteconfirmstr}
</p>
@@ -67,30 +67,30 @@ if $cgi.include?("confirmnumber")
<li><a href='http://www.google.com'>#{googlestr}</a></li>
</ul>
</div>
-SUCCESS
+ }
$d.out
exit
else
- hint = <<HINT
+ hint = %{
<table style='background:lightgray'>
<tr>
<td style='text-align:right'>
-HINT
+}
hint += _("To delete the poll, you have to type:")
- hint += <<HINT
+ hint += %{
</td>
<td class='warning' style='text-align:left'>#{QUESTIONS[CONFIRM]}</td>
</tr>
<tr>
<td style='text-align:right'>
-HINT
+}
hint += _("but you typed:")
- hint += <<HINT
+ hint += %{
</td>
<td class='warning' style='text-align:left'>#{USERCONFIRM}</td>
</tr>
</table>
-HINT
+}
end
else
CONFIRM = rand(QUESTIONS.size()-1) +1
@@ -101,7 +101,7 @@ $d.html << _("You want to delete the poll named") + " <b>#{$d.table.name}</b>.<b
$d.html << _("This is an irreversible action!") + "<br />"
$d.html << _("If you are sure in what you are doing, please type “%{question}” into the form.") % {:question => QUESTIONS[CONFIRM]}
deletestr = _("Delete")
-$d.html << <<TABLE
+$d.html << %{
#{hint}
<form method='post' action='' accept-charset='utf-8'>
<div>
@@ -110,7 +110,7 @@ $d.html << <<TABLE
<input type='submit' value='#{deletestr}' />
</div>
</form>
-TABLE
+}
$d.out
diff --git a/error.cgi b/error.cgi
index 3e192a7..1b386d8 100755
--- a/error.cgi
+++ b/error.cgi
@@ -70,7 +70,7 @@ if $conf.auto_send_report
f << errorstr
}
- `mail -s "Bug in dudle" #{$conf.bugreportmail} < #{tmpfile}`
+ %x{mail -s "Bug in dudle" #{$conf.bugreportmail} < #{tmpfile}}
File.delete(tmpfile)
diff --git a/vcs_bzr.rb b/vcs_bzr.rb
index f2fe2db..9f15527 100644
--- a/vcs_bzr.rb
+++ b/vcs_bzr.rb
@@ -23,27 +23,27 @@ require "log"
class VCS
BZRCMD="export LC_ALL=de_DE.UTF-8; bzr"
def VCS.init
- `#{BZRCMD} init`
+ %x{#{BZRCMD} init}
end
def VCS.rm file
- `#{BZRCMD} rm #{file}`
+ %x{#{BZRCMD} rm #{file}}
end
def VCS.add file
- `#{BZRCMD} add #{file}`
+ %x{#{BZRCMD} add #{file}}
end
def VCS.revno
- `#{BZRCMD} revno`.to_i
+ %x{#{BZRCMD} revno}.to_i
end
def VCS.cat revision, file
- `#{BZRCMD} cat -r #{revision.to_i} #{file}`
+ %x{#{BZRCMD} cat -r #{revision.to_i} #{file}}
end
def VCS.history
- log = `#{BZRCMD} log --forward`.split("-"*60)
+ log = %x{#{BZRCMD} log --forward}.split("-"*60)
ret = Log.new
log.shift
log.each{|s|
@@ -58,12 +58,12 @@ class VCS
File.open(tmpfile,"w"){|f|
f<<comment
}
- ret = `#{BZRCMD} commit -q -F #{tmpfile}`
+ ret = %x{#{BZRCMD} commit -q -F #{tmpfile}}
File.delete(tmpfile)
ret
end
def VCS.branch source, target
- `#{BZRCMD} branch #{source} #{target}`
+ %x{#{BZRCMD} branch #{source} #{target}}
end
end
diff --git a/vcs_git.rb b/vcs_git.rb
index e74502c..27b7d1c 100644
--- a/vcs_git.rb
+++ b/vcs_git.rb
@@ -21,34 +21,34 @@ require "time"
require "log"
class VCS
- GITCMD="export LC_ALL=de_DE.UTF-8; git"
+ GITCMD="git"
def VCS.init
- `#{GITCMD} init`
+ %x{#{GITCMD} init}
end
def VCS.rm file
- `#{GITCMD} rm #{file}`
+ %x{#{GITCMD} rm #{file}}
end
def VCS.add file
- `#{GITCMD} add #{file}`
+ %x{#{GITCMD} add #{file}}
end
def VCS.revno
# there is a bug in git log --format, which supresses the \n on the last line
- `#{GITCMD} log --format="format:x"`.scan("\n").size + 1
+ %x{#{GITCMD} log --format="format:x"}.scan("\n").size + 1
end
def VCS.cat revision, file
- revs = `#{GITCMD} log --format="format:%H"`.scan(/^(.*)$/).flatten.reverse
- `#{GITCMD} show #{revs[revision-1]}:#{file}`
+ revs = %x{#{GITCMD} log --format=format:%H}.scan(/^(.*)$/).flatten.reverse
+ %x{#{GITCMD} show #{revs[revision-1]}:#{file}}
end
def VCS.history
- log = `#{GITCMD} log --format="format:%s|%ai"`.split("\n").reverse
+ log = %x{#{GITCMD} log --format=format:"%s\t%ai"}.split("\n").reverse
ret = Log.new
log.each_with_index{|s,i|
- a = s.scan(/^([^\|]*)(.*)$/).flatten
+ a = s.scan(/^([^\t]*)(.*)$/).flatten
ret.add(i+1, Time.parse(a[1]), a[0])
}
ret
@@ -59,18 +59,18 @@ class VCS
File.open(tmpfile,"w"){|f|
f<<comment
}
- ret = `#{GITCMD} commit -a -F #{tmpfile}`
+ ret = %x{#{GITCMD} commit -a -F #{tmpfile}}
File.delete(tmpfile)
ret
end
def VCS.branch source, target
- `#{GITCMD} clone #{source} #{target}`
+ %x{#{GITCMD} clone #{source} #{target}}
end
def VCS.revert revno
- revhash = `#{GITCMD} log --format="%H"`.split("\n").reverse[revno-1]
- `#{GITCMD} checkout #{revhash} .`
+ revhash = %x{#{GITCMD} log --format=%H}.split("\n").reverse[revno-1]
+ %x{#{GITCMD} checkout #{revhash} .}
VCS.commit("Reverted Poll to version #{revno}")
end
end
diff --git a/vcs_test.rb b/vcs_test.rb
index 2111cc5..248a619 100644
--- a/vcs_test.rb
+++ b/vcs_test.rb
@@ -47,7 +47,7 @@ class VCS_test < Test::Unit::TestCase
def teardown
puts @repo
# Dir.chdir("/")
-# `rm -rf #{@repo}`
+# %x{rm -rf #{@repo}}
puts "#{@t}: #{@b}"
end
def test_cat