apple_system_status 0.3.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +133 -0
- data/.circleci/setup.sh +8 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +0 -8
- data/README.md +1 -2
- data/apple_system_status.gemspec +3 -2
- data/lib/apple_system_status/crawler.rb +25 -8
- data/lib/apple_system_status/version.rb +1 -1
- metadata +7 -20
- data/.travis.yml +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f37e0bc20f096a7bc87993a4fede84c3a65179ce45eeecdef66366247e8ded24
|
4
|
+
data.tar.gz: '051072148ed47b0d99ef85b8f3dabfa7e7729ea380e7c00ce636811a3e7b0428'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94a23d2049243bd3bfe2f283a15c1bd46749a22751f901554574319b640ee36ff567378584a36e6f11b1212f00bb3fd93be7d809933e18cbf8cb92c1bb94a07
|
7
|
+
data.tar.gz: b0398313dbf3df6fef23a1361f43a6e5624e50c67043c0475522fb52b79d67080c74a99a895de6e98eaa7cfe3034e8fa4bf422f544055d539ea5b9aeea1e6986
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# Ruby CircleCI 2.0 configuration file
|
2
|
+
#
|
3
|
+
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
|
4
|
+
#
|
5
|
+
version: 2
|
6
|
+
|
7
|
+
environment: &environment
|
8
|
+
LANG: en_US.UTF-8
|
9
|
+
LANGUAGE: en_US.UTF-8
|
10
|
+
LC_ALL: C.UTF-8
|
11
|
+
|
12
|
+
BUNDLE_PATH: vendor/bundle
|
13
|
+
BUNDLE_JOBS: 4
|
14
|
+
CODECLIMATE_REPO_TOKEN: 89b665462d69ce4c873ee8165d496c4a97b9afaaf48e375c1bc3200e4b45b1e7
|
15
|
+
|
16
|
+
default: &default
|
17
|
+
docker:
|
18
|
+
- image: circleci/ruby
|
19
|
+
environment:
|
20
|
+
<<: *environment
|
21
|
+
|
22
|
+
working_directory: ~/app
|
23
|
+
|
24
|
+
restore_repo_cache_option: &restore_repo_cache_option
|
25
|
+
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
|
26
|
+
|
27
|
+
save_repo_cache_option: &save_repo_cache_option
|
28
|
+
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
|
29
|
+
paths:
|
30
|
+
- ~/app
|
31
|
+
|
32
|
+
restore_bundle_cache_option: &restore_bundle_cache_option
|
33
|
+
keys:
|
34
|
+
- v1-bundle-{{ .Environment.CIRCLE_JOB }}-{{ epoch }}
|
35
|
+
- v1-bundle-{{ .Environment.CIRCLE_JOB }}
|
36
|
+
|
37
|
+
save_bundle_cache_option: &save_bundle_cache_option
|
38
|
+
key: v1-bundle-{{ .Environment.CIRCLE_JOB }}-{{ epoch }}
|
39
|
+
paths:
|
40
|
+
- ~/app/vendor/bundle
|
41
|
+
- ~/app/Gemfile.lock
|
42
|
+
|
43
|
+
rspec_steps: &rspec_steps
|
44
|
+
- restore_cache:
|
45
|
+
<<: *restore_repo_cache_option
|
46
|
+
- restore_cache:
|
47
|
+
<<: *restore_bundle_cache_option
|
48
|
+
- run: ./.circleci/setup.sh
|
49
|
+
- save_cache:
|
50
|
+
<<: *save_bundle_cache_option
|
51
|
+
|
52
|
+
- run: bundle exec rspec
|
53
|
+
- run: bundle exec codeclimate-test-reporter
|
54
|
+
|
55
|
+
build_jobs: &build_jobs
|
56
|
+
- checkout_code
|
57
|
+
- ruby:2.2:
|
58
|
+
requires:
|
59
|
+
- checkout_code
|
60
|
+
- ruby:2.3:
|
61
|
+
requires:
|
62
|
+
- checkout_code
|
63
|
+
- ruby:2.4:
|
64
|
+
requires:
|
65
|
+
- checkout_code
|
66
|
+
- ruby:2.5:
|
67
|
+
requires:
|
68
|
+
- checkout_code
|
69
|
+
|
70
|
+
jobs:
|
71
|
+
checkout_code:
|
72
|
+
<<: *default
|
73
|
+
|
74
|
+
steps:
|
75
|
+
- checkout
|
76
|
+
|
77
|
+
- save_cache:
|
78
|
+
<<: *save_repo_cache_option
|
79
|
+
|
80
|
+
ruby:2.2:
|
81
|
+
<<: *default
|
82
|
+
|
83
|
+
docker:
|
84
|
+
- image: circleci/ruby:2.2-node-browsers
|
85
|
+
environment:
|
86
|
+
<<: *environment
|
87
|
+
|
88
|
+
steps: *rspec_steps
|
89
|
+
|
90
|
+
ruby:2.3:
|
91
|
+
<<: *default
|
92
|
+
|
93
|
+
docker:
|
94
|
+
- image: circleci/ruby:2.3-node-browsers
|
95
|
+
environment:
|
96
|
+
<<: *environment
|
97
|
+
|
98
|
+
steps: *rspec_steps
|
99
|
+
|
100
|
+
ruby:2.4:
|
101
|
+
<<: *default
|
102
|
+
|
103
|
+
docker:
|
104
|
+
- image: circleci/ruby:2.4-node-browsers
|
105
|
+
environment:
|
106
|
+
<<: *environment
|
107
|
+
|
108
|
+
steps: *rspec_steps
|
109
|
+
|
110
|
+
ruby:2.5:
|
111
|
+
<<: *default
|
112
|
+
|
113
|
+
docker:
|
114
|
+
- image: circleci/ruby:2.5-node-browsers
|
115
|
+
environment:
|
116
|
+
<<: *environment
|
117
|
+
|
118
|
+
steps: *rspec_steps
|
119
|
+
|
120
|
+
workflows:
|
121
|
+
version: 2
|
122
|
+
|
123
|
+
build:
|
124
|
+
jobs: *build_jobs
|
125
|
+
|
126
|
+
weekly_build:
|
127
|
+
triggers:
|
128
|
+
- schedule:
|
129
|
+
cron: "00 19 * * 5" # JST 4:00 (Sat)
|
130
|
+
filters:
|
131
|
+
branches:
|
132
|
+
only: master
|
133
|
+
jobs: *build_jobs
|
data/.circleci/setup.sh
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.3.2](https://github.com/sue445/apple_system_status/tree/v0.3.2) (2017-08-26)
|
4
|
+
[Full Changelog](https://github.com/sue445/apple_system_status/compare/v0.3.1...v0.3.2)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Fixed: title including description [\#18](https://github.com/sue445/apple_system_status/pull/18) ([sue445](https://github.com/sue445))
|
9
|
+
|
3
10
|
## [v0.3.1](https://github.com/sue445/apple_system_status/tree/v0.3.1) (2017-07-06)
|
4
11
|
[Full Changelog](https://github.com/sue445/apple_system_status/compare/v0.3.0...v0.3.1)
|
5
12
|
|
data/Gemfile
CHANGED
@@ -4,14 +4,6 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.2")
|
7
|
-
# NOTE: activesupport 5.x supports only ruby 2.2.2+
|
8
|
-
gem "activesupport", ">= 4.0.0", "< 5.0.0"
|
9
|
-
|
10
7
|
# NOTE: rack 2.x supports only ruby 2.2.2+
|
11
8
|
gem "rack", "< 2.0.0"
|
12
9
|
end
|
13
|
-
|
14
|
-
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.2.0")
|
15
|
-
# NOTE: byebug 9.1.0+ requires ruby 2.2.0+
|
16
|
-
gem "byebug", "< 9.1.0"
|
17
|
-
end
|
data/README.md
CHANGED
@@ -3,11 +3,10 @@
|
|
3
3
|
[Apple System Status](https://www.apple.com/support/systemstatus/) scraping library
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/apple_system_status.svg)](http://badge.fury.io/rb/apple_system_status)
|
6
|
-
[![
|
6
|
+
[![CircleCI](https://circleci.com/gh/sue445/apple_system_status/tree/master.svg?style=svg)](https://circleci.com/gh/sue445/apple_system_status/tree/master)
|
7
7
|
[![Code Climate](https://codeclimate.com/github/sue445/apple_system_status/badges/gpa.svg)](https://codeclimate.com/github/sue445/apple_system_status)
|
8
8
|
[![Test Coverage](https://codeclimate.com/github/sue445/apple_system_status/badges/coverage.svg)](https://codeclimate.com/github/sue445/apple_system_status/coverage)
|
9
9
|
[![Coverage Status](https://coveralls.io/repos/sue445/apple_system_status/badge.svg?branch=master&service=github)](https://coveralls.io/github/sue445/apple_system_status?branch=master)
|
10
|
-
[![Dependency Status](https://gemnasium.com/sue445/apple_system_status.svg)](https://gemnasium.com/sue445/apple_system_status)
|
11
10
|
|
12
11
|
## Requirements
|
13
12
|
* Ruby 2.1+
|
data/apple_system_status.gemspec
CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/sue445/apple_system_status"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
+
spec.required_ruby_version = ">= 2.2"
|
18
|
+
|
17
19
|
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
20
|
# delete this section to allow pushing this gem to any host.
|
19
21
|
if spec.respond_to?(:metadata)
|
@@ -27,9 +29,8 @@ Gem::Specification.new do |spec|
|
|
27
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
30
|
spec.require_paths = ["lib"]
|
29
31
|
|
30
|
-
spec.add_dependency "activesupport"
|
31
32
|
spec.add_dependency "capybara"
|
32
|
-
spec.add_dependency "
|
33
|
+
spec.add_dependency "selenium-webdriver"
|
33
34
|
spec.add_dependency "thor"
|
34
35
|
|
35
36
|
spec.add_development_dependency "bundler"
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module AppleSystemStatus
|
2
2
|
require "capybara"
|
3
|
-
require
|
4
|
-
require "active_support/core_ext/object/blank"
|
3
|
+
require "selenium-webdriver"
|
5
4
|
|
6
5
|
class Crawler
|
7
6
|
USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36"
|
@@ -9,11 +8,24 @@ module AppleSystemStatus
|
|
9
8
|
MAX_RETRY_COUNT = 5
|
10
9
|
|
11
10
|
def initialize
|
12
|
-
Capybara.register_driver :
|
13
|
-
|
11
|
+
Capybara.register_driver :chrome_headless do |app|
|
12
|
+
client = Selenium::WebDriver::Remote::Http::Default.new
|
13
|
+
client.read_timeout = 120
|
14
|
+
|
15
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
|
16
|
+
chromeOptions: {
|
17
|
+
args: ["headless", "disable-gpu", "window-size=1280,800", "no-sandbox", "user-agent=#{USER_AGENT}"]
|
18
|
+
}
|
19
|
+
)
|
20
|
+
|
21
|
+
Capybara::Selenium::Driver.new(
|
22
|
+
app,
|
23
|
+
browser: :chrome,
|
24
|
+
desired_capabilities: capabilities,
|
25
|
+
http_client: client,
|
26
|
+
)
|
14
27
|
end
|
15
|
-
@session = Capybara::Session.new(:
|
16
|
-
@session.driver.headers = { "User-Agent" => USER_AGENT }
|
28
|
+
@session = Capybara::Session.new(:chrome_headless)
|
17
29
|
end
|
18
30
|
|
19
31
|
def quit!
|
@@ -53,7 +65,7 @@ module AppleSystemStatus
|
|
53
65
|
|
54
66
|
raise "Not found services" if response[:services].empty?
|
55
67
|
|
56
|
-
unless
|
68
|
+
unless self.class.blank_string?(title)
|
57
69
|
response[:services].select! { |service| service[:title] == title }
|
58
70
|
end
|
59
71
|
|
@@ -63,7 +75,7 @@ module AppleSystemStatus
|
|
63
75
|
end
|
64
76
|
|
65
77
|
def apple_url(country)
|
66
|
-
if
|
78
|
+
if self.class.blank_string?(country) || country == "us"
|
67
79
|
"https://www.apple.com/support/systemstatus/"
|
68
80
|
else
|
69
81
|
"https://www.apple.com/#{country}/support/systemstatus/"
|
@@ -89,6 +101,11 @@ module AppleSystemStatus
|
|
89
101
|
crawler.quit!
|
90
102
|
end
|
91
103
|
|
104
|
+
def self.blank_string?(str)
|
105
|
+
return true unless str
|
106
|
+
str.strip.empty?
|
107
|
+
end
|
108
|
+
|
92
109
|
private
|
93
110
|
|
94
111
|
def fetch_services
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apple_system_status
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
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
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: capybara
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +25,7 @@ dependencies:
|
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: selenium-webdriver
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - ">="
|
@@ -200,10 +186,11 @@ executables:
|
|
200
186
|
extensions: []
|
201
187
|
extra_rdoc_files: []
|
202
188
|
files:
|
189
|
+
- ".circleci/config.yml"
|
190
|
+
- ".circleci/setup.sh"
|
203
191
|
- ".coveralls.yml"
|
204
192
|
- ".gitignore"
|
205
193
|
- ".rspec"
|
206
|
-
- ".travis.yml"
|
207
194
|
- ".yardopts"
|
208
195
|
- CHANGELOG.md
|
209
196
|
- Gemfile
|
@@ -231,7 +218,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
231
218
|
requirements:
|
232
219
|
- - ">="
|
233
220
|
- !ruby/object:Gem::Version
|
234
|
-
version: '
|
221
|
+
version: '2.2'
|
235
222
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
223
|
requirements:
|
237
224
|
- - ">="
|
@@ -239,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
226
|
version: '0'
|
240
227
|
requirements: []
|
241
228
|
rubyforge_project:
|
242
|
-
rubygems_version: 2.6
|
229
|
+
rubygems_version: 2.7.6
|
243
230
|
signing_key:
|
244
231
|
specification_version: 4
|
245
232
|
summary: Apple System Status scraping library
|
data/.travis.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.1
|
4
|
-
- 2.2.2
|
5
|
-
- 2.3.1
|
6
|
-
- 2.4.0
|
7
|
-
- ruby-head
|
8
|
-
before_script:
|
9
|
-
- export CI=true
|
10
|
-
- export CODECLIMATE_REPO_TOKEN=89b665462d69ce4c873ee8165d496c4a97b9afaaf48e375c1bc3200e4b45b1e7
|
11
|
-
- mkdir travis-phantomjs
|
12
|
-
- wget https://assets.membergetmember.co/software/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
|
13
|
-
- tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs
|
14
|
-
- export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH
|
15
|
-
- phantomjs --version
|
16
|
-
before_install: gem install bundler -v 1.10.5
|
17
|
-
script:
|
18
|
-
- bundle exec rspec
|
19
|
-
- bundle exec codeclimate-test-reporter
|
20
|
-
branches:
|
21
|
-
only:
|
22
|
-
- master
|
23
|
-
notifications:
|
24
|
-
email: false
|
25
|
-
slack:
|
26
|
-
secure: wPazrrt03q4/4YEWTGejm2yB36hROtpeJKSojv4cE1gRQarQceyMZdOZU4gvJ7DP5ehGSikp+PvdhUj8ZGmUoLcaQQu89eCxa5BGf3sofYD2EOZJe33w+di+L++41/cFp6XJ9XRPxbmVjpmPzl28yq2nfzgdI90qhztcswojGyT3Pkj0STB4qu6T+Kmvd5o4vlWUsZlKiv20sAav5/kL86/K4gwakmpyxPYMafG4WcVGbXoHovOlwdHXdml3Ldfuq9IQ35tu0xJ23o6RoPHl38klOgQQj4k7vbtowWmE5UWZFzWkPpH9GDYtS3ML4yCcM7QLj8nEMVWj+QlTsICmKgKfvSpcs9jQtLQEykDS/H43dTu3gyLuGPcbKbR08cXxkOq6lAAuVV7avNkJb5yJV8Nj+1PWksbBbTNwURamjogRTejxX1dTTUsTQITrrCJyKCOM8LvigKTBmpkEiBR6wDZqZoAx6HXEu0O8G9XpT7aI3pJ85/RCxQdYDe193olcg25TQNjlrSaFl6M1VCMB3jzNcCHZkmiM9KnTRjTMSn/5FUxzAnGeaHvxff6wMffcPKS3E/j+2sXkdpsL1Kwtj6b7ejpL/Pbn6P926iWx8mUmH0xC04M8nQgDE1aorMuqHSSH0EPUUMGBdOPvXOjR2CEtEYgqH/ymDPsT/dUub1M=
|
27
|
-
matrix:
|
28
|
-
allow_failures:
|
29
|
-
- rvm: ruby-head
|
30
|
-
sudo: false
|
31
|
-
cache: bundler
|