Skip to content

Commit

Permalink
Merge pull request #16 from mkdynamic/patch-1
Browse files Browse the repository at this point in the history
Update cli runner for server_env option
  • Loading branch information
netzpirat committed Nov 30, 2011
2 parents f70aa05 + e4f2e44 commit e31867f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/guard/jasmine/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ class CLI < Thor
:default => 'failure',
:desc => 'Whether to show console.log statements in the spec runner, either `always`, `never` or `failure`'

method_option :server_env,
:type => :string,
:aliases => '-e',
:default => 'development',
:desc => 'The server environment to use, for example `development`, `test` etc.'

# Run the Guard::Jasmine::Runner with options from
# the command line.
#
Expand All @@ -69,6 +75,7 @@ def spec(*paths)
runner[:phantomjs_bin] = options.bin
runner[:timeout] = options.timeout
runner[:port] = options.port
runner[:server_env] = options.server_env
runner[:console] = [:always, :never, :failure].include?(options.console.to_sym) ? options.console.to_sym : :failure
runner[:server] = [:auto, :rack, :jasmine_gem, :none].include?(options.server.to_sym) ? options.server.to_sym : :auto

Expand All @@ -77,7 +84,7 @@ def spec(*paths)
runner[:max_error_notify] = 0
runner[:specdoc] = :always

::Guard::Jasmine::Server.start(runner[:server], runner[:port]) unless runner[:server] == :none
::Guard::Jasmine::Server.start(runner[:server], runner[:port], runner[:server_env]) unless runner[:server] == :none
result = ::Guard::Jasmine::Runner.run(paths, runner)

::Guard::Jasmine::Server.stop
Expand Down

0 comments on commit e31867f

Please sign in to comment.