class Twigg::Command::Pivotal

Constants

SUB_SUBCOMMANDS

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/twigg-pivotal/command/pivotal.rb, line 7
def initialize(*args)
  super
  @sub_subcommand = @args.shift
  ignore @args

  unless SUB_SUBCOMMANDS.include?(@sub_subcommand)
    Help.new('pivotal').run!
  end
end

Public Instance Methods

run() click to toggle source
# File lib/twigg-pivotal/command/pivotal.rb, line 17
def run
  send @sub_subcommand
end

Private Instance Methods

stats() click to toggle source

Shows a list of open stories, grouped by status.

# File lib/twigg-pivotal/command/pivotal.rb, line 24
def stats
  groups = ::Twigg::Pivotal::Status.status

  groups.each do |current_state, stories|
    header = pluralize stories.size,
                       "#{current_state} story",
                       "#{current_state} stories"
    puts header

    stories.each do |story|
      print "[#{story.story_type}] #{story.name}"
      if story.owned_by
        puts " [#{story.owned_by['initials']}]"
      else
        puts
      end
    end

    puts
  end

  puts '', 'Totals'
  groups.each do |current_state, stories|
    puts number_with_delimiter(stories.size) + " #{current_state}"
  end
  puts
end