arxutils_sqlite3 0.1.44 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Rakefile +19 -2
- data/exe/arxutils_sqlite3 +52 -83
- data/lib/arxutils_sqlite3/config.rb +242 -0
- data/lib/arxutils_sqlite3/dbutil/dbconnect.rb +14 -0
- data/lib/arxutils_sqlite3/dbutil.rb +0 -10
- data/lib/arxutils_sqlite3/migrate.rb +20 -23
- data/lib/arxutils_sqlite3/util.rb +2 -21
- data/lib/arxutils_sqlite3/version.rb +1 -1
- data/lib/arxutils_sqlite3.rb +9 -24
- data/lib/template/relation/db_scheme/dbsetup.rb +1 -1
- data/lib/template/relation/db_scheme/opts.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7186c960b82d6762345ea6f0d8a52282025c001a52a4a9398ca7c7f15e4c21eb
         | 
| 4 | 
            +
              data.tar.gz: 859c88d305e3b9227a9ed1464d5a254d13b096ccc30447acb6043cd7fd73a71f
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 357450af1e2fc3051d4c0b9c3289022a39b779de484db79ca3576baff144c5a8c25529f181dc5e77ca0a6de5453d20bfae409898dc84d430cd46afaea48d8c21
         | 
| 7 | 
            +
              data.tar.gz: 00142e1c2494bea9a3158628f778f553aae4ac1d4b02a18c7e576aea2b947b47f3ab5df1ffc200d58c9f84d4570ac916076b4acb41437d6e0be64179e668604b
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/Rakefile
    CHANGED
    
    | @@ -11,9 +11,26 @@ task default: :test | |
| 11 11 | 
             
            =end
         | 
| 12 12 |  | 
| 13 13 | 
             
            #=begin
         | 
| 14 | 
            -
            task default | 
| 14 | 
            +
            # Defining a task called default that depends on the tasks setup, makeconfig, migrate, and integrate.
         | 
| 15 | 
            +
            task default: %w[delete setup makeconfig migrate integrate]
         | 
| 15 16 |  | 
| 16 | 
            -
            task  | 
| 17 | 
            +
            task scmi: %w[setup makeconfig migrate integrate]
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            task dsc: %w[delete setup makeconfig]
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            task ds: %w[delete setup]
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            task s: %w[setup]
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            task sc: %w[setup makeconfig]
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            task dscm: %w[delete setup makeconfig migrate]
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            task scm: %w[setup makeconfig migrate]
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            task dscmi: %w[delete setup makeconfig migrate integrate]
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            task scmi: %w[setup makeconfig migrate integrate]
         | 
| 17 34 |  | 
| 18 35 | 
             
            # コマンドラインで指定したクラス名を含むオプション指定用ハッシュの定義を含むRubyスクリ
         | 
| 19 36 | 
             
            # プトファイルの生成
         | 
    
        data/exe/arxutils_sqlite3
    CHANGED
    
    | @@ -6,14 +6,9 @@ require "pp" | |
| 6 6 | 
             
            require "ykutils"
         | 
| 7 7 | 
             
            require "ykxutils"
         | 
| 8 8 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
                require opts_file
         | 
| 13 | 
            -
              rescue LoadError => ex
         | 
| 14 | 
            -
                pp ex.message
         | 
| 15 | 
            -
              end
         | 
| 16 | 
            -
            end
         | 
| 9 | 
            +
            config = Arxutils_Sqlite3::Config.new
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            config.require_opts_file
         | 
| 17 12 |  | 
| 18 13 | 
             
            begin
         | 
| 19 14 | 
             
              require "dbrelation"
         | 
| @@ -21,21 +16,18 @@ rescue LoadError => ex | |
| 21 16 | 
             
              pp ex.message
         | 
| 22 17 | 
             
            end
         | 
| 23 18 |  | 
| 19 | 
            +
             | 
| 20 | 
            +
            klass = nil
         | 
| 21 | 
            +
            setting = config.load_setting_yaml_file
         | 
| 22 | 
            +
            klass = setting[:klass]
         | 
| 23 | 
            +
             | 
| 24 24 | 
             
            # DBセットアップクラス
         | 
| 25 | 
            -
             | 
| 26 | 
            -
              dbsetup_file = File.join("./" , Arxutils_Sqlite3::DEST_DBSETUP_FILE_2.to_s)
         | 
| 27 | 
            -
              begin
         | 
| 28 | 
            -
                require dbsetup_file
         | 
| 29 | 
            -
              rescue LoadError => ex
         | 
| 30 | 
            -
                pp ex.message
         | 
| 31 | 
            -
              end
         | 
| 32 | 
            -
            end
         | 
| 25 | 
            +
            config.require_dbsetup_file
         | 
| 33 26 |  | 
| 34 27 | 
             
            banner = "Usage: bundle exec ruby exe/makemigrate --cmd=(s|c|m|i|d) -y yaml_file --klass=class"
         | 
| 35 28 |  | 
| 36 29 | 
             
            opts = @opts ? @opts : {}
         | 
| 37 | 
            -
             | 
| 38 | 
            -
            opts["dbconfig"] = Arxutils_Sqlite3::Dbutil::DBCONFIG_SQLITE3
         | 
| 30 | 
            +
            opts["dbconfig"] = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3
         | 
| 39 31 |  | 
| 40 32 | 
             
            Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Arxutils_Sqlite3::VERSION, nil) do |parser|
         | 
| 41 33 | 
             
              parser.on("--cmd X", %w[s c m i d]) { |x| opts["cmd"] = x }
         | 
| @@ -48,93 +40,70 @@ env ||= "production" | |
| 48 40 |  | 
| 49 41 | 
             
            case opts["cmd"]
         | 
| 50 42 | 
             
            when "s"
         | 
| 51 | 
            -
               | 
| 43 | 
            +
              config.check_file_exist(Arxutils_Sqlite3::Config::DEST_OPTS_FILE, banner, 10)
         | 
| 44 | 
            +
             | 
| 52 45 | 
             
              if opts["klass"].nil? || opts["klass"].strip == ""
         | 
| 53 46 | 
             
                puts banner
         | 
| 54 | 
            -
                exit  | 
| 47 | 
            +
                exit 20
         | 
| 55 48 | 
             
              end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
               | 
| 58 | 
            -
               | 
| 59 | 
            -
               | 
| 60 | 
            -
             | 
| 61 | 
            -
              File.open(Arxutils_Sqlite3::DEST_OPTS_FILE, "w"){|file|
         | 
| 62 | 
            -
                file.write(result_content)
         | 
| 63 | 
            -
              }
         | 
| 49 | 
            +
              klass = opts["klass"]
         | 
| 50 | 
            +
              config.make_config_directory
         | 
| 51 | 
            +
              config.setup_db_scheme_file
         | 
| 52 | 
            +
              config.setup_opts_file(klass)
         | 
| 53 | 
            +
              config.setup_setting_yaml_file(klass)
         | 
| 64 54 | 
             
              db_scheme_ary = nil
         | 
| 65 55 |  | 
| 66 56 | 
             
            when "c"
         | 
| 67 57 | 
             
              db_scheme_ary = nil
         | 
| 68 | 
            -
               | 
| 69 | 
            -
               | 
| 70 | 
            -
               | 
| 71 | 
            -
               | 
| 72 | 
            -
             | 
| 73 | 
            -
              mig = Arxutils_Sqlite3::Util.prepare_for_migrate(env, db_scheme_ary, db_dir, dbconfig_path, opts)
         | 
| 58 | 
            +
              dbconfig = opts["dbconfig"]
         | 
| 59 | 
            +
              replation = opts["replation"]
         | 
| 60 | 
            +
              dbconfig_path = config.make_dbconfig_path(dbconfig)
         | 
| 61 | 
            +
              config.check_file_exist(dbconfig_path, banner, 30)
         | 
| 62 | 
            +
              mig = config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig, replation)
         | 
| 74 63 | 
             
              mig.make_dbconfig(opts)
         | 
| 75 64 |  | 
| 76 65 | 
             
            when "m"
         | 
| 77 | 
            -
               | 
| 66 | 
            +
              yaml_fname = opts["yaml"]
         | 
| 67 | 
            +
              relation = opts[:relation]
         | 
| 68 | 
            +
              dbconfig = opts["dbconfig"]
         | 
| 69 | 
            +
             | 
| 70 | 
            +
              if yaml_fname.nil? || yaml_fname.strip == ""
         | 
| 78 71 | 
             
                puts banner
         | 
| 79 | 
            -
                exit  | 
| 72 | 
            +
                exit 40
         | 
| 80 73 | 
             
              end
         | 
| 74 | 
            +
              yaml_pn = Pathname.new(yaml_fname)
         | 
| 75 | 
            +
              config.check_file_not_exist(yaml_pn, banner, 55)
         | 
| 76 | 
            +
              db_scheme_ary = YAML.load_file( yaml_pn )
         | 
| 77 | 
            +
             | 
| 78 | 
            +
              dest_dbsetup_file = config.get_dest_dbsetup_file
         | 
| 79 | 
            +
              config.check_file_exist(dest_dbsetup_file, banner, 50)
         | 
| 80 | 
            +
             | 
| 81 | 
            +
              config.make_dbsetup_file(db_scheme_ary, relation, klass, dest_dbsetup_file)
         | 
| 82 | 
            +
             | 
| 83 | 
            +
              connect_time = Arxutils_Sqlite3::Dbutil::Dbconnect.db_connect(config, dbconfig, env)
         | 
| 81 84 |  | 
| 82 | 
            -
               | 
| 83 | 
            -
               | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
              hash0 = {module_name: opts[:relation][:module].join("::")}
         | 
| 88 | 
            -
              hash = db_scheme_ary[0].merge( hash0 )
         | 
| 89 | 
            -
              result_content = Ykutils::Erubyx.erubi_render_with_template_file(Arxutils_Sqlite3::DBSETUP_FILE, scope, hash)
         | 
| 90 | 
            -
             | 
| 91 | 
            -
              File.open(Arxutils_Sqlite3::DEST_DBSETUP_FILE, "w"){|file|
         | 
| 92 | 
            -
                file.write(result_content)
         | 
| 93 | 
            -
              }
         | 
| 94 | 
            -
              db_dir = Arxutils_Sqlite3::Dbutil::DB_DIR
         | 
| 95 | 
            -
             | 
| 96 | 
            -
              config_dir = Arxutils_Sqlite3::Dbutil::CONFIG_DIR
         | 
| 97 | 
            -
              # DB構成ファイル名
         | 
| 98 | 
            -
              dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, opts["dbconfig"])
         | 
| 99 | 
            -
              # DBログファイルへのパス
         | 
| 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)
         | 
| 102 | 
            -
              mig.process
         | 
| 103 | 
            -
              dbconnect = Arxutils_Sqlite3::Dbutil::Dbconnect.new(
         | 
| 104 | 
            -
                dbconfig_path,
         | 
| 105 | 
            -
                env,
         | 
| 106 | 
            -
                log_path
         | 
| 107 | 
            -
              )
         | 
| 108 | 
            -
              connect_time = dbconnect.connect
         | 
| 109 | 
            -
              #p "connect_time=#{connect_time}"
         | 
| 85 | 
            +
              # マイグレーション用スクリプトの生成、relationのクラス定義ファイルの生成
         | 
| 86 | 
            +
              mig = config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig, relation)
         | 
| 87 | 
            +
              mig.output
         | 
| 88 | 
            +
             | 
| 89 | 
            +
              # マイグレーション実行
         | 
| 110 90 | 
             
              ActiveRecord::MigrationContext.new(mig.migrate_dir, ActiveRecord::SchemaMigration).up
         | 
| 111 91 |  | 
| 112 92 | 
             
            when "i"
         | 
| 113 | 
            -
               | 
| 114 | 
            -
               | 
| 115 | 
            -
              db_dir = Arxutils_Sqlite3::Dbutil::DB_DIR
         | 
| 116 | 
            -
             | 
| 117 | 
            -
              config_dir = Arxutils_Sqlite3::Dbutil::CONFIG_DIR
         | 
| 118 | 
            -
              # DB構成ファイルへのパス
         | 
| 119 | 
            -
              dbconfig_dest_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, opts["dbconfig"])
         | 
| 120 | 
            -
              # DBログファイルへのパス
         | 
| 121 | 
            -
              log_path = Arxutils_Sqlite3::Util.make_log_path(db_dir, opts["dbconfig"])
         | 
| 122 | 
            -
              dbconnect = Arxutils_Sqlite3::Dbutil::Dbconnect.new(
         | 
| 123 | 
            -
                dbconfig_dest_path,
         | 
| 124 | 
            -
                env,
         | 
| 125 | 
            -
                log_path
         | 
| 126 | 
            -
              )
         | 
| 127 | 
            -
              connect_time = dbconnect.connect
         | 
| 128 | 
            -
             | 
| 93 | 
            +
              dbconfig = opts["dbconfig"]
         | 
| 94 | 
            +
              connect_time = Arxutils_Sqlite3::Dbutil::Dbconnect.db_connect(config, dbconfig, env)
         | 
| 129 95 | 
             
              Dbsetup.new(connect_time)
         | 
| 130 96 |  | 
| 131 97 | 
             
            when "d"
         | 
| 132 98 | 
             
              db_scheme_ary = nil
         | 
| 133 | 
            -
               | 
| 99 | 
            +
              dbconfig = opts["dbconfig"]
         | 
| 100 | 
            +
              replation = opts["replation"]
         | 
| 101 | 
            +
             | 
| 102 | 
            +
              config_dir = config.get_config_dir
         | 
| 103 | 
            +
              dbconfig_path = Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, dbconfig)
         | 
| 104 | 
            +
              mig = config.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig, replation)
         | 
| 134 105 | 
             
              mig.delete_migrate_config_and_db
         | 
| 135 106 |  | 
| 136 107 | 
             
            else
         | 
| 137 108 | 
             
              puts "Invalid command(#{opts["cmd"]}) specified!!"
         | 
| 138 109 | 
             
            end
         | 
| 139 | 
            -
            #
         | 
| 140 | 
            -
             | 
| @@ -0,0 +1,242 @@ | |
| 1 | 
            +
            require "ykutils"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Arxutils_Sqlite3
         | 
| 4 | 
            +
              ##
         | 
| 5 | 
            +
              # migrateに必要なファイルをテンプレートから作成し、migarteを実行する
         | 
| 6 | 
            +
              class Config
         | 
| 7 | 
            +
                # DB格納ディレクトリ名
         | 
| 8 | 
            +
                DB_DIR = "db".freeze
         | 
| 9 | 
            +
                # migrate用スクリプト格納ディレクトリ名
         | 
| 10 | 
            +
                MIGRATE_BASE_DIR = "migrate".freeze
         | 
| 11 | 
            +
                # SQLITE3用DB構成名
         | 
| 12 | 
            +
                DBCONFIG_SQLITE3 = "sqlite3".freeze
         | 
| 13 | 
            +
                # MYSQL用DB構成名
         | 
| 14 | 
            +
                DBCONFIG_MYSQL = "mysql".freeze
         | 
| 15 | 
            +
                # DB構成格納用ディレクトリ名
         | 
| 16 | 
            +
                CONFIG_DIR_NAME = "config".freeze
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                # コンフィグディレクトリへのパス
         | 
| 19 | 
            +
                CONFIG_DIR = Pathname.new(CONFIG_DIR_NAME)
         | 
| 20 | 
            +
                # データベース用ログファイル名
         | 
| 21 | 
            +
                DATABASELOG = "database.log".freeze
         | 
| 22 | 
            +
                # テンプレートディレクトリへのパス
         | 
| 23 | 
            +
                TEMPLATE_DIR = Arxutils_Sqlite3::TOP_DIR.join("template")
         | 
| 24 | 
            +
                # リレーションテンプレートディレクトリへのパス
         | 
| 25 | 
            +
                TEMPLATE_RELATION_DIR = TEMPLATE_DIR.join("relation")
         | 
| 26 | 
            +
                TEMPLATE_CONFIG_DIR = TEMPLATE_DIR.join( CONFIG_DIR )
         | 
| 27 | 
            +
                DB_SCHEME_DIR = TEMPLATE_RELATION_DIR.join("db_scheme")
         | 
| 28 | 
            +
                DB_SCHEME_FILE = DB_SCHEME_DIR.join("db_scheme.yml")
         | 
| 29 | 
            +
                DB_SCHEME_FILE_NAME = "db_scheme.yml".freeze
         | 
| 30 | 
            +
                DB_SCHEME_FILE_NAME_2 = "db_scheme".freeze
         | 
| 31 | 
            +
                OPTS_FILE_NAME = "opts.rb".freeze
         | 
| 32 | 
            +
                OPTS_FILE_NAME_2 = "opts".freeze
         | 
| 33 | 
            +
                DBSETUP_FILE_NAME = "dbsetup.rb".freeze
         | 
| 34 | 
            +
                DBSETUP_FILE_NAME_2 = "dbsetup".freeze
         | 
| 35 | 
            +
                SETTING_YAML_FILE_NAME = "setting.yml".freeze
         | 
| 36 | 
            +
                DEST_CONFIG_DIR = Pathname.new( CONFIG_DIR )
         | 
| 37 | 
            +
                OPTS_FILE = DB_SCHEME_DIR.join(OPTS_FILE_NAME)
         | 
| 38 | 
            +
                # 変換先Dbsetupクラス定義のRubyスクリプトファイルへのパス
         | 
| 39 | 
            +
                DBSETUP_FILE = DB_SCHEME_DIR.join(DBSETUP_FILE_NAME)
         | 
| 40 | 
            +
                # 変換先optsファイル(Rubyスクリプトファイル)へのパス
         | 
| 41 | 
            +
                DEST_OPTS_FILE = DEST_CONFIG_DIR.join(OPTS_FILE_NAME)
         | 
| 42 | 
            +
                DEST_OPTS_FILE_2 = DEST_CONFIG_DIR.join(OPTS_FILE_NAME_2)
         | 
| 43 | 
            +
                # 変換先Dbsetupクラス定義のRubyスクリプトファイルへのパス
         | 
| 44 | 
            +
                DEST_DBSETUP_FILE = DEST_CONFIG_DIR.join(DBSETUP_FILE_NAME)
         | 
| 45 | 
            +
                # 変換先Dbsetupクラス定義のRubyスクリプトファイル(拡張子無し)へのパス
         | 
| 46 | 
            +
                DEST_DBSETUP_FILE_2 = DEST_CONFIG_DIR.join(DBSETUP_FILE_NAME_2)
         | 
| 47 | 
            +
                DEST_DB_SCHEME_FILE = DEST_CONFIG_DIR.join(DB_SCHEME_FILE_NAME)
         | 
| 48 | 
            +
                # 変換後DBスキームファイル(拡張子無し)へのパス
         | 
| 49 | 
            +
                DEST_DB_SCHEME_FILE_2 = DEST_CONFIG_DIR.join(DB_SCHEME_FILE_NAME_2)
         | 
| 50 | 
            +
                SETTING_YAML_FILE = CONFIG_DIR.join(SETTING_YAML_FILE_NAME)
         | 
| 51 | 
            +
                DB_PN = Pathname.new(DB_DIR)
         | 
| 52 | 
            +
                # migrateディレクトリへのパス
         | 
| 53 | 
            +
                MIGRATE_DIR = DB_PN.join(MIGRATE_BASE_DIR)
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                # DB構成ファイル格納ディレクトリの作成
         | 
| 56 | 
            +
                def make_config_directory
         | 
| 57 | 
            +
                  FileUtils.mkdir_p(CONFIG_DIR)
         | 
| 58 | 
            +
                end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                # DBスキームファイルのひな型コピー
         | 
| 61 | 
            +
                def setup_db_scheme_file
         | 
| 62 | 
            +
                  FileUtils.cp(DB_SCHEME_FILE,  DEST_DB_SCHEME_FILE)
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                # optsファイル(Rubyスクリプトファイル)のrequire
         | 
| 66 | 
            +
                def setup_opts_file(klass)
         | 
| 67 | 
            +
                  scope = Object.new
         | 
| 68 | 
            +
                  hash = {klass: klass}
         | 
| 69 | 
            +
                  result_content = Ykutils::Erubyx.erubi_render_with_template_file(OPTS_FILE, scope, hash)
         | 
| 70 | 
            +
                  File.open(DEST_OPTS_FILE, "w"){|file|
         | 
| 71 | 
            +
                    file.write(result_content)
         | 
| 72 | 
            +
                  }
         | 
| 73 | 
            +
                end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                # setting.ymlへの出力
         | 
| 76 | 
            +
                def setup_setting_yaml_file(klass)
         | 
| 77 | 
            +
                  hash = { "klass": klass }
         | 
| 78 | 
            +
                  content = YAML.dump(hash)
         | 
| 79 | 
            +
                  File.open(SETTING_YAML_FILE, "w"){|file|
         | 
| 80 | 
            +
                    file.write(content)
         | 
| 81 | 
            +
                  }
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                # DB構成ファイルの作成
         | 
| 85 | 
            +
                def make_dbconfig_path(dbconfig)
         | 
| 86 | 
            +
                  # DB構成ファイル名
         | 
| 87 | 
            +
                  Arxutils_Sqlite3::Util.make_dbconfig_path(CONFIG_DIR, dbconfig)
         | 
| 88 | 
            +
                end
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                # optsファイル(Rubyスクリプトファイル)のrequire
         | 
| 91 | 
            +
                def require_opts_file
         | 
| 92 | 
            +
                  if DEST_OPTS_FILE.exist?
         | 
| 93 | 
            +
                    opts_file = File.join("./" , DEST_OPTS_FILE_2.to_s)
         | 
| 94 | 
            +
                    begin
         | 
| 95 | 
            +
                      require opts_file
         | 
| 96 | 
            +
                    rescue LoadError => ex
         | 
| 97 | 
            +
                      pp ex.message
         | 
| 98 | 
            +
                    end
         | 
| 99 | 
            +
                  end
         | 
| 100 | 
            +
                end
         | 
| 101 | 
            +
             | 
| 102 | 
            +
                # setting.ymlのロード
         | 
| 103 | 
            +
                def load_setting_yaml_file
         | 
| 104 | 
            +
                  setting = {}
         | 
| 105 | 
            +
                  # settingファイル
         | 
| 106 | 
            +
                  setting_yaml_file = SETTING_YAML_FILE
         | 
| 107 | 
            +
                  if setting_yaml_file.exist?
         | 
| 108 | 
            +
                    setting = YAML.load_file( setting_yaml_file )
         | 
| 109 | 
            +
                  end
         | 
| 110 | 
            +
                  setting
         | 
| 111 | 
            +
                end
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                # Dbsetupファイル(Rubyスクリプトファイル)のrequire
         | 
| 114 | 
            +
                def require_dbsetup_file
         | 
| 115 | 
            +
                  dbsetup_file = File.join(".", get_dest_dbsetup_file_2.to_s)
         | 
| 116 | 
            +
                  begin
         | 
| 117 | 
            +
                    require dbsetup_file
         | 
| 118 | 
            +
                  rescue LoadError => ex
         | 
| 119 | 
            +
                    pp ex.message
         | 
| 120 | 
            +
                  end
         | 
| 121 | 
            +
                end
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                # 指定ファイルの存在確認
         | 
| 124 | 
            +
                def check_file_exist(file_pn, banner, exit_code)
         | 
| 125 | 
            +
                  if file_pn.exist?
         | 
| 126 | 
            +
                    puts "#{file_pn} exists!"
         | 
| 127 | 
            +
                    puts banner
         | 
| 128 | 
            +
                    exit 10
         | 
| 129 | 
            +
                  end
         | 
| 130 | 
            +
                end
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                # 指定ファイルの非存在確認
         | 
| 133 | 
            +
                def check_file_not_exist(file_pn, banner, exit_code)
         | 
| 134 | 
            +
                  if !file_pn.exist?
         | 
| 135 | 
            +
                    puts "#{file_pn} does not exists!"
         | 
| 136 | 
            +
                    puts banner
         | 
| 137 | 
            +
                    exit 10
         | 
| 138 | 
            +
                  end
         | 
| 139 | 
            +
                end
         | 
| 140 | 
            +
                
         | 
| 141 | 
            +
                # 変換先optsファイル(Rubyスクリプトファイル)へのパス
         | 
| 142 | 
            +
                def get_dest_opts_file
         | 
| 143 | 
            +
                  DEST_OPTS_FILE
         | 
| 144 | 
            +
                end
         | 
| 145 | 
            +
             | 
| 146 | 
            +
                # DB格納ディレクトリ名
         | 
| 147 | 
            +
                def get_db_dir
         | 
| 148 | 
            +
                  DB_DIR
         | 
| 149 | 
            +
                end
         | 
| 150 | 
            +
             | 
| 151 | 
            +
                # migrateディレクトリへのパス
         | 
| 152 | 
            +
                def get_migrate_dir
         | 
| 153 | 
            +
                  MIGRATE_DIR
         | 
| 154 | 
            +
                end
         | 
| 155 | 
            +
                # コンフィグディレクトリへのパス
         | 
| 156 | 
            +
                def get_config_dir
         | 
| 157 | 
            +
                  CONFIG_DIR
         | 
| 158 | 
            +
                end
         | 
| 159 | 
            +
             | 
| 160 | 
            +
                # リレーションテンプレートディレクトリへのパス
         | 
| 161 | 
            +
                def get_template_relation_dir
         | 
| 162 | 
            +
                  TEMPLATE_RELATION_DIR
         | 
| 163 | 
            +
                end
         | 
| 164 | 
            +
             | 
| 165 | 
            +
                # テンプレートディレクトリへのパス
         | 
| 166 | 
            +
                def get_template_config_dir
         | 
| 167 | 
            +
                  TEMPLATE_CONFIG_DIR
         | 
| 168 | 
            +
                end
         | 
| 169 | 
            +
             | 
| 170 | 
            +
                # 変換先Dbsetupクラス定義のRubyスクリプトファイルへのパス
         | 
| 171 | 
            +
                def get_src_dbsetup_file
         | 
| 172 | 
            +
                  DBSETUP_FILE
         | 
| 173 | 
            +
                end
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                # 変換先Dbsetupクラス定義のRubyスクリプトファイルへのパス
         | 
| 176 | 
            +
                def get_dest_dbsetup_file
         | 
| 177 | 
            +
                  DEST_DBSETUP_FILE
         | 
| 178 | 
            +
                end
         | 
| 179 | 
            +
             | 
| 180 | 
            +
                # 変換先Dbsetupクラス定義のRubyスクリプトファイル(拡張子無し)へのパス
         | 
| 181 | 
            +
                def get_dest_dbsetup_file_2
         | 
| 182 | 
            +
                  DEST_DBSETUP_FILE_2
         | 
| 183 | 
            +
                end
         | 
| 184 | 
            +
             | 
| 185 | 
            +
                # 変換後DBスキームファイル名(拡張子無し)
         | 
| 186 | 
            +
                def get_dest_db_scheme_file
         | 
| 187 | 
            +
                  DEST_DB_SCHEME_FILE_2
         | 
| 188 | 
            +
                end
         | 
| 189 | 
            +
             | 
| 190 | 
            +
                # DBログファイルの作成
         | 
| 191 | 
            +
                def setup_for_db_log_path(dbconfig)
         | 
| 192 | 
            +
                  db_dir = get_db_dir
         | 
| 193 | 
            +
                  # DBログファイルへのパス
         | 
| 194 | 
            +
                  Arxutils_Sqlite3::Util.make_log_path(db_dir, dbconfig)
         | 
| 195 | 
            +
                end
         | 
| 196 | 
            +
             | 
| 197 | 
            +
                # DB構成ファイルの作成
         | 
| 198 | 
            +
                def setup_for_dbconfig_path(dbconfig)
         | 
| 199 | 
            +
                  config_dir = get_config_dir
         | 
| 200 | 
            +
                  # DB構成ファイル名
         | 
| 201 | 
            +
                  Arxutils_Sqlite3::Util.make_dbconfig_path(config_dir, dbconfig)
         | 
| 202 | 
            +
                end
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                # migrate用スクリプトの生成
         | 
| 205 | 
            +
                def make_migrate_script(db_scheme_ary, dbconfig_path, dbconfig, relation)
         | 
| 206 | 
            +
                  mig = Arxutils_Sqlite3::Util.prepare_for_migrate(db_scheme_ary, dbconfig_path, dbconfig, relation)
         | 
| 207 | 
            +
                  # マイグレーション用スクリプトの生成、relationのクラス定義ファイルの生成
         | 
| 208 | 
            +
                  mig.output
         | 
| 209 | 
            +
                end
         | 
| 210 | 
            +
             | 
| 211 | 
            +
                # migrateの準備
         | 
| 212 | 
            +
                def prepare_for_migrate(db_scheme_ary, dbconfig_dest_path, dbconfig, relation)
         | 
| 213 | 
            +
                  #db_dir = config.DB_DIR
         | 
| 214 | 
            +
                  db_dir = get_db_dir
         | 
| 215 | 
            +
                  migrate_dir = get_migrate_dir
         | 
| 216 | 
            +
                  # DB構成ファイルの出力先ディレクトリ
         | 
| 217 | 
            +
                  dbconfig_src_fname = "#{dbconfig}.tmpl"
         | 
| 218 | 
            +
                  mig = Migrate.new(
         | 
| 219 | 
            +
                    self,
         | 
| 220 | 
            +
                    dbconfig_dest_path,
         | 
| 221 | 
            +
                    dbconfig_src_fname,
         | 
| 222 | 
            +
                    db_scheme_ary,
         | 
| 223 | 
            +
                    relation
         | 
| 224 | 
            +
                    )
         | 
| 225 | 
            +
                end
         | 
| 226 | 
            +
             | 
| 227 | 
            +
                def make_dbsetup_file(db_scheme_ary, relation, klass, dest_dbsetup_file)
         | 
| 228 | 
            +
                  src_dbsetup_file = get_src_dbsetup_file
         | 
| 229 | 
            +
             | 
| 230 | 
            +
                  scope = Object.new
         | 
| 231 | 
            +
                  hash0 = {module_name: relation[:module].join("::")}
         | 
| 232 | 
            +
                  hash = db_scheme_ary[0].merge( hash0 )
         | 
| 233 | 
            +
                  hash["klass"] = klass
         | 
| 234 | 
            +
                  result_content = Ykutils::Erubyx.erubi_render_with_template_file(src_dbsetup_file, scope, hash)
         | 
| 235 | 
            +
             | 
| 236 | 
            +
                  #p "################ dest_dbsetup_file=#{dest_dbsetup_file}"
         | 
| 237 | 
            +
                  File.open(dest_dbsetup_file, "w"){|file|
         | 
| 238 | 
            +
                    file.write(result_content)
         | 
| 239 | 
            +
                  }
         | 
| 240 | 
            +
                end
         | 
| 241 | 
            +
              end
         | 
| 242 | 
            +
            end
         | 
| @@ -36,6 +36,20 @@ module Arxutils_Sqlite3 | |
| 36 36 | 
             
                    format("%s-%s", dbconfig.to_s, log_file_base_name)
         | 
| 37 37 | 
             
                  end
         | 
| 38 38 |  | 
| 39 | 
            +
                  def self.db_connect(config, dbconfig, env)
         | 
| 40 | 
            +
                    # DB構成ファイルへのパス
         | 
| 41 | 
            +
                    dbconfig_path = config.setup_for_dbconfig_path(dbconfig)
         | 
| 42 | 
            +
                    # DB用ログファイルへのパス
         | 
| 43 | 
            +
                    log_path = config.setup_for_db_log_path(dbconfig)
         | 
| 44 | 
            +
                    # DB接続
         | 
| 45 | 
            +
                    dbconnect = Arxutils_Sqlite3::Dbutil::Dbconnect.new(
         | 
| 46 | 
            +
                      dbconfig_path,
         | 
| 47 | 
            +
                      env,
         | 
| 48 | 
            +
                      log_path
         | 
| 49 | 
            +
                    )
         | 
| 50 | 
            +
                    dbconnect.connect
         | 
| 51 | 
            +
                  end
         | 
| 52 | 
            +
             | 
| 39 53 | 
             
                  # DB接続までの初期化に必要なディレクトリの確認、作成
         | 
| 40 54 | 
             
                  def initialize(dbconfig_dest_path, env, log_path)
         | 
| 41 55 | 
             
                    # 接続開始時刻
         | 
| @@ -5,15 +5,5 @@ module Arxutils_Sqlite3 | |
| 5 5 | 
             
              module Dbutil
         | 
| 6 6 | 
             
                # DB格納ディレクトリ名
         | 
| 7 7 | 
             
                DB_DIR = "db".freeze
         | 
| 8 | 
            -
                # migrate用スクリプト格納ディレクトリ名
         | 
| 9 | 
            -
                MIGRATE_DIR = "migrate".freeze
         | 
| 10 | 
            -
                # SQLITE3用DB構成名
         | 
| 11 | 
            -
                DBCONFIG_SQLITE3 = "sqlite3".freeze
         | 
| 12 | 
            -
                # MYSQL用DB構成名
         | 
| 13 | 
            -
                DBCONFIG_MYSQL = "mysql".freeze
         | 
| 14 | 
            -
                # DB構成格納用ディレクトリ名
         | 
| 15 | 
            -
                CONFIG_DIR = "config".freeze
         | 
| 16 | 
            -
                # データベース用ログファイル名
         | 
| 17 | 
            -
                DATABASELOG = "database.log".freeze
         | 
| 18 8 | 
             
              end
         | 
| 19 9 | 
             
            end
         | 
| @@ -10,7 +10,7 @@ require "pp" | |
| 10 10 | 
             
            module Arxutils_Sqlite3
         | 
| 11 11 | 
             
            ##
         | 
| 12 12 | 
             
            # migrateに必要なファイルをテンプレートから作成し、migarteを実行する
         | 
| 13 | 
            -
            class Migrate
         | 
| 13 | 
            +
              class Migrate
         | 
| 14 14 | 
             
                attr_reader :migrate_dir
         | 
| 15 15 | 
             
                # migrate用スクリプトファイル名の先頭の番号の間隔
         | 
| 16 16 | 
             
                FILENAME_COUNTER_STEP = 10
         | 
| @@ -19,34 +19,33 @@ class Migrate | |
| 19 19 |  | 
| 20 20 | 
             
                # migrate用のスクリプトの生成、migrateの実行を行うmigratexの生成
         | 
| 21 21 | 
             
                def initialize(
         | 
| 22 | 
            +
                  config,
         | 
| 22 23 | 
             
                  dbconfig_dest_path,
         | 
| 23 24 | 
             
                  dbconfig_src_fname,
         | 
| 24 | 
            -
                  migrate_dir,
         | 
| 25 | 
            -
                  db_dir,
         | 
| 26 25 | 
             
                  db_scheme_ary,
         | 
| 27 | 
            -
                   | 
| 28 | 
            -
                   | 
| 26 | 
            +
                  relation_config
         | 
| 27 | 
            +
                  )
         | 
| 29 28 | 
             
                  # DB格納ディレクトリ名
         | 
| 30 | 
            -
                  @db_dir =  | 
| 29 | 
            +
                  @db_dir = config.get_db_dir
         | 
| 31 30 | 
             
                  # DB構成ファイルの出力先ディレクトリ
         | 
| 32 | 
            -
                  @dest_config_dir =  | 
| 31 | 
            +
                  @dest_config_dir = config.get_config_dir
         | 
| 33 32 | 
             
                  # 生成するDB構成情報ファイルパス
         | 
| 34 33 | 
             
                  @dbconfig_dest_path = dbconfig_dest_path
         | 
| 35 34 | 
             
                  # 参照用DB構成情報ファイル名
         | 
| 36 35 | 
             
                  @dbconfig_src_fname = dbconfig_src_fname
         | 
| 37 36 |  | 
| 38 37 | 
             
                  # migrate用スクリプトの出力先ディレクトリ名
         | 
| 39 | 
            -
                  @migrate_dir =  | 
| 38 | 
            +
                  @migrate_dir = config.get_migrate_dir
         | 
| 40 39 | 
             
                  # テンプレートファイル格納ディレクトリ名
         | 
| 41 | 
            -
                  @src_path =  | 
| 40 | 
            +
                  @src_path = config.get_template_relation_dir
         | 
| 41 | 
            +
                  #@src_path = Arxutils_Sqlite3::TEMPLATE_RELATION_DIR
         | 
| 42 42 | 
             
                  # 構成ファイル格納ディレクトリ
         | 
| 43 | 
            -
                  @src_config_path =  | 
| 43 | 
            +
                  @src_config_path = config.get_template_config_dir
         | 
| 44 | 
            +
            #      @src_config_path = Arxutils_Sqlite3::TEMPLATE_CONFIG_DIR
         | 
| 44 45 | 
             
                  # データベーススキーマ定義配列
         | 
| 45 46 | 
             
                  @db_scheme_ary = db_scheme_ary
         | 
| 46 47 | 
             
                  # リレーション指定
         | 
| 47 | 
            -
                  @ | 
| 48 | 
            -
                  # オプション指定
         | 
| 49 | 
            -
                  @opts = opts
         | 
| 48 | 
            +
                  @relation_config = relation_config
         | 
| 50 49 |  | 
| 51 50 | 
             
                  FileUtils.mkdir_p(@db_dir) if @db_dir
         | 
| 52 51 | 
             
                  FileUtils.mkdir_p(@migrate_dir) if @migrate_dir
         | 
| @@ -63,8 +62,8 @@ class Migrate | |
| 63 62 | 
             
                  end
         | 
| 64 63 | 
             
                end
         | 
| 65 64 |  | 
| 66 | 
            -
                # マイグレーション用スクリプトの生成、relation | 
| 67 | 
            -
                def  | 
| 65 | 
            +
                # マイグレーション用スクリプトの生成、relationのクラス定義ファイルの生成
         | 
| 66 | 
            +
                def output
         | 
| 68 67 | 
             
                  # migrationのスクリプトをファイル出力する
         | 
| 69 68 | 
             
                  output_all_script
         | 
| 70 69 |  | 
| @@ -90,7 +89,7 @@ class Migrate | |
| 90 89 | 
             
                    content_array = ary
         | 
| 91 90 | 
             
                  end
         | 
| 92 91 | 
             
                  # relationのスクリプトを作成
         | 
| 93 | 
            -
                  output_relation_script(content_array, @ | 
| 92 | 
            +
                  output_relation_script(content_array, @relation_config)
         | 
| 94 93 | 
             
                end
         | 
| 95 94 |  | 
| 96 95 | 
             
                # migrationのスクリプトをファイル出力する
         | 
| @@ -184,19 +183,17 @@ class Migrate | |
| 184 183 | 
             
                end
         | 
| 185 184 |  | 
| 186 185 | 
             
                # relationのスクリプトをファイル出力する
         | 
| 187 | 
            -
                def output_relation_script(content_array,  | 
| 188 | 
            -
                   | 
| 189 | 
            -
                   | 
| 190 | 
            -
                  dir = opts[:dir]
         | 
| 191 | 
            -
                  fname = opts[:filename]
         | 
| 186 | 
            +
                def output_relation_script(content_array, relation_config)
         | 
| 187 | 
            +
                  dir = relation_config[:dir]
         | 
| 188 | 
            +
                  fname = relation_config[:filename]
         | 
| 192 189 | 
             
                  fpath = File.join(dir, fname)
         | 
| 193 190 | 
             
                  File.open(fpath, "w") do |file|
         | 
| 194 | 
            -
                     | 
| 191 | 
            +
                    relation_config[:module].map { |mod| file.puts("module #{mod}") }
         | 
| 195 192 | 
             
                    content_array.map do |x|
         | 
| 196 193 | 
             
                      file.puts x
         | 
| 197 194 | 
             
                      file.puts ""
         | 
| 198 195 | 
             
                    end
         | 
| 199 | 
            -
                     | 
| 196 | 
            +
                    relation_config[:module].map { |_mod| file.puts("end") }
         | 
| 200 197 | 
             
                  end
         | 
| 201 198 | 
             
                end
         | 
| 202 199 | 
             
              end
         | 
| @@ -1,29 +1,10 @@ | |
| 1 1 | 
             
            module Arxutils_Sqlite3
         | 
| 2 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 3 | 
             
                # DBログファイルへのパスの作成
         | 
| 23 4 | 
             
                def self.make_log_path(db_dir, dbconfig)
         | 
| 24 5 | 
             
                  log_path = ""
         | 
| 25 6 | 
             
                  log_fname = Dbutil::Dbconnect.make_log_file_name(
         | 
| 26 | 
            -
                    dbconfig,  | 
| 7 | 
            +
                    dbconfig, Config::DATABASELOG)
         | 
| 27 8 | 
             
                  if db_dir && log_fname
         | 
| 28 9 | 
             
                    # DB用ログファイルへのパス
         | 
| 29 10 | 
             
                    log_path = File.join(db_dir, log_fname)
         | 
| @@ -33,7 +14,7 @@ module Arxutils_Sqlite3 | |
| 33 14 |  | 
| 34 15 | 
             
                # DB構成ファイルへのパスの作成
         | 
| 35 16 | 
             
                def self.make_dbconfig_path(config_dir, dbconfig)
         | 
| 36 | 
            -
                   | 
| 17 | 
            +
                  Pathname.new(config_dir).join("#{dbconfig}.yml")
         | 
| 37 18 | 
             
                end
         | 
| 38 19 | 
             
              end
         | 
| 39 20 | 
             
            end
         | 
    
        data/lib/arxutils_sqlite3.rb
    CHANGED
    
    | @@ -8,34 +8,19 @@ require "active_support/core_ext" | |
| 8 8 | 
             
            require "active_record"
         | 
| 9 9 | 
             
            require "pathname"
         | 
| 10 10 |  | 
| 11 | 
            +
            module Arxutils_Sqlite3
         | 
| 12 | 
            +
              TOP_DIR = Pathname(__FILE__).parent
         | 
| 13 | 
            +
              class Error < StandardError; end
         | 
| 14 | 
            +
              # Your code goes here...
         | 
| 15 | 
            +
            end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            require_relative "arxutils_sqlite3/dbutil"
         | 
| 18 | 
            +
            require_relative "arxutils_sqlite3/config"
         | 
| 19 | 
            +
             | 
| 11 20 | 
             
            require_relative "arxutils_sqlite3/version"
         | 
| 12 21 | 
             
            require_relative "arxutils_sqlite3/arx"
         | 
| 13 22 | 
             
            require_relative "arxutils_sqlite3/transactstate"
         | 
| 14 23 | 
             
            require_relative "arxutils_sqlite3/hier"
         | 
| 15 24 | 
             
            require_relative "arxutils_sqlite3/migrate"
         | 
| 16 | 
            -
            require_relative "arxutils_sqlite3/dbutil"
         | 
| 17 25 | 
             
            require_relative "arxutils_sqlite3/migrate"
         | 
| 18 26 | 
             
            require_relative "arxutils_sqlite3/util"
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            module Arxutils_Sqlite3
         | 
| 21 | 
            -
              TOP_DIR = Pathname(__FILE__).parent
         | 
| 22 | 
            -
              TEMPLATE_DIR = TOP_DIR.join("template")
         | 
| 23 | 
            -
              TEMPLATE_RELATION_DIR = TEMPLATE_DIR.join("relation")
         | 
| 24 | 
            -
              TEMPLATE_CONFIG_DIR = TEMPLATE_DIR.join( Dbutil::CONFIG_DIR )
         | 
| 25 | 
            -
              DB_SCHEME_DIR = TEMPLATE_RELATION_DIR.join("db_scheme")
         | 
| 26 | 
            -
              DB_SCHEME_FILE = DB_SCHEME_DIR.join("db_scheme.yml")
         | 
| 27 | 
            -
              OPTS_FILE_NAME = "opts.rb"
         | 
| 28 | 
            -
              OPTS_FILE_NAME_2 = "opts"
         | 
| 29 | 
            -
              DBSETUP_FILE_NAME = "dbsetup.rb"
         | 
| 30 | 
            -
              DBSETUP_FILE_NAME_2 = "dbsetup"
         | 
| 31 | 
            -
              DEST_CONFIG_DIR = Pathname.new( Dbutil::CONFIG_DIR )
         | 
| 32 | 
            -
              OPTS_FILE = DB_SCHEME_DIR.join(OPTS_FILE_NAME)
         | 
| 33 | 
            -
              DBSETUP_FILE = DB_SCHEME_DIR.join(DBSETUP_FILE_NAME)
         | 
| 34 | 
            -
              DEST_OPTS_FILE = DEST_CONFIG_DIR.join(OPTS_FILE_NAME)
         | 
| 35 | 
            -
              DEST_OPTS_FILE_2 = DEST_CONFIG_DIR.join(OPTS_FILE_NAME_2)
         | 
| 36 | 
            -
              DEST_DBSETUP_FILE = DEST_CONFIG_DIR.join(DBSETUP_FILE_NAME)
         | 
| 37 | 
            -
              DEST_DBSETUP_FILE_2 = DEST_CONFIG_DIR.join(DBSETUP_FILE_NAME_2)
         | 
| 38 | 
            -
             | 
| 39 | 
            -
              class Error < StandardError; end
         | 
| 40 | 
            -
              # Your code goes here...
         | 
| 41 | 
            -
            end
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            class Dbsetup
         | 
| 2 2 | 
             
              def initialize(connect_time)
         | 
| 3 3 | 
             
                @connect_time = connect_time
         | 
| 4 | 
            -
                @ct = <%=  | 
| 4 | 
            +
                @ct = <%= klass %>::Dbutil::Countdatetime.create( countdatetime: @connect_time )
         | 
| 5 5 | 
             
                @hs_by_notebook = {}
         | 
| 6 6 | 
             
                @hs_by_id = {}
         | 
| 7 7 | 
             
              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. | 
| 4 | 
            +
              version: 0.1.45
         | 
| 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- | 
| 11 | 
            +
            date: 2022-09-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -217,6 +217,7 @@ files: | |
| 217 217 | 
             
            - exe/arxutils_sqlite3
         | 
| 218 218 | 
             
            - lib/arxutils_sqlite3.rb
         | 
| 219 219 | 
             
            - lib/arxutils_sqlite3/arx.rb
         | 
| 220 | 
            +
            - lib/arxutils_sqlite3/config.rb
         | 
| 220 221 | 
             
            - lib/arxutils_sqlite3/dbutil.rb
         | 
| 221 222 | 
             
            - lib/arxutils_sqlite3/dbutil/dbconnect.rb
         | 
| 222 223 | 
             
            - lib/arxutils_sqlite3/hier.rb
         |