Hard fork holidays/holidays gem into plugin.

Hard fork holidays/holidays gem into plugin.

The original gem does not seem to be maintained anymore so we’re pulling this into the plugin so that we can update the definitions easily.

diff --git a/jobs/scheduled/create_holiday_events.rb b/jobs/scheduled/create_holiday_events.rb
index 27ee588..42222e6 100644
--- a/jobs/scheduled/create_holiday_events.rb
+++ b/jobs/scheduled/create_holiday_events.rb
@@ -8,8 +8,6 @@ module Jobs
       return unless SiteSetting.calendar_enabled
       return unless topic_id = SiteSetting.holiday_calendar_topic_id.presence
 
-      require "holidays" unless defined?(Holidays)
-
       regions_and_user_ids = Hash.new { |h, k| h[k] = [] }
 
       UserCustomField
diff --git a/lib/tasks/javascript.rake b/lib/tasks/javascript.rake
index a3624a3..2295378 100644
--- a/lib/tasks/javascript.rake
+++ b/lib/tasks/javascript.rake
@@ -5,7 +5,6 @@ UNUSED_REGIONS = ["ecbtarget", "federalreserve", "federalreservebanks", "fedex",
 HOLIDAYS_COUNTRY_OVERRIDES = { "gr" => "el" }
 
 task 'javascript:update_constants' => :environment do
-  require 'holidays'
   holiday_regions = Holidays.available_regions.map(&:to_s) - UNUSED_REGIONS
 
   time_zone_to_region = {}
diff --git a/plugin.rb b/plugin.rb
index 66f61ff..8df356b 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -6,7 +6,10 @@
 # author: Daniel Waterworth, Joffrey Jaffeux
 # url: https://github.com/discourse/discourse-calendar
 
-gem 'holidays', '8.4.1', require: false
+if !Rails.env.production? || Sidekiq.server?
+  require File.join(File.dirname(__FILE__), "vendor/holidays/lib/holidays")
+end
+
 gem 'rrule', '0.4.2', require: false
 
 load File.expand_path('../lib/calendar_settings_validator.rb', __FILE__)
diff --git a/vendor/holidays/CHANGELOG.md b/vendor/holidays/CHANGELOG.md
new file mode 100644
index 0000000..f517f56
--- /dev/null
+++ b/vendor/holidays/CHANGELOG.md
@@ -0,0 +1,416 @@
+# Ruby Holidays Gem CHANGELOG
+
+## 8.4.1
+
+* Fix jp holidays from 2022. 
+
+## 8.4.0
+
+* Update submodule definitions. 
+* Thanks to contributors!!
+
+
+## 8.3.0
+
+* Update submodule definitions. 
+* Remove test about feb 29 on non leap year.
+* Thanks to contributors!!
+
+## 8.2.0
+
+* Update submodule definitions. Thanks to contributors!!
+
+## 8.1.0
+
+* Update submodule definitions, so that the newest holidays from the definition
+  gem are represent here.
+
+## 8.0.0
+
+* Remove support for ruby 2.2 and ruby 2.3.
+* Add support for latest ruby 2.6
+* Update to [v5.0.1 definitions](https://github.com/holidays/definitions/releases/tag/v5.0.1). Please see the changelog for the definition details.
+
+## 7.1.0
+
+* Update to [v4.1.0 definitions](https://github.com/holidays/definitions/releases/tag/v4.1.0). Please see the changelog for the definition details.
+
+## 7.0.0
+
+Major semver bump due to the major version change in the [definitions](https://github.com/holidays/definitions/blob/master/CHANGELOG.md#400). Several non ISO regions have been modified in order to provide more clarity for parent and sub-regions.
+
+Affected regions:
+
+* `ecb_target` region changed to `ecbtarget`
+* `federal_reserve` region changed to `federalreserve`
+* `federalreservebanks` region changed to `federalreservebanks`
+* `north_america_informal` region changed to `northamericainformal`
+* `united_nations` region changed to `unitednations`
+* `north_america` region changed to `northamerica`
+* `south_america` region changed to `southamerica`
+
+Please see the [definitions v4.0.0 CHANGELOG](https://github.com/holidays/definitions/blob/master/CHANGELOG.md#400) for the full change list.
+
+## 6.6.1
+
+* Fixes `any_holidays_during_work_week?` so that it actually does what it says it does [issue-264](https://github.com/holidays/holidays/issues/264)
+
+## 6.6.0
+
+* Update to [v3.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v3.0.0). This required updates to the custom method parser but no behavior changes.
+* Remove unused `simplecov-rcov` from gemspec dev dependencies
+* Fix parent region loading bug [PR](https://github.com/holidays/holidays/pull/320) (thanks to chadrschroeder)
+* Fix `ruby-head` build caused by new 'endless range' feature in ruby 2.6.0 [PR](https://github.com/holidays/holidays/pull/321)
+* Refactor definition search logic for improved readability [PR](https://github.com/holidays/holidays/pull/318) (thanks to https://github.com/guizma)
+* Reorganize most documentation into the `docs/` directory
+* Fix list of covered rubies in README
+
+## 6.5.0
+
+* Update to [v2.5.2 definitions](https://github.com/holidays/definitions/releases/tag/v2.5.2). Please see the changelog for the definition details.
+* Fix permissions on `bin` executables (thanks to github.com/JuanitoFatas)
+
+## 6.4.0
+
+* Update to [v2.4.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.4.0). Please see the changelog for the definition details.
+
+## 6.3.0
+
+* Update to [v2.3.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.3.0). Please see the changelog for the definition details.
+
+## 6.2.0
+
+* Update to [v2.2.1 definitions](https://github.com/holidays/definitions/releases/tag/v2.2.1). Please see the changelog for the definition details.
+* README update to add `:federal_reserve` examples (thanks to https://github.com/aahmad)
+
+## 6.1.0
+
+* Update to [v2.1.1 definitions](https://github.com/holidays/definitions/releases/tag/v2.1.1). Please see the changelog for
+  the definitions for details.
+
+## 6.0.0
+
+* Remove support for ruby 2.1.0 since it is [no longer officially supported](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/). This is the cause of the major
+  version bump.
+* Update to [v2.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.0.0). This changes the format
+  of definition tests and requires the other changes.
+* Rewrite test generation logic to consume new YAML format.
+
+To be crystal clear: this version should not behave differently in terms of holiday results than v5.7.0 of the gem. Any
+differences are a bug that should be addressed.
+
+## 5.7.0
+
+* Update to [v1.7.1 definitions](https://github.com/holidays/definitions/releases/tag/v1.7.1). Please see the
+  definitions repository for the list of changes.
+* Remove 'coveralls'. We never looked at the reports. We will we simplecov to enforce test coverage. It will
+  start off being set to require 99% and above.
+
+## 5.6.0
+
+* Update to v1.6.1 definitions, which includes updates for the `:ca` region (and subregions)
+
+## 5.5.1
+
+* Update to v1.5.1 definitions, which includes bugfix in `fedex` custom method
+
+## 5.5.0
+
+* Fix [#251](https://github.com/holidays/holidays/issues/251): `load_custom` would override all other definitions
+* Fix [#266](https://github.com/holidays/holidays/issues/266): `:any` does not return expected results
+* Fix [#265](https://github.com/holidays/holidays/issues/265): Jersey/je not loaded as expected when pulling `:gb`
+* Add lunar date calculations, which are used in `:kr` and `:vi` definitions (thanks to https://github.com/jonathanpike)
+* Improve cache performance (thanks to https://github.com/mzruya)
+* Remove incorrect comments in definition generation (thanks to https://github.com/morrme)
+* Fix bug related to definition functions inadvertently affecting subsequent date calculations
+* Point to latest version (1.5.0) of definitions, which includes:
+  * Add Vietnamese holidays
+  * Updates Australian holidays
+  * Updates Korean holidays to use native language and fancy lunar date calculations
+  * Fix NYSE definitions to correctly calculate observed "New Year's Day"
+
+## 5.4.0
+
+* Add support for ruby 2.4.0 (added it to the required tests in Travis CI)
+* Fix issue [#250](https://github.com/holidays/holidays/issues/250), which was that subregions were 'lost' if there was more than one underscore in it (thanks to https://github.com/chinito)
+* Fix caching when using Date extensions (thanks to https://github.com/alexgerstein)
+* Remove unused weekend date calculator method (thanks to https://github.com/ttwo32)

[... diff too long, it was truncated ...]

GitHub sha: 0e3431f1

This commit appears in #138 which was approved by eviltrout. It was merged by tgxworld.