This file contains hidden or 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
| # Only fixes the structural stupidity, not the retardedness | |
| # of the underlying method of package finding | |
| def get_cruise_package(cruise_package_code) | |
| returning(package = nil) do |pack| | |
| [ | |
| :getPreHotelPackage, :getPostHotelPackage, :getShorexPackage, | |
| :getPreTransfersPackage, :getPostTransfersPackage, getMotorcoachPackage | |
| ].detect do |find_by_package_type| | |
| pack = send(find_by_package_type, cruise_package_code) | |
| end |
This file contains hidden or 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 Report | |
| attr_reader :input, :output | |
| def initialize(input, output) | |
| @input = input | |
| @output = output | |
| end | |
| def publish(server) |
This file contains hidden or 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 Report | |
| BLANK = "".freeze | |
| class << self | |
| def publish(server, options = {}) | |
| report = self.new | |
| report.process(options[:log], server) | |
| end | |
| end |
This file contains hidden or 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 ActivateDeviceReport < Report | |
| fields :time, :date :call_id, :exec_time, :account_number, :sr_number, :serial_number , :output, :das_server | |
| pattern /^(\d{2}:\d{2}:\d{2},\d{3}).*?(\d{2}\/\d{2})\s(\w*?)\s.*?\[execution\(activateDevice\)\].*?(\d*)ms.*?accountNumber=(\d*?),srNumber=(\d*?)\],serialNumber=(.*?),.*?output\s=\s(.*?)/ | |
| end |
This file contains hidden or 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
| require 'config/environment' | |
| def create_reports | |
| DAS_SERVERS.each do |server| | |
| report = SubmitTerminationReport.publish(server, :log => STATE_LOG); | |
| write_file(report, server, SUBMIT_TERM_PREFIX) | |
| report = ActivateDeviceReport.publish(server, :log => DAO_LOG); | |
| write_file(report, server, ACTIVATE_DEVICE_PREFIX) | |
This file contains hidden or 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
| # Hmmm, not sure I like it | |
| # not much of an improvement | |
| class Thing < AR::Base | |
| StateMap = Hash.new {|h,k| h[k] = @@states[3]}.update({ | |
| 'disabled' => @@states[0..1], | |
| 'active' => @@states[2], | |
| 'all' => nil | |
| }) | |
This file contains hidden or 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
| #!/bin/sh | |
| trap "exit 2" 1 2 3 13 15 | |
| OPTS="--no-rdoc --no-ri" | |
| if [ -f "/etc/lsb-release" ]; then | |
| ### bootstrap with git. | |
| apt-get update -y && apt-get upgrade -y --force-yes && apt-get install -y git-core vim | |
This file contains hidden or 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 'octopi' | |
| require 'choice' | |
| include Octopi | |
| Choice.options do | |
| header '' |
This file contains hidden or 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 | |
| puts "looking for the gems to upgrade..." | |
| gem_info = Struct.new(:name, :version) | |
| to_reinstall = [] | |
| Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path| | |
| path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/ | |
| name, version = $1, $2 | |
| bundle_info = `file path` | |
| to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/ | |
| end |
This file contains hidden or 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
| module SQLGrowler | |
| class Subscriber < ActiveRecord::Railties::Subscriber | |
| def sql(event) | |
| super | |
| g('%s (%.1fms) %s' % [event.payload[:name], event.duration, event.payload[:sql].squeeze(' ')]) | |
| end | |
| end | |
| def self.enable | |
| if Kernel.respond_to?(:g) |
OlderNewer