mguymon-whenever 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,77 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
2
+
3
+ class JobTest < Test::Unit::TestCase
4
+
5
+ context "A Job" do
6
+ should "return the :at set when #at is called" do
7
+ assert_equal 'foo', new_job(:at => 'foo').at
8
+ end
9
+
10
+ should "substitute the :task when #output is called" do
11
+ job = new_job(:template => ":task", :task => 'abc123')
12
+ assert_equal 'abc123', job.output
13
+ end
14
+
15
+ should "substitute the :path when #output is called" do
16
+ assert_equal 'foo', new_job(:template => ':path', :path => 'foo').output
17
+ end
18
+
19
+ should "substitute the :path with the default Whenever.path if none is provided when #output is called" do
20
+ Whenever.expects(:path).returns('/my/path')
21
+ assert_equal '/my/path', new_job(:template => ':path').output
22
+ end
23
+ end
24
+
25
+
26
+ context "A Job with quotes" do
27
+ should "output the :task if it's in single quotes" do
28
+ job = new_job(:template => "':task'", :task => 'abc123')
29
+ assert_equal %q('abc123'), job.output
30
+ end
31
+
32
+ should "output the :task if it's in double quotes" do
33
+ job = new_job(:template => '":task"', :task => 'abc123')
34
+ assert_equal %q("abc123"), job.output
35
+ end
36
+
37
+ should "output escaped single quotes in when it's wrapped in them" do
38
+ job = new_job(
39
+ :template => "before ':foo' after",
40
+ :foo => "quote -> ' <- quote"
41
+ )
42
+ assert_equal %q(before 'quote -> '\'' <- quote' after), job.output
43
+ end
44
+
45
+ should "output escaped double quotes when it's wrapped in them" do
46
+ job = new_job(
47
+ :template => 'before ":foo" after',
48
+ :foo => 'quote -> " <- quote'
49
+ )
50
+ assert_equal %q(before "quote -> \" <- quote" after), job.output
51
+ end
52
+ end
53
+
54
+ context "A Job with a job_template" do
55
+ should "use the job template" do
56
+ job = new_job(:template => ':task', :task => 'abc123', :job_template => 'left :job right')
57
+ assert_equal 'left abc123 right', job.output
58
+ end
59
+
60
+ should "escape single quotes" do
61
+ job = new_job(:template => "before ':task' after", :task => "quote -> ' <- quote", :job_template => "left ':job' right")
62
+ assert_equal %q(left 'before '\''quote -> '\\''\\'\\'''\\'' <- quote'\'' after' right), job.output
63
+ end
64
+
65
+ should "escape double quotes" do
66
+ job = new_job(:template => 'before ":task" after', :task => 'quote -> " <- quote', :job_template => 'left ":job" right')
67
+ assert_equal %q(left "before \"quote -> \\\" <- quote\" after" right), job.output
68
+ end
69
+ end
70
+
71
+ private
72
+
73
+ def new_job(options={})
74
+ Whenever::Job.new(options)
75
+ end
76
+
77
+ end
data/whenever.gemspec ADDED
@@ -0,0 +1,85 @@
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{mguymon-whenever}
8
+ s.version = "0.6.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{2010-10-26}
13
+ s.description = %q{Clean ruby syntax for writing and deploying cron jobs.}
14
+ s.email = %q{javan@javan.us}
15
+ s.executables = ["whenever", "wheneverize"]
16
+ s.extra_rdoc_files = [
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".gitignore",
21
+ "CHANGELOG.md",
22
+ "README.md",
23
+ "Rakefile",
24
+ "bin/whenever",
25
+ "bin/wheneverize",
26
+ "lib/whenever.rb",
27
+ "lib/whenever/capistrano.rb",
28
+ "lib/whenever/command_line.rb",
29
+ "lib/whenever/cron.rb",
30
+ "lib/whenever/job.rb",
31
+ "lib/whenever/job_list.rb",
32
+ "lib/whenever/output_redirection.rb",
33
+ "lib/whenever/setup.rb",
34
+ "lib/whenever/version.rb",
35
+ "test/functional/command_line_test.rb",
36
+ "test/functional/output_at_test.rb",
37
+ "test/functional/output_default_defined_jobs_test.rb",
38
+ "test/functional/output_defined_job_test.rb",
39
+ "test/functional/output_env_test.rb",
40
+ "test/functional/output_redirection_test.rb",
41
+ "test/test_helper.rb",
42
+ "test/unit/cron_test.rb",
43
+ "test/unit/job_test.rb",
44
+ "whenever.gemspec"
45
+ ]
46
+ s.homepage = %q{http://github.com/mguymon/whenever}
47
+ s.rdoc_options = ["--charset=UTF-8"]
48
+ s.require_paths = ["lib"]
49
+ s.rubygems_version = %q{1.3.7}
50
+ s.summary = %q{Write your cron jobs in ruby.}
51
+ s.test_files = [
52
+ "test/functional/command_line_test.rb",
53
+ "test/functional/output_at_test.rb",
54
+ "test/functional/output_default_defined_jobs_test.rb",
55
+ "test/functional/output_defined_job_test.rb",
56
+ "test/functional/output_env_test.rb",
57
+ "test/functional/output_redirection_test.rb",
58
+ "test/test_helper.rb",
59
+ "test/unit/cron_test.rb",
60
+ "test/unit/job_test.rb"
61
+ ]
62
+
63
+ if s.respond_to? :specification_version then
64
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
65
+ s.specification_version = 3
66
+
67
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
68
+ s.add_runtime_dependency(%q<aaronh-chronic>, [">= 0.3.9"])
69
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.4"])
70
+ s.add_development_dependency(%q<shoulda>, [">= 2.1.1"])
71
+ s.add_development_dependency(%q<mocha>, [">= 0.9.5"])
72
+ else
73
+ s.add_dependency(%q<aaronh-chronic>, [">= 0.3.9"])
74
+ s.add_dependency(%q<activesupport>, [">= 2.3.4"])
75
+ s.add_dependency(%q<shoulda>, [">= 2.1.1"])
76
+ s.add_dependency(%q<mocha>, [">= 0.9.5"])
77
+ end
78
+ else
79
+ s.add_dependency(%q<aaronh-chronic>, [">= 0.3.9"])
80
+ s.add_dependency(%q<activesupport>, [">= 2.3.4"])
81
+ s.add_dependency(%q<shoulda>, [">= 2.1.1"])
82
+ s.add_dependency(%q<mocha>, [">= 0.9.5"])
83
+ end
84
+ end
85
+
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mguymon-whenever
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.6.2
6
+ platform: ruby
7
+ authors:
8
+ - Javan Makhmali
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-02-04 00:00:00 -05:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: aaronh-chronic
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.3.9
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 2.3.4
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: shoulda
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.1.1
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: mocha
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 0.9.5
58
+ type: :development
59
+ version_requirements: *id004
60
+ description: Clean ruby syntax for writing and deploying cron jobs.
61
+ email: javan@javan.us
62
+ executables:
63
+ - whenever
64
+ - wheneverize
65
+ extensions: []
66
+
67
+ extra_rdoc_files:
68
+ - README.md
69
+ files:
70
+ - CHANGELOG.md
71
+ - README.md
72
+ - Rakefile
73
+ - bin/whenever
74
+ - bin/wheneverize
75
+ - lib/whenever.rb
76
+ - lib/whenever/capistrano.rb
77
+ - lib/whenever/command_line.rb
78
+ - lib/whenever/cron.rb
79
+ - lib/whenever/job.rb
80
+ - lib/whenever/job_list.rb
81
+ - lib/whenever/output_redirection.rb
82
+ - lib/whenever/setup.rb
83
+ - lib/whenever/version.rb
84
+ - mguymon-whenever.gemspec
85
+ - test/functional/command_line_test.rb
86
+ - test/functional/output_at_test.rb
87
+ - test/functional/output_default_defined_jobs_test.rb
88
+ - test/functional/output_defined_job_test.rb
89
+ - test/functional/output_env_test.rb
90
+ - test/functional/output_redirection_test.rb
91
+ - test/test_helper.rb
92
+ - test/unit/cron_test.rb
93
+ - test/unit/job_test.rb
94
+ - whenever.gemspec
95
+ has_rdoc: true
96
+ homepage: http://github.com/mguymon/whenever
97
+ licenses: []
98
+
99
+ post_install_message:
100
+ rdoc_options: []
101
+
102
+ require_paths:
103
+ - lib
104
+ required_ruby_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: "0"
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: "0"
116
+ requirements: []
117
+
118
+ rubyforge_project:
119
+ rubygems_version: 1.5.0
120
+ signing_key:
121
+ specification_version: 3
122
+ summary: Write your cron jobs in ruby.
123
+ test_files:
124
+ - test/functional/command_line_test.rb
125
+ - test/functional/output_at_test.rb
126
+ - test/functional/output_default_defined_jobs_test.rb
127
+ - test/functional/output_defined_job_test.rb
128
+ - test/functional/output_env_test.rb
129
+ - test/functional/output_redirection_test.rb
130
+ - test/test_helper.rb
131
+ - test/unit/cron_test.rb
132
+ - test/unit/job_test.rb