taskloop 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/taskloop/command/deploy.rb +3 -4
- data/lib/taskloop/command/init.rb +10 -8
- data/lib/taskloop/command/list.rb +10 -8
- data/lib/taskloop/dsl/dsl.rb +16 -5
- data/lib/taskloop/extension/integer_extension.rb +0 -4
- data/lib/taskloop/rules/after_scope_rule.rb +36 -45
- data/lib/taskloop/rules/before_scope_rule.rb +36 -45
- data/lib/taskloop/rules/between_scope_rule.rb +51 -60
- data/lib/taskloop/rules/boundary_rule.rb +21 -0
- data/lib/taskloop/rules/date_list_rule.rb +0 -4
- data/lib/taskloop/rules/default_rule.rb +0 -4
- data/lib/taskloop/rules/end_point_boundary_rule.rb +21 -0
- data/lib/taskloop/rules/interval_rule.rb +0 -4
- data/lib/taskloop/rules/loop_rule.rb +0 -4
- data/lib/taskloop/rules/rule.rb +2 -4
- data/lib/taskloop/rules/specific_rule.rb +25 -32
- data/lib/taskloop/rules/start_point_boundary_rule.rb +21 -0
- data/lib/taskloop/rules/time_list_rule.rb +0 -4
- data/lib/taskloop/task/task.rb +20 -7
- data/lib/taskloop/task/task_property.rb +121 -45
- data/lib/taskloop/version.rb +1 -1
- data/sig/integer.rbs +11 -0
- data/sig/string.rbs +7 -0
- data/sig/task_loop/after_scope_rule.rbs +11 -0
- data/sig/task_loop/before_scope_rule.rbs +11 -0
- data/sig/task_loop/between_scope_rule.rbs +14 -0
- data/sig/task_loop/boundary_rule.rbs +9 -0
- data/sig/task_loop/date_list_rule.rbs +11 -0
- data/sig/task_loop/default_rule.rbs +8 -0
- data/sig/task_loop/deploy.rbs +18 -0
- data/sig/task_loop/dsl.rbs +25 -0
- data/sig/task_loop/end_point_boundary_rule.rbs +9 -0
- data/sig/task_loop/env.rbs +13 -0
- data/sig/task_loop/init.rbs +5 -0
- data/sig/task_loop/interval_rule.rbs +9 -0
- data/sig/task_loop/launch.rbs +12 -0
- data/sig/task_loop/list.rbs +9 -0
- data/sig/task_loop/log.rbs +11 -0
- data/sig/task_loop/loop_rule.rbs +9 -0
- data/sig/task_loop/proj_task_list.rbs +5 -0
- data/sig/task_loop/rule.rbs +11 -0
- data/sig/task_loop/run.rbs +11 -0
- data/sig/task_loop/scope_rule.rbs +9 -0
- data/sig/task_loop/shutdown.rbs +7 -0
- data/sig/task_loop/specific_rule.rbs +11 -0
- data/sig/task_loop/start_point_boundary_rule.rbs +9 -0
- data/sig/task_loop/task.rbs +34 -0
- data/sig/task_loop/task_data_file.rbs +23 -0
- data/sig/task_loop/task_property.rbs +83 -0
- data/sig/task_loop/time_list_rule.rbs +13 -0
- data/sig/task_loop/undeploy.rbs +7 -0
- metadata +35 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe54ad9d9bfec60de30dcda7607bae029880697f8e3300f3d8f5ca720d1e3b61
|
4
|
+
data.tar.gz: 1963fb584f8fbb3fdde0d72008a19a3c8568c0b4fe3dc5939a3df22360370cee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 534de276e8ced9600bbecc3f7a07a4de578d3addee053ddcacacad7b284e9e59b40f9bde0cd309a2075e0f5ff3692f8c2fc38a9ff08ccedabfae933c792d5e52
|
7
|
+
data.tar.gz: 529cdbe0ea94872d8960fba3a1b7eba0520d5bd2b0d09ae5f1319c698b20fc63c9d6acb957c0f239e0958e58f0f908531c26caed504956b6c4ae73eaf70f51e4
|
data/Gemfile.lock
CHANGED
@@ -13,6 +13,9 @@ module TaskLoop
|
|
13
13
|
require_relative '../rules/loop_rule'
|
14
14
|
require_relative '../rules/date_list_rule'
|
15
15
|
require_relative '../rules/time_list_rule'
|
16
|
+
require_relative '../rules//boundary_rule'
|
17
|
+
require_relative '../rules/start_point_boundary_rule'
|
18
|
+
require_relative '../rules/end_point_boundary_rule'
|
16
19
|
require_relative '../extension/string_extension'
|
17
20
|
require_relative '../extension/integer_extension'
|
18
21
|
require_relative '../dsl/dsl'
|
@@ -62,10 +65,6 @@ module TaskLoop
|
|
62
65
|
json_string = File.read(taskloop_proj_list_path)
|
63
66
|
parsed_json = JSON.parse(json_string)
|
64
67
|
# check if all the registered path
|
65
|
-
push_taskfile_dir_if_needed(parsed_json)
|
66
|
-
end
|
67
|
-
|
68
|
-
private def push_taskfile_dir_if_needed(parsed_json)
|
69
68
|
proj_dir = Dir.pwd
|
70
69
|
duplicate = parsed_json.select { |path| path == proj_dir }
|
71
70
|
if duplicate.empty?
|
@@ -25,14 +25,16 @@ module TaskLoop
|
|
25
25
|
# env "ENV_NAME", "ENV_VALUE"
|
26
26
|
|
27
27
|
TaskLoop::Task.new do |t|
|
28
|
-
t.name
|
29
|
-
t.path
|
30
|
-
t.year
|
31
|
-
t.month
|
32
|
-
t.day
|
33
|
-
t.hour
|
34
|
-
t.minute
|
35
|
-
t.loop
|
28
|
+
t.name = 'TODO: task name. <Required>'
|
29
|
+
t.path = 'TODO: task job path. For exmaple, t.path = "./Job.sh". <Required>'
|
30
|
+
t.year = "TODO: year rule. <Optional>"
|
31
|
+
t.month = "TODO: month rule. <Optional>"
|
32
|
+
t.day = "TODO: day rule. <Optional>"
|
33
|
+
t.hour = "TODO: hour rule. <Optional>"
|
34
|
+
t.minute = "TODO: minute rule. <Optional>"
|
35
|
+
t.loop = "TODO: loop count. <Optional>"
|
36
|
+
t.start_point = "TODO: start point boundary rule. <Optional"
|
37
|
+
t.end_point = "TODO: start point boundary rule. <Optional"
|
36
38
|
end
|
37
39
|
DESC
|
38
40
|
file.puts content
|
@@ -44,14 +44,16 @@ module TaskLoop
|
|
44
44
|
puts "Tasks above are defined in Taskfile of <#{proj}>".ansi.blue
|
45
45
|
list.each do |task|
|
46
46
|
puts " #{task.desc}".ansi.blue
|
47
|
-
puts " t.name
|
48
|
-
puts " t.path
|
49
|
-
puts " t.year
|
50
|
-
puts " t.month
|
51
|
-
puts " t.day
|
52
|
-
puts " t.hour
|
53
|
-
puts " t.minute
|
54
|
-
puts " t.loop
|
47
|
+
puts " t.name = #{task.name}".ansi.blue
|
48
|
+
puts " t.path = #{task.path}".ansi.blue
|
49
|
+
puts " t.year = #{task.year.desc}".ansi.blue
|
50
|
+
puts " t.month = #{task.month.desc}".ansi.blue
|
51
|
+
puts " t.day = #{task.day.desc}".ansi.blue
|
52
|
+
puts " t.hour = #{task.hour.desc}".ansi.blue
|
53
|
+
puts " t.minute = #{task.minute.desc}".ansi.blue
|
54
|
+
puts " t.loop = #{task.loop.desc}".ansi.blue
|
55
|
+
puts " t.start_point = #{task.start_point.desc}".ansi.blue
|
56
|
+
puts " t.end_point = #{task.end_point.desc}".ansi.blue
|
55
57
|
end
|
56
58
|
end
|
57
59
|
end
|
data/lib/taskloop/dsl/dsl.rb
CHANGED
@@ -11,23 +11,23 @@ module TaskLoop
|
|
11
11
|
#################################
|
12
12
|
# Specific Syntax
|
13
13
|
#################################
|
14
|
-
def at(
|
15
|
-
SpecificRule.new(:unknown,
|
14
|
+
def at(*values)
|
15
|
+
SpecificRule.new(:unknown, values)
|
16
16
|
end
|
17
17
|
|
18
18
|
#################################
|
19
19
|
# Scope Syntax
|
20
20
|
#################################
|
21
21
|
def before(right)
|
22
|
-
BeforeScopeRule.new(:unknown,
|
22
|
+
BeforeScopeRule.new(:unknown, right)
|
23
23
|
end
|
24
24
|
|
25
25
|
def between(left, right)
|
26
|
-
BetweenScopeRule.new(:unknown,
|
26
|
+
BetweenScopeRule.new(:unknown, left, right)
|
27
27
|
end
|
28
28
|
|
29
29
|
def after(left)
|
30
|
-
AfterScopeRule.new(:unknown,
|
30
|
+
AfterScopeRule.new(:unknown, left)
|
31
31
|
end
|
32
32
|
|
33
33
|
#################################
|
@@ -51,6 +51,17 @@ module TaskLoop
|
|
51
51
|
DateListRule.new(:unknown, args)
|
52
52
|
end
|
53
53
|
|
54
|
+
#################################
|
55
|
+
# Boundary Syntax
|
56
|
+
#################################
|
57
|
+
def from(value)
|
58
|
+
StartPointBoundaryRule.new(:unknown, value)
|
59
|
+
end
|
60
|
+
|
61
|
+
def to(value)
|
62
|
+
EndPointBoundaryRule.new(:unknown, value)
|
63
|
+
end
|
64
|
+
|
54
65
|
#################################
|
55
66
|
# Env
|
56
67
|
#################################
|
@@ -3,39 +3,39 @@ module TaskLoop
|
|
3
3
|
|
4
4
|
attr_accessor :left
|
5
5
|
|
6
|
-
def initialize(unit,
|
7
|
-
super unit,
|
6
|
+
def initialize(unit, left)
|
7
|
+
super unit, :after
|
8
8
|
@left = left
|
9
9
|
end
|
10
10
|
|
11
|
-
def invalidate!
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
11
|
+
# def invalidate!
|
12
|
+
# super
|
13
|
+
# if @unit == :day
|
14
|
+
# unless Task::WEEK.has_key?(@left) || Task::DAY.has_key?(@left)
|
15
|
+
# raise ArgumentError, "#{left} must be a Symbol defined in Task::WEEK or Task::DAY"
|
16
|
+
# end
|
17
|
+
# return
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# if @unit == :month
|
21
|
+
# unless Task::MONTH.has_key?(@left)
|
22
|
+
# raise ArgumentError, "#{left} must be a Symbol defined in Task::MONTH"
|
23
|
+
# end
|
24
|
+
# return
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# unless @left.is_a?(Integer)
|
28
|
+
# raise TypeError, "'left' need to be Symbol or Integer"
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# if @unit == :minute && (@left < 0 || @left > 59)
|
32
|
+
# raise ArgumentError, "'right' for 'minute' must >= 0 and <= 59"
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# if @unit == :hour && (@left < 0 || @left > 23)
|
36
|
+
# raise ArgumentError, "'right' for 'hour' must >= 0 and <= 23"
|
37
|
+
# end
|
38
|
+
# end
|
39
39
|
|
40
40
|
|
41
41
|
def left_value
|
@@ -56,30 +56,21 @@ module TaskLoop
|
|
56
56
|
return @left
|
57
57
|
end
|
58
58
|
|
59
|
-
def is_week_value?
|
60
|
-
if @unit == :day && Task::WEEK.has_key?(@left)
|
61
|
-
return true
|
62
|
-
end
|
63
|
-
return false
|
64
|
-
end
|
65
|
-
|
66
59
|
def is_conform_rule?(last_exec_time)
|
67
60
|
current = Time.now
|
68
61
|
value = left_value
|
69
62
|
result = false
|
70
63
|
case @unit
|
71
64
|
when :year then
|
72
|
-
result = current.year
|
65
|
+
result = current.year >= value
|
73
66
|
when :month then
|
74
|
-
result = current.month
|
67
|
+
result = current.month >= value
|
68
|
+
when :week then
|
69
|
+
result = current.wday >= (value % TaskLoop::WEEK_BASE)
|
75
70
|
when :day then
|
76
|
-
|
77
|
-
result = current.wday > (value % TaskLoop::WEEK_BASE)
|
78
|
-
else
|
79
|
-
result = current.day > value
|
80
|
-
end
|
71
|
+
result = current.day >= value
|
81
72
|
when :hour then
|
82
|
-
result = current.hour
|
73
|
+
result = current.hour >= value
|
83
74
|
end
|
84
75
|
return result
|
85
76
|
end
|
@@ -3,39 +3,39 @@ module TaskLoop
|
|
3
3
|
|
4
4
|
attr_accessor :right
|
5
5
|
|
6
|
-
def initialize(unit,
|
7
|
-
super unit,
|
6
|
+
def initialize(unit, right)
|
7
|
+
super unit, :before
|
8
8
|
@right = right
|
9
9
|
end
|
10
10
|
|
11
|
-
def invalidate!
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
11
|
+
# def invalidate!
|
12
|
+
# super
|
13
|
+
# if @unit == :day
|
14
|
+
# unless Task::WEEK.has_key?(@right) || Task::DAY.has_key?(@right)
|
15
|
+
# raise ArgumentError, "#{@right} must be a Symbol defined in Task::WEEK or Task::DAY"
|
16
|
+
# end
|
17
|
+
# return
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# if @unit == :month
|
21
|
+
# unless Task::MONTH.has_key?(@right)
|
22
|
+
# raise ArgumentError, "#{@right} must be a Symbol defined in Task::MONTH"
|
23
|
+
# end
|
24
|
+
# return
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# unless @right.is_a?(Integer)
|
28
|
+
# raise TypeError, "'right' need to be Symbol or Integer"
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# if @unit == :minute && (@right < 0 || @right > 59)
|
32
|
+
# raise ArgumentError, "'right' for 'minute' must >= 0 and <= 59"
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# if @unit == :hour && (@right < 0 || @right > 23)
|
36
|
+
# raise ArgumentError, "'right' for 'hour' must >= 0 and <= 23"
|
37
|
+
# end
|
38
|
+
# end
|
39
39
|
|
40
40
|
def right_value
|
41
41
|
if (Task::DAY.has_key?(@right))
|
@@ -55,30 +55,21 @@ module TaskLoop
|
|
55
55
|
return @right
|
56
56
|
end
|
57
57
|
|
58
|
-
def is_week_value?
|
59
|
-
if @unit == :day && Task::WEEK.has_key?(@right)
|
60
|
-
return true
|
61
|
-
end
|
62
|
-
return false
|
63
|
-
end
|
64
|
-
|
65
58
|
def is_conform_rule?(last_exec_time)
|
66
59
|
current = Time.now
|
67
60
|
value = right_value
|
68
61
|
result = false
|
69
62
|
case @unit
|
70
63
|
when :year then
|
71
|
-
result = current.year
|
64
|
+
result = current.year <= value
|
72
65
|
when :month then
|
73
|
-
result = current.month
|
66
|
+
result = current.month <= value
|
67
|
+
when :week then
|
68
|
+
result = current.wday <= (value % TaskLoop::WEEK_BASE)
|
74
69
|
when :day then
|
75
|
-
|
76
|
-
result = current.wday < (value % TaskLoop::WEEK_BASE)
|
77
|
-
else
|
78
|
-
result = current.day < value
|
79
|
-
end
|
70
|
+
result = current.day <= value
|
80
71
|
when :hour then
|
81
|
-
result = current.hour
|
72
|
+
result = current.hour <= value
|
82
73
|
end
|
83
74
|
return result
|
84
75
|
end
|
@@ -5,58 +5,58 @@ module TaskLoop
|
|
5
5
|
|
6
6
|
attr_accessor :right
|
7
7
|
|
8
|
-
def initialize(unit,
|
9
|
-
super unit,
|
8
|
+
def initialize(unit, left, right)
|
9
|
+
super unit, :between
|
10
10
|
@left = left
|
11
11
|
@right = right
|
12
12
|
end
|
13
13
|
|
14
|
-
def invalidate!
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
14
|
+
# def invalidate!
|
15
|
+
# super
|
16
|
+
# if @unit == :day
|
17
|
+
# if Task::WEEK.has_key?(@left) && Task::WEEK.has_key?(@right)
|
18
|
+
# unless Task::WEEK[@left] < Task::WEEK[@right]
|
19
|
+
# raise ArgumentError, "'left' must less than 'right'"
|
20
|
+
# end
|
21
|
+
# return
|
22
|
+
# end
|
23
|
+
# if Task::DAY.has_key?(@left) && Task::DAY.has_key?(@right)
|
24
|
+
# unless Task::WEEK[@left] < Task::WEEK[@right]
|
25
|
+
# raise ArgumentError, "'left' must less than 'right'"
|
26
|
+
# end
|
27
|
+
# return
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# raise ArgumentError, "'left' and 'right' must be the same type."
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# if @unit == :month
|
34
|
+
# unless Task::MONTH.has_key?(@left)
|
35
|
+
# raise ArgumentError, "#{left} must be a Symbol defined in Task::MONTH"
|
36
|
+
# end
|
37
|
+
# return
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# unless @left.is_a?(Integer) && @right.is_a?(Integer)
|
41
|
+
# raise TypeError, "both 'left' and 'right' need to be Symbol or Integer"
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# unless @left < @right
|
45
|
+
# raise ArgumentError, "'left' must less than 'right'"
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# if @unit == :minute && (@left < 0 || @right > 59)
|
49
|
+
# raise ArgumentError, "'left' and 'right' for 'minute' must >= 0 and <= 59"
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# if @unit == :hour && (@left < 0 || @right > 23)
|
53
|
+
# raise ArgumentError, "'left', 'right' for 'hour' must >= 0 and <= 23"
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# if @unit == :year && @left < 0
|
57
|
+
# raise ArgumentError, "'left' must greater than 0"
|
58
|
+
# end
|
59
|
+
# end
|
60
60
|
|
61
61
|
def left_value
|
62
62
|
if (Task::DAY.has_key?(@left))
|
@@ -94,13 +94,6 @@ module TaskLoop
|
|
94
94
|
return @right
|
95
95
|
end
|
96
96
|
|
97
|
-
def is_week_value?
|
98
|
-
if @unit == :day && Task::WEEK.has_key?(@left) && Task::WEEK.has_key?(@right)
|
99
|
-
return true
|
100
|
-
end
|
101
|
-
return false
|
102
|
-
end
|
103
|
-
|
104
97
|
def is_conform_rule?(last_exec_time)
|
105
98
|
current = Time.now
|
106
99
|
left = left_value
|
@@ -111,12 +104,10 @@ module TaskLoop
|
|
111
104
|
result = left <= current.year >= left && current.year <= right
|
112
105
|
when :month then
|
113
106
|
result = left <= current.month && current.month <= right
|
107
|
+
when :week then
|
108
|
+
result = (left % TaskLoop::WEEK_BASE) <= current.wday && current.wday <= (right % TaskLoop::WEEK_BASE)
|
114
109
|
when :day then
|
115
|
-
|
116
|
-
result = (left % TaskLoop::WEEK_BASE) <= current.wday && current.wday <= (right % TaskLoop::WEEK_BASE)
|
117
|
-
else
|
118
|
-
result = left <= current.day && current.day <= right
|
119
|
-
end
|
110
|
+
result = left <= current.day && current.day <= right
|
120
111
|
when :hour then
|
121
112
|
result = left <= current.hour && current.hour <= right
|
122
113
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TaskLoop
|
2
|
+
|
3
|
+
class BoundaryRule < Rule
|
4
|
+
|
5
|
+
BOUNDARY = {
|
6
|
+
:start => 0,
|
7
|
+
:end => 1,
|
8
|
+
}
|
9
|
+
|
10
|
+
attr_accessor :boundary
|
11
|
+
|
12
|
+
def initialize(unit, boundary)
|
13
|
+
super unit
|
14
|
+
@boundary = boundary
|
15
|
+
end
|
16
|
+
|
17
|
+
def desc
|
18
|
+
super + "; boundary: #{boundary.to_s}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TaskLoop
|
2
|
+
class EndPointBoundaryRule < BoundaryRule
|
3
|
+
attr_accessor :value
|
4
|
+
def initialize(unit, value)
|
5
|
+
super unit, :end
|
6
|
+
@value = value
|
7
|
+
end
|
8
|
+
|
9
|
+
def is_conform_rule?(last_exec_time)
|
10
|
+
current = Time.now.to_i
|
11
|
+
date_format = "%Y-%m-%d %H:%M:%S"
|
12
|
+
date_object = Time.strptime(value, date_format)
|
13
|
+
end_time = date_object.to_i
|
14
|
+
return current <= end_time
|
15
|
+
end
|
16
|
+
|
17
|
+
def desc
|
18
|
+
super + " to #{value}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -8,10 +8,6 @@ module TaskLoop
|
|
8
8
|
@interval = interval
|
9
9
|
end
|
10
10
|
|
11
|
-
def is_week_value?
|
12
|
-
return false
|
13
|
-
end
|
14
|
-
|
15
11
|
def is_conform_rule?(last_exec_time)
|
16
12
|
# interval rule is different for other rules. It should be calculated by combining the interval times of all units.
|
17
13
|
# So here returns false
|
data/lib/taskloop/rules/rule.rb
CHANGED
@@ -8,9 +8,11 @@ module TaskLoop
|
|
8
8
|
:day => 3, # support interval/scope/specific syntax
|
9
9
|
:month => 4, # support interval/scope/specific syntax
|
10
10
|
:year => 5, # support interval/scope/specific syntax
|
11
|
+
:week => 6, # support scope/specific syntax
|
11
12
|
:loop => 7, # only support loop syntax
|
12
13
|
:date => 8, # only support date list syntax
|
13
14
|
:time => 9, # only support time list syntax
|
15
|
+
:full => 10, # only support boundary syntax
|
14
16
|
}
|
15
17
|
|
16
18
|
attr_accessor :unit
|
@@ -19,10 +21,6 @@ module TaskLoop
|
|
19
21
|
@unit = unit
|
20
22
|
end
|
21
23
|
|
22
|
-
def is_week_value?
|
23
|
-
raise NotImplementedError, 'subclass need implement this method!'
|
24
|
-
end
|
25
|
-
|
26
24
|
def is_conform_rule?(last_exec_time)
|
27
25
|
raise NotImplementedError, 'subclass need implement this method!'
|
28
26
|
end
|