holidays 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/LICENSE +1 -1
- data/README +1 -1
- data/lib/holidays.rb +1 -1
- data/rakefile.rb +113 -0
- metadata +3 -2
data/CHANGELOG
CHANGED
data/LICENSE
CHANGED
data/README
CHANGED
@@ -71,6 +71,6 @@ Lookup Canada Day in different regions.
|
|
71
71
|
* Source: http://code.dunae.ca/svn/holidays
|
72
72
|
* Docs: http://code.dunae.ca/holidays/doc
|
73
73
|
|
74
|
-
By Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007.
|
74
|
+
By Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007-08.
|
75
75
|
|
76
76
|
Made on Vancouver Island.
|
data/lib/holidays.rb
CHANGED
data/rakefile.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
require 'rake/gempackagetask'
|
5
|
+
require 'yaml'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'lib/holidays'
|
8
|
+
require 'data/build_defs'
|
9
|
+
|
10
|
+
desc 'Run all tests'
|
11
|
+
task :test => ["test:lib", "test:defs"]
|
12
|
+
|
13
|
+
namespace :test do
|
14
|
+
desc 'Run the unit tests.'
|
15
|
+
Rake::TestTask.new(:lib) do |t|
|
16
|
+
t.libs << 'lib'
|
17
|
+
t.test_files = FileList['test/defs/test*.rb'].exclude('test_helper.rb')
|
18
|
+
t.verbose = false
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'Run the definition tests.'
|
22
|
+
Rake::TestTask.new(:defs) do |t|
|
23
|
+
t.libs << 'lib'
|
24
|
+
t.test_files = FileList['test/test*.rb'].exclude('test_helper.rb')
|
25
|
+
t.verbose = false
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
task :doc => ["defs:manifest", :rdoc]
|
30
|
+
|
31
|
+
desc 'Generate documentation.'
|
32
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
33
|
+
rdoc.rdoc_dir = 'doc'
|
34
|
+
rdoc.title = 'Ruby Holidays Gem'
|
35
|
+
rdoc.options << '--all' << '--inline-source' << '--line-numbers'
|
36
|
+
rdoc.options << '--charset' << 'utf-8'
|
37
|
+
#rdoc.template = 'extras/rdoc_template.rb'
|
38
|
+
rdoc.rdoc_files.include('README')
|
39
|
+
rdoc.rdoc_files.include('data/SYNTAX')
|
40
|
+
rdoc.rdoc_files.include('lib/holidays/MANIFEST')
|
41
|
+
rdoc.rdoc_files.include('REFERENCES')
|
42
|
+
rdoc.rdoc_files.include('CHANGELOG')
|
43
|
+
rdoc.rdoc_files.include('LICENSE')
|
44
|
+
rdoc.rdoc_files.include('lib/*.rb')
|
45
|
+
end
|
46
|
+
|
47
|
+
spec = Gem::Specification.new do |s|
|
48
|
+
s.name = 'holidays'
|
49
|
+
s.version = '0.9.2'
|
50
|
+
s.author = 'Alex Dunae'
|
51
|
+
s.homepage = 'http://code.dunae.ca/holidays'
|
52
|
+
s.platform = Gem::Platform::RUBY
|
53
|
+
s.description = <<-EOF
|
54
|
+
A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!
|
55
|
+
EOF
|
56
|
+
s.summary = 'A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!'
|
57
|
+
s.files = FileList["{lib}/**/*", "{data}/**/*", "*.rb"].to_a
|
58
|
+
s.test_files = FileList['test/defs/test*.rb'].exclude('test_helper.rb')
|
59
|
+
s.has_rdoc = true
|
60
|
+
s.extra_rdoc_files = ['README', 'data/SYNTAX', 'lib/holidays/MANIFEST', 'REFERENCES', 'CHANGELOG', 'LICENSE']
|
61
|
+
s.rdoc_options << '--all' << '--inline-source' << '--line-numbers' << '--charset' << 'utf-8'
|
62
|
+
end
|
63
|
+
|
64
|
+
desc 'Build the gem.'
|
65
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
66
|
+
pkg.need_zip = true
|
67
|
+
pkg.need_tar = true
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Definition file tasks'
|
71
|
+
namespace :defs do
|
72
|
+
DATA_PATH = 'data'
|
73
|
+
|
74
|
+
desc 'Build holiday definition files'
|
75
|
+
task :build_all do
|
76
|
+
# load the index
|
77
|
+
def_index = YAML.load_file("#{DATA_PATH}/index.yaml")
|
78
|
+
|
79
|
+
# create a dir for the generated tests
|
80
|
+
FileUtils.mkdir_p('test/defs')
|
81
|
+
|
82
|
+
def_index['defs'].each do |region, files|
|
83
|
+
puts "Building #{region} definition module:"
|
84
|
+
files = files.collect { |f| "#{DATA_PATH}/#{f}" }
|
85
|
+
files.uniq!
|
86
|
+
|
87
|
+
module_src, test_src = parse_holiday_defs(region, files)
|
88
|
+
File.open("lib/holidays/#{region.to_s}.rb","w") do |file|
|
89
|
+
file.puts module_src
|
90
|
+
end
|
91
|
+
unless test_src.empty?
|
92
|
+
File.open("test/defs/test_defs_#{region.to_s}.rb","w") do |file|
|
93
|
+
file.puts test_src
|
94
|
+
end
|
95
|
+
end
|
96
|
+
puts "Done.\n\n"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
desc 'Build the definition manifest.'
|
101
|
+
task :manifest do
|
102
|
+
File.open("lib/holidays/MANIFEST","w") do |file|
|
103
|
+
file.puts <<-EOH
|
104
|
+
==== Regional definitions
|
105
|
+
The following definition files are included in this installation:
|
106
|
+
|
107
|
+
EOH
|
108
|
+
FileList.new('lib/holidays/*.rb').each do |str|
|
109
|
+
file.puts('* ' + str.gsub(/^lib\/|\.rb$/, ''))
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: holidays
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.9.
|
7
|
-
date: 2008-
|
6
|
+
version: 0.9.2
|
7
|
+
date: 2008-07-23 00:00:00 -07:00
|
8
8
|
summary: A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- data/united_nations.yaml
|
74
74
|
- data/us.yaml
|
75
75
|
- data/za.yaml
|
76
|
+
- rakefile.rb
|
76
77
|
- README
|
77
78
|
- REFERENCES
|
78
79
|
- CHANGELOG
|