scron 1.0.2 → 1.0.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/scron.rb +6 -2
- data/scron_test.rb +4 -2
- metadata +2 -2
data/scron.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
3
|
class Scron
|
4
|
-
VERSION = '1.0.
|
4
|
+
VERSION = '1.0.3'
|
5
5
|
SCHEDULE_FILE = "#{ENV['HOME']}/.scron"
|
6
6
|
HISTORY_FILE = "#{ENV['HOME']}/.scrondb"
|
7
7
|
LOG_FILE = "#{ENV['HOME']}/.scronlog"
|
@@ -39,7 +39,11 @@ class Scron
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.now
|
42
|
-
@now ||=
|
42
|
+
@now ||= begin
|
43
|
+
now = DateTime.now
|
44
|
+
now += now.offset
|
45
|
+
now = now.new_offset('+00:00')
|
46
|
+
end
|
43
47
|
end
|
44
48
|
|
45
49
|
def self.edit
|
data/scron_test.rb
CHANGED
@@ -6,7 +6,9 @@ class ScronTest < MiniTest::Unit::TestCase
|
|
6
6
|
def setup
|
7
7
|
Scron.instance_variable_set(:@now, DateTime.new(2010, 3, 15))
|
8
8
|
end
|
9
|
+
end
|
9
10
|
|
11
|
+
class AppTest < ScronTest
|
10
12
|
def test_files
|
11
13
|
assert_equal("#{ENV['HOME']}/.scron", Scron::SCHEDULE_FILE)
|
12
14
|
assert_equal("#{ENV['HOME']}/.scrondb", Scron::HISTORY_FILE)
|
@@ -41,7 +43,7 @@ class ScronTest < MiniTest::Unit::TestCase
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
class ScheduleTest
|
46
|
+
class ScheduleTest < ScronTest
|
45
47
|
def test_parse_day_interval
|
46
48
|
sched = Schedule.new('1d c', History.new(''))
|
47
49
|
assert_equal(1, sched.send(:parse_days, '1d'))
|
@@ -104,7 +106,7 @@ class ScheduleTest
|
|
104
106
|
end
|
105
107
|
end
|
106
108
|
|
107
|
-
class HistoryTest
|
109
|
+
class HistoryTest < ScronTest
|
108
110
|
def test_initialize
|
109
111
|
history = History.new('2100-01-01.01:00 cmd arg1 arg2')
|
110
112
|
assert_equal(DateTime.new(2100, 1, 1, 1, 0), history['cmd arg1 arg2'])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: .
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|