Skip to content

Commit

Permalink
Merge pull request ddollar#515 from rasky/fix_run_unknown_options
Browse files Browse the repository at this point in the history
Do not parse options after "run" argument, to avoid conflicts.
  • Loading branch information
ddollar committed Jan 17, 2015
2 parents 6b66898 + 901ae47 commit 339ff1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/foreman/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def check
desc "run COMMAND [ARGS...]", "Run a command using your application's environment"

method_option :env, :type => :string, :aliases => "-e", :desc => "Specify an environment file to load, defaults to .env"
stop_on_unknown_option! :run

def run(*args)
load_environment!
Expand Down
6 changes: 5 additions & 1 deletion spec/foreman/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@
expect(forked_foreman("run echo 1")).to eq("1\n")
end

it "doesn't parse options for the command" do
expect(forked_foreman("run grep -e FOO #{resource_path(".env")}")).to eq("FOO=bar\n")
end

it "includes the environment" do
expect(forked_foreman("run #{resource_path("bin/env FOO")} -e #{resource_path(".env")}")).to eq("bar\n")
expect(forked_foreman("run -e #{resource_path(".env")} #{resource_path("bin/env FOO")}")).to eq("bar\n")
end

it "can run a command from the Procfile" do
Expand Down

0 comments on commit 339ff1d

Please sign in to comment.