Class: P4Tools::Describe

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/describe.rb

Class Method Summary collapse

Instance Method Summary collapse

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.set_options(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_pendingObject



41
42
43
# File 'lib/commands/describe.rb', line 41

def find_pending
  @p4.run_describe('-s', @submitted)
end

#find_submittedObject



37
38
39
# File 'lib/commands/describe.rb', line 37

def 
  @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

#runObject



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 = 
    report(numbers)
  end
end