Class: AllGem::CLI
- Inherits:
-
Object
- Object
- AllGem::CLI
- Defined in:
- lib/all-gem/cli.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdin ⇒ Object
readonly
Returns the value of attribute stdin.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
-
#initialize(stdout:, stderr:, stdin:) ⇒ CLI
constructor
A new instance of CLI.
- #run(argv) ⇒ Object
Constructor Details
#initialize(stdout:, stderr:, stdin:) ⇒ CLI
Returns a new instance of CLI.
27 28 29 30 31 32 33 |
# File 'lib/all-gem/cli.rb', line 27 def initialize(stdout:, stderr:, stdin:) @stdout = stdout @stderr = stderr @stdin = stdin set_optparse end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
25 26 27 |
# File 'lib/all-gem/cli.rb', line 25 def op @op end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
25 26 27 |
# File 'lib/all-gem/cli.rb', line 25 def opts @opts end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
25 26 27 |
# File 'lib/all-gem/cli.rb', line 25 def stderr @stderr end |
#stdin ⇒ Object (readonly)
Returns the value of attribute stdin.
25 26 27 |
# File 'lib/all-gem/cli.rb', line 25 def stdin @stdin end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
25 26 27 |
# File 'lib/all-gem/cli.rb', line 25 def stdout @stdout end |
Instance Method Details
#run(argv) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/all-gem/cli.rb', line 35 def run(argv) argv = @op.order(argv) command = argv[0] or raise Error.new("COMMAND is not specified.\n\n" + op.help) spec = gemspec_from_command(command) versions = versions_of(spec, opts) versions = filter_by_level(versions, opts) install! spec, versions execute_and_print argv, versions end |