win32-taskscheduler 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +88 -73
- data/MANIFEST +9 -11
- data/README +68 -76
- data/Rakefile +37 -34
- data/examples/taskscheduler_example.rb +56 -56
- data/lib/win32/taskscheduler.rb +1368 -1690
- data/lib/win32/windows/helper.rb +33 -0
- data/test/test_taskscheduler.rb +689 -538
- data/win32-taskscheduler.gemspec +33 -29
- metadata +88 -49
- data/doc/taskscheduler.txt +0 -419
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 10db6c303493c5c308511397a042a8595eeb63da
|
4
|
+
data.tar.gz: 3d8cca5c8168f5232c6cbfb1ffa0924dac6d81d9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 435915b83d71f4f2fb45222d530be067ea6a36d1fb7d4584cd67ef72b7f6f83af677e73b31c03186fb41568c68c5ce0d674c065a9c5dfa50cadf852f19ec8a6e
|
7
|
+
data.tar.gz: 1c0a7dbe1185f14cbb897510ffe1fa4d99299d2de655ec0e639c00a55fa91976d3b08533e4af3cd2dcdd906afe7c8e2c3fb3d9c8f6ef6f6af4c720d5d87bd914
|
data/CHANGES
CHANGED
@@ -1,73 +1,88 @@
|
|
1
|
-
== 0.
|
2
|
-
*
|
3
|
-
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
*
|
10
|
-
|
11
|
-
|
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
|
-
|
39
|
-
*
|
40
|
-
|
41
|
-
|
42
|
-
* Added
|
43
|
-
*
|
44
|
-
*
|
45
|
-
|
46
|
-
*
|
47
|
-
*
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
*
|
52
|
-
*
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
*
|
57
|
-
|
58
|
-
|
59
|
-
*
|
60
|
-
|
61
|
-
*
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
*
|
67
|
-
|
68
|
-
*
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
1
|
+
== 0.3.0 - 15-Jan-2014
|
2
|
+
* Rewritten to use Win32OLE instead of using wrapping the C API. Benefits
|
3
|
+
include working on Windows Vista or later, and working with JRuby.
|
4
|
+
* Modified the constructor to accept 3rd and 4th arguments. These indicate
|
5
|
+
which folder to use, and whether or not to create it if it doesn't exist.
|
6
|
+
* The TaskScheduler#save method is now no longer necessary. It is retained
|
7
|
+
for backwards compatibility, but will raise a deprecation warning. In this
|
8
|
+
version simply calling TaskScheduler#activate will implement the task.
|
9
|
+
* Added support for the AT_SYSTEMSTART, AT_LOGON and ON_IDLE trigger types.
|
10
|
+
* Now requires the structured_warnings gem.
|
11
|
+
* Removed the doc directory and separate documentation file. Everything is
|
12
|
+
inlined now. There's still an example under the "examples" directory, too.
|
13
|
+
* Added test-unit, rake, and win32-security as development dependencies.
|
14
|
+
These are needed for testing only.
|
15
|
+
|
16
|
+
== 0.2.2 - 29-Feb-2012
|
17
|
+
* Moved some include statements inside the TaskScheduler class to avoid
|
18
|
+
polluting Object. Thanks go to Josh Cooper for the spot and patch.
|
19
|
+
* Minor formatting tweaks to silence 1.9 warnings.
|
20
|
+
|
21
|
+
== 0.2.1 - 8-Oct-2011
|
22
|
+
* Fixed a bug that would not allow task to run as SYSTEM. Thanks go to
|
23
|
+
Josh cooper for the spot and patch.
|
24
|
+
* Fixed a bug in new_work_item that would cause it to crash if you tried
|
25
|
+
to create a work item that already existed. An error is now raised instead.
|
26
|
+
Thanks go to Pete Higgins for the spot.
|
27
|
+
* The set_trigger and trigger= methods now internally transform and validate
|
28
|
+
the trigger hash in the same manner as new_work_item. Thanks again go to
|
29
|
+
Pete Higgins.
|
30
|
+
* Cleaned up the repo. The C source files have been removed from the main
|
31
|
+
repository (and this gem). They are in a separate branch on github for
|
32
|
+
anyone who misses them.
|
33
|
+
* Refactored the Rakefile, removing tasks related to the old C source files,
|
34
|
+
and added tasks for cleaning, building and installing a gem.
|
35
|
+
* Updated the README file, eliminating references to anything that was only
|
36
|
+
related to the older C version.
|
37
|
+
|
38
|
+
== 0.2.0 - 19-Jun-2009
|
39
|
+
* Rewritten in pure Ruby!
|
40
|
+
* The TaskScheduler::ONCE constant is now a valid trigger type. Thanks go to
|
41
|
+
Uri Iurgel for the spot and patch.
|
42
|
+
* Added the TaskScheduler#exists? method.
|
43
|
+
* Added the TaskScheduler#tasks alias for the TaskScheduler#enum method.
|
44
|
+
* The TaskScheduler#new_work_item method now accepts symbols as well as
|
45
|
+
strings for hash keys, and ignores case. Also, the keys are now validated.
|
46
|
+
* Renamed the example file and test file.
|
47
|
+
* Added the 'example' Rake task.
|
48
|
+
* Fixed some code in the README synopsis that was incorrect.
|
49
|
+
|
50
|
+
== 0.1.0 - 11-May-2008
|
51
|
+
* The TaskScheduler#save instance method now accepts an optional file name.
|
52
|
+
* Most of the TaskScheduler setter methods now return the value specified
|
53
|
+
instead of true.
|
54
|
+
* Removed the RUN_ONLY_IF_DOCKED and RUN_IF_CONNECTED_TO_INTERNET constants.
|
55
|
+
The MSDN docs say that they are unused.
|
56
|
+
* Added more documentation. Much more rdoc friendly now.
|
57
|
+
* Added many more tests.
|
58
|
+
* Better type handling for bad arguments.
|
59
|
+
* Added a Rakefile with tasks for building, installation and testing.
|
60
|
+
* Added a gemspec.
|
61
|
+
* Inlined the rdoc documentation.
|
62
|
+
* Internal project reorganization and code cleanup.
|
63
|
+
|
64
|
+
== 0.0.3 - 1-Mar-2005
|
65
|
+
* Bug fix for the bitFieldToHumanDays() internal function.
|
66
|
+
* Moved the 'examples' directory to the toplevel directory.
|
67
|
+
* Made the CHANGES and README files rdoc friendly.
|
68
|
+
* Minor updates to taskscheduler.h.
|
69
|
+
|
70
|
+
== 0.0.2 - 04-Aug-2004
|
71
|
+
* Now uses the newer allocation framework and replaced all instances of the
|
72
|
+
deprecated STR2CSTR() function with StringValuePtr(). This means that, as
|
73
|
+
of this release, Ruby 1.8.0 or later is required.
|
74
|
+
* Modified the constructor to accept arguments. This is just some sugar for
|
75
|
+
creating a new task item in one call instead of two.
|
76
|
+
* The argument to trigger= now must be a hash. The same goes for the 'type'
|
77
|
+
sub-hash.
|
78
|
+
* Added the add_trigger() method. Actually, the C code for this method was
|
79
|
+
already in place, I simply forgot to create a corresponding Ruby method
|
80
|
+
for it.
|
81
|
+
* Removed the create_trigger() method. This was really nothing more than an
|
82
|
+
alias for trigger=(). I got confused somehow.
|
83
|
+
* Test suite modified and many more tests added.
|
84
|
+
* Documentation updates, including docs for a couple of methods that I had
|
85
|
+
accidentally omitted previously.
|
86
|
+
|
87
|
+
== 0.0.1 - 24-Apr-2004
|
88
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,11 +1,9 @@
|
|
1
|
-
* CHANGES
|
2
|
-
* MANIFEST
|
3
|
-
* README
|
4
|
-
* Rakefile
|
5
|
-
* win32-taskscheduler.gemspec
|
6
|
-
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
* examples/taskscheduler_test.rb
|
11
|
-
* test/tc_taskscheduler.rb
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* win32-taskscheduler.gemspec
|
6
|
+
* lib/win32/taskscheduler.rb
|
7
|
+
* lib/win32/windows/helper.rb
|
8
|
+
* examples/taskscheduler_test.rb
|
9
|
+
* test/test_taskscheduler.rb
|
data/README
CHANGED
@@ -1,76 +1,68 @@
|
|
1
|
-
= Description
|
2
|
-
The win32-taskscheduler library is a Ruby interface to the MS Windows Task
|
3
|
-
Scheduler. It is analogous to the Unix cron daemon.
|
4
|
-
|
5
|
-
=
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
All Rights Reserved
|
70
|
-
|
71
|
-
= License
|
72
|
-
Artistic 2.0
|
73
|
-
|
74
|
-
= Authors
|
75
|
-
Park Heesob
|
76
|
-
Daniel Berger
|
1
|
+
= Description
|
2
|
+
The win32-taskscheduler library is a Ruby interface to the MS Windows Task
|
3
|
+
Scheduler. It is analogous to the Unix cron daemon.
|
4
|
+
|
5
|
+
= Installation
|
6
|
+
gem install win32-taskscheduler
|
7
|
+
|
8
|
+
= Synopsis
|
9
|
+
require 'win32/taskscheduler'
|
10
|
+
include Win32
|
11
|
+
|
12
|
+
ts = TaskScheduler.new
|
13
|
+
|
14
|
+
# Create a trigger that starts on April 25, 2014 at 11:05 pm. The trigger
|
15
|
+
# will run on the first and last week of the month, on Monday and Friday,
|
16
|
+
# in the months of April and May.
|
17
|
+
#
|
18
|
+
trigger = {
|
19
|
+
:start_year => 2014,
|
20
|
+
:start_month => 4,
|
21
|
+
:start_day => 25,
|
22
|
+
:start_hour => 23,
|
23
|
+
:start_minute => 5,
|
24
|
+
:trigger_type => TaskScheduler::MONTHLYDOW,
|
25
|
+
:type => {
|
26
|
+
:weeks => TaskScheduler::FIRST_WEEK | TaskScheduler::LAST_WEEK,
|
27
|
+
:days_of_week => TaskScheduler::MONDAY | TaskScheduler::FRIDAY,
|
28
|
+
:months => TaskScheduler::APRIL | TaskScheduler::MAY
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
ts.new_work_item('my_notepad', trigger)
|
33
|
+
ts.application_name = 'notepad.exe'
|
34
|
+
ts.activate('my_notepad')
|
35
|
+
|
36
|
+
= Documentation
|
37
|
+
If you installed this library as a gem then the documentation was built for
|
38
|
+
you and can be viewed if your gem server is running. There is also some
|
39
|
+
documentation on the github wiki page.
|
40
|
+
|
41
|
+
= Acknowledgements
|
42
|
+
This library was modeled to some degree on the Win32::TaskScheduler Perl
|
43
|
+
module by Umberto Nicoletti. However, there are some differences. Please see
|
44
|
+
the documentation for details.
|
45
|
+
|
46
|
+
= Warranty
|
47
|
+
This package is provided "as is" and without any express or
|
48
|
+
implied warranties, including, without limitation, the implied
|
49
|
+
warranties of merchantability and fitness for a particular purpose.
|
50
|
+
|
51
|
+
= Known Issues
|
52
|
+
In some cases JRuby appears to raise a native exception rather than a
|
53
|
+
Ruby exception on failure. This should be mostly harmless.
|
54
|
+
|
55
|
+
Please submit any bug reports to the project page at
|
56
|
+
http://github.com/djberg96/win32-taskscheduler or
|
57
|
+
http://www.rubyforge.org/projects/win32utils.
|
58
|
+
|
59
|
+
= Copyright
|
60
|
+
(C) 2003-2014 Daniel J. Berger
|
61
|
+
All Rights Reserved
|
62
|
+
|
63
|
+
= License
|
64
|
+
Artistic 2.0
|
65
|
+
|
66
|
+
= Authors
|
67
|
+
Park Heesob
|
68
|
+
Daniel Berger
|
data/Rakefile
CHANGED
@@ -1,34 +1,37 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/
|
3
|
-
require 'rake/
|
4
|
-
|
5
|
-
include
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
CLEAN.include("**/*.gem", "**/*.rbc")
|
6
|
+
|
7
|
+
namespace 'gem' do
|
8
|
+
desc 'Build the win32-taskscheduler gem'
|
9
|
+
task :create => [:clean] do
|
10
|
+
spec = eval(IO.read('win32-taskscheduler.gemspec'))
|
11
|
+
if Gem::VERSION < "2.0"
|
12
|
+
Gem::Builder.new(spec).build
|
13
|
+
else
|
14
|
+
require 'rubygems/package'
|
15
|
+
Gem::Package.build(spec)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Install the win32-taskscheduler library as a gem'
|
20
|
+
task :install => [:build] do
|
21
|
+
file = Dir['win32-taskscheduler*.gem'].first
|
22
|
+
sh "gem install #{file}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Run the example code'
|
27
|
+
task :example do
|
28
|
+
ruby '-Iib examples/taskscheduler_example.rb'
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Run the test suite for the win32-taskscheduler library'
|
32
|
+
Rake::TestTask.new do |t|
|
33
|
+
t.verbose = true
|
34
|
+
t.warning = true
|
35
|
+
end
|
36
|
+
|
37
|
+
task :default => :test
|
@@ -1,56 +1,56 @@
|
|
1
|
-
#######################################################################
|
2
|
-
# taskscheduler_example.rb
|
3
|
-
#
|
4
|
-
# A test script for general futzing. You can run this example via the
|
5
|
-
# 'example' rake task.
|
6
|
-
#
|
7
|
-
# Modify as you see fit.
|
8
|
-
#######################################################################
|
9
|
-
require 'win32/taskscheduler'
|
10
|
-
require 'fileutils'
|
11
|
-
require 'pp'
|
12
|
-
include Win32
|
13
|
-
|
14
|
-
puts 'VERSION: ' + TaskScheduler::VERSION
|
15
|
-
|
16
|
-
ts = TaskScheduler.new
|
17
|
-
|
18
|
-
trigger = {
|
19
|
-
"start_year" => 2009,
|
20
|
-
"start_month" => 4,
|
21
|
-
"start_day" => 11,
|
22
|
-
"start_hour" => 7,
|
23
|
-
"start_minute" => 14,
|
24
|
-
"trigger_type" => TaskScheduler::DAILY,
|
25
|
-
"type" => { "days_interval" => 1 }
|
26
|
-
}
|
27
|
-
|
28
|
-
unless ts.enum.grep(/foo/).length > 0
|
29
|
-
ts.new_work_item("foo", trigger)
|
30
|
-
ts.application_name = "notepad.exe"
|
31
|
-
ts.save
|
32
|
-
puts "Task Added"
|
33
|
-
end
|
34
|
-
|
35
|
-
ts.activate("foo")
|
36
|
-
ts.priority = TaskScheduler::IDLE
|
37
|
-
ts.working_directory = "C:\\"
|
38
|
-
|
39
|
-
puts "App name: " + ts.application_name
|
40
|
-
puts "Creator: " + ts.creator
|
41
|
-
puts "Exit code: " + ts.exit_code.to_s
|
42
|
-
puts "Flags: " + ts.flags.to_s
|
43
|
-
puts "Max run time: " + ts.max_run_time.to_s
|
44
|
-
puts "Next run time: " + ts.next_run_time.to_s
|
45
|
-
puts "Parameters: " + ts.parameters
|
46
|
-
puts "Priority: " + ts.priority.to_s
|
47
|
-
puts "Status: " + ts.status
|
48
|
-
puts "Trigger count: " + ts.trigger_count.to_s
|
49
|
-
puts "Trigger string: " + ts.trigger_string(0)
|
50
|
-
puts "Working directory: " + ts.working_directory
|
51
|
-
puts "Trigger: "
|
52
|
-
|
53
|
-
pp ts.trigger(0)
|
54
|
-
|
55
|
-
ts.delete("foo")
|
56
|
-
puts "Task deleted"
|
1
|
+
#######################################################################
|
2
|
+
# taskscheduler_example.rb
|
3
|
+
#
|
4
|
+
# A test script for general futzing. You can run this example via the
|
5
|
+
# 'example' rake task.
|
6
|
+
#
|
7
|
+
# Modify as you see fit.
|
8
|
+
#######################################################################
|
9
|
+
require 'win32/taskscheduler'
|
10
|
+
require 'fileutils'
|
11
|
+
require 'pp'
|
12
|
+
include Win32
|
13
|
+
|
14
|
+
puts 'VERSION: ' + TaskScheduler::VERSION
|
15
|
+
|
16
|
+
ts = TaskScheduler.new
|
17
|
+
|
18
|
+
trigger = {
|
19
|
+
"start_year" => 2009,
|
20
|
+
"start_month" => 4,
|
21
|
+
"start_day" => 11,
|
22
|
+
"start_hour" => 7,
|
23
|
+
"start_minute" => 14,
|
24
|
+
"trigger_type" => TaskScheduler::DAILY,
|
25
|
+
"type" => { "days_interval" => 1 }
|
26
|
+
}
|
27
|
+
|
28
|
+
unless ts.enum.grep(/foo/).length > 0
|
29
|
+
ts.new_work_item("foo", trigger)
|
30
|
+
ts.application_name = "notepad.exe"
|
31
|
+
ts.save
|
32
|
+
puts "Task Added"
|
33
|
+
end
|
34
|
+
|
35
|
+
ts.activate("foo")
|
36
|
+
ts.priority = TaskScheduler::IDLE
|
37
|
+
ts.working_directory = "C:\\"
|
38
|
+
|
39
|
+
puts "App name: " + ts.application_name
|
40
|
+
puts "Creator: " + ts.creator
|
41
|
+
puts "Exit code: " + ts.exit_code.to_s
|
42
|
+
puts "Flags: " + ts.flags.to_s
|
43
|
+
puts "Max run time: " + ts.max_run_time.to_s
|
44
|
+
puts "Next run time: " + ts.next_run_time.to_s
|
45
|
+
puts "Parameters: " + ts.parameters
|
46
|
+
puts "Priority: " + ts.priority.to_s
|
47
|
+
puts "Status: " + ts.status
|
48
|
+
puts "Trigger count: " + ts.trigger_count.to_s
|
49
|
+
puts "Trigger string: " + ts.trigger_string(0)
|
50
|
+
puts "Working directory: " + ts.working_directory
|
51
|
+
puts "Trigger: "
|
52
|
+
|
53
|
+
pp ts.trigger(0)
|
54
|
+
|
55
|
+
ts.delete("foo")
|
56
|
+
puts "Task deleted"
|