Class: DbLoad
Class Method Summary collapse
Methods inherited from DbHelper
dump!, fork!, get_configs, load!, save_db_config!
Class Method Details
.run(args = []) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/load.rb', line 6 def self.run(args=[]) = { relative: false, clean: false, reset: false, branch: :dev } opt_parser = OptionParser.new do |opts| opts. = "Usage: .. load [options]" opts.separator "" opts.separator "Specific options:" opts.on("-f", "--file [database name]", "Set output file for database dump file.") do |arg| [:file] = arg end opts.on("-b", "--branch [dev|test|stag|prod|all]", "Set branch for load, default: development.") do |arg| arg = arg.downcase.to_sym [:branch] = arg if [:dev, :test, :prod, :stag, :all].include?(arg) end opts.on("-r", "--relative", "Set relative position of database dump file, if no option - used db store folder.") do |arg| [:relative] = true end opts.on("-c", "--clean", "Clean db before load (drop>create>migrate>load)") do |arg| [:clean] = true end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end opt_parser.parse!(args) get_configs() load!() # pp options end |