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

.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