Compare commits

...
6 Commits
Author SHA1 Message Date
David Dollar ada41ce311 0.25.0 2011-10-17 16:21:15 -04:00
David Dollar 8f1c752a77 Merge pull request #85 from hlegendre/master
Allow numbers in the ENV variable keys
2011-10-12 14:20:50 -07:00
Hugues Le Gendre ddf25fe0ea Numbers should be allowed in key names of ENV no ? 2011-10-12 17:06:37 +03:00
David Dollar 86e4251840 add ability to test full comamnd line 2011-10-04 11:30:28 -04:00
David Dollar ba18f7e589 Merge pull request #74 from tomafro/master
Allow export using a specified environment file, using the --env or -e option
2011-10-04 08:20:04 -07:00
Tom Ward 47008fb921 Allow export using a specified environment file, using the --env or -e option 2011-09-16 08:31:29 +01:00
6 changed files with 23 additions and 3 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
foreman (0.24.0) foreman (0.25.0)
term-ansicolor (~> 1.0.5) term-ansicolor (~> 1.0.5)
thor (>= 0.13.6) thor (>= 0.13.6)
+1
View File
@@ -28,6 +28,7 @@ class Foreman::CLI < Thor
method_option :app, :type => :string, :aliases => "-a" method_option :app, :type => :string, :aliases => "-a"
method_option :log, :type => :string, :aliases => "-l" method_option :log, :type => :string, :aliases => "-l"
method_option :env, :type => :string, :aliases => "-e", :desc => "Specify an environment file to load, defaults to .env"
method_option :port, :type => :numeric, :aliases => "-p" method_option :port, :type => :numeric, :aliases => "-p"
method_option :user, :type => :string, :aliases => "-u" method_option :user, :type => :string, :aliases => "-u"
method_option :template, :type => :string, :aliases => "-t" method_option :template, :type => :string, :aliases => "-t"
+1 -1
View File
@@ -184,7 +184,7 @@ private ######################################################################
return {} unless File.exists?(filename) return {} unless File.exists?(filename)
File.read(filename).split("\n").inject({}) do |hash, line| File.read(filename).split("\n").inject({}) do |hash, line|
if line =~ /\A([A-Za-z_]+)=(.*)\z/ if line =~ /\A([A-Za-z_0-9]+)=(.*)\z/
hash[$1] = $2 hash[$1] = $2
end end
hash hash
+1 -1
View File
@@ -1,5 +1,5 @@
module Foreman module Foreman
VERSION = "0.24.0" VERSION = "0.25.0"
end end
+9
View File
@@ -26,6 +26,15 @@ describe "Foreman::CLI" do
end end
describe "export" do describe "export" do
describe "options" do
it "respects --env" do
write_procfile
write_env("envfile")
mock.instance_of(Foreman::Export::Upstart).export("/upstart", { "env" => "envfile" })
foreman %{ export upstart /upstart --env envfile }
end
end
describe "with a non-existent Procfile" do describe "with a non-existent Procfile" do
it "prints an error" do it "prints an error" do
mock_error(subject, "Procfile does not exist.") do mock_error(subject, "Procfile does not exist.") do
+10
View File
@@ -12,6 +12,10 @@ def mock_error(subject, message)
end end
end end
def foreman(args)
Foreman::CLI.start(args.split(" "))
end
def mock_exit(&block) def mock_exit(&block)
block.should raise_error(SystemExit) block.should raise_error(SystemExit)
end end
@@ -33,6 +37,12 @@ def write_procfile(procfile="Procfile")
File.expand_path(procfile) File.expand_path(procfile)
end end
def write_env(env=".env")
File.open(env, "w") do |file|
file.puts "FOO=bar"
end
end
def load_export_templates_into_fakefs(type) def load_export_templates_into_fakefs(type)
FakeFS.deactivate! FakeFS.deactivate!
files = Dir[File.expand_path("../../data/export/#{type}/**", __FILE__)].inject({}) do |hash, file| files = Dir[File.expand_path("../../data/export/#{type}/**", __FILE__)].inject({}) do |hash, file|