syobocalite 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27047202eef018b20e894d68c9c77a429a3bed348228239889e0cf76925b8f3a
4
- data.tar.gz: 8c8c19bbd0c9c140f8c61802fd6d8a8f6f136c9fa5226344001026c5ff7345ad
3
+ metadata.gz: 54e715bc7979d257cd27952ad2591999411c2fbff9a5bf89ae74e68ef2130507
4
+ data.tar.gz: 838b7257de52a103e8d12f04892600020edd0eeb2845b94da847508022ec2634
5
5
  SHA512:
6
- metadata.gz: c1f677c0e2848b61a575b5d008b7b47f5a6e91d5a28ad1755a0d4cd5272ade7ba29802e57178047c2b0baf789a30f4289c940a7e80705ff1b09330e8cddeddd8
7
- data.tar.gz: df34dd8b948c3ffbc14b975a7475f4116ae846712c9fc95c81f752be50091986c8099fcb1d0c8ecf75b9aa7f41869f79239e232b893789ece21e78ced5f34a96
6
+ metadata.gz: 3df0024a0d4337855bf8b6c51e51b3a7859ec97b5f3030b4bca2695057e88cb9640aaa443adbd27508f8fb3830c928284cd42f217247a6c741c476a9f651ec6c
7
+ data.tar.gz: 745e50fe71acf628cd6dba421b44327234179a099702ac626b7e6718d834cdb51ce2e02f8b7b023beb2ef80445b92223a07d79d007650c9e31e78d1d72307134
@@ -0,0 +1,10 @@
1
+ # c.f. https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2
+ version: 2
3
+
4
+ updates:
5
+ - package-ecosystem: github-actions
6
+ directory: /
7
+ schedule:
8
+ interval: weekly
9
+ assignees:
10
+ - sue445
@@ -0,0 +1,59 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches:
8
+ - master
9
+
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch:
12
+
13
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ # Allow one concurrent deployment
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: true
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v4
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ruby
38
+ bundler-cache: true
39
+
40
+ - run: bundle exec yard
41
+
42
+ - name: Setup Pages
43
+ uses: actions/configure-pages@v5
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v3
46
+ with:
47
+ # Upload entire repository
48
+ path: './doc'
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@main
52
+
53
+ - name: Slack Notification (not success)
54
+ uses: act10ns/slack@v2
55
+ if: "! success()"
56
+ continue-on-error: true
57
+ with:
58
+ status: ${{ job.status }}
59
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
@@ -2,105 +2,52 @@ name: test
2
2
 
3
3
  on:
4
4
  push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ types:
9
+ - opened
10
+ - synchronize
11
+ - reopened
5
12
  schedule:
6
13
  - cron: "0 10 * * 5" # JST 19:00 (Fri)
7
14
 
8
- env:
9
- CI: "true"
10
-
11
15
  jobs:
12
16
  test:
13
- runs-on: ${{ matrix.runner }}
17
+ runs-on: ubuntu-latest
14
18
 
15
19
  strategy:
16
20
  fail-fast: false
17
21
 
18
22
  matrix:
19
23
  ruby:
20
- - 2.5.0
21
- - 2.6.0
22
- - 2.7.0
23
- - 2.8.0-dev
24
- include:
25
- - ruby: 2.5.0
26
- runner: ubuntu-latest
27
- - ruby: 2.6.0
28
- runner: ubuntu-latest
29
- - ruby: 2.7.0
30
- runner: ubuntu-latest
31
- - ruby: 2.8.0-dev
32
- runner: ubuntu-latest
24
+ - "2.5"
25
+ - "2.6"
26
+ - "2.7"
27
+ - "3.0"
28
+ - "3.1"
29
+ - "3.2"
30
+ - "3.3"
33
31
 
34
32
  steps:
35
- - uses: actions/checkout@v2
36
-
37
- - name: Set up rbenv
38
- uses: masa-iwasaki/setup-rbenv@1.1.0
39
-
40
- - name: Cache RBENV_ROOT
41
- uses: actions/cache@v1
42
- id: cache_rbenv
43
- with:
44
- path: ~/.rbenv/versions
45
- key: v1-rbenv-${{ runner.os }}-${{ matrix.ruby }}
46
- if: "!endsWith(matrix.ruby, '-dev')"
47
-
48
- - name: Reinstall libssl-dev
49
- run: |
50
- set -xe
51
- sudo apt-get remove -y libssl-dev
52
- sudo apt-get install -y libssl-dev=1.0.2g-1ubuntu4.15
53
- if: matrix.runner == 'ubuntu-16.04'
54
-
55
- - name: Install Ruby
56
- run: |
57
- set -xe
58
- eval "$(rbenv init -)"
59
- rbenv install -s $RBENV_VERSION
60
-
61
- gem install bundler --no-document -v 1.17.3 || true
62
- env:
63
- RBENV_VERSION: ${{ matrix.ruby }}
64
- continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
65
-
66
- - name: Generate unique cache key
67
- run: uuidgen > uuid.txt
33
+ - uses: actions/checkout@v4
68
34
 
69
- - name: Cache vendor/bundle
70
- uses: actions/cache@v1
71
- id: cache_gem
35
+ - uses: ruby/setup-ruby@v1
72
36
  with:
73
- path: vendor/bundle
74
- key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles('uuid.txt') }}
75
- restore-keys: |
76
- v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
77
- continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
37
+ ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
39
+ cache-version: ${{ matrix.gemfile }}
78
40
 
79
- - name: bundle update
80
- run: |
81
- set -xe
82
- eval "$(rbenv init -)"
83
- bundle config path vendor/bundle
84
- bundle update --jobs $(nproc) --retry 3
85
- env:
86
- RBENV_VERSION: ${{ matrix.ruby }}
87
- continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
41
+ - run: bundle update --jobs $(nproc) --retry 3
88
42
 
89
43
  - name: Setup Code Climate Test Reporter
90
44
  uses: aktions/codeclimate-test-reporter@v1
91
45
  with:
92
46
  codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
93
47
  command: before-build
94
- continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
48
+ continue-on-error: true
95
49
 
96
- - name: Run test
97
- run: |
98
- set -xe
99
- eval "$(rbenv init -)"
100
- bundle exec rspec
101
- env:
102
- RBENV_VERSION: ${{ matrix.ruby }}
103
- continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
50
+ - run: bundle exec rspec
104
51
 
105
52
  - name: Teardown Code Climate Test Reporter
106
53
  uses: aktions/codeclimate-test-reporter@v1
@@ -108,17 +55,16 @@ jobs:
108
55
  codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
109
56
  command: after-build
110
57
  if: always()
111
- continue-on-error: ${{ endsWith(matrix.ruby, '-dev') }}
58
+ continue-on-error: true
112
59
 
113
60
  - name: Slack Notification (not success)
114
- uses: homoluctus/slatify@v2.0.0
61
+ uses: act10ns/slack@v2
115
62
  if: "! success()"
63
+ continue-on-error: true
116
64
  with:
117
- job_name: ${{ format('*build* ({0})', matrix.ruby) }}
118
- type: ${{ job.status }}
119
- icon_emoji: ":octocat:"
120
- url: ${{ secrets.SLACK_WEBHOOK }}
121
- token: ${{ secrets.GITHUB_TOKEN }}
65
+ status: ${{ job.status }}
66
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
67
+ matrix: ${{ toJson(matrix) }}
122
68
 
123
69
  notify:
124
70
  needs:
@@ -128,11 +74,9 @@ jobs:
128
74
 
129
75
  steps:
130
76
  - name: Slack Notification (success)
131
- uses: homoluctus/slatify@v2.0.0
77
+ uses: act10ns/slack@v2
132
78
  if: always()
79
+ continue-on-error: true
133
80
  with:
134
- job_name: '*build*'
135
- type: ${{ job.status }}
136
- icon_emoji: ":octocat:"
137
- url: ${{ secrets.SLACK_WEBHOOK }}
138
- token: ${{ secrets.GITHUB_TOKEN }}
81
+ status: ${{ job.status }}
82
+ webhook-url: ${{ secrets.SLACK_WEBHOOK }}
data/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
1
  ## master
2
- [full changelog](https://github.com/sue445/syobocalite/compare/v1.0.0...master)
2
+ [full changelog](https://github.com/sue445/syobocalite/compare/v1.1.0...master)
3
+
4
+ ## 1.1.0
5
+ [full changelog](https://github.com/sue445/syobocalite/compare/v1.0.1...v1.1.0)
6
+
7
+ * Add `#flag`,`#remark?`, `#new?`, `#final?` and `#re_air?` to `Syobocalite::Program`
8
+ * https://github.com/sue445/syobocalite/pull/41
9
+
10
+ ## 1.0.1
11
+ [full changelog](https://github.com/sue445/syobocalite/compare/v1.0.0...v1.0.1)
12
+
13
+ * Enable MFA requirement for gem releasing
14
+ * https://github.com/sue445/syobocalite/pull/24
3
15
 
4
16
  ## 1.0.0
5
17
  [full changelog](https://github.com/sue445/syobocalite/compare/v0.1.1...v1.0.0)
6
18
 
7
- ### BREAKING CHANGES :bomb
19
+ ### BREAKING CHANGES :bomb:
8
20
  * Drop support ruby 2.3 and 2.4
9
21
  * https://github.com/sue445/syobocalite/pull/14
10
22
 
data/README.md CHANGED
@@ -42,11 +42,11 @@ end_at = Time.zone.parse("2018-10-07 09:00:00")
42
42
  Syobocalite.search(start_at: start_at, end_at: end_at)
43
43
  ```
44
44
 
45
- `Syobocalite.search` returns `Array` of [`Syobocalite::Program`](lib/syobocalite/program.rb)
45
+ `Syobocalite.search` returns `Array` of [Syobocalite::Program](lib/syobocalite/program.rb)
46
46
 
47
47
  ## vs. [syobocal](https://github.com/xmisao/syobocal)
48
48
  * Supports only `http://cal.syoboi.jp/cal_chk.php`
49
- * Supports `Time` and [`ActiveSupport::TimeWithZone`](https://api.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html)
49
+ * Supports `Time` and [ActiveSupport::TimeWithZone](https://api.rubyonrails.org/classes/ActiveSupport/TimeWithZone.html)
50
50
  * Returns array of PORO (NOT array of `Hash`)
51
51
 
52
52
  ## Development
@@ -0,0 +1,27 @@
1
+ module Syobocalite
2
+ # API client for https://cal.syoboi.jp/db.php
3
+ # @see https://docs.cal.syoboi.jp/spec/db.php/
4
+ class DbClient
5
+ # Get program's flag
6
+ # @param tid [Integer]
7
+ # @param pid [Integer]
8
+ # @return [Integer]
9
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
10
+ def get_program_flag(tid:, pid:)
11
+ params = {
12
+ "Command" => "ProgLookup",
13
+ "Fields" => "Flag",
14
+ "TID" => tid,
15
+ "PID" => pid,
16
+ }
17
+
18
+ headers = {
19
+ "User-Agent" => Syobocalite.user_agent,
20
+ }
21
+
22
+ xml = URI.open("https://cal.syoboi.jp/db.php?#{params.to_param}", headers).read
23
+ response = MultiXml.parse(xml)
24
+ response["ProgLookupResponse"]["ProgItems"]["ProgItem"]["Flag"].to_i
25
+ end
26
+ end
27
+ end
@@ -73,6 +73,41 @@ module Syobocalite
73
73
  alias_method :story_number, :count
74
74
  alias_method :story_number=, :count=
75
75
 
76
+ # Get program's flag
77
+ # @return [Integer]
78
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
79
+ def flag
80
+ @flag ||= Syobocalite::DbClient.new.get_program_flag(tid: tid, pid: pid)
81
+ end
82
+
83
+ # Whether contains remark
84
+ # @return [Boolean]
85
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
86
+ def remark?
87
+ flag & 0x01 != 0
88
+ end
89
+
90
+ # Whether new program
91
+ # @return [Boolean]
92
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
93
+ def new?
94
+ flag & 0x02 != 0
95
+ end
96
+
97
+ # Whether final program
98
+ # @return [Boolean]
99
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
100
+ def final?
101
+ flag & 0x04 != 0
102
+ end
103
+
104
+ # Whether re-air program
105
+ # @return [Boolean]
106
+ # @see https://docs.cal.syoboi.jp/spec/proginfo-flag/
107
+ def re_air?
108
+ flag & 0x08 != 0
109
+ end
110
+
76
111
  # @param attrs [Hash]
77
112
  #
78
113
  # @return [Syobocalite::Program]
@@ -1,3 +1,3 @@
1
1
  module Syobocalite
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/syobocalite.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "syobocalite/version"
2
2
  require "syobocalite/program"
3
+ require "syobocalite/db_client"
3
4
  require "active_support/all"
4
5
  require "multi_xml"
5
6
  require "open-uri"
@@ -12,7 +13,7 @@ module Syobocalite
12
13
  #
13
14
  # @return [Array<Program>]
14
15
  #
15
- # @see https://sites.google.com/site/syobocal/spec/cal_chk-php
16
+ # @see https://docs.cal.syoboi.jp/spec/cal_chk.php/
16
17
  def self.search(start_at:, end_at:)
17
18
  xml = fetch(start_at: start_at, end_at: end_at)
18
19
  response = MultiXml.parse(xml)
@@ -25,6 +26,11 @@ module Syobocalite
25
26
  end
26
27
  end
27
28
 
29
+ # @return [String]
30
+ def self.user_agent
31
+ "Syobocalite v#{Syobocalite::VERSION}"
32
+ end
33
+
28
34
  def self.fetch(start_at:, end_at:)
29
35
  params = {}
30
36
 
@@ -38,7 +44,7 @@ module Syobocalite
38
44
  end
39
45
 
40
46
  headers = {
41
- "User-Agent" => "Syobocalite v#{Syobocalite::VERSION}",
47
+ "User-Agent" => user_agent,
42
48
  }
43
49
 
44
50
  URI.open("http://cal.syoboi.jp/cal_chk.php?#{params.to_param}", headers).read
data/syobocalite.gemspec CHANGED
@@ -16,14 +16,11 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.required_ruby_version = ">= 2.3.0"
18
18
 
19
- if spec.respond_to?(:metadata)
20
- spec.metadata["homepage_uri"] = spec.homepage
21
- spec.metadata["source_code_uri"] = spec.homepage
22
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
23
- else
24
- raise "RubyGems 2.0 or newer is required to protect against " \
25
- "public gem pushes."
26
- end
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = spec.homepage
21
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
22
+ spec.metadata["documentation_uri"] = "https://sue445.github.io/syobocalite/"
23
+ spec.metadata["rubygems_mfa_required"] = "true"
27
24
 
28
25
  # Specify which files should be added to the gem when it is released.
29
26
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -40,9 +37,9 @@ Gem::Specification.new do |spec|
40
37
  spec.add_dependency "multi_xml"
41
38
 
42
39
  spec.add_development_dependency "bundler", ">= 1.16"
43
- spec.add_development_dependency "coveralls"
40
+ spec.add_development_dependency "coveralls_reborn"
44
41
  spec.add_development_dependency "pry-byebug"
45
- spec.add_development_dependency "rake", "~> 10.0"
42
+ spec.add_development_dependency "rake", ">= 10.0"
46
43
  spec.add_development_dependency "rspec", "~> 3.0"
47
44
  spec.add_development_dependency "rspec-its"
48
45
  spec.add_development_dependency "webmock"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syobocalite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-02 00:00:00.000000000 Z
11
+ date: 2024-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.16'
55
55
  - !ruby/object:Gem::Dependency
56
- name: coveralls
56
+ name: coveralls_reborn
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -84,14 +84,14 @@ dependencies:
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '10.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '10.0'
97
97
  - !ruby/object:Gem::Dependency
@@ -158,6 +158,8 @@ extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
160
  - ".coveralls.yml"
161
+ - ".github/dependabot.yml"
162
+ - ".github/workflows/pages.yml"
161
163
  - ".github/workflows/test.yml"
162
164
  - ".gitignore"
163
165
  - ".rspec"
@@ -170,6 +172,7 @@ files:
170
172
  - bin/console
171
173
  - bin/setup
172
174
  - lib/syobocalite.rb
175
+ - lib/syobocalite/db_client.rb
173
176
  - lib/syobocalite/program.rb
174
177
  - lib/syobocalite/version.rb
175
178
  - syobocalite.gemspec
@@ -180,7 +183,9 @@ metadata:
180
183
  homepage_uri: https://github.com/sue445/syobocalite
181
184
  source_code_uri: https://github.com/sue445/syobocalite
182
185
  changelog_uri: https://github.com/sue445/syobocalite/blob/master/CHANGELOG.md
183
- post_install_message:
186
+ documentation_uri: https://sue445.github.io/syobocalite/
187
+ rubygems_mfa_required: 'true'
188
+ post_install_message:
184
189
  rdoc_options: []
185
190
  require_paths:
186
191
  - lib
@@ -195,8 +200,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
200
  - !ruby/object:Gem::Version
196
201
  version: '0'
197
202
  requirements: []
198
- rubygems_version: 3.1.2
199
- signing_key:
203
+ rubygems_version: 3.5.3
204
+ signing_key:
200
205
  specification_version: 4
201
206
  summary: Lite client for Syoboi calendar
202
207
  test_files: []