qiita_trend 0.4.1 → 0.4.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: deb236394c618fe2b5eb7291ed6a26201b24e2009f13d5f7f5b3b424eb735879
4
- data.tar.gz: 5db6ade791a700afdd49d4ad9cf4d8794affa7cc0c817378171e753a690d7bc2
3
+ metadata.gz: 132ff1d32ba9c8a824e07a7e3d2c6823098242ec82c9088b311d11d966e97edb
4
+ data.tar.gz: b84e41afe0e2d10d00b1fa3afc699b47ac3ae4f0aa11e80eec0accbd4d7a0fd8
5
5
  SHA512:
6
- metadata.gz: c2b6f9bd38e0afb27ccdc703267a74d70eefaf523faeb348e410cdc2b6a5279657584e2b95aa276434a4b721c1e7e65e4a611fef72689015a9e83fdfc428cfb0
7
- data.tar.gz: 241e713d4d1dfc6ca893ff1c8e65df476f6183817d409b211dffb303d0cc45312657f11324bfc460aa985dcdea4baa4618c8c42cfdade196aa6d75432a074f56
6
+ metadata.gz: e0dab4659f2944b0a9edd128a23f897dfe35101632c192a40296c0c49de224f865345c7e4cef7e0e92e65d56873afec3f1674eb21079c06fea1f586023d67b46
7
+ data.tar.gz: 0f36488b2bb23ce076ff9bf9e34141b26f3c83883caec6ed15952fc3964d325cea64ac25fbb4e817931bada3f1f6c40375747a161faf59a54b7b938b00cae51b
@@ -1,47 +1,23 @@
1
1
  version: 2.1
2
2
  orbs:
3
+ ruby: circleci/ruby@1.1.2
3
4
  slack: circleci/slack@3.4.2
4
5
  executors:
5
6
  base:
6
7
  docker:
7
- - image: circleci/ruby:2.6.0
8
+ - image: cimg/ruby:2.6.6
9
+ auth:
10
+ username: dodonki1223
11
+ password: $DOCKERHUB_PASSWORD
8
12
  environment:
9
13
  # Bundlerのパス設定が書き換えられ`vendor/bundle`ではなくて`/usr/local/bundle`を参照してしまい`bundle exec`でエラーになる
10
14
  # Bundlerのconfigファイル(pathの設定がされたもの)をworkspaceで永続化し`vendor/bundle`を参照するようにするための設定
11
15
  BUNDLE_APP_CONFIG: .bundle
16
+ # ref: https://circleci.com/docs/2.0/faq/#how-can-i-set-the-timezone-in-docker-images
17
+ TZ: "Asia/Tokyo"
12
18
  working_directory: ~/dodonki1223/qiita_trend
13
19
 
14
20
  commands:
15
- install-bundler:
16
- steps:
17
- - run:
18
- name: Install bundler(2.1.0)
19
- command: gem install bundler:2.1.0
20
-
21
- # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
22
- restore-gem-cache:
23
- steps:
24
- - restore_cache:
25
- keys:
26
- - v1-dependencies-{{ checksum "Gemfile.lock" }}
27
- # fallback to using the latest cache if no exact match is found
28
- - v1-dependencies-
29
-
30
- install-gem:
31
- steps:
32
- - run:
33
- name: Install gem
34
- command: |
35
- # jobs=4は並列処理をして高速化するための設定(4つのjobで実行するって意味)
36
- bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
37
-
38
- save-gem-cache:
39
- steps:
40
- - save_cache:
41
- paths:
42
- - ./vendor/bundle
43
- key: v1-dependencies-{{ checksum "Gemfile.lock" }}
44
-
45
21
  save-workspace:
46
22
  steps:
47
23
  - persist_to_workspace:
@@ -55,35 +31,8 @@ commands:
55
31
  # working_directory からの相対パスか絶対パスを指定します
56
32
  at: .
57
33
 
58
- run-rubocop:
59
- steps:
60
- - run:
61
- name: Run RuboCop
62
- command: |
63
- bundle exec rubocop
64
-
65
- run-tests:
66
- steps:
67
- - run:
68
- name: Run tests
69
- command: |
70
- TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
71
- bundle exec rspec \
72
- --format progress \
73
- --format RspecJunitFormatter \
74
- --out test_results/rspec.xml \
75
- --format progress \
76
- $TEST_FILES
77
-
78
34
  collect-reports:
79
35
  steps:
80
- # ref:https://circleci.com/docs/ja/2.0/configuration-reference/#store_test_results
81
- - store_test_results:
82
- path: test_results
83
- - store_artifacts:
84
- # テスト結果をtest-resultsディレクトリに吐き出す
85
- path: test_results
86
- destination: test-results
87
36
  - store_artifacts:
88
37
  # カバレッジの結果をcoverage-resultsディレクトリに吐き出す
89
38
  path: coverage
@@ -102,19 +51,13 @@ commands:
102
51
 
103
52
  deploy-rubygems:
104
53
  steps:
105
- # ref:https://support.circleci.com/hc/ja/articles/115015628247-%E6%8E%A5%E7%B6%9A%E3%82%92%E7%B6%9A%E8%A1%8C%E3%81%97%E3%81%BE%E3%81%99%E3%81%8B-%E3%81%AF%E3%81%84-%E3%81%84%E3%81%84%E3%81%88-
106
- # read/write両方の権限が必要
107
- - add_ssh_keys:
108
- fingerprints:
109
- - "38:d2:72:5e:9f:67:93:9a:ec:95:94:a2:0e:bf:41:9e"
110
-
111
- # ref:https://circleci.com/docs/2.0/gh-bb-integration/#establishing-the-authenticity-of-an-ssh-host
54
+ # https://discuss.circleci.com/t/the-authenticity-of-github-host-cant-be-stablished/33133 と同じ現象で job が進まなくなるので以下の記事を参考に実装
55
+ # ref:https://circleci.com/docs/ja/2.0/gh-bb-integration/#ssh-%E3%83%9B%E3%82%B9%E3%83%88%E3%81%AE%E4%BF%A1%E9%A0%BC%E6%80%A7%E3%81%AE%E7%A2%BA%E7%AB%8B
112
56
  - run:
113
57
  name: Avoid hosts unknown for github
114
58
  command: |
115
59
  mkdir -p ~/.ssh
116
60
  echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
117
- bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==
118
61
  ' >> ~/.ssh/known_hosts
119
62
 
120
63
  - run:
@@ -138,39 +81,37 @@ jobs:
138
81
  executor: base
139
82
  steps:
140
83
  - checkout
141
- - install-bundler
142
- - restore-gem-cache
143
- - install-gem
144
- - save-gem-cache
84
+ - ruby/install-deps
145
85
  - save-workspace
146
86
 
147
87
  lint:
148
88
  executor: base
149
89
  steps:
150
90
  - using-workspace
151
- - install-bundler
152
- - run-rubocop
91
+ - ruby/install-deps
92
+ - ruby/rubocop-check
153
93
 
154
94
  test:
155
95
  executor: base
156
96
  steps:
157
97
  - using-workspace
158
- - install-bundler
159
- - run-tests
98
+ - ruby/install-deps
99
+ - ruby/rspec-test:
100
+ out-path: 'test_results/rspec/'
160
101
  - collect-reports
161
102
 
162
103
  document:
163
104
  executor: base
164
105
  steps:
165
106
  - using-workspace
166
- - install-bundler
107
+ - ruby/install-deps
167
108
  - create-document
168
109
 
169
110
  deploy:
170
111
  executor: base
171
112
  steps:
172
113
  - using-workspace
173
- - install-bundler
114
+ - ruby/install-deps
174
115
  - deploy-rubygems
175
116
  - deploy-notification
176
117
 
data/.gitignore CHANGED
@@ -7,6 +7,7 @@
7
7
  /spec/reports/
8
8
  /tmp/
9
9
  /vendor/
10
+ /test_results/
10
11
 
11
12
  # rspec failure tracking
12
13
  .rspec_status
@@ -16,4 +17,4 @@
16
17
 
17
18
  /cache/
18
19
  /spec/vcr/
19
- /vendor/
20
+ /vendor/
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qiita_trend (0.4.1)
4
+ qiita_trend (0.4.6)
5
5
  mechanize (~> 2.7)
6
- nokogiri (>= 1.10)
6
+ nokogiri (~> 1.10)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -39,7 +39,7 @@ $ ruby -r qiita_trend -e "pp QiitaTrend::Trend.new.items"
39
39
  "https://qiita-image-store.s3.amazonaws.com/0/15319/profile-images/1473684249",
40
40
  "user_page"=>"https://qiita.com/akameco",
41
41
  "article"=>"https://qiita.com/akameco/items/e12377e55e379d29636e",
42
- "created_at"=>"2019-08-05T01:17:34Z",
42
+ "published_at"=>"2019-08-05T01:17:34Z",
43
43
  "likes_count"=>158,
44
44
  "is_new_arrival"=>false},
45
45
  {"title"=>"Excelで誰でも簡単言語処理 (感情推定, 固有表現抽出, キーワード抽出, 文類似度推定 etc...)",
@@ -47,7 +47,7 @@ $ ruby -r qiita_trend -e "pp QiitaTrend::Trend.new.items"
47
47
  "user_image"=>"https://avatars2.githubusercontent.com/u/19549989?v=4",
48
48
  "user_page"=>"https://qiita.com/Harusugi",
49
49
  "article"=>"https://qiita.com/Harusugi/items/535874c0456dbc4db231",
50
- "created_at"=>"2019-08-04T23:01:22Z",
50
+ "published_at"=>"2019-08-04T23:01:22Z",
51
51
  "likes_count"=>103,
52
52
  "is_new_arrival"=>false},
53
53
  ...
@@ -173,7 +173,7 @@ irb(main):001:0> pp QiitaTrend::Trend.new.items[0]
173
173
  "https://qiita-image-store.s3.amazonaws.com/0/15319/profile-images/1473684249",
174
174
  "user_page"=>"https://qiita.com/akameco",
175
175
  "article"=>"https://qiita.com/akameco/items/e12377e55e379d29636e",
176
- "created_at"=>"2019-08-05T01:17:34Z",
176
+ "published_at"=>"2019-08-05T01:17:34Z",
177
177
  "likes_count"=>158,
178
178
  "is_new_arrival"=>false}
179
179
  ```
@@ -213,7 +213,7 @@ irb(main):001:0> pp QiitaTrend::Trend.new.items[0]
213
213
  <td></td>
214
214
  </tr>
215
215
  <tr>
216
- <td>created_at</td>
216
+ <td>published_at</td>
217
217
  <td>記事作成日</td>
218
218
  <td></td>
219
219
  </tr>
@@ -20,8 +20,7 @@ module QiitaTrend
20
20
  def initialize(trend_type = TrendType::DAILY, date = nil)
21
21
  page = Page.new(trend_type, date)
22
22
  parsed_html = Nokogiri::HTML.parse(page.html)
23
-
24
- trends_data = JSON.parse(parsed_html.xpath('//div[@data-hyperapp-app="Trend"]')[0]['data-hyperapp-props'])
23
+ trends_data = JSON.parse(parsed_html.xpath('//script[@data-component-name="HomeArticleTrendFeed"]')[0].text)
25
24
  @data = trends_data['trend']['edges']
26
25
  end
27
26
 
@@ -36,7 +35,7 @@ module QiitaTrend
36
35
  result['user_image'] = user_image(trend['node']['author']['profileImageUrl'])
37
36
  result['user_page'] = "#{Page::QIITA_URI}#{trend['node']['author']['urlName']}"
38
37
  result['article'] = "#{Page::QIITA_URI}#{trend['node']['author']['urlName']}/items/#{trend['node']['uuid']}"
39
- result['created_at'] = trend['node']['createdAt']
38
+ result['published_at'] = trend['node']['publishedAt']
40
39
  result['likes_count'] = trend['node']['likesCount']
41
40
  result['is_new_arrival'] = trend['isNewArrival']
42
41
  value << result
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QiitaTrend
4
- VERSION = '0.4.1'
4
+ VERSION = '0.4.6'
5
5
  end
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
39
39
 
40
40
  # qiita_trendに必要な依存gem設定(ここは最小限にすること)
41
41
  spec.add_dependency 'mechanize', '~> 2.7'
42
- spec.add_dependency 'nokogiri', '>= 1.10'
42
+ spec.add_dependency 'nokogiri', '~> 1.10'
43
43
  # 開発中のみ必要なgem設定
44
44
  spec.add_development_dependency 'bundler', '~> 2.0'
45
45
  spec.add_development_dependency 'pry', '~> 0.13'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiita_trend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - dodonki1223
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-08-26 00:00:00.000000000 Z
11
+ date: 2020-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.10'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.10'
41
41
  - !ruby/object:Gem::Dependency
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  - !ruby/object:Gem::Version
272
272
  version: '0'
273
273
  requirements: []
274
- rubygems_version: 3.0.1
274
+ rubygems_version: 3.1.3
275
275
  signing_key:
276
276
  specification_version: 4
277
277
  summary: Easy to get trend for Qiita in 10 seconds