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
@@ -2,63 +2,56 @@ module TaskLoop
|
|
2
2
|
|
3
3
|
class SpecificRule < Rule
|
4
4
|
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :values
|
6
6
|
|
7
|
-
def initialize(unit,
|
7
|
+
def initialize(unit, values)
|
8
8
|
super unit
|
9
|
-
|
9
|
+
unless values != nil && values.length > 0
|
10
|
+
raise ArgumentError, "values arguments need at least one value."
|
11
|
+
end
|
12
|
+
|
13
|
+
@values = values
|
10
14
|
end
|
11
15
|
|
12
|
-
def
|
13
|
-
if
|
14
|
-
return Task::
|
15
|
-
end
|
16
|
-
if (Task::WEEK.has_key?(@value))
|
17
|
-
return Task::WEEK[@value]
|
18
|
-
end
|
19
|
-
if (Task::MONTH.has_key?(@value))
|
20
|
-
return Task::MONTH[@value]
|
16
|
+
def values_values
|
17
|
+
if @unit == :week
|
18
|
+
return @values.map { |key| Task::WEEK[key] }
|
21
19
|
end
|
22
20
|
|
23
|
-
|
24
|
-
return
|
21
|
+
if @unit == :day
|
22
|
+
return @values.map { |key| Task::DAY[key] }
|
25
23
|
end
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def is_week_value?
|
31
|
-
if @unit == :day && Task::WEEK.has_key?(@value)
|
32
|
-
return true
|
25
|
+
if @unit == :month
|
26
|
+
return @values.map { |key| Task::MONTH[key] }
|
33
27
|
end
|
34
|
-
|
28
|
+
|
29
|
+
return @values
|
35
30
|
end
|
36
31
|
|
37
32
|
def is_conform_rule?(last_exec_time)
|
38
33
|
current = Time.now
|
39
|
-
|
34
|
+
vals = values_values
|
40
35
|
result = false
|
41
36
|
case @unit
|
42
37
|
when :year then
|
43
|
-
result = current.year
|
38
|
+
result = vals.include?(current.year)
|
44
39
|
when :month then
|
45
|
-
result = current.month
|
40
|
+
result = vals.include?(current.month)
|
41
|
+
when :week then
|
42
|
+
result = vals.include?(TaskLoop::WEEK_BASE + current.wday)
|
46
43
|
when :day then
|
47
|
-
|
48
|
-
result = current.wday == (value % TaskLoop::WEEK_BASE)
|
49
|
-
else
|
50
|
-
result = current.day == value
|
51
|
-
end
|
44
|
+
result = vals.include?(current.day)
|
52
45
|
when :hour then
|
53
|
-
result = current.hour
|
46
|
+
result = vals.include?(current.hour)
|
54
47
|
when :minute then
|
55
|
-
result = current.min
|
48
|
+
result = vals.include?(current.min)
|
56
49
|
end
|
57
50
|
return result
|
58
51
|
end
|
59
52
|
|
60
53
|
def desc
|
61
|
-
super + "; specific: #{
|
54
|
+
super + "; specific: #{values.join(', ')}"
|
62
55
|
end
|
63
56
|
end
|
64
57
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TaskLoop
|
2
|
+
class StartPointBoundaryRule < BoundaryRule
|
3
|
+
attr_accessor :value
|
4
|
+
def initialize(unit, value)
|
5
|
+
super unit, :start
|
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
|
+
start_time = date_object.to_i
|
14
|
+
return current >= start_time
|
15
|
+
end
|
16
|
+
|
17
|
+
def desc
|
18
|
+
super + " from #{value}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/taskloop/task/task.rb
CHANGED
@@ -19,7 +19,7 @@ module TaskLoop
|
|
19
19
|
@@tasklist = value
|
20
20
|
end
|
21
21
|
|
22
|
-
def initialize
|
22
|
+
def initialize
|
23
23
|
yield self
|
24
24
|
check = true
|
25
25
|
unless @name
|
@@ -73,20 +73,20 @@ module TaskLoop
|
|
73
73
|
def check_rule_conflict?
|
74
74
|
result = true
|
75
75
|
# check year/month/day with date, they cannot be set at the same time
|
76
|
-
if
|
76
|
+
if has_ymd? && has_date?
|
77
77
|
puts "Error: #{desc} => <year/month/day> and <date> cannot be set at the same time.".ansi.red
|
78
78
|
result = false
|
79
79
|
end
|
80
80
|
|
81
81
|
# check hour/minute with time, they cannot be set at the same time
|
82
|
-
if
|
82
|
+
if has_hm? && has_time?
|
83
83
|
puts "Error: #{desc} => <hour/minute> and <time> cannot be set at the same time.".ansi.red
|
84
84
|
result = false
|
85
85
|
end
|
86
86
|
|
87
87
|
# check rule type
|
88
88
|
|
89
|
-
if
|
89
|
+
if has_ymd? && has_hm?
|
90
90
|
# check minute/hour/day/month/year. Get the last IntervalRule, than check if there is SpecificRule or ScopeRule before
|
91
91
|
rules = [minute, hour, day, month, year]
|
92
92
|
rIdx = rules.rindex { |rule| rule.is_a?(IntervalRule) }
|
@@ -104,7 +104,7 @@ module TaskLoop
|
|
104
104
|
|
105
105
|
end
|
106
106
|
|
107
|
-
if
|
107
|
+
if has_ymd? && has_time?
|
108
108
|
# check year/month/day with time, YMD can not have IntervalRule
|
109
109
|
rules = [day, month, year]
|
110
110
|
hasInterval = rules.any? { |rule| rule.is_a?(IntervalRule) }
|
@@ -114,11 +114,11 @@ module TaskLoop
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
if
|
117
|
+
if has_date? && has_hm?
|
118
118
|
# it's ok
|
119
119
|
end
|
120
120
|
|
121
|
-
if
|
121
|
+
if has_date? && has_time?
|
122
122
|
# it's ok
|
123
123
|
end
|
124
124
|
|
@@ -129,6 +129,7 @@ module TaskLoop
|
|
129
129
|
last_exec_time = last_time
|
130
130
|
|
131
131
|
result = true
|
132
|
+
result &&= check_boundary_rule?(last_exec_time)
|
132
133
|
result &&= check_interval_rule?(last_exec_time)
|
133
134
|
result &&= check_scope_rule?(last_exec_time)
|
134
135
|
result &&= check_specific_fule?(last_exec_time)
|
@@ -176,6 +177,9 @@ module TaskLoop
|
|
176
177
|
if minute.is_a?(ScopeRule)
|
177
178
|
result &&= minute.is_conform_rule?(last_exec_time)
|
178
179
|
end
|
180
|
+
if week.is_a?(ScopeRule)
|
181
|
+
result &&= week.is_conform_rule?(last_exec_time)
|
182
|
+
end
|
179
183
|
return result
|
180
184
|
end
|
181
185
|
|
@@ -196,6 +200,9 @@ module TaskLoop
|
|
196
200
|
if minute.is_a?(SpecificRule)
|
197
201
|
result &&= minute.is_conform_rule?(last_exec_time)
|
198
202
|
end
|
203
|
+
if week.is_a?(SpecificRule)
|
204
|
+
result &&= week.is_conform_rule?(last_exec_time)
|
205
|
+
end
|
199
206
|
if time.is_a?(TimeListRule)
|
200
207
|
result &&= time.is_conform_rule?(last_exec_time)
|
201
208
|
end
|
@@ -215,6 +222,12 @@ module TaskLoop
|
|
215
222
|
return result
|
216
223
|
end
|
217
224
|
|
225
|
+
private def check_boundary_rule?(last_exec_time)
|
226
|
+
result = true
|
227
|
+
result &&= start_point.is_conform_rule?(last_exec_time)
|
228
|
+
result &&= end_point.is_conform_rule?(last_exec_time)
|
229
|
+
return result
|
230
|
+
end
|
218
231
|
|
219
232
|
#################################
|
220
233
|
# Sha1 and description
|
@@ -1,5 +1,14 @@
|
|
1
1
|
module TaskLoop
|
2
2
|
module TaskProperty
|
3
|
+
WEEK = {
|
4
|
+
:Sun => 0,
|
5
|
+
:Mon => 1,
|
6
|
+
:Tue => 2,
|
7
|
+
:Wed => 3,
|
8
|
+
:Thu => 4,
|
9
|
+
:Fri => 5,
|
10
|
+
:Sat => 6,
|
11
|
+
}
|
3
12
|
|
4
13
|
MONTH = {
|
5
14
|
:Jan => 1,
|
@@ -27,17 +36,6 @@ module TaskLoop
|
|
27
36
|
:mon12 => 12,
|
28
37
|
}
|
29
38
|
|
30
|
-
WEEK_BASE = 10000
|
31
|
-
WEEK = {
|
32
|
-
:Sun => 10000,
|
33
|
-
:Mon => 10001,
|
34
|
-
:Tue => 10002,
|
35
|
-
:Wed => 10003,
|
36
|
-
:Thu => 10004,
|
37
|
-
:Fri => 10005,
|
38
|
-
:Sat => 10006,
|
39
|
-
}
|
40
|
-
|
41
39
|
DAY = {
|
42
40
|
:day1 => 1,
|
43
41
|
:day2 => 2,
|
@@ -78,11 +76,35 @@ module TaskLoop
|
|
78
76
|
attr_accessor :path
|
79
77
|
|
80
78
|
#################################
|
81
|
-
#
|
79
|
+
# Week Property
|
80
|
+
# specific syntax
|
81
|
+
# - at
|
82
|
+
# - example: at :Mon, :Tue, :Fri
|
83
|
+
# scope syntax
|
84
|
+
# - before
|
85
|
+
# - example: before :Mon
|
86
|
+
# - between
|
87
|
+
# - example: between :Mon, :Fri
|
88
|
+
# - after
|
89
|
+
# 0 example: after :Tue
|
82
90
|
#################################
|
91
|
+
def week=(rule)
|
92
|
+
unless rule.is_a?(SpecificRule) || rule.is_a?(ScopeRule)
|
93
|
+
raise TypeError, "the rule of week must be SpecificRule or ScopeRule or IntervalRule"
|
94
|
+
end
|
95
|
+
@week = rule
|
96
|
+
@week.unit = :week
|
97
|
+
end
|
98
|
+
|
99
|
+
def week
|
100
|
+
@week ||= DefaultRule.new(:week)
|
101
|
+
end
|
102
|
+
|
103
|
+
#################################
|
104
|
+
# Year Property
|
83
105
|
# specific syntax
|
84
106
|
# - of
|
85
|
-
# - example:
|
107
|
+
# - example: at 2024, 2025 ...
|
86
108
|
# interval syntax
|
87
109
|
# - interval
|
88
110
|
# - example: interval 1.year
|
@@ -92,12 +114,12 @@ module TaskLoop
|
|
92
114
|
# - between
|
93
115
|
# - example: between 2025, 2026
|
94
116
|
# - after
|
95
|
-
# -
|
117
|
+
# - example: after 2023
|
118
|
+
#################################
|
96
119
|
def year=(rule)
|
97
|
-
unless rule.is_a?(
|
98
|
-
raise TypeError, "the rule of year must be
|
120
|
+
unless rule.is_a?(SpecificRule) || rule.is_a?(ScopeRule) || rule.is_a?(IntervalRule)
|
121
|
+
raise TypeError, "the rule of year must be SpecificRule or ScopeRule or IntervalRule"
|
99
122
|
end
|
100
|
-
|
101
123
|
@year = rule
|
102
124
|
@year.unit = :year
|
103
125
|
end
|
@@ -106,10 +128,12 @@ module TaskLoop
|
|
106
128
|
@year ||= DefaultRule.new(:year)
|
107
129
|
end
|
108
130
|
|
131
|
+
#################################
|
132
|
+
# Month Property
|
109
133
|
# specific syntax
|
110
|
-
# -
|
111
|
-
# - example:
|
112
|
-
# - example:
|
134
|
+
# - at
|
135
|
+
# - example: at :Jan, :Feb, :Mar, :Apr, :Jun, :Jul, :Aug, :Sep, :Oct, :Nov, :Dec;
|
136
|
+
# - example: at :month1, :month2, :month3 ...
|
113
137
|
# interval syntax
|
114
138
|
# - every
|
115
139
|
# - example: interval 1.month
|
@@ -120,9 +144,10 @@ module TaskLoop
|
|
120
144
|
# - example: between 2025, 2026
|
121
145
|
# - after
|
122
146
|
# - examle: after 2023
|
147
|
+
#################################
|
123
148
|
def month=(rule)
|
124
|
-
unless rule.is_a?(
|
125
|
-
raise TypeError, "the rule of month must be
|
149
|
+
unless rule.is_a?(SpecificRule) || rule.is_a?(ScopeRule) || rule.is_a?(IntervalRule)
|
150
|
+
raise TypeError, "the rule of month must be SpecificRule or ScopeRule or IntervalRule"
|
126
151
|
end
|
127
152
|
@month = rule
|
128
153
|
@month.unit = :month
|
@@ -132,10 +157,11 @@ module TaskLoop
|
|
132
157
|
@month||= DefaultRule.new(:month)
|
133
158
|
end
|
134
159
|
|
160
|
+
#################################
|
161
|
+
# Day Property
|
135
162
|
# specific syntax
|
136
|
-
# -
|
137
|
-
# - example:
|
138
|
-
# - example: on :day1, :day2, :day3;
|
163
|
+
# - at
|
164
|
+
# - example: at :day1, :day2, :day3 ...
|
139
165
|
# interval syntax
|
140
166
|
# - interval
|
141
167
|
# - example: interval 10.day
|
@@ -147,9 +173,10 @@ module TaskLoop
|
|
147
173
|
# - example: between :Mon, :Fri
|
148
174
|
# - after
|
149
175
|
# - example: after :day10
|
176
|
+
#################################
|
150
177
|
def day=(rule)
|
151
|
-
unless rule.is_a?(
|
152
|
-
raise TypeError, "the rule of day must be
|
178
|
+
unless rule.is_a?(SpecificRule) || rule.is_a?(ScopeRule) || rule.is_a?(IntervalRule)
|
179
|
+
raise TypeError, "the rule of day must be SpecificRule or ScopeRule or IntervalRule"
|
153
180
|
end
|
154
181
|
@day = rule
|
155
182
|
@day.unit = :day
|
@@ -159,9 +186,11 @@ module TaskLoop
|
|
159
186
|
@day ||= DefaultRule.new(:day)
|
160
187
|
end
|
161
188
|
|
189
|
+
#################################
|
190
|
+
# Hour Property
|
162
191
|
# specific syntax
|
163
192
|
# - at
|
164
|
-
# - example: at 10
|
193
|
+
# - example: at 10, 11, 13 ...
|
165
194
|
# interval syntax
|
166
195
|
# - interval
|
167
196
|
# - example: interval 10.hour
|
@@ -172,9 +201,10 @@ module TaskLoop
|
|
172
201
|
# - example: between 10, 12
|
173
202
|
# - after
|
174
203
|
# - example: after 11
|
204
|
+
#################################
|
175
205
|
def hour=(rule)
|
176
|
-
unless rule.is_a?(
|
177
|
-
raise TypeError, "the rule of hour must be
|
206
|
+
unless rule.is_a?(SpecificRule) || rule.is_a?(ScopeRule) || rule.is_a?(IntervalRule)
|
207
|
+
raise TypeError, "the rule of hour must be SpecificRule or ScopeRule or IntervalRule"
|
178
208
|
end
|
179
209
|
@hour = rule
|
180
210
|
@hour.unit = :hour
|
@@ -184,19 +214,17 @@ module TaskLoop
|
|
184
214
|
@hour ||= DefaultRule.new(:hour)
|
185
215
|
end
|
186
216
|
|
217
|
+
#################################
|
218
|
+
# Minute Property
|
187
219
|
# specific syntax
|
188
220
|
# - at
|
189
|
-
# - example: at 59
|
221
|
+
# - example: at 59, 23 ...
|
190
222
|
# interval syntax
|
191
223
|
# - interval
|
192
224
|
# - example: interval 5.minute
|
193
225
|
def minute=(rule)
|
194
|
-
unless rule.is_a?(
|
195
|
-
raise TypeError, "the rule of minute must be
|
196
|
-
end
|
197
|
-
|
198
|
-
if rule.is_a?(ScopeRule)
|
199
|
-
raise TypeError, "the rule of minute cannot be a class or subclass of ScopeRule"
|
226
|
+
unless rule.is_a?(SpecificRule) || rule.is_a?(IntervalRule)
|
227
|
+
raise TypeError, "the rule of minute must be SpecificRule or IntervalRule"
|
200
228
|
end
|
201
229
|
@minute = rule
|
202
230
|
@minute.unit = :minute
|
@@ -206,12 +234,15 @@ module TaskLoop
|
|
206
234
|
@minute ||= DefaultRule.new(:minute)
|
207
235
|
end
|
208
236
|
|
237
|
+
#################################
|
238
|
+
# Loop Property
|
209
239
|
# loop syntax
|
210
240
|
# - loop
|
211
241
|
# - example: loop 5.times
|
242
|
+
#################################
|
212
243
|
def loop=(rule)
|
213
|
-
unless rule.is_a?(
|
214
|
-
raise TypeError, "the rule of loop must be
|
244
|
+
unless rule.is_a?(LoopRule)
|
245
|
+
raise TypeError, "the rule of loop must be LoopRule"
|
215
246
|
end
|
216
247
|
|
217
248
|
@loop = rule
|
@@ -221,12 +252,15 @@ module TaskLoop
|
|
221
252
|
@loop ||= DefaultRule.new(:loop)
|
222
253
|
end
|
223
254
|
|
255
|
+
#################################
|
256
|
+
# Time Property
|
224
257
|
# time list syntax
|
225
258
|
# - time
|
226
259
|
# - example: time "10:10:30", "9:10:20", "20:10:20"
|
260
|
+
#################################
|
227
261
|
def time=(rule)
|
228
262
|
unless rule.is_a?(TimeListRule)
|
229
|
-
raise TypeError, "the rule of time must be
|
263
|
+
raise TypeError, "the rule of time must be TimeListRule"
|
230
264
|
end
|
231
265
|
|
232
266
|
@time = rule
|
@@ -236,12 +270,15 @@ module TaskLoop
|
|
236
270
|
@time ||= DefaultRule.new(:time)
|
237
271
|
end
|
238
272
|
|
273
|
+
#################################
|
274
|
+
# Date Property
|
239
275
|
# date list syntax
|
240
276
|
# - date
|
241
277
|
# - example: date "2023-10-10", "2013-10-11", "2023-11-10"
|
278
|
+
#################################
|
242
279
|
def date=(rule)
|
243
280
|
unless rule.is_a?(DateListRule)
|
244
|
-
raise TypeError, "the rule of time must be
|
281
|
+
raise TypeError, "the rule of time must be DateListRule"
|
245
282
|
end
|
246
283
|
|
247
284
|
@date = rule
|
@@ -251,22 +288,61 @@ module TaskLoop
|
|
251
288
|
@date ||= DefaultRule.new(:date)
|
252
289
|
end
|
253
290
|
|
291
|
+
#################################
|
292
|
+
# StartPoint Property
|
293
|
+
# boundary syntax
|
294
|
+
# - start_point
|
295
|
+
# - example: from "2023-10-11 10:00:00"
|
296
|
+
#################################
|
297
|
+
def start_point=(rule)
|
298
|
+
unless rule.is_a?(StartPointBoundaryRule)
|
299
|
+
raise TypeError, "the rule of start_point must be StartPointBoundaryRule"
|
300
|
+
end
|
301
|
+
@start_point = rule
|
302
|
+
@start_point.unit = :full
|
303
|
+
end
|
304
|
+
|
305
|
+
def start_point
|
306
|
+
@start_point ||= DefaultRule.new(:full)
|
307
|
+
end
|
308
|
+
|
309
|
+
#################################
|
310
|
+
# EndPoint Property
|
311
|
+
# boundary syntax
|
312
|
+
# - end_point
|
313
|
+
# - example: to "2023-10-11 10:00:00"
|
314
|
+
#################################
|
315
|
+
def end_point=(rule)
|
316
|
+
unless rule.is_a?(EndPointBoundaryRule)
|
317
|
+
raise TypeError, "the rule of end_point must be EndPointBoundaryRule"
|
318
|
+
end
|
319
|
+
@end_point = rule
|
320
|
+
@end_point.unit = :full
|
321
|
+
end
|
322
|
+
|
323
|
+
def end_point
|
324
|
+
@end_point ||= DefaultRule.new(:full)
|
325
|
+
end
|
326
|
+
|
254
327
|
#################################
|
255
328
|
# Help Methods
|
256
329
|
#################################
|
257
|
-
def
|
330
|
+
def has_week?
|
331
|
+
!week.is_a?(DefaultRule)
|
332
|
+
end
|
333
|
+
def has_date?
|
258
334
|
!date.is_a?(DefaultRule)
|
259
335
|
end
|
260
336
|
|
261
|
-
def
|
337
|
+
def has_time?
|
262
338
|
!time.is_a?(DefaultRule)
|
263
339
|
end
|
264
340
|
|
265
|
-
def
|
341
|
+
def has_ymd?
|
266
342
|
[year, month, day].any? { |rule| !rule.is_a?(DefaultRule) }
|
267
343
|
end
|
268
344
|
|
269
|
-
def
|
345
|
+
def has_hm?
|
270
346
|
[hour, minute].any? { |rule| !rule.is_a?(DefaultRule) }
|
271
347
|
end
|
272
348
|
|
data/lib/taskloop/version.rb
CHANGED
data/sig/integer.rbs
ADDED
data/sig/string.rbs
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module TaskLoop
|
2
|
+
class BetweenScopeRule
|
3
|
+
attr_accessor left: [Symbol | Integer]
|
4
|
+
attr_accessor right: [Symbol | Integer]
|
5
|
+
|
6
|
+
def desc: () -> String
|
7
|
+
|
8
|
+
def is_conform_rule?: (Time) -> bool
|
9
|
+
|
10
|
+
def left_value: () -> Integer
|
11
|
+
|
12
|
+
def right_value: () -> Integer
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module TaskLoop
|
2
|
+
class Deploy
|
3
|
+
def run: () -> void
|
4
|
+
def register_taskfile_dir_if_needed: () -> void
|
5
|
+
|
6
|
+
def tasklist: () -> Array[Task]
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def clean_loopfile_if_needed: () -> void
|
11
|
+
|
12
|
+
def deploy_lint?: () -> bool
|
13
|
+
|
14
|
+
def eval_taskfile: (String) -> void
|
15
|
+
|
16
|
+
def generate_taskfile_deploy: () -> void
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module TaskLoop
|
2
|
+
module DSL
|
3
|
+
def after: ([Symbol | Integer]) -> AfterScopeRule
|
4
|
+
|
5
|
+
def at: (*[Symbol | Integer]) -> SpecificRule
|
6
|
+
|
7
|
+
def before: ([Symbol | Integer]) -> BeforeScopeRule
|
8
|
+
|
9
|
+
def between: ([Symbol | Integer], [Symbol | Integer]) -> BetweenScopeRule
|
10
|
+
|
11
|
+
def date: (*String) -> DateListRule
|
12
|
+
|
13
|
+
def env: (String, String) -> void
|
14
|
+
|
15
|
+
def from: (String) -> StartPointBoundaryRule
|
16
|
+
|
17
|
+
def interval: (Integer) -> IntervalRule
|
18
|
+
|
19
|
+
def loop: (Integer) -> LoopRule
|
20
|
+
|
21
|
+
def time: (*String) -> TimeListRule
|
22
|
+
|
23
|
+
def to: (String) -> EndPointBoundaryRule
|
24
|
+
end
|
25
|
+
end
|