Skip to content

Instantly share code, notes, and snippets.

View Atalanta's full-sized avatar

Stephen Nelson-Smith Atalanta

  • Ticketmaster
  • Hampshire, UK
View GitHub Profile
require 'rubygems'
require 'thor'
require 'fileutils'
require 'awesome_print'
ap ARGV
command = ARGV.first
arguments = ARGV[1..-1]
GEM_DIR = Gem.default_dir
#!/usr/bin/env ruby
require 'rubygems'
require 'thor'
require 'pathname'
command = ARGV.first
arguments = ARGV[1..-1]
class CucumberChef < Thor
( ) ( ) )
) ( ) ( (
( ) ( ) )
_____________
<_____________> ___
| |/ _ \
| | | |
| |_| |
___| |\___/
class Config
def initialize(data={})
@data = {}
update!(data)
end
def update!(data)
data.each do |key,value|
self[key] = value
end
require 'rubygems'
require 'sinatra'
require 'haml'
require 'awesome_print'
before do
@yoga_classes = {"hatha beginners" => ['meli', 'wilf'], "hatha intermediate" => ['atty', 'corin', 'grabby'], "ashthanga beginners" => ['corin', 'atty'], "ashtanga intermediate" => ['corin', 'stephen', 'helena', 'grandpa'], "asthanga advanced" => ['helena', 'denis']}
end
helpers do
import json, socket, struct
s = socket.socket()
evil_todo_list = []
def do_cmd(data):
cmd = data[0]
if cmd == "push":
evil_todo_list.append(data[1])
return len(evil_todo_list)
sh -c '
mkdir -p /etc/chef
(
cat <<'EOP'
<%= IO.read(Chef::Config[:validation_key]) %>
EOP
) > /tmp/validation.pem
awk NF /tmp/validation.pem > /etc/chef/validation.pem
require 'fog'
require 'net/ssh/multi'
managed_ec2_nodes = []
nodes.all.each do |n|
if n.attribute?("ec2")
managed_ec2_nodes << n["ec2"]["instance_id"]
end
end

Anatomy of a Cucumber test suite

features/                  # Base directory for all your features
features/step_definitions/ # Generic steps used across multiple features
features/support/          # Cucumber bootstrapping directory

On boot, Cucumber will load up features/support/env.rb. This is where you should include all the libraries you want to use. So features/support/env.rb doesn't get cluttered, it's suggested you split out your customisations into

require 'ubuntu_ami'
require 'awesome_print'
require 'chef/knife/ec2_server_create'
require 'trollop'
def convert_input(arguments)
arguments.reject do |option|
option !~ /^[a-z]+:[a-z]{2,}-*[a-z]*-*\d*$/
end.map do |option|
opt, value = option.split(':')