Report abuse

save to bulkedit.rb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
if ARGV.size < 5
  puts "ruby bulkedit.rb MYTOKEN MYACCOUNT MYPROJECT QUERY COMMAND [MIGRATION_TOKEN]"
  puts
  puts "example: ruby bulk edit.rb 1sdfasd23rfSDfasdf shake-and-bake 1 \"milestone:\\\"1.0 Launch\\\" state:open\" \"milestone:next\""
  puts
  puts "see also: http://help.lighthouseapp.com/faqs/ticket-workflow/ticket-keyword-updates"
  puts "problems? http://help.lighthouseapp.com"
  exit
end

token   = ARGV.shift
account = ARGV.shift
project = ARGV.shift
params = {'query' => ARGV.shift, 'command' => ARGV.shift, 'migration_token' => ARGV.shift}

lh_domain = ENV['LH_DOMAIN'] || "lighthouseapp.com"

require 'net/http'
require 'uri'

res = Net::HTTP.post_form URI.parse("http://#{token}:x@#{account}.#{lh_domain}/projects/#{project}/bulk_edit.json"), params
if res.body == ' '
  puts "Done!"
else
  puts res.body
end