holidays 9.1.2 → 10.0.0

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.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +38 -2
  4. data/lib/generated_definitions/MANIFEST +2 -0
  5. data/lib/generated_definitions/REGIONS.rb +2 -2
  6. data/lib/generated_definitions/au.rb +16 -42
  7. data/lib/generated_definitions/europe.rb +7 -15
  8. data/lib/generated_definitions/fr.rb +2 -2
  9. data/lib/generated_definitions/gb.rb +3 -3
  10. data/lib/generated_definitions/il.rb +74 -0
  11. data/lib/generated_definitions/lu.rb +1 -1
  12. data/lib/generated_definitions/mc.rb +36 -0
  13. data/lib/generated_definitions/northamerica.rb +3 -2
  14. data/lib/generated_definitions/nz.rb +9 -1
  15. data/lib/generated_definitions/pl.rb +3 -11
  16. data/lib/generated_definitions/us.rb +3 -2
  17. data/lib/holidays/definition/context/function_processor.rb +4 -5
  18. data/lib/holidays/definition/context/generator.rb +3 -1
  19. data/lib/holidays/version.rb +1 -1
  20. metadata +5 -309
  21. data/.github/workflows/changelog-check.yml +0 -47
  22. data/.github/workflows/release.yml +0 -46
  23. data/.github/workflows/ruby.yml +0 -26
  24. data/.gitmodules +0 -3
  25. data/CODE_OF_CONDUCT.md +0 -74
  26. data/Gemfile +0 -8
  27. data/Makefile +0 -56
  28. data/Rakefile +0 -128
  29. data/bin/console +0 -7
  30. data/bin/setup +0 -6
  31. data/doc/CONTRIBUTING.md +0 -72
  32. data/doc/MAINTAINERS.md +0 -79
  33. data/doc/REFERENCES +0 -19
  34. data/holidays.gemspec +0 -31
  35. data/test/coverage_report.rb +0 -24
  36. data/test/data/test_custom_year_range_holiday_defs.yaml +0 -31
  37. data/test/data/test_date_transform_conflict_region_1.yaml +0 -14
  38. data/test/data/test_date_transform_conflict_region_2.yaml +0 -14
  39. data/test/data/test_invalid_region.rb +0 -15
  40. data/test/data/test_region.rb +0 -15
  41. data/test/data/test_single_custom_holiday_defs.yaml +0 -12
  42. data/test/data/test_single_custom_holiday_with_custom_procs.yaml +0 -28
  43. data/test/defs/test_defs_ar.rb +0 -69
  44. data/test/defs/test_defs_at.rb +0 -31
  45. data/test/defs/test_defs_au.rb +0 -233
  46. data/test/defs/test_defs_be_fr.rb +0 -45
  47. data/test/defs/test_defs_be_nl.rb +0 -45
  48. data/test/defs/test_defs_bg.rb +0 -41
  49. data/test/defs/test_defs_br.rb +0 -49
  50. data/test/defs/test_defs_ca.rb +0 -289
  51. data/test/defs/test_defs_ch.rb +0 -51
  52. data/test/defs/test_defs_cl.rb +0 -69
  53. data/test/defs/test_defs_co.rb +0 -113
  54. data/test/defs/test_defs_cr.rb +0 -29
  55. data/test/defs/test_defs_cy.rb +0 -41
  56. data/test/defs/test_defs_cz.rb +0 -37
  57. data/test/defs/test_defs_de.rb +0 -91
  58. data/test/defs/test_defs_dk.rb +0 -47
  59. data/test/defs/test_defs_ecbtarget.rb +0 -27
  60. data/test/defs/test_defs_ee.rb +0 -41
  61. data/test/defs/test_defs_es.rb +0 -137
  62. data/test/defs/test_defs_europe.rb +0 -1526
  63. data/test/defs/test_defs_fed_ex.rb +0 -24
  64. data/test/defs/test_defs_federalreserve.rb +0 -119
  65. data/test/defs/test_defs_federalreservebanks.rb +0 -251
  66. data/test/defs/test_defs_fedex.rb +0 -31
  67. data/test/defs/test_defs_fi.rb +0 -59
  68. data/test/defs/test_defs_fr.rb +0 -43
  69. data/test/defs/test_defs_gb.rb +0 -159
  70. data/test/defs/test_defs_ge.rb +0 -53
  71. data/test/defs/test_defs_gr.rb +0 -41
  72. data/test/defs/test_defs_hk.rb +0 -93
  73. data/test/defs/test_defs_hr.rb +0 -45
  74. data/test/defs/test_defs_hu.rb +0 -47
  75. data/test/defs/test_defs_ie.rb +0 -53
  76. data/test/defs/test_defs_in.rb +0 -94
  77. data/test/defs/test_defs_is.rb +0 -51
  78. data/test/defs/test_defs_it.rb +0 -57
  79. data/test/defs/test_defs_jp.rb +0 -159
  80. data/test/defs/test_defs_ke.rb +0 -31
  81. data/test/defs/test_defs_kr.rb +0 -37
  82. data/test/defs/test_defs_kz.rb +0 -39
  83. data/test/defs/test_defs_li.rb +0 -35
  84. data/test/defs/test_defs_lt.rb +0 -65
  85. data/test/defs/test_defs_lu.rb +0 -35
  86. data/test/defs/test_defs_lv.rb +0 -98
  87. data/test/defs/test_defs_ma.rb +0 -29
  88. data/test/defs/test_defs_mt_en.rb +0 -41
  89. data/test/defs/test_defs_mt_mt.rb +0 -41
  90. data/test/defs/test_defs_mx.rb +0 -49
  91. data/test/defs/test_defs_my.rb +0 -23
  92. data/test/defs/test_defs_nerc.rb +0 -29
  93. data/test/defs/test_defs_ng.rb +0 -29
  94. data/test/defs/test_defs_nl.rb +0 -33
  95. data/test/defs/test_defs_no.rb +0 -43
  96. data/test/defs/test_defs_northamerica.rb +0 -674
  97. data/test/defs/test_defs_nyse.rb +0 -46
  98. data/test/defs/test_defs_nz.rb +0 -67
  99. data/test/defs/test_defs_pe.rb +0 -47
  100. data/test/defs/test_defs_ph.rb +0 -29
  101. data/test/defs/test_defs_pl.rb +0 -229
  102. data/test/defs/test_defs_pt.rb +0 -47
  103. data/test/defs/test_defs_ro.rb +0 -69
  104. data/test/defs/test_defs_rs_cyrl.rb +0 -46
  105. data/test/defs/test_defs_rs_la.rb +0 -46
  106. data/test/defs/test_defs_ru.rb +0 -34
  107. data/test/defs/test_defs_scandinavia.rb +0 -215
  108. data/test/defs/test_defs_se.rb +0 -59
  109. data/test/defs/test_defs_sg.rb +0 -25
  110. data/test/defs/test_defs_si.rb +0 -105
  111. data/test/defs/test_defs_sk.rb +0 -37
  112. data/test/defs/test_defs_southamerica.rb +0 -327
  113. data/test/defs/test_defs_th.rb +0 -33
  114. data/test/defs/test_defs_tn.rb +0 -27
  115. data/test/defs/test_defs_tr.rb +0 -60
  116. data/test/defs/test_defs_tsx.rb +0 -70
  117. data/test/defs/test_defs_ua.rb +0 -41
  118. data/test/defs/test_defs_unitednations.rb +0 -11
  119. data/test/defs/test_defs_ups.rb +0 -31
  120. data/test/defs/test_defs_us.rb +0 -394
  121. data/test/defs/test_defs_ve.rb +0 -35
  122. data/test/defs/test_defs_vi.rb +0 -22
  123. data/test/defs/test_defs_za.rb +0 -35
  124. data/test/e2e/README.md +0 -52
  125. data/test/e2e/data/test_multiple_regions_with_conflicts_region_1.yaml +0 -38
  126. data/test/e2e/data/test_multiple_regions_with_conflicts_region_2.yaml +0 -38
  127. data/test/e2e/data/test_multiple_regions_with_conflicts_region_3.yaml +0 -38
  128. data/test/e2e/test_all_regions.rb +0 -49
  129. data/test/e2e/test_any_holidays_during_work_week.rb +0 -90
  130. data/test/e2e/test_holidays.rb +0 -244
  131. data/test/e2e/test_holidays_between.rb +0 -87
  132. data/test/e2e/test_multiple_regions.rb +0 -71
  133. data/test/e2e/test_multiple_regions_with_conflict.rb +0 -228
  134. data/test/e2e/test_nonstandard_regions.rb +0 -25
  135. data/test/holidays/core_extensions/test_date.rb +0 -122
  136. data/test/holidays/core_extensions/test_date_time.rb +0 -60
  137. data/test/holidays/date_calculator/test_day_of_month.rb +0 -27
  138. data/test/holidays/date_calculator/test_easter_gregorian.rb +0 -30
  139. data/test/holidays/date_calculator/test_easter_julian.rb +0 -36
  140. data/test/holidays/date_calculator/test_lunar_date.rb +0 -89
  141. data/test/holidays/date_calculator/test_weekend_modifier.rb +0 -54
  142. data/test/holidays/definition/context/test_function_processor.rb +0 -199
  143. data/test/holidays/definition/context/test_generator.rb +0 -226
  144. data/test/holidays/definition/context/test_load.rb +0 -37
  145. data/test/holidays/definition/context/test_merger.rb +0 -25
  146. data/test/holidays/definition/decorator/test_custom_method_proc.rb +0 -113
  147. data/test/holidays/definition/decorator/test_custom_method_source.rb +0 -96
  148. data/test/holidays/definition/decorator/test_test.rb +0 -123
  149. data/test/holidays/definition/generator/test_module.rb +0 -268
  150. data/test/holidays/definition/generator/test_regions.rb +0 -97
  151. data/test/holidays/definition/generator/test_test.rb +0 -113
  152. data/test/holidays/definition/parser/test_custom_method.rb +0 -79
  153. data/test/holidays/definition/parser/test_test.rb +0 -142
  154. data/test/holidays/definition/repository/test_cache.rb +0 -123
  155. data/test/holidays/definition/repository/test_custom_methods.rb +0 -43
  156. data/test/holidays/definition/repository/test_holidays_by_month.rb +0 -275
  157. data/test/holidays/definition/repository/test_proc_result_cache.rb +0 -91
  158. data/test/holidays/definition/repository/test_regions.rb +0 -104
  159. data/test/holidays/definition/validator/test_custom_method.rb +0 -94
  160. data/test/holidays/definition/validator/test_region.rb +0 -54
  161. data/test/holidays/definition/validator/test_test.rb +0 -60
  162. data/test/holidays/finder/context/test_between.rb +0 -172
  163. data/test/holidays/finder/context/test_dates_driver_builder.rb +0 -91
  164. data/test/holidays/finder/context/test_next_holiday.rb +0 -156
  165. data/test/holidays/finder/context/test_parse_options.rb +0 -141
  166. data/test/holidays/finder/context/test_search.rb +0 -290
  167. data/test/holidays/finder/context/test_year_holiday.rb +0 -202
  168. data/test/holidays/finder/rules/test_in_region.rb +0 -42
  169. data/test/holidays/finder/rules/test_year_range.rb +0 -166
  170. data/test/integration/README.md +0 -48
  171. data/test/integration/data/test_custom_govt_holiday_defs.yaml +0 -5
  172. data/test/integration/data/test_custom_informal_holidays_defs.yaml +0 -11
  173. data/test/integration/data/test_multiple_custom_holiday_defs.yaml +0 -12
  174. data/test/integration/test_custom_holidays.rb +0 -41
  175. data/test/integration/test_custom_informal_holidays.rb +0 -15
  176. data/test/integration/test_custom_year_range_holidays.rb +0 -35
  177. data/test/smoke/README.md +0 -31
  178. data/test/smoke/test_available_regions.rb +0 -18
  179. data/test/smoke/test_smoke.rb +0 -74
  180. data/test/test_helper.rb +0 -37
data/Rakefile DELETED
@@ -1,128 +0,0 @@
1
- $:.unshift File.expand_path('../lib', __FILE__)
2
- $:.unshift File.expand_path('../test', __FILE__)
3
-
4
- require 'bundler/gem_tasks'
5
- require 'rake/testtask'
6
- require 'yaml'
7
- require 'fileutils'
8
- require 'holidays'
9
-
10
- DEFINITION_PATH = 'definitions'
11
- DEFINITION_TESTS_PATH = 'test/defs'
12
-
13
- Rake::TestTask.new(:test) do |t|
14
- t.libs << 'test'
15
- t.test_files = FileList['test/**/test_*.rb']
16
- end
17
-
18
- task 'test:smoke' do
19
- ENV['SMOKE_TEST'] = '1'
20
- end
21
-
22
- Rake::TestTask.new('test:smoke') do |t|
23
- t.libs << 'test'
24
- t.test_files = FileList['test/smoke/test_*.rb']
25
- end
26
-
27
- Rake::TestTask.new('test:integration') do |t|
28
- t.libs << 'test'
29
- t.test_files = FileList['test/integration/test_*.rb']
30
- end
31
-
32
- Rake::TestTask.new('test:e2e') do |t|
33
- t.libs << 'test'
34
- t.test_files = FileList['test/e2e/test_*.rb']
35
- end
36
-
37
- task :default => :test
38
-
39
- desc "Run tests for only a single region. Do not provide sub regions. Example (without quotes): 'rake test_region jp'"
40
- task :test_region do
41
- # Magic to define empty tasks on the fly so we have nicer arguments, see http://cobwwweb.com/4-ways-to-pass-arguments-to-a-rake-task
42
- ARGV.each { |a| task a.to_sym do ; end }
43
-
44
- if ARGV[1].nil? || ARGV[1].empty?
45
- raise ArgumentError.new("You must provide a region. Example (without quotes): 'rake test_region us'")
46
- end
47
-
48
- region = ARGV[1].downcase
49
-
50
- unless Holidays.available_regions.include?(region.to_sym)
51
- raise ArgumentError.new("Region '#{region}' not recognized")
52
- end
53
-
54
- unless File.file?("#{DEFINITION_TESTS_PATH}/test_defs_#{region}.rb")
55
- raise ArgumentError.new("Test file not found for region '#{region}'. Do not use sub regions, try the overall region instead. Example: 'us' instead of 'us_dc'")
56
- end
57
-
58
- sh "bundle exec ruby #{DEFINITION_TESTS_PATH}/test_defs_#{region}.rb"
59
- end
60
-
61
- desc 'Launch IRB session'
62
- task :console do
63
- sh "irb -r rubygems -I lib -r holidays.rb"
64
- end
65
-
66
- desc 'Generate definitions and tests used in main holiday logic based on raw YAML definitions'
67
- namespace :generate do
68
- desc 'Generate the holiday definition files'
69
- task :definitions do
70
- # load the index
71
- def_index = YAML.load_file("#{DEFINITION_PATH}/index.yaml")
72
-
73
- # create a dir for the generated tests
74
- FileUtils.mkdir_p(DEFINITION_TESTS_PATH)
75
-
76
- #TODO This entire section should be moved into '/lib/holidays/definition'. I don't think such an
77
- # important part of the gem should be left in the Rakefile and without unit tests. There's no
78
- # reason we can't move it.
79
- all_regions = {}
80
-
81
- def_index['defs'].each do |region, files|
82
- puts "Building #{region} definition module:"
83
- files = files.collect { |f| "#{DEFINITION_PATH}/#{f}" }.uniq
84
-
85
- regions, rules_by_month, custom_methods, tests = Holidays::Factory::Definition.file_parser.parse_definition_files(files)
86
- module_src, test_src = Holidays::Factory::Definition.source_generator.generate_definition_source(region, files, regions, rules_by_month, custom_methods, tests)
87
-
88
- File.open("lib/#{Holidays::DEFINITIONS_PATH}/#{region.downcase.to_s}.rb","w") do |file|
89
- file.puts module_src
90
- end
91
- unless test_src.empty?
92
- File.open("#{DEFINITION_TESTS_PATH}/test_defs_#{region.downcase.to_s}.rb","w") do |file|
93
- file.puts test_src
94
- end
95
- end
96
-
97
- all_regions[region.downcase.to_sym] = regions
98
-
99
- puts "Done.\n\n"
100
- end
101
-
102
- puts "Building regions master file for later validation:"
103
-
104
- File.open("lib/#{Holidays::DEFINITIONS_PATH}/REGIONS.rb","w") do |file|
105
- file.puts Holidays::Factory::Definition.regions_generator.call(all_regions)
106
- end
107
-
108
- puts "Done.\n\n"
109
- end
110
-
111
- desc 'Build the definition manifest'
112
- task :manifest do
113
- File.open("lib/#{Holidays::DEFINITIONS_PATH}/MANIFEST","w") do |file|
114
- #TODO Generating the file source should be done interally, in the /lib dir, not in the Rakefile
115
- file.puts <<-EOH
116
- ==== Regional definitions
117
- The following definition files are included in this installation:
118
-
119
- EOH
120
- FileList.new("lib/#{Holidays::DEFINITIONS_PATH}/*.rb").exclude(/version/).each do |str|
121
- file.puts('* ' + str.gsub(/^lib\/|\.rb$/, ''))
122
- end
123
- end
124
- puts "Updated manifest file."
125
- end
126
- end
127
-
128
- task :generate => ['generate:definitions', 'generate:manifest']
data/bin/console DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "holidays"
5
-
6
- require "irb"
7
- IRB.start
data/bin/setup DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
data/doc/CONTRIBUTING.md DELETED
@@ -1,72 +0,0 @@
1
- # How to contribute
2
-
3
- There are multiple ways to help! We rely on users around the world to help keep our definitions accurate and up to date. In addition, pull requests to address bugs or implement new features are always welcome.
4
-
5
- ## Code of Conduct
6
-
7
- Please read our [Code of Conduct](../CODE_OF_CONDUCT.md) before contributing. Everyone interacting with this project (or associated projects) is expected to abide by its terms.
8
-
9
- ## General note
10
-
11
- The definitions for this project are housed in a submodule. When pulling this repo please make sure to run `git clone --recursive git@github.com/holidays/holidays`
12
- or, if you forgot to do so, run `make update-defs` so that all of the submodule data is pulled correctly.
13
-
14
- ## For definition updates
15
-
16
- Our definitions are written in YAML. They are housed in a [separate repository](https://github.com/holidays/definitions) so that they can be used by tools written in other languages. You can find a complete guide to our format in the [definitions SYNTAX guide](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md).
17
-
18
- In this ruby project we take the YAML definitions and generate final ruby classes that are loaded at runtime for fast calculations.
19
-
20
- Once you have a good idea on what you want to change, please see the [CONTRIBUTING guide](https://github.com/holidays/definitions/blob/master/doc/CONTRIBUTING.md) in the `definitions` repository.
21
-
22
- The idea is that if the validation passes on the other repo then you shouldn't have to worry about generating and testing here. We'll see how that goes!
23
-
24
- Once that PR is accepted the maintainers of this project will be responsible for generating the updated definitions here and releasing a new gem. Don't worry about versioning, we'll take care of it!
25
-
26
- #### Testing out your definitions locally
27
-
28
- As mentioned above we use a git submodule for the definitions. Sometimes you might want to manually test out how this ruby project will behave with your changes. To facilitate that we provide some commands for pointing the definitions submodule to your fork/branch.
29
-
30
- To point at your fork/branch:
31
-
32
- ```sh
33
- make clean-defs
34
- BRANCH=<branch-name> USER=<user> make point-to-defs-branch
35
- ```
36
-
37
- Example:
38
-
39
- ```sh
40
- make clean-defs
41
- BRANCH=issue-24 USER=ppeble make point-to-defs-branch
42
- ```
43
-
44
- This will pull everything down for the latest commit on that fork/branch. When you are done testing and want to point back at the master definitions:
45
-
46
- ```sh
47
- make clean-defs
48
- make point-to-defs-master
49
- ```
50
-
51
- ## For non-definition functionality
52
-
53
- * Fork this repository
54
- * Make your changes. Don't forget to run `make test` to execute the test suite!
55
- * Create a PR pointing back to `master`
56
-
57
- Don't worry about versioning, we'll handle it on our end.
58
-
59
- *Tests are required*. If your PR results in lower test coverage then it will not be accepted.
60
-
61
- ## Local development helpers
62
-
63
- We have included a few handy tasks to help you troubleshoot and test:
64
-
65
- * `make test` - runs the entire suite
66
- * `bundle exec ruby <test-file-to-run>` - runs just the tests in the specified file
67
- * `REGION=<region> make test-region` - runs the tests for just that region
68
- * `make console` - launches an IRB session with the 'holidays' gem loaded for quick testing
69
- * `make update-defs` - runs the appropriate git submodule commands to pull the latest definitions
70
- * `make clean-defs` - removes the definitions submodule, useful for switching between a fork and the main definitions repository
71
- * `BRANCH=<branch> USER=<user> make point-to-defs-branch` - updates your definitions submodule to point at a fork/branch
72
- * `make point-to-defs-master` - updates your definitions submodule to point back at the `holidays/definitions` repo and master branch
data/doc/MAINTAINERS.md DELETED
@@ -1,79 +0,0 @@
1
- # Maintainers guide
2
-
3
- This document outlines the process of releasing an update to the `holidays` gem. This update could
4
- include any (or a combination of) the following:
5
-
6
- * definition updates from the [definitions](https://github.com/holidays/definitions) repository
7
- * bug fixes
8
- * additional functionality
9
-
10
- ### semver
11
-
12
- This gem operates under the rules of [semver](http://semver.org/). The decisions on what constitutes a major,
13
- minor, or patch version update fall on the maintainer. If in doubt, follow these rules:
14
-
15
- * Will this change mean that users will be REQUIRED to make a code change? If so then it is a major version bump. This includes dropping supported versions of ruby!
16
- * Will this change mean that users might see a definition/behavior change but won't need to modify their own code? If so then it is as minor version bump
17
- * Will this change mean that a bug, either in code or definitions, will be fixed? If so then it is a patch version bump
18
-
19
- *@ppeble editor note*: I am pretty aggressive when it comes to version bumps! If the slightest functionality has changed then
20
- I consider it a minor version bump, if ANY consumer code has to change then I consider it a major version bump. I don't care
21
- if we get up to version 250, the version number doesn't matter. Communicating the effort required in updating is what matters!
22
-
23
- ### Who this document is for
24
-
25
- This document is for maintainers that have merge access to this repository. These maintainers may or may not have access to the upstream
26
- [definitions](https://github.com/holidays/definitions) repository.
27
-
28
- Please note that a core contributor must provide the relevant Github access so that you can perform merges. If you have any issues
29
- please contact the [core members](https://github.com/orgs/holidays/teams/core/members) for assistance.
30
-
31
- ### Setup
32
-
33
- This guide assumes that you have forked the repository in Github. If you require assistance in this please contact the core members listed above.
34
-
35
- You will need upload access to rubygems.org in order to publish gems. Contact a [core member](https://github.com/orgs/holidays/teams/core/members) for assistance.
36
-
37
- ### Release Overview
38
-
39
- A release could contain one or more of the following:
40
-
41
- * definition updates - these are rule updates pulled from https://github.com/holidays/definitions. These changes are not
42
- language specific and will most likely require local regeneration of compiled rules.
43
- * functionality additions - this is new functionality in this repository that uses the existing definitions
44
- * bug fixes - these are bug fixes in this repository
45
-
46
- It is up to the maintainer to determine what needs to be updated. We will attempt to outline the various scenarios in the
47
- sections below.
48
-
49
- ### Release flow
50
-
51
- * Does this update require definition updates? If YES, then:
52
- * Pull the latest `master` version of this ruby repository and run `make update-defs`. This will grab the latest version from the [definitions](https://github.com/holidays/definitions) repository. Run `git diff` to verify that the version of the submodule for the definitions matches the latest commit in the [definitions](https://github.com/holidays/definitions) repo.
53
- * Run the `make generate` command. This will 'recompile' the ruby sources with the latest definitions.
54
- * Run `make test` and ensure that all of the tests pass. If any tests fail then do *not* merge and contact a [core member](https://github.com/orgs/holidays/teams/core/members) for assistance.
55
- * If all of the tests pass, update the `lib/holidays/version.rb` file to the new version. Reference the above [semver](http://semver.org/) rules for how to update versions.
56
- * Make a branch on your fork and update the [CHANGELOG](../CHANGELOG.md) to reflect the latest changes. You do not need to put in all of the definition changes in this update, you can simply reference the other repository. See other entries in the CHANGELOG for examples.
57
- * Open a PR against the new branch and merge it (another maintainer will need to review before you can merge)
58
- * Once the branch is merged, the release GitHub Actions workflow will automatically build the gem and push it to rubygems.org. No local steps are required.
59
- * Does this update require functionality additions or bug fixes? If YES, then:
60
- * Run `make test` and ensure that all of the tests pass. If any tests fail then do *not* merge and contact a [core member](https://github.com/orgs/holidays/teams/core/members) for assistance.
61
- * If all of the tests pass, make a branch on your fork and update the [CHANGELOG](../CHANGELOG.md) to reflect the latest changes.
62
- * Update the `lib/holidays/version.rb` file to the new version. Reference the above [semver](http://semver.org/) rules for how to update versions.
63
- * Open a PR against the new branch and merge it (another maintainer will need to review before you can merge)
64
- * Once the branch is merged, the release GitHub Actions workflow will automatically build the gem and push it to rubygems.org. No local steps are required.
65
-
66
- You are done! The latest version should be uploaded to rubygems.org. You can go to view the [holidays page](https://rubygems.org/gems/holidays) to verify that the latest version is available.
67
-
68
- It is totally acceptable to do both functionality AND definition updates in a single release. Simply combine both sets of rules into a single branch for your update.
69
-
70
- ### Troubleshooting
71
-
72
- The biggest hurdle in this repository is that [upstream definition](https://github.com/holidays/definitions) changes will
73
- result in failures in existing tests and it will not be because of ruby issues but rather upstream issues. If you notice any test failures
74
- that seem to be specific to certain regions then look at recent changes in that other repository. If there were changes there then the odds
75
- are that there are issues in the definition-specific tests. This is most likely not a language (i.e. ruby) specific issue.
76
-
77
- It is a known issue that the definitions do not have a good set of self-tests to ensure that they are internally consistent. This means that a failure in this
78
- repository could NOT be related to ruby specifically. It could be that the 'tests' specified in in the YAML files are incorrect! If you encounter errors here
79
- make sure that you don't assume that it is just a ruby error that is causing the issues!
data/doc/REFERENCES DELETED
@@ -1,19 +0,0 @@
1
- === References
2
-
3
- We are eternally grateful to the following sources.
4
-
5
- ==== Date calculations
6
- * http://michaelthompson.org/technikos/holidays.php
7
-
8
- ==== Easter calculations
9
- * http://www.assa.org.au/edm.html
10
- * http://www.smart.net/~mmontes/ec-cal.html
11
- * https://github.com/Loyolny/when_easter - graciously allowed by Michał Nierebiński
12
-
13
- ==== World dates
14
- * http://www.un.org/geninfo/faq/factsheets/FS18.HTM
15
- * http://en.wikipedia.org/wiki/List_of_holidays_by_country
16
-
17
- Other sources for specific regions are noted in the definitions files themselves.
18
-
19
- If a commit sneaks past the maintainers without attribution then please, let us know immediately! It was entirely unintentional.
data/holidays.gemspec DELETED
@@ -1,31 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- require 'holidays/version'
6
-
7
- Gem::Specification.new do |gem|
8
- gem.name = 'holidays'
9
- gem.version = Holidays::VERSION
10
- gem.authors = ['Alex Dunae', 'Phil Peble']
11
- gem.email = ['holidaysgem@gmail.com']
12
- gem.homepage = 'https://github.com/holidays/holidays'
13
- gem.description = %q(A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!)
14
- gem.summary = %q(A collection of Ruby methods to deal with statutory and other holidays.)
15
- gem.metadata = {
16
- 'changelog_uri' => "https://github.com/holidays/holidays/blob/master/CHANGELOG.md",
17
- 'source_code_uri' => 'https://github.com/holidays/holidays',
18
- 'bug_tracker_uri' => 'https://github.com/holidays/holidays/issues'
19
- }
20
- gem.files = `git ls-files`.split("\n") - ['.gitignore', '.travis.yml']
21
- gem.test_files = gem.files.grep(/^test/)
22
- gem.require_paths = ['lib']
23
- gem.licenses = ['MIT']
24
- gem.required_ruby_version = '>= 3.2'
25
- gem.add_development_dependency 'bundler', '>= 4'
26
- gem.add_development_dependency 'rake', '~> 13'
27
- gem.add_development_dependency 'simplecov', '~> 0.16'
28
- gem.add_development_dependency 'test-unit', '~> 3'
29
- gem.add_development_dependency 'mocha', '~> 3'
30
- gem.add_development_dependency 'pry', '~> 0.16'
31
- end
@@ -1,24 +0,0 @@
1
- require 'simplecov'
2
-
3
- # JRuby coverage reporting is inaccurate without --debug mode, resulting in
4
- # artificially low numbers. Skip the minimum coverage check under JRuby.
5
- SimpleCov.minimum_coverage 89 unless RUBY_PLATFORM == 'java' || ENV['SMOKE_TEST']
6
-
7
- SimpleCov.add_filter [
8
- # Apparently simplecov doesn't automatically filter 'spec' or 'test' so we
9
- # have to do it manually.
10
- 'test',
11
-
12
- # Only filtered because I tend to not see value in testing factories.
13
- 'lib/holidays/factory/',
14
-
15
- # jruby coverage flips out here and doesn't count much of the large date
16
- # arrays used by this class. This results in an extremely low reported
17
- # coverage for this specific file but only in jruby, not other ruby versions.
18
- # Since it obliterates coverage percentages I'll filter it until I can come
19
- # up with a solution.
20
- 'lib/holidays/date_calculator/lunar_date.rb',
21
- ]
22
-
23
- SimpleCov.coverage_dir 'reports/coverage'
24
- SimpleCov.start
@@ -1,31 +0,0 @@
1
- months:
2
- 6:
3
- - name: after_year
4
- regions: [custom_year_range_file]
5
- mday: 1
6
- year_ranges:
7
- from: 2016
8
- - name: before_year
9
- regions: [custom_year_range_file]
10
- mday: 2
11
- year_ranges:
12
- until: 2017
13
- - name: between_year
14
- regions: [custom_year_range_file]
15
- mday: 3
16
- year_ranges:
17
- between:
18
- start: 2016
19
- end: 2018
20
- - name: limited_year
21
- regions: [custom_year_range_file]
22
- mday: 4
23
- year_ranges:
24
- limited: [2016,2018,2019]
25
-
26
- tests:
27
- - given:
28
- date: '2017-01-01'
29
- regions: [custom_year_range_file]
30
- expect:
31
- name: "after_year"
@@ -1,14 +0,0 @@
1
- months:
2
- 1:
3
- - name: Weekend Holiday
4
- regions: [date_transform_conflict_1]
5
- mday: 1
6
- function: to_nearest_upcoming_weekend_day(date)
7
-
8
- methods:
9
- to_nearest_upcoming_weekend_day:
10
- arguments: date
11
- ruby: |
12
- days_until = (6 - date.wday) % 7
13
- days_until = 7 if days_until == 0
14
- date + days_until
@@ -1,14 +0,0 @@
1
- months:
2
- 1:
3
- - name: Weekend Holiday
4
- regions: [date_transform_conflict_2]
5
- mday: 1
6
- function: to_nearest_upcoming_weekend_day(date)
7
-
8
- methods:
9
- to_nearest_upcoming_weekend_day:
10
- arguments: date
11
- ruby: |
12
- days_until = (7 - date.wday) % 7
13
- days_until = 7 if days_until == 0
14
- date + days_until
@@ -1,15 +0,0 @@
1
- module Holidays
2
- module BAD_REGION_NAME
3
- def self.defined_regions
4
- [:test_region]
5
- end
6
-
7
- def self.holidays_by_month
8
- {}
9
- end
10
-
11
- def self.custom_methods
12
- {}
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- module Holidays
2
- module TEST_REGION
3
- def self.defined_regions
4
- [:test_region, :test_region2]
5
- end
6
-
7
- def self.holidays_by_month
8
- {}
9
- end
10
-
11
- def self.custom_methods
12
- {}
13
- end
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- months:
2
- 6:
3
- - name: Company Founding
4
- regions: [custom_single_file]
5
- mday: 20
6
-
7
- tests:
8
- - given:
9
- date: '2013-06-20'
10
- regions: [custom_single_file]
11
- expect:
12
- name: "Company Founding"
@@ -1,28 +0,0 @@
1
- months:
2
- 0:
3
- - name: Custom Holiday
4
- regions: [custom_single_file]
5
- function: custom_method(year, month)
6
- function_modifier: 5
7
- 6:
8
- - name: Company Founding
9
- regions: [custom_single_file]
10
- mday: 20
11
- methods:
12
- custom_method:
13
- arguments: year, month
14
- source: |
15
- d = Date.civil(year, month, 1)
16
- d + 2
17
-
18
- tests:
19
- - given:
20
- date: '2013-06-20'
21
- regions: [custom_single_file]
22
- expect:
23
- name: "Company Founding"
24
- - given:
25
- date: '2015-01-01'
26
- regions: [custom_single_file]
27
- expect:
28
- name: "Custom Holiday"
@@ -1,69 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
-
4
- # This file is generated by the Ruby Holiday gem.
5
- #
6
- # Definitions loaded: definitions/ar.yaml
7
- class ArDefinitionTests < Test::Unit::TestCase # :nodoc:
8
-
9
- def test_ar
10
- assert_equal "Año Nuevo", (Holidays.on(Date.civil(2016, 1, 1), [:ar], [:informal])[0] || {})[:name]
11
-
12
- assert_equal "Carnaval Lunes", (Holidays.on(Date.civil(2016, 2, 8), [:ar], [:informal])[0] || {})[:name]
13
-
14
- assert_equal "Carnaval Martes", (Holidays.on(Date.civil(2016, 2, 9), [:ar], [:informal])[0] || {})[:name]
15
-
16
- assert_equal "Carnaval Lunes", (Holidays.on(Date.civil(2017, 2, 27), [:ar], [:informal])[0] || {})[:name]
17
-
18
- assert_equal "Carnaval Martes", (Holidays.on(Date.civil(2017, 2, 28), [:ar], [:informal])[0] || {})[:name]
19
-
20
- assert_equal "Carnaval Lunes", (Holidays.on(Date.civil(2018, 2, 12), [:ar], [:informal])[0] || {})[:name]
21
-
22
- assert_equal "Carnaval Martes", (Holidays.on(Date.civil(2018, 2, 13), [:ar], [:informal])[0] || {})[:name]
23
-
24
- assert_equal "Día Nacional de la Memoria por la Verdad y la Justicia", (Holidays.on(Date.civil(2016, 3, 24), [:ar], [:informal])[0] || {})[:name]
25
-
26
- assert_equal "Viernes Santo", (Holidays.on(Date.civil(2016, 3, 25), [:ar], [:informal])[0] || {})[:name]
27
-
28
- assert_equal "Día del Veterano y de los Caídos en la Guerra de Malvinas", (Holidays.on(Date.civil(2016, 4, 2), [:ar], [:informal])[0] || {})[:name]
29
-
30
- assert_equal "Día del Trabajador", (Holidays.on(Date.civil(2016, 5, 1), [:ar], [:informal])[0] || {})[:name]
31
-
32
- assert_equal "Día de la Revolución de Mayo", (Holidays.on(Date.civil(2016, 5, 25), [:ar], [:informal])[0] || {})[:name]
33
-
34
- assert_equal "Paso a la Inmortalidad del General Martín Miguel de Güemes", (Holidays.on(Date.civil(2020, 6, 15), [:ar], [:informal])[0] || {})[:name]
35
- assert_equal "Paso a la Inmortalidad del General Martín Miguel de Güemes", (Holidays.on(Date.civil(2021, 6, 21), [:ar], [:informal])[0] || {})[:name]
36
-
37
- assert_nil (Holidays.on(Date.civil(2020, 6, 17), [:ar], [:informal])[0] || {})[:name]
38
- assert_nil (Holidays.on(Date.civil(2021, 6, 17), [:ar], [:informal])[0] || {})[:name]
39
-
40
- assert_equal "Paso a la Inmortalidad del General Martín Miguel de Güemes", (Holidays.on(Date.civil(2016, 6, 20), [:ar], [:informal])[0] || {})[:name]
41
-
42
- assert_equal "Día de la Independencia", (Holidays.on(Date.civil(2016, 7, 9), [:ar], [:informal])[0] || {})[:name]
43
-
44
- assert_equal "Paso a la Inmortalidad del General José de San Martín", (Holidays.on(Date.civil(2016, 8, 15), [:ar], [:informal])[0] || {})[:name]
45
- assert_equal "Paso a la Inmortalidad del General José de San Martín", (Holidays.on(Date.civil(2020, 8, 17), [:ar], [:informal])[0] || {})[:name]
46
- assert_equal "Paso a la Inmortalidad del General José de San Martín", (Holidays.on(Date.civil(2021, 8, 16), [:ar], [:informal])[0] || {})[:name]
47
-
48
- assert_nil (Holidays.on(Date.civil(2016, 8, 17), [:ar], [:informal])[0] || {})[:name]
49
- assert_nil (Holidays.on(Date.civil(2021, 8, 17), [:ar], [:informal])[0] || {})[:name]
50
-
51
- assert_equal "Día del Respeto a la Diversidad Cultural", (Holidays.on(Date.civil(2016, 10, 10), [:ar], [:informal])[0] || {})[:name]
52
- assert_equal "Día del Respeto a la Diversidad Cultural", (Holidays.on(Date.civil(2021, 10, 11), [:ar], [:informal])[0] || {})[:name]
53
-
54
- assert_nil (Holidays.on(Date.civil(2021, 10, 12), [:ar], [:informal])[0] || {})[:name]
55
-
56
- assert_equal "Día de la Soberanía Nacional", (Holidays.on(Date.civil(2016, 11, 20), [:ar], [:informal])[0] || {})[:name]
57
-
58
- assert_equal "Inmaculada Concepción de María", (Holidays.on(Date.civil(2016, 12, 8), [:ar], [:informal])[0] || {})[:name]
59
-
60
- assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2016, 7, 8), [:ar], [:informal])[0] || {})[:name]
61
- assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2016, 12, 9), [:ar], [:informal])[0] || {})[:name]
62
- assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2021, 5, 24), [:ar], [:informal])[0] || {})[:name]
63
- assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2021, 10, 8), [:ar], [:informal])[0] || {})[:name]
64
- assert_equal "Feriado con fines turísticos", (Holidays.on(Date.civil(2021, 11, 22), [:ar], [:informal])[0] || {})[:name]
65
-
66
- assert_equal "Navidad", (Holidays.on(Date.civil(2016, 12, 25), [:ar], [:informal])[0] || {})[:name]
67
-
68
- end
69
- end
@@ -1,31 +0,0 @@
1
- # encoding: utf-8
2
- require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
-
4
- # This file is generated by the Ruby Holiday gem.
5
- #
6
- # Definitions loaded: definitions/at.yaml
7
- class AtDefinitionTests < Test::Unit::TestCase # :nodoc:
8
-
9
- def test_at
10
- assert_equal "Neujahrstag", (Holidays.on(Date.civil(2009, 1, 1), [:at], [:informal])[0] || {})[:name]
11
-
12
- assert_equal "Ostermontag", (Holidays.on(Date.civil(2009, 4, 13), [:at])[0] || {})[:name]
13
-
14
- assert_equal "Christi Himmelfahrt", (Holidays.on(Date.civil(2009, 5, 21), [:at])[0] || {})[:name]
15
-
16
- assert_equal "Pfingstmontag", (Holidays.on(Date.civil(2009, 6, 1), [:at])[0] || {})[:name]
17
-
18
- assert_equal "Nationalfeiertag", (Holidays.on(Date.civil(2009, 10, 26), [:at], [:informal])[0] || {})[:name]
19
-
20
- assert_equal "Mariä Empfängnis", (Holidays.on(Date.civil(2009, 12, 8), [:at], [:informal])[0] || {})[:name]
21
-
22
- assert_equal "1. Weihnachtstag", (Holidays.on(Date.civil(2009, 12, 25), [:at], [:informal])[0] || {})[:name]
23
-
24
- assert_equal "2. Weihnachtstag", (Holidays.on(Date.civil(2009, 12, 26), [:at], [:informal])[0] || {})[:name]
25
-
26
- assert_nil (Holidays.on(Date.civil(2010, 5, 8), [:at])[0] || {})[:name]
27
-
28
- assert_equal "Fronleichnam", (Holidays.on(Date.civil(2017, 6, 15), [:at])[0] || {})[:name]
29
-
30
- end
31
- end