Skip to content

Instantly share code, notes, and snippets.

@sebastiangeiger
Created October 31, 2014 16:45
Show Gist options
  • Save sebastiangeiger/377cb2052b27eaf3ccfb to your computer and use it in GitHub Desktop.
Save sebastiangeiger/377cb2052b27eaf3ccfb to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'pivotal-tracker'
def main
raise "Please set your PIVOTAL_TOKEN" unless ENV["PIVOTAL_TOKEN"]
PivotalTracker::Client.token = ENV["PIVOTAL_TOKEN"]
projects = PivotalTracker::Project.all
matches = projects.select do |project|
project.name == "ClariStream Management System"
end
if matches.size == 1
claristream = matches.first
offenders = claristream.stories.all.reject do |story|
story.name.start_with?(story.id.to_s)
end.reject do |story|
story.name =~ /STORY TEMPLATE/
end
offenders.each do |story|
new_name = "#{story.id} - #{story.name}"
puts %Q{"#{story.name}" -> "#{new_name}"}
story.update(name: new_name)
end
else
raise "Found #{matches.size} matching projects, need 1!"
end
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment