webpage_update_checker 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +31 -0
- data/.gitignore +53 -0
- data/.rspec +3 -0
- data/.rubocop.yml +56 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +173 -0
- data/LICENSE +21 -0
- data/README.md +33 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/webpage_update_checker/judge.rb +14 -0
- data/lib/webpage_update_checker/methods/last_modified.rb +17 -0
- data/lib/webpage_update_checker/methods/md5.rb +16 -0
- data/lib/webpage_update_checker/methods/sha1.rb +16 -0
- data/lib/webpage_update_checker/methods/sha256.rb +16 -0
- data/lib/webpage_update_checker/methods/sha384.rb +16 -0
- data/lib/webpage_update_checker/methods/sha512.rb +16 -0
- data/lib/webpage_update_checker/version.rb +3 -0
- data/lib/webpage_update_checker.rb +5 -0
- data/webpage_update_checker.gemspec +41 -0
- metadata +289 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1d02d9b92d3ab8891e12c9cc7eaff8c75219158adb258bdbaeffbe5234d6d8f5
|
4
|
+
data.tar.gz: 9fd76ab55f4c9a7277e525d86672792fb98c18b0bdaf32a23da1f80bdfe9aa50
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f5174a32a8f062b53b4270dabee2c6a15c100993298a2907c01311d96a39df4895acd676951041cee97753f8de69f3a6b42622cc81b3dcc4c0059184a840a36
|
7
|
+
data.tar.gz: 4f7e0e712e24b25fb1c78cf9ad91440542db28481065e25bc976b7c9cb2dd042c0154f6136bfadde47d0326fcce3f25a87b3e8953d2d650fa586a0c38b4b025c
|
@@ -0,0 +1,31 @@
|
|
1
|
+
version: 2
|
2
|
+
jobs:
|
3
|
+
build:
|
4
|
+
docker:
|
5
|
+
- image: circleci/ruby:2.4.1-node-browsers
|
6
|
+
working_directory: /tmp/circleci/webpage-update-checker
|
7
|
+
steps:
|
8
|
+
- checkout
|
9
|
+
- restore_cache:
|
10
|
+
keys:
|
11
|
+
- v1-dependencies-{{ checksum "Gemfile.lock" }}
|
12
|
+
- v1-dependencies-
|
13
|
+
- run:
|
14
|
+
name: install dependencies
|
15
|
+
command: |
|
16
|
+
bundle install --jobs=4 --retry=3 --path vendor/bundle
|
17
|
+
- save_cache:
|
18
|
+
paths:
|
19
|
+
- ./vendor/bundle
|
20
|
+
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
21
|
+
- run:
|
22
|
+
name: run tests
|
23
|
+
command: |
|
24
|
+
mkdir /tmp/test-results
|
25
|
+
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
|
26
|
+
|
27
|
+
bundle exec rspec --format progress \
|
28
|
+
--format RspecJunitFormatter \
|
29
|
+
--out /tmp/test-results/rspec.xml \
|
30
|
+
--format progress \
|
31
|
+
$TEST_FILES
|
data/.gitignore
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
.rspec_status
|
53
|
+
.vscode
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Rails:
|
2
|
+
Enabled: true
|
3
|
+
|
4
|
+
Style/FrozenStringLiteralComment:
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Style/TrailingCommaInHashLiteral:
|
8
|
+
Enabled: false # 有効にすると見た目がいいレイアウトにした際に怒られるため無効にする
|
9
|
+
# EnforcedStyleForMultiline: consistent_comma
|
10
|
+
|
11
|
+
Style/TrailingCommaInArrayLiteral:
|
12
|
+
Enabled: false # 有効にすると見た目がいいレイアウトにした際に怒られるため無効にする
|
13
|
+
# EnforcedStyleForMultiline: consistent_comma
|
14
|
+
|
15
|
+
Style/BracesAroundHashParameters:
|
16
|
+
Enabled: false # 有効にすると見た目がいいレイアウトにした際に怒られるため無効にする
|
17
|
+
# EnforcedStyle: context_dependent
|
18
|
+
|
19
|
+
Layout/TrailingBlankLines:
|
20
|
+
Enabled: false # 有効にした場合、コメントが最終行だとどんな設定にしてても怒られるため無効にする
|
21
|
+
|
22
|
+
Style/AsciiComments:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Metrics/LineLength:
|
26
|
+
Max: 180 # 数字に特に根拠はない
|
27
|
+
|
28
|
+
Style/NumericLiterals:
|
29
|
+
Enabled: false
|
30
|
+
|
31
|
+
Style/PercentLiteralDelimiters:
|
32
|
+
Enabled: false
|
33
|
+
# TODO: 非常に心苦しいが、false としておく
|
34
|
+
# PreferredDelimiters:
|
35
|
+
# default: ()
|
36
|
+
# '%i': []
|
37
|
+
# '%I': []
|
38
|
+
# '%r': {}
|
39
|
+
# '%w': ()
|
40
|
+
# '%W': []
|
41
|
+
|
42
|
+
Style/Documentation:
|
43
|
+
Enabled: false # 一行目に class って書いてもいいでしょ
|
44
|
+
|
45
|
+
Style/ClassAndModuleChildren:
|
46
|
+
Enabled: false # 暫定的に false にする(名前空間関連)
|
47
|
+
|
48
|
+
Metrics/MethodLength:
|
49
|
+
Enabled: false # メソッドの長さが長いと怒られる(有用なので後で調整すること)
|
50
|
+
|
51
|
+
Rails/Output:
|
52
|
+
Enabled: false # プリントデバッグに使いたいので勘弁してくれ
|
53
|
+
|
54
|
+
Metrics/BlockLength:
|
55
|
+
Enabled: false # ブロック引数部分がある程度長くなることもある
|
56
|
+
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,173 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
webpage_update_checker (1.0.0)
|
5
|
+
mechanize
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
abstract_type (0.0.7)
|
11
|
+
adamantium (0.2.0)
|
12
|
+
ice_nine (~> 0.11.0)
|
13
|
+
memoizable (~> 0.4.0)
|
14
|
+
addressable (2.5.2)
|
15
|
+
public_suffix (>= 2.0.2, < 4.0)
|
16
|
+
ast (2.4.0)
|
17
|
+
binding_of_caller (0.8.0)
|
18
|
+
debug_inspector (>= 0.0.1)
|
19
|
+
byebug (10.0.2)
|
20
|
+
codeclimate-test-reporter (1.0.9)
|
21
|
+
simplecov (<= 0.13)
|
22
|
+
coderay (1.1.2)
|
23
|
+
concord (0.1.5)
|
24
|
+
adamantium (~> 0.2.0)
|
25
|
+
equalizer (~> 0.0.9)
|
26
|
+
connection_pool (2.2.2)
|
27
|
+
coveralls (0.8.19)
|
28
|
+
json (>= 1.8, < 3)
|
29
|
+
simplecov (~> 0.12.0)
|
30
|
+
term-ansicolor (~> 1.3)
|
31
|
+
thor (~> 0.19.1)
|
32
|
+
tins (~> 1.6)
|
33
|
+
crack (0.4.3)
|
34
|
+
safe_yaml (~> 1.0.0)
|
35
|
+
debug_inspector (0.0.3)
|
36
|
+
diff-lcs (1.3)
|
37
|
+
docile (1.1.5)
|
38
|
+
domain_name (0.5.20180417)
|
39
|
+
unf (>= 0.0.5, < 1.0.0)
|
40
|
+
dotenv (2.5.0)
|
41
|
+
equalizer (0.0.11)
|
42
|
+
hashdiff (0.3.7)
|
43
|
+
http-cookie (1.0.3)
|
44
|
+
domain_name (~> 0.5)
|
45
|
+
ice_nine (0.11.2)
|
46
|
+
jaro_winkler (1.5.1)
|
47
|
+
json (2.1.0)
|
48
|
+
mechanize (2.7.6)
|
49
|
+
domain_name (~> 0.5, >= 0.5.1)
|
50
|
+
http-cookie (~> 1.0)
|
51
|
+
mime-types (>= 1.17.2)
|
52
|
+
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
53
|
+
net-http-persistent (>= 2.5.2)
|
54
|
+
nokogiri (~> 1.6)
|
55
|
+
ntlm-http (~> 0.1, >= 0.1.1)
|
56
|
+
webrobots (>= 0.0.9, < 0.2)
|
57
|
+
memoizable (0.4.2)
|
58
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
59
|
+
method_source (0.9.0)
|
60
|
+
mime-types (3.2.2)
|
61
|
+
mime-types-data (~> 3.2015)
|
62
|
+
mime-types-data (3.2018.0812)
|
63
|
+
mini_portile2 (2.3.0)
|
64
|
+
net-http-digest_auth (1.4.1)
|
65
|
+
net-http-persistent (3.0.0)
|
66
|
+
connection_pool (~> 2.2)
|
67
|
+
nokogiri (1.8.4)
|
68
|
+
mini_portile2 (~> 2.3.0)
|
69
|
+
ntlm-http (0.1.1)
|
70
|
+
parallel (1.12.1)
|
71
|
+
parser (2.5.3.0)
|
72
|
+
ast (~> 2.4.0)
|
73
|
+
powerpack (0.1.2)
|
74
|
+
proc_to_ast (0.1.0)
|
75
|
+
coderay
|
76
|
+
parser
|
77
|
+
unparser
|
78
|
+
procto (0.0.3)
|
79
|
+
pry (0.11.3)
|
80
|
+
coderay (~> 1.1.0)
|
81
|
+
method_source (~> 0.9.0)
|
82
|
+
pry-byebug (3.6.0)
|
83
|
+
byebug (~> 10.0)
|
84
|
+
pry (~> 0.10)
|
85
|
+
public_suffix (3.0.3)
|
86
|
+
rainbow (3.0.0)
|
87
|
+
rake (10.5.0)
|
88
|
+
rspec (3.8.0)
|
89
|
+
rspec-core (~> 3.8.0)
|
90
|
+
rspec-expectations (~> 3.8.0)
|
91
|
+
rspec-mocks (~> 3.8.0)
|
92
|
+
rspec-core (3.8.0)
|
93
|
+
rspec-support (~> 3.8.0)
|
94
|
+
rspec-expectations (3.8.1)
|
95
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
96
|
+
rspec-support (~> 3.8.0)
|
97
|
+
rspec-its (1.2.0)
|
98
|
+
rspec-core (>= 3.0.0)
|
99
|
+
rspec-expectations (>= 3.0.0)
|
100
|
+
rspec-mocks (3.8.0)
|
101
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
102
|
+
rspec-support (~> 3.8.0)
|
103
|
+
rspec-parameterized (0.4.0)
|
104
|
+
binding_of_caller
|
105
|
+
parser
|
106
|
+
proc_to_ast
|
107
|
+
rspec (>= 2.13, < 4)
|
108
|
+
unparser
|
109
|
+
rspec-support (3.8.0)
|
110
|
+
rspec_junit_formatter (0.4.1)
|
111
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
112
|
+
rubocop (0.60.0)
|
113
|
+
jaro_winkler (~> 1.5.1)
|
114
|
+
parallel (~> 1.10)
|
115
|
+
parser (>= 2.5, != 2.5.1.1)
|
116
|
+
powerpack (~> 0.1)
|
117
|
+
rainbow (>= 2.2.2, < 4.0)
|
118
|
+
ruby-progressbar (~> 1.7)
|
119
|
+
unicode-display_width (~> 1.4.0)
|
120
|
+
ruby-progressbar (1.10.0)
|
121
|
+
safe_yaml (1.0.4)
|
122
|
+
simplecov (0.12.0)
|
123
|
+
docile (~> 1.1.0)
|
124
|
+
json (>= 1.8, < 3)
|
125
|
+
simplecov-html (~> 0.10.0)
|
126
|
+
simplecov-html (0.10.2)
|
127
|
+
term-ansicolor (1.7.0)
|
128
|
+
tins (~> 1.0)
|
129
|
+
thor (0.19.4)
|
130
|
+
thread_safe (0.3.6)
|
131
|
+
tins (1.19.0)
|
132
|
+
unf (0.1.4)
|
133
|
+
unf_ext
|
134
|
+
unf_ext (0.0.7.5)
|
135
|
+
unicode-display_width (1.4.0)
|
136
|
+
unparser (0.2.8)
|
137
|
+
abstract_type (~> 0.0.7)
|
138
|
+
adamantium (~> 0.2.0)
|
139
|
+
concord (~> 0.1.5)
|
140
|
+
diff-lcs (~> 1.3)
|
141
|
+
equalizer (~> 0.0.9)
|
142
|
+
parser (>= 2.3.1.2, < 2.6)
|
143
|
+
procto (~> 0.0.2)
|
144
|
+
webmock (3.4.2)
|
145
|
+
addressable (>= 2.3.6)
|
146
|
+
crack (>= 0.3.2)
|
147
|
+
hashdiff
|
148
|
+
webrobots (0.1.2)
|
149
|
+
yard (0.9.16)
|
150
|
+
|
151
|
+
PLATFORMS
|
152
|
+
ruby
|
153
|
+
|
154
|
+
DEPENDENCIES
|
155
|
+
bundler (~> 1.16)
|
156
|
+
codeclimate-test-reporter (~> 1.0.0)
|
157
|
+
coveralls
|
158
|
+
dotenv
|
159
|
+
pry
|
160
|
+
pry-byebug
|
161
|
+
rake (~> 10.0)
|
162
|
+
rspec (~> 3.0)
|
163
|
+
rspec-its
|
164
|
+
rspec-parameterized
|
165
|
+
rspec_junit_formatter
|
166
|
+
rubocop
|
167
|
+
simplecov
|
168
|
+
webmock
|
169
|
+
webpage_update_checker!
|
170
|
+
yard
|
171
|
+
|
172
|
+
BUNDLED WITH
|
173
|
+
1.17.1
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Osamu Takiya
|
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/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Webpage Update Checker
|
2
|
+
- Gem for checking whether the target webpage is updated.
|
3
|
+
- For not only webpage but also image, css and js (resources)
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/webpage_update_checker.svg)](https://badge.fury.io/rb/webpage_update_checker)
|
6
|
+
[![CircleCI](https://circleci.com/gh/corselia/webpage-update-checker.svg?style=svg)](https://circleci.com/gh/corselia/webpage-update-checker)
|
7
|
+
|
8
|
+
# Usage
|
9
|
+
```
|
10
|
+
gem 'webpage_update_checker'
|
11
|
+
```
|
12
|
+
|
13
|
+
```bash
|
14
|
+
$ bundle install
|
15
|
+
```
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'webpage_update_checker'
|
19
|
+
|
20
|
+
checker = WebpageUpdateChecker::Judge.new
|
21
|
+
target_page_md5 = WebpageUpdateChecker::Methods::Md5.new(uri: 'http://www.ne.jp/asahi/pursuits/ootsuki/pc/X68k/x680x0.xhtml')
|
22
|
+
|
23
|
+
checker.current_diff_value(target_page_md5) #=> fb2eeb524e6b5637ef7fa4bed48f1d67
|
24
|
+
checker.updated?(target_page_md5, previous_diff_value: 'fb2eeb524e6b5637ef7fa4bed48f1d67') #=> false (not updated)
|
25
|
+
checker.updated?(target_page_md5, previous_diff_value: '12345678901234567890123456789012') #=> true (updated)
|
26
|
+
```
|
27
|
+
|
28
|
+
# TODO
|
29
|
+
- [Coveralls](https://coveralls.io/)
|
30
|
+
- [Code Climate](https://codeclimate.com/)
|
31
|
+
|
32
|
+
# LICENSE
|
33
|
+
- [MIT LICENSE](/LICENSE)
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'webpage_update_checker'
|
5
|
+
|
6
|
+
# require 'dotenv'
|
7
|
+
# Dotenv.load
|
8
|
+
|
9
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
10
|
+
# with your gem easier. You can also use a different console, if you like.
|
11
|
+
|
12
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
13
|
+
require 'pry'
|
14
|
+
Pry.start
|
data/bin/setup
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'mechanize'
|
2
|
+
Dir[File.expand_path('methods', __dir__) << '/*.rb'].each { |file| require file }
|
3
|
+
|
4
|
+
module WebpageUpdateChecker
|
5
|
+
class Judge
|
6
|
+
def updated?(checked_object, previous_diff_value:)
|
7
|
+
current_diff_value(checked_object) != previous_diff_value
|
8
|
+
end
|
9
|
+
|
10
|
+
def current_diff_value(checked_object)
|
11
|
+
checked_object.current_diff_value
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
3
|
+
module WebpageUpdateChecker
|
4
|
+
module Methods
|
5
|
+
class LastModified
|
6
|
+
|
7
|
+
def initialize(uri:)
|
8
|
+
@uri = uri
|
9
|
+
end
|
10
|
+
|
11
|
+
def current_diff_value
|
12
|
+
page = Mechanize.new.get(@uri)
|
13
|
+
page.header['last-modified'] ? Time.parse(page.header['last-modified']) : nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module WebpageUpdateChecker
|
2
|
+
module Methods
|
3
|
+
class Md5
|
4
|
+
def initialize(uri:)
|
5
|
+
@uri = uri
|
6
|
+
end
|
7
|
+
|
8
|
+
def current_diff_value
|
9
|
+
require 'digest/md5'
|
10
|
+
|
11
|
+
page = Mechanize.new.get(@uri)
|
12
|
+
Digest::MD5.hexdigest(page.body)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module WebpageUpdateChecker
|
2
|
+
module Methods
|
3
|
+
class Sha1
|
4
|
+
def initialize(uri:)
|
5
|
+
@uri = uri
|
6
|
+
end
|
7
|
+
|
8
|
+
def current_diff_value
|
9
|
+
require 'digest/sha1'
|
10
|
+
|
11
|
+
page = Mechanize.new.get(@uri)
|
12
|
+
Digest::SHA1.hexdigest(page.body)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module WebpageUpdateChecker
|
2
|
+
module Methods
|
3
|
+
class Sha256
|
4
|
+
def initialize(uri:)
|
5
|
+
@uri = uri
|
6
|
+
end
|
7
|
+
|
8
|
+
def current_diff_value
|
9
|
+
require 'digest/sha2'
|
10
|
+
|
11
|
+
page = Mechanize.new.get(@uri)
|
12
|
+
Digest::SHA256.hexdigest(page.body)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module WebpageUpdateChecker
|
2
|
+
module Methods
|
3
|
+
class Sha384
|
4
|
+
def initialize(uri:)
|
5
|
+
@uri = uri
|
6
|
+
end
|
7
|
+
|
8
|
+
def current_diff_value
|
9
|
+
require 'digest/sha2'
|
10
|
+
|
11
|
+
page = Mechanize.new.get(@uri)
|
12
|
+
Digest::SHA384.hexdigest(page.body)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module WebpageUpdateChecker
|
2
|
+
module Methods
|
3
|
+
class Sha512
|
4
|
+
def initialize(uri:)
|
5
|
+
@uri = uri
|
6
|
+
end
|
7
|
+
|
8
|
+
def current_diff_value
|
9
|
+
require 'digest/sha2'
|
10
|
+
|
11
|
+
page = Mechanize.new.get(@uri)
|
12
|
+
Digest::SHA512.hexdigest(page.body)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'webpage_update_checker/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'webpage_update_checker'
|
7
|
+
spec.version = WebpageUpdateChecker::VERSION
|
8
|
+
spec.authors = ['Osamu Takiya']
|
9
|
+
spec.email = ['takiya@toran.sakura.ne.jp']
|
10
|
+
|
11
|
+
spec.summary = 'Check whether a webpage is updated'
|
12
|
+
spec.description = 'This gem checks whether a webpage is updated. By HTTP header or hash (MD5, SHA256...) differences, this gem inspects whether the page is updated or not.'
|
13
|
+
spec.homepage = 'https://github.com/corselia/webpage-update-checker'
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = 'exe'
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename f }
|
22
|
+
spec.require_paths = ['lib']
|
23
|
+
|
24
|
+
spec.add_dependency 'mechanize'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
27
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 1.0.0'
|
28
|
+
spec.add_development_dependency 'coveralls'
|
29
|
+
spec.add_development_dependency 'dotenv'
|
30
|
+
spec.add_development_dependency 'pry'
|
31
|
+
spec.add_development_dependency 'pry-byebug'
|
32
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
|
+
spec.add_development_dependency 'rspec-its'
|
35
|
+
spec.add_development_dependency 'rspec-parameterized'
|
36
|
+
spec.add_development_dependency 'rspec_junit_formatter'
|
37
|
+
spec.add_development_dependency 'rubocop'
|
38
|
+
spec.add_development_dependency 'simplecov'
|
39
|
+
spec.add_development_dependency 'webmock'
|
40
|
+
spec.add_development_dependency 'yard'
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,289 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: webpage_update_checker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Osamu Takiya
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-11-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mechanize
|
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: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: codeclimate-test-reporter
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: dotenv
|
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
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry-byebug
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rake
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '10.0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '10.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rspec-its
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rspec-parameterized
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rspec_junit_formatter
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: rubocop
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: simplecov
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: webmock
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ">="
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: yard
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
237
|
+
description: This gem checks whether a webpage is updated. By HTTP header or hash
|
238
|
+
(MD5, SHA256...) differences, this gem inspects whether the page is updated or not.
|
239
|
+
email:
|
240
|
+
- takiya@toran.sakura.ne.jp
|
241
|
+
executables: []
|
242
|
+
extensions: []
|
243
|
+
extra_rdoc_files: []
|
244
|
+
files:
|
245
|
+
- ".circleci/config.yml"
|
246
|
+
- ".gitignore"
|
247
|
+
- ".rspec"
|
248
|
+
- ".rubocop.yml"
|
249
|
+
- Gemfile
|
250
|
+
- Gemfile.lock
|
251
|
+
- LICENSE
|
252
|
+
- README.md
|
253
|
+
- Rakefile
|
254
|
+
- bin/console
|
255
|
+
- bin/setup
|
256
|
+
- lib/webpage_update_checker.rb
|
257
|
+
- lib/webpage_update_checker/judge.rb
|
258
|
+
- lib/webpage_update_checker/methods/last_modified.rb
|
259
|
+
- lib/webpage_update_checker/methods/md5.rb
|
260
|
+
- lib/webpage_update_checker/methods/sha1.rb
|
261
|
+
- lib/webpage_update_checker/methods/sha256.rb
|
262
|
+
- lib/webpage_update_checker/methods/sha384.rb
|
263
|
+
- lib/webpage_update_checker/methods/sha512.rb
|
264
|
+
- lib/webpage_update_checker/version.rb
|
265
|
+
- webpage_update_checker.gemspec
|
266
|
+
homepage: https://github.com/corselia/webpage-update-checker
|
267
|
+
licenses: []
|
268
|
+
metadata: {}
|
269
|
+
post_install_message:
|
270
|
+
rdoc_options: []
|
271
|
+
require_paths:
|
272
|
+
- lib
|
273
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - ">="
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '0'
|
278
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
279
|
+
requirements:
|
280
|
+
- - ">="
|
281
|
+
- !ruby/object:Gem::Version
|
282
|
+
version: '0'
|
283
|
+
requirements: []
|
284
|
+
rubyforge_project:
|
285
|
+
rubygems_version: 2.7.6
|
286
|
+
signing_key:
|
287
|
+
specification_version: 4
|
288
|
+
summary: Check whether a webpage is updated
|
289
|
+
test_files: []
|