Class: P4Tools::Describe
- Inherits:
-
Object
- Object
- P4Tools::Describe
- Defined in:
- lib/commands/describe.rb
Class Method Summary collapse
Instance Method Summary collapse
- #find_pending ⇒ Object
- #find_submitted ⇒ Object
-
#initialize(args) ⇒ Describe
constructor
A new instance of Describe.
- #report(numbers) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Describe
Returns a new instance of Describe.
20 21 22 23 24 25 |
# File 'lib/commands/describe.rb', line 20 def initialize(args) @pending = args[:pending] @submitted = args[:submitted] @p4 = P4Tools.connection end |
Class Method Details
.run(arguments) ⇒ Object
4 5 6 |
# File 'lib/commands/describe.rb', line 4 def self.run(arguments) Describe.new(arguments).run end |
.set_options(opts) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/commands/describe.rb', line 8 def self.(opts) opts.set do help 'Provides information about changelists and the changelists files.' help '' help 'Options:' help '' arg :submitted, 'Find pending CL number, based on submitted CL number.', :short => '-s', :type => :ints arg :pending, 'Find submitted CL number, based on pending CL number.', :short => '-p', :type => :ints end end |
Instance Method Details
#find_pending ⇒ Object
41 42 43 |
# File 'lib/commands/describe.rb', line 41 def find_pending @p4.run_describe('-s', @submitted) end |
#find_submitted ⇒ Object
37 38 39 |
# File 'lib/commands/describe.rb', line 37 def find_submitted @p4.run_describe('-s', '-O', @pending) end |
#report(numbers) ⇒ Object
45 46 47 48 49 |
# File 'lib/commands/describe.rb', line 45 def report(numbers) numbers.each { |num| p "pending: #{num['oldChange']}, submitted: #{num['change']}" } end |
#run ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/commands/describe.rb', line 27 def run if !@submitted.nil? numbers = find_pending report(numbers) elsif !@pending.nil? numbers = find_submitted report(numbers) end end |