master_data_tool 0.13.0 → 0.14.0

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: d8d4c2c62c923b5e23871ac9e4df2f91c535c36cd8c66a6cb3d3a05ca6c7275d
4
- data.tar.gz: 39c776e2196f8a080d7caac86eb4a689701f7263b7aa2d856a4061bd8893863f
3
+ metadata.gz: dd3199a48034b2f7e95d6fb3549f91710212a65e84d7f74a5985c7dbf03ed442
4
+ data.tar.gz: 5038f9809f0c7d10f467f070fc4b181a6e65da9527671af3df641f6f7d5a2be8
5
5
  SHA512:
6
- metadata.gz: 624bf1b07e720e1d062c607c9dd697d5709bbc28d19f6396510a2426a0e423b56791682d57f72b6323e36a34c3b70e22f1f1e40dfa9d687cb8dc2fd071a39116
7
- data.tar.gz: 1bc885ac91429ba21b201ccf7bc275bcba05377004ac0517aec0ec0ceedb3ead0c1bb2324fe29c435a8e06a9e50101e3e7b85636c5b700ec79b4f44528585ae0
6
+ metadata.gz: 893ba835ff02bac37c5d61768d72980d4ce0b6dd8dd252c403937429e249d3ad1a46b6081d8c258cc8cd6e78e69588517ffd95f56645bdd9c0b5fa8503fd71ac
7
+ data.tar.gz: 4b20ba6933e7137de973c1e92fadf93733717dbf5371ada340d1661cf19fab22dd0aca6fa21fc8c7ad3cd55ef9f8b060f1c4a796b765ce66577e58c53dd2d4a8
data/README.md CHANGED
@@ -68,12 +68,13 @@ bundle exec thor master_data_tool import \
68
68
 
69
69
  ### ダンプ
70
70
 
71
- | option | default | 内容 |
72
- |-----------------------|---------|---------------|
73
- | --ignore-empty-table | true | 空のテーブルを無視する |
74
- | --ignore-tables | [] | 指定したテーブルを無視する |
75
- | --ignore-column-names | [] | 指定したカラムを無視する |
76
- | --verbose | false | 詳細表示 |
71
+ | option | default | 内容 |
72
+ |-----------------------|---------|-----------------|
73
+ | --ignore-empty-table | true | 空のテーブルを無視する |
74
+ | --ignore-tables | [] | 指定したテーブルを無視する |
75
+ | --ignore-column-names | [] | 指定したカラムを無視する |
76
+ | --only-tables | nil | 指定したテーブルのみダンプする |
77
+ | --verbose | false | 詳細表示 |
77
78
 
78
79
  ```bash
79
80
  bundle exec master_data_tool dump
@@ -86,6 +87,7 @@ bundle exec master_data_tool dump \
86
87
  --ignore-empty-table=true \
87
88
  --ignore-tables="" \
88
89
  --ignore-column-names="" \
90
+ --only-tables="" \
89
91
  --verbose=false
90
92
  ```
91
93
 
data/exe/master_data_tool CHANGED
@@ -28,18 +28,21 @@ module MasterDataTool
28
28
  option :ignore_empty_table, default: true, type: :boolean
29
29
  option :ignore_tables, default: [], type: :array
30
30
  option :ignore_column_names, default: [], type: :array
31
+ option :only_tables, default: nil, type: :array
31
32
  option :verbose, default: false, type: :boolean
32
33
  desc 'dump', 'dump'
33
34
  def dump
34
35
  ignore_empty_table = options[:ignore_empty_table]
35
36
  ignore_tables = options[:ignore_tables]
36
37
  ignore_column_names = options[:ignore_column_names]
38
+ only_tables = options[:only_tables]
37
39
  verbose = options[:verbose]
38
40
 
39
41
  executor = MasterDataTool::Dump::Executor.new(
40
42
  ignore_empty_table: ignore_empty_table,
41
43
  ignore_tables: ignore_tables,
42
44
  ignore_column_names: ignore_column_names,
45
+ only_tables: only_tables,
43
46
  verbose: verbose
44
47
  )
45
48
  errors = executor.execute
@@ -8,10 +8,11 @@ module MasterDataTool
8
8
  DEFAULT_IGNORE_TABLES = %w[ar_internal_metadata schema_migrations master_data_statuses]
9
9
  DEFAULT_IGNORE_COLUMNS = %w[created_at updated_at]
10
10
 
11
- def initialize(ignore_empty_table: true, ignore_tables: [], ignore_column_names: [], verbose: false)
11
+ def initialize(ignore_empty_table: true, ignore_tables: [], ignore_column_names: [], only_tables: [], verbose: false)
12
12
  @ignore_empty_table = ignore_empty_table
13
13
  @ignore_tables = DEFAULT_IGNORE_TABLES + Array(MasterDataTool.config.dump_ignore_tables) + ignore_tables
14
14
  @ignore_column_names = DEFAULT_IGNORE_COLUMNS + Array(MasterDataTool.config.dump_ignore_columns) + ignore_column_names
15
+ @only_tables = Array(only_tables)
15
16
  end
16
17
 
17
18
  def execute
@@ -23,6 +24,11 @@ module MasterDataTool
23
24
  next
24
25
  end
25
26
 
27
+ if @only_tables.any? && !@only_tables.include?(table)
28
+ print_message "[skip] #{table}"
29
+ next
30
+ end
31
+
26
32
  dump_to_csv(table)
27
33
  rescue => e
28
34
  errors << Error.new(table, e)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MasterDataTool
4
- VERSION = "0.13.0"
4
+ VERSION = "0.14.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: master_data_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro Ooishi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-05 00:00:00.000000000 Z
11
+ date: 2022-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -205,7 +205,6 @@ files:
205
205
  - lib/master_data_tool/report/verify_report.rb
206
206
  - lib/master_data_tool/version.rb
207
207
  - log/test.log
208
- - master_data_tool.gemspec
209
208
  - scripts/setup.sh
210
209
  - sig/master_data_tool.rbs
211
210
  homepage: https://github.com/taka0125/master_data_tool
@@ -228,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
227
  - !ruby/object:Gem::Version
229
228
  version: '0'
230
229
  requirements: []
231
- rubygems_version: 3.2.22
230
+ rubygems_version: 3.0.3
232
231
  signing_key:
233
232
  specification_version: 4
234
233
  summary: マスタデータの管理ツール
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/master_data_tool/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "master_data_tool"
7
- spec.version = MasterDataTool::VERSION
8
- spec.authors = ["Takahiro Ooishi"]
9
- spec.email = ["taka0125@gmail.com"]
10
-
11
- spec.summary = "マスタデータの管理ツール"
12
- spec.description = "システムが稼働する上で最初から必要なデータ(マスタデータ)を管理するツールです。"
13
- spec.homepage = "https://github.com/taka0125/master_data_tool"
14
- spec.required_ruby_version = ">= 2.6.0"
15
-
16
- spec.metadata["homepage_uri"] = spec.homepage
17
- spec.metadata["source_code_uri"] = spec.homepage
18
-
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
22
- `git ls-files -z`.split("\x0").reject do |f|
23
- (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
24
- end
25
- end
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
29
-
30
- spec.add_development_dependency 'rspec'
31
- spec.add_development_dependency 'mysql2'
32
- spec.add_development_dependency 'psych', '~> 3.1'
33
- spec.add_development_dependency 'appraisal'
34
- spec.add_development_dependency 'ridgepole'
35
- spec.add_development_dependency 'database_cleaner-active_record'
36
- spec.add_development_dependency 'standalone_activerecord_boot_loader'
37
-
38
- spec.add_dependency 'activerecord', '>= 5.1.7'
39
- spec.add_dependency 'activesupport'
40
- spec.add_dependency 'thor'
41
- spec.add_dependency 'activerecord-import'
42
- end