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 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.2 - 29-Feb-2012
2
- * Moved some include statements inside the TaskScheduler class to avoid
3
- polluting Object. Thanks go to Josh Cooper for the spot and patch.
4
- * Minor formatting tweaks to silence 1.9 warnings.
5
-
6
- == 0.2.1 - 8-Oct-2011
7
- * Fixed a bug that would not allow task to run as SYSTEM. Thanks go to
8
- Josh cooper for the spot and patch.
9
- * Fixed a bug in new_work_item that would cause it to crash if you tried
10
- to create a work item that already existed. An error is now raised instead.
11
- Thanks go to Pete Higgins for the spot.
12
- * The set_trigger and trigger= methods now internally transform and validate
13
- the trigger hash in the same manner as new_work_item. Thanks again go to
14
- Pete Higgins.
15
- * Cleaned up the repo. The C source files have been removed from the main
16
- repository (and this gem). They are in a separate branch on github for
17
- anyone who misses them.
18
- * Refactored the Rakefile, removing tasks related to the old C source files,
19
- and added tasks for cleaning, building and installing a gem.
20
- * Updated the README file, eliminating references to anything that was only
21
- related to the older C version.
22
-
23
- == 0.2.0 - 19-Jun-2009
24
- * Rewritten in pure Ruby!
25
- * The TaskScheduler::ONCE constant is now a valid trigger type. Thanks go to
26
- Uri Iurgel for the spot and patch.
27
- * Added the TaskScheduler#exists? method.
28
- * Added the TaskScheduler#tasks alias for the TaskScheduler#enum method.
29
- * The TaskScheduler#new_work_item method now accepts symbols as well as
30
- strings for hash keys, and ignores case. Also, the keys are now validated.
31
- * Renamed the example file and test file.
32
- * Added the 'example' Rake task.
33
- * Fixed some code in the README synopsis that was incorrect.
34
-
35
- == 0.1.0 - 11-May-2008
36
- * The TaskScheduler#save instance method now accepts an optional file name.
37
- * Most of the TaskScheduler setter methods now return the value specified
38
- instead of true.
39
- * Removed the RUN_ONLY_IF_DOCKED and RUN_IF_CONNECTED_TO_INTERNET constants.
40
- The MSDN docs say that they are unused.
41
- * Added more documentation. Much more rdoc friendly now.
42
- * Added many more tests.
43
- * Better type handling for bad arguments.
44
- * Added a Rakefile with tasks for building, installation and testing.
45
- * Added a gemspec.
46
- * Inlined the rdoc documentation.
47
- * Internal project reorganization and code cleanup.
48
-
49
- == 0.0.3 - 1-Mar-2005
50
- * Bug fix for the bitFieldToHumanDays() internal function.
51
- * Moved the 'examples' directory to the toplevel directory.
52
- * Made the CHANGES and README files rdoc friendly.
53
- * Minor updates to taskscheduler.h.
54
-
55
- == 0.0.2 - 04-Aug-2004
56
- * Now uses the newer allocation framework and replaced all instances of the
57
- deprecated STR2CSTR() function with StringValuePtr(). This means that, as
58
- of this release, Ruby 1.8.0 or later is required.
59
- * Modified the constructor to accept arguments. This is just some sugar for
60
- creating a new task item in one call instead of two.
61
- * The argument to trigger= now must be a hash. The same goes for the 'type'
62
- sub-hash.
63
- * Added the add_trigger() method. Actually, the C code for this method was
64
- already in place, I simply forgot to create a corresponding Ruby method
65
- for it.
66
- * Removed the create_trigger() method. This was really nothing more than an
67
- alias for trigger=(). I got confused somehow.
68
- * Test suite modified and many more tests added.
69
- * Documentation updates, including docs for a couple of methods that I had
70
- accidentally omitted previously.
71
-
72
- == 0.0.1 - 24-Apr-2004
73
- * Initial release
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
- * ext/extconf.rb
7
- * ext/win32/taskscheduler.c
8
- * ext/win32/taskscheduler.h
9
- * doc/taskscheduler.txt
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
- = Prerequisites
6
- * win32-api
7
- * windows-pr
8
-
9
- = Installation
10
- gem install win32-taskscheduler
11
-
12
- = Synopsis
13
- require 'win32/taskscheduler'
14
- include Win32
15
-
16
- ts = TaskScheduler.new
17
-
18
- # Create a trigger that starts on April 25, 2014 at 11:05 pm. The trigger
19
- # will run on the first and last week of the month, on Monday and Friday,
20
- # in the months of April and May.
21
- #
22
- trigger = {
23
- :start_year => 2014,
24
- :start_month => 4,
25
- :start_day => 25,
26
- :start_hour => 23,
27
- :start_minute => 5,
28
- :trigger_type => TaskScheduler::MONTHLYDOW,
29
- :type => {
30
- :weeks => TaskScheduler::FIRST_WEEK | TaskScheduler::LAST_WEEK,
31
- :days_of_week => TaskScheduler::MONDAY | TaskScheduler::FRIDAY,
32
- :months => TaskScheduler::APRIL | TaskScheduler::MAY
33
- }
34
- }
35
-
36
- ts.new_work_item('my_notepad', trigger)
37
- ts.application_name = 'notepad.exe'
38
- ts.save
39
-
40
- = Documentation
41
- If you installed this library as a gem then the documentation was built for
42
- you and can be viewed if your gem server is running. There is also some
43
- documentation on the github wiki page.
44
-
45
- Otherwise, you can look at the doc/taskscheduler.txt file which should have
46
- everything you need.
47
-
48
- = Acknowledgements
49
- This library was modeled to some degree on the Win32::TaskScheduler Perl
50
- module by Umberto Nicoletti. However, there are some differences. Please see
51
- the documentation for details.
52
-
53
- = Using OLE
54
- There's an OLE version in the works. Please see the 'ole' branch on github.
55
-
56
- = Warranty
57
- This package is provided "as is" and without any express or
58
- implied warranties, including, without limitation, the implied
59
- warranties of merchantability and fitness for a particular purpose.
60
-
61
- = Known Issues
62
- None known.
63
-
64
- Please submit any bug reports to the project page at
65
- http://www.rubyforge.org/projects/win32utils.
66
-
67
- = Copyright
68
- (C) 2003-2012 Daniel J. Berger
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/testtask'
3
- require 'rake/clean'
4
- require 'rbconfig'
5
- include Config
6
-
7
- CLEAN.include("**/*.gem", "**/*.rbc", ".rbx")
8
-
9
- namespace 'gem' do
10
- desc 'Create the win32-taskscheduler gem'
11
- task :create => [:clean] do
12
- spec = eval(IO.read('win32-taskscheduler.gemspec'))
13
- Gem::Builder.new(spec).build
14
- end
15
-
16
- desc 'Install the win32-taskscheduler library as a gem'
17
- task :install => [:create] do
18
- file = Dir['win32-taskscheduler*.gem'].first
19
- sh "gem install #{file}"
20
- end
21
- end
22
-
23
- desc 'Run the example code'
24
- task :example do
25
- ruby '-Iib examples/taskscheduler_example.rb'
26
- end
27
-
28
- desc 'Run the test suite for the win32-taskscheduler library'
29
- Rake::TestTask.new do |t|
30
- t.verbose = true
31
- t.warning = true
32
- end
33
-
34
- task :default => :test
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"