Skip to content

Instantly share code, notes, and snippets.

View brettcave's full-sized avatar

Brett cave brettcave

View GitHub Profile
@brettcave
brettcave / gist:6184116
Last active December 20, 2015 19:38
ERB conditional
Environment: <%= @environment %>
<% if @environment == "PROD" %>
noThen {}
<% end %>
<% if @environment == "PROD" then %>
withThen {}
<% end %>
@brettcave
brettcave / gist:6112224
Last active December 20, 2015 09:59
chef_gem strangeness
g = chef_gem "somegem" do
action :nothing
end
g.run_action(:install)
require 'somegem'
# Works
####
@brettcave
brettcave / gist:6104137
Created July 29, 2013 12:59
a nice way to run recipes within recipes.
r = recipe "apt::default" do
action :nothing
done
r.run_action(:execute)
@brettcave
brettcave / gist:6103434
Last active December 20, 2015 08:49
How to install a gem with dependencies.
include_recipe "apt"
package_list = ["ruby1.9.1-dev","make", " libxml2-dev" ]
package_list.each do |pkg|
r = package pkg do
action :install
## action :nothing
end
## r.runaction(:install)
end
@brettcave
brettcave / gist:6087089
Created July 26, 2013 08:03
Difference between gem install syntax
gem_package "gem" do
action :install
done
r = gempackage "gem" do
action :nothing
done
r.runaction(:install)