holiday_scraper 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/atlassian-ide-plugin.xml +5 -0
- data/.idea/encodings.xml +6 -0
- data/.idea/holiday_scraper.iml +166 -0
- data/.idea/misc.xml +14 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +38 -0
- data/Rakefile +13 -0
- data/bin/holiday_scraper +13 -0
- data/holiday_scraper.gemspec +32 -0
- data/lib/holiday_scraper.rb +4 -0
- data/lib/holiday_scraper/parser.rb +122 -0
- data/lib/holiday_scraper/scraper.rb +18 -0
- data/lib/holiday_scraper/version.rb +3 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eb125f972df2435ec5b99fb2b068415cf7ca9b9f
|
4
|
+
data.tar.gz: 1e40fb15187099c1e74533b074f0af7efcd0187a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b82d9e56d9c12ccda49604e281f2672057402cc381e5224fd5ad4a40676fe0be9bf581665c67848fca74bff0c006d9125f730495203013c6e8a4e9d9dfdfdab3
|
7
|
+
data.tar.gz: bd0eee16420e75f4b8f7d611021de44467bbe3031bd7eb5325dac416f83dc8772031dcf88f2568fe99f3071a3e006f5512e46add8bf1eb9ac0a485a7e82d95dc
|
data/.gitignore
ADDED
data/.idea/.name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
holiday_scraper
|
data/.idea/.rakeTasks
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
|
+
You are allowed to:
|
4
|
+
1. Remove rake task
|
5
|
+
2. Add existing rake tasks
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build holiday_scraper-0.0.1.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Remove RDoc HTML files" fullCmd="clobber_rdoc" taksId="clobber_rdoc" /><RakeTask description="Build and install holiday_scraper-0.0.1.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install holiday_scraper-0.0.1.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Build RDoc HTML files" fullCmd="rdoc" taksId="rdoc" /><RakeTask description="Create tag v0.0.1 and build and push holiday_scraper-0.0.1.gem to Rubygems" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Rebuild RDoc HTML files" fullCmd="rerdoc" taksId="rerdoc" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="html" taksId="html" /><RakeTask description="" fullCmd="html/created.rid" taksId="html/created.rid" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup><RakeTask description="" fullCmd="test" taksId="test" /></RakeGroup></Settings>
|
data/.idea/encodings.xml
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
12
|
+
<component name="ModuleRunConfigurationManager">
|
13
|
+
<configuration default="false" name="spec: holiday_scraper" type="RakeRunConfigurationType" factoryName="Rake" temporary="true">
|
14
|
+
<module name="holiday_scraper" />
|
15
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
16
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
17
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
18
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
19
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
20
|
+
<envs />
|
21
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
22
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
23
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
24
|
+
<COVERAGE_PATTERN ENABLED="true">
|
25
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
26
|
+
</COVERAGE_PATTERN>
|
27
|
+
</EXTENSION>
|
28
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
|
29
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
|
30
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
|
31
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
|
32
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
|
33
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
|
34
|
+
<method />
|
35
|
+
</configuration>
|
36
|
+
<configuration default="false" name="HolidayScraper::Parser: holiday_scraper" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
37
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
38
|
+
<module name="holiday_scraper" />
|
39
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
40
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
41
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
42
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
43
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
44
|
+
<envs>
|
45
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
46
|
+
</envs>
|
47
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
48
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
49
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
50
|
+
<COVERAGE_PATTERN ENABLED="true">
|
51
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
52
|
+
</COVERAGE_PATTERN>
|
53
|
+
</EXTENSION>
|
54
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
55
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/parser_spec.rb" />
|
56
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
57
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
58
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="HolidayScraper::Parser" />
|
59
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
60
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
61
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
62
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
63
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
64
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
65
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
66
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
67
|
+
<method />
|
68
|
+
</configuration>
|
69
|
+
<configuration default="false" name="HolidayScraper::Parser get years from: holiday_scraper" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
70
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
71
|
+
<module name="holiday_scraper" />
|
72
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
73
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
74
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
75
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
76
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
77
|
+
<envs>
|
78
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
79
|
+
</envs>
|
80
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
81
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
82
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
83
|
+
<COVERAGE_PATTERN ENABLED="true">
|
84
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
85
|
+
</COVERAGE_PATTERN>
|
86
|
+
</EXTENSION>
|
87
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
88
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/parser_spec.rb" />
|
89
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
90
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
91
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="HolidayScraper::Parser get years from" />
|
92
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
93
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
94
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
95
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
96
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
97
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
98
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
99
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
100
|
+
<method />
|
101
|
+
</configuration>
|
102
|
+
<configuration default="false" name="install: holiday_scraper" type="RakeRunConfigurationType" factoryName="Rake" temporary="true">
|
103
|
+
<module name="holiday_scraper" />
|
104
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
105
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
106
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
107
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
108
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
109
|
+
<envs />
|
110
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
111
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
112
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
113
|
+
<COVERAGE_PATTERN ENABLED="true">
|
114
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
115
|
+
</COVERAGE_PATTERN>
|
116
|
+
</EXTENSION>
|
117
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="install" />
|
118
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
|
119
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
|
120
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
|
121
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
|
122
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
|
123
|
+
<method />
|
124
|
+
</configuration>
|
125
|
+
<configuration default="false" name="build: holiday_scraper" type="RakeRunConfigurationType" factoryName="Rake" temporary="true">
|
126
|
+
<module name="holiday_scraper" />
|
127
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
128
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
129
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
130
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
131
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
132
|
+
<envs />
|
133
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
134
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
135
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
136
|
+
<COVERAGE_PATTERN ENABLED="true">
|
137
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
138
|
+
</COVERAGE_PATTERN>
|
139
|
+
</EXTENSION>
|
140
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="build" />
|
141
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
|
142
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
|
143
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
|
144
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
|
145
|
+
<RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
|
146
|
+
<method />
|
147
|
+
</configuration>
|
148
|
+
</component>
|
149
|
+
<component name="NewModuleRootManager">
|
150
|
+
<content url="file://$MODULE_DIR$" />
|
151
|
+
<orderEntry type="jdk" jdkName="ruby-2.3.0-p0" jdkType="RUBY_SDK" />
|
152
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
153
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.11.2, ruby-2.3.0-p0) [gem]" level="application" />
|
154
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, ruby-2.3.0-p0) [gem]" level="application" />
|
155
|
+
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.13.7, ruby-2.3.0-p0) [gem]" level="application" />
|
156
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.0.0, ruby-2.3.0-p0) [gem]" level="application" />
|
157
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.5.5, ruby-2.3.0-p0) [gem]" level="application" />
|
158
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.7.2, ruby-2.3.0-p0) [gem]" level="application" />
|
159
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.3.0-p0) [gem]" level="application" />
|
160
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.4.0, ruby-2.3.0-p0) [gem]" level="application" />
|
161
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.4.4, ruby-2.3.0-p0) [gem]" level="application" />
|
162
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.4.0, ruby-2.3.0-p0) [gem]" level="application" />
|
163
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.4.1, ruby-2.3.0-p0) [gem]" level="application" />
|
164
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.4.1, ruby-2.3.0-p0) [gem]" level="application" />
|
165
|
+
</component>
|
166
|
+
</module>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
4
|
+
<OptionsSetting value="true" id="Add" />
|
5
|
+
<OptionsSetting value="true" id="Remove" />
|
6
|
+
<OptionsSetting value="true" id="Checkout" />
|
7
|
+
<OptionsSetting value="true" id="Update" />
|
8
|
+
<OptionsSetting value="true" id="Status" />
|
9
|
+
<OptionsSetting value="true" id="Edit" />
|
10
|
+
<ConfirmationsSetting value="0" id="Add" />
|
11
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
12
|
+
</component>
|
13
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.0.0-p645" project-jdk-type="RUBY_SDK" />
|
14
|
+
</project>
|
data/.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/holiday_scraper.iml" filepath="$PROJECT_DIR$/.idea/holiday_scraper.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Cédric Wider
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Cedric Wider
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
## Installation
|
2
|
+
|
3
|
+
Add this line to your application's Gemfile:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
gem 'holiday_scraper'
|
7
|
+
```
|
8
|
+
|
9
|
+
And then execute:
|
10
|
+
|
11
|
+
$ bundle
|
12
|
+
|
13
|
+
Or install it yourself as:
|
14
|
+
|
15
|
+
$ gem install holiday_scraper
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
scraper = HolidayScraper::Scraper.new
|
21
|
+
events = HolidayScraper::Parser.new.parse(scraper.page)
|
22
|
+
```
|
23
|
+
|
24
|
+
## Development
|
25
|
+
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
27
|
+
|
28
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cedricwider/holidayscraper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
33
|
+
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
38
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
require "rdoc/task"
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
desc 'generate API documentation to doc/rdocs/index.html'
|
8
|
+
RDoc::Task.new do |rdoc|
|
9
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
10
|
+
end
|
11
|
+
|
12
|
+
task :default => :spec
|
13
|
+
task :test => :spec
|
data/bin/holiday_scraper
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require_relative '../lib/holiday_scraper'
|
4
|
+
|
5
|
+
scraper = HolidayScraper::Scraper.new
|
6
|
+
events = HolidayScraper::Parser.new.parse(scraper.page)
|
7
|
+
|
8
|
+
events.each do |event|
|
9
|
+
event_out = "#{event.name}: #{event.start_date}"
|
10
|
+
event_out += " - #{event.end_date}" if event.end_date
|
11
|
+
puts event_out
|
12
|
+
end
|
13
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'holiday_scraper/version'
|
6
|
+
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = "holiday_scraper"
|
10
|
+
spec.version = HolidayScraper::VERSION
|
11
|
+
spec.authors = ["Cedric Wider"]
|
12
|
+
spec.email = ["wider.cedric@gmail.com"]
|
13
|
+
|
14
|
+
spec.summary = %q{Scrape holidays for Dällikon from the school's official homepage}
|
15
|
+
spec.description = spec.summary
|
16
|
+
spec.homepage = "https://github.com/cedricwider/holidayscraper.git"
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
spec.bindir = 'bin'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
# runtime dependencies
|
25
|
+
spec.add_runtime_dependency 'httparty'
|
26
|
+
spec.add_runtime_dependency 'nokogiri'
|
27
|
+
|
28
|
+
# development dependencies
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
spec.add_development_dependency "rspec"
|
32
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
module HolidayScraper
|
2
|
+
class Parser
|
3
|
+
|
4
|
+
DATE_PATTERN = /[^,]+, (\d\d?. [^ ]+)(?: - [^,]+, (\d\d?. [^ ]+))?/
|
5
|
+
|
6
|
+
Event = Struct.new(:name, :start_date, :end_date)
|
7
|
+
|
8
|
+
def parse(page)
|
9
|
+
events = []
|
10
|
+
current_year = nil
|
11
|
+
each_table_header_on(page) do |table_header|
|
12
|
+
if year_header?(table_header)
|
13
|
+
current_year = table_header.text
|
14
|
+
elsif event_header?(table_header)
|
15
|
+
events << as_event(current_year, table_header)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
events
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
attr_reader :page
|
24
|
+
|
25
|
+
def holiday_table(page)
|
26
|
+
page.css('#contentboxsub table')
|
27
|
+
end
|
28
|
+
|
29
|
+
def each_table_header_on(page, &block)
|
30
|
+
holiday_table(page).css('th').each &block
|
31
|
+
end
|
32
|
+
|
33
|
+
def as_event(current_year, table_header)
|
34
|
+
start_date, end_date = parse_dates(date_string_from(table_header), current_year)
|
35
|
+
sanitize(Event.new(table_header.text, start_date, end_date))
|
36
|
+
end
|
37
|
+
|
38
|
+
def date_string_from(table_header)
|
39
|
+
table_header.next_sibling.next_sibling.text
|
40
|
+
end
|
41
|
+
|
42
|
+
def event_header?(table_header)
|
43
|
+
table_header.has_attribute?('valign')
|
44
|
+
end
|
45
|
+
|
46
|
+
def year_header?(table_header)
|
47
|
+
table_header.has_attribute?('colspan')
|
48
|
+
end
|
49
|
+
|
50
|
+
def parse_dates(str, year)
|
51
|
+
dates = []
|
52
|
+
match = DATE_PATTERN.match(str)
|
53
|
+
dates << Date.parse_international("#{match[1]} #{year}")
|
54
|
+
if match[2]
|
55
|
+
dates << Date.parse_international("#{match[2]} #{year}")
|
56
|
+
end
|
57
|
+
dates
|
58
|
+
end
|
59
|
+
|
60
|
+
def sanitize(event)
|
61
|
+
event.end_date += 365 if event.end_date && event.end_date < event.start_date
|
62
|
+
event
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# -*- coding: utf-8 -*-
|
68
|
+
#
|
69
|
+
# Purpose:
|
70
|
+
# Extend the date parsing capabilities of Ruby to work with dates with international month names.
|
71
|
+
#
|
72
|
+
# Usage:
|
73
|
+
#
|
74
|
+
# Date.parse_international(date_string)
|
75
|
+
# DateTime.parse_international(date_string)
|
76
|
+
# date_string.to_international_date
|
77
|
+
#
|
78
|
+
# Notes:
|
79
|
+
# 1) This routine works by substituting your local month names (as defined by Date::MONTHNAMES) for the
|
80
|
+
# international names when they occur in the date_string.
|
81
|
+
# 2) As distributed, this code works for French, German, Italian, and Spanish. You must add the month
|
82
|
+
# names for any additional languages you wish to handle.
|
83
|
+
#
|
84
|
+
|
85
|
+
class Date
|
86
|
+
def self.parse_international(string)
|
87
|
+
parse(month_to_english(string))
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def self.make_hash(names)
|
93
|
+
names.inject({}) {|result, name| result[name] = MONTHNAMES[result.count+1] ; result }
|
94
|
+
end
|
95
|
+
|
96
|
+
MONTH_TRANSLATIONS = {}
|
97
|
+
MONTH_TRANSLATIONS.merge! make_hash(%w/janvier février mars avril mai juin juillet août septembre octobre novembre décembre/) # French
|
98
|
+
MONTH_TRANSLATIONS.merge! make_hash(%w/januar februar märz april mai juni juli august september oktober november dezember/) # German
|
99
|
+
MONTH_TRANSLATIONS.merge! make_hash(%w/gennaio febbraio marzo aprile maggio giugno luglio agosto settembre ottobre novembre dicembre/) # Italian
|
100
|
+
MONTH_TRANSLATIONS.merge! make_hash(%w/enero febrero marzo abril mayo junio julio agosto septiembre octubre noviembre diciembre/) # Spanish
|
101
|
+
|
102
|
+
def self.month_to_english(string)
|
103
|
+
month_from = string[/[^\s\d,.]+/i] # Search for a month name
|
104
|
+
if month_from
|
105
|
+
month_to = MONTH_TRANSLATIONS[month_from.downcase] # Look up the translation
|
106
|
+
return string.sub(month_from, month_to.to_s) if month_to
|
107
|
+
end
|
108
|
+
return string
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class DateTime
|
113
|
+
def self.parse_international(string)
|
114
|
+
parse(Date::month_to_english(string))
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
class String
|
119
|
+
def to_international_date
|
120
|
+
Date::month_to_english(self).to_date
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module HolidayScraper
|
2
|
+
class Scraper
|
3
|
+
|
4
|
+
DAELLIKON_FERIENPLAN_URL = 'http://www.schule-daellikon.ch/de/ferienplan/'
|
5
|
+
|
6
|
+
def initialize(url = DAELLIKON_FERIENPLAN_URL)
|
7
|
+
@url = url
|
8
|
+
end
|
9
|
+
|
10
|
+
def page
|
11
|
+
@page ||= Nokogiri::HTML(HTTParty.get(url))
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
attr_reader :url
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: holiday_scraper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Cedric Wider
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: nokogiri
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Scrape holidays for Dällikon from the school's official homepage
|
84
|
+
email:
|
85
|
+
- wider.cedric@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".idea/.name"
|
92
|
+
- ".idea/.rakeTasks"
|
93
|
+
- ".idea/atlassian-ide-plugin.xml"
|
94
|
+
- ".idea/encodings.xml"
|
95
|
+
- ".idea/holiday_scraper.iml"
|
96
|
+
- ".idea/misc.xml"
|
97
|
+
- ".idea/modules.xml"
|
98
|
+
- ".idea/vcs.xml"
|
99
|
+
- ".rspec"
|
100
|
+
- ".travis.yml"
|
101
|
+
- CODE_OF_CONDUCT.md
|
102
|
+
- Gemfile
|
103
|
+
- LICENSE
|
104
|
+
- LICENSE.txt
|
105
|
+
- README.md
|
106
|
+
- Rakefile
|
107
|
+
- bin/holiday_scraper
|
108
|
+
- holiday_scraper.gemspec
|
109
|
+
- lib/holiday_scraper.rb
|
110
|
+
- lib/holiday_scraper/parser.rb
|
111
|
+
- lib/holiday_scraper/scraper.rb
|
112
|
+
- lib/holiday_scraper/version.rb
|
113
|
+
homepage: https://github.com/cedricwider/holidayscraper.git
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.5.1
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Scrape holidays for Dällikon from the school's official homepage
|
137
|
+
test_files: []
|
138
|
+
has_rdoc:
|