dekiru 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/labels.yml +18 -0
- data/.github/release.yml +23 -0
- data/.github/workflows/github-label-sync.yml +16 -0
- data/lib/dekiru/data_migration_operator.rb +9 -1
- data/lib/dekiru/version.rb +1 -1
- data/spec/dekiru/data_migration_operator_spec.rb +13 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 883e443347e743adfd76dd7c0a7932d04227241c542bd69bd4c99db26dd41b56
|
4
|
+
data.tar.gz: b841f7ceda476d786b00453a95747d9049d72c94e477d0666780bac57ec0e696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86df3c5e61c8bf2a34aaf0fe2c27dc1aeae509ba39aea50559fd7ab7685878fd610b3d45b4a9b2c443c5039703450b87d9da6787c3ad21fa77a9cf81a621118f
|
7
|
+
data.tar.gz: 31d047b646605752a5e9b7025e2275d7163d5b846d824a358aa2e9edf332e7f777d2b306abd821d8f933fbb6fc4dfef2e7648fc6cc256258362b7ddee1051ee6
|
data/.github/labels.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
- name: add
|
2
|
+
description: Add new features.
|
3
|
+
color: "0e8a16"
|
4
|
+
- name: change
|
5
|
+
description: Change existing functionality.
|
6
|
+
color: "fbca04"
|
7
|
+
- name: deprecate
|
8
|
+
description: Mark as soon-to-be removed features.
|
9
|
+
color: "d93f0b"
|
10
|
+
- name: remove
|
11
|
+
description: Remove features.
|
12
|
+
color: "b60205"
|
13
|
+
- name: fix
|
14
|
+
description: Fix bug.
|
15
|
+
color: "5319e7"
|
16
|
+
- name: security
|
17
|
+
description: In case of vulnerabilities.
|
18
|
+
color: "0052cc"
|
data/.github/release.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
changelog:
|
2
|
+
categories:
|
3
|
+
- title: Added
|
4
|
+
labels:
|
5
|
+
- add
|
6
|
+
- title: Changed
|
7
|
+
labels:
|
8
|
+
- change
|
9
|
+
- title: Deprecated
|
10
|
+
labels:
|
11
|
+
- deprecate
|
12
|
+
- title: Fixed
|
13
|
+
labels:
|
14
|
+
- fix
|
15
|
+
- title: Removed
|
16
|
+
labels:
|
17
|
+
- remove
|
18
|
+
- title: Security
|
19
|
+
labels:
|
20
|
+
- security
|
21
|
+
- title: Others
|
22
|
+
labels:
|
23
|
+
- "*"
|
@@ -0,0 +1,16 @@
|
|
1
|
+
name: github-label-sync
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
paths:
|
8
|
+
- .github/labels.yml
|
9
|
+
- .github/workflows/github-label-sync.yml
|
10
|
+
workflow_dispatch:
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
build:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: r7kamura/github-label-sync-action@v0
|
@@ -2,6 +2,8 @@ require 'ruby-progressbar'
|
|
2
2
|
|
3
3
|
module Dekiru
|
4
4
|
class DataMigrationOperator
|
5
|
+
class NestedTransactionError < StandardError ; end
|
6
|
+
|
5
7
|
attr_reader :title, :stream, :result, :canceled, :started_at, :ended_at, :error
|
6
8
|
|
7
9
|
def self.execute(title, options = {}, &block)
|
@@ -25,7 +27,9 @@ module Dekiru
|
|
25
27
|
run(&block)
|
26
28
|
@result = true
|
27
29
|
else
|
28
|
-
|
30
|
+
raise NestedTransactionError if current_transaction_open?
|
31
|
+
|
32
|
+
@result = ActiveRecord::Base.transaction do
|
29
33
|
run(&block)
|
30
34
|
confirm?("\nAre you sure to commit?")
|
31
35
|
end
|
@@ -65,6 +69,10 @@ module Dekiru
|
|
65
69
|
|
66
70
|
private
|
67
71
|
|
72
|
+
def current_transaction_open?
|
73
|
+
ActiveRecord::Base.connection.current_transaction.open?
|
74
|
+
end
|
75
|
+
|
68
76
|
def log(message)
|
69
77
|
stream.puts(message)
|
70
78
|
end
|
data/lib/dekiru/version.rb
CHANGED
@@ -27,7 +27,11 @@ describe Dekiru::DataMigrationOperator do
|
|
27
27
|
Dekiru::DummyStream.new
|
28
28
|
end
|
29
29
|
let(:without_transaction) { false }
|
30
|
-
let(:operator)
|
30
|
+
let(:operator) do
|
31
|
+
op = Dekiru::DataMigrationOperator.new('dummy', output: dummy_stream, without_transaction: without_transaction)
|
32
|
+
allow(op).to receive(:current_transaction_open?) { false }
|
33
|
+
op
|
34
|
+
end
|
31
35
|
|
32
36
|
describe '#execute' do
|
33
37
|
it 'confirm で yes' do
|
@@ -76,6 +80,14 @@ describe Dekiru::DataMigrationOperator do
|
|
76
80
|
expect(operator.stream.out).to include('Total time:')
|
77
81
|
end
|
78
82
|
|
83
|
+
context 'トランザクション内で呼び出された場合' do
|
84
|
+
before { allow(operator).to receive(:current_transaction_open?) { true } }
|
85
|
+
|
86
|
+
it '例外が発生すること' do
|
87
|
+
expect { operator.execute { log 'processing'; sleep 1.0 } }.to raise_error(Dekiru::DataMigrationOperator::NestedTransactionError)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
79
91
|
context 'without_transaction: true のとき' do
|
80
92
|
let(:without_transaction) { true }
|
81
93
|
|
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.
|
4
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2022-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http_accept_language
|
@@ -129,6 +129,9 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".github/labels.yml"
|
133
|
+
- ".github/release.yml"
|
134
|
+
- ".github/workflows/github-label-sync.yml"
|
132
135
|
- ".github/workflows/rspec.yml"
|
133
136
|
- ".gitignore"
|
134
137
|
- ".ruby-version"
|