github.com/rakutentech/cli@v6.12.5-0.20151006231303-24468b65536e+incompatible/bin/pivotal-tracker-deliver (about)

     1  #!/usr/bin/env ruby
     2  
     3  # gem 'pivotal-tracker'
     4  require 'pivotal-tracker'
     5  
     6  PivotalTracker::Client.token = ENV["PIVOTAL_TRACKER_TOKEN"]
     7  PivotalTracker::Client.use_ssl = true
     8  
     9  unpakt_project = PivotalTracker::Project.find(ENV["PIVOTAL_TRACKER_PROJECT_ID"])
    10  stories = unpakt_project.stories.all(:state => "finished", :story_type => ['bug', 'feature'])
    11  
    12  staging_deploy_tag = `git tag | grep staging | tail -n1`
    13  
    14  stories.each do | story |
    15    puts "Searching for #{story.id} in local git repo."
    16    search_result = `git log --grep #{story.id} #{staging_deploy_tag}`
    17    if search_result.length > 0
    18      puts "Found #{story.id}, marking as delivered."
    19      story.notes.create(:text => "Delivered by jenkins.")
    20      story.update({"current_state" => "delivered"})
    21    else
    22      puts "Could not find #{story.id} in git repo."
    23    end
    24  end