Class: LighthouseCLI::Parser

Inherits:
Object
  • Object
show all
Extended by:
Hirb::Helpers
Defined in:
lib/lighthouse_cli.rb

Class Method Summary collapse

Class Method Details

.add(title, tags = []) ⇒ Object



78
79
80
81
# File 'lib/lighthouse_cli.rb', line 78

def add(title, tags = [])
  new_ticket(title, tags)
  puts "Ticket added."
end

.go!Object



70
71
72
73
74
75
76
# File 'lib/lighthouse_cli.rb', line 70

def go!
  (help; return) if ARGV.blank?

  LighthouseCLI.bootstrap!
  @project = LighthouseCLI.project
  self.send(ARGV.shift.to_sym, *ARGV)
end

.helpObject



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/lighthouse_cli.rb', line 114

def help
  puts <<-TEXT
  Available commands:
  help
    Show this text.
  
  list
    List all assigned tickets from upcoming milestone.
    
  show 50
    Show details for ticket with given id.
  
  add "Ticket name" "tag1 tag2"
    Add ticket for yourself into current milestone with (optional) tags and without any body.
  
  resolve 50
    Mark ticket 50 resolved.
  
  open 50
    Mark ticket 50 new.
  TEXT
end

.list(which = "next") ⇒ Object



83
84
85
86
87
88
89
90
# File 'lib/lighthouse_cli.rb', line 83

def list(which = "next")
  list = case which
  when 'next'
    tickets("responsible:me milestone:#{next_milestone.title} state:open sort:priority")
  end
  
  display_tickets list
end

.open(id) ⇒ Object



99
100
101
102
103
104
# File 'lib/lighthouse_cli.rb', line 99

def open(id)
  t = ticket(id)
  t.state = 'new'
  t.save
  puts "Opened: \"#{t.title}\""
end

.resolve(id) ⇒ Object



92
93
94
95
96
97
# File 'lib/lighthouse_cli.rb', line 92

def resolve(id)
  t = ticket(id)
  t.state = 'resolved'
  t.save
  puts "Resolved: \"#{t.title}\""
end

.show(id) ⇒ Object



106
107
108
109
110
111
112
# File 'lib/lighthouse_cli.rb', line 106

def show(id)
  ticket = ticket(id)
  puts "  Ticket ##{id} (#{ticket.state})"
  puts "  "+ticket.title
  puts "  "+ticket.body unless ticket.body.blank?
  puts "  "+ticket.tags.join(', ') unless ticket.tags.blank? 
end