guard-delayed 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fc570d910c387469972e88ba1cfd06b2a3f7d4c8
4
+ data.tar.gz: f193d241bad7c608187eb7cc908cf34896017ae0
5
+ SHA512:
6
+ metadata.gz: 634e7df86b944f6c96ff18a2ee005c444645683a1910326de9cf1f22dbe3a0f2785a97fcc2dd9242afd75adc59a3a09a53604eba0c607d29012e68e946e4ab32
7
+ data.tar.gz: 6e7a72a901ad612412cc70d1d4f063588b5f92c898e61d521477b3a5d2da7d7fa9d96095b30a07b8c00f0bf2c7d376b8389ad36efac58f1a40590eba1cec7701
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ guard-delayed
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.3
data/CHANGELOG.md CHANGED
@@ -1,34 +1,39 @@
1
+ ## 0.3.0 (2014-11-27)
2
+
3
+ * Upgraded to work with Guard 2.
4
+ * Merged option to add `root`.
5
+ * Added MIT licence to GemSpec.
6
+
1
7
  ## 0.2.1 (2012-12-10)
2
8
 
3
- * Fixed script/delayed\_job call when passing RAILS_ENV in dash shell (not sure if it happens with other ones)
9
+ * Fixed `script/delayed\_job` call when passing `RAILS_ENV` in dash shell (not sure if it happens with other ones).
4
10
 
5
11
  ## 0.2.0 (2012-07-04)
6
12
 
7
- * Merged pull request from @drewda to support guard 1.1
8
- * Minor doc changes.
9
-
13
+ * Merged pull request from @drewda to support guard 1.1
14
+ * Minor doc changes.
15
+
10
16
  ## 0.1.2 (2012-01-25)
11
17
 
12
- * Now passing the environment in using 'export RAILS\_ENV=test;' before calling script/delayed\_job
13
- Thanks to @rwz for this patch.
14
- * Added a meaningful spec that checks the system call using a mock. Much nicer!
18
+ * Now passing the environment in using 'export RAILS\_ENV=test;' before calling `script/delayed\_job`. Thanks to @rwz for this patch.
19
+ * Added a meaningful spec that checks the system call using a mock. Much nicer!
15
20
 
16
21
  ## 0.1.0 (2011-07-28)
17
22
 
18
- * Fixed options for current delayed_job version (from dbloete)
19
- * Environment settings needed to be passed in via RAILS_ENV=
20
-
23
+ * Fixed options for current delayed_job version (from dbloete)
24
+ * Environment settings needed to be passed in via `RAILS_ENV=xxx`
25
+
21
26
  ## 0.0.9 (2011-06-22)
22
27
 
23
- * Fixed argument passing to the start script
24
- * Cleaned up some documentation.
28
+ * Fixed argument passing to the start script
29
+ * Cleaned up some documentation.
25
30
 
26
31
  ## 0.0.8 (2011-05-24)
27
32
 
28
- * Changed template to include :environment => 'development'
29
- * Changed name from 'guard-delayed_job' to 'guard-delayed'
30
- * Fixed options passing
33
+ * Changed template to include `:environment => 'development'`
34
+ * Changed name from 'guard-delayed_job' to 'guard-delayed'
35
+ * Fixed options passing
31
36
 
32
37
  ## 0.0.3 (2011-05-23)
33
38
 
34
- * Initial release.
39
+ * Initial release.
data/Guardfile CHANGED
@@ -3,8 +3,8 @@ guard 'bundler' do
3
3
  watch(/^.+\.gemspec/)
4
4
  end
5
5
 
6
- guard 'rspec', :version => 2 do
7
- watch(/^spec\/.*_spec\.rb/)
8
- watch(/^lib\/(.*)\.rb/) { |m| "spec/#{m[1]}_spec.rb" }
9
- watch(/^spec\/spec_helper\.rb/) { "spec" }
6
+ guard :rspec, cmd: 'bundle exec rspec' do
7
+ watch(%r{^spec/.+_spec\.rb$})
8
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
+ watch('spec/spec_helper.rb') { "spec" }
10
10
  end
data/README.markdown CHANGED
@@ -6,11 +6,7 @@ Guard::Delayed automatically starts/stops/restarts delayed_job
6
6
 
7
7
  Please be sure to have [Guard](http://github.com/guard/guard) installed before continuing.
8
8
 
9
- Install the gem:
10
-
11
- gem install guard-delayed
12
-
13
- or add it to your Gemfile (inside your development and/or test group):
9
+ Add it to your Gemfile (inside your development and/or test group):
14
10
 
15
11
  gem 'guard-delayed'
16
12
 
@@ -22,8 +18,7 @@ Add guard definition to your Guardfile by running this command:
22
18
 
23
19
  Please read [Guard usage doc](http://github.com/guard/guard#readme).
24
20
 
25
- I suggest you put the delayed guard definition *before* your test/rspec guard if your tests depend on it
26
- being active.
21
+ I suggest you put the delayed guard definition *before* your test/rspec guard if your tests depend on it being active.
27
22
 
28
23
  ## Guardfile
29
24
 
@@ -44,16 +39,16 @@ Please create a topic branch for every separate change you make.
44
39
  * Update the version number in `lib/guard/delayed/version.rb`
45
40
  * Update `CHANGELOG.md`
46
41
  * Build the gem:
47
-
42
+
48
43
  gem build guard-delayed.gemspec
49
44
 
50
45
  * Push to rubygems.org:
51
-
52
- gem push guard-delayed-0.2.1.gem
46
+
47
+ gem push guard-delayed-0.3.3.gem
53
48
 
54
49
  ## Testing the gem locally
55
50
 
56
- gem install guard-delayed-0.2.1.gem
51
+ gem install guard-delayed-0.3.0.gem
57
52
 
58
53
 
59
54
  ## Authors
@@ -62,9 +57,3 @@ Please create a topic branch for every separate change you make.
62
57
  [Dennis Reimann](https://github.com/dbloete)
63
58
 
64
59
  Ideas for this gem came from [Guard::WEBrick](http://github.com/fnichol/guard-webrick).
65
-
66
- ## Note
67
-
68
- I originally called this `guard-delayed_job` but had all sorts of unexpected behaviour when trying to build the gem.
69
- After much fruitless investigation it appeared that the underscore was the problem, so I renamed it to `guard-delayed`.
70
- Anybody else encountered this? Let me know if you have. Thanks in advance.
@@ -11,18 +11,18 @@ Gem::Specification.new do |s|
11
11
  s.homepage = 'http://rubygems.org/gems/guard-delayed'
12
12
  s.summary = %q{guard gem for delayed_job}
13
13
  s.description = %q{Guard::Delayedjob automatically starts/stops/restarts delayed_job}
14
+ s.license = "MIT"
14
15
 
15
- s.required_rubygems_version = '>= 1.3.6'
16
+ s.required_rubygems_version = '>= 2.2'
16
17
  s.rubyforge_project = "guard-delayed"
17
-
18
- s.add_dependency 'guard', '> 0.3'
19
- s.add_dependency 'delayed_job'
20
- s.add_dependency 'daemons'
21
-
22
- s.add_development_dependency 'bundler', '> 1.0.10'
23
- s.add_development_dependency 'rspec', '> 2.5.0'
24
- s.add_development_dependency 'guard-rspec', '> 0.2.0'
25
- s.add_development_dependency 'guard-bundler', '> 0.1.1'
18
+
19
+ s.add_dependency 'guard', '~> 0'
20
+ s.add_dependency 'delayed_job', '~> 0'
21
+
22
+ s.add_development_dependency 'bundler', '~> 0'
23
+ s.add_development_dependency 'rspec', '~> 0'
24
+ s.add_development_dependency 'guard-rspec', '~> 0'
25
+ s.add_development_dependency 'guard-bundler', '~> 0'
26
26
 
27
27
  s.files = `git ls-files`.split("\n")
28
28
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/lib/guard/delayed.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  require 'guard'
2
- require 'guard/guard'
2
+ require 'guard/plugin'
3
3
 
4
4
  module Guard
5
- class Delayed < Guard
5
+ class Delayed < Plugin
6
6
 
7
7
  # Allowable options are:
8
8
  # :environment defaults to 'test'
@@ -15,9 +15,9 @@ module Guard
15
15
  # :sleep-delay N Amount of time to sleep in seconds when no jobs are found
16
16
  # :prefix NAME String to be prefixed to worker process names
17
17
 
18
- def initialize(watchers = [], options = {})
18
+ def initialize(options = {})
19
19
  @options = options
20
- super(watchers, options)
20
+ super
21
21
  end
22
22
 
23
23
  def start
@@ -67,6 +67,7 @@ module Guard
67
67
 
68
68
  def cmd
69
69
  command = "script/delayed_job"
70
+ command = "#{@options[:root]}/script/delayed_job" if @options[:root]
70
71
  command = "export RAILS_ENV=#{@options[:environment]}; #{command}" if @options[:environment]
71
72
  command
72
73
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module DelayedVersion
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -2,27 +2,52 @@ require 'spec_helper'
2
2
 
3
3
  describe Guard::Delayed do
4
4
  describe "when passing an environment option" do
5
- subject { Guard::Delayed.new([], {:environment => 'test'}) }
5
+ let(:subject) {Guard::Delayed.new({environment: 'test'})}
6
6
 
7
7
  it "calls system with 'export RAILS_ENV=test;' call first" do
8
- subject.should_receive(:system).with("export RAILS_ENV=test; script/delayed_job stop").and_return(true)
9
- subject.should_receive(:system).with("export RAILS_ENV=test; script/delayed_job start").and_return(true)
8
+ expect(subject).to receive(:system).with("export RAILS_ENV=test; script/delayed_job stop").and_return(true)
9
+ expect(subject).to receive(:system).with("export RAILS_ENV=test; script/delayed_job start").and_return(true)
10
10
  subject.start
11
11
  end
12
12
 
13
13
  it "calls system with 'export RAILS_ENV=test;' after changes" do
14
- subject.should_receive(:system).with("export RAILS_ENV=test; script/delayed_job restart").and_return(true)
14
+ expect(subject).to receive(:system).with("export RAILS_ENV=test; script/delayed_job restart").and_return(true)
15
15
  subject.run_on_changes([])
16
16
  end
17
17
 
18
18
  it "should raise an exception when system call fails" do
19
- subject.should_receive(:system).and_return(nil)
20
- lambda { subject.run_on_changes([]) }.should raise_error
19
+ expect(subject).to receive(:system).and_return(nil)
20
+ expect(-> {subject.run_on_changes([])}).to raise_error
21
21
  end
22
22
 
23
23
  it "should raise an exception when system command fails " do
24
- subject.should_receive(:system).and_return(false)
25
- lambda { subject.run_on_changes([]) }.should raise_error
24
+ expect(subject).to receive(:system).and_return(false)
25
+ expect(-> {subject.run_on_changes([]) }).to raise_error
26
+ end
27
+ end
28
+
29
+ describe "when passing a root option" do
30
+ subject { Guard::Delayed.new({:root => 'test/dummy'}) }
31
+
32
+ it "calls system in correct directory call first" do
33
+ expect(subject).to receive(:system).with("test/dummy/script/delayed_job stop").and_return(true)
34
+ expect(subject).to receive(:system).with("test/dummy/script/delayed_job start").and_return(true)
35
+ subject.start
36
+ end
37
+
38
+ it "calls system in correct directory after changes" do
39
+ expect(subject).to receive(:system).with("test/dummy/script/delayed_job restart").and_return(true)
40
+ subject.run_on_changes([])
41
+ end
42
+
43
+ it "should raise an exception when system call fails" do
44
+ expect(subject).to receive(:system).and_return(nil)
45
+ expect(-> {subject.run_on_changes([])}).to raise_error
46
+ end
47
+
48
+ it "should raise an exception when system command fails " do
49
+ expect(subject).to receive(:system).and_return(false)
50
+ expect(-> {subject.run_on_changes([])}).to raise_error
26
51
  end
27
52
  end
28
53
  end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,18 @@
1
- require 'rspec'
1
+ require 'rubygems'
2
2
  require 'guard/delayed'
3
+ require "rspec"
3
4
 
4
5
  ENV["GUARD_ENV"] = 'test'
5
6
 
7
+ Dir["#{File.expand_path('..', __FILE__)}/support/**/*.rb"].each { |f| require f }
8
+
6
9
  RSpec.configure do |config|
7
- config.color_enabled = true
10
+ config.filter_run focus: true
11
+ config.run_all_when_everything_filtered = true
12
+
13
+ config.before(:each) do
14
+ ::Guard::Notifier.stub(:notify).and_return(true)
15
+ @fixture_path = Pathname.new(File.expand_path('../fixtures/', __FILE__))
16
+ end
17
+
8
18
  end
metadata CHANGED
@@ -1,128 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-delayed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - David Parry
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-10 00:00:00.000000000 Z
11
+ date: 2014-11-27 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: guard
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>'
20
- - !ruby/object:Gem::Version
21
- version: '0.3'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>'
28
- - !ruby/object:Gem::Version
29
- version: '0.3'
30
- - !ruby/object:Gem::Dependency
31
- name: delayed_job
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
17
+ - - "~>"
36
18
  - !ruby/object:Gem::Version
37
19
  version: '0'
38
20
  type: :runtime
39
21
  prerelease: false
40
22
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
23
  requirements:
43
- - - ! '>='
24
+ - - "~>"
44
25
  - !ruby/object:Gem::Version
45
26
  version: '0'
46
27
  - !ruby/object:Gem::Dependency
47
- name: daemons
28
+ name: delayed_job
48
29
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
30
  requirements:
51
- - - ! '>='
31
+ - - "~>"
52
32
  - !ruby/object:Gem::Version
53
33
  version: '0'
54
34
  type: :runtime
55
35
  prerelease: false
56
36
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
37
  requirements:
59
- - - ! '>='
38
+ - - "~>"
60
39
  - !ruby/object:Gem::Version
61
40
  version: '0'
62
41
  - !ruby/object:Gem::Dependency
63
42
  name: bundler
64
43
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
44
  requirements:
67
- - - ! '>'
45
+ - - "~>"
68
46
  - !ruby/object:Gem::Version
69
- version: 1.0.10
47
+ version: '0'
70
48
  type: :development
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
51
  requirements:
75
- - - ! '>'
52
+ - - "~>"
76
53
  - !ruby/object:Gem::Version
77
- version: 1.0.10
54
+ version: '0'
78
55
  - !ruby/object:Gem::Dependency
79
56
  name: rspec
80
57
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
58
  requirements:
83
- - - ! '>'
59
+ - - "~>"
84
60
  - !ruby/object:Gem::Version
85
- version: 2.5.0
61
+ version: '0'
86
62
  type: :development
87
63
  prerelease: false
88
64
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
65
  requirements:
91
- - - ! '>'
66
+ - - "~>"
92
67
  - !ruby/object:Gem::Version
93
- version: 2.5.0
68
+ version: '0'
94
69
  - !ruby/object:Gem::Dependency
95
70
  name: guard-rspec
96
71
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
72
  requirements:
99
- - - ! '>'
73
+ - - "~>"
100
74
  - !ruby/object:Gem::Version
101
- version: 0.2.0
75
+ version: '0'
102
76
  type: :development
103
77
  prerelease: false
104
78
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
79
  requirements:
107
- - - ! '>'
80
+ - - "~>"
108
81
  - !ruby/object:Gem::Version
109
- version: 0.2.0
82
+ version: '0'
110
83
  - !ruby/object:Gem::Dependency
111
84
  name: guard-bundler
112
85
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
86
  requirements:
115
- - - ! '>'
87
+ - - "~>"
116
88
  - !ruby/object:Gem::Version
117
- version: 0.1.1
89
+ version: '0'
118
90
  type: :development
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
93
  requirements:
123
- - - ! '>'
94
+ - - "~>"
124
95
  - !ruby/object:Gem::Version
125
- version: 0.1.1
96
+ version: '0'
126
97
  description: Guard::Delayedjob automatically starts/stops/restarts delayed_job
127
98
  email:
128
99
  - david.parry@suranyami.com
@@ -130,7 +101,9 @@ executables: []
130
101
  extensions: []
131
102
  extra_rdoc_files: []
132
103
  files:
133
- - .gitignore
104
+ - ".gitignore"
105
+ - ".ruby-gemset"
106
+ - ".ruby-version"
134
107
  - CHANGELOG.md
135
108
  - Gemfile
136
109
  - Guardfile
@@ -144,28 +117,28 @@ files:
144
117
  - spec/guard/delayed_spec.rb
145
118
  - spec/spec_helper.rb
146
119
  homepage: http://rubygems.org/gems/guard-delayed
147
- licenses: []
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
148
123
  post_install_message:
149
124
  rdoc_options: []
150
125
  require_paths:
151
126
  - lib
152
127
  required_ruby_version: !ruby/object:Gem::Requirement
153
- none: false
154
128
  requirements:
155
- - - ! '>='
129
+ - - ">="
156
130
  - !ruby/object:Gem::Version
157
131
  version: '0'
158
132
  required_rubygems_version: !ruby/object:Gem::Requirement
159
- none: false
160
133
  requirements:
161
- - - ! '>='
134
+ - - ">="
162
135
  - !ruby/object:Gem::Version
163
- version: 1.3.6
136
+ version: '2.2'
164
137
  requirements: []
165
138
  rubyforge_project: guard-delayed
166
- rubygems_version: 1.8.24
139
+ rubygems_version: 2.2.2
167
140
  signing_key:
168
- specification_version: 3
141
+ specification_version: 4
169
142
  summary: guard gem for delayed_job
170
143
  test_files:
171
144
  - spec/guard/delayed_spec.rb