From 3c4121670d67370a653c522e58625d7976c6025a Mon Sep 17 00:00:00 2001 From: Nathan Stitt Date: Tue, 19 Jun 2018 10:16:10 -0500 Subject: [PATCH 1/5] set ruby mode indent as well as enh --- .dir-locals.el | 1 + 1 file changed, 1 insertion(+) diff --git a/.dir-locals.el b/.dir-locals.el index 925b41c..56a5479 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,4 +1,5 @@ ((nil . ((enh-ruby-indent-level . 2) + (ruby-indent-level . 2) (js-indent-level . 2) (js2-basic-offset . 2) (prelude-clean-whitespace-on-save . nil) From e2cfb22b9e9704872bc9be77c18b133f2430c80f Mon Sep 17 00:00:00 2001 From: Nathan Stitt Date: Tue, 19 Jun 2018 10:16:21 -0500 Subject: [PATCH 2/5] update jasmine version to 3.x --- guard-jasmine.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guard-jasmine.gemspec b/guard-jasmine.gemspec index 2337bd9..ff81085 100644 --- a/guard-jasmine.gemspec +++ b/guard-jasmine.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |s| s.add_dependency 'guard', '~> 2.14' s.add_dependency 'guard-compat', '~> 1.2' - s.add_dependency 'jasmine', '~> 2.4' + s.add_dependency 'jasmine', '~> 3.1' s.add_dependency 'multi_json', '~> 1.12' s.add_dependency 'childprocess', '~> 0.5' s.add_dependency 'thor', '~> 0.19' From ad678366ca43ac3bb5fc67e7a466d082246905da Mon Sep 17 00:00:00 2001 From: Nathan Stitt Date: Tue, 19 Jun 2018 10:16:36 -0500 Subject: [PATCH 3/5] JASMINE_PORT env var is removed; set server_port on Jasmine config fixes #200 --- lib/guard/jasmine.rb | 3 +++ lib/guard/jasmine/server.rb | 2 +- spec/guard/jasmine_spec.rb | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/guard/jasmine.rb b/lib/guard/jasmine.rb index 6a2167b..a0d0479 100644 --- a/lib/guard/jasmine.rb +++ b/lib/guard/jasmine.rb @@ -103,6 +103,9 @@ def initialize(options = {}) self.last_run_failed = false self.last_failed_paths = [] + ::Jasmine.configure do |config| + config.server_port = options[:port] if options[:port] + end @runner = Runner.new(options.merge(run_all_options)) end diff --git a/lib/guard/jasmine/server.rb b/lib/guard/jasmine/server.rb index 5b28f8f..5d7d8a6 100644 --- a/lib/guard/jasmine/server.rb +++ b/lib/guard/jasmine/server.rb @@ -127,7 +127,7 @@ def start_unicorn_server(port, options) # def start_rake_server(port, task, options) Compat::UI.info "Guard::Jasmine starts Jasmine Gem test server on port #{port}." - execute(options, ['rake', task, "JASMINE_PORT=#{port}"]) + execute(options, ['rake', task]) end # Builds a child process with the given command and arguments diff --git a/spec/guard/jasmine_spec.rb b/spec/guard/jasmine_spec.rb index 8df309d..c53780b 100644 --- a/spec/guard/jasmine_spec.rb +++ b/spec/guard/jasmine_spec.rb @@ -49,6 +49,14 @@ expect(guard.options[:port]).to eql 9999 end + it 'port can be set' do + mock_config = OpenStruct.new + expect(::Jasmine).to receive(:configure).and_yield mock_config + guard = Guard::Jasmine.new(port: 12345) + expect(guard.options[:port]).to eql 12345 + expect(mock_config.server_port).to eql 12345 + end + it 'sets a default :rackup_config option' do expect(guard.options[:rackup_config]).to eql nil end From 08d5a7d9510ed9590ef82d2f2bc5a2df36c6bd08 Mon Sep 17 00:00:00 2001 From: Nathan Stitt Date: Tue, 19 Jun 2018 10:25:00 -0500 Subject: [PATCH 4/5] drop 2.2, add 2.4 & 2.5 --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4efc235..ca6400b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ language: ruby bundler_args: --without development rvm: - - 2.2.5 - - 2.3.1 + - 2.3 + - 2.4 + - 2.5 - jruby-9.0.5.0 - rbx matrix: From 26727ec0916912b76381a3b376145c9d9f444480 Mon Sep 17 00:00:00 2001 From: Nathan Stitt Date: Tue, 19 Jun 2018 10:32:17 -0500 Subject: [PATCH 5/5] mention tmp_restart conflict in README Fixes #199, thanks @quolpr --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 56e49b6..28759d6 100644 --- a/README.md +++ b/README.md @@ -620,6 +620,28 @@ Given your configuration, you could also need to set: * the server url in the command line: `bundle exec guard-jasmine -u http://localhost:8888/` + +## Notes + +Rails 5 ships with a puma configuration that may conflict with Guard Jasmine if they're both running concurrently. + +To work around this, the `tmp_restart` plugin in config/puma.rb needs to be disabled for development mode. + +```ruby +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart +``` + +To: + +```ruby +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart unless ENV['RAILS_ENV'] == 'development' +``` + +Thanks to `quolpr` for investigating and suggesting the fix in: https://github.com/guard/guard-jasmine/issues/199#issuecomment-292648860 + + ## Alternatives There are many ways to get your Jasmine specs run within a headless environment. If Guard::Jasmine isn't for you,