Class: TrelloFlow::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/trello_flow/main.rb

Instance Method Summary collapse

Constructor Details

#initialize(global_config = GlobalConfig.new, local_config = LocalConfig.new) ⇒ Main

Returns a new instance of Main.



6
7
8
9
# File 'lib/trello_flow/main.rb', line 6

def initialize(global_config = GlobalConfig.new, local_config = LocalConfig.new)
  Api::Base.configure(key: global_config.key, token: global_config.token)
  @local_config = local_config
end

Instance Method Details

#cleanupObject



29
30
31
# File 'lib/trello_flow/main.rb', line 29

def cleanup
  Cleanup.new(Branch.current.target).run
end

#finishObject



22
23
24
25
26
27
# File 'lib/trello_flow/main.rb', line 22

def finish
  branch = Branch.current
  branch.push
  branch.open_pull_request
  branch.finish_current_card
end

#openObject



18
19
20
# File 'lib/trello_flow/main.rb', line 18

def open
  Branch.current.open_trello(current_user)
end

#start(name) ⇒ Object



11
12
13
14
15
16
# File 'lib/trello_flow/main.rb', line 11

def start(name)
  card = create_or_pick_card(name)
  card.add_member(current_user)
  card.start
  Branch.from_card(card).checkout
end