Class: TrelloScrum::Cli
- Inherits:
-
Thor
- Object
- Thor
- TrelloScrum::Cli
- Defined in:
- lib/cli.rb
Instance Method Summary collapse
- #authorize ⇒ Object
- #excel(outfile) ⇒ Object
- #pdf(outfile) ⇒ Object
- #setup(developer_public_key, member_token, board_id = nil, list_name = nil) ⇒ Object
Instance Method Details
#authorize ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/cli.rb', line 87 def # Open the browser url = "https://trello.com/1/connect" url << "?key=#{self.config["developer_public_key"]}" url << "&name=TrelloScrumCard&response_type=token" Launchy.open(url) member_token = ask("Paste member token here:") if member_token =~ /.+/ self.config["member_token"] = member_token write_config! else say "No member token entered. Not saving new member token" end end |
#excel(outfile) ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/cli.rb', line 46 def excel(outfile) trello = setup_trello lists_with_cards = trello.get_cards(.list || config["list_name"], ) sheet = Spreadsheet.new sheet.render_cards(lists_with_cards) sheet.save(outfile) end |
#pdf(outfile) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cli.rb', line 23 def pdf(outfile) trello = setup_trello list_name = .list || config["list_name"] if !list_name || list_name.empty? say "Please enter a listname (using --list) or configure one using setup" exit(1) end lists_with_cards = trello.get_cards(list_name, ) pdf = Pdf.new pdf.render_cards(lists_with_cards) pdf.save(outfile) end |
#setup(developer_public_key, member_token, board_id = nil, list_name = nil) ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'lib/cli.rb', line 73 def setup(developer_public_key, member_token, board_id=nil, list_name=nil) self.config["developer_public_key"] = developer_public_key self.config["member_token"] = member_token self.config["board_id"] = board_id if board_id self.config["list_name"] = list_name if list_name write_config! end |