moneypools-whenever 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,3 +1,3 @@
1
1
  .DS_Store
2
2
  pkg
3
- docmoneypools-whenever.gemspec
3
+ doc
data/Rakefile CHANGED
@@ -29,4 +29,4 @@ end
29
29
 
30
30
  task :test => :check_dependencies
31
31
 
32
- task :default => :test
32
+ task :default => :test
@@ -10,10 +10,21 @@ module Whenever
10
10
  end
11
11
 
12
12
  def to_single_job
13
+ options = @options.dup
14
+ default_redirection = options.delete(:output)
15
+
13
16
  concatenation = @dependent ? " && " : "; "
14
- task = map(&:output).join(concatenation)
17
+ tasks_with_redirection = map do |t|
18
+ if redirection = t.output_redirection.nil? || t.output_redirection == :not_set ? default_redirection : t.output_redirection
19
+ t.output + " " + Output::Cron::OutputRedirection.new(redirection).to_s
20
+ else
21
+ t.output
22
+ end
23
+ end
24
+
25
+ single_task = tasks_with_redirection.join(concatenation)
15
26
 
16
- Job::Default.new(@options.merge(:task => task))
27
+ Job::Default.new(options.merge(:task => single_task))
17
28
  end
18
29
  end
19
- end
30
+ end
@@ -1,3 +1,3 @@
1
1
  module Whenever
2
- VERSION = '0.4.2'
3
- end unless defined?(Whenever::VERSION)
2
+ VERSION = '0.4.3'
3
+ end unless defined?(Whenever::VERSION)
@@ -19,6 +19,47 @@ class InSequenceTest < Test::Unit::TestCase
19
19
  end
20
20
  end
21
21
 
22
+ context "A pair of tasks in a sequence with output redirection" do
23
+ setup do
24
+ @output = Whenever.cron \
25
+ <<-file
26
+ set :path, '/my/path'
27
+ every 1.day, :at => "20:15" do
28
+ in_sequence do
29
+ rake "first_task", :output => 'logfile1'
30
+ rake "second_task", :output => 'logfile2'
31
+ end
32
+ end
33
+ file
34
+ end
35
+
36
+ should "produce a set of tasks using individual output options" do
37
+ assert_match 'rake first_task >> logfile1', @output
38
+ assert_match 'rake second_task >> logfile2', @output
39
+ end
40
+ end
41
+
42
+ context "A pair of tasks in a sequence with two levels of output redirection" do
43
+ setup do
44
+ @output = Whenever.cron \
45
+ <<-file
46
+ set :path, '/my/path'
47
+ every 1.day, :at => "20:15" do
48
+ in_sequence :output => 'fallthrough' do
49
+ rake "first_task"
50
+ rake "second_task", :output => 'logfile2'
51
+ end
52
+ end
53
+ file
54
+ end
55
+
56
+ should "use the sequence level redirection as a default" do
57
+ assert_match 'rake first_task >> fallthrough', @output
58
+ assert_match 'rake second_task >> logfile2', @output
59
+ end
60
+ end
61
+
62
+
22
63
  context "A pair of tasks in the same time block that should be executed in a dependent sequence" do
23
64
  setup do
24
65
  @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.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javan Makhmali
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-30 00:00:00 -06:00
12
+ date: 2009-12-03 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,6 @@ files:
50
50
  - lib/whenever/outputs/cron.rb
51
51
  - lib/whenever/outputs/cron/output_redirection.rb
52
52
  - lib/whenever/version.rb
53
- - moneypools-whenever.gemspec
54
53
  - test/command_line_test.rb
55
54
  - test/cron_test.rb
56
55
  - test/in_sequence_test.rb
@@ -63,7 +62,6 @@ files:
63
62
  - test/output_redirection_test.rb
64
63
  - test/output_runner_test.rb
65
64
  - test/test_helper.rb
66
- - whenever.gemspec
67
65
  has_rdoc: true
68
66
  homepage: http://github.com/javan/whenever
69
67
  licenses: []
@@ -1,86 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{moneypools-whenever}
8
- s.version = "0.4.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Javan Makhmali"]
12
- s.date = %q{2009-11-30}
13
- s.description = %q{Clean ruby syntax for defining and deploying messy cron jobs.}
14
- s.email = %q{javan@javan.us}
15
- s.executables = ["whenever", "wheneverize"]
16
- s.extra_rdoc_files = [
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- "CHANGELOG.rdoc",
22
- "README.rdoc",
23
- "Rakefile",
24
- "bin/whenever",
25
- "bin/wheneverize",
26
- "lib/whenever.rb",
27
- "lib/whenever/base.rb",
28
- "lib/whenever/command_line.rb",
29
- "lib/whenever/job_list.rb",
30
- "lib/whenever/job_sequence.rb",
31
- "lib/whenever/job_types/cap_task.rb",
32
- "lib/whenever/job_types/default.rb",
33
- "lib/whenever/job_types/rake_task.rb",
34
- "lib/whenever/job_types/runner.rb",
35
- "lib/whenever/outputs/cron.rb",
36
- "lib/whenever/outputs/cron/output_redirection.rb",
37
- "lib/whenever/version.rb",
38
- "moneypools-whenever.gemspec",
39
- "test/command_line_test.rb",
40
- "test/cron_test.rb",
41
- "test/in_sequence_test.rb",
42
- "test/job_sequence_test.rb",
43
- "test/output_at_test.rb",
44
- "test/output_cap_test.rb",
45
- "test/output_command_test.rb",
46
- "test/output_env_test.rb",
47
- "test/output_rake_test.rb",
48
- "test/output_redirection_test.rb",
49
- "test/output_runner_test.rb",
50
- "test/test_helper.rb",
51
- "whenever.gemspec"
52
- ]
53
- s.homepage = %q{http://github.com/javan/whenever}
54
- s.rdoc_options = ["--charset=UTF-8"]
55
- s.require_paths = ["lib"]
56
- s.rubygems_version = %q{1.3.5}
57
- s.summary = %q{Clean ruby syntax for defining and deploying messy cron jobs.}
58
- s.test_files = [
59
- "test/command_line_test.rb",
60
- "test/cron_test.rb",
61
- "test/in_sequence_test.rb",
62
- "test/job_sequence_test.rb",
63
- "test/output_at_test.rb",
64
- "test/output_cap_test.rb",
65
- "test/output_command_test.rb",
66
- "test/output_env_test.rb",
67
- "test/output_rake_test.rb",
68
- "test/output_redirection_test.rb",
69
- "test/output_runner_test.rb",
70
- "test/test_helper.rb"
71
- ]
72
-
73
- if s.respond_to? :specification_version then
74
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
75
- s.specification_version = 3
76
-
77
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
78
- s.add_runtime_dependency(%q<chronic>, [">= 0.2.3"])
79
- else
80
- s.add_dependency(%q<chronic>, [">= 0.2.3"])
81
- end
82
- else
83
- s.add_dependency(%q<chronic>, [">= 0.2.3"])
84
- end
85
- end
86
-
data/whenever.gemspec DELETED
@@ -1,77 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{whenever}
8
- s.version = "0.4.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Javan Makhmali"]
12
- s.date = %q{2009-11-30}
13
- s.description = %q{Clean ruby syntax for defining and deploying messy cron jobs.}
14
- s.email = %q{javan@javan.us}
15
- s.executables = ["whenever", "wheneverize"]
16
- s.extra_rdoc_files = [
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".gitignore",
21
- "CHANGELOG.rdoc",
22
- "README.rdoc",
23
- "Rakefile",
24
- "bin/whenever",
25
- "bin/wheneverize",
26
- "lib/whenever.rb",
27
- "lib/whenever/base.rb",
28
- "lib/whenever/command_line.rb",
29
- "lib/whenever/job_list.rb",
30
- "lib/whenever/job_types/default.rb",
31
- "lib/whenever/job_types/rake_task.rb",
32
- "lib/whenever/job_types/runner.rb",
33
- "lib/whenever/outputs/cron.rb",
34
- "lib/whenever/outputs/cron/output_redirection.rb",
35
- "lib/whenever/version.rb",
36
- "test/command_line_test.rb",
37
- "test/cron_test.rb",
38
- "test/output_at_test.rb",
39
- "test/output_command_test.rb",
40
- "test/output_env_test.rb",
41
- "test/output_rake_test.rb",
42
- "test/output_redirection_test.rb",
43
- "test/output_runner_test.rb",
44
- "test/test_helper.rb",
45
- "whenever.gemspec"
46
- ]
47
- s.homepage = %q{http://github.com/javan/whenever}
48
- s.rdoc_options = ["--charset=UTF-8"]
49
- s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.3.5}
51
- s.summary = %q{Clean ruby syntax for defining and deploying messy cron jobs.}
52
- s.test_files = [
53
- "test/command_line_test.rb",
54
- "test/cron_test.rb",
55
- "test/output_at_test.rb",
56
- "test/output_command_test.rb",
57
- "test/output_env_test.rb",
58
- "test/output_rake_test.rb",
59
- "test/output_redirection_test.rb",
60
- "test/output_runner_test.rb",
61
- "test/test_helper.rb"
62
- ]
63
-
64
- if s.respond_to? :specification_version then
65
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
66
- s.specification_version = 3
67
-
68
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
69
- s.add_runtime_dependency(%q<chronic>, [">= 0.2.3"])
70
- else
71
- s.add_dependency(%q<chronic>, [">= 0.2.3"])
72
- end
73
- else
74
- s.add_dependency(%q<chronic>, [">= 0.2.3"])
75
- end
76
- end
77
-