Class: Guard::Jasmine::CLI
- Inherits:
-
Thor
- Object
- Thor
- Guard::Jasmine::CLI
- Extended by:
- Util
- Defined in:
- lib/guard/jasmine/cli.rb
Overview
Small helper class to run the Jasmine runner_options once from the command line. This can be useful to integrate guard-jasmine into a continuous integration server.
This outputs the specdoc and disables any notifications.
Instance Method Summary (collapse)
-
- (Object) spec(*paths)
Run the Guard::Jasmine::Runner with options from the command line.
-
- (Object) version
Shows the current version of Guard::Jasmine.
Methods included from Util
find_free_server_port, phantomjs_bin_valid?, runner_available?, which
Instance Method Details
- (Object) spec(*paths)
Run the Guard::Jasmine::Runner with options from the command line.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/guard/jasmine/cli.rb', line 140 def spec(*paths) paths = [.spec_dir] if paths.empty? = { } [:port] = .port || CLI.find_free_server_port [:jasmine_url] = .url || "http://localhost:#{ [:port] }#{ .server.to_sym == :jasmine_gem ? '/' : '/jasmine' }" [:phantomjs_bin] = .bin || CLI.which('phantomjs') [:timeout] = .timeout [:verbose] = .verbose [:server] = .server.to_sym [:server_env] = .server_env [:server_timeout] = .server_timeout [:rackup_config] = .rackup_config [:spec_dir] = .spec_dir [:console] = [:always, :never, :failure].include?(.console.to_sym) ? .console.to_sym : :failure [:errors] = [:always, :never, :failure].include?(.errors.to_sym) ? .errors.to_sym : :failure [:specdoc] = [:always, :never, :failure].include?(.specdoc.to_sym) ? .specdoc.to_sym : :always [:focus] = .focus [:coverage] = .coverage || .coverage_html || .coverage_summary [:coverage_html] = .coverage_html [:coverage_summary] = .coverage_summary [:statements_threshold] = .statements_threshold [:functions_threshold] = .functions_threshold [:branches_threshold] = .branches_threshold [:lines_threshold] = .lines_threshold [:notification] = false [:hide_success] = true [:max_error_notify] = 0 if CLI.phantomjs_bin_valid?([:phantomjs_bin]) catch(:task_has_failed) do ::Guard::Jasmine::Server.start() unless [:server] == :none end if CLI.runner_available?() result = ::Guard::Jasmine::Runner.run(paths, ) ::Guard::Jasmine::Server.stop Process.exit result.first ? 0 : 1 else ::Guard::Jasmine::Server.stop Process.exit 2 end else Process.exit 2 end rescue => e ::Guard::UI.error e. Process.exit 2 end |
- (Object) version
Shows the current version of Guard::Jasmine.
200 201 202 |
# File 'lib/guard/jasmine/cli.rb', line 200 def version ::Guard::UI.info "Guard::Jasmine version #{ ::Guard::JasmineVersion::VERSION }" end |