arxutils_sqlite3 0.1.43 → 0.1.44

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: 3b67a7e8b8c74b99735830d7a77ed35c489a2f94334ed2e9d648e28a1dd7e619
4
- data.tar.gz: daa960e9e9ed7f7a4e4457e8c1d8cc986abfea6a2ea0bff25c6da7ad3db9dd0c
3
+ metadata.gz: 3b5f6ede0a6841ea546179192fe18757e9f35669baae096b5c7f0ed9ec79c687
4
+ data.tar.gz: 592da7e2edf26c4e4a41e7d9d1ed74ebf67ffdb7dddc6e2a2732f3643a545570
5
5
  SHA512:
6
- metadata.gz: e213121d613bfb5445a2b701dabfb7718eec7a3a34b034c6bfe6a979d7302dbe64c2b8ed921f09f5ad49039e9ea782bdd1f115065dd5214267f549bb61354eae
7
- data.tar.gz: f3ce79fb5d0162c515705f5132c143dc37dd17f438b3599871567e96a717b19f951cd2f82bfc6e320d70bd5fbb8932d0359d3c9466ba2743a5f128fd0c89a979
6
+ metadata.gz: 3ade5c9990a6c5553a71b62adda473541415bdba26b1c6c7162d2d588e66750d9ebe80367c8efa7bbccff064aa4410a18138fc254a571f14ea27ca2e07b03096
7
+ data.tar.gz: aedfc8af290c382f5cd2eb4c67dde8b94ef533de95ee5607236a480c0cf0443a1f5a249258efaefdc35193f681f44ab6ce9502232ba388967c85a0eb6e8bd615
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.bindir = "exe"
33
33
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
- p spec.executables
34
+ #p spec.executables
35
35
  spec.require_paths = ["lib"]
36
36
  spec.add_runtime_dependency "activesupport"
37
37
  # spec.add_runtime_dependency "erb"
data/exe/arxutils_sqlite3 CHANGED
@@ -31,41 +31,6 @@ if File.exist?(Arxutils_Sqlite3::DEST_DBSETUP_FILE)
31
31
  end
32
32
  end
33
33
 
34
-
35
- def prepare_for_migrate(env, db_scheme_ary, db_dir, dbconfig_dest_path, opts)
36
- migrate_base_dir = Arxutils_Sqlite3::Dbutil::MIGRATE_DIR
37
- # migrate用スクリプト格納ディレクトリへのパス
38
- migrate_dir = File.join(db_dir, migrate_base_dir)
39
- # DB構成ファイルの出力先ディレクトリ
40
- dest_config_dir = Arxutils_Sqlite3::Dbutil::CONFIG_DIR
41
- dbconfig_src_fname = "#{opts["dbconfig"]}.tmpl"
42
- p "dbconfig_dest_path=#{dbconfig_dest_path}"
43
- relation = opts[:relation]
44
- mig = Arxutils_Sqlite3::Migrate.new(
45
- dbconfig_dest_path,
46
- dbconfig_src_fname,
47
- migrate_dir,
48
- db_dir,
49
- db_scheme_ary,
50
- relation,
51
- opts)
52
- end
53
-
54
- def make_log_path(db_dir, dbconfig)
55
- log_path = ""
56
- log_fname = Arxutils_Sqlite3::Dbutil::Dbconnect.make_log_file_name(
57
- dbconfig, Arxutils_Sqlite3::Dbutil::DATABASELOG)
58
- if db_dir && log_fname
59
- # DB用ログファイルへのパス
60
- log_path = File.join(db_dir, log_fname)
61
- end
62
- log_path
63
- end
64
-
65
- def make_dbconfig_path(config_dir, dbconfig)
66
- File.join( config_dir, "#{dbconfig}.yml")
67
- end
68
-
69
34
  banner = "Usage: bundle exec ruby exe/makemigrate --cmd=(s|c|m|i|d) -y yaml_file --klass=class"
70
35
 
71
36
  opts = @opts ? @opts : {}
@@ -103,9 +68,9 @@ when "c"
103
68
  db_dir = Arxutils_Sqlite3::Dbutil::DB_DIR
104
69
  config_dir = Arxutils_Sqlite3::Dbutil::CONFIG_DIR
105
70
  # DB構成ファイル名
106
- dbconfig_path = make_dbconfig_path(config_dir, opts["dbconfig"])
71
+ dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, opts["dbconfig"])
107
72
 
108
- mig = prepare_for_migrate(env, db_scheme_ary, db_dir, dbconfig_path, opts)
73
+ mig = Arxutils_Sqlite3::Util.prepare_for_migrate(env, db_scheme_ary, db_dir, dbconfig_path, opts)
109
74
  mig.make_dbconfig(opts)
110
75
 
111
76
  when "m"
@@ -130,10 +95,10 @@ when "m"
130
95
 
131
96
  config_dir = Arxutils_Sqlite3::Dbutil::CONFIG_DIR
132
97
  # DB構成ファイル名
133
- dbconfig_path = make_dbconfig_path(config_dir, opts["dbconfig"])
98
+ dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, opts["dbconfig"])
134
99
  # DBログファイルへのパス
135
- log_path = make_log_path(db_dir, opts["dbconfig"])
136
- mig = prepare_for_migrate(env, db_scheme_ary, db_dir, dbconfig_path, opts)
100
+ log_path = Arxutils_Sqlite3::Util.make_log_path(db_dir, opts["dbconfig"])
101
+ mig = Arxutils_Sqlite3::Util.prepare_for_migrate(env, db_scheme_ary, db_dir, dbconfig_path, opts)
137
102
  mig.process
138
103
  dbconnect = Arxutils_Sqlite3::Dbutil::Dbconnect.new(
139
104
  dbconfig_path,
@@ -141,7 +106,7 @@ when "m"
141
106
  log_path
142
107
  )
143
108
  connect_time = dbconnect.connect
144
- p "connect_time=#{connect_time}"
109
+ #p "connect_time=#{connect_time}"
145
110
  ActiveRecord::MigrationContext.new(mig.migrate_dir, ActiveRecord::SchemaMigration).up
146
111
 
147
112
  when "i"
@@ -151,9 +116,9 @@ when "i"
151
116
 
152
117
  config_dir = Arxutils_Sqlite3::Dbutil::CONFIG_DIR
153
118
  # DB構成ファイルへのパス
154
- dbconfig_dest_path = make_dbconfig_path(config_dir, opts["dbconfig"])
119
+ dbconfig_dest_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, opts["dbconfig"])
155
120
  # DBログファイルへのパス
156
- log_path = make_log_path(db_dir, opts["dbconfig"])
121
+ log_path = Arxutils_Sqlite3::Util.make_log_path(db_dir, opts["dbconfig"])
157
122
  dbconnect = Arxutils_Sqlite3::Dbutil::Dbconnect.new(
158
123
  dbconfig_dest_path,
159
124
  env,
@@ -165,12 +130,11 @@ when "i"
165
130
 
166
131
  when "d"
167
132
  db_scheme_ary = nil
168
- mig = repare_for_migrate(env, db_scheme_ary, opts)
133
+ mig = Arxutils_Sqlite3::Util.repare_for_migrate(env, db_scheme_ary, opts)
169
134
  mig.delete_migrate_config_and_db
170
135
 
171
136
  else
172
137
  puts "Invalid command(#{opts["cmd"]}) specified!!"
173
138
  end
174
-
175
139
  #
176
140
 
@@ -50,10 +50,10 @@ module Arxutils_Sqlite3
50
50
  def connect
51
51
  unless @connect_time
52
52
  begin
53
- p "@dbconfig_dest_path=#{@dbconfig_dest_path}"
53
+ #p "@dbconfig_dest_path=#{@dbconfig_dest_path}"
54
54
  dbconfig = Ykxutils.yaml_load_file_compati(@dbconfig_dest_path)
55
- p "dbconfig=#{dbconfig}"
56
- p "@env=#{@env}"
55
+ #p "dbconfig=#{dbconfig}"
56
+ #p "@env=#{@env}"
57
57
  ActiveRecord::Base.establish_connection(dbconfig[@env])
58
58
  ActiveRecord::Base.logger = Logger.new(@log_path)
59
59
  @connect_time = DateTime.now.new_offset
@@ -0,0 +1,39 @@
1
+ module Arxutils_Sqlite3
2
+ class Util
3
+ # migrateの準備
4
+ def self.prepare_for_migrate(env, db_scheme_ary, db_dir, dbconfig_dest_path, opts)
5
+ migrate_base_dir = Dbutil::MIGRATE_DIR
6
+ # migrate用スクリプト格納ディレクトリへのパス
7
+ migrate_dir = File.join(db_dir, migrate_base_dir)
8
+ # DB構成ファイルの出力先ディレクトリ
9
+ dest_config_dir = Dbutil::CONFIG_DIR
10
+ dbconfig_src_fname = "#{opts["dbconfig"]}.tmpl"
11
+ relation = opts[:relation]
12
+ mig = Migrate.new(
13
+ dbconfig_dest_path,
14
+ dbconfig_src_fname,
15
+ migrate_dir,
16
+ db_dir,
17
+ db_scheme_ary,
18
+ relation,
19
+ opts)
20
+ end
21
+
22
+ # DBログファイルへのパスの作成
23
+ def self.make_log_path(db_dir, dbconfig)
24
+ log_path = ""
25
+ log_fname = Dbutil::Dbconnect.make_log_file_name(
26
+ dbconfig, Dbutil::DATABASELOG)
27
+ if db_dir && log_fname
28
+ # DB用ログファイルへのパス
29
+ log_path = File.join(db_dir, log_fname)
30
+ end
31
+ log_path
32
+ end
33
+
34
+ # DB構成ファイルへのパスの作成
35
+ def self.make_dbconfig_path(config_dir, dbconfig)
36
+ File.join( config_dir, "#{dbconfig}.yml")
37
+ end
38
+ end
39
+ end
@@ -1,4 +1,4 @@
1
1
  module Arxutils_Sqlite3
2
2
  # バージョン番号
3
- VERSION = "0.1.43".freeze
3
+ VERSION = "0.1.44".freeze
4
4
  end
@@ -15,6 +15,7 @@ require_relative "arxutils_sqlite3/hier"
15
15
  require_relative "arxutils_sqlite3/migrate"
16
16
  require_relative "arxutils_sqlite3/dbutil"
17
17
  require_relative "arxutils_sqlite3/migrate"
18
+ require_relative "arxutils_sqlite3/util"
18
19
 
19
20
  module Arxutils_Sqlite3
20
21
  TOP_DIR = Pathname(__FILE__).parent
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arxutils_sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.43
4
+ version: 0.1.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - yasuo kominami
@@ -222,6 +222,7 @@ files:
222
222
  - lib/arxutils_sqlite3/hier.rb
223
223
  - lib/arxutils_sqlite3/migrate.rb
224
224
  - lib/arxutils_sqlite3/transactstate.rb
225
+ - lib/arxutils_sqlite3/util.rb
225
226
  - lib/arxutils_sqlite3/version.rb
226
227
  - lib/template/config/mysql.tmpl
227
228
  - lib/template/config/sqlite3.tmpl