dekiru 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +7 -0
- data/.github/workflows/rspec.yml +2 -2
- data/.ruby-version +1 -1
- data/README.md +19 -0
- data/dekiru.gemspec +2 -3
- data/lib/dekiru/data_migration_operator.rb +9 -4
- data/lib/dekiru/version.rb +1 -1
- data/lib/dekiru.rb +2 -1
- data/lib/generators/maintenance_script/maintenance_script_generator.rb +2 -1
- metadata +10 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afd167e9d998eb5aa11c66c794a6d7c4c7852d8c000fea2832cff7d1a3b2ba21
|
4
|
+
data.tar.gz: b91f62debd887e6995fcd11500b3e56f0ae625b7d241b4ed70554b7be5d0b0d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b303856ea984d22f835a31fe670556697e76da4a7741183713afbe8453b80a8ed7d63740e3126d74bae38e2fd6ae48e93d86096af358fc0f33d226908055a9f
|
7
|
+
data.tar.gz: e32c040b3d0cc23034a1992ac732980886489b3610b641c4d58782c3091ffc90e08e5bfffe51802326983a207bff2c802b052f0fb84391442065ccf209c56a01
|
data/.github/workflows/rspec.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
3.2.2
|
data/README.md
CHANGED
@@ -182,6 +182,25 @@ Deliverd Mailers!!
|
|
182
182
|
Are you sure to commit? (yes/no) > yes
|
183
183
|
```
|
184
184
|
|
185
|
+
ジェネレータを使って `Dekiru::DataMigrationOperator` を使ったメンテナンススクリプトを生成することができます。ファイル名にはスクリプトファイルを生成した日付が prefix として付与されます。
|
186
|
+
|
187
|
+
```
|
188
|
+
$ bin/rails g maintenance_script demo_migration
|
189
|
+
$ cat scripts/20230118_demo_migration.rb
|
190
|
+
Dekiru::DataMigrationOperator.execute('demo_migration') do
|
191
|
+
# write here
|
192
|
+
end
|
193
|
+
```
|
194
|
+
|
195
|
+
ファイルの出力先ディレクトリは、デフォルトではアプリケーションルート直下の `scripts` ディレクトリです。設定で出力先ディレクトリを変更することもできます。
|
196
|
+
|
197
|
+
```ruby
|
198
|
+
# config/initializer/dekiru.rb
|
199
|
+
Dekiru.configure do |config|
|
200
|
+
config.maintenance_script_directory = 'scripts/maintenance'
|
201
|
+
end
|
202
|
+
```
|
203
|
+
|
185
204
|
## Refinements
|
186
205
|
|
187
206
|
### Dekiru::CamelizeHash
|
data/dekiru.gemspec
CHANGED
@@ -19,10 +19,9 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
gem.version = Dekiru::VERSION
|
21
21
|
|
22
|
-
gem.required_ruby_version = '>=
|
22
|
+
gem.required_ruby_version = '>= 3.0.0'
|
23
23
|
|
24
|
-
gem.add_dependency '
|
25
|
-
gem.add_dependency 'rails', '>= 6.0'
|
24
|
+
gem.add_dependency 'rails', '>= 6.1'
|
26
25
|
gem.add_dependency 'ruby-progressbar'
|
27
26
|
gem.add_development_dependency 'rake'
|
28
27
|
gem.add_development_dependency 'rspec'
|
@@ -61,12 +61,12 @@ module Dekiru
|
|
61
61
|
total: total || target_scope.count,
|
62
62
|
output: stream
|
63
63
|
)
|
64
|
-
pb = ::ProgressBar.create(opt)
|
64
|
+
@pb = ::ProgressBar.create(opt)
|
65
65
|
target_scope.find_each do |target|
|
66
66
|
yield target
|
67
|
-
pb.increment
|
67
|
+
@pb.increment
|
68
68
|
end
|
69
|
-
pb.finish
|
69
|
+
@pb.finish
|
70
70
|
end
|
71
71
|
|
72
72
|
private
|
@@ -76,7 +76,12 @@ module Dekiru
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def log(message)
|
79
|
-
|
79
|
+
if @pb && !@pb.finished?
|
80
|
+
@pb.log(message)
|
81
|
+
else
|
82
|
+
stream.puts(message)
|
83
|
+
end
|
84
|
+
|
80
85
|
logger&.info(message.squish)
|
81
86
|
end
|
82
87
|
|
data/lib/dekiru/version.rb
CHANGED
data/lib/dekiru.rb
CHANGED
@@ -21,10 +21,11 @@ module Dekiru
|
|
21
21
|
end
|
22
22
|
|
23
23
|
class Configuration
|
24
|
-
attr_accessor :mail_security_hook
|
24
|
+
attr_accessor :mail_security_hook, :maintenance_script_directory
|
25
25
|
|
26
26
|
def initialize
|
27
27
|
@mail_security_hook = false # default
|
28
|
+
@maintenance_script_directory = 'scripts'
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|
@@ -4,7 +4,8 @@ class MaintenanceScriptGenerator < Rails::Generators::NamedBase
|
|
4
4
|
source_root File.expand_path('templates', __dir__)
|
5
5
|
|
6
6
|
def copy_maintenance_script_file
|
7
|
-
template 'maintenance_script.rb.erb',
|
7
|
+
template 'maintenance_script.rb.erb',
|
8
|
+
"#{Dekiru.configuration.maintenance_script_directory}/#{filename_date}_#{file_name}.rb"
|
8
9
|
end
|
9
10
|
|
10
11
|
private
|
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dekiru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
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: 2023-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: http_accept_language
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rails
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '6.
|
19
|
+
version: '6.1'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - ">="
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '6.
|
26
|
+
version: '6.1'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: ruby-progressbar
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -129,6 +115,7 @@ executables: []
|
|
129
115
|
extensions: []
|
130
116
|
extra_rdoc_files: []
|
131
117
|
files:
|
118
|
+
- ".github/dependabot.yml"
|
132
119
|
- ".github/labels.yml"
|
133
120
|
- ".github/release.yml"
|
134
121
|
- ".github/workflows/github-label-sync.yml"
|
@@ -170,7 +157,7 @@ metadata:
|
|
170
157
|
homepage_uri: https://github.com/SonicGarden/dekiru
|
171
158
|
source_code_uri: https://github.com/SonicGarden/dekiru
|
172
159
|
changelog_uri: https://github.com/SonicGarden/dekiru/releases
|
173
|
-
post_install_message:
|
160
|
+
post_install_message:
|
174
161
|
rdoc_options: []
|
175
162
|
require_paths:
|
176
163
|
- lib
|
@@ -178,15 +165,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
165
|
requirements:
|
179
166
|
- - ">="
|
180
167
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
168
|
+
version: 3.0.0
|
182
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
170
|
requirements:
|
184
171
|
- - ">="
|
185
172
|
- !ruby/object:Gem::Version
|
186
173
|
version: '0'
|
187
174
|
requirements: []
|
188
|
-
rubygems_version: 3.
|
189
|
-
signing_key:
|
175
|
+
rubygems_version: 3.4.10
|
176
|
+
signing_key:
|
190
177
|
specification_version: 4
|
191
178
|
summary: Usefull helper methods for Ruby on Rails
|
192
179
|
test_files:
|