Class: Boshify::CommandLine
- Inherits:
-
Object
- Object
- Boshify::CommandLine
- Defined in:
- lib/boshify/command_line.rb
Overview
Command line argument processing
Instance Method Summary collapse
-
#initialize(options) ⇒ CommandLine
constructor
A new instance of CommandLine.
- #run(args) ⇒ Object
Constructor Details
#initialize(options) ⇒ CommandLine
Returns a new instance of CommandLine.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/boshify/command_line.rb', line 7 def initialize() unless [:program_name] fail ArgumentError, 'Program name must be specified' end unless [:package_converter] fail ArgumentError, 'Package converter must be specified' end @program_name = Pathname.new([:program_name]).basename @package_converter = [:package_converter] end |
Instance Method Details
#run(args) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/boshify/command_line.rb', line 18 def run(args) (args) do || begin use_mirror_if_specified([:mirror]) @package_converter.create_release_for(name: [:package]) { exit_code: 0, stdout: "Package #{options[:package]} converted", stderr: '' } rescue => e { exit_code: 1, stdout: '', stderr: e. } end end end |