Skip to content

@nshbrown /github_lighthouse.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
#!/usr/local/bin/ruby
# This file creates a Git branch based on a specific Lighthouse ticket number
### CONFIG
lh_token = 'mysecretkey'
lh_username = false
lh_password = false
lh_account_name = "my_project"
lh_project_id = 1
### No need to modify below this line
require 'rubygems'
require 'lighthouse-api'
## Create a branch for lighthouse for the passed ticket number
ticket_number = ARGV[0]
Lighthouse.account = lh_account_name
#### You can use `authenticate` OR `token`
if lh_token
Lighthouse.token = lh_token
elsif lh_username && lh_password
Lighthouse.authenticate(lh_username, lh_password)
else
puts "This script is not configured yet. Open it up and change some of the config vars"
exit
end
if ticket_number && ticket_number.to_i > 0
puts "Creating new branch for Lighthouse ticket ##{ticket_number}"
`git checkout -b LH_#{ticket_number}`
else
puts "Please enter a valid ticket:\n"
project = Lighthouse::Project.find(lh_project_id)
project.tickets.each do |ticket|
puts " [##{ticket.id} is #{ticket.state}] [Milestone: #{ticket.milestone_title}] #{ticket.title}\n" if !['resolved', 'invalid'].include?(ticket.state)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.