arxutils_sqlite3 0.1.56 → 0.1.57

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: 6c61855dd1cb824e99683ddbe8ea74085dccfdceb07daf5d875c17ae970ba764
4
- data.tar.gz: 58b003297e61ab90072846de1b34836ac0a7461d3c611dee991224c6d07c0354
3
+ metadata.gz: fc3d7553db8a9f3ab369bb8cd52ddc1c2dad405a5bc902dab4df7f10cf092371
4
+ data.tar.gz: 051160b94504da313197d003017d925c30c035b17c7bc14dd8dfd957e23d2014
5
5
  SHA512:
6
- metadata.gz: 123d78945f9f2f2b8e23f944f111d069e92c94551523f51a13dce6e928722f031a3c399b66eb87be4973ec2f372bdb067ea78b36ea1df115d9382bccec9c70df
7
- data.tar.gz: '08dcc25d6c3fc43b343ef65d08df6bdf789a6eed391f0af73deb5fbe348d8a8baca7a3086d19ab21bd42edd99cf1ab75c0d0b1da6012276c659589d99ff74292'
6
+ metadata.gz: a0925a9111aa889b00d36609fd1027a5e6b925f855e5bc1934dbbae5df85134c7eb1d1b1edd3d5133b59323151d88bae047954a9febf8fd22837b0ecda2fb06b
7
+ data.tar.gz: 1fb3f7177523006d793adedb9080557fe6a7d132163d70cc19436e22c4d789c08c0e75060219f53f1d9a026fa2a89d828eaf1c0c02fcd12ac9b559b062c287e7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arxutils_sqlite3 (0.1.56)
4
+ arxutils_sqlite3 (0.1.57)
5
5
  activerecord (~> 6.1)
6
6
  activesupport
7
7
  simpleoptparse
@@ -109,4 +109,4 @@ DEPENDENCIES
109
109
  ykxutils (> 0.1.0)
110
110
 
111
111
  BUNDLED WITH
112
- 2.3.17
112
+ 2.3.22
data/config/setting.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- :klass: Xenop
2
+ :mod: Xenop
data/exe/arxutils_sqlite3 CHANGED
@@ -8,17 +8,17 @@ require "ykxutils"
8
8
 
9
9
  config = Arxutils_Sqlite3::Config.new
10
10
 
11
- opts, klass = config.setupx(self)
11
+ opts, mod = config.setupx(self)
12
12
  # p opts
13
- # p klass
13
+ # p mod
14
14
  # exit
15
15
 
16
- banner = "Usage: bundle exec arxutils_sqlite3 --cmd=(s|cds|co|c|f|m|a|d|b|y|dm) -y yaml_file --klass=class"
16
+ 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
17
 
18
18
  Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Arxutils_Sqlite3::VERSION, nil) do |parser|
19
- parser.on("--cmd X", %w[s cds co c f m a d b y dm]) { |x| opts["cmd"] = x }
19
+ parser.on("--cmd X", %w[s cds co c f m a d del b y dm]) { |x| opts["cmd"] = x }
20
20
  parser.on("-y yaml_file", "--yaml yaml_file") { |x| opts["yaml"] = x }
21
- parser.on("--klass klass") { |x| opts["klass"] = x }
21
+ parser.on("--mod mod") { |x| opts["mod"] = x }
22
22
  end
23
23
 
24
24
  dbconfig = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3
@@ -27,18 +27,18 @@ env ||= "production"
27
27
 
28
28
  acrecord = opts[:acrecord]
29
29
  yaml_fname = opts["yaml"]
30
- klass = opts["klass"]
31
- cli = Arxutils_Sqlite3::Cli.new(config, dbconfig, env, acrecord, yaml_fname, klass)
30
+ mod ||= opts["mod"]
31
+ cli = Arxutils_Sqlite3::Cli.new(config, dbconfig, env, acrecord, yaml_fname, mod)
32
32
 
33
33
  case opts["cmd"]
34
34
  when "s"
35
35
  # config.check_file_exist(Arxutils_Sqlite3::Config::SAMPLE_DEST_OPTS_FILE, banner, 10)
36
36
 
37
- if opts["klass"].nil? || opts["klass"].strip == ""
37
+ if opts["mod"].nil? || opts["mod"].strip == ""
38
38
  puts banner
39
39
  exit 20
40
40
  end
41
- cli.setup(klass)
41
+ cli.setup(mod)
42
42
 
43
43
  when "cds"
44
44
  cli.copy_db_scheme
@@ -64,6 +64,9 @@ when "a"
64
64
  cli.acr
65
65
 
66
66
  when "d"
67
+ cli.clean
68
+
69
+ when "del"
67
70
  cli.delete
68
71
 
69
72
  when "b"
@@ -1,7 +1,7 @@
1
1
  module Arxutils_Sqlite3
2
2
  # CLI用クラス
3
3
  class Cli
4
- def initialize(config, dbconfig, env, acrecord, yaml_fname, klass)
4
+ def initialize(config, dbconfig, env, acrecord, yaml_fname, _mod)
5
5
  @config = config
6
6
  @dbconfig = dbconfig
7
7
  @env = env
@@ -16,19 +16,15 @@ module Arxutils_Sqlite3
16
16
  @mig = @config.prepare_for_migrate(@db_scheme_ary, @dbconfig_path, @dbconfig, @acrecord)
17
17
  end
18
18
 
19
- def setup_for_migrate(yaml_pn, klass)
20
-
21
- end
22
-
23
- def setup(klass)
19
+ def setup(mod)
24
20
  # p "make_config_directory"
25
21
  @config.make_config_directory
26
22
  # p "setup_db_scheme_file"
27
- @config.setup_db_scheme_file(klass)
28
- # p "setup_opts_file(#{klass})"
29
- @config.setup_opts_file(klass)
30
- # p "setup_setting_yaml_file(#{klass})"
31
- @config.setup_setting_yaml_file(klass)
23
+ @config.setup_db_scheme_file(mod)
24
+ # p "setup_opts_file(#{mod})"
25
+ @config.setup_opts_file(mod)
26
+ # p "setup_setting_yaml_file(#{mod})"
27
+ @config.setup_setting_yaml_file(mod)
32
28
  # db_scheme_ary = nil
33
29
  end
34
30
 
@@ -43,10 +39,12 @@ module Arxutils_Sqlite3
43
39
  end
44
40
 
45
41
  def setup_for_migrate
42
+ ret = :SUCCESS
46
43
  db_scheme_ary = nil
47
44
  dbconfig_path = @config.make_dbconfig_path(@dbconfig)
48
45
  # @config.check_file_exist(dbconfig_path, banner, exit_code)
49
46
  @config.prepare_for_migrate(db_scheme_ary, dbconfig_path, @dbconfig, @acrecord)
47
+ ret
50
48
  end
51
49
 
52
50
  def makeconfig(opts)
@@ -55,7 +53,7 @@ module Arxutils_Sqlite3
55
53
 
56
54
  def make_migrate_script
57
55
  @dest_dbsetup_file = @config.dest_dbsetup_file
58
- @config.make_dbsetup_file(@db_scheme_ary, @acrecord, @klass, @dest_dbsetup_file)
56
+ @config.make_dbsetup_file(@db_scheme_ary, @acrecord, @mod, @dest_dbsetup_file)
59
57
  # マイグレーション用スクリプトの生成、acrecordのクラス定義ファイルの生成
60
58
  @mig.output
61
59
  end
@@ -79,17 +77,22 @@ module Arxutils_Sqlite3
79
77
  ret = :SUCCESS
80
78
  begin
81
79
  Dbsetup.new(connect_time)
82
- rescue StandardError
80
+ rescue StandardError => e
81
+ puts e.message
83
82
  ret = :StandardError
84
83
  end
85
84
 
86
85
  ret
87
86
  end
88
87
 
89
- def delete
88
+ def clean
90
89
  @mig.delete_migrate_and_config_and_db
91
90
  end
92
91
 
92
+ def delete
93
+ @mig.delete_migrate_and_db
94
+ end
95
+
93
96
  def delete_db
94
97
  @mig.delete_db
95
98
  end
@@ -61,10 +61,10 @@ module Arxutils_Sqlite3
61
61
  # 削除しないファイル群
62
62
  EXCLUDE_FILES = %w[SETTING_YAML_FILE_NAME].freeze
63
63
  # 作成対象のActiveRecordの子クラスのデフォルトクラス名
64
- DEFAULT_KLASS = "Xenop".freeze
64
+ DEFAULT_MOD = "Xenop".freeze
65
65
 
66
- def default_klass
67
- DEFAULT_KLASS
66
+ def default_mod
67
+ DEFAULT_MOD
68
68
  end
69
69
 
70
70
  def setting_yaml_file
@@ -95,13 +95,13 @@ module Arxutils_Sqlite3
95
95
 
96
96
  setting = load_setting_yaml_file
97
97
  # p "setting=#{setting}"
98
- klass = setting[:klass]
99
- klass ||= DEFAULT_KLASS
98
+ mod = setting[:mod]
99
+ mod ||= DEFAULT_MOD
100
100
 
101
101
  # DBセットアップクラス
102
102
  require_dbsetup_file
103
103
 
104
- [opts, klass]
104
+ [opts, mod]
105
105
  end
106
106
 
107
107
  # DB構成ファイル格納ディレクトリの作成
@@ -111,12 +111,12 @@ module Arxutils_Sqlite3
111
111
  end
112
112
 
113
113
  # DBスキームファイルのサンプルファイコピー
114
- def setup_db_scheme_file(klass)
114
+ def setup_db_scheme_file(mod)
115
115
  # p "config setup_db_scheme_file"
116
116
  # p "DB_SCHEME_FILE=#{DB_SCHEME_FILE}"
117
117
  # p "SAMPLE_DB_SCHEME_FILE=#{SAMPLE_DB_SCHEME_FILE}"
118
118
  scope = {}
119
- value_hash = { klass: klass }
119
+ value_hash = { mod: mod }
120
120
  content = Ykutils::Erubyx.erubi_render_with_template_file(DB_SCHEME_FILE, scope, value_hash)
121
121
  Ykxutils.yaml_load_compati(content)
122
122
  File.write(SAMPLE_DB_SCHEME_FILE, content)
@@ -130,9 +130,9 @@ module Arxutils_Sqlite3
130
130
  end
131
131
 
132
132
  # optsファイル(Rubyスクリプトファイル)のサンプルファイル書き込み
133
- def setup_opts_file(klass)
133
+ def setup_opts_file(mod)
134
134
  scope = Object.new
135
- hash = { klass: klass }
135
+ hash = { mod_name: mod }
136
136
  result_content = Ykutils::Erubyx.erubi_render_with_template_file(OPTS_FILE, scope, hash)
137
137
  File.write(SAMPLE_OPTS_FILE, result_content)
138
138
  end
@@ -147,8 +147,8 @@ module Arxutils_Sqlite3
147
147
  end
148
148
 
149
149
  # setting.ymlへの出力
150
- def setup_setting_yaml_file(klass)
151
- hash = { klass: klass }
150
+ def setup_setting_yaml_file(mod)
151
+ hash = { mod: mod }
152
152
  content = YAML.dump(hash)
153
153
  ret = :SUCCESS
154
154
  begin
@@ -285,11 +285,10 @@ module Arxutils_Sqlite3
285
285
  )
286
286
  end
287
287
 
288
- def make_dbsetup_file(db_scheme_ary, acrecord, klass, dest_dbsetup_file)
288
+ def make_dbsetup_file(db_scheme_ary, acrecord, _mod, dest_dbsetup_file)
289
289
  scope = Object.new
290
- hash0 = { module_name: acrecord[:module].join("::") }
290
+ hash0 = { mod_name: acrecord[:module].join("::") }
291
291
  hash = db_scheme_ary[0].merge(hash0)
292
- hash["klass"] = klass
293
292
  result_content = Ykutils::Erubyx.erubi_render_with_template_file(src_dbsetup_file, scope, hash)
294
293
 
295
294
  File.write(dest_dbsetup_file, result_content)
@@ -2,10 +2,10 @@
2
2
  require "arxutils_sqlite3"
3
3
  config = Arxutils_Sqlite3::Config.new
4
4
 
5
- klass = nil
5
+ mod = nil
6
6
  setting = config.load_setting_yaml_file
7
- klass = setting[:klass]
8
- klass = config.default_klass if klass.nil?
7
+ mod = setting[:mod]
8
+ mod = config.default_mod if mod.nil?
9
9
 
10
10
  desc_arxutils_sqlite3 = "setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr"
11
11
 
@@ -29,9 +29,9 @@ task "arx:ds": %w[arx:delete_setting]
29
29
 
30
30
  # コマンドラインで指定したクラス名を含むオプション指定用ハッシュの定義を含むRubyスクリ
31
31
  # プトファイルの生成
32
- desc "produce setting.yml, db_scheme.yml.sample and opts.rb.sample with class name #{klass}"
32
+ desc "produce setting.yml, db_scheme.yml.sample and opts.rb.sample with class name #{mod}"
33
33
  task "arx:setup" do
34
- sh "bundle exec arxutils_sqlite3 --cmd=s --klass=#{klass}"
34
+ sh "bundle exec arxutils_sqlite3 --cmd=s --mod=#{mod}"
35
35
  end
36
36
 
37
37
  desc "copy from db_scheme.yml.sample to db_scheme.yml"
@@ -68,6 +68,11 @@ end
68
68
 
69
69
  desc "delete configuration files adn migration scripts and db files"
70
70
  task "arx:delete" do
71
+ sh "bundle exec arxutils_sqlite3 --cmd=del"
72
+ end
73
+
74
+ desc "delete configuration files adn migration scripts and db files"
75
+ task "arx:clean" do
71
76
  sh "bundle exec arxutils_sqlite3 --cmd=d"
72
77
  end
73
78
 
@@ -84,4 +89,4 @@ end
84
89
  desc "delete migrate scripts"
85
90
  task "arx:delete_migrate" do
86
91
  sh "bundle exec arxutils_sqlite3 --cmd=dm"
87
- end
92
+ end
@@ -1,4 +1,4 @@
1
1
  module Arxutils_Sqlite3
2
2
  # バージョン番号
3
- VERSION = "0.1.56".freeze
3
+ VERSION = "0.1.57".freeze
4
4
  end
@@ -11,8 +11,8 @@
11
11
  :ar_version: 6.0
12
12
  - :flist:
13
13
  - noitem
14
- :classname: <%= klass %>
15
- :classname_downcase: <%= klass.downcase %>
14
+ :classname: <%= mod %>
15
+ :classname_downcase: <%= mod.downcase %>
16
16
  :items:
17
17
  - - time_id
18
18
  - integer
@@ -20,14 +20,14 @@
20
20
  - - ennb_id
21
21
  - integer
22
22
  - 'false'
23
- :plural: <%= klass.downcase %>s
23
+ :plural: <%= mod.downcase %>s
24
24
  :ar_version: 6.0
25
25
  - :flist:
26
26
  - noitem
27
27
  - invalid
28
28
  - current
29
- :classname: <%= klass %>list
30
- :classname_downcase: <%= klass.downcase %>list
29
+ :classname: <%= mod %>list
30
+ :classname_downcase: <%= mod.downcase %>list
31
31
  :items:
32
32
  - - stack
33
33
  - string
@@ -44,5 +44,5 @@
44
44
  - - start_datetime
45
45
  - datetime
46
46
  - 'false'
47
- :plural: <%= klass.downcase %>lists
47
+ :plural: <%= mod.downcase %>lists
48
48
  :ar_version: 6.0
@@ -3,7 +3,7 @@ require_relative "../lib/dbacrecord"
3
3
  class Dbsetup
4
4
  def initialize(connect_time)
5
5
  @connect_time = connect_time
6
- @ct = <%= klass %>::Dbutil::Countdatetime.create(countdatetime: @connect_time)
6
+ @ct = <%= mod_name %>::Countdatetime.create(countdatetime: @connect_time)
7
7
  @hs_by_notebook = {}
8
8
  @hs_by_id = {}
9
9
  end
@@ -1,6 +1,6 @@
1
1
  @opts = {
2
2
  acrecord: {
3
- module: %w[<%= klass %> Dbutil],
3
+ module: %w[<%= mod %> Dbutil],
4
4
  filename: "dbacrecord.rb",
5
5
  dir: "lib"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  @opts = {
2
2
  acrecord: {
3
- module: %w[<%= klass %> Dbutil],
3
+ module: %w[<%= mod_name %> Dbutil],
4
4
  filename: "dbacrecord.rb",
5
5
  dir: "lib"
6
6
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arxutils_sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.56
4
+ version: 0.1.57
5
5
  platform: ruby
6
6
  authors:
7
7
  - yasuo kominami
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-24 00:00:00.000000000 Z
11
+ date: 2022-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -250,7 +250,7 @@ licenses:
250
250
  metadata:
251
251
  homepage_uri: https://ykominami.github.io/arxutils_sqlite3/
252
252
  rubygems_mfa_required: 'true'
253
- post_install_message:
253
+ post_install_message:
254
254
  rdoc_options: []
255
255
  require_paths:
256
256
  - lib
@@ -265,8 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
265
  - !ruby/object:Gem::Version
266
266
  version: '0'
267
267
  requirements: []
268
- rubygems_version: 3.3.7
269
- signing_key:
268
+ rubygems_version: 3.1.6
269
+ signing_key:
270
270
  specification_version: 4
271
271
  summary: utility functions for ActiveRecord.
272
272
  test_files: []