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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0da913353b55e77e20fe62d8053774029054e3cac7dd14ecb58cf2042bd0f95
|
4
|
+
data.tar.gz: e11b45a6d92a3e33fab980bfdf324ed3aa1396b6a43b80e9f99f4cb4804789ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de6594cac31f869510f03fd42c20df001f454a237230748ba83cabed2d9fb7065bf6504f22f6c73b63b6f0dc4007b2e56e69bee5e8dc4d90bad23dd67f816b79
|
7
|
+
data.tar.gz: c833e3e3f9fa206c9fa4ba5013dcfa604833bf927e18c72ef7f8c3963e952d3be82dbec4f17927d6a02c6dd4166e4e82957a8853ab513f21e4e0bd7c1ddcb23f
|
data/.github/workflows/rspec.yml
CHANGED
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.
|
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)
|
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)
|
data/lib/dekiru/version.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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:
|