school_days 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +57 -3
- data/Rakefile +4 -1
- data/lib/school_days.rb +1 -1
- data/test/test_date_extensions.rb +1 -1
- data/test/test_fixnum_extensions.rb +1 -1
- data/test/test_school_days.rb +1 -1
- data/test/test_school_days_calculator.rb +1 -1
- metadata +10 -10
data/README.rdoc
CHANGED
@@ -13,7 +13,7 @@ Unlike Business Time, School Days focuses on the demands of keeping a school cal
|
|
13
13
|
|
14
14
|
With School Days you can:
|
15
15
|
|
16
|
-
* 1.days.from_now.
|
16
|
+
* 1.days.from_now.school_day?
|
17
17
|
* Date.civil(2011, 05, 31).school_night?
|
18
18
|
* 2.school_days.from_now
|
19
19
|
|
@@ -85,8 +85,10 @@ This key has two subkeys:
|
|
85
85
|
* included_days
|
86
86
|
|
87
87
|
I've seen schools have school days on a Saturday, in very rare circumstances. included_days list days where you would normally not have school (weekends)... but you do this year.
|
88
|
-
|
89
|
-
|
88
|
+
|
89
|
+
Note that exceptional days should fall in the school year as a whole (see the above note about FixNum#school_days.from)
|
90
|
+
|
91
|
+
Example configure file can be found at: https://github.com/rwilcox/school_days/blob/master/rails_generators/school_days_config/templates/school_days.yml
|
90
92
|
|
91
93
|
== WHAT THIS GEM DOES NOT DO:
|
92
94
|
|
@@ -110,6 +112,58 @@ This gem also relies on manual configuration every year. It can not possibly kno
|
|
110
112
|
* I use GitFlow <https://github.com/nvie/gitflow> to develop, so bonus points for that.
|
111
113
|
|
112
114
|
|
115
|
+
== (GENERATED) Specifications for this gem
|
116
|
+
|
117
|
+
The following are generated specifications for this gem. Computers know very little about making sense, *however* these should give you some idea of the capability of this gem
|
118
|
+
|
119
|
+
Config
|
120
|
+
Config should load a file with one session with no errors.
|
121
|
+
Config should load a file with two sessions correctly.
|
122
|
+
exceptional included days should only include exceptional included days, as Ruby date objects.
|
123
|
+
holiday exceptions should only include listed holiday exceptions, as Ruby Date objects.
|
124
|
+
when loading a file with multiple sessions should be able to find the first start date.
|
125
|
+
when loading a file with multiple sessions should be able to find the last end date.
|
126
|
+
when loading a file with one session should be able to find the end date.
|
127
|
+
when loading a file with one session should be able to find the start date.
|
128
|
+
when loading an invalid config file should throw a Runtime error when we're missing start or end dates for a session.
|
129
|
+
DateExtension
|
130
|
+
Date instances should Date should respond to school_day?.
|
131
|
+
Date instances should return false for school_day? if the day is a weekend.
|
132
|
+
Date instances should return false for school_day? if the day is flagged as a holiday.
|
133
|
+
Date instances should return false if the day is not a school night.
|
134
|
+
Date instances should return true before an exceptional included day.
|
135
|
+
Date instances should return true for school_day if the day is a weekday.
|
136
|
+
Date instances should return true for school_day? if a normally off day is flagged as an included day.
|
137
|
+
Date instances should return true if the day is a school night.
|
138
|
+
Date instances should return true when the date is equal to the last date of a session.
|
139
|
+
Date instances should return true when the date is equal to the start date of a session.
|
140
|
+
Date instances when looking at a single school session should return false for school_day? if the date is outside the session (and not in exceptional included days).
|
141
|
+
Date instances when looking at a single school session should return true for school_day? if the date is inside the session (and not in exceptional included days).
|
142
|
+
Date instances when looking at multiple school sessions should return false for school_day if the weekday is between school sessions.
|
143
|
+
Date instances when looking at multiple school sessions should return false for school_day? if a weekday is is outside ALL of the sessions (and not in exceptional included days).
|
144
|
+
Date instances when looking at multiple school sessions should return false for school_day? if a weekend is is outside ALL of the sessions (and not in exceptional included days).
|
145
|
+
Date instances when looking at multiple school sessions should return true for school_day? if the date is outside one session, but inside another.
|
146
|
+
FixnumExtension
|
147
|
+
when adding a school day should elegantly handle a situation where we go outside the school year.
|
148
|
+
when adding a school day should move forward one week when adding 5 school days.
|
149
|
+
when adding a school day should move forward onto an exceptional day.
|
150
|
+
when adding a school day should move to Monday (if tomorrow is a weekend).
|
151
|
+
when adding a school day should move to the next session if we have multiple sessions.
|
152
|
+
when adding a school day should move to tomorrow (if tomorrow is a school day).
|
153
|
+
when adding a school day should skip exceptional holidays.
|
154
|
+
when subtracting a school day should elegantly handle a situation where we go outside the school year.
|
155
|
+
when subtracting a school day should move back one week when adding 5 school days.
|
156
|
+
when subtracting a school day should move backwards onto an exceptional day.
|
157
|
+
when subtracting a school day should move to Friday (if yesterday is a weekend).
|
158
|
+
when subtracting a school day should move to the previous session if we have multiple sessions.
|
159
|
+
when subtracting a school day should move to yesterday (if yesterday is a school day).
|
160
|
+
when subtracting a school day should skip exceptional holidays.
|
161
|
+
SchoolDaysCalculator
|
162
|
+
identifying if a date is in the range of the whole school year with a single session should return false when it falls OUTSIDE of the school year.
|
163
|
+
identifying if a date is in the range of the whole school year with a single session should return true when it falls in the school year.
|
164
|
+
identifying if a date is in the range of the whole school year with many sessions should return false when it falls OUTSIDE of the school year.
|
165
|
+
identifying if a date is in the range of the whole school year with many sessions should return true when it falls in the school year.
|
166
|
+
|
113
167
|
== LICENSE:
|
114
168
|
|
115
169
|
(The MIT License)
|
data/Rakefile
CHANGED
@@ -14,11 +14,14 @@ $hoe = Hoe.spec 'school_days' do
|
|
14
14
|
self.developer 'Ryan Wilcox', 'rwilcox@wilcoxd.com'
|
15
15
|
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
16
16
|
self.rubyforge_name = self.name # TODO this is default value
|
17
|
-
self.extra_deps = [['activesupport','>= 2.0.2']
|
17
|
+
self.extra_deps = [ ['activesupport','>= 2.0.2'] ]
|
18
|
+
self.extra_dev_deps = [ ["shoulda", ">= 2.10.0"] ]
|
18
19
|
|
19
20
|
end
|
20
21
|
|
21
22
|
require 'newgem/tasks'
|
23
|
+
require 'shoulda/tasks'
|
24
|
+
|
22
25
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
23
26
|
|
24
27
|
# TODO - want other tests/tasks run by default? Add them to the list
|
data/lib/school_days.rb
CHANGED
data/test/test_school_days.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
2
|
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestSchoolDaysCalculator < Test::Unit::TestCase
|
5
5
|
|
6
6
|
context "identifying if a date is in the range of the whole school year" do
|
7
7
|
context "with a single session" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: school_days
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Wilcox
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-27 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -40,15 +40,15 @@ dependencies:
|
|
40
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- - "
|
43
|
+
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
hash:
|
45
|
+
hash: 39
|
46
46
|
segments:
|
47
47
|
- 2
|
48
|
-
-
|
49
|
-
-
|
50
|
-
version: 2.
|
51
|
-
type: :
|
48
|
+
- 10
|
49
|
+
- 0
|
50
|
+
version: 2.10.0
|
51
|
+
type: :development
|
52
52
|
version_requirements: *id002
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: hoe
|