moneypools-whenever 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -39,7 +39,7 @@ module Whenever
39
39
  end
40
40
 
41
41
  def in_sequence(options={})
42
- @current_sequence = JobSequence.new(options)
42
+ @current_sequence = JobSequence.new(@options.merge(options))
43
43
  yield
44
44
  @jobs[@current_time_scope] << @current_sequence
45
45
  @current_sequence = nil
@@ -5,12 +5,15 @@ module Whenever
5
5
  def initialize(options={}, size=0, obj=nil)
6
6
  super(size, obj)
7
7
 
8
+ @options = options
8
9
  @dependent = options.fetch(:dependent, true)
9
10
  end
10
11
 
11
12
  def to_single_job
12
13
  concatenation = @dependent ? " && " : "; "
13
- Job::Default.new(:task => map(&:output).join(concatenation))
14
+ task = map(&:output).join(concatenation)
15
+
16
+ Job::Default.new(@options.merge(:task => task))
14
17
  end
15
18
  end
16
19
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{moneypools-whenever}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Javan Makhmali"]
@@ -1,6 +1,24 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
2
2
 
3
3
  class InSequenceTest < Test::Unit::TestCase
4
+ context "A single task in a sequence" do
5
+ setup do
6
+ @output = Whenever.cron \
7
+ <<-file
8
+ set :path, '/my/path'
9
+ every 1.day, :at => "20:15" do
10
+ in_sequence do
11
+ rake "only_task"
12
+ end
13
+ end
14
+ file
15
+ end
16
+
17
+ should "produce an unaltered task using options from every block" do
18
+ assert_match '15 20 * * * cd /my/path && RAILS_ENV=production /usr/bin/env rake only_task', @output
19
+ end
20
+ end
21
+
4
22
  context "A pair of tasks in the same time block that should be executed in a dependent sequence" do
5
23
  setup do
6
24
  @output = Whenever.cron \
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneypools-whenever
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javan Makhmali