dekiru 0.4.1 → 0.4.2

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: 883e443347e743adfd76dd7c0a7932d04227241c542bd69bd4c99db26dd41b56
4
- data.tar.gz: b841f7ceda476d786b00453a95747d9049d72c94e477d0666780bac57ec0e696
3
+ metadata.gz: c890a48f2abca1d753301d1d95b568306896da734616e4ecf18b1f65fef89126
4
+ data.tar.gz: fdddce1a0ff1db098175aa86abf02c0e1327ee2ede909364e08c14919151b0d2
5
5
  SHA512:
6
- metadata.gz: 86df3c5e61c8bf2a34aaf0fe2c27dc1aeae509ba39aea50559fd7ab7685878fd610b3d45b4a9b2c443c5039703450b87d9da6787c3ad21fa77a9cf81a621118f
7
- data.tar.gz: 31d047b646605752a5e9b7025e2275d7163d5b846d824a358aa2e9edf332e7f777d2b306abd821d8f933fbb6fc4dfef2e7648fc6cc256258362b7ddee1051ee6
6
+ metadata.gz: 76a86a4250d2633f379078535034596067d3331c23e4c4c3f55aaf38dfcb3fcabdc82c695c0829bf3b5990c86fab6095318dde10c4be86a9b2d4677ed868d52e
7
+ data.tar.gz: f7e3a2065a7c58537e070d066b40d3ef9805caa0712b53372bff8db5806a2e07c8e375ba680f9f0ca622c7fe16c4ee2c3480f5795b80e8c290ccab8232ccb3dc
data/dekiru.gemspec CHANGED
@@ -6,7 +6,11 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["matsumura.aki@gmail.com"]
7
7
  gem.description = %q{Usefull helper methods for Ruby on Rails}
8
8
  gem.summary = %q{Usefull helper methods for Ruby on Rails}
9
- gem.homepage = ""
9
+ gem.homepage = "https://github.com/SonicGarden/dekiru"
10
+
11
+ gem.metadata["homepage_uri"] = gem.homepage
12
+ gem.metadata["source_code_uri"] = "https://github.com/SonicGarden/dekiru"
13
+ gem.metadata["changelog_uri"] = "https://github.com/SonicGarden/dekiru/releases"
10
14
 
11
15
  gem.files = `git ls-files`.split($\)
12
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -4,7 +4,7 @@ module Dekiru
4
4
  class DataMigrationOperator
5
5
  class NestedTransactionError < StandardError ; end
6
6
 
7
- attr_reader :title, :stream, :result, :canceled, :started_at, :ended_at, :error
7
+ attr_reader :title, :stream, :logger, :result, :canceled, :started_at, :ended_at, :error
8
8
 
9
9
  def self.execute(title, options = {}, &block)
10
10
  self.new(title, options).execute(&block)
@@ -13,6 +13,7 @@ module Dekiru
13
13
  def initialize(title, options = {})
14
14
  @title = title
15
15
  @options = options
16
+ @logger = @options.fetch(:logger) { Logger.new(Rails.root.join("log/data_migration_#{Time.current.strftime("%Y%m%d%H%M")}.log")) }
16
17
  @stream = @options.fetch(:output, $stdout)
17
18
  @without_transaction = @options.fetch(:without_transaction, false)
18
19
  @side_effects = Hash.new do |hash, key|
@@ -31,6 +32,7 @@ module Dekiru
31
32
 
32
33
  @result = ActiveRecord::Base.transaction do
33
34
  run(&block)
35
+ log "Finished execution: #{title}"
34
36
  confirm?("\nAre you sure to commit?")
35
37
  end
36
38
  end
@@ -75,6 +77,7 @@ module Dekiru
75
77
 
76
78
  def log(message)
77
79
  stream.puts(message)
80
+ logger&.info(message.squish)
78
81
  end
79
82
 
80
83
  def confirm?(message = 'Are you sure?')
@@ -92,7 +95,7 @@ module Dekiru
92
95
  end
93
96
 
94
97
  def newline
95
- log ''
98
+ stream.puts('')
96
99
  end
97
100
 
98
101
  def cancel!
@@ -1,3 +1,3 @@
1
1
  module Dekiru
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
@@ -28,7 +28,7 @@ describe Dekiru::DataMigrationOperator do
28
28
  end
29
29
  let(:without_transaction) { false }
30
30
  let(:operator) do
31
- op = Dekiru::DataMigrationOperator.new('dummy', output: dummy_stream, without_transaction: without_transaction)
31
+ op = Dekiru::DataMigrationOperator.new('dummy', output: dummy_stream, logger: nil, without_transaction: without_transaction)
32
32
  allow(op).to receive(:current_transaction_open?) { false }
33
33
  op
34
34
  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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akihiro Matsumura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-05 00:00:00.000000000 Z
11
+ date: 2022-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http_accept_language
@@ -164,9 +164,12 @@ files:
164
164
  - spec/spec_helper.rb
165
165
  - spec/supports/action_mailer.rb
166
166
  - spec/supports/mock_active_record.rb
167
- homepage: ''
167
+ homepage: https://github.com/SonicGarden/dekiru
168
168
  licenses: []
169
- metadata: {}
169
+ metadata:
170
+ homepage_uri: https://github.com/SonicGarden/dekiru
171
+ source_code_uri: https://github.com/SonicGarden/dekiru
172
+ changelog_uri: https://github.com/SonicGarden/dekiru/releases
170
173
  post_install_message:
171
174
  rdoc_options: []
172
175
  require_paths: