ttsttb 0.2.0 → 0.2.1

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: b74f82a57cd4e66dd567b8e08fcb912f1e15adef10ecb5425c4cc97a1b81c876
4
- data.tar.gz: 43025df61b33fa229fd2916f4048136b2335821d71cdf26334e6f20be4c13b4f
3
+ metadata.gz: c47b3a5446b1d79df9a55e7e520350d366148e3cd36b3ea42e685d183cb58495
4
+ data.tar.gz: 76c882d413f2c462d25b9343fd16b1d16c7b557ec79e911c9871cc2211a2d928
5
5
  SHA512:
6
- metadata.gz: 8760c59576186caebb3367992a0b6bdcb5a1db97fe7315fc62660acaa735ada4afa1cdd4464f457c7047c89855e7127ca2ce1063512e982de09a74cc6bf9fcde
7
- data.tar.gz: 7e011078efe0470234eb0e90330129e2ae2d71c3459ea89429611ec7a96279d9169812c23101993f5fc4cc0ab4462f3daf23b3829b1a644b268245418f217db0
6
+ metadata.gz: eb5f9e8afb24ab090fce465538d6049efcc7ec2855d461deaf2b2362a30da389713f5ec156b86a999220f21e706b0e44e2e49455b6675f0db8cd9890578ccb8e
7
+ data.tar.gz: 30adf01d45c97ade98b24d5130a5460d8d1182a6e4457c3dcb65a8996695d8ac9dd9f3667eedaa25027396406cfeced5248a0b6fe5a2ef9a0790d1571f38ba52
@@ -35,3 +35,9 @@ jobs:
35
35
  run: bundle exec rubocop
36
36
  - name: Run tests
37
37
  run: bundle exec rspec
38
+ - name: Archive code coverage results
39
+ uses: actions/upload-artifact@v2
40
+ with:
41
+ name: code-coverage-report
42
+ path: coverage/
43
+
data/.rubocop.yml CHANGED
@@ -25,3 +25,8 @@ Layout/LineLength:
25
25
  # Configuration parameters: CountComments.
26
26
  Metrics/MethodLength:
27
27
  Max: 20
28
+
29
+ Metrics/BlockLength:
30
+ Exclude:
31
+ - 'spec/lib/**/*'
32
+
data/Gemfile.lock CHANGED
@@ -9,6 +9,7 @@ GEM
9
9
  specs:
10
10
  ast (2.4.2)
11
11
  diff-lcs (1.4.4)
12
+ docile (1.4.0)
12
13
  mini_portile2 (2.6.1)
13
14
  nokogiri (1.12.5)
14
15
  mini_portile2 (~> 2.6.1)
@@ -46,6 +47,12 @@ GEM
46
47
  rubocop-ast (1.12.0)
47
48
  parser (>= 3.0.1.1)
48
49
  ruby-progressbar (1.11.0)
50
+ simplecov (0.21.2)
51
+ docile (~> 1.1)
52
+ simplecov-html (~> 0.11)
53
+ simplecov_json_formatter (~> 0.1)
54
+ simplecov-html (0.12.3)
55
+ simplecov_json_formatter (0.1.3)
49
56
  unicode-display_width (2.1.0)
50
57
 
51
58
  PLATFORMS
@@ -56,6 +63,7 @@ DEPENDENCIES
56
63
  rake (~> 13.0)
57
64
  rspec
58
65
  rubocop
66
+ simplecov
59
67
  ttsttb!
60
68
 
61
69
  BUNDLED WITH
data/README.md CHANGED
@@ -231,13 +231,24 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
231
231
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
232
232
 
233
233
 
234
- ## Tests
234
+ ### Tests
235
235
 
236
236
 
237
237
  ```
238
238
  % bundle exec rspec
239
239
  ```
240
240
 
241
+ ### Publis a new version
242
+
243
+ Create a tag to be released and push to the github reopsitory. Github actions workflow proceeds ruby gem publish process.
244
+ ```
245
+ % git switch master
246
+ % vim lib/ttsttb/version.rb
247
+ % git commit lib/ttsttb/version.rb -m 'bump version'
248
+ % git tag <v0.0.0>
249
+ % git push --tags
250
+ ```
251
+
241
252
 
242
253
  ## Contributing
243
254
 
@@ -1,3 +1,3 @@
1
1
  module Ttsttb
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
data/lib/ttsttb.rb CHANGED
@@ -10,26 +10,26 @@ module Ttsttb
10
10
  # TODO
11
11
  raise 'Today is not supported yet.' if date == Date.today
12
12
 
13
- begin
14
- doc = Nokogiri::HTML(URI.open(url(date), :redirect => false).read.encode('utf-8'))
15
- scrape(doc)
16
- rescue OpenURI::HTTPRedirect
17
- raise 'Data is not found on the MUFG page corresponding to the specificate date.'
18
- end
13
+ raise 'Old data before 1990/1/1 is not provided.' if date < Date.new(1990, 1, 1)
14
+
15
+ doc = Nokogiri::HTML(html(date))
16
+ scrape(doc)
19
17
  end
20
18
 
21
- def self.url(date)
19
+ def self.html(date)
22
20
  url = format('http://www.murc-kawasesouba.jp/fx/past/index.php?id=%<ymd>s',
23
21
  { :ymd => date.strftime('%y%m%d') })
24
- URI.open(url, :redirect => false)
25
- url
22
+
23
+ URI.open(url, :redirect => false).read.encode('utf-8')
26
24
  rescue OpenURI::HTTPRedirect
27
- format('http://www.murc-kawasesouba.jp/fx/past_3month_result.php?y=%<y>s&m=%<m>s&d=%<d>s&c=',
28
- {
29
- :y => date.strftime('%Y'),
30
- :m => date.strftime('%m'),
31
- :d => date.strftime('%d')
32
- })
25
+ url = format('http://www.murc-kawasesouba.jp/fx/past_3month_result.php?y=%<y>s&m=%<m>s&d=%<d>s&c=',
26
+ {
27
+ :y => date.strftime('%Y'),
28
+ :m => date.strftime('%m'),
29
+ :d => date.strftime('%d')
30
+ })
31
+
32
+ URI.open(url, :redirect => false).read.encode('utf-8')
33
33
  end
34
34
 
35
35
  # parse document
data/ttsttb.gemspec CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "rake", "~> 13.0"
34
34
  spec.add_development_dependency "rspec"
35
35
  spec.add_development_dependency "rubocop"
36
+ spec.add_development_dependency 'simplecov'
36
37
 
37
38
  spec.add_runtime_dependency 'nokogiri'
38
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttsttb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuki Matsukura
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: nokogiri
71
85
  requirement: !ruby/object:Gem::Requirement