arxutils_sqlite3 0.1.61 → 0.1.63
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +95 -14
- data/.tool-versions +1 -0
- data/Gemfile +22 -10
- data/Gemfile.lock +122 -67
- data/SECURITY.md +21 -0
- data/arxutils_sqlite3.gemspec +14 -13
- data/bin/setup +1 -1
- data/lib/arxutils_sqlite3/arx.rb +6 -6
- data/lib/arxutils_sqlite3/cli.rb +3 -2
- data/lib/arxutils_sqlite3/config.rb +27 -27
- data/lib/arxutils_sqlite3/dbutil/dbconnect.rb +9 -7
- data/lib/arxutils_sqlite3/dbutil.rb +1 -1
- data/lib/arxutils_sqlite3/hier.rb +9 -9
- data/lib/arxutils_sqlite3/migrate.rb +25 -25
- data/lib/arxutils_sqlite3/rake_task.rb +40 -40
- data/lib/arxutils_sqlite3/util.rb +1 -1
- data/lib/arxutils_sqlite3/version.rb +1 -1
- data/lib/arxutils_sqlite3.rb +19 -17
- metadata +12 -178
@@ -1,45 +1,45 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "ykutils"
|
4
4
|
|
5
5
|
module Arxutils_Sqlite3
|
6
6
|
##
|
7
7
|
# migrateに必要なファイルをテンプレートから作成し、migarteを実行する
|
8
8
|
class Config
|
9
9
|
# DB格納ディレクトリ名
|
10
|
-
DB_DIR =
|
10
|
+
DB_DIR = "db"
|
11
11
|
# migrate用スクリプト格納ディレクトリ名
|
12
|
-
MIGRATE_BASE_DIR =
|
12
|
+
MIGRATE_BASE_DIR = "migrate"
|
13
13
|
# SQLITE3用DB構成名
|
14
|
-
DBCONFIG_SQLITE3 =
|
14
|
+
DBCONFIG_SQLITE3 = "sqlite3"
|
15
15
|
# MYSQL用DB構成名
|
16
|
-
DBCONFIG_MYSQL =
|
16
|
+
DBCONFIG_MYSQL = "mysql"
|
17
17
|
# DB構成格納用ディレクトリ名
|
18
|
-
CONFIG_DIR_NAME =
|
18
|
+
CONFIG_DIR_NAME = "config"
|
19
19
|
|
20
20
|
# コンフィグディレクトリへのパス
|
21
21
|
CONFIG_DIR = Pathname.new(CONFIG_DIR_NAME)
|
22
22
|
# データベース用ログファイル名
|
23
|
-
DATABASELOG =
|
23
|
+
DATABASELOG = "database.log"
|
24
24
|
# テンプレートディレクトリへのパス
|
25
|
-
TEMPLATE_DIR = Arxutils_Sqlite3::TOP_DIR.join(
|
25
|
+
TEMPLATE_DIR = Arxutils_Sqlite3::TOP_DIR.join("template")
|
26
26
|
# リレーションテンプレートディレクトリへのパス
|
27
|
-
TEMPLATE_ACRECORD_DIR = TEMPLATE_DIR.join(
|
27
|
+
TEMPLATE_ACRECORD_DIR = TEMPLATE_DIR.join("acrecord")
|
28
28
|
TEMPLATE_CONFIG_DIR = TEMPLATE_DIR.join(CONFIG_DIR)
|
29
|
-
DB_SCHEME_DIR = TEMPLATE_ACRECORD_DIR.join(
|
30
|
-
DB_SCHEME_FILE = DB_SCHEME_DIR.join(
|
31
|
-
SAMPLE_DB_SCHEME_FILE = CONFIG_DIR.join(
|
32
|
-
DB_SCHEME_FILE_NAME =
|
33
|
-
DB_SCHEME_FILE_NAME_B =
|
34
|
-
OPTS_FILE_NAME =
|
35
|
-
SAMPLE_OPTS_FILE_NAME =
|
36
|
-
OPTS_FILE_NAME_B =
|
37
|
-
DEST_OPTS_FILE_NAME =
|
38
|
-
DEST_OPTS_FILE_NAME_B =
|
39
|
-
DBSETUP_FILE_NAME =
|
40
|
-
DBSETUP_FILE_NAME_B =
|
41
|
-
DEST_DBSETUP_FILE_NAME =
|
42
|
-
SETTING_YAML_FILE_NAME =
|
29
|
+
DB_SCHEME_DIR = TEMPLATE_ACRECORD_DIR.join("db_scheme")
|
30
|
+
DB_SCHEME_FILE = DB_SCHEME_DIR.join("db_scheme.yml")
|
31
|
+
SAMPLE_DB_SCHEME_FILE = CONFIG_DIR.join("db_scheme.yml.sample")
|
32
|
+
DB_SCHEME_FILE_NAME = "db_scheme.yml"
|
33
|
+
DB_SCHEME_FILE_NAME_B = "db_scheme"
|
34
|
+
OPTS_FILE_NAME = "opts.tmpl"
|
35
|
+
SAMPLE_OPTS_FILE_NAME = "opts.rb.sample"
|
36
|
+
OPTS_FILE_NAME_B = "opts"
|
37
|
+
DEST_OPTS_FILE_NAME = "opts.rb"
|
38
|
+
DEST_OPTS_FILE_NAME_B = "opts"
|
39
|
+
DBSETUP_FILE_NAME = "dbsetup.tmpl"
|
40
|
+
DBSETUP_FILE_NAME_B = "dbsetup"
|
41
|
+
DEST_DBSETUP_FILE_NAME = "dbsetup.rb"
|
42
|
+
SETTING_YAML_FILE_NAME = "setting.yml"
|
43
43
|
DEST_CONFIG_DIR = Pathname.new(CONFIG_DIR)
|
44
44
|
OPTS_FILE = DB_SCHEME_DIR.join(OPTS_FILE_NAME)
|
45
45
|
SAMPLE_OPTS_FILE = CONFIG_DIR.join(SAMPLE_OPTS_FILE_NAME)
|
@@ -63,7 +63,7 @@ module Arxutils_Sqlite3
|
|
63
63
|
# 削除しないファイル群
|
64
64
|
EXCLUDE_FILES = %w[SETTING_YAML_FILE_NAME].freeze
|
65
65
|
# 作成対象のActiveRecordの子クラスのデフォルトクラス名
|
66
|
-
DEFAULT_MOD =
|
66
|
+
DEFAULT_MOD = "Xenop"
|
67
67
|
|
68
68
|
def default_mod
|
69
69
|
DEFAULT_MOD
|
@@ -171,7 +171,7 @@ module Arxutils_Sqlite3
|
|
171
171
|
def require_opts_file
|
172
172
|
return unless DEST_OPTS_FILE.exist?
|
173
173
|
|
174
|
-
opts_file = File.join(
|
174
|
+
opts_file = File.join("./", DEST_OPTS_FILE_B.to_s)
|
175
175
|
begin
|
176
176
|
require opts_file
|
177
177
|
rescue LoadError
|
@@ -190,7 +190,7 @@ module Arxutils_Sqlite3
|
|
190
190
|
|
191
191
|
# Dbsetupファイル(Rubyスクリプトファイル)のrequire
|
192
192
|
def require_dbsetup_file
|
193
|
-
dbsetup_file = File.join(
|
193
|
+
dbsetup_file = File.join(".", dest_dbsetup_file_b.to_s)
|
194
194
|
begin
|
195
195
|
require dbsetup_file
|
196
196
|
rescue LoadError
|
@@ -289,7 +289,7 @@ module Arxutils_Sqlite3
|
|
289
289
|
|
290
290
|
def make_dbsetup_file(db_scheme_ary, acrecord, _mod, dest_dbsetup_file)
|
291
291
|
scope = Object.new
|
292
|
-
hash0 = { mod_name: acrecord[:module].join(
|
292
|
+
hash0 = { mod_name: acrecord[:module].join("::") }
|
293
293
|
hash = db_scheme_ary[0].merge(hash0)
|
294
294
|
result_content = Ykutils::Erubyx.erubi_render_with_template_file(src_dbsetup_file, scope, hash)
|
295
295
|
|
@@ -1,18 +1,18 @@
|
|
1
1
|
#! -*- encoding : UTF-8 -*-
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
4
|
+
require "fileutils"
|
5
|
+
require "yaml"
|
6
|
+
require "active_record"
|
7
|
+
require "sqlite3"
|
8
|
+
require "ykxutils"
|
9
9
|
|
10
10
|
module Arxutils_Sqlite3
|
11
11
|
module Dbutil
|
12
12
|
# DB操作用ユーティリティクラス
|
13
13
|
class Dbconnect
|
14
14
|
def self.make_log_file_name(dbconfig, log_file_base_name)
|
15
|
-
format(
|
15
|
+
format("%s-%s", dbconfig.to_s, log_file_base_name)
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.db_connect(config, dbconfig, env)
|
@@ -44,9 +44,11 @@ module Arxutils_Sqlite3
|
|
44
44
|
unless @connect_time
|
45
45
|
begin
|
46
46
|
# p "@dbconfig_dest_path=#{@dbconfig_dest_path}"
|
47
|
-
dbconfig = Ykxutils.yaml_load_file_compati(@dbconfig_dest_path)
|
47
|
+
dbconfig, _value = Ykxutils.yaml_load_file_compati(@dbconfig_dest_path)
|
48
48
|
# p "dbconfig=#{dbconfig}"
|
49
49
|
# p "@env=#{@env}"
|
50
|
+
# x = dbconfig[@env]
|
51
|
+
# p x
|
50
52
|
ActiveRecord::Base.establish_connection(dbconfig[@env])
|
51
53
|
ActiveRecord::Base.logger = Logger.new(@log_path)
|
52
54
|
@connect_time = DateTime.now.new_offset
|
@@ -27,7 +27,7 @@ module Arxutils_Sqlite3
|
|
27
27
|
# '/'が区切り文字の文字列で階層処理を実現するクラスの階層構造を表す文字列を持つメソッド/アトリビュートを表すシンボ
|
28
28
|
@hier_symbol = hier_symbol
|
29
29
|
# '/'が区切り文字の文字列で階層処理を実現するクラスのクラス名(DB中のテーブルに対応するActiveRecordの子クラス)
|
30
|
-
@base_klass
|
30
|
+
@base_klass = base_klass
|
31
31
|
# '/'が区切り文字の文字列で階層処理を実現するクラスのカレントに対応するクラス名(DB中のテーブルに対応するActiveRecordの子クラス)
|
32
32
|
@current_klass = current_klass
|
33
33
|
# '/'が区切り文字の文字列で階層処理を実現するクラスのインバリッドに対応するクラス名(DB中のテーブルに対応するActiveRecordの子クラス)
|
@@ -74,10 +74,10 @@ module Arxutils_Sqlite3
|
|
74
74
|
|
75
75
|
dest_parent_row_item = @base_klass.find_by(name: dest_parent_hier)
|
76
76
|
dest_parent_num = if dest_parent_row_item
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
dest_parent_row_item.id
|
78
|
+
else
|
79
|
+
register(dest_parent_hier)
|
80
|
+
end
|
81
81
|
dest_parent_level = get_level_by_child(dest_parent_num)
|
82
82
|
|
83
83
|
# srcの親をdest_parentにする
|
@@ -98,7 +98,7 @@ module Arxutils_Sqlite3
|
|
98
98
|
def register_parent(hier_ary, child_num, level)
|
99
99
|
hier_ary.pop
|
100
100
|
parent_hier_ary = hier_ary
|
101
|
-
parent_hier = parent_hier_ary.join(
|
101
|
+
parent_hier = parent_hier_ary.join("/")
|
102
102
|
parent_num = register(parent_hier)
|
103
103
|
hs = { parent_id: parent_num, child_id: child_num, level: level }
|
104
104
|
@hier_klass.create(hs)
|
@@ -106,7 +106,7 @@ module Arxutils_Sqlite3
|
|
106
106
|
|
107
107
|
# 文字列で指定した階層(/を区切り文字として持つ)をhier_klassに登録
|
108
108
|
def register(hier)
|
109
|
-
hier_ary = hier.split(
|
109
|
+
hier_ary = hier.split("/")
|
110
110
|
level = get_level_by_array(hier_ary)
|
111
111
|
|
112
112
|
# もしhier_aryがnilだけを1個持つ配列、または空文字列だけを1個もつ配列であれば、hier_nameは空文字列になる
|
@@ -187,7 +187,7 @@ module Arxutils_Sqlite3
|
|
187
187
|
|
188
188
|
# 階層を表すデータ構造から階層の名前を得る
|
189
189
|
def get_name(items_row)
|
190
|
-
items_row ? items_row.name.split(
|
190
|
+
items_row ? items_row.name.split("/").pop : ""
|
191
191
|
end
|
192
192
|
|
193
193
|
# 階層を表すデータ構造で指定された階層の下部階層の名前を調整する
|
@@ -226,7 +226,7 @@ module Arxutils_Sqlite3
|
|
226
226
|
|
227
227
|
# 文字列で指定された親の階層の下の子の名前から、子の名前を作成
|
228
228
|
def make_hier(parent_hier, name)
|
229
|
-
[parent_hier, name].join(
|
229
|
+
[parent_hier, name].join("/")
|
230
230
|
end
|
231
231
|
end
|
232
232
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# require "arxutils_sqlite3"
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "ykutils"
|
5
|
+
require "fileutils"
|
6
6
|
# require "active_support"
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
7
|
+
require "active_record"
|
8
|
+
require "active_record/migration"
|
9
|
+
require "pp"
|
10
10
|
|
11
11
|
# ActiveRecord用ユーティリティモジュール
|
12
12
|
module Arxutils_Sqlite3
|
@@ -60,7 +60,7 @@ module Arxutils_Sqlite3
|
|
60
60
|
def delete_migrate_and_config_and_db
|
61
61
|
# def delete_migrate_and_config
|
62
62
|
delete_migrate
|
63
|
-
Dir.glob(File.join(@dest_config_dir,
|
63
|
+
Dir.glob(File.join(@dest_config_dir, "*")).each do |x|
|
64
64
|
basename = File.basename(x)
|
65
65
|
ret = !@config.exclude_file?(basename)
|
66
66
|
ret_file = File.file?(x)
|
@@ -79,14 +79,14 @@ module Arxutils_Sqlite3
|
|
79
79
|
def delete_migrate
|
80
80
|
return unless @migrate_dir
|
81
81
|
|
82
|
-
Dir.glob(File.join(@migrate_dir,
|
82
|
+
Dir.glob(File.join(@migrate_dir, "*")).each do |x|
|
83
83
|
FileUtils.rm(x) if File.file?(x)
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
87
|
# DBファイルの削除
|
88
88
|
def delete_db
|
89
|
-
Dir.glob(File.join(@db_dir,
|
89
|
+
Dir.glob(File.join(@db_dir, "*")).each do |x|
|
90
90
|
FileUtils.rm(x) if File.file?(x)
|
91
91
|
end
|
92
92
|
end
|
@@ -108,12 +108,12 @@ module Arxutils_Sqlite3
|
|
108
108
|
if content_array.find { |x| !x.nil? }
|
109
109
|
# p "####### 1"
|
110
110
|
data_count = {
|
111
|
-
count_classname:
|
112
|
-
need_count_class_plural: need_count_class_plural
|
111
|
+
count_classname: "Count",
|
112
|
+
need_count_class_plural: need_count_class_plural,
|
113
113
|
}
|
114
114
|
# p "data_count=#{data_count}"
|
115
115
|
ary = content_array.collect { |x| x[:content] }.flatten
|
116
|
-
count_content = convert_count_class_acrecord(data_count,
|
116
|
+
count_content = convert_count_class_acrecord(data_count, "acrecord_count.tmpl")
|
117
117
|
ary.unshift(count_content)
|
118
118
|
content_array = ary
|
119
119
|
end
|
@@ -134,7 +134,7 @@ module Arxutils_Sqlite3
|
|
134
134
|
def make_content_array
|
135
135
|
# スキーマ設定配列から、acrecordのmigrate用のスクリプトの内容(ハッシュ形式)の配列を作成する
|
136
136
|
acrecords = @db_scheme_ary.map do |x|
|
137
|
-
make_acrecord(x,
|
137
|
+
make_acrecord(x, "count")
|
138
138
|
end
|
139
139
|
acrecords.select { |x| x.size.positive? }
|
140
140
|
end
|
@@ -155,7 +155,7 @@ module Arxutils_Sqlite3
|
|
155
155
|
def make_dbconfig(data)
|
156
156
|
content = convert(data, @src_config_path, @dbconfig_src_fname)
|
157
157
|
File.open(
|
158
|
-
@dbconfig_dest_path,
|
158
|
+
@dbconfig_dest_path, "w:utf-8"
|
159
159
|
) do |f|
|
160
160
|
f.puts(content)
|
161
161
|
end
|
@@ -171,8 +171,8 @@ module Arxutils_Sqlite3
|
|
171
171
|
# 指定フィールドのフィールド名に対応したテンプレートファイルを用いて、acrecord設定を作成
|
172
172
|
data[:flist].each_with_object({ content: [], need_count_class: nil }) do |field_name, s|
|
173
173
|
case field_name
|
174
|
-
when
|
175
|
-
name_base =
|
174
|
+
when "base", "noitem"
|
175
|
+
name_base = "acrecord"
|
176
176
|
# data[:acrecord]がnilに設定されていたら改めて空の配列を設定
|
177
177
|
data[:acrecord] = [] unless data[:acrecord]
|
178
178
|
else
|
@@ -200,13 +200,13 @@ module Arxutils_Sqlite3
|
|
200
200
|
# migrationのスクリプトをファイル出力する
|
201
201
|
def output_script(idy, kind, content, classname_downcase)
|
202
202
|
additional = case kind
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
fname = File.join(@migrate_dir, format(
|
209
|
-
File.open(fname,
|
203
|
+
when "base", "noitem"
|
204
|
+
""
|
205
|
+
else
|
206
|
+
kind
|
207
|
+
end
|
208
|
+
fname = File.join(@migrate_dir, format("%03d_create_%s%s.rb", idy, additional, classname_downcase))
|
209
|
+
File.open(fname, "w", **{ encoding: Encoding::UTF_8 }) do |f|
|
210
210
|
f.puts(content)
|
211
211
|
end
|
212
212
|
end
|
@@ -218,13 +218,13 @@ module Arxutils_Sqlite3
|
|
218
218
|
fpath = File.join(dir, fname)
|
219
219
|
ret = :SUCCESS
|
220
220
|
begin
|
221
|
-
File.open(fpath,
|
221
|
+
File.open(fpath, "w") do |file|
|
222
222
|
acrecord_config[:module].map { |mod| file.puts("module #{mod}") }
|
223
223
|
content_array.map do |x|
|
224
224
|
file.puts x
|
225
|
-
file.puts
|
225
|
+
file.puts ""
|
226
226
|
end
|
227
|
-
acrecord_config[:module].map { |_mod| file.puts(
|
227
|
+
acrecord_config[:module].map { |_mod| file.puts("end") }
|
228
228
|
end
|
229
229
|
rescue StandardError
|
230
230
|
ret = :StandardError
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Defining a task called default that depends on the tasks setup, makeconfig, migrate, and acr.
|
4
|
-
require
|
4
|
+
require "arxutils_sqlite3"
|
5
5
|
config = Arxutils_Sqlite3::Config.new
|
6
6
|
|
7
7
|
mod = nil
|
@@ -9,7 +9,7 @@ setting = config.load_setting_yaml_file
|
|
9
9
|
mod = setting[:mod]
|
10
10
|
mod = config.default_mod if mod.nil?
|
11
11
|
|
12
|
-
desc_arxutils_sqlite3 =
|
12
|
+
desc_arxutils_sqlite3 = "setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr"
|
13
13
|
|
14
14
|
desc desc_arxutils_sqlite3.to_s
|
15
15
|
task arxutils_sqlite3: %w[arx:setup arx:copy_db_scheme arx:copy_opts arx:makeconfig arx:make_migrate_script arx:migrate arx:acr]
|
@@ -17,78 +17,78 @@ task arxutils_sqlite3: %w[arx:setup arx:copy_db_scheme arx:copy_opts arx:makecon
|
|
17
17
|
desc desc_arxutils_sqlite3.to_s
|
18
18
|
task 'arx:arxutils_sqlite3': %w[arxutils_sqlite3]
|
19
19
|
|
20
|
-
desc
|
20
|
+
desc "delete setup copy_db_scheme copy_opts makeconfig make_migrate_script migrate acr"
|
21
21
|
task 'arx:bootstrap': %w[arx:delete arxutils_sqlite3]
|
22
22
|
|
23
|
-
desc
|
23
|
+
desc "migrate acr"
|
24
24
|
task 'arx:ma': %w[arx:migrate arx:acr]
|
25
25
|
|
26
|
-
desc
|
26
|
+
desc "delete_db"
|
27
27
|
task 'arx:b': %w[arx:delete_db]
|
28
28
|
|
29
|
-
desc
|
29
|
+
desc "delete setting.yaml"
|
30
30
|
task 'arx:ds': %w[arx:delete_setting]
|
31
31
|
|
32
32
|
# コマンドラインで指定したクラス名を含むオプション指定用ハッシュの定義を含むRubyスクリ
|
33
33
|
# プトファイルの生成
|
34
34
|
desc "produce setting.yml, db_scheme.yml.sample and opts.rb.sample with class name #{mod}"
|
35
|
-
task
|
35
|
+
task "arx:setup" do
|
36
36
|
sh "bundle exec arxutils_sqlite3 --cmd=s --mod=#{mod}"
|
37
37
|
end
|
38
38
|
|
39
|
-
desc
|
40
|
-
task
|
41
|
-
sh
|
39
|
+
desc "copy from db_scheme.yml.sample to db_scheme.yml"
|
40
|
+
task "arx:copy_db_scheme" do
|
41
|
+
sh "bundle exec arxutils_sqlite3 --cmd=cds"
|
42
42
|
end
|
43
43
|
|
44
|
-
desc
|
45
|
-
task
|
46
|
-
sh
|
44
|
+
desc "copy from opts.rb.sample to opts.rb"
|
45
|
+
task "arx:copy_opts" do
|
46
|
+
sh "bundle exec arxutils_sqlite3 --cmd=co"
|
47
47
|
end
|
48
48
|
|
49
49
|
# DB構成情報の生成
|
50
|
-
desc
|
51
|
-
task
|
52
|
-
sh
|
50
|
+
desc "produce sqlite3.yml"
|
51
|
+
task "arx:makeconfig" do
|
52
|
+
sh "bundle exec arxutils_sqlite3 --cmd=c"
|
53
53
|
end
|
54
54
|
|
55
55
|
# マイグレート用スクリプトファイルの生成
|
56
|
-
desc
|
57
|
-
task
|
58
|
-
sh
|
56
|
+
desc "produce migration scripts"
|
57
|
+
task "arx:make_migrate_script" do
|
58
|
+
sh "bundle exec arxutils_sqlite3 --cmd=f --yaml=config/db_scheme.yml"
|
59
59
|
end
|
60
60
|
# マイグレートの実行
|
61
|
-
desc
|
62
|
-
task
|
63
|
-
sh
|
61
|
+
desc "execute migration"
|
62
|
+
task "arx:migrate" do
|
63
|
+
sh "bundle exec arxutils_sqlite3 --cmd=m"
|
64
64
|
end
|
65
65
|
|
66
|
-
desc
|
67
|
-
task
|
68
|
-
sh
|
66
|
+
desc "call ActiveRecord instance method"
|
67
|
+
task "arx:acr" do
|
68
|
+
sh "bundle exec arxutils_sqlite3 --cmd=a"
|
69
69
|
end
|
70
70
|
|
71
|
-
desc
|
72
|
-
task
|
73
|
-
sh
|
71
|
+
desc "delete configuration files adn migration scripts and db files"
|
72
|
+
task "arx:delete" do
|
73
|
+
sh "bundle exec arxutils_sqlite3 --cmd=del"
|
74
74
|
end
|
75
75
|
|
76
|
-
desc
|
77
|
-
task
|
78
|
-
sh
|
76
|
+
desc "delete configuration files adn migration scripts and db files"
|
77
|
+
task "arx:clean" do
|
78
|
+
sh "bundle exec arxutils_sqlite3 --cmd=d"
|
79
79
|
end
|
80
80
|
|
81
|
-
desc
|
82
|
-
task
|
83
|
-
sh
|
81
|
+
desc "delete db files"
|
82
|
+
task "arx:delete_db" do
|
83
|
+
sh "bundle exec arxutils_sqlite3 --cmd=b"
|
84
84
|
end
|
85
85
|
|
86
|
-
desc
|
87
|
-
task
|
88
|
-
sh
|
86
|
+
desc "delete setting yaml"
|
87
|
+
task "arx:delete_setting" do
|
88
|
+
sh "bundle exec arxutils_sqlite3 --cmd=y"
|
89
89
|
end
|
90
90
|
|
91
|
-
desc
|
92
|
-
task
|
93
|
-
sh
|
91
|
+
desc "delete migrate scripts"
|
92
|
+
task "arx:delete_migrate" do
|
93
|
+
sh "bundle exec arxutils_sqlite3 --cmd=dm"
|
94
94
|
end
|
data/lib/arxutils_sqlite3.rb
CHANGED
@@ -1,28 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
# require "ykutils"
|
4
|
+
require "ykxutils"
|
5
5
|
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
6
|
+
require "bigdecimal"
|
7
|
+
require "active_support"
|
8
|
+
require "active_support/core_ext"
|
9
|
+
require "active_record"
|
10
|
+
require "pathname"
|
11
11
|
|
12
12
|
module Arxutils_Sqlite3
|
13
13
|
TOP_DIR = Pathname(__FILE__).parent
|
14
|
+
|
14
15
|
class Error < StandardError; end
|
16
|
+
|
15
17
|
# Your code goes here...
|
16
18
|
end
|
17
19
|
|
18
|
-
require_relative
|
19
|
-
require_relative
|
20
|
-
require_relative
|
20
|
+
require_relative "arxutils_sqlite3/dbutil"
|
21
|
+
require_relative "arxutils_sqlite3/config"
|
22
|
+
require_relative "arxutils_sqlite3/cli"
|
21
23
|
|
22
|
-
require_relative
|
23
|
-
require_relative
|
24
|
-
require_relative
|
25
|
-
require_relative
|
26
|
-
require_relative
|
27
|
-
require_relative
|
28
|
-
require_relative
|
24
|
+
require_relative "arxutils_sqlite3/version"
|
25
|
+
require_relative "arxutils_sqlite3/arx"
|
26
|
+
require_relative "arxutils_sqlite3/transactstate"
|
27
|
+
require_relative "arxutils_sqlite3/hier"
|
28
|
+
require_relative "arxutils_sqlite3/migrate"
|
29
|
+
require_relative "arxutils_sqlite3/util"
|
30
|
+
require_relative "dbacrecord"
|