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 Pop | |
| def initialize(h={}, &block) | |
| default_options(h) | |
| puts "indide #{self.class} #{doop.inspect}" | |
| instance_eval &block if block | |
| end | |
| def self.default_options | |
| @@default_options | |
| 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 Pop | |
| def initialize(h={}, &block) | |
| options(h) | |
| puts "indide #{self.class} #{options.inspect}" | |
| instance_eval &block if block | |
| end | |
| def self.default_options(h={}) | |
| @default_options ||= h | |
| 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
| # It would be nice to have a simple way to describe metrics I want to monitor on my server. | |
| # Perhaps a dsl would help out here | |
| # --- | |
| # Lets think about the API first. | |
| # How would you express your intent in english? | |
| # Perhaps: | |
| # Get the load and send an email when it is greater than 1. | |
| # --- | |
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
| # Basic pool spec | |
| # Shows global settings for the clouds | |
| pool :application do | |
| instances 1..3 | |
| keypair "#{ENV["HOME"]}/.ec2oncourse/r_and_d.pem" | |
| verbose true | |
| ami 'ami-7cfd1a15' | |
| # testing false | |
| cloud :pp1 do |
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 'rubygems' | |
| require 'open4' | |
| require 'ec2' | |
| class Ec2 | |
| aws_keys = {} | |
| aws_keys = YAML::load( File.open('/etc/poolparty/aws_keys.yml') ) rescue 'No aws_keys.yml file. Will try to use enviornment variables' | |
| ACCESS_KEY_ID = aws_keys[:access_key] || ENV['AMAZON_ACCESS_KEY_ID'] || ENV['AWS_ACCESS_KEY'] | |
| SECRET_ACCESS_KEY = aws_keys[:secret_access_key] || ENV['AMAZON_SECRET_ACCESS_KEY'] || ENV['AWS_SECRET_ACCESS_KEY'] | |
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 'rubygems' | |
| require 'ec2' | |
| module BootStrapper | |
| class Ec2 | |
| aws_keys = {} | |
| aws_keys = YAML::load( File.open('/etc/poolparty/aws_keys.yml') ) rescue 'No aws_keys.yml file. Will try to use enviornment variables' | |
| ACCESS_KEY_ID = aws_keys[:access_key] || ENV['AMAZON_ACCESS_KEY_ID'] || ENV['AWS_ACCESS_KEY'] | |
| SECRET_ACCESS_KEY = aws_keys[:secret_access_key] || ENV['AMAZON_SECRET_ACCESS_KEY'] || ENV['AWS_SECRET_ACCESS_KEY'] | |
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
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
| } | |
| GRAY="\[\033[1;30m\]" | |
| LIGHT_GRAY="\[\033[0;37m\]" | |
| WHITE="\[\033[1;37m\]" | |
| LIGHT_BLUE="\[\033[1;34m\]" | |
| LIGHT_RED="\[\033[1;31m\]" |
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
| # ~.autotest | |
| require 'autotest/redgreen' | |
| # require 'autotest/timestamp' | |
| # require 'autotest/growl' | |
| # require 'autotest/html_report' | |
| def summary_to_hash(summary_string) | |
| res = Hash.new |
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
| @remote_instances_list =[ | |
| {:status=>'running', :ip=>'10'}, | |
| {:status => 'pending', :ip=>'not.assigned'}, | |
| {:status=>'running', :ip=>'192', :bogus=>nil} | |
| ] | |
| class Array | |
| # Example nodes.select_with_hash(:status=>'running') | |
| def select_with_hash(conditions={}) | |
| select do |node| |
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
| # Just some rough ideas on how request URLs might be mapped to class::module.method | |
| class Server | |
| module Get | |
| def load(req, resp) | |
| path_vars "/:duration/:units/:averaged" #this could parse local vars out of req.path | |
| resp.body = Server.uptime | |
| resp | |
| end | |
| end |