guard-puma 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81c0c0cd4e8ab842c0781c27076ea8d84a78e13d
4
- data.tar.gz: d70318306ba358549a3a93a1a911d5b22555494f
3
+ metadata.gz: 2e00ac65e68f7b4921cfa5a02bc117182de5c0d9
4
+ data.tar.gz: ad040e3870595a66d6aae79cace22b5a59d6ef4f
5
5
  SHA512:
6
- metadata.gz: eab367b5fa5f6812fbe5bf281903c3e4a512bab5387395558b2f2034544a3c5e1056e85e99fecac89238bea4743103ec323c579f4c5a3678b14dafd5dc232c0b
7
- data.tar.gz: 0e4f4fa6a6ab8a93fe6116d77da8112050f872757464158ba6b932e718b51deb9f98cc62dc7195ce83bbabde085f005512122552765d8c70d918878e3d108085
6
+ metadata.gz: 493b03f73a243ceb4c4a8a6542d80f8e7c5be67a94b83383e80bf064f136918ddb0c37500d1eccb5cfa61a897e9432f876ef28acb87c436c733f5bd8751a2ad4
7
+ data.tar.gz: 3ec94f2e799ed2a9a8148289a13673118a97c5b62d85e6d7d655b0db0f5dae85f77a2f79011244d68cec92d36df011a3b2765d857f91ebca851833179da50839
data/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changes
2
2
 
3
+ ## 0.4.0
4
+
5
+ * Support Windows with custom start command. Via #29
6
+
7
+ ## 0.3.6
8
+
9
+ * Use a secure random token by default for the control token. Fixes #23
10
+
3
11
  ## 0.3.5
4
12
 
5
13
  * If puma crashed don't fail when trying to restart. Fixes #22
data/README.md CHANGED
@@ -54,3 +54,11 @@ end
54
54
  1. Commit your changes (`git commit -am 'Added some feature'`)
55
55
  1. Push to the branch (`git push origin my-new-feature`)
56
56
  1. Create new Pull Request
57
+
58
+ ## Releasing
59
+
60
+ 1. Update [changelog](CHANGES.md)
61
+ 1. Bump version in `lib/guard/puma/version.rb`
62
+ 1. Commit
63
+ 1. `gem build guard-puma.gemspec`
64
+ 1. `gem push guard-puma-VERSION.gem`
@@ -40,7 +40,11 @@ module Guard
40
40
  end
41
41
 
42
42
  def start
43
- system %{sh -c 'cd #{Dir.pwd} && puma #{cmd_opts} &'}
43
+ if in_windows_cmd?
44
+ Kernel.system windows_start_cmd
45
+ else
46
+ Kernel.system nix_start_cmd
47
+ end
44
48
  end
45
49
 
46
50
  def halt
@@ -76,5 +80,17 @@ module Guard
76
80
  URI "http://#{control_url}/#{cmd}?token=#{control_token}"
77
81
  end
78
82
 
83
+ def nix_start_cmd
84
+ %{sh -c 'cd #{Dir.pwd} && puma #{cmd_opts} &'}
85
+ end
86
+
87
+ def windows_start_cmd
88
+ %{cd "#{Dir.pwd}" && start "" /B cmd /C "puma #{cmd_opts}"}
89
+ end
90
+
91
+ def in_windows_cmd?
92
+ ENV['SHELL'].nil? && !ENV['COMSPEC'].nil?
93
+ end
94
+
79
95
  end
80
96
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module PumaVersion
3
- VERSION = "0.3.6"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'guard/puma/runner'
3
+ require 'pry'
3
4
 
4
5
  describe Guard::PumaRunner do
5
6
  let(:runner) { Guard::PumaRunner.new(options) }
@@ -28,6 +29,31 @@ describe Guard::PumaRunner do
28
29
  end
29
30
  end
30
31
 
32
+ describe '#start' do
33
+ context "when on Windows" do
34
+ before do
35
+ allow(runner).to receive(:in_windows_cmd?).and_return(true)
36
+ allow(runner).to receive(:windows_start_cmd).and_return("echo 'windows'")
37
+ end
38
+
39
+ it "runs the Windows command" do
40
+ expect(Kernel).to receive(:system).with("echo 'windows'")
41
+ runner.start
42
+ end
43
+ end
44
+
45
+ context "when on *nix" do
46
+ before do
47
+ allow(runner).to receive(:nix_start_cmd).and_return("echo 'nix'")
48
+ end
49
+
50
+ it "runs the *nix command" do
51
+ expect(Kernel).to receive(:system).with("echo 'nix'")
52
+ runner.start
53
+ end
54
+ end
55
+ end
56
+
31
57
 
32
58
  describe '#sleep_time' do
33
59
  let(:timeout) { 30 }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-08 00:00:00.000000000 Z
11
+ date: 2017-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard