winever 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,21 +32,21 @@ module Winever
32
32
  end
33
33
 
34
34
  def password
35
+ return @options[:password] if @options.has_key?(:password)
36
+ return ENV['WINEVER_PASSWORD'] if ENV['WINEVER_PASSWORD'] && !ENV['WINEVER_PASSWORD'].empty?
37
+
35
38
  return @password.empty? ? nil : @password if @password
36
39
  require 'highline/import'
37
40
  prompt = <<-PRMP.gsub(/^ +/, '')
38
- To setup tasks correctly, the password of the current user account is needed.
39
- You can leave it empty, but without the password, the task will only be run the user is logged on and will open a black
40
- console window while running.
41
- You can manually go edit the scheduled task to add the password manually if you prefer not to give it to Winever, but you will need to go do that every time you edit the tasks through Winever, for each task.
42
- Enter the password of the current user (or just press enter to skip):
41
+ To setup tasks, the password of the current user account is needed.
42
+ Enter the password of the current windows user (or leave blank to avoid doing the changes):
43
43
  PRMP
44
44
 
45
45
  pw = ask(prompt){|q| q.echo = false}
46
46
  while pw && !pw.empty? && !validate_password(pw)
47
47
  prompt = <<-PRMP.gsub(/^ +/, '')
48
48
  Invalid password entered.
49
- Enter the password of the current user (or just press enter to skip):
49
+ Enter the password of the current windows user (or leave blank to avoid doing the changes):
50
50
  PRMP
51
51
  pw = ask(prompt){|q| q.echo = false}
52
52
  end
@@ -62,6 +62,8 @@ module Winever
62
62
  end
63
63
 
64
64
  def create_tasks
65
+ return if self.password.nil?
66
+
65
67
  cron_entries = Winever::WheneverInterface.valid_cron_entries(@options)
66
68
 
67
69
  created_task_names = []
@@ -72,8 +74,12 @@ module Winever
72
74
  end
73
75
 
74
76
  def update_tasks
77
+ return false if self.password.nil?
78
+
75
79
  task_names = create_tasks
76
80
  clear_tasks_except(task_names)
81
+
82
+ true
77
83
  end
78
84
 
79
85
  def clear_tasks_except keep_tasks=[]
@@ -87,6 +93,8 @@ module Winever
87
93
  end
88
94
 
89
95
  def create_task cron_entry
96
+ return if self.password.nil?
97
+
90
98
  task_name = generate_task_name(cron_entry.task_name)
91
99
 
92
100
  # Replacing the /dev/null by NUL
@@ -1,3 +1,3 @@
1
1
  module Winever
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
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.5
4
+ version: 0.1.6
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-06 00:00:00.000000000 Z
12
+ date: 2016-07-25 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: 1699128231675029553
151
+ hash: 287491473
152
152
  required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  none: false
154
154
  requirements:
@@ -157,10 +157,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  segments:
159
159
  - 0
160
- hash: 1699128231675029553
160
+ hash: 287491473
161
161
  requirements: []
162
162
  rubyforge_project:
163
- rubygems_version: 1.8.25
163
+ rubygems_version: 1.8.24
164
164
  signing_key:
165
165
  specification_version: 3
166
166
  summary: Add tasks in Windows' task scheduler from a ruby configuration file.