Class: ITunes::Store::Transporter::Command::Base
- Inherits:
-
Object
- Object
- ITunes::Store::Transporter::Command::Base
- Includes:
- Option
- Defined in:
- lib/itunes/store/transporter/command.rb
Constant Summary
Constant Summary
Constants included from Option
Option::APPLE_ID, Option::DELETE_ON_SUCCESS, Option::DESTINATION, Option::ON_FAILURE, Option::ON_SUCCESS, Option::PACKAGE, Option::SHORTNAME, Option::TRANSPORT, Option::VENDOR_ID
Instance Method Summary (collapse)
-
- (Base) initialize(config, default_options = {})
constructor
A new instance of Base.
- - (Object) run(options = {})
Constructor Details
- (Base) initialize(config, default_options = {})
A new instance of Base
17 18 19 20 21 |
# File 'lib/itunes/store/transporter/command.rb', line 17 def initialize(config, = {}) @config = config @shell = Shell.new(@config[:path]) @default_options = end |
Instance Method Details
- (Object) run(options = {})
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/itunes/store/transporter/command.rb', line 23 def run( = {}) argv = () stdout_lines = [] stderr_lines = [] exitcode = @shell.exec(argv) do |line, name| if name == :stdout stdout_lines << line $stdout.puts line if config[:print_stdout] else stderr_lines << line $stderr.puts line if config[:print_stderr] end end if exitcode == 0 handle_success(stdout_lines, stderr_lines, ) else handle_error(stdout_lines, stderr_lines, exitcode, ) end end |