hatenablog 0.5.2 → 0.6.0

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
- SHA1:
3
- metadata.gz: 22d695f3608ea9a0b666d8fed252685d3b7c19f1
4
- data.tar.gz: e1ae79a67ac18f4f43476ee402a83f02bde88940
2
+ SHA256:
3
+ metadata.gz: 8b23d91da870185150a492dc63bc736664a9a267d1d8ce0b7e6be9646bc74222
4
+ data.tar.gz: 85f6cfe7fb4745e3ec4cefd1de86f9fdd70d49af692953af38f5b2767ec96916
5
5
  SHA512:
6
- metadata.gz: f7daba5de0a4bb7d4629164b6339b245ed31627ff68010176a95834f24667e25c95535584a65e55abe96b1a2ccbd5c03e060c631a37e6a8b6de83e6d94df8826
7
- data.tar.gz: a0eaad9e820e84388f053ef1f73b9734bc250fa693f3c29239e06d8e317d8552ce308f8624e450be8dc3901cdd87b8d6f0b007c1fc90e5fed4b15a46dec88bf6
6
+ metadata.gz: 657a83356b31866fbc825914971b7bd30be38569fea2892b8fe901d1e2bd96791bc50bc5e5f70059481e3920d65122979505a473afccb1d9feb396d28bfbe613
7
+ data.tar.gz: bee6720833ff60c3298b1aa06e451eb7011e55c72a6b55485012f0ab2c8a554b61c2ecbc0d72719777be0648a2a1c0af5c42f42414a4eebe980c1254250de0f4
@@ -0,0 +1,31 @@
1
+ name: build
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: ['2.4.x', '2.5.x', '2.6.x']
11
+ steps:
12
+ - uses: actions/checkout@v1
13
+ - name: Set up Ruby
14
+ uses: actions/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby }}
17
+ - name: Install Bundler
18
+ run: gem install bundler
19
+ - name: Install dependencies
20
+ run: bundle install -j4
21
+ - name: Run test
22
+ env:
23
+ TZ: Asia/Tokyo
24
+ run: bundle exec rake
25
+ - name: Report test coverage
26
+ env:
27
+ CC_TEST_REPORTER_ID: 309cf0784d00d2a6009566d28be111a8a0280cdeb2da280225eedf577b16beb5
28
+ run: |
29
+ curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
30
+ chmod +x ./cc-test-reporter
31
+ ./cc-test-reporter after-build
data/.gitignore CHANGED
@@ -28,9 +28,9 @@ build/
28
28
 
29
29
  # for a library or gem, you might want to ignore these files since the code is
30
30
  # intended to run in multiple environments; otherwise, check them in:
31
- # Gemfile.lock
32
- # .ruby-version
33
- # .ruby-gemset
31
+ Gemfile.lock
32
+ .ruby-version
33
+ .ruby-gemset
34
34
 
35
35
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
36
  .rvmrc
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hatenablog
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/hatenablog.svg)](https://badge.fury.io/rb/hatenablog) [![Build Status](https://travis-ci.org/kymmt90/hatenablog.svg?branch=master)](https://travis-ci.org/kymmt90/hatenablog)
3
+ [![Gem Version](https://badge.fury.io/rb/hatenablog.svg)](https://badge.fury.io/rb/hatenablog) [![Build Status](https://github.com/kymmt90/hatenablog/workflows/build/badge.svg)](https://github.com/kymmt90/hatenablog/actions?workflow=build)
4
4
  [![Code Climate](https://codeclimate.com/github/kymmt90/hatenablog/badges/gpa.svg)](https://codeclimate.com/github/kymmt90/hatenablog)
5
5
  [![Test Coverage](https://codeclimate.com/github/kymmt90/hatenablog/badges/coverage.svg)](https://codeclimate.com/github/kymmt90/hatenablog/coverage)
6
6
 
@@ -15,9 +15,11 @@ module Hatenablog
15
15
  @categories.dup
16
16
  end
17
17
 
18
- def each
18
+ def each(&block)
19
+ return enum_for(__method__) unless block_given?
20
+
19
21
  @categories.each do |category|
20
- yield category
22
+ block.call(category)
21
23
  end
22
24
  end
23
25
 
@@ -212,10 +212,12 @@ module Hatenablog
212
212
  @page = page
213
213
  end
214
214
 
215
- def each
215
+ def each(&block)
216
+ return enum_for(__method__) unless block_given?
217
+
216
218
  current_page = 0
217
219
  until (@page && current_page > @page) || !(feed = @client.next_feed(feed))
218
- feed.entries.each { |entry| yield entry }
220
+ feed.entries.each { |entry| block.call(entry) }
219
221
  current_page += 1
220
222
  end
221
223
  end
@@ -19,6 +19,7 @@ module Hatenablog
19
19
  define_method(method) do |*args, &block|
20
20
  result = send(origin_method, *args, &block)
21
21
  send(hook)
22
+ result
22
23
  end
23
24
  end
24
25
  end
@@ -27,8 +28,9 @@ module Hatenablog
27
28
  class Entry
28
29
  extend AfterHook
29
30
 
30
- attr_accessor :uri, :author_name, :title, :content, :draft, :categories
31
+ attr_accessor :uri, :author_name, :title, :content, :draft
31
32
  attr_reader :edit_uri, :id, :updated
33
+ attr_writer :categories
32
34
 
33
35
  def updated=(date)
34
36
  @updated = Time.parse(date)
@@ -130,8 +132,10 @@ module Hatenablog
130
132
  @content = @document.at_css('content').content
131
133
  @draft = @document.at_css('entry app|control app|draft').content
132
134
  @categories = parse_categories
133
- unless @document.at_css('entry updated').nil?
135
+ if @document.at_css('entry updated')
134
136
  @updated = Time.parse(@document.at_css('entry updated').content)
137
+ else
138
+ @updated = nil
135
139
  end
136
140
  end
137
141
 
@@ -1,3 +1,3 @@
1
1
  module Hatenablog
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hatenablog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohei Yamamoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2019-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,8 +130,8 @@ executables:
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
+ - ".github/workflows/build.yml"
133
134
  - ".gitignore"
134
- - ".travis.yml"
135
135
  - Gemfile
136
136
  - LICENSE.txt
137
137
  - README.md
@@ -167,8 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0'
169
169
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.6.11
170
+ rubygems_version: 3.0.3
172
171
  signing_key:
173
172
  specification_version: 4
174
173
  summary: Hatenablog AtomPub API library
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.6
4
- - 2.3.3
5
- - 2.4.0
6
- env:
7
- - TZ=Asia/Tokyo
8
- addons:
9
- code_climate:
10
- repo_token: 309cf0784d00d2a6009566d28be111a8a0280cdeb2da280225eedf577b16beb5
11
- after_success:
12
- - bundle exec codeclimate-test-reporter