dekiru 0.2.1 → 0.3.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: fcd978fde22a3be50e588396b36e5956217c4614b955a1ab45c017425861662c
4
- data.tar.gz: 2e302850fe5fb912bc02e7d1114dae4e7b904094d21fca641ec26e1d1dc84ee5
3
+ metadata.gz: a0da913353b55e77e20fe62d8053774029054e3cac7dd14ecb58cf2042bd0f95
4
+ data.tar.gz: e11b45a6d92a3e33fab980bfdf324ed3aa1396b6a43b80e9f99f4cb4804789ad
5
5
  SHA512:
6
- metadata.gz: 4a7749d34c73ca1ce3463f78de7d7b50c86b0ce4c508061e2c522ccba9e6501ec46ee318909619b171f386e630b5701dd43d291b5fd07e6e62824423231d348e
7
- data.tar.gz: 2206deba2fa7e617f5c1ddb3d386574270edab4551679e2eb978dfa67e76547e3a42aea0dccce1ddfe626645b4207b966c323c73af79fe116f96ef8ccfcddcbd
6
+ metadata.gz: de6594cac31f869510f03fd42c20df001f454a237230748ba83cabed2d9fb7065bf6504f22f6c73b63b6f0dc4007b2e56e69bee5e8dc4d90bad23dd67f816b79
7
+ data.tar.gz: c833e3e3f9fa206c9fa4ba5013dcfa604833bf927e18c72ef7f8c3963e952d3be82dbec4f17927d6a02c6dd4166e4e82957a8853ab513f21e4e0bd7c1ddcb23f
@@ -14,7 +14,7 @@ jobs:
14
14
  strategy:
15
15
  fail-fast: false
16
16
  matrix:
17
- ruby: ["2.6", "2.7", "3.0"]
17
+ ruby: ["2.7", "3.0", "3.1"]
18
18
  steps:
19
19
  - uses: actions/checkout@v2
20
20
 
data/dekiru.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Dekiru::VERSION
17
17
 
18
- gem.required_ruby_version = '>= 2.4.0'
18
+ gem.required_ruby_version = '>= 2.7.0'
19
19
 
20
20
  gem.add_dependency 'http_accept_language', [">= 2.0.0"]
21
21
  gem.add_dependency 'rails'
@@ -3,7 +3,11 @@ module Dekiru
3
3
  module Matchers
4
4
  class JsNoErrorMatcher
5
5
  def matches?(page_or_logs)
6
- logs = page_or_logs.respond_to?(:driver) ? page_or_logs.driver.browser.manage.logs.get(:browser) : page_or_logs
6
+ logs = if page_or_logs.respond_to?(:driver)
7
+ page_or_logs.driver.browser.logs.get(:browser)
8
+ else
9
+ page_or_logs
10
+ end
7
11
  logs.find_all { |log| log.level == 'WARNING' }.each do |log|
8
12
  STDERR.puts 'WARN: javascript warning'
9
13
  STDERR.puts log.message
@@ -48,10 +48,11 @@ module Dekiru
48
48
  end
49
49
 
50
50
  def find_each_with_progress(target_scope, options = {})
51
+ total = options.delete(:total)
51
52
  opt = {
52
53
  format: '%a |%b>>%i| %p%% %t',
53
54
  }.merge(options).merge(
54
- total: target_scope.count,
55
+ total: total || target_scope.count,
55
56
  output: stream
56
57
  )
57
58
  pb = ::ProgressBar.create(opt)
@@ -1,3 +1,3 @@
1
1
  module Dekiru
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -127,5 +127,36 @@ describe Dekiru::DataMigrationOperator do
127
127
  expect(operator.stream.out).to include('Finished successfully:')
128
128
  expect(operator.stream.out).to include('Total time:')
129
129
  end
130
+
131
+ it 'total をオプションで渡すことができる' do
132
+ class Dekiru::DummyRecord
133
+ def self.count
134
+ raise "won't call"
135
+ end
136
+
137
+ def self.find_each
138
+ yield 99
139
+ end
140
+ end
141
+
142
+ allow(STDIN).to receive(:gets) do
143
+ "yes\n"
144
+ end
145
+
146
+ sum = 0
147
+ operator.execute do
148
+ find_each_with_progress(Dekiru::DummyRecord, title: 'pass total as option', total: 1) do |num|
149
+ sum += num
150
+ end
151
+ end
152
+
153
+ expect(sum).to eq(99)
154
+ expect(operator.result).to eq(true)
155
+ expect(operator.error).to eq(nil)
156
+ expect(operator.stream.out).to include('Are you sure to commit?')
157
+ expect(operator.stream.out).to include('pass total as option:')
158
+ expect(operator.stream.out).to include('Finished successfully:')
159
+ expect(operator.stream.out).to include('Total time:')
160
+ end
130
161
  end
131
162
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dekiru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akihiro Matsumura
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-02 00:00:00.000000000 Z
11
+ date: 2022-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http_accept_language
@@ -168,7 +168,7 @@ files:
168
168
  homepage: ''
169
169
  licenses: []
170
170
  metadata: {}
171
- post_install_message:
171
+ post_install_message:
172
172
  rdoc_options: []
173
173
  require_paths:
174
174
  - lib
@@ -176,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - ">="
178
178
  - !ruby/object:Gem::Version
179
- version: 2.4.0
179
+ version: 2.7.0
180
180
  required_rubygems_version: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - ">="
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubygems_version: 3.1.2
187
- signing_key:
187
+ signing_key:
188
188
  specification_version: 4
189
189
  summary: Usefull helper methods for Ruby on Rails
190
190
  test_files: