Created
February 17, 2011 00:36
-
-
Save codekitchen/830667 to your computer and use it in GitHub Desktop.
update redmine environment with a new staging/production ref
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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