guard-rack 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -16
- data/.rubocop_todo.yml +33 -0
- data/.travis.yml +12 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +8 -12
- data/Guardfile +2 -2
- data/README.md +1 -1
- data/Rakefile +2 -3
- data/guard-rack.gemspec +17 -17
- data/lib/guard/rack.rb +12 -12
- data/lib/guard/rack/runner.rb +2 -2
- data/lib/guard/rack/templates/Guardfile +0 -1
- data/lib/guard/rack/version.rb +1 -1
- data/spec/lib/guard/integration_spec.rb +3 -3
- data/spec/lib/guard/rack_spec.rb +2 -3
- data/spec/lib/guard/runner_spec.rb +15 -15
- data/spec/spec_helper.rb +2 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b49da0e890d6242a516c5c1205aaf14bbd44d45d
|
4
|
+
data.tar.gz: 9be5c0c5f25a654819c6b508ba0eebe29ffc9ec6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bbde5d25b4b00a0cead05ce62deea1ab1b2409f239d94a09463f56f1a08bc81149ffbab1c22c456806f285bd36c1c24da9b0941b72486f0f631856f2d67b3b2
|
7
|
+
data.tar.gz: f40a9827262d2280cf9804433e2dae808de16ef060b0c010b532f2057362fc27243bd9885abd9532386bb1e7ac40ce1e47e3cdff11850ae3f073cda76ae2d151
|
data/.rubocop.yml
CHANGED
@@ -3,19 +3,4 @@ AllCops:
|
|
3
3
|
- vendor/**
|
4
4
|
- bin/**
|
5
5
|
|
6
|
-
|
7
|
-
Enabled: false
|
8
|
-
|
9
|
-
MethodLength:
|
10
|
-
Enabled: false
|
11
|
-
|
12
|
-
ClassLength:
|
13
|
-
Enabled: false
|
14
|
-
|
15
|
-
Documentation:
|
16
|
-
# don't require classes to be documented
|
17
|
-
Enabled: false
|
18
|
-
|
19
|
-
Encoding:
|
20
|
-
# no need to always specify encoding
|
21
|
-
Enabled: false
|
6
|
+
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-11-14 17:38:24 -0500 using RuboCop version 0.27.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 2
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Max: 22
|
11
|
+
|
12
|
+
# Offense count: 14
|
13
|
+
# Configuration parameters: AllowURI, URISchemes.
|
14
|
+
Metrics/LineLength:
|
15
|
+
Max: 155
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# Configuration parameters: CountComments.
|
19
|
+
Metrics/MethodLength:
|
20
|
+
Max: 17
|
21
|
+
|
22
|
+
# Offense count: 3
|
23
|
+
Style/Documentation:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
# Offense count: 1
|
27
|
+
# Configuration parameters: Exclude.
|
28
|
+
Style/FileName:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
# Offense count: 3
|
32
|
+
Style/RegexpLiteral:
|
33
|
+
MaxSlashes: 0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
2.0.0 (11/15/2014)
|
2
|
+
==================
|
3
|
+
|
4
|
+
* Upgraded to Guard 2.x - [@jdurand](https://github.com/jdurand).
|
5
|
+
* Upgraded RuboCop to 0.27.1 - [@dblock](https://github.com/dblock).
|
6
|
+
* Upgraded RSpec to 3.x - [@dblock](https://github.com/dblock).
|
7
|
+
|
1
8
|
1.4.0 (1/28/2014)
|
2
9
|
=================
|
3
10
|
|
data/Gemfile
CHANGED
@@ -1,20 +1,16 @@
|
|
1
|
-
source
|
1
|
+
source 'http://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
gem
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'ffi'
|
6
|
+
gem 'spoon'
|
7
|
+
gem 'guard', '~> 2.3.0'
|
6
8
|
|
7
9
|
group :development, :test do
|
8
|
-
gem
|
9
|
-
gem "bundler"
|
10
|
-
gem "rspec"
|
11
|
-
gem "guard-rspec"
|
12
|
-
gem "fakefs"
|
13
|
-
gem "mocha"
|
14
|
-
gem "rack"
|
10
|
+
gem 'guard-rspec', '~> 4.2.5'
|
15
11
|
gem 'growl'
|
16
12
|
gem 'rb-inotify', require: false
|
17
13
|
gem 'rb-fsevent', require: false
|
18
14
|
gem 'rb-fchange', require: false
|
19
|
-
gem 'rubocop'
|
15
|
+
gem 'rubocop', '0.27.1'
|
20
16
|
end
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -31,5 +31,5 @@ Copyright and License
|
|
31
31
|
|
32
32
|
MIT License, see [LICENSE](http://github.com/dblock/guard-rack/raw/master/LICENSE.md) for details.
|
33
33
|
|
34
|
-
(c) 2012 [Daniel Doubrovkine](http://github.com/dblock)
|
34
|
+
(c) 2012-2014 [Daniel Doubrovkine](http://github.com/dblock) and [Contributors](https://github.com/dblock/guard-rack/graphs/contributors).
|
35
35
|
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ begin
|
|
7
7
|
Bundler.setup(:default, :development)
|
8
8
|
rescue Bundler::BundlerError => e
|
9
9
|
$stderr.puts e.message
|
10
|
-
$stderr.puts
|
10
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
11
11
|
exit e.status_code
|
12
12
|
end
|
13
13
|
|
@@ -21,7 +21,6 @@ end
|
|
21
21
|
|
22
22
|
require 'rainbow/ext/string' unless String.respond_to?(:color)
|
23
23
|
require 'rubocop/rake_task'
|
24
|
-
|
24
|
+
RuboCop::RakeTask.new(:rubocop)
|
25
25
|
|
26
26
|
task default: [:rubocop, :spec]
|
27
|
-
|
data/guard-rack.gemspec
CHANGED
@@ -2,29 +2,29 @@
|
|
2
2
|
require File.expand_path('../lib/guard/rack/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = [
|
5
|
+
gem.authors = ['Daniel Doubrovkine']
|
6
6
|
|
7
|
-
gem.email = [
|
8
|
-
gem.description =
|
9
|
-
gem.homepage =
|
7
|
+
gem.email = ['dblock@dblock.org']
|
8
|
+
gem.description = 'Automatically reloads your Rack based app on file change using Guard.'
|
9
|
+
gem.homepage = 'https://github.com/dblock/guard-rack'
|
10
10
|
gem.summary = gem.description
|
11
11
|
gem.license = 'MIT'
|
12
12
|
|
13
|
-
gem.name =
|
14
|
-
gem.require_paths = [
|
13
|
+
gem.name = 'guard-rack'
|
14
|
+
gem.require_paths = ['lib']
|
15
15
|
gem.files = `git ls-files`.split("\n")
|
16
16
|
gem.version = Guard::RackVersion::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency
|
19
|
-
gem.add_dependency
|
20
|
-
gem.add_dependency
|
21
|
-
gem.add_dependency
|
22
|
-
gem.add_dependency
|
18
|
+
gem.add_dependency 'guard', '~> 2.3'
|
19
|
+
gem.add_dependency 'ffi'
|
20
|
+
gem.add_dependency 'spoon'
|
21
|
+
gem.add_dependency 'rb-inotify'
|
22
|
+
gem.add_dependency 'libnotify'
|
23
23
|
|
24
|
-
gem.add_development_dependency
|
25
|
-
gem.add_development_dependency
|
26
|
-
gem.add_development_dependency
|
27
|
-
gem.add_development_dependency
|
28
|
-
gem.add_development_dependency
|
29
|
-
gem.add_development_dependency
|
24
|
+
gem.add_development_dependency 'rake'
|
25
|
+
gem.add_development_dependency 'bundler'
|
26
|
+
gem.add_development_dependency 'rspec', '~> 3.0'
|
27
|
+
gem.add_development_dependency 'fakefs'
|
28
|
+
gem.add_development_dependency 'mocha', '~> 1.1'
|
29
|
+
gem.add_development_dependency 'rack'
|
30
30
|
end
|
data/lib/guard/rack.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
require 'guard'
|
2
|
-
require 'guard/
|
2
|
+
require 'guard/plugin'
|
3
3
|
require 'guard/rack/runner'
|
4
4
|
require 'rbconfig'
|
5
5
|
|
6
6
|
module Guard
|
7
|
-
class Rack < ::Guard::
|
7
|
+
class Rack < ::Guard::Plugin
|
8
8
|
attr_reader :options, :runner
|
9
9
|
|
10
10
|
DEFAULT_OPTIONS = {
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
port: 9292,
|
12
|
+
environment: 'development',
|
13
|
+
start_on_start: true,
|
14
|
+
force_run: false,
|
15
|
+
timeout: 20,
|
16
|
+
debugger: false,
|
17
|
+
config: 'config.ru'
|
18
|
+
}
|
19
19
|
|
20
|
-
def initialize(
|
20
|
+
def initialize(options = {})
|
21
21
|
super
|
22
22
|
@options = DEFAULT_OPTIONS.merge(options)
|
23
23
|
@runner = ::Guard::RackRunner.new(@options)
|
@@ -46,7 +46,7 @@ module Guard
|
|
46
46
|
runner.stop
|
47
47
|
end
|
48
48
|
|
49
|
-
def run_on_changes(
|
49
|
+
def run_on_changes(_paths)
|
50
50
|
reload
|
51
51
|
end
|
52
52
|
end
|
data/lib/guard/rack/runner.rb
CHANGED
@@ -37,7 +37,7 @@ module Guard
|
|
37
37
|
private
|
38
38
|
|
39
39
|
def build_rack_command
|
40
|
-
command = %w
|
40
|
+
command = %w(rackup)
|
41
41
|
command.push(
|
42
42
|
options[:config],
|
43
43
|
'--env', options[:environment].to_s,
|
@@ -90,7 +90,7 @@ module Guard
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def unmanaged_pid
|
93
|
-
|
93
|
+
`lsof -n -i TCP:#{options[:port]}`.each_line do |line|
|
94
94
|
return line.split("\s")[1].to_i if line["*:#{options[:port]} "]
|
95
95
|
end
|
96
96
|
nil
|
data/lib/guard/rack/version.rb
CHANGED
@@ -8,10 +8,10 @@ describe 'Integration' do
|
|
8
8
|
describe '#start' do
|
9
9
|
context 'run' do
|
10
10
|
it 'should run' do
|
11
|
-
runner.start.
|
11
|
+
expect(runner.start).to be_truthy
|
12
12
|
pid = runner.pid
|
13
|
-
pid.
|
14
|
-
Process.getpgid(pid).
|
13
|
+
expect(pid).not_to be_nil
|
14
|
+
expect(Process.getpgid(pid)).to be > 0
|
15
15
|
runner.stop
|
16
16
|
expect do
|
17
17
|
Process.getpgid(pid)
|
data/spec/lib/guard/rack_spec.rb
CHANGED
@@ -2,15 +2,14 @@ require 'spec_helper'
|
|
2
2
|
require 'guard/rack'
|
3
3
|
|
4
4
|
describe Guard::Rack do
|
5
|
-
let(:guard) { Guard::Rack.new(
|
6
|
-
let(:watchers) { [] }
|
5
|
+
let(:guard) { Guard::Rack.new(options) }
|
7
6
|
let(:options) { {} }
|
8
7
|
|
9
8
|
describe '#initialize' do
|
10
9
|
it 'should initialize with options' do
|
11
10
|
guard
|
12
11
|
|
13
|
-
guard.runner.options[:port].
|
12
|
+
expect(guard.runner.options[:port]).to eq(9292)
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
@@ -23,13 +23,13 @@ describe Guard::RackRunner do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should not be nil' do
|
26
|
-
runner.pid.
|
26
|
+
expect(runner.pid).to eq(pid)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
context 'before running' do
|
31
31
|
it 'should return nil' do
|
32
|
-
runner.pid.
|
32
|
+
expect(runner.pid).to be_nil
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -37,7 +37,7 @@ describe Guard::RackRunner do
|
|
37
37
|
describe '#build_rack_command' do
|
38
38
|
context 'no daemon' do
|
39
39
|
it 'should not have a daemon switch' do
|
40
|
-
runner.send(:build_rack_command).
|
40
|
+
expect(runner.send(:build_rack_command)).not_to include('--daemonize')
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -45,7 +45,7 @@ describe Guard::RackRunner do
|
|
45
45
|
let(:options) { default_options.merge(daemon: true) }
|
46
46
|
|
47
47
|
it 'should have a daemon switch' do
|
48
|
-
runner.send(:build_rack_command).
|
48
|
+
expect(runner.send(:build_rack_command)).to include('--daemonize')
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -53,7 +53,7 @@ describe Guard::RackRunner do
|
|
53
53
|
let(:options) { default_options.merge(debugger: true) }
|
54
54
|
|
55
55
|
it 'should have a debugger switch' do
|
56
|
-
runner.send(:build_rack_command).
|
56
|
+
expect(runner.send(:build_rack_command)).to include('--debug')
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -63,15 +63,15 @@ describe Guard::RackRunner do
|
|
63
63
|
it 'should honour server switch' do
|
64
64
|
command = runner.send(:build_rack_command)
|
65
65
|
index = command.index('--server')
|
66
|
-
index.
|
67
|
-
command[index + 1].
|
66
|
+
expect(index).to be >= 0
|
67
|
+
expect(command[index + 1]).to eq('thin')
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
context 'config file' do
|
72
72
|
context 'default' do
|
73
73
|
it 'should default to config.ru' do
|
74
|
-
runner.send(:build_rack_command).
|
74
|
+
expect(runner.send(:build_rack_command)).to include('config.ru')
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -79,7 +79,7 @@ describe Guard::RackRunner do
|
|
79
79
|
let(:options) { default_options.merge(config: 'config2.ru') }
|
80
80
|
it 'should honour config option' do
|
81
81
|
default_options.merge(config: 'config2.ru')
|
82
|
-
runner.send(:build_rack_command).
|
82
|
+
expect(runner.send(:build_rack_command)).to include('config2.ru')
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -101,7 +101,7 @@ describe Guard::RackRunner do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
it 'should act properly' do
|
104
|
-
runner.start.
|
104
|
+
expect(runner.start).to be_truthy
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
@@ -114,7 +114,7 @@ describe Guard::RackRunner do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'should act properly' do
|
117
|
-
runner.start.
|
117
|
+
expect(runner.start).to be_truthy
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -140,7 +140,7 @@ describe Guard::RackRunner do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
it 'should return true' do
|
143
|
-
runner.stop.
|
143
|
+
expect(runner.stop).to be_truthy
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
@@ -152,7 +152,7 @@ describe Guard::RackRunner do
|
|
152
152
|
end
|
153
153
|
|
154
154
|
it 'should return false' do
|
155
|
-
runner.stop.
|
155
|
+
expect(runner.stop).to be_falsey
|
156
156
|
end
|
157
157
|
|
158
158
|
it 'should send some kind of message to UI.info' do
|
@@ -169,7 +169,7 @@ describe Guard::RackRunner do
|
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'should return false' do
|
172
|
-
runner.stop.
|
172
|
+
expect(runner.stop).to be_falsey
|
173
173
|
end
|
174
174
|
|
175
175
|
it 'should send some kind of message to UI.info' do
|
@@ -181,7 +181,7 @@ describe Guard::RackRunner do
|
|
181
181
|
|
182
182
|
context 'pid does not exist' do
|
183
183
|
it 'should return true' do
|
184
|
-
runner.stop.
|
184
|
+
expect(runner.stop).to be_truthy
|
185
185
|
end
|
186
186
|
end
|
187
187
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -2,8 +2,9 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
2
2
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
3
|
|
4
4
|
require 'guard-rack'
|
5
|
-
require '
|
5
|
+
require 'mocha/api'
|
6
6
|
|
7
7
|
RSpec.configure do |c|
|
8
8
|
c.mock_with :mocha
|
9
|
+
c.raise_errors_for_deprecations!
|
9
10
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ffi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
117
|
+
version: '3.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
124
|
+
version: '3.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: fakefs
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,16 +140,16 @@ dependencies:
|
|
140
140
|
name: mocha
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ~>
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '1.1'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ~>
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '1.1'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rack
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,6 +174,7 @@ files:
|
|
174
174
|
- .gitignore
|
175
175
|
- .rspec
|
176
176
|
- .rubocop.yml
|
177
|
+
- .rubocop_todo.yml
|
177
178
|
- .travis.yml
|
178
179
|
- CHANGELOG.md
|
179
180
|
- Gemfile
|