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
in routes.rb | |
map.resources :staff, :member => {:graph_code=>:get} | |
in controller, | |
@graph = open_flash_chart_object(500,300, graph_code_staff_path( {:title=>'Timesheet', :conditions=>@conditions})) | |
in view, error: | |
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
it "should get another hmac" do | |
bs = 'GET&http%3A%2F%2Fterm.ie%2Foauth%2Fexample%2Frequest_token.php&oauth_consumer_key%3Dkey%26oauth_nonce%3DuhnyjcnYEyO9vUxPAcdttE0OqbFPgBOp2xv7XmN6bw%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1223595784%26oauth_token%3Dtoken%26oauth_version%3D1.0' | |
@oa.signature(bs, 'secret', '').should == "cumMcmS4gQG5pcrtlgckPv/V0WU=" | |
end | |
end | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'thor' | |
require 'fileutils' | |
require 'yaml' | |
# TODO | |
# - pulling a specific UUID/Tag (gitspec hash) with clone/update | |
# - a 'deploy' task (in addition to 'redeploy' ?) | |
# - add merb:gems:refresh to refresh all gems (from specifications) |
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
class Project < Sequel::Model | |
one_to_many :milestones | |
one_to_many :tickets | |
def self.update_from_lighthouse(project_id=nil, updated_at=nil) | |
#TODO: allow scoping this call to only records updated_at>? | |
Lighthouse::Project.find(:all).each do |lh_project| | |
if project=Project[lh_project.id] | |
project.update_from_lighthouse | |
else |
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
class TicketNumbersMigration < Sequel::Migration | |
def up | |
alter_table(:tickets) do | |
add_column 'number', :integer | |
end | |
end | |
def down | |
alter_table(:tickets) do |
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
#!/usr/bin/env ruby | |
# 2008.10.03 | |
# JD Huntington | |
# shell script to assist in working with lighthouse and git | |
# requires lighthouse api ruby wrapper from http://github.com/Caged/lighthouse-api/tree/master | |
LIB_DIR='~/lib' # Absolute location of lighthouse.rb and lighthouse-api.rb | |
TOKEN='' # Insert your lighthouse token | |
ACCOUNT='' # Insert your lighthouse account name |
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
abbot(fairchild@abbot) :~/WebApps/lightsheet2 | |
> ls gems/gems/httparty-0.1.3/lib/ | |
httparty/ httparty.rb | |
abbot(fairchild@abbot) :~/WebApps/lightsheet2 | |
> merb -i | |
Warning: please use bin/merb to load merb-core-0.9.9 from ./gems | |
Loading init file from /home/fairchild/WebApps/lightsheet2/config/init.rb | |
Loading /home/fairchild/WebApps/lightsheet2/config/environments/development.rb | |
~ Loaded DEVELOPMENT Environment... | |
~ |
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
class Ticket < Sequel::Model | |
set_schema do | |
foreign_key :ticket_version_id, :table => :ticket_version | |
end | |
is(:versioned_fact, {:dimensions => [TicketVersion]}) | |
one_to_many :ticket_versions | |
end | |
class TicketVersion < Sequel::Model | |
set_schema do |
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
#Query LH for ticket, and update db cache. Allow ticket number or lh ticket object | |
def self.update_or_create_from_lighthouse(ticket, project_id) | |
lh_ticket = case ticket.class | |
when Fixnum: Ticket.retrieve_from_lh(ticket, project_id) | |
when Lighthouse::Ticket: Ticket.retrieve_from_lh(ticket.number, project_id) | |
else return false | |
end | |
if lh_ticket == 404 #delete ticket if it was deleted from LH |
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
class Spec::Example::ExampleGroup | |
def execute(*args, &block) | |
# DB = Merb::Orms::Sequel.connect | |
Merb::Orms::Sequel.connect.transaction do | |
super(*args, &block) | |
raise Sequel::Error::Rollback | |
end | |
end | |
end |