Class: BBFlow::Application
- Inherits:
-
Object
- Object
- BBFlow::Application
- Defined in:
- lib/bb_flow.rb
Class Method Summary collapse
Class Method Details
.run(command) ⇒ void
This method returns an undefined value.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/bb_flow.rb', line 30 def self.run(command) case command when :commit return puts Misc.execute('git commit') if Misc.execute('git diff-index HEAD --name-only --cached').empty? = (Options.get(:commit_message) || Misc.edit).strip cards = Trello.cards cards = Printer.select_items(cards, 'Which cards does this commit address?', formatter: Trello.method(:format_card)) unless cards.blank? card_lines = cards.map do |card| "Trello Card: #{card.name}, #{card.short_url}" end.join("\n") # TODO: re-write with plumbing commands # e.g. git write-tree | xargs git commit-tree -m'message' Misc.execute("git commit -m \"#{}\n\n#{card_lines}\"") commit_sha = Misc.execute('git show-ref --head -s /HEAD/').strip # TODO: convert to http url. commit_url = "#{Github.http_url}/commit/#{commit_sha}" cards.each do |card| card.(commit_url, ) Printer.success("Added the commit to the „#{card.name}“ card (#{card.url}).") end when :pr PullRequester.create! else Printer.panic("Incorrect parameter: #{command}") end end |