khronotab 1.3.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +14 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +5 -20
- data/Rakefile +37 -49
- data/VERSION +1 -1
- data/lib/khronotab/cron_job.rb +5 -0
- data/test/helper.rb +9 -2
- data/test/test_khronotab.rb +2 -7
- metadata +84 -35
- data/.gitignore +0 -5
- data/khronotab.gemspec +0 -74
- data/test/tc_cron_job_command-length.rb +0 -29
- data/test/tc_cron_job_different-time-arguments.rb +0 -56
- data/test/tc_cron_job_nil-checks.rb +0 -38
- data/test/ts_cron_job.rb +0 -4
- data/test/ts_cron_tab.rb +0 -1
- data/test/ts_cron_unit.rb +0 -1
- data/test/ts_cron_variable.rb +0 -1
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "bundler", "~> 1.0.0"
|
10
|
+
gem "jeweler", "~> 1.6.2"
|
11
|
+
gem "rcov", ">= 0"
|
12
|
+
gem "reek", "~> 1.2.8"
|
13
|
+
gem "roodi", "~> 2.1.0"
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
git (1.2.5)
|
5
|
+
jeweler (1.6.2)
|
6
|
+
bundler (~> 1.0)
|
7
|
+
git (>= 1.2.5)
|
8
|
+
rake
|
9
|
+
rake (0.9.2)
|
10
|
+
rcov (0.9.9)
|
11
|
+
reek (1.2.8)
|
12
|
+
ruby2ruby (~> 1.2)
|
13
|
+
ruby_parser (~> 2.0)
|
14
|
+
sexp_processor (~> 3.0)
|
15
|
+
roodi (2.1.0)
|
16
|
+
ruby_parser
|
17
|
+
ruby2ruby (1.2.5)
|
18
|
+
ruby_parser (~> 2.0)
|
19
|
+
sexp_processor (~> 3.0)
|
20
|
+
ruby_parser (2.0.6)
|
21
|
+
sexp_processor (~> 3.0)
|
22
|
+
sexp_processor (3.0.5)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
bundler (~> 1.0.0)
|
29
|
+
jeweler (~> 1.6.2)
|
30
|
+
rcov
|
31
|
+
reek (~> 1.2.8)
|
32
|
+
roodi (~> 2.1.0)
|
data/LICENSE
CHANGED
@@ -1,24 +1,9 @@
|
|
1
1
|
Copyright (c) 2010, Kristofer M White
|
2
2
|
All rights reserved.
|
3
3
|
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
5
|
-
modification, are permitted provided that the following conditions are met:
|
6
|
-
* Redistributions of source code must retain the above copyright
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
8
|
-
* Redistributions in binary form must reproduce the above copyright
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
10
|
-
documentation and/or other materials provided with the distribution.
|
11
|
-
* Neither the name of the <organization> nor the
|
12
|
-
names of its contributors may be used to endorse or promote products
|
13
|
-
derived from this software without specific prior written permission.
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
14
5
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
DISCLAIMED. IN NO EVENT SHALL
|
19
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
8
|
+
|
9
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/Rakefile
CHANGED
@@ -1,22 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
2
12
|
require 'rake'
|
3
13
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "khronotab"
|
18
|
+
gem.homepage = "http://khronotab.kmwhite.net/"
|
19
|
+
gem.license = "BSD"
|
20
|
+
gem.summary = %Q{A pure ruby interface to the crontab}
|
21
|
+
gem.description = %Q{A pure ruby interface to the crontab}
|
22
|
+
gem.email = "me@kmwhite.net"
|
23
|
+
gem.authors = ["Kristofer M White"]
|
24
|
+
# dependencies defined in Gemfile
|
19
25
|
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
20
27
|
|
21
28
|
require 'rake/testtask'
|
22
29
|
Rake::TestTask.new(:test) do |test|
|
@@ -25,44 +32,25 @@ Rake::TestTask.new(:test) do |test|
|
|
25
32
|
test.verbose = true
|
26
33
|
end
|
27
34
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
rescue LoadError
|
36
|
-
task :rcov do
|
37
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
-
end
|
35
|
+
require 'rcov/rcovtask'
|
36
|
+
Rcov::RcovTask.new do |test|
|
37
|
+
test.libs << 'test'
|
38
|
+
test.pattern = 'test/**/test_*.rb'
|
39
|
+
test.verbose = true
|
40
|
+
test.rcov_opts << '--exclude "gems/*"'
|
39
41
|
end
|
40
42
|
|
41
|
-
task
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
t.fail_on_error = true
|
47
|
-
t.verbose = false
|
48
|
-
t.source_files = 'lib/**/*.rb'
|
49
|
-
end
|
50
|
-
rescue LoadError
|
51
|
-
task :reek do
|
52
|
-
abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
|
53
|
-
end
|
43
|
+
require 'reek/rake/task'
|
44
|
+
Reek::Rake::Task.new do |t|
|
45
|
+
t.fail_on_error = true
|
46
|
+
t.verbose = false
|
47
|
+
t.source_files = 'lib/**/*.rb'
|
54
48
|
end
|
55
49
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
t.verbose = false
|
61
|
-
end
|
62
|
-
rescue LoadError
|
63
|
-
task :roodi do
|
64
|
-
abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi"
|
65
|
-
end
|
50
|
+
require 'roodi'
|
51
|
+
require 'roodi_task'
|
52
|
+
RoodiTask.new do |t|
|
53
|
+
t.verbose = false
|
66
54
|
end
|
67
55
|
|
68
56
|
task :default => :test
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.5.0
|
data/lib/khronotab/cron_job.rb
CHANGED
@@ -14,6 +14,11 @@ class CronJob
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.add_new(cron_entry)
|
17
|
+
STDERR.puts("DEPRECATION WARNING: add_new is deprecated. See CronJob.add_new")
|
18
|
+
self.parse_new(cron_entry)
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.parse_new(cron_entry)
|
17
22
|
return nil unless JOB_REGEX.match(cron_entry)
|
18
23
|
minute, hour, dom, month, dow, user, command =
|
19
24
|
cron_entry.scan(JOB_REGEX).shift
|
data/test/helper.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
2
10
|
require 'test/unit'
|
3
|
-
require 'shoulda'
|
4
11
|
|
5
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
12
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
13
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
14
|
require 'khronotab'
|
8
15
|
|
9
16
|
class Test::Unit::TestCase
|
data/test/test_khronotab.rb
CHANGED
@@ -1,12 +1,7 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
require 'ts_cron_tab'
|
4
|
-
require 'ts_cron_job'
|
5
|
-
require 'ts_cron_unit'
|
6
|
-
require 'ts_cron_variable'
|
7
|
-
|
8
3
|
class TestKhronotab < Test::Unit::TestCase
|
9
|
-
|
10
|
-
|
4
|
+
def test_something_for_real
|
5
|
+
flunk "hey buddy, you should probably rename this file and start testing for real"
|
11
6
|
end
|
12
7
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: khronotab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 1.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kristofer M White
|
@@ -15,13 +15,45 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-06-25 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: bundler
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 1.0.0
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: jeweler
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 11
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 6
|
49
|
+
- 2
|
50
|
+
version: 1.6.2
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rcov
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
25
57
|
none: false
|
26
58
|
requirements:
|
27
59
|
- - ">="
|
@@ -31,8 +63,40 @@ dependencies:
|
|
31
63
|
- 0
|
32
64
|
version: "0"
|
33
65
|
type: :development
|
34
|
-
version_requirements: *
|
35
|
-
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: reek
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 15
|
76
|
+
segments:
|
77
|
+
- 1
|
78
|
+
- 2
|
79
|
+
- 8
|
80
|
+
version: 1.2.8
|
81
|
+
type: :development
|
82
|
+
version_requirements: *id004
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: roodi
|
85
|
+
prerelease: false
|
86
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ~>
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
hash: 11
|
92
|
+
segments:
|
93
|
+
- 2
|
94
|
+
- 1
|
95
|
+
- 0
|
96
|
+
version: 2.1.0
|
97
|
+
type: :development
|
98
|
+
version_requirements: *id005
|
99
|
+
description: A pure ruby interface to the crontab
|
36
100
|
email: me@kmwhite.net
|
37
101
|
executables: []
|
38
102
|
|
@@ -43,35 +107,28 @@ extra_rdoc_files:
|
|
43
107
|
- README.rdoc
|
44
108
|
files:
|
45
109
|
- .document
|
46
|
-
-
|
110
|
+
- Gemfile
|
111
|
+
- Gemfile.lock
|
47
112
|
- LICENSE
|
48
113
|
- README.rdoc
|
49
114
|
- Rakefile
|
50
115
|
- VERSION
|
51
116
|
- demo/sample.ct
|
52
117
|
- demo/sample.rb
|
53
|
-
- khronotab.gemspec
|
54
118
|
- lib/khronotab.rb
|
55
119
|
- lib/khronotab/cron_comment.rb
|
56
120
|
- lib/khronotab/cron_job.rb
|
57
121
|
- lib/khronotab/cron_unit.rb
|
58
122
|
- lib/khronotab/cron_variable.rb
|
59
123
|
- test/helper.rb
|
60
|
-
- test/tc_cron_job_command-length.rb
|
61
|
-
- test/tc_cron_job_different-time-arguments.rb
|
62
|
-
- test/tc_cron_job_nil-checks.rb
|
63
124
|
- test/test_khronotab.rb
|
64
|
-
- test/ts_cron_job.rb
|
65
|
-
- test/ts_cron_tab.rb
|
66
|
-
- test/ts_cron_unit.rb
|
67
|
-
- test/ts_cron_variable.rb
|
68
125
|
has_rdoc: true
|
69
|
-
homepage: http://
|
70
|
-
licenses:
|
71
|
-
|
126
|
+
homepage: http://khronotab.kmwhite.net/
|
127
|
+
licenses:
|
128
|
+
- BSD
|
72
129
|
post_install_message:
|
73
|
-
rdoc_options:
|
74
|
-
|
130
|
+
rdoc_options: []
|
131
|
+
|
75
132
|
require_paths:
|
76
133
|
- lib
|
77
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -95,17 +152,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
152
|
requirements: []
|
96
153
|
|
97
154
|
rubyforge_project:
|
98
|
-
rubygems_version: 1.
|
155
|
+
rubygems_version: 1.6.2
|
99
156
|
signing_key:
|
100
157
|
specification_version: 3
|
101
|
-
summary: A pure ruby
|
102
|
-
test_files:
|
103
|
-
|
104
|
-
- test/ts_cron_variable.rb
|
105
|
-
- test/ts_cron_job.rb
|
106
|
-
- test/test_khronotab.rb
|
107
|
-
- test/tc_cron_job_different-time-arguments.rb
|
108
|
-
- test/tc_cron_job_command-length.rb
|
109
|
-
- test/ts_cron_unit.rb
|
110
|
-
- test/ts_cron_tab.rb
|
111
|
-
- test/helper.rb
|
158
|
+
summary: A pure ruby interface to the crontab
|
159
|
+
test_files: []
|
160
|
+
|
data/khronotab.gemspec
DELETED
@@ -1,74 +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{khronotab}
|
8
|
-
s.version = "1.3.3"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Kristofer M White"]
|
12
|
-
s.date = %q{2010-11-09}
|
13
|
-
s.description = %q{A pure ruby crontab parser with a Hash-like interface}
|
14
|
-
s.email = %q{me@kmwhite.net}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"demo/sample.ct",
|
27
|
-
"demo/sample.rb",
|
28
|
-
"khronotab.gemspec",
|
29
|
-
"lib/khronotab.rb",
|
30
|
-
"lib/khronotab/cron_comment.rb",
|
31
|
-
"lib/khronotab/cron_job.rb",
|
32
|
-
"lib/khronotab/cron_unit.rb",
|
33
|
-
"lib/khronotab/cron_variable.rb",
|
34
|
-
"test/helper.rb",
|
35
|
-
"test/tc_cron_job_command-length.rb",
|
36
|
-
"test/tc_cron_job_different-time-arguments.rb",
|
37
|
-
"test/tc_cron_job_nil-checks.rb",
|
38
|
-
"test/test_khronotab.rb",
|
39
|
-
"test/ts_cron_job.rb",
|
40
|
-
"test/ts_cron_tab.rb",
|
41
|
-
"test/ts_cron_unit.rb",
|
42
|
-
"test/ts_cron_variable.rb"
|
43
|
-
]
|
44
|
-
s.homepage = %q{http://github.com/kmwhite/khronotab}
|
45
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
46
|
-
s.require_paths = ["lib"]
|
47
|
-
s.rubygems_version = %q{1.3.7}
|
48
|
-
s.summary = %q{A pure ruby crontab parser with a Hash-like interface}
|
49
|
-
s.test_files = [
|
50
|
-
"test/tc_cron_job_nil-checks.rb",
|
51
|
-
"test/ts_cron_variable.rb",
|
52
|
-
"test/ts_cron_job.rb",
|
53
|
-
"test/test_khronotab.rb",
|
54
|
-
"test/tc_cron_job_different-time-arguments.rb",
|
55
|
-
"test/tc_cron_job_command-length.rb",
|
56
|
-
"test/ts_cron_unit.rb",
|
57
|
-
"test/ts_cron_tab.rb",
|
58
|
-
"test/helper.rb"
|
59
|
-
]
|
60
|
-
|
61
|
-
if s.respond_to? :specification_version then
|
62
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
63
|
-
s.specification_version = 3
|
64
|
-
|
65
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
66
|
-
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
67
|
-
else
|
68
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
69
|
-
end
|
70
|
-
else
|
71
|
-
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
@@ -1,29 +0,0 @@
|
|
1
|
-
class CronJobTest < Test::Unit::TestCase
|
2
|
-
|
3
|
-
context "a CronJob with a single-arg cmd" do
|
4
|
-
setup do
|
5
|
-
@cronjob = CronJob.add_new('0 0 0 0 0 root ls')
|
6
|
-
end
|
7
|
-
|
8
|
-
should "parse user and cmd correctly" do
|
9
|
-
assert_equal('root', @cronjob.user,
|
10
|
-
'User parsed incorrectly') &&
|
11
|
-
assert_equal('ls', @cronjob.command,
|
12
|
-
'Command parsed incorrectly')
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context "a CronJob with a multi-arg cmd" do
|
17
|
-
setup do
|
18
|
-
@cronjob = CronJob.add_new('0 0 0 0 0 root grep foo /var/log/bar | cut -d\':\' -f 3 | sort | uniq')
|
19
|
-
end
|
20
|
-
|
21
|
-
should "handle complex, multi command lines" do
|
22
|
-
assert_equal('root', @cronjob.user,
|
23
|
-
'User parsed incorrectly') &&
|
24
|
-
assert_equal('grep foo /var/log/bar | cut -d\':\' -f 3 | sort | uniq', @cronjob.command,
|
25
|
-
'Command parsed incorrectly')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
@@ -1,56 +0,0 @@
|
|
1
|
-
class CronJobTest < Test::Unit::TestCase
|
2
|
-
|
3
|
-
context "a CronJob with range time args" do
|
4
|
-
setup do
|
5
|
-
@cronjob = CronJob.add_new('0-9 0-9 0-9 0-9 0-4 root ls')
|
6
|
-
end
|
7
|
-
|
8
|
-
should "should have correct user and command" do
|
9
|
-
assert_equal('root', @cronjob.user,
|
10
|
-
'User parsed incorrectly') &&
|
11
|
-
assert_equal('ls', @cronjob.command,
|
12
|
-
'Command parsed incorrectly')
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context "a CronJob with interval time args" do
|
17
|
-
setup do
|
18
|
-
@cronjob = CronJob.add_new('6/2 6/2 6/2 6/2 6/2 root ls')
|
19
|
-
end
|
20
|
-
|
21
|
-
should "should have correct user and command" do
|
22
|
-
assert_equal('root', @cronjob.user,
|
23
|
-
'User parsed incorrectly') &&
|
24
|
-
assert_equal('ls', @cronjob.command,
|
25
|
-
'Command parsed incorrectly')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context "a CronJob with asterisk time args" do
|
30
|
-
setup do
|
31
|
-
@cronjob = CronJob.add_new('* * * * * root ls')
|
32
|
-
end
|
33
|
-
|
34
|
-
should "should have correct user and command" do
|
35
|
-
assert_equal('root', @cronjob.user,
|
36
|
-
'User parsed incorrectly') &&
|
37
|
-
assert_equal('ls', @cronjob.command,
|
38
|
-
'Command parsed incorrectly')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "a CronJob with mixed time args" do
|
43
|
-
setup do
|
44
|
-
@cronjob = CronJob.add_new('* 6/2 0-9 0 0 root ls')
|
45
|
-
end
|
46
|
-
|
47
|
-
should "should have correct user and command" do
|
48
|
-
assert_equal('root', @cronjob.user,
|
49
|
-
'User parsed incorrectly') &&
|
50
|
-
assert_equal('ls', @cronjob.command,
|
51
|
-
'Command parsed incorrectly')
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
@@ -1,38 +0,0 @@
|
|
1
|
-
class CronJobTest < Test::Unit::TestCase
|
2
|
-
|
3
|
-
context "a CronJob" do
|
4
|
-
setup do
|
5
|
-
@cronjob = CronJob.new
|
6
|
-
end
|
7
|
-
|
8
|
-
should "have a nil minutes" do
|
9
|
-
assert_nil @cronjob.minutes.cron_form
|
10
|
-
end
|
11
|
-
|
12
|
-
should "have a nil hours" do
|
13
|
-
assert_nil @cronjob.hours.cron_form
|
14
|
-
end
|
15
|
-
|
16
|
-
should "have a nil days_of_month" do
|
17
|
-
assert_nil @cronjob.days_of_month.cron_form
|
18
|
-
end
|
19
|
-
|
20
|
-
should "have a nil month" do
|
21
|
-
assert_nil @cronjob.month.cron_form
|
22
|
-
end
|
23
|
-
|
24
|
-
should "have a nil days_of_week" do
|
25
|
-
assert_nil @cronjob.days_of_week.cron_form
|
26
|
-
end
|
27
|
-
|
28
|
-
should "have a nil user" do
|
29
|
-
assert_nil @cronjob.user
|
30
|
-
end
|
31
|
-
|
32
|
-
should "have a nil command" do
|
33
|
-
assert_nil @cronjob.command
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
data/test/ts_cron_job.rb
DELETED
data/test/ts_cron_tab.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
data/test/ts_cron_unit.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
data/test/ts_cron_variable.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'test/unit'
|