Skip to content

Commit

Permalink
Initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
practicingruby committed Nov 6, 2013
0 parents commit c556f9d
Show file tree
Hide file tree
Showing 12 changed files with 238 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor/cookbooks
1 change: 1 addition & 0 deletions .vagrant/machines/default/virtualbox/action_provision
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1383667566
1 change: 1 addition & 0 deletions .vagrant/machines/default/virtualbox/action_set_name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1383667566
1 change: 1 addition & 0 deletions .vagrant/machines/default/virtualbox/id
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4c199304-f959-4f87-a52f-2b78bdc1e4bd
1 change: 1 addition & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
metadata
10 changes: 10 additions & 0 deletions Berksfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"sources": {
"demo": {
"path": "."
},
"ruby_build": {
"locked_version": "0.8.0"
}
}
}
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem "berkshelf"
126 changes: 126 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
GEM
specs:
activesupport (3.2.15)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.5)
akami (1.2.0)
gyoku (>= 0.4.0)
nokogiri (>= 1.4.0)
berkshelf (2.0.10)
activesupport (~> 3.2.0)
addressable (~> 2.3.4)
buff-shell_out (~> 0.1)
chozo (>= 0.6.1)
faraday (>= 0.8.5)
hashie (>= 2.0.2)
minitar (~> 0.5.4)
rbzip2 (~> 0.2.0)
retryable (~> 1.3.3)
ridley (~> 1.5.0)
solve (>= 0.5.0)
thor (~> 0.18.0)
buff-config (0.4.0)
buff-extensions (~> 0.3)
varia_model (~> 0.1)
buff-extensions (0.5.0)
buff-ignore (1.1.0)
buff-ruby_engine (0.1.0)
buff-shell_out (0.1.0)
buff-ruby_engine (~> 0.1.0)
builder (3.2.2)
celluloid (0.14.1)
timers (>= 1.0.0)
celluloid-io (0.14.1)
celluloid (>= 0.14.1)
nio4r (>= 0.4.5)
chozo (0.6.1)
activesupport (>= 3.2.0)
hashie (>= 2.0.2)
multi_json (>= 1.3.0)
erubis (2.7.0)
faraday (0.8.8)
multipart-post (~> 1.2.0)
ffi (1.9.0)
gssapi (1.0.3)
ffi (>= 1.0.1)
gyoku (1.1.0)
builder (>= 2.1.2)
hashie (2.0.5)
httpclient (2.3.4.1)
httpi (0.9.7)
rack
i18n (0.6.5)
json (1.8.1)
little-plugger (1.1.3)
logging (1.8.1)
little-plugger (>= 1.1.3)
multi_json (>= 1.3.6)
mini_portile (0.5.1)
minitar (0.5.4)
mixlib-authentication (1.3.0)
mixlib-log
mixlib-log (1.6.0)
multi_json (1.8.2)
multipart-post (1.2.0)
net-http-persistent (2.9)
net-ssh (2.7.0)
nio4r (0.5.0)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
nori (1.1.5)
rack (1.5.2)
rbzip2 (0.2.0)
retryable (1.3.3)
ridley (1.5.3)
addressable
buff-config (~> 0.2)
buff-extensions (~> 0.3)
buff-ignore (~> 1.1)
buff-shell_out (~> 0.1)
celluloid (~> 0.14.0)
celluloid-io (~> 0.14.0)
erubis
faraday (>= 0.8.4)
hashie (>= 2.0.2)
json (>= 1.7.7)
mixlib-authentication (>= 1.3.0)
net-http-persistent (>= 2.8)
net-ssh
nio4r (>= 0.5.0)
retryable
solve (>= 0.4.4)
varia_model (~> 0.1)
winrm (~> 1.1.0)
rubyntlm (0.1.1)
savon (0.9.5)
akami (~> 1.0)
builder (>= 2.1.2)
gyoku (>= 0.4.0)
httpi (~> 0.9)
nokogiri (>= 1.4.0)
nori (~> 1.0)
wasabi (~> 1.0)
solve (0.8.1)
thor (0.18.1)
timers (1.1.0)
uuidtools (2.1.4)
varia_model (0.2.0)
buff-extensions (~> 0.2)
hashie (>= 2.0.2)
wasabi (1.0.0)
nokogiri (>= 1.4.0)
winrm (1.1.3)
gssapi (~> 1.0.0)
httpclient (~> 2.2, >= 2.2.0.2)
logging (~> 1.6, >= 1.6.1)
nokogiri (~> 1.5)
rubyntlm (~> 0.1.1)
savon (= 0.9.5)
uuidtools (~> 2.1.2)

PLATFORMS
ruby

DEPENDENCIES
berkshelf
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Demo Cookbook
========================

This Chef cookbook is a code sample from Issue 7.6 of Practicing Ruby. It installs
Ruby 2.0, updates RubyGems to the latest version, and then installs the
Bundler gem. It makes use of the [ruby_build][] cookbook to do
its heavy lifting.

## Requirements

To use this cookbook, you need the following software:

* [VirtualBox] - Version 4.2 or higher
* [Vagrant] - Version 1.3.4 or higher
* [vagrant-omnibus] - installable via `vagrant plugin install vagrant-omnibus`
* [Berkshelf] - installable via `bundle install`

When you provision a VM using this cookbook, Chef will be installed for you
via `vagrant-omnibus`, and if necessary an Ubuntu Linux base system image will
be downloaded automatically. See the project's `Vagrantfile` for exact
versions used.

## Provisioning

Run the following two commands inside the cookbook to create a vagrant box and boot it up:

$ bundle exec berks install --path vendor/cookbooks
$ vagrant up --provision

In case the VM is already up, you can always run Chef again with:

$ bundle exec berks install --path vendor/cookbooks
$ vagrant provision

To SSH into the running VM:

$ vagrant ssh

You can verify the Ruby, RubyGems, and Bundler versions with the following commands:

$ ruby -v
$ gem -v
$ bundle -v

Last but not least, here is how to stop and destroy the VM when you no longer
need it or when you want to start from scratch:

$ vagrant destroy -f

[ruby_build]: https://github.com/fnichol/chef-ruby_build
[Berkshelf]: http://berkshelf.com/
[Vagrant]: http://vagrantup.com
[VirtualBox]: https://www.virtualbox.org/
[practicingruby-web]: https://github.com/elm-city-craftworks/practicing-ruby-web
[vagrant-omnibus]: https://github.com/schisamo/vagrant-omnibus
15 changes: 15 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
VAGRANTFILE_API_VERSION="2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"

config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/"+
"precise-server-cloudimg-amd64-vagrant-disk1.box"

config.omnibus.chef_version = "11.6.2"

config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "vendor/cookbooks"
chef.add_recipe "demo::default"
end
end
7 changes: 7 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name "demo"
version "1.0.0"
recipe "demo::default", "Installs Ruby"

supports "ubuntu", ">= 12.04"

depends "ruby_build"
17 changes: 17 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Install ruby-build
include_recipe "ruby_build"

# Build and install Ruby version using ruby-build. By installing it to
# /usr/local, we ensure it is the new global Ruby version from now on.
ruby_build_ruby "2.0.0-p247" do
prefix_path "/usr/local"
end

# Update to the latest RubyGems version
execute "update-rubygems" do
command "gem update --system"
not_if "gem list | grep -q rubygems-update"
end

# Install Bundler
gem_package "bundler"

0 comments on commit c556f9d

Please sign in to comment.