Skip to content

Instantly share code, notes, and snippets.

@webuilder240
Last active October 17, 2016 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save webuilder240/1b1549869dd85b7ef17e to your computer and use it in GitHub Desktop.
Save webuilder240/1b1549869dd85b7ef17e to your computer and use it in GitHub Desktop.
require 'bundler'
require 'bundler/setup'
require 'trello'
include Trello
include Trello::Authorization
application_key = ""
application_secret = ""
application_token = ""
Trello::Authorization.const_set :AuthPolicy, OAuthPolicy
OAuthPolicy.consumer_credential = OAuthCredential.new application_key, application_secret
OAuthPolicy.token = OAuthCredential.new application_token, nil
me = Trello::Member.find("me")
board_name = ARGV[0]
version_name = ARGV[1]
file_name = "release_for_#{version_name}.md"
me.boards.each do |board|
if board.name == board_name
board.lists.each do |list|
if list.name == version_name
File.open(file_name, 'w') do |fh|
fh.write("# Release for #{board_name} #{version_name}" + "\n\n")
list.cards.each do |card|
headline = "- #{card.name}"
card.card_labels.map {|label| headline << " [ #{label['name']} ]"}
fh.write("#{headline}\n")
end
end
break
end
end
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment