flombe 0.1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.gitignore +4 -0
  2. data/.gitmodules +3 -0
  3. data/.rspec +2 -0
  4. data/Flombefile +9 -0
  5. data/Gemfile +10 -0
  6. data/Gemfile.lock +57 -0
  7. data/LICENSE +20 -0
  8. data/Rakefile +33 -0
  9. data/bin/flombe +17 -0
  10. data/config/rake.rb +38 -0
  11. data/cookbooks/homebrew/README.rdoc +8 -0
  12. data/cookbooks/homebrew/metadata.rb +8 -0
  13. data/cookbooks/homebrew/providers/homebrew.rb +39 -0
  14. data/cookbooks/homebrew/recipes/default.rb +42 -0
  15. data/cookbooks/homebrew/resources/homebrew.rb +14 -0
  16. data/cookbooks/mysql/README.rdoc +8 -0
  17. data/cookbooks/mysql/metadata.rb +6 -0
  18. data/cookbooks/mysql/recipes/default.rb +43 -0
  19. data/cookbooks/mysql/recipes/timezone.rb +10 -0
  20. data/cookbooks/redis/README.rdoc +8 -0
  21. data/cookbooks/redis/metadata.rb +6 -0
  22. data/cookbooks/redis/recipes/2.0.4.rb +24 -0
  23. data/cookbooks/redis/recipes/default.rb +7 -0
  24. data/cookbooks/rvm/CHANGELOG.md +19 -0
  25. data/cookbooks/rvm/README.md +564 -0
  26. data/cookbooks/rvm/Rakefile +35 -0
  27. data/cookbooks/rvm/attributes/default.rb +54 -0
  28. data/cookbooks/rvm/attributes/gem_package.rb +23 -0
  29. data/cookbooks/rvm/attributes/vagrant.rb +22 -0
  30. data/cookbooks/rvm/libraries/gem_package_monkeypatch.rb +34 -0
  31. data/cookbooks/rvm/libraries/helpers.rb +334 -0
  32. data/cookbooks/rvm/libraries/rvm_rubygems_package.rb +108 -0
  33. data/cookbooks/rvm/metadata.json +271 -0
  34. data/cookbooks/rvm/metadata.rb +95 -0
  35. data/cookbooks/rvm/providers/default_ruby.rb +46 -0
  36. data/cookbooks/rvm/providers/environment.rb +50 -0
  37. data/cookbooks/rvm/providers/gemset.rb +135 -0
  38. data/cookbooks/rvm/providers/global_gem.rb +99 -0
  39. data/cookbooks/rvm/providers/ruby.rb +100 -0
  40. data/cookbooks/rvm/providers/shell.rb +68 -0
  41. data/cookbooks/rvm/providers/wrapper.rb +58 -0
  42. data/cookbooks/rvm/recipes/default.rb +73 -0
  43. data/cookbooks/rvm/recipes/gem_package.rb +23 -0
  44. data/cookbooks/rvm/recipes/system.rb +69 -0
  45. data/cookbooks/rvm/recipes/user.rb +47 -0
  46. data/cookbooks/rvm/recipes/vagrant.rb +30 -0
  47. data/cookbooks/rvm/resources/default_ruby.rb +29 -0
  48. data/cookbooks/rvm/resources/environment.rb +29 -0
  49. data/cookbooks/rvm/resources/gem.rb +36 -0
  50. data/cookbooks/rvm/resources/gemset.rb +30 -0
  51. data/cookbooks/rvm/resources/global_gem.rb +33 -0
  52. data/cookbooks/rvm/resources/ruby.rb +29 -0
  53. data/cookbooks/rvm/resources/shell.rb +40 -0
  54. data/cookbooks/rvm/resources/wrapper.rb +32 -0
  55. data/cookbooks/rvm/templates/default/rvmrc.erb +14 -0
  56. data/cookbooks/rvm/templates/default/vagrant-chef-solo-wrapper.erb +23 -0
  57. data/cookbooks/utils/README.rdoc +8 -0
  58. data/cookbooks/utils/metadata.rb +6 -0
  59. data/cookbooks/utils/recipes/default.rb +10 -0
  60. data/cookbooks/utils/recipes/dotfiles.rb +21 -0
  61. data/cookbooks/utils/templates/default/dot.profile.erb +36 -0
  62. data/flombe.gemspec +28 -0
  63. data/lib/flombe/dsl.rb +66 -0
  64. data/lib/flombe.rb +107 -0
  65. data/spec/dsl_spec.rb +111 -0
  66. data/spec/flombe_spec.rb +30 -0
  67. data/spec/quality_spec.rb +11 -0
  68. data/spec/spec_helper.rb +21 -0
  69. data/spec/support/helpers.rb +18 -0
  70. data/spec/support/matchers.rb +9 -0
  71. data/spec/support/path.rb +21 -0
  72. data/templates/chef_solo.erb +11 -0
  73. metadata +154 -0
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ cache/*
2
+ backup/*
3
+ tmp/*
4
+ chef-stacktrace.out
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "cookbooks/rvm"]
2
+ path = cookbooks/rvm
3
+ url = git@github.com:devpips/chef-rvm.git
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format documentation
data/Flombefile ADDED
@@ -0,0 +1,9 @@
1
+ recipe "homebrew"
2
+ recipe "utils"
3
+ recipe "utils::dotfiles"
4
+ recipe "mysql"
5
+ recipe "mysql::timezone"
6
+ recipe "redis::2.0.4"
7
+
8
+ recipe "rvm"
9
+ rubies "ruby-1.9.2-p180", :default => "ruby-1.9.2-p180"
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'http://rubygems.org'
2
+
3
+ group :runtime do
4
+ gem "chef", "~>0.9.10"
5
+ gem "erubis"
6
+ end
7
+
8
+ group :test, :development do
9
+ gem "rspec", "~>2.6.0"
10
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,57 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ bunny (0.6.0)
5
+ chef (0.9.16)
6
+ bunny (>= 0.6.0)
7
+ erubis
8
+ extlib
9
+ highline
10
+ json (>= 1.4.4, <= 1.4.6)
11
+ mixlib-authentication (>= 1.1.0)
12
+ mixlib-cli (>= 1.1.0)
13
+ mixlib-config (>= 1.1.2)
14
+ mixlib-log (>= 1.2.0)
15
+ moneta
16
+ ohai (>= 0.5.7)
17
+ rest-client (>= 1.0.4, < 1.7.0)
18
+ uuidtools
19
+ diff-lcs (1.1.2)
20
+ erubis (2.7.0)
21
+ extlib (0.9.15)
22
+ highline (1.6.2)
23
+ json (1.4.6)
24
+ mime-types (1.16)
25
+ mixlib-authentication (1.1.4)
26
+ mixlib-log
27
+ mixlib-cli (1.2.0)
28
+ mixlib-config (1.1.2)
29
+ mixlib-log (1.3.0)
30
+ moneta (0.6.0)
31
+ ohai (0.6.4)
32
+ mixlib-cli
33
+ mixlib-config
34
+ mixlib-log
35
+ systemu
36
+ yajl-ruby
37
+ rest-client (1.6.1)
38
+ mime-types (>= 1.16)
39
+ rspec (2.6.0)
40
+ rspec-core (~> 2.6.0)
41
+ rspec-expectations (~> 2.6.0)
42
+ rspec-mocks (~> 2.6.0)
43
+ rspec-core (2.6.0)
44
+ rspec-expectations (2.6.0)
45
+ diff-lcs (~> 1.1.2)
46
+ rspec-mocks (2.6.0)
47
+ systemu (2.2.0)
48
+ uuidtools (2.1.2)
49
+ yajl-ruby (0.8.2)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ chef (~> 0.9.10)
56
+ erubis
57
+ rspec (~> 2.6.0)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010-2011 BabyPips.com, LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ # Rakefile for Flombe
2
+ #
3
+ # Unless required by applicable law or agreed to in writing, software
4
+ # distributed under the License is distributed on an "AS IS" BASIS,
5
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6
+ # See the License for the specific language governing permissions and
7
+ # limitations under the License.
8
+ #
9
+
10
+ require 'fileutils'
11
+ require 'chef'
12
+ require File.join(File.dirname(__FILE__), 'config', 'rake')
13
+
14
+ load 'chef/tasks/chef_repo.rake'
15
+
16
+ namespace :flombe do
17
+ desc "Cleanses the environment, removing all the core junk that was installed."
18
+ task :clean do
19
+ if !`which brew`.chomp.empty?
20
+ prefix = `brew --prefix`.chomp
21
+ sh %{rm -rf #{prefix}/Cellar}
22
+ sh %{brew prune}
23
+ sh %{rm -rf #{prefix}/Library #{prefix}/.git #{prefix}/.gitignore #{prefix}/bin/brew #{prefix}/README.md #{prefix}/share/man/man1/brew}
24
+ end
25
+
26
+ if !`which rvm`.chomp.empty?
27
+ sh %{rvm implode}
28
+ sh %{gem uninstall rvm}
29
+ end
30
+
31
+ sh %{rm -rf ~/.flombe ~/.flombe.profile ~/.gemrc ~/.rdebugrc ~/.rvmrc ~/.bash_profile}
32
+ end
33
+ end
data/bin/flombe ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ require "rubygems"
3
+ require "optparse"
4
+ require "flombe"
5
+
6
+ ENV['HOME'] ||= '/Users/flombe'
7
+ ENV['USER'] ||= 'flombe'
8
+ ENV['EMAIL'] ||= 'flombe@gmail.com'
9
+ ENV['EDITOR'] ||= 'vim'
10
+ ENV['FULLNAME'] ||= 'Flom Be'
11
+
12
+ begin
13
+ Flombe::Runner.run
14
+ rescue Flombe::FlombeError => e
15
+ Flombe::Runner.warn e.message
16
+ exit 1
17
+ end
data/config/rake.rb ADDED
@@ -0,0 +1,38 @@
1
+ ###
2
+ # Company and SSL Details
3
+ ###
4
+
5
+ # The company name - used for SSL certificates, and in srvious other places
6
+ COMPANY_NAME = ""
7
+
8
+ # The Country Name to use for SSL Certificates
9
+ SSL_COUNTRY_NAME = "US"
10
+
11
+ # The State Name to use for SSL Certificates
12
+ SSL_STATE_NAME = "Several"
13
+
14
+ # The Locality Name for SSL - typically, the city
15
+ SSL_LOCALITY_NAME = "Locality"
16
+
17
+ # What department?
18
+ SSL_ORGANIZATIONAL_UNIT_NAME = "Operations"
19
+
20
+ # The SSL contact email address
21
+ SSL_EMAIL_ADDRESS = ""
22
+
23
+ # License for new Cookbooks
24
+ # Can be :apachev2 or :none
25
+ NEW_COOKBOOK_LICENSE = :none
26
+
27
+ ###
28
+ # Useful Extras (which you probably don't need to change)
29
+ ###
30
+
31
+ # The top of the repository checkout
32
+ TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), ".."))
33
+
34
+ # Where to store certificates generated with ssl_cert
35
+ CADIR = File.expand_path(File.join(TOPDIR, "certificates"))
36
+
37
+ # Where to store the mtime cache for the recipe/template syntax check
38
+ TEST_CACHE = File.expand_path(File.join(TOPDIR, ".rake_test_cache"))
@@ -0,0 +1,8 @@
1
+ = DESCRIPTION:
2
+
3
+ = REQUIREMENTS:
4
+
5
+ = ATTRIBUTES:
6
+
7
+ = USAGE:
8
+
@@ -0,0 +1,8 @@
1
+ maintainer "Corey Donohoe"
2
+ maintainer_email "atmos@atmos.org"
3
+ license "MIT"
4
+ description "Installs/Configures homebrew"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
6
+ version "0.1.0"
7
+ provides "homebrew::dbs"
8
+ provides "homebrew::misc"
@@ -0,0 +1,39 @@
1
+ require 'pp'
2
+ require 'chef/provider'
3
+
4
+ class Chef
5
+ class Provider
6
+ class Package
7
+ class Homebrew < ::Chef::Provider::Package
8
+ PREFIX = "/usr/local"
9
+ HOMEBREW = "#{PREFIX}/bin/brew"
10
+
11
+ def latest_version_for(name)
12
+ %x{#{HOMEBREW} info #{name}| head -n1 | awk '{print $2}'}.chomp
13
+ end
14
+
15
+ def load_current_resource
16
+ @current_resource = Chef::Resource::Homebrew.new(@new_resource.name)
17
+ @current_resource.package_name(@new_resource.name)
18
+ @candidate_version = latest_version_for(@new_resource.name)
19
+ @current_resource
20
+ end
21
+
22
+ def install_package(name, version)
23
+ run_brew_command("#{HOMEBREW} install #{name}")
24
+ end
25
+
26
+ def remove_package(name, version)
27
+ run_brew_command("#{HOMEBREW} uninstall #{name}")
28
+ end
29
+
30
+ def run_brew_command(command)
31
+ Chef::Log.debug(command)
32
+ run_command_with_systems_locale(
33
+ :command => command
34
+ )
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,42 @@
1
+ #
2
+ # Cookbook Name:: homebrew
3
+ # Recipe:: homebrew
4
+ #
5
+
6
+ root = File.expand_path(File.join(File.dirname(__FILE__), ".."))
7
+
8
+ require root + '/resources/homebrew'
9
+ require root + '/providers/homebrew'
10
+ require 'etc'
11
+
12
+ directory "#{ENV['HOME']}/.flombe" do
13
+ action :create
14
+ end
15
+
16
+ execute "install homebrew" do
17
+ command "ruby -e \"$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)\""
18
+ cwd "/usr/local"
19
+ not_if "test -e /usr/local/bin/brew"
20
+ end
21
+
22
+ homebrew "git"
23
+
24
+ script "ensure the git remote is installed" do
25
+ interpreter "bash"
26
+ code <<-EOS
27
+ cd /usr/local
28
+ if [ ! -d ./.git ]; then
29
+ git init
30
+ git remote add origin git://github.com/mxcl/homebrew.git
31
+ git fetch origin
32
+ git reset --hard origin/master
33
+ fi
34
+ EOS
35
+ end
36
+
37
+ script "updating homebrew from github" do
38
+ interpreter "bash"
39
+ code <<-EOS
40
+ /usr/local/bin/brew update >> ~/.flombe/brew.log 2>&1
41
+ EOS
42
+ end
@@ -0,0 +1,14 @@
1
+ require 'chef/resource/script'
2
+
3
+ class Chef
4
+ class Resource
5
+ class Homebrew < ::Chef::Resource::Package
6
+ def initialize(name, run_context = nil)
7
+ super(name, run_context)
8
+ @resource_name = :homebrew
9
+ @provider = Chef::Provider::Package::Homebrew
10
+ @allowed_actions = [ :install, :remove ]
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ = DESCRIPTION:
2
+
3
+ = REQUIREMENTS:
4
+
5
+ = ATTRIBUTES:
6
+
7
+ = USAGE:
8
+
@@ -0,0 +1,6 @@
1
+ maintainer ""
2
+ maintainer_email ""
3
+ license "All rights reserved"
4
+ description "Installs/Configures mysql"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
6
+ version "0.1"
@@ -0,0 +1,43 @@
1
+ #
2
+ # Cookbook Name:: mysql
3
+ # Recipe:: default
4
+ #
5
+
6
+ require_recipe 'homebrew'
7
+
8
+ homebrew 'mysql'
9
+
10
+ execute "initialize MySQL database" do
11
+ command <<-EOS
12
+ unset TMPDIR
13
+ mysql_install_db --user=#{ENV['USER']} --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
14
+ EOS
15
+ not_if "test -d /usr/local/var/mysql/mysql"
16
+ end
17
+
18
+ gem_package "mysql" do
19
+ action :install
20
+ end
21
+
22
+ Chef::Log.info("Configuring mysql to automatically start on login")
23
+
24
+ destination_plist = "#{ENV['HOME']}/Library/LaunchAgents/com.mysql.mysqld.plist"
25
+ plist_path = "$(brew --prefix mysql)/com.mysql.mysqld.plist"
26
+
27
+ execute "unloading existing plist" do
28
+ command "launchctl unload -w -F #{destination_plist}"
29
+ only_if "test -f #{destination_plist}"
30
+ end
31
+
32
+ execute "adding plist to login" do
33
+ command <<-EOS
34
+ mkdir -p #{ENV['HOME']}/Library/LaunchAgents
35
+ cp -f #{plist_path} #{destination_plist}
36
+ launchctl load -w -F #{destination_plist}
37
+ EOS
38
+ end
39
+
40
+ execute "sleeping to wait for mysql to come online" do
41
+ command "sleep 5"
42
+ not_if "mysqladmin -uroot status"
43
+ end
@@ -0,0 +1,10 @@
1
+ #
2
+ # Cookbook Name:: mysql
3
+ # Recipe:: timezone
4
+ #
5
+ # Loads the timezone information into MySQL for timezone related functions.
6
+ #
7
+
8
+ execute "mysql-tzinfo import" do
9
+ command "mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot mysql"
10
+ end
@@ -0,0 +1,8 @@
1
+ = DESCRIPTION:
2
+
3
+ = REQUIREMENTS:
4
+
5
+ = ATTRIBUTES:
6
+
7
+ = USAGE:
8
+
@@ -0,0 +1,6 @@
1
+ maintainer ""
2
+ maintainer_email ""
3
+ license "All rights reserved"
4
+ description "Installs/Configures redis"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
6
+ version "0.1"
@@ -0,0 +1,24 @@
1
+ #
2
+ # Cookbook Name:: redis
3
+ # Recipe:: 2.0.4
4
+ #
5
+
6
+ require_recipe 'homebrew'
7
+
8
+ execute "ensure checking out of redis-2.0.4 branch" do
9
+ command <<-EOS
10
+ cd #{Chef::Provider::Package::Homebrew::PREFIX}
11
+ git checkout -b redis-2.0.4 29f618bec65c05ab1a00d8670fc320dae33f5a55
12
+ EOS
13
+ not_if "git branch | grep -q redis-2.0.4"
14
+ end
15
+
16
+ homebrew 'redis'
17
+
18
+ execute "ensure checking out of master branch after redis install" do
19
+ command <<-EOS
20
+ cd #{Chef::Provider::Package::Homebrew::PREFIX}
21
+ git checkout master
22
+ git branch -d redis-2.0.4
23
+ EOS
24
+ end
@@ -0,0 +1,7 @@
1
+ #
2
+ # Cookbook Name:: redis
3
+ # Recipe:: default
4
+ #
5
+
6
+ require_recipe 'homebrew'
7
+ homebrew 'redis'
@@ -0,0 +1,19 @@
1
+ ## 0.7.0 (May 14, 2011)
2
+
3
+ * Revamp and update README.md. [GH-3]
4
+ * Add CHANGELOG.md. [GH-5]
5
+ * Attr rvm/upgrade accepts "none", false and nil as same value. [GH-19]
6
+ * Update rvm/install_rubies attr to "true"/"false".
7
+ * Update rvm/skip_docs_on_install attr to rvm/rvm_gem_options.
8
+ * Speed up install by disabling RDOC generation. [GH-13]
9
+ * New experimental recipe gem_package which patches gem_package resource.
10
+ * Add rvm_global_gem resource.
11
+ * Refactor of rvm_gem provider to leverage Chef::Provider::Package::Rubygems.
12
+ * Allow no default RVM ruby (i.e. use system ruby). [GH-14]
13
+ * Update RVM install to use SSL URL. [GH-12]
14
+ * Now /etc/rvmrc has export for rvm/rvmrc key/value pairs.
15
+
16
+ ## Previous
17
+
18
+ The changelog began with version 0.6.0 so any changes prior to that can be
19
+ seen by checking the tagged releases and reading git commit messages.