Class: MasterDelivery::CliMasterDelivery
- Inherits:
-
Object
- Object
- MasterDelivery::CliMasterDelivery
- Defined in:
- lib/cli_master_delivery.rb
Overview
command line wrapper
Instance Attribute Summary collapse
-
#params ⇒ Object
rubocop:disable Metrics/ClassLength.
Instance Method Summary collapse
-
#initialize ⇒ CliMasterDelivery
constructor
A new instance of CliMasterDelivery.
- #parse_options ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize ⇒ CliMasterDelivery
Returns a new instance of CliMasterDelivery.
82 83 84 |
# File 'lib/cli_master_delivery.rb', line 82 def initialize @params = { type: VALUE_DELIVERY_TYPE[0].to_sym, dryrun: false, quiet: false } end |
Instance Attribute Details
#params ⇒ Object
rubocop:disable Metrics/ClassLength
80 81 82 |
# File 'lib/cli_master_delivery.rb', line 80 def params @params end |
Instance Method Details
#parse_options ⇒ Object
86 87 88 89 90 91 |
# File 'lib/cli_master_delivery.rb', line 86 def OptionParser.new do |opts| opts = (opts) opts.parse!(ARGV, into: @params) end end |
#run ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/cli_master_delivery.rb', line 93 def run return unless check_param_consistency fix_param_paths(%i[master delivery backup]) basics = delivery_basics md = MasterDelivery.new(basics[:master_dir], basics[:backup_root]) return unless md.confirm(basics, @params.slice(:type, :quiet, :dryrun, :yes)) mfiles, _tmpdir = md.deliver(basics, **@params.slice(:type, :dryrun, :verbose)) puts "done! (#{mfiles.size} master files are delivered.)" unless @params[:quiet] end |