Sha256: 8080538311454c2eeeb63e989732183d7ca76fce2d673650d69e6d270d244eca
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
#!/usr/bin/env ruby require "arxutils_sqlite3" require "simpleoptparse" require "pp" require "ykutils" require "ykxutils" config = Arxutils_Sqlite3::Config.new opts, mod = config.setupx(self) # p opts # p mod # exit banner = "Usage: bundle exec arxutils_sqlite3 --cmd=(s|cds|co|c|f|m|a|d|del|b|y|dm) -y yaml_file --mod=mod" 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 del b y dm]) { |x| opts["cmd"] = x } parser.on("-y yaml_file", "--yaml yaml_file") { |x| opts["yaml"] = x } parser.on("--mod mod") { |x| opts["mod"] = x } end dbconfig = Arxutils_Sqlite3::Config::DBCONFIG_SQLITE3 env = ENV.fetch("ENV", nil) env ||= "production" acrecord = opts[:acrecord] yaml_fname = opts["yaml"] mod ||= opts["mod"] cli = Arxutils_Sqlite3::Cli.new(config, dbconfig, env, acrecord, yaml_fname, mod) case opts["cmd"] when "s" # config.check_file_exist(Arxutils_Sqlite3::Config::SAMPLE_DEST_OPTS_FILE, banner, 10) if opts["mod"].nil? || opts["mod"].strip == "" puts banner exit 20 end cli.setup(mod) when "cds" cli.copy_db_scheme when "co" cli.copy_opts_file when "c" cli.makeconfig(opts) when "f" 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.make_migrate_script when "m" cli.migrate when "a" cli.acr when "d" cli.clean when "del" cli.delete when "b" cli.delete_db when "y" cli.delete_setting_yaml when "dm" cli.delete_migrate else puts "Invalid command(#{opts["cmd"]}) specified!!" end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arxutils_sqlite3-0.1.58 | exe/arxutils_sqlite3 |
arxutils_sqlite3-0.1.57 | exe/arxutils_sqlite3 |