rwdschedule 0.99 → 1.00

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/Readme.txt +10 -0
  2. data/code/superant.com.schedule/downloadrwdschedulefiles.rb +19 -13
  3. data/code/superant.com.schedule/loadconfigurationrecord.rb +1 -2
  4. data/code/superant.com.schedule/saveconfigurationrecord.rb +4 -1
  5. data/code/superant.com.schedule/test_cases.rb +46 -0
  6. data/configuration/rwdapplicationidentity.dist +1 -1
  7. data/configuration/rwdschedule.dist +3 -2
  8. data/configuration/rwdtinker.dist +2 -2
  9. data/extras/icalendar/base.rb +17 -0
  10. data/extras/icalendar/calendar.rb +44 -0
  11. data/extras/icalendar/calendar_parser.rb +237 -0
  12. data/extras/icalendar/component.rb +91 -0
  13. data/extras/icalendar/component/alarm.rb +16 -0
  14. data/extras/icalendar/component/event.rb +25 -0
  15. data/extras/icalendar/component/freebusy.rb +12 -0
  16. data/extras/icalendar/component/journal.rb +25 -0
  17. data/extras/icalendar/component/timezone.rb +26 -0
  18. data/extras/icalendar/component/todo.rb +21 -0
  19. data/extras/icalendar/helpers.rb +103 -0
  20. data/extras/icalendar/parameter.rb +25 -0
  21. data/extras/zip/ioextras.rb +114 -0
  22. data/extras/zip/stdrubyext.rb +111 -0
  23. data/extras/zip/tempfile_bugfixed.rb +195 -0
  24. data/extras/zip/zip.rb +1377 -0
  25. data/extras/zip/zipfilesystem.rb +558 -0
  26. data/extras/zip/ziprequire.rb +61 -0
  27. data/gui/00coreguibegin/applicationguitop.rwd +1 -1
  28. data/rwd_files/HowTo_Schedule.txt +4 -0
  29. data/rwd_files/HowTo_Tinker.txt +3 -0
  30. data/schedules/200505may02a.sch +4 -0
  31. data/tests/RubyGauge.rb +179 -0
  32. data/tests/makedist.rb +1 -0
  33. metadata +24 -7
  34. data/schedules/200502february22 test event.sch +0 -5
  35. data/updates/200507july04a.sch +0 -8
@@ -0,0 +1,91 @@
1
+ module Icalendar
2
+ # The body of the iCalendar object consists of a sequence of calendar
3
+ # properties and one or more calendar components. The calendar
4
+ # properties are attributes that apply to the calendar as a whole. The
5
+ # calendar components are collections of properties that express a
6
+ # particular calendar semantic. For example, the calendar component can
7
+ # specify an event, a to-do, a journal entry, time zone information, or
8
+ # free/busy time information, or an alarm.
9
+ class Component < Icalendar::Base
10
+
11
+ attr_reader :name
12
+ attr_accessor :properties, :property_params
13
+
14
+ def initialize(name)
15
+ @name = name
16
+ @properties = {}
17
+ @property_params = {}
18
+
19
+ @@logger.info("New #{@name[1,@name.size].capitalize}...")
20
+ end
21
+
22
+ def print_string
23
+ s = ""
24
+
25
+ # Begin a new component
26
+ s << "BEGIN:#{@name.upcase}\r\n"
27
+
28
+ # Then print the properties, possible parameters and potentially
29
+ # multiple parameter values for each parameter.
30
+ @properties.each do |key,value|
31
+ # Property name
32
+ s << "#{key.upcase}"
33
+
34
+ # Possible parameters
35
+ if @property_params.has_key?(key)
36
+ params = @property_params[key]
37
+ params.each do |key,val|
38
+ s << ";#{key}"
39
+ unless val.respond_to?(:to_ary)
40
+ val = [ val ]
41
+ end
42
+
43
+ # Possible parameter values
44
+ unless val.empty?
45
+ s << "="
46
+ sep = "" # First entry comes after = sign, but then we need commas
47
+ val.each do |pval|
48
+ s << sep << pval
49
+ sep = ","
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ # Property value
56
+ s << ":#{value}\r\n"
57
+ end
58
+
59
+ # Any custom body of the derived component
60
+ yield(s)
61
+
62
+ # End of this component
63
+ s << "END:#{@name.upcase}\r\n"
64
+ end
65
+
66
+ # Dynamically execute getters and setters for properties and
67
+ # property parameters. This lets us handle all the general text properties
68
+ # as well as custom app related properties in a natural way, but we don't
69
+ # have to write a million getters and setters for every possible thing we
70
+ # want to support.
71
+ def method_missing(method_id, *args)
72
+ method_name = method_id.id2name.upcase
73
+
74
+ if method_name =~ /\w+_PARAMS/ # Its a parameter request
75
+ hash = @property_params
76
+ val = args
77
+ else # Or its a property request
78
+ hash = @properties
79
+ val = args.first unless args.empty?
80
+ end
81
+
82
+ if method_name =~ /(.*)(=)/ # Its a setter
83
+ hash[$1] = val
84
+ @@logger.debug("Setting #{$1} => #{val}")
85
+ else # Or its a getter
86
+ @@logger.debug("Getting #{method_name} => #{hash[method_name]}")
87
+ return hash[method_name]
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,16 @@
1
+ module Icalendar
2
+ # An Alarm calendar component is a grouping of component
3
+ # properties that is a reminder or alarm for an event or a
4
+ # to-do. For example, it may be used to define a reminder for a
5
+ # pending Event or an overdue Todo.
6
+ class Alarm < Component
7
+ def initialize()
8
+ super("VALARM")
9
+
10
+ end
11
+
12
+ def to_s
13
+ print_string {}
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,25 @@
1
+ module Icalendar
2
+ # A Event calendar component is a grouping of component
3
+ # properties, and possibly including Alarm calendar components, that
4
+ # represents a scheduled amount of time on a calendar. For example, it
5
+ # can be an activity; such as a one-hour long, department meeting from
6
+ # 8:00 AM to 9:00 AM, tomorrow. Generally, an event will take up time
7
+ # on an individual calendar.
8
+ class Event < Component
9
+ include Dtstart
10
+
11
+ attr_accessor :alarms
12
+
13
+ def initialize()
14
+ super("VEVENT")
15
+
16
+ @alarms = []
17
+ end
18
+
19
+ def to_s
20
+ print_string do |s|
21
+ @alarms.each { |alarm| s << alarm.to_s }
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,12 @@
1
+ module Icalendar
2
+ # A Freebusy calendar component is a grouping of
3
+ # component properties that represents either a request for, a reply to
4
+ # a request for free or busy time information or a published set of
5
+ # busy time information.
6
+ class Freebusy < Component
7
+
8
+ def initialize()
9
+ super("VFREEBUSY")
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,25 @@
1
+ module Icalendar
2
+ # A Journal calendar component is a grouping of
3
+ # component properties that represent one or more descriptive text
4
+ # notes associated with a particular calendar date. The "DTSTART"
5
+ # property is used to specify the calendar date that the journal entry
6
+ # is associated with. Generally, it will have a DATE value data type,
7
+ # but it can also be used to specify a DATE-TIME value data type.
8
+ # Examples of a journal entry include a daily record of a legislative
9
+ # body or a journal entry of individual telephone contacts for the day
10
+ # or an ordered list of accomplishments for the day. The Journal
11
+ # calendar component can also be used to associate a document with a
12
+ # calendar date.
13
+ class Journal < Component
14
+
15
+ def initialize()
16
+ super("VJOURNAL")
17
+ end
18
+
19
+ def to_s
20
+ print_string { }
21
+ end
22
+
23
+ end
24
+ end
25
+
@@ -0,0 +1,26 @@
1
+ module Icalendar
2
+ # A Timezone is unambiguously defined by the set of time
3
+ # measurement rules determined by the governing body for a given
4
+ # geographic area. These rules describe at a minimum the base offset
5
+ # from UTC for the time zone, often referred to as the Standard Time
6
+ # offset. Many locations adjust their Standard Time forward or backward
7
+ # by one hour, in order to accommodate seasonal changes in number of
8
+ # daylight hours, often referred to as Daylight Saving Time. Some
9
+ # locations adjust their time by a fraction of an hour. Standard Time
10
+ # is also known as Winter Time. Daylight Saving Time is also known as
11
+ # Advanced Time, Summer Time, or Legal Time in certain countries. The
12
+ # following table shows the changes in time zone rules in effect for
13
+ # New York City starting from 1967. Each line represents a description
14
+ # or rule for a particular observance.
15
+ class Timezone < Component
16
+
17
+ def initialize()
18
+ super("VTIMEZONE")
19
+ @components = components
20
+ end
21
+
22
+ def to_s
23
+ super.to_s { |s| s << @components.each { |component| component.to_s } }
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ module Icalendar
2
+ # A Todo calendar component is a grouping of component
3
+ # properties and possibly Alarm calendar components that represent
4
+ # an action-item or assignment. For example, it can be used to
5
+ # represent an item of work assigned to an individual; such as "turn in
6
+ # travel expense today".
7
+ class Todo < Component
8
+
9
+ attr_reader :alarms
10
+
11
+ def initialize()
12
+ super("VTODO")
13
+
14
+ @alarms = alarms
15
+ end
16
+
17
+ def to_s
18
+ print_string { |s| @alarms.each { |alarm| alarm.to_s } }
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,103 @@
1
+ module Icalendar
2
+ # date = date-fullyear date-month date-mday
3
+ # date-fullyear = 4 DIGIT
4
+ # date-month = 2 DIGIT
5
+ # date-mday = 2 DIGIT
6
+ DATE = '(\d\d\d\d)(\d\d)(\d\d)'
7
+
8
+ # time = time-hour [":"] time-minute [":"] time-second [time-secfrac] [time-zone]
9
+ # time-hour = 2 DIGIT
10
+ # time-minute = 2 DIGIT
11
+ # time-second = 2 DIGIT
12
+ # time-secfrac = "," 1*DIGIT
13
+ # time-zone = "Z" / time-numzone
14
+ # time-numzome = sign time-hour [":"] time-minute
15
+ TIME = '(\d\d)(\d\d)(\d\d)(Z)?'
16
+
17
+
18
+ # Maps to dtstart property
19
+ # TODO: Look into having the DateTime library do more of the work...
20
+ module Dtstart
21
+
22
+ # Set the starting DateTime of an Event, Todo,
23
+ # Freebusy or Timezone component. If utc is set to true
24
+ # then this time represents absolute time without regard for
25
+ # timezone information.
26
+ def setStart(start, utc = false)
27
+ if start.respond_to?(:year) # Date format
28
+ s = ""
29
+
30
+ # 4 digit year
31
+ s << start.year.to_s
32
+
33
+ # Double digit month
34
+ s << "0" unless start.month > 9
35
+ s << start.month.to_s
36
+
37
+ # Double digit day
38
+ s << "0" unless start.day > 9
39
+ s << start.day.to_s
40
+ else
41
+ raise InvalidPropertyValue, "Cannot access year on start argument object!"
42
+ end
43
+
44
+ if start.respond_to?(:hour) # include Time format if possible
45
+ s << "T"
46
+
47
+ # Double digit hour
48
+ s << "0" unless start.hour > 9
49
+ s << start.hour.to_s
50
+
51
+ # Double digit minute
52
+ s << "0" unless start.min > 9
53
+ s << start.min.to_s
54
+
55
+ # Double digit second
56
+ s << "0" unless start.sec > 9
57
+ s << start.sec.to_s
58
+ end
59
+
60
+ # UTC time gets a Z suffix
61
+ if utc
62
+ s << "Z"
63
+ end
64
+
65
+ @properties["DTSTART"] = s
66
+ end
67
+
68
+ # Returns the starting DateTime of an Event, Todo, Freebusy or
69
+ # Timezone component.
70
+ def getStart
71
+ # If we don't have a start time then return nil.
72
+ unless @properties.has_key?("DTSTART")
73
+ return nil
74
+ end
75
+ s = @properties["DTSTART"]
76
+
77
+ # If we can't parse the start time figure its bad and return nil.
78
+ unless s =~ %r{#{DATE}}i
79
+ return nil
80
+ end
81
+
82
+ # We can at least create a Date object
83
+ year = $1
84
+ month = $2
85
+ day = $3
86
+
87
+ puts "s: #{s}"
88
+ puts "#{DATE}T#{TIME}"
89
+ # We might be able to get the time too
90
+ if s =~ %r{"#{DATE}T#{TIME}"}i
91
+ hour = $5
92
+ min = $6
93
+ sec = $7
94
+
95
+ puts "Hour: #{hour.to_s}"
96
+
97
+ return DateTime.new(year, month, day, hour, min, sec)
98
+ else
99
+ return Date.new(year.to_i, month.to_i, day.to_i)
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,25 @@
1
+ module Icalendar
2
+
3
+ # A property can have attributes associated with it. These "property
4
+ # parameters" contain meta-information about the property or the
5
+ # property value. Property parameters are provided to specify such
6
+ # information as the location of an alternate text representation for a
7
+ # property value, the language of a text property value, the data type
8
+ # of the property value and other attributes.
9
+ class Parameter < Icalendar::Content
10
+
11
+ def to_s
12
+ s = ""
13
+
14
+ s << "#{@name}="
15
+ if is_escapable?
16
+ s << escape(print_value())
17
+ else
18
+ s << print_value
19
+ end
20
+
21
+ s
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,114 @@
1
+ module IOExtras
2
+ module FakeIO
3
+ def kind_of?(object)
4
+ object == IO || super
5
+ end
6
+ end
7
+
8
+ # Implements many of the convenience methods of IO
9
+ # such as gets, getc, readline and readlines
10
+ # depends on: input_finished?, produce_input and read
11
+ module AbstractInputStream
12
+ include Enumerable
13
+ include FakeIO
14
+
15
+ def initialize
16
+ super
17
+ @lineno = 0
18
+ @outputBuffer = ""
19
+ end
20
+
21
+ attr_accessor :lineno
22
+
23
+ def readlines(aSepString = $/)
24
+ retVal = []
25
+ each_line(aSepString) { |line| retVal << line }
26
+ return retVal
27
+ end
28
+
29
+ def gets(aSepString=$/)
30
+ @lineno = @lineno.next
31
+ return read if aSepString == nil
32
+ aSepString="#{$/}#{$/}" if aSepString == ""
33
+
34
+ bufferIndex=0
35
+ while ((matchIndex = @outputBuffer.index(aSepString, bufferIndex)) == nil)
36
+ bufferIndex=@outputBuffer.length
37
+ if input_finished?
38
+ return @outputBuffer.empty? ? nil : flush
39
+ end
40
+ @outputBuffer << produce_input
41
+ end
42
+ sepIndex=matchIndex + aSepString.length
43
+ return @outputBuffer.slice!(0...sepIndex)
44
+ end
45
+
46
+ def flush
47
+ retVal=@outputBuffer
48
+ @outputBuffer=""
49
+ return retVal
50
+ end
51
+
52
+ def readline(aSepString = $/)
53
+ retVal = gets(aSepString)
54
+ raise EOFError if retVal == nil
55
+ return retVal
56
+ end
57
+
58
+ def each_line(aSepString = $/)
59
+ while true
60
+ yield readline(aSepString)
61
+ end
62
+ rescue EOFError
63
+ end
64
+
65
+ alias_method :each, :each_line
66
+ end
67
+
68
+
69
+ #relies on <<
70
+ module AbstractOutputStream
71
+ include FakeIO
72
+
73
+ def write(data)
74
+ self << data
75
+ data.to_s.length
76
+ end
77
+
78
+
79
+ def print(*params)
80
+ self << params.to_s << $\.to_s
81
+ end
82
+
83
+ def printf(aFormatString, *params)
84
+ self << sprintf(aFormatString, *params)
85
+ end
86
+
87
+ def putc(anObject)
88
+ self << case anObject
89
+ when Fixnum then anObject.chr
90
+ when String then anObject
91
+ else raise TypeError, "putc: Only Fixnum and String supported"
92
+ end
93
+ anObject
94
+ end
95
+
96
+ def puts(*params)
97
+ params << "\n" if params.empty?
98
+ params.flatten.each {
99
+ |element|
100
+ val = element.to_s
101
+ self << val
102
+ self << "\n" unless val[-1,1] == "\n"
103
+ }
104
+ end
105
+
106
+ end
107
+
108
+ end # IOExtras namespace module
109
+
110
+
111
+
112
+ # Copyright (C) 2002-2004 Thomas Sondergaard
113
+ # rubyzip is free software; you can redistribute it and/or
114
+ # modify it under the terms of the ruby license.