Sha256: ab6fb143881292caf4d9f04380089a64f77350cbfe9d6779c92af0f972ff040e
Contents?: true
Size: 1.76 KB
Versions: 2
Compression:
Stored size: 1.76 KB
Contents
#!/usr/bin/env ruby require "arxutils_sqlite3" require "simpleoptparse" require "pp" require "ykutils" require "ykxutils" config = Arxutils_Sqlite3::Config.new opts, klass = config.setupx(self) # p opts # p klass # exit banner = "Usage: bundle exec arxutils_sqlite3 --cmd=(s|cds|co|c|f|m|a|d|b|y) -y yaml_file --klass=class" Simpleoptparse::Simpleoptparse.parse(ARGV, opts, banner, Arxutils_Sqlite3::VERSION, nil) do |parser| parser.on("--cmd X", %w[s cds co c f m a d b y]) { |x| opts["cmd"] = x } parser.on("-y yaml_file", "--yaml yaml_file") { |x| opts["yaml"] = x } parser.on("--klass klass") { |x| opts["klass"] = x } end dbconfig = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3 env = ENV.fetch("ENV", nil) env ||= "production" cli = Arxutils_Sqlite3::Cli.new(config, dbconfig, env) case opts["cmd"] when "s" # config.check_file_exist(Arxutils_Sqlite3::Config::SAMPLE_DEST_OPTS_FILE, banner, 10) if opts["klass"].nil? || opts["klass"].strip == "" puts banner exit 20 end cli.setup(klass) when "cds" cli.copy_db_scheme when "co" cli.copy_opts_file when "c" acrecord = opts[:acrecord] cli.makeconfig(acrecord, banner, 30, opts) when "f" yaml_fname = opts["yaml"] acrecord = opts[:acrecord] if yaml_fname.nil? || yaml_fname.strip == "" puts banner exit 40 end yaml_pn = Pathname.new(yaml_fname) config.check_file_not_exist(yaml_pn, banner, 55) cli.setup_for_migrate(yaml_pn, acrecord, klass) when "m" cli.migrate when "a" cli.acr when "d" db_scheme_ary = nil acrecord = opts["acrecord"] cli.delete(db_scheme_ary, acrecord) when "b" db_scheme_ary = nil acrecord = opts["acrecord"] cli.delete_db(db_scheme_ary, acrecord) when "y" cli.delete_setting_yaml else puts "Invalid command(#{opts["cmd"]}) specified!!" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arxutils_sqlite3-0.1.55 | exe/arxutils_sqlite3 |
arxutils_sqlite3-0.1.54 | exe/arxutils_sqlite3 |