winever 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/winever/cron_entry.rb +2 -2
- data/lib/winever/cron_time.rb +1 -1
- data/lib/winever/task_manager.rb +1 -1
- data/lib/winever/version.rb +1 -1
- data/lib/winever/whenever_interface.rb +3 -3
- metadata +4 -4
data/lib/winever/cron_entry.rb
CHANGED
@@ -3,7 +3,7 @@ module Winever
|
|
3
3
|
attr_accessor :cron_time, :task_folder, :task_name, :working_directory, :parameters, :cron_line
|
4
4
|
|
5
5
|
def self.from_cron_output cron_output, include_invalid=false
|
6
|
-
entries = cron_output.split("\n").
|
6
|
+
entries = cron_output.split("\n").reject(&:empty?).map{|o| new(o)}
|
7
7
|
entries = entries.select(&:valid?) unless include_invalid
|
8
8
|
entries
|
9
9
|
end
|
@@ -25,7 +25,7 @@ module Winever
|
|
25
25
|
|
26
26
|
def invalid_reason
|
27
27
|
return "Doesn't match the Winever format" unless @cron_parts.length == 5
|
28
|
-
return "Doesn't have a task_name specified"
|
28
|
+
return "Doesn't have a task_name specified" if @task_name.nil? || @task_name.empty?
|
29
29
|
return "Problem with schedule: #{@cron_time.unsupported_reason}" unless @cron_time.supported?
|
30
30
|
nil
|
31
31
|
end
|
data/lib/winever/cron_time.rb
CHANGED
@@ -35,7 +35,7 @@ module Winever
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def unsupported_reason
|
38
|
-
return "Need 5 parts delimited by spaces" if parts.
|
38
|
+
return "Need 5 parts delimited by spaces" if parts.compact.reject(&:empty?).length != 5
|
39
39
|
return "Only '*' is supported for day, month and day or week parts" if [day, month, dow].detect{|v| v != '*'}
|
40
40
|
return "Only single number is supported for minute and hour parts" if [minute, hour].detect{|v| (v =~ /^\d+$/).nil? }
|
41
41
|
nil
|
data/lib/winever/task_manager.rb
CHANGED
@@ -43,7 +43,7 @@ module Winever
|
|
43
43
|
PRMP
|
44
44
|
|
45
45
|
pw = ask(prompt){|q| q.echo = false}
|
46
|
-
while pw.
|
46
|
+
while pw && !pw.empty? && !validate_password(pw)
|
47
47
|
prompt = <<-PRMP.gsub(/^ +/, '')
|
48
48
|
Invalid password entered.
|
49
49
|
Enter the password of the current user (or just press enter to skip):
|
data/lib/winever/version.rb
CHANGED
@@ -52,14 +52,14 @@ module Winever
|
|
52
52
|
|
53
53
|
|
54
54
|
output = "# Valid tasks for Winever in internal format:\n"
|
55
|
-
if valid_entries.
|
55
|
+
if !valid_entries.empty?
|
56
56
|
output << valid_entries.map(&:cron_line).join("\n\n")
|
57
57
|
else
|
58
58
|
output << "No valid entries"
|
59
59
|
end
|
60
60
|
output << "\n\n"
|
61
61
|
|
62
|
-
if invalid_entries.
|
62
|
+
if !invalid_entries.empty?
|
63
63
|
output << "\n# Invalid entries for Winever in internal format:\n"
|
64
64
|
invalid_entries.each do |invalid_entry|
|
65
65
|
output << "# #{invalid_entry.invalid_reason}\n"
|
@@ -67,7 +67,7 @@ module Winever
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
-
if existing_tasks_to_remove.
|
70
|
+
if !existing_tasks_to_remove.empty?
|
71
71
|
if existing_tasks_to_remove.size <= 15
|
72
72
|
output << "\n# Additionnal task names that will be removed if they exist:\n"
|
73
73
|
existing_tasks_to_remove.each do |path|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: winever
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-07-
|
12
|
+
date: 2015-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: whenever
|
@@ -148,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
segments:
|
150
150
|
- 0
|
151
|
-
hash:
|
151
|
+
hash: 2464518562927042211
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
none: false
|
154
154
|
requirements:
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
segments:
|
159
159
|
- 0
|
160
|
-
hash:
|
160
|
+
hash: 2464518562927042211
|
161
161
|
requirements: []
|
162
162
|
rubyforge_project:
|
163
163
|
rubygems_version: 1.8.25
|