syobocalite 1.0.1 → 1.1.1
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 +4 -4
- data/.github/dependabot.yml +10 -0
- data/.github/workflows/pages.yml +59 -0
- data/.github/workflows/test.yml +22 -48
- data/CHANGELOG.md +17 -1
- data/README.md +3 -3
- data/lib/syobocalite/db_client.rb +27 -0
- data/lib/syobocalite/program.rb +35 -0
- data/lib/syobocalite/version.rb +1 -1
- data/lib/syobocalite.rb +9 -3
- data/syobocalite.gemspec +8 -14
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e14368c8d79563c025d22156ebc584146d777810db0704ccbd617c9fd1801a6
|
4
|
+
data.tar.gz: 1dc682265e40f9951cf60d84c21631b5afe2b5a6f4d933e57c1b5e1dd81dc023
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e54fd15d7c8e2eb5551bebdf0cab87064243285195f81febc8138920ed1c3095146c5717575696cd85345189f81b98e19692a0556dff96c803dbd0ae3ef0655
|
7
|
+
data.tar.gz: 50065a209b3d9f788fc05a09a61e04b49c60fa7137f1cf726c977157fcf9b718876f1dae956dfd94409e8470c27c82ae4dc38f2ad13fd6ed85b303067ae05cb6
|
@@ -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 }}
|
data/.github/workflows/test.yml
CHANGED
@@ -12,82 +12,59 @@ on:
|
|
12
12
|
schedule:
|
13
13
|
- cron: "0 10 * * 5" # JST 19:00 (Fri)
|
14
14
|
|
15
|
-
env:
|
16
|
-
CI: "true"
|
17
|
-
|
18
15
|
jobs:
|
19
16
|
test:
|
20
17
|
runs-on: ubuntu-latest
|
21
18
|
|
22
|
-
container: ${{ matrix.ruby }}
|
23
|
-
|
24
19
|
strategy:
|
25
20
|
fail-fast: false
|
26
21
|
|
27
22
|
matrix:
|
28
23
|
ruby:
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
|
35
|
-
-
|
36
|
-
allow_failures: "true"
|
24
|
+
- "2.5"
|
25
|
+
- "2.6"
|
26
|
+
- "2.7"
|
27
|
+
- "3.0"
|
28
|
+
- "3.1"
|
29
|
+
- "3.2"
|
30
|
+
- "3.3"
|
37
31
|
|
38
32
|
steps:
|
39
|
-
- uses: actions/checkout@
|
33
|
+
- uses: actions/checkout@v4
|
40
34
|
|
41
|
-
|
42
|
-
- name: Cache vendor/bundle
|
43
|
-
uses: actions/cache@v1
|
44
|
-
id: cache_gem
|
35
|
+
- uses: ruby/setup-ruby@v1
|
45
36
|
with:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
v1-gem-${{ runner.os }}-${{ matrix.ruby }}-
|
50
|
-
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
37
|
+
ruby-version: ${{ matrix.ruby }}
|
38
|
+
bundler-cache: true
|
39
|
+
cache-version: ${{ matrix.gemfile }}
|
51
40
|
|
52
|
-
-
|
53
|
-
run: |
|
54
|
-
set -xe
|
55
|
-
bundle config path vendor/bundle
|
56
|
-
bundle update --jobs $(nproc) --retry 3
|
57
|
-
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
41
|
+
- run: bundle update --jobs $(nproc) --retry 3
|
58
42
|
|
59
43
|
- name: Setup Code Climate Test Reporter
|
60
44
|
uses: aktions/codeclimate-test-reporter@v1
|
61
45
|
with:
|
62
46
|
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
63
47
|
command: before-build
|
64
|
-
if: matrix.ruby >= 'ruby:2.4'
|
65
48
|
continue-on-error: true
|
66
49
|
|
67
|
-
-
|
68
|
-
run: |
|
69
|
-
set -xe
|
70
|
-
bundle exec rspec
|
71
|
-
continue-on-error: ${{ matrix.allow_failures == 'true' }}
|
50
|
+
- run: bundle exec rspec
|
72
51
|
|
73
52
|
- name: Teardown Code Climate Test Reporter
|
74
53
|
uses: aktions/codeclimate-test-reporter@v1
|
75
54
|
with:
|
76
55
|
codeclimate-test-reporter-id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
77
56
|
command: after-build
|
78
|
-
if:
|
57
|
+
if: always()
|
79
58
|
continue-on-error: true
|
80
59
|
|
81
60
|
- name: Slack Notification (not success)
|
82
|
-
uses:
|
61
|
+
uses: act10ns/slack@v2
|
83
62
|
if: "! success()"
|
84
63
|
continue-on-error: true
|
85
64
|
with:
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
url: ${{ secrets.SLACK_WEBHOOK }}
|
90
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
65
|
+
status: ${{ job.status }}
|
66
|
+
webhook-url: ${{ secrets.SLACK_WEBHOOK }}
|
67
|
+
matrix: ${{ toJson(matrix) }}
|
91
68
|
|
92
69
|
notify:
|
93
70
|
needs:
|
@@ -97,12 +74,9 @@ jobs:
|
|
97
74
|
|
98
75
|
steps:
|
99
76
|
- name: Slack Notification (success)
|
100
|
-
uses:
|
77
|
+
uses: act10ns/slack@v2
|
101
78
|
if: always()
|
102
79
|
continue-on-error: true
|
103
80
|
with:
|
104
|
-
|
105
|
-
|
106
|
-
icon_emoji: ":octocat:"
|
107
|
-
url: ${{ secrets.SLACK_WEBHOOK }}
|
108
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
81
|
+
status: ${{ job.status }}
|
82
|
+
webhook-url: ${{ secrets.SLACK_WEBHOOK }}
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
## master
|
2
|
-
[full changelog](https://github.com/sue445/syobocalite/compare/v1.
|
2
|
+
[full changelog](https://github.com/sue445/syobocalite/compare/v1.1.1...master)
|
3
|
+
|
4
|
+
## 1.1.1
|
5
|
+
[full changelog](https://github.com/sue445/syobocalite/compare/v1.1.0...v1.1.1)
|
6
|
+
|
7
|
+
* Remove duplicated `required_ruby_version`
|
8
|
+
* https://github.com/sue445/syobocalite/pull/42
|
9
|
+
* Use https://cal.syoboi.jp instead of http://cal.syoboi.jp
|
10
|
+
* https://github.com/sue445/syobocalite/pull/43
|
11
|
+
* Tweak User-Agent format
|
12
|
+
* https://github.com/sue445/syobocalite/pull/44
|
13
|
+
|
14
|
+
## 1.1.0
|
15
|
+
[full changelog](https://github.com/sue445/syobocalite/compare/v1.0.1...v1.1.0)
|
16
|
+
|
17
|
+
* Add `#flag`,`#remark?`, `#new?`, `#final?` and `#re_air?` to `Syobocalite::Program`
|
18
|
+
* https://github.com/sue445/syobocalite/pull/41
|
3
19
|
|
4
20
|
## 1.0.1
|
5
21
|
[full changelog](https://github.com/sue445/syobocalite/compare/v1.0.0...v1.0.1)
|
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 [
|
45
|
+
`Syobocalite.search` returns `Array` of [Syobocalite::Program](lib/syobocalite/program.rb)
|
46
46
|
|
47
47
|
## vs. [syobocal](https://github.com/xmisao/syobocal)
|
48
|
-
* Supports only `
|
49
|
-
* Supports `Time` and [
|
48
|
+
* Supports only `https://cal.syoboi.jp/cal_chk.php`
|
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
|
data/lib/syobocalite/program.rb
CHANGED
@@ -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]
|
data/lib/syobocalite/version.rb
CHANGED
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://
|
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} (+https://github.com/sue445/syobocalite)"
|
32
|
+
end
|
33
|
+
|
28
34
|
def self.fetch(start_at:, end_at:)
|
29
35
|
params = {}
|
30
36
|
|
@@ -38,10 +44,10 @@ module Syobocalite
|
|
38
44
|
end
|
39
45
|
|
40
46
|
headers = {
|
41
|
-
"User-Agent" =>
|
47
|
+
"User-Agent" => user_agent,
|
42
48
|
}
|
43
49
|
|
44
|
-
URI.open("
|
50
|
+
URI.open("https://cal.syoboi.jp/cal_chk.php?#{params.to_param}", headers).read
|
45
51
|
end
|
46
52
|
private_class_method :fetch
|
47
53
|
end
|
data/syobocalite.gemspec
CHANGED
@@ -14,17 +14,13 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/sue445/syobocalite"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.required_ruby_version = ">= 2.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
else
|
25
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
|
-
"public gem pushes."
|
27
|
-
end
|
17
|
+
spec.required_ruby_version = ">= 2.5.0"
|
18
|
+
|
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"
|
28
24
|
|
29
25
|
# Specify which files should be added to the gem when it is released.
|
30
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -35,13 +31,11 @@ Gem::Specification.new do |spec|
|
|
35
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
32
|
spec.require_paths = ["lib"]
|
37
33
|
|
38
|
-
spec.required_ruby_version = ">= 2.5.0"
|
39
|
-
|
40
34
|
spec.add_dependency "activesupport"
|
41
35
|
spec.add_dependency "multi_xml"
|
42
36
|
|
43
37
|
spec.add_development_dependency "bundler", ">= 1.16"
|
44
|
-
spec.add_development_dependency "
|
38
|
+
spec.add_development_dependency "coveralls_reborn"
|
45
39
|
spec.add_development_dependency "pry-byebug"
|
46
40
|
spec.add_development_dependency "rake", ">= 10.0"
|
47
41
|
spec.add_development_dependency "rspec", "~> 3.0"
|
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.
|
4
|
+
version: 1.1.1
|
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: 2024-05-03 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:
|
56
|
+
name: coveralls_reborn
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -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,6 +183,7 @@ 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
|
186
|
+
documentation_uri: https://sue445.github.io/syobocalite/
|
183
187
|
rubygems_mfa_required: 'true'
|
184
188
|
post_install_message:
|
185
189
|
rdoc_options: []
|
@@ -196,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
200
|
- !ruby/object:Gem::Version
|
197
201
|
version: '0'
|
198
202
|
requirements: []
|
199
|
-
rubygems_version: 3.
|
203
|
+
rubygems_version: 3.5.3
|
200
204
|
signing_key:
|
201
205
|
specification_version: 4
|
202
206
|
summary: Lite client for Syoboi calendar
|