- My blink is that in 2012 Puppet is safer and more productive.
- Puppet is declarative, Chef procedural.
- Puppet brings system into compliance (state), Chef "does" things (recipes).
- Puppet has strong security practices; Chef has a toleration for loose security in Chef itself.
- Puppet makes it very hard to get "outside the lines" or violate its strong opinions; in Chef this is routine.
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
require 'spec_helper' | |
describe QuitCommand do | |
let(:terminal) { double('terminal', shutdown: true ) } | |
let(:command) { QuitCommand.new terminal } | |
context do | |
subject{ command } |
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
#command_factory_spec.rb: | |
require 'spec_helper' | |
describe CommandFactory do | |
let(:factory) { CommandFactory.new nil } | |
subject { factory.command(:foo) } | |
context 'a thing' 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
# Version 2 -- the cool version | |
require 'redis' | |
require 'forwardable' #standard ruby library | |
class RedisTester | |
# this way, we create the instance and check to see it's running every time | |
# we ask for it automatically. | |
def redis | |
@redis ||= Redis.new | |
raise unless redis_is_running? | |
@redis |
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
# Here's how I might do it, though I'd probably skip the shared_examples and just duplicate them. I feel | |
# like it hides things a bit too much otherwise. Given that it doesn't represent a _huge_ extraction, I wouldn't | |
# mind the duplication. | |
# | |
# I'm pretty sure that subject is preserved across shared example calls, if it's not, you might need to improvise. | |
# | |
shared_examples_for "Firefox browser" do | |
its(:browser) { should == "Firefox" } | |
its(:security) { should == :strong } |
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
require 'minitest/autorun' | |
### | |
# Test to demonstrate TCO in Ruby. Tested in 1.9.2+ | |
class TestTCO < MiniTest::Unit::TestCase | |
code = <<-eocode | |
class Facts | |
def fact_helper(n, res) | |
if n == 1 | |
res |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |