blazing-whenever 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,11 +23,11 @@ options have precedence over recipe options.
23
23
  # Options:
24
24
  #
25
25
  # :app (specify the app name, defaults to pwd name)
26
- # :rails_env (specify the rails environment)
26
+ # :targets (specify the targets this recipes runs on, can be array)
27
27
  #
28
28
  # Example:
29
29
 
30
- recipe :update_crontab, :rails_env => 'production'
30
+ recipe :update_crontab, :targets => :production
31
31
  ```
32
32
 
33
33
  Authors
@@ -17,6 +17,6 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency "blazing", '>= 0.2.9'
20
+ s.add_dependency "blazing", '>= 0.3.0'
21
21
  s.add_dependency "whenever"
22
22
  end
@@ -4,7 +4,8 @@ class Blazing::Recipe::UpdateCrontab < Blazing::Recipe
4
4
 
5
5
  def run(target_options = {})
6
6
  super target_options
7
-
7
+
8
+ return if options[:targets] && !Array(options[:targets]).include?(target_options[:target_name])
8
9
  info "updating crontab"
9
10
  system "bundle exec whenever --update-crontab #{application} --set #{variables}"
10
11
  end
@@ -1,5 +1,5 @@
1
1
  module Blazing
2
2
  module Whenever
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
@@ -8,16 +8,18 @@ describe Blazing::Recipe::UpdateCrontab do
8
8
 
9
9
  describe 'run' do
10
10
 
11
- before :each do
11
+ it 'should call whenever for updating crontab with params' do
12
12
  @recipe = Blazing::Recipe::UpdateCrontab.new(:app => 'testing', :rails_env => 'development')
13
13
  @recipe.stub(:info)
14
- end
15
-
16
- it 'calls whenever for updating crontab with params' do
17
14
  @recipe.should_receive(:system).with("bundle exec whenever --update-crontab testing --set environment=development")
18
15
  @recipe.run
19
16
  end
20
17
 
18
+ it 'should return early if targets is set and does not include current target' do
19
+ @recipe = Blazing::Recipe::UpdateCrontab.new(:app => 'testing', :rails_env => 'development', :targets => :production)
20
+ @recipe.should_not_receive(:system)
21
+ @recipe.run(:target_name => :development)
22
+ end
21
23
  end
22
24
 
23
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blazing-whenever
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-06 00:00:00.000000000 Z
12
+ date: 2013-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blazing
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.2.9
21
+ version: 0.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.2.9
29
+ version: 0.3.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: whenever
32
32
  requirement: !ruby/object:Gem::Requirement