arxutils_sqlite3 0.1.45 → 0.1.47

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: 7186c960b82d6762345ea6f0d8a52282025c001a52a4a9398ca7c7f15e4c21eb
4
- data.tar.gz: 859c88d305e3b9227a9ed1464d5a254d13b096ccc30447acb6043cd7fd73a71f
3
+ metadata.gz: e09dc03b438aa54a9f0bb3e49c46b7592593e52a4e4275220a1b66890694054e
4
+ data.tar.gz: 1afd929a60c9e1fed27e11b9ff4ea87761be5dd77e15cf87cb2e090a153dbc07
5
5
  SHA512:
6
- metadata.gz: 357450af1e2fc3051d4c0b9c3289022a39b779de484db79ca3576baff144c5a8c25529f181dc5e77ca0a6de5453d20bfae409898dc84d430cd46afaea48d8c21
7
- data.tar.gz: 00142e1c2494bea9a3158628f778f553aae4ac1d4b02a18c7e576aea2b947b47f3ab5df1ffc200d58c9f84d4570ac916076b4acb41437d6e0be64179e668604b
6
+ metadata.gz: 3f63fa45e2827cc7c16ae8fc534c2ef725e1359c4d2c9f99c4edc73af78b846eaf43319c25cb177636cffef8d997fc939e6d97e865ece6ea0a0a064d398d90df
7
+ data.tar.gz: 508aa3ff67bddd7e1ec59403e6f18d024f71e79dbd23aa750dd6c736bd3a3183091f7ec9fde7b61d634091dddf41ef5885f5d6b900fcb8c4eb5a97bdde077ed7
data/Rakefile CHANGED
@@ -10,7 +10,6 @@ desc "Run test"
10
10
  task default: :test
11
11
  =end
12
12
 
13
- #=begin
14
13
  # Defining a task called default that depends on the tasks setup, makeconfig, migrate, and integrate.
15
14
  task default: %w[delete setup makeconfig migrate integrate]
16
15
 
@@ -32,11 +31,18 @@ task dscmi: %w[delete setup makeconfig migrate integrate]
32
31
 
33
32
  task scmi: %w[setup makeconfig migrate integrate]
34
33
 
34
+ task mi: %w[migrate integrate]
35
+
36
+ task bmi: %w[delete_db migrate integrate]
37
+
38
+ task b: %w[delete_db]
39
+
35
40
  # コマンドラインで指定したクラス名を含むオプション指定用ハッシュの定義を含むRubyスクリ
36
41
  # プトファイルの生成
37
42
  task :setup do
38
43
  sh "bundle exec arxutils_sqlite3 --cmd=s --klass=Enop"
39
44
  end
45
+
40
46
  # DB構成情報の生成
41
47
  task :makeconfig do
42
48
  sh "bundle exec arxutils_sqlite3 --cmd=c"
@@ -45,6 +51,7 @@ end
45
51
  task :migrate do
46
52
  sh "bundle exec arxutils_sqlite3 --cmd=m --yaml=config/db_scheme.yml"
47
53
  end
54
+
48
55
  task :integrate do
49
56
  sh "bundle exec arxutils_sqlite3 --cmd=i"
50
57
  end
@@ -53,5 +60,8 @@ task :delete do
53
60
  sh "bundle exec arxutils_sqlite3 --cmd=d"
54
61
  end
55
62
 
56
- #=end
63
+ task :delete_db do
64
+ sh "bundle exec arxutils_sqlite3 --cmd=b"
65
+ end
66
+
57
67
 
data/exe/arxutils_sqlite3 CHANGED
@@ -24,13 +24,13 @@ klass = setting[:klass]
24
24
  # DBセットアップクラス
25
25
  config.require_dbsetup_file
26
26
 
27
- banner = "Usage: bundle exec ruby exe/makemigrate --cmd=(s|c|m|i|d) -y yaml_file --klass=class"
27
+ banner = "Usage: bundle exec arxutils_sqlite3 --cmd=(s|c|m|i|d|b) -y yaml_file --klass=class"
28
28
 
29
29
  opts = @opts ? @opts : {}
30
30
  opts["dbconfig"] = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3
31
31
 
32
32
  Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Arxutils_Sqlite3::VERSION, nil) do |parser|
33
- parser.on("--cmd X", %w[s c m i d]) { |x| opts["cmd"] = x }
33
+ parser.on("--cmd X", %w[s c m i d b]) { |x| opts["cmd"] = x }
34
34
  parser.on("-y yaml_file", "--yaml yaml_file") { |x| opts["yaml"] = x }
35
35
  parser.on("--klass klass") { |x| opts["klass"] = x }
36
36
  end
@@ -66,7 +66,6 @@ when "m"
66
66
  yaml_fname = opts["yaml"]
67
67
  relation = opts[:relation]
68
68
  dbconfig = opts["dbconfig"]
69
-
70
69
  if yaml_fname.nil? || yaml_fname.strip == ""
71
70
  puts banner
72
71
  exit 40
@@ -76,8 +75,6 @@ when "m"
76
75
  db_scheme_ary = YAML.load_file( yaml_pn )
77
76
 
78
77
  dest_dbsetup_file = config.get_dest_dbsetup_file
79
- config.check_file_exist(dest_dbsetup_file, banner, 50)
80
-
81
78
  config.make_dbsetup_file(db_scheme_ary, relation, klass, dest_dbsetup_file)
82
79
 
83
80
  connect_time = Arxutils_Sqlite3::Dbutil::Dbconnect.db_connect(config, dbconfig, env)
@@ -102,7 +99,29 @@ when "d"
102
99
  config_dir = config.get_config_dir
103
100
  dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, dbconfig)
104
101
  mig = config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig, replation)
105
- mig.delete_migrate_config_and_db
102
+ mig.delete_migrate_and_config_and_db
103
+
104
+ when "b"
105
+ db_scheme_ary = nil
106
+ dbconfig = opts["dbconfig"]
107
+ replation = opts["replation"]
108
+
109
+ config_dir = config.get_config_dir
110
+ dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, dbconfig)
111
+ mig = config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig, replation)
112
+ # mig.delete_migrate_config_and_db
113
+ mig.delete_db
114
+
115
+ when "b"
116
+ db_scheme_ary = nil
117
+ dbconfig = opts["dbconfig"]
118
+ replation = opts["replation"]
119
+
120
+ config_dir = config.get_config_dir
121
+ dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, dbconfig)
122
+ mig = config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig, replation)
123
+ # mig.delete_migrate_config_and_db
124
+ mig.delete_db
106
125
 
107
126
  else
108
127
  puts "Invalid command(#{opts["cmd"]}) specified!!"
@@ -125,7 +125,7 @@ module Arxutils_Sqlite3
125
125
  if file_pn.exist?
126
126
  puts "#{file_pn} exists!"
127
127
  puts banner
128
- exit 10
128
+ exit exit_code
129
129
  end
130
130
  end
131
131
 
@@ -134,7 +134,7 @@ module Arxutils_Sqlite3
134
134
  if !file_pn.exist?
135
135
  puts "#{file_pn} does not exists!"
136
136
  puts banner
137
- exit 10
137
+ exit exit_code
138
138
  end
139
139
  end
140
140
 
@@ -3,7 +3,6 @@ require_relative "dbutil/dbconnect"
3
3
  module Arxutils_Sqlite3
4
4
  # DB操作用ユーティリティクラス
5
5
  module Dbutil
6
- # DB格納ディレクトリ名
7
- DB_DIR = "db".freeze
6
+ #
8
7
  end
9
8
  end
@@ -53,9 +53,36 @@ module Arxutils_Sqlite3
53
53
  end
54
54
 
55
55
  # マイグレート用スクリプト、DB構成情報ファイル、DBファイルの削除
56
- def delete_migrate_config_and_db
57
- FileUtils.rm(Dir.glob(File.join(@migrate_dir, "*"))) if @migrate_dir
58
- FileUtils.rm(Dir.glob(File.join(@dest_config_dir, "*")))
56
+ def delete_migrate_and_config_and_db
57
+ if @migrate_dir
58
+ Dir.glob(File.join(@migrate_dir, "*")).each do |x|
59
+ FileUtils.rm(x) if File.file?(x)
60
+ end
61
+ end
62
+ Dir.glob(File.join(@dest_config_dir, "*")).each do |x|
63
+ FileUtils.rm(x) if File.file?(x)
64
+ end
65
+ Dir.glob(File.join(@db_dir, "*")).each do |x|
66
+ # puts x
67
+ FileUtils.rm(x) if File.file?(x)
68
+ end
69
+ end
70
+
71
+ # マイグレート用スクリプト、DBファイルの削除
72
+ def delete_migrate_and_db
73
+ if @migrate_dir
74
+ Dir.glob(File.join(@migrate_dir, "*")).each do |x|
75
+ FileUtils.rm(x) if File.file?(x)
76
+ end
77
+ end
78
+ Dir.glob(File.join(@db_dir, "*")).each do |x|
79
+ # puts x
80
+ FileUtils.rm(x) if File.file?(x)
81
+ end
82
+ end
83
+
84
+ # DBファイルの削除
85
+ def delete_db
59
86
  Dir.glob(File.join(@db_dir, "*")).each do |x|
60
87
  # puts x
61
88
  FileUtils.rm(x) if File.file?(x)
@@ -1,4 +1,4 @@
1
1
  module Arxutils_Sqlite3
2
2
  # バージョン番号
3
- VERSION = "0.1.45".freeze
3
+ VERSION = "0.1.47".freeze
4
4
  end
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.45
4
+ version: 0.1.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - yasuo kominami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-12 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport