Install (copy & paste):
curl -sL raw.github.com/gist/1676577/travis.rb > ~/bin/travis \
&& chmod +x ~/bin/travis
gem install hub | tail -2
ruby -e 'require "json"' 2>/dev/null || gem install json
require "erb" | |
require "pathname" | |
DOT_TEMPLATE=<<-END | |
digraph { | |
size="20,20"; | |
overlap=false; | |
sep=0.4; | |
graph [fontname=Helvetica,fontsize=10]; | |
node [fontname=Helvetica,fontsize=10]; |
require 'sinatra' | |
# before we process a route, we'll set the response as | |
# plain text and set up an array of viable moves that | |
# a player (and the computer) can perform | |
before do | |
content_type :txt | |
@defeat = {rock: :scissors, paper: :rock, scissors: :paper} | |
@throws = @defeat.keys | |
end |
# Save this in an empty directory as Vagrantfile and run: | |
# | |
# gem install vagrant | |
# vagrant up | |
# vagrant ssh | |
# | |
# You need to have a recent VirtualBox installed. | |
Vagrant::Config.run do |config| | |
config.vm.box = "travis-ruby" | |
config.vm.box_url = "http://files.travis-ci.org/boxes/provisioned/travis-ruby.box" |
begin | |
require 'highline/import' | |
rescue LoadError | |
puts "we need highline, please run:", "", "\tgem install highline", "" | |
exit 1 | |
end | |
begin | |
require 'gh' | |
rescue LoadError |
# encoding: binary | |
# Removes any bytes from a string that are not valid UTF-8 | |
class Cleaner | |
attr_reader :bytes, :buffer, :outstanding | |
def self.clean(str) | |
new.tap { |c| c << str }.to_s | |
end |
class Chef | |
class Recipe | |
def skip_unsupported_platform | |
unless supported_platform? | |
Chef::Log.info("Unsupported platform #{node[:platform]} in #{cookbook_name}::#{recipe_name}, skipping recipe") | |
Chef::Log.debug("You said to skip unsupported platforms in #{cookbook_name}::#{recipe_name}") | |
Chef::Log.debug("and #{node['platform']} is unsupported by cookbook #{cookbook_name}. Update the cookbook's metadata") | |
Chef::Log.debug("if this is a supported platform, or remove #{cookbook_name}::#{recipe_name} from the node.") | |
end | |
end |
# To have the last stable version of Chef (10.14.4) | |
# with the official Vagrant boxes | |
config.vm.provision :shell, | |
:inline => "gem search -i chef -v 10.14.4 || gem install chef -v 10.14.4 --no-rdoc --no-ri" | |
# with the official Opscode boxes | |
config.vm.provision :shell, | |
:inline => "/opt/chef/embedded/bin/gem search -i chef -v 10.14.4 || /opt/chef/embedded/bin/gem install chef -v 10.14.4 --no-rdoc --no-ri" |
desc 'generate a class in lib/ and a spec in spec/lib/ for name=underscored_class_name' | |
task :genclass do | |
require 'erb' | |
filename = ENV['name'] | |
raise 'must specify name=underscored_class_name' unless filename | |
classname = filename.camelize | |
class_file_template = ERB.new <<-EOF | |
class <%= classname %> |