Skip to content

Commit

Permalink
flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Sofaer and Raphael Sofaer committed Nov 19, 2010
1 parent 7b0c2b8 commit 9d2c950
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/hellspawn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ def march!(base)
run_file.close
end
def run_script
"exec #{self[:executable]}"
"exec #{self[:executable]} " + flag_snippet
end
def flag_snippet
self[:flags].map{|k,v| k + " " + v}.join(" ")
end
def run_prep
"exec 2&>1"
Expand Down
12 changes: 12 additions & 0 deletions test/hellspawn_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ class BasicTest < Test::Unit::TestCase
def setup
@thin = {:name => "thin",
:executable => "/usr/local/bin/thin",
:flags => {"-e" => "production",
"-c" => "/usr/local/app/my_app",
},
}
@legion = Hellspawn.legion(:base => "/tmp/test_services", :name => "test_legion")
end
def teardown
FileUtils.rm_rf("/tmp/test_services")
end
def test_legion
assert {@legion.size == 0}
end
Expand All @@ -21,6 +27,12 @@ def test_march
run_script = File.read("/tmp/test_services/thin/run")
assert { run_script.match /exec \/usr\/local\/bin\/thin/ }
end
def test_flags
@legion.summon @thin
@legion.march!
run_script_lines = File.read("/tmp/test_services/thin/run").split("\n")
assert { run_script_lines.include?("exec /usr/local/bin/thin -c /usr/local/app/my_app -e production") }
end
def test_stderr
@legion.summon @thin
@legion.march!
Expand Down

0 comments on commit 9d2c950

Please sign in to comment.