Skip to content

Commit

Permalink
Merge branch 'lockrun'
Browse files Browse the repository at this point in the history
  • Loading branch information
technicalpickles committed Jul 22, 2009
2 parents 5a3bce2 + dfb8935 commit 0cabade
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions lib/job_types/default.rb
Expand Up @@ -34,8 +34,7 @@ def wrap_task(task)

def lockrunify(output)
path_required
escaped_output = output
%Q{/usr/bin/env lockrun --lockfile=#{lockfile_path} -- sh -c "#{escaped_output}"}
%Q{/usr/bin/env lockrun --lockfile=#{lockfile_path} -- sh -c '#{output}'}
end

def lockfile_path
Expand Down
10 changes: 4 additions & 6 deletions test/output_lockrun_test.rb
Expand Up @@ -15,7 +15,7 @@ class OutputLockrunTest < Test::Unit::TestCase
end

should "output the command wrapped by lockrun with the default lockfile" do
assert_match two_hours + %Q{ /usr/bin/env lockrun --lockfile=/some/directory/log/default.lockrun -- sh -c "blahblah"}, @output
assert_match two_hours + %Q{ /usr/bin/env lockrun --lockfile=/some/directory/log/default.lockrun -- sh -c 'blahblah'}, @output
end
end

Expand All @@ -30,10 +30,8 @@ class OutputLockrunTest < Test::Unit::TestCase
file
end

"cd #{@path} && RAILS_ENV=#{@environment} /usr/bin/env rake #{task}"

should "output the command wrapped by lockrun with the default lockfile" do
assert_includes %Q{#{two_hours} /usr/bin/env lockrun --lockfile=/my/super/directory/log/default.lockrun -- sh -c "cd /my/super/directory && RAILS_ENV=production /usr/bin/env rake blahblah"}, @output
assert_includes %Q{#{two_hours} /usr/bin/env lockrun --lockfile=/my/super/directory/log/default.lockrun -- sh -c 'cd /my/super/directory && RAILS_ENV=production /usr/bin/env rake blahblah'}, @output
end
end

Expand All @@ -49,7 +47,7 @@ class OutputLockrunTest < Test::Unit::TestCase
end

should "output the command wrapped by lockrun with the default lockfile" do
assert_includes %Q{#{two_hours} /usr/bin/env lockrun --lockfile=/my/directory/log/default.lockrun -- sh -c "/my/directory/script/runner -e production \"blahblah\""}, @output
assert_includes %Q{#{two_hours} /usr/bin/env lockrun --lockfile=/my/directory/log/default.lockrun -- sh -c '/my/directory/script/runner -e production "blahblah"'}, @output
end
end

Expand All @@ -65,7 +63,7 @@ class OutputLockrunTest < Test::Unit::TestCase
end

should "output the command wrapped by lockrun with the zomg lockfile" do
assert_includes %Q{#{two_hours} /usr/bin/env lockrun --lockfile=/some/directory/log/zomg.lockrun -- sh -c "blahblah"}, @output
assert_includes %Q{#{two_hours} /usr/bin/env lockrun --lockfile=/some/directory/log/zomg.lockrun -- sh -c 'blahblah'}, @output
end
end

Expand Down

0 comments on commit 0cabade

Please sign in to comment.