arxutils_sqlite3 0.1.58 → 0.1.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -3
- data/.rubocop_todo.yml +21 -49
- data/Gemfile +20 -26
- data/Gemfile.lock +15 -7
- data/Rakefile +37 -18
- data/arxutils_sqlite3.gemspec +31 -30
- data/bin/console +3 -3
- data/bin/setup +2 -0
- data/exe/arxutils_sqlite3 +29 -28
- data/lib/arxutils_sqlite3/arx.rb +4 -2
- data/lib/arxutils_sqlite3/cli.rb +3 -1
- data/lib/arxutils_sqlite3/config.rb +29 -27
- data/lib/arxutils_sqlite3/dbutil/dbconnect.rb +7 -6
- data/lib/arxutils_sqlite3/dbutil.rb +3 -1
- data/lib/arxutils_sqlite3/hier.rb +6 -4
- data/lib/arxutils_sqlite3/migrate.rb +23 -21
- data/lib/arxutils_sqlite3/rake_task.rb +47 -45
- data/lib/arxutils_sqlite3/transactstate.rb +2 -0
- data/lib/arxutils_sqlite3/util.rb +4 -1
- data/lib/arxutils_sqlite3/version.rb +3 -1
- data/lib/arxutils_sqlite3.rb +17 -17
- data/lib/dbacrecord.rb +3 -3
- data/lib/template/acrecord/acrecord_current.tmpl +1 -1
- data/lib/template/acrecord/acrecord_invalid.tmpl +2 -2
- data/lib/template/acrecord/db_scheme/dbsetup.tmpl +1 -46
- data/lib/template/acrecord/db_scheme/opts.rb.sample +2 -2
- data/lib/template/acrecord/db_scheme/opts.tmpl +2 -2
- metadata +41 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba5f7070ec93ff0ea6f25e7b66fa8f8fb74860ff477adb367fe653ad4853dd70
|
4
|
+
data.tar.gz: fe71d7c10f6ad03081531fc0f69d532b99a66bc7b2be25a13b5535803dc04ab0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93fa710fff1d92e873823ac196de7436e66e7b7999d3a4291670c260dd6a338ab11ef30ebc58e769a4a04a86fe895cf0300c6698a71ad2a7486d54ad4ed7285b
|
7
|
+
data.tar.gz: 502b418dc1faaf99a295a53dc24e642464ea9f4c1052e7b85995914bfc9f4b19eec8b1a6d9a69cb2867d33f659449ee13b393fd2923d76bb28fb21191f92e1e9
|
data/.rubocop.yml
CHANGED
@@ -8,9 +8,9 @@ AllCops:
|
|
8
8
|
TargetRubyVersion: 2.6
|
9
9
|
NewCops: enable
|
10
10
|
|
11
|
-
Style/StringLiterals:
|
12
|
-
Enabled: true
|
13
|
-
EnforcedStyle: double_quotes
|
11
|
+
#Style/StringLiterals:
|
12
|
+
# Enabled: true
|
13
|
+
# EnforcedStyle: double_quotes
|
14
14
|
|
15
15
|
Style/StringLiteralsInInterpolation:
|
16
16
|
Enabled: true
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2022-
|
3
|
+
# on 2022-10-01 01:21:06 UTC using RuboCop version 1.36.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -27,27 +27,6 @@ Layout/IndentationWidth:
|
|
27
27
|
Exclude:
|
28
28
|
- 'lib/dbacrecord.rb'
|
29
29
|
|
30
|
-
# Offense count: 3
|
31
|
-
# This cop supports safe autocorrection (--autocorrect).
|
32
|
-
Layout/SpaceBeforeComma:
|
33
|
-
Exclude:
|
34
|
-
# - 'lib/dbacrecord.rb'
|
35
|
-
|
36
|
-
# Offense count: 2
|
37
|
-
# This cop supports safe autocorrection (--autocorrect).
|
38
|
-
# Configuration parameters: EnforcedStyle.
|
39
|
-
# SupportedStyles: space, compact, no_space
|
40
|
-
Layout/SpaceInsideParens:
|
41
|
-
Exclude:
|
42
|
-
# - 'config/dbsetup.rb'
|
43
|
-
|
44
|
-
# Offense count: 1
|
45
|
-
# This cop supports safe autocorrection (--autocorrect).
|
46
|
-
# Configuration parameters: AllowInHeredoc.
|
47
|
-
Layout/TrailingWhitespace:
|
48
|
-
Exclude:
|
49
|
-
- 'db/migrate/050_create_currentxenoplist.rb'
|
50
|
-
|
51
30
|
# Offense count: 4
|
52
31
|
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
|
53
32
|
Metrics/AbcSize:
|
@@ -56,14 +35,14 @@ Metrics/AbcSize:
|
|
56
35
|
# Offense count: 3
|
57
36
|
# Configuration parameters: CountComments, CountAsOne.
|
58
37
|
Metrics/ClassLength:
|
59
|
-
Max:
|
38
|
+
Max: 190
|
60
39
|
|
61
|
-
# Offense count:
|
40
|
+
# Offense count: 12
|
62
41
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
|
63
42
|
Metrics/MethodLength:
|
64
43
|
Max: 49
|
65
44
|
|
66
|
-
# Offense count:
|
45
|
+
# Offense count: 3
|
67
46
|
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
68
47
|
Metrics/ParameterLists:
|
69
48
|
Max: 7
|
@@ -95,31 +74,17 @@ Naming/ClassAndModuleCamelCase:
|
|
95
74
|
RSpec/MultipleMemoizedHelpers:
|
96
75
|
Max: 11
|
97
76
|
|
98
|
-
# Offense count:
|
99
|
-
# This cop supports safe autocorrection (--autocorrect).
|
100
|
-
Style/BlockComments:
|
101
|
-
Exclude:
|
102
|
-
# - 'config/dbsetup.rb'
|
103
|
-
|
104
|
-
# Offense count: 7
|
77
|
+
# Offense count: 5
|
105
78
|
# Configuration parameters: AllowedConstants.
|
106
79
|
Style/Documentation:
|
107
80
|
Exclude:
|
108
81
|
- 'spec/**/*'
|
109
82
|
- 'test/**/*'
|
110
|
-
- 'config/dbsetup.rb'
|
111
83
|
- 'db/migrate/010_create_countdatetime.rb'
|
112
84
|
- 'db/migrate/020_create_xenop.rb'
|
113
85
|
- 'db/migrate/030_create_xenoplist.rb'
|
114
86
|
- 'db/migrate/040_create_invalidxenoplist.rb'
|
115
87
|
- 'db/migrate/050_create_currentxenoplist.rb'
|
116
|
-
- 'lib/arxutils_sqlite3/util.rb'
|
117
|
-
|
118
|
-
# Offense count: 2
|
119
|
-
# This cop supports safe autocorrection (--autocorrect).
|
120
|
-
Style/EmptyLiteral:
|
121
|
-
Exclude:
|
122
|
-
# - 'config/dbsetup.rb'
|
123
88
|
|
124
89
|
# Offense count: 5
|
125
90
|
# This cop supports safe autocorrection (--autocorrect).
|
@@ -128,24 +93,31 @@ Style/EmptyLiteral:
|
|
128
93
|
Style/FormatStringToken:
|
129
94
|
EnforcedStyle: unannotated
|
130
95
|
|
131
|
-
# Offense count:
|
96
|
+
# Offense count: 7
|
132
97
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
133
98
|
# Configuration parameters: EnforcedStyle.
|
134
99
|
# SupportedStyles: always, always_true, never
|
135
100
|
Style/FrozenStringLiteralComment:
|
136
|
-
|
101
|
+
Exclude:
|
102
|
+
- 'config/dbsetup.rb'
|
103
|
+
- 'db/migrate/010_create_countdatetime.rb'
|
104
|
+
- 'db/migrate/020_create_xenop.rb'
|
105
|
+
- 'db/migrate/030_create_xenoplist.rb'
|
106
|
+
- 'db/migrate/040_create_invalidxenoplist.rb'
|
107
|
+
- 'db/migrate/050_create_currentxenoplist.rb'
|
108
|
+
- 'lib/dbacrecord.rb'
|
137
109
|
|
138
|
-
# Offense count:
|
110
|
+
# Offense count: 11
|
139
111
|
# This cop supports safe autocorrection (--autocorrect).
|
140
112
|
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
141
113
|
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
142
114
|
# SupportedShorthandSyntax: always, never, either, consistent
|
143
115
|
Style/HashSyntax:
|
144
116
|
Exclude:
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
117
|
+
- 'db/migrate/010_create_countdatetime.rb'
|
118
|
+
- 'db/migrate/020_create_xenop.rb'
|
119
|
+
- 'db/migrate/030_create_xenoplist.rb'
|
120
|
+
- 'db/migrate/040_create_invalidxenoplist.rb'
|
149
121
|
|
150
122
|
# Offense count: 4
|
151
123
|
# This cop supports safe autocorrection (--autocorrect).
|
@@ -153,5 +125,5 @@ Style/HashSyntax:
|
|
153
125
|
# SupportedStyles: single_quotes, double_quotes
|
154
126
|
Style/StringLiterals:
|
155
127
|
Exclude:
|
156
|
-
|
157
|
-
|
128
|
+
- 'config/dbsetup.rb'
|
129
|
+
- 'lib/dbacrecord.rb'
|
data/Gemfile
CHANGED
@@ -1,37 +1,31 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in arxutils_sqlite3.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
gem
|
14
|
-
gem
|
15
|
-
|
16
|
-
|
17
|
-
gem "activesupport"
|
18
|
-
# spec.add_runtime_dependency "erb"
|
19
|
-
# spec.add_runtime_dependency "activerecord", "~> 4.2"
|
20
|
-
gem "activerecord", "~> 6.1"
|
21
|
-
gem "sqlite3"
|
22
|
-
# spec.add_runtime_dependency "mysql2" , "~> 0.4.1"
|
23
|
-
# gem "encx"
|
24
|
-
|
25
|
-
# spec.add_development_dependency "bundler", "~> 2.2.10"
|
26
|
-
gem "rake", "~> 13.0"
|
27
|
-
gem "rspec", "~> 3.0"
|
28
|
-
|
29
|
-
gem "rubocop", "~> 1.7"
|
30
|
-
gem "rubocop-rake"
|
31
|
-
gem "rubocop-rspec"
|
8
|
+
gem 'activesupport'
|
9
|
+
gem 'activerecord', '~> 6.1'
|
10
|
+
gem 'sqlite3'
|
11
|
+
gem 'simpleoptparse'
|
12
|
+
gem 'ykutils'
|
13
|
+
gem 'ykxutils'
|
14
|
+
gem 'bundler'
|
15
|
+
gem 'rake', '~> 13.0'
|
32
16
|
|
33
17
|
group :development do
|
34
|
-
gem
|
18
|
+
gem 'yard'
|
19
|
+
end
|
20
|
+
|
21
|
+
group :test, optional: true do
|
22
|
+
gem "rspec", "~> 3.0"
|
23
|
+
# gem "rspec"
|
24
|
+
gem "rubocop", '~> 1.7'
|
25
|
+
gem "rubocop-performance"
|
26
|
+
gem "rubocop-rake"
|
27
|
+
gem "rubocop-rspec"
|
28
|
+
gem 'power_assert', '~> 1.1.5'
|
35
29
|
end
|
36
30
|
|
37
31
|
# group :test do
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
arxutils_sqlite3 (0.1.
|
4
|
+
arxutils_sqlite3 (0.1.60)
|
5
5
|
activerecord (~> 6.1)
|
6
6
|
activesupport
|
7
|
+
bundler
|
8
|
+
rake (~> 13.0)
|
7
9
|
simpleoptparse
|
8
10
|
sqlite3
|
9
11
|
ykutils
|
@@ -39,9 +41,10 @@ GEM
|
|
39
41
|
parallel (1.22.1)
|
40
42
|
parser (3.1.2.1)
|
41
43
|
ast (~> 2.4.1)
|
44
|
+
power_assert (1.1.7)
|
42
45
|
rainbow (3.1.1)
|
43
46
|
rake (13.0.6)
|
44
|
-
regexp_parser (2.
|
47
|
+
regexp_parser (2.6.0)
|
45
48
|
rexml (3.2.5)
|
46
49
|
rspec (3.11.0)
|
47
50
|
rspec-core (~> 3.11.0)
|
@@ -68,13 +71,16 @@ GEM
|
|
68
71
|
unicode-display_width (>= 1.4.0, < 3.0)
|
69
72
|
rubocop-ast (1.21.0)
|
70
73
|
parser (>= 3.1.1.0)
|
74
|
+
rubocop-performance (1.15.0)
|
75
|
+
rubocop (>= 1.7.0, < 2.0)
|
76
|
+
rubocop-ast (>= 0.4.0)
|
71
77
|
rubocop-rake (0.6.0)
|
72
78
|
rubocop (~> 1.0)
|
73
79
|
rubocop-rspec (2.13.2)
|
74
80
|
rubocop (~> 1.33)
|
75
81
|
ruby-progressbar (1.11.0)
|
76
82
|
simpleoptparse (0.1.2)
|
77
|
-
sqlite3 (1.5.
|
83
|
+
sqlite3 (1.5.2-x86_64-linux)
|
78
84
|
tilt (2.0.11)
|
79
85
|
tzinfo (2.0.5)
|
80
86
|
concurrent-ruby (~> 1.0)
|
@@ -82,12 +88,12 @@ GEM
|
|
82
88
|
webrick (1.7.0)
|
83
89
|
yard (0.9.28)
|
84
90
|
webrick (~> 1.7.0)
|
85
|
-
ykutils (0.1.
|
91
|
+
ykutils (0.1.7)
|
86
92
|
erubi
|
87
93
|
filex
|
88
94
|
tilt
|
89
95
|
ykxutils (0.1.7)
|
90
|
-
zeitwerk (2.6.
|
96
|
+
zeitwerk (2.6.1)
|
91
97
|
|
92
98
|
PLATFORMS
|
93
99
|
x86_64-linux
|
@@ -97,16 +103,18 @@ DEPENDENCIES
|
|
97
103
|
activesupport
|
98
104
|
arxutils_sqlite3!
|
99
105
|
bundler
|
106
|
+
power_assert (~> 1.1.5)
|
100
107
|
rake (~> 13.0)
|
101
108
|
rspec (~> 3.0)
|
102
109
|
rubocop (~> 1.7)
|
110
|
+
rubocop-performance
|
103
111
|
rubocop-rake
|
104
112
|
rubocop-rspec
|
105
113
|
simpleoptparse
|
106
114
|
sqlite3
|
107
115
|
yard
|
108
|
-
ykutils
|
109
|
-
ykxutils
|
116
|
+
ykutils
|
117
|
+
ykxutils
|
110
118
|
|
111
119
|
BUNDLED WITH
|
112
120
|
2.3.22
|
data/Rakefile
CHANGED
@@ -1,21 +1,40 @@
|
|
1
|
-
|
2
|
-
# require "rake/testtask"
|
3
|
-
|
4
|
-
# Rake::TestTask.new do |t|
|
5
|
-
# t.libs << "test"
|
6
|
-
# end
|
7
|
-
|
8
|
-
# desc "Run test"
|
9
|
-
# task default: :test
|
10
|
-
|
11
|
-
require "rspec/core/rake_task"
|
1
|
+
# frozen_string_literal: true
|
12
2
|
|
13
|
-
|
14
|
-
|
15
|
-
require "rubocop/rake_task"
|
16
|
-
|
17
|
-
RuboCop::RakeTask.new
|
3
|
+
require "bundler/gem_tasks"
|
18
4
|
|
19
|
-
|
5
|
+
begin
|
6
|
+
require "rspec/core/rake_task"
|
7
|
+
rescue LoadError => e
|
8
|
+
puts e.message
|
9
|
+
end
|
10
|
+
|
11
|
+
begin
|
12
|
+
RSpec::Core::RakeTask.new(:spec)
|
13
|
+
rescue NameError, LoadError => e
|
14
|
+
puts e.message
|
15
|
+
end
|
16
|
+
|
17
|
+
begin
|
18
|
+
require "rubocop/rake_task"
|
19
|
+
rescue LoadError => e
|
20
|
+
puts e.message
|
21
|
+
end
|
22
|
+
|
23
|
+
begin
|
24
|
+
RuboCop::RakeTask.new
|
25
|
+
rescue NameError, LoadError => e
|
26
|
+
puts e.message
|
27
|
+
end
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'arxutils_sqlite3/rake_task'
|
31
|
+
rescue LoadError => e
|
32
|
+
puts e.message
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
task default: %i[spec rubocop]
|
37
|
+
rescue LoadError => e
|
38
|
+
puts e.message
|
39
|
+
end
|
20
40
|
|
21
|
-
require "arxutils_sqlite3/rake_task"
|
data/arxutils_sqlite3.gemspec
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'lib/arxutils_sqlite3/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'arxutils_sqlite3'
|
7
7
|
spec.version = Arxutils_Sqlite3::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ['yasuo kominami']
|
9
|
+
spec.email = ['ykominami@gmail.com']
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
15
|
-
spec.required_ruby_version =
|
11
|
+
spec.summary = 'utility functions for ActiveRecord.'
|
12
|
+
spec.description = 'utility functions for ActiveRecord.'
|
13
|
+
spec.homepage = 'https://ykominami.github.io/arxutils_sqlite3/'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = '>= 2.6.0'
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
|
18
18
|
|
19
|
-
spec.metadata[
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
20
|
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
21
21
|
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
22
|
-
spec.metadata[
|
22
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
23
23
|
|
24
24
|
# Specify which files should be added to the gem when it is released.
|
25
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -29,27 +29,28 @@ Gem::Specification.new do |spec|
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
spec.bindir =
|
32
|
+
spec.bindir = 'exe'
|
33
33
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
34
34
|
# p spec.executables
|
35
|
-
spec.require_paths = [
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
spec.add_runtime_dependency
|
41
|
-
spec.add_runtime_dependency
|
42
|
-
spec.add_runtime_dependency
|
43
|
-
spec.add_runtime_dependency
|
44
|
-
spec.add_runtime_dependency
|
45
|
-
|
46
|
-
|
47
|
-
spec.add_development_dependency
|
48
|
-
spec.add_development_dependency
|
49
|
-
spec.add_development_dependency
|
50
|
-
spec.add_development_dependency
|
51
|
-
spec.add_development_dependency
|
52
|
-
spec.add_development_dependency
|
35
|
+
spec.require_paths = ['lib']
|
36
|
+
|
37
|
+
spec.add_runtime_dependency 'bundler'
|
38
|
+
|
39
|
+
spec.add_runtime_dependency 'activesupport'
|
40
|
+
spec.add_runtime_dependency 'activerecord', '~> 6.1'
|
41
|
+
spec.add_runtime_dependency 'sqlite3'
|
42
|
+
spec.add_runtime_dependency 'simpleoptparse'
|
43
|
+
spec.add_runtime_dependency 'ykutils'
|
44
|
+
spec.add_runtime_dependency 'ykxutils'
|
45
|
+
spec.add_runtime_dependency 'rake', '~> 13.0'
|
46
|
+
|
47
|
+
spec.add_development_dependency 'power_assert', '~> 1.1.5'
|
48
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
49
|
+
spec.add_development_dependency 'rubocop', '~> 1.7'
|
50
|
+
spec.add_development_dependency 'rubocop-performance'
|
51
|
+
spec.add_development_dependency 'rubocop-rake'
|
52
|
+
spec.add_development_dependency 'rubocop-rspec'
|
53
|
+
spec.add_development_dependency 'yard'
|
53
54
|
# Uncomment to register a new dependency of your gem
|
54
55
|
# spec.add_dependency "example-gem", "~> 1.0"
|
55
56
|
|
data/bin/console
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'arxutils_sqlite3'
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -11,5 +11,5 @@ require "arxutils_sqlite3"
|
|
11
11
|
# require "pry"
|
12
12
|
# Pry.start
|
13
13
|
|
14
|
-
require
|
14
|
+
require 'irb'
|
15
15
|
IRB.start(__FILE__)
|
data/bin/setup
CHANGED
data/exe/arxutils_sqlite3
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
4
|
+
require 'arxutils_sqlite3'
|
5
|
+
require 'simpleoptparse'
|
6
|
+
require 'pp'
|
7
|
+
require 'ykutils'
|
8
|
+
require 'ykxutils'
|
8
9
|
|
9
10
|
config = Arxutils_Sqlite3::Config.new
|
10
11
|
|
@@ -13,69 +14,69 @@ opts, mod = config.setupx(self)
|
|
13
14
|
# p mod
|
14
15
|
# exit
|
15
16
|
|
16
|
-
banner =
|
17
|
+
banner = 'Usage: bundle exec arxutils_sqlite3 --cmd=(s|cds|co|c|f|m|a|d|del|b|y|dm) -y yaml_file --mod=mod'
|
17
18
|
|
18
19
|
Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Arxutils_Sqlite3::VERSION, nil) do |parser|
|
19
|
-
parser.on(
|
20
|
-
parser.on(
|
21
|
-
parser.on(
|
20
|
+
parser.on('--cmd X', %w[s cds co c f m a d del b y dm]) { |x| opts['cmd'] = x }
|
21
|
+
parser.on('-y yaml_file', '--yaml yaml_file') { |x| opts['yaml'] = x }
|
22
|
+
parser.on('--mod mod') { |x| opts['mod'] = x }
|
22
23
|
end
|
23
24
|
|
24
25
|
dbconfig = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3
|
25
|
-
env = ENV.fetch(
|
26
|
-
env ||=
|
26
|
+
env = ENV.fetch('ENV', nil)
|
27
|
+
env ||= 'production'
|
27
28
|
|
28
29
|
acrecord = opts[:acrecord]
|
29
|
-
yaml_fname = opts[
|
30
|
-
mod ||= opts[
|
30
|
+
yaml_fname = opts['yaml']
|
31
|
+
mod ||= opts['mod']
|
31
32
|
cli = Arxutils_Sqlite3::Cli.new(config, dbconfig, env, acrecord, yaml_fname, mod)
|
32
33
|
|
33
|
-
case opts[
|
34
|
-
when
|
34
|
+
case opts['cmd']
|
35
|
+
when 's'
|
35
36
|
# config.check_file_exist(Arxutils_Sqlite3::Config::SAMPLE_DEST_OPTS_FILE, banner, 10)
|
36
37
|
|
37
|
-
if opts[
|
38
|
+
if opts['mod'].nil? || opts['mod'].strip == ''
|
38
39
|
puts banner
|
39
40
|
exit 20
|
40
41
|
end
|
41
42
|
cli.setup(mod)
|
42
43
|
|
43
|
-
when
|
44
|
+
when 'cds'
|
44
45
|
cli.copy_db_scheme
|
45
46
|
|
46
|
-
when
|
47
|
+
when 'co'
|
47
48
|
cli.copy_opts_file
|
48
49
|
|
49
|
-
when
|
50
|
+
when 'c'
|
50
51
|
cli.makeconfig(opts)
|
51
52
|
|
52
|
-
when
|
53
|
-
if yaml_fname.nil? || yaml_fname.strip ==
|
53
|
+
when 'f'
|
54
|
+
if yaml_fname.nil? || yaml_fname.strip == ''
|
54
55
|
puts banner
|
55
56
|
exit 40
|
56
57
|
end
|
57
58
|
yaml_pn = Pathname.new(yaml_fname)
|
58
59
|
config.check_file_not_exist(yaml_pn, banner, 55)
|
59
60
|
cli.make_migrate_script
|
60
|
-
when
|
61
|
+
when 'm'
|
61
62
|
cli.migrate
|
62
63
|
|
63
|
-
when
|
64
|
+
when 'a'
|
64
65
|
cli.acr
|
65
66
|
|
66
|
-
when
|
67
|
+
when 'd'
|
67
68
|
cli.clean
|
68
69
|
|
69
|
-
when
|
70
|
+
when 'del'
|
70
71
|
cli.delete
|
71
72
|
|
72
|
-
when
|
73
|
+
when 'b'
|
73
74
|
cli.delete_db
|
74
75
|
|
75
|
-
when
|
76
|
+
when 'y'
|
76
77
|
cli.delete_setting_yaml
|
77
78
|
|
78
|
-
when
|
79
|
+
when 'dm'
|
79
80
|
cli.delete_migrate
|
80
81
|
|
81
82
|
else
|
data/lib/arxutils_sqlite3/arx.rb
CHANGED
data/lib/arxutils_sqlite3/cli.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Arxutils_Sqlite3
|
2
4
|
# CLI用クラス
|
3
5
|
class Cli
|
@@ -9,7 +11,7 @@ module Arxutils_Sqlite3
|
|
9
11
|
@dbconfig_path = @config.make_dbconfig_path(@dbconfig)
|
10
12
|
|
11
13
|
@db_scheme_ary = nil
|
12
|
-
if yaml_fname && yaml_fname.strip !=
|
14
|
+
if yaml_fname && yaml_fname.strip != ''
|
13
15
|
yaml_pn = Pathname.new(yaml_fname)
|
14
16
|
@db_scheme_ary = YAML.load_file(yaml_pn)
|
15
17
|
end
|