Skip to content

Instantly share code, notes, and snippets.

@codekitchen
Created February 17, 2011 00:36
Show Gist options
  • Save codekitchen/830667 to your computer and use it in GitHub Desktop.
Save codekitchen/830667 to your computer and use it in GitHub Desktop.
update redmine environment with a new staging/production ref
# requires redmine 1.1.x for the REST API fixes
require 'rubygems'
gem 'activeresource'
require 'active_resource'
env = ARGV.shift
new_commit = ARGV.shift
class Project < ActiveResource::Base
# self.site = 'https://redmine.instructure.com/'
self.site = 'http://localhost:3002/'
self.user = ENV['REDMINE_SECRET_ACCESS_KEY'] || raise("Need REDMINE_SECRET_ACCESS_KEY, available on the right sidebar of https://redmine.instructure.com/my/account")
self.password = '1234' # password can be anything when api key is used
end
canvas = Project.find('canvas')
field_name = "#{env} ref"
field = canvas.custom_fields.find { |f| f.name == field_name }
raise("Couldn't find #{field_name} custom field on canvas project") unless field
field.value = new_commit
canvas.save!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment