Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cli runner for server_env option #16

Merged
merged 1 commit into from
Nov 30, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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