Permalink
Browse files

Put everything in place for gemifying, but haven't tested it

  • Loading branch information...
1 parent 1425266 commit cc66eb8b4bc82dd2f99e6dbfbfdd0b320210618d Philip (flip) Kromer committed May 20, 2011
Showing with 355 additions and 5 deletions.
  1. +4 −1 .gitignore
  2. +3 −0 .rspec
  3. +20 −0 .watchr
  4. +23 −0 Gemfile
  5. +96 −0 Gemfile.lock
  6. +51 −1 Rakefile
  7. +118 −0 cluster_chef.gemspec
  8. +1 −2 lib/cluster_chef/cloud.rb
  9. +7 −0 spec/cluster_chef_spec.rb
  10. +31 −0 spec/spec_helper.rb
  11. +1 −1 tasks/databag.rake
View
@@ -5,16 +5,19 @@ nohup.out
## EDITORS
\#*
-.\#*
+.#*
*~
*.swp
+.bak
REVISION
TAGS*
tmtags
*_flymake.*
+*_flymake
*.tmproj
.project
.settings
+mkmf.log
## COMPILED
a.out
View
3 .rspec
@@ -0,0 +1,3 @@
+--color
+--format documentation
+--drb
View
20 .watchr
@@ -0,0 +1,20 @@
+# -*- ruby -*-
+
+def run_spec(file)
+ unless File.exist?(file)
+ puts "#{file} does not exist"
+ return
+ end
+
+ puts "Running #{file}"
+ system "bundle exec rspec #{file}"
+ puts
+end
+
+watch("spec/.*/*_spec\.rb") do |match|
+ run_spec match[0]
+end
+
+watch("lib/(.*)\.rb") do |match|
+ run_spec %{spec/#{match[1]}_spec.rb}
+end
View
23 Gemfile
@@ -0,0 +1,23 @@
+source "http://rubygems.org"
+
+gem 'chef', "~> 0.10.0"
+gem 'json', "~> 1.5.1"
+gem 'right_aws', "~> 2.1.0"
+gem 'formatador', "~> 0.1.3"
+gem 'choice', "~> 0.1.4"
+gem 'configliere', "~> 0.4.5"
+gem 'highline', "~> 1.6.2"
+
+# Add dependencies to develop your gem here.
+# Include everything needed to run rake, tests, features, etc.
+group :development do
+ gem 'bundler', "~> 1.0.12"
+ gem 'yard', "~> 0.6.7"
+ gem 'jeweler', "~> 1.5.2"
+ gem 'rspec', "~> 2.5.0"
+ gem 'spork', "~> 0.9.0.rc5"
+ gem 'RedCloth' # for yard
+ # only interesting for coverage testing
+ gem 'rcov', ">= 0.9.9"
+ gem 'watchr'
+end
View
@@ -0,0 +1,96 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ RedCloth (4.2.7)
+ bunny (0.6.0)
+ chef (0.10.0)
+ bunny (>= 0.6.0)
+ erubis
+ highline
+ json (>= 1.4.4, <= 1.5.2)
+ mixlib-authentication (>= 1.1.0)
+ mixlib-cli (>= 1.1.0)
+ mixlib-config (>= 1.1.2)
+ mixlib-log (>= 1.3.0)
+ moneta
+ net-ssh (~> 2.1.3)
+ net-ssh-multi (~> 1.0.1)
+ ohai (>= 0.6.0)
+ rest-client (>= 1.0.4, < 1.7.0)
+ treetop (~> 1.4.9)
+ uuidtools
+ choice (0.1.4)
+ configliere (0.4.5)
+ diff-lcs (1.1.2)
+ erubis (2.7.0)
+ formatador (0.1.3)
+ git (1.2.5)
+ highline (1.6.2)
+ jeweler (1.5.2)
+ bundler (~> 1.0.0)
+ git (>= 1.2.5)
+ rake
+ json (1.5.1)
+ mime-types (1.16)
+ mixlib-authentication (1.1.4)
+ mixlib-log
+ mixlib-cli (1.2.0)
+ mixlib-config (1.1.2)
+ mixlib-log (1.3.0)
+ moneta (0.6.0)
+ net-ssh (2.1.4)
+ net-ssh-gateway (1.1.0)
+ net-ssh (>= 1.99.1)
+ net-ssh-multi (1.0.1)
+ net-ssh (>= 1.99.2)
+ net-ssh-gateway (>= 0.99.0)
+ ohai (0.6.4)
+ mixlib-cli
+ mixlib-config
+ mixlib-log
+ systemu
+ yajl-ruby
+ polyglot (0.3.1)
+ rake (0.8.7)
+ rcov (0.9.9)
+ rest-client (1.6.1)
+ mime-types (>= 1.16)
+ right_aws (2.1.0)
+ right_http_connection (>= 1.2.5)
+ right_http_connection (1.3.0)
+ rspec (2.5.0)
+ rspec-core (~> 2.5.0)
+ rspec-expectations (~> 2.5.0)
+ rspec-mocks (~> 2.5.0)
+ rspec-core (2.5.2)
+ rspec-expectations (2.5.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.5.0)
+ spork (0.9.0.rc7)
+ systemu (2.2.0)
+ treetop (1.4.9)
+ polyglot (>= 0.3.1)
+ uuidtools (2.1.2)
+ watchr (0.7)
+ yajl-ruby (0.8.2)
+ yard (0.6.8)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ RedCloth
+ bundler (~> 1.0.12)
+ chef (~> 0.10.0)
+ choice (~> 0.1.4)
+ configliere (~> 0.4.5)
+ formatador (~> 0.1.3)
+ highline (~> 1.6.2)
+ jeweler (~> 1.5.2)
+ json (~> 1.5.1)
+ rcov (>= 0.9.9)
+ right_aws (~> 2.1.0)
+ rspec (~> 2.5.0)
+ spork (~> 0.9.0.rc5)
+ watchr
+ yard (~> 0.6.7)
View
@@ -1,8 +1,58 @@
-require 'rubygems'
+require 'rubygems' unless defined?(Gem)
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+
require 'chef'
require 'json'
TOPDIR = File.expand_path(File.join(File.dirname(__FILE__), "."))
+require 'jeweler'
+Jeweler::Tasks.new do |gem|
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
+ gem.name = "cluster_chef"
+ gem.homepage = "http://infochimps.com/labs"
+ gem.license = "MIT"
+ gem.summary = %Q{Chef is a powerful tool for maintaining and describing the software and configurations that let a machine provide its services.}
+ gem.description = %Q{Chef is a powerful tool for maintaining and describing the software and configurations that let a machine provide its services.}
+ gem.email = "coders@infochimps.org"
+ gem.authors = ["Infochimps"]
+
+ gem.add_development_dependency 'bundler', "~> 1.0.12"
+ gem.add_development_dependency 'jeweler', "~> 1.5.2"
+
+ ignores = File.readlines(".gitignore").grep(/^[^#]\S+/).map{|s| s.chomp }
+ dotfiles = [".gemtest", ".gitignore", ".rspec", ".yardopts"]
+ gem.files = dotfiles + Dir["**/*"].
+ reject{|f| f =~ %r{^(clusters|config|cookbooks|data_bags|roles|site-cookbooks)/} }.
+ reject{|f| File.directory?(f) }.
+ reject{|f| ignores.any?{|i| File.fnmatch(i, f) || File.fnmatch(i+'/**/*', f) } }
+ gem.test_files = gem.files.grep(/^spec\//)
+ gem.require_paths = ['lib']
+end
+Jeweler::RubygemsDotOrgTasks.new
+
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
+end
+
+RSpec::Core::RakeTask.new(:rcov) do |spec|
+ spec.pattern = 'spec/**/*_spec.rb'
+ spec.rcov = true
+ spec.rcov_opts = %w[ --exclude .rvm --no-comments --text-summary]
+end
+
+task :default => :spec
+
+require 'yard'
+YARD::Rake::YardocTask.new
TEST_CACHE = File.expand_path(File.join(TOPDIR, ".rake_test_cache"))
COMPANY_NAME = "Opscode, Inc."
View
@@ -0,0 +1,118 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{cluster_chef}
+ s.version = "0.1.10"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Infochimps"]
+ s.date = %q{2011-05-20}
+ s.description = %q{Chef is a powerful tool for maintaining and describing the software and configurations that let a machine provide its services.}
+ s.email = %q{coders@infochimps.org}
+ s.extra_rdoc_files = [
+ "README.textile"
+ ]
+ s.files = [
+ ".gitignore",
+ "Gemfile",
+ "Gemfile.lock",
+ "README.textile",
+ "Rakefile",
+ "TODO.textile",
+ "VERSION",
+ "cluster_chef.gemspec",
+ "lib/cluster_chef.rb",
+ "lib/cluster_chef/cloud.rb",
+ "lib/cluster_chef/compute.rb",
+ "lib/cluster_chef/core_ext/class.rb",
+ "lib/cluster_chef/dsl_object.rb",
+ "lib/cluster_chef/knife/bootstrap/ubuntu10.04-cluster_chef.erb",
+ "lib/cluster_chef/knife/cluster_bootstrap.rb",
+ "lib/cluster_chef/knife/cluster_kill.rb",
+ "lib/cluster_chef/knife/cluster_launch.rb",
+ "lib/cluster_chef/knife/cluster_show.rb",
+ "lib/cluster_chef/knife/cluster_ssh.rb",
+ "lib/cluster_chef/knife/cluster_ssh_proxy.rb",
+ "lib/cluster_chef/security_group.rb",
+ "notes/burn_your_own_AMI.textile",
+ "notes/cluster_roles_and_service_discovery.textile",
+ "notes/design_your_cluster.textile",
+ "notes/ec2pricing-and-capacity.numbers",
+ "notes/ec2pricing-and-capacity.txt",
+ "notes/make_your_hdfs_persistent_with_ebs_volumes.textile",
+ "notes/patching-hadoop-the-kludgey-way.textile",
+ "notes/pt1-initial-settings-and-credentials.textile",
+ "notes/pt2-chef_server_and_local_chef.textile",
+ "notes/tips_and_troubleshooting.textile",
+ "tasks/databag.rake"
+ ]
+ s.homepage = %q{http://infochimps.com/labs}
+ s.licenses = ["MIT"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.5.0}
+ s.summary = %q{Chef is a powerful tool for maintaining and describing the software and configurations that let a machine provide its services.}
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<chef>, ["~> 0.10.0"])
+ s.add_runtime_dependency(%q<json>, ["~> 1.5.1"])
+ s.add_runtime_dependency(%q<right_aws>, ["~> 2.1.0"])
+ s.add_runtime_dependency(%q<formatador>, ["~> 0.1.3"])
+ s.add_runtime_dependency(%q<choice>, ["~> 0.1.4"])
+ s.add_runtime_dependency(%q<configliere>, ["~> 0.4.5"])
+ s.add_runtime_dependency(%q<highline>, ["~> 1.6.2"])
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.12"])
+ s.add_development_dependency(%q<yard>, ["~> 0.6.7"])
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
+ s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
+ s.add_development_dependency(%q<spork>, ["~> 0.9.0.rc5"])
+ s.add_development_dependency(%q<RedCloth>, [">= 0"])
+ s.add_development_dependency(%q<rcov>, [">= 0.9.9"])
+ s.add_development_dependency(%q<watchr>, [">= 0"])
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.12"])
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
+ else
+ s.add_dependency(%q<chef>, ["~> 0.10.0"])
+ s.add_dependency(%q<json>, ["~> 1.5.1"])
+ s.add_dependency(%q<right_aws>, ["~> 2.1.0"])
+ s.add_dependency(%q<formatador>, ["~> 0.1.3"])
+ s.add_dependency(%q<choice>, ["~> 0.1.4"])
+ s.add_dependency(%q<configliere>, ["~> 0.4.5"])
+ s.add_dependency(%q<highline>, ["~> 1.6.2"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.12"])
+ s.add_dependency(%q<yard>, ["~> 0.6.7"])
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
+ s.add_dependency(%q<spork>, ["~> 0.9.0.rc5"])
+ s.add_dependency(%q<RedCloth>, [">= 0"])
+ s.add_dependency(%q<rcov>, [">= 0.9.9"])
+ s.add_dependency(%q<watchr>, [">= 0"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.12"])
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
+ end
+ else
+ s.add_dependency(%q<chef>, ["~> 0.10.0"])
+ s.add_dependency(%q<json>, ["~> 1.5.1"])
+ s.add_dependency(%q<right_aws>, ["~> 2.1.0"])
+ s.add_dependency(%q<formatador>, ["~> 0.1.3"])
+ s.add_dependency(%q<choice>, ["~> 0.1.4"])
+ s.add_dependency(%q<configliere>, ["~> 0.4.5"])
+ s.add_dependency(%q<highline>, ["~> 1.6.2"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.12"])
+ s.add_dependency(%q<yard>, ["~> 0.6.7"])
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
+ s.add_dependency(%q<spork>, ["~> 0.9.0.rc5"])
+ s.add_dependency(%q<RedCloth>, [">= 0"])
+ s.add_dependency(%q<rcov>, [">= 0.9.9"])
+ s.add_dependency(%q<watchr>, [">= 0"])
+ s.add_dependency(%q<bundler>, ["~> 1.0.12"])
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
+ end
+end
+
@@ -1,4 +1,3 @@
-
module ClusterChef
module Cloud
class Base < ClusterChef::DslObject
@@ -127,7 +126,7 @@ def resolve! cloud
end
def resolve_region!
- region availability_zones.first.gsub(/^(\w+-\w+-\d)[a-z]/, '\1') if !region && availability_zones.respond_to?(:first)
+ region availability_zones.first.gsub(/^(\w+-\w+-\d)[a-z]/, '\1') if !region && availability_zones.respond_to?(:first)
end
def resolve_block_device_mapping!
@@ -0,0 +1,7 @@
+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+
+describe "cluster_chef" do
+ it "fails" do
+ fail "hey buddy, you should probably rename this file and start specing for real"
+ end
+end
View
@@ -0,0 +1,31 @@
+require 'spork'
+require 'rspec'
+
+Spork.prefork do
+ # This code is run only once when the spork server is started
+
+ ENV["RACK_ENV"] ||= 'test'
+ RACK_ENV = ENV["RACK_ENV"] unless defined?(RACK_ENV)
+
+ require File.join(File.dirname(__FILE__), '../lib/boot')
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
+
+ require 'goliath'
+ require 'em-synchrony'
+ require 'goliath/test_helper'
+ require 'support/test_helper'
+
+ # Requires custom matchers & macros, etc from files in ./support/ & subdirs
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
+
+ # Configure rspec
+ RSpec.configure do |config|
+ config.include Goliath::TestHelper, :example_group => {
+ :file_path => /spec/
+ }
+ end
+end
+
+Spork.each_run do
+ # This code will be run each time you run your specs.
+end
Oops, something went wrong.

0 comments on commit cc66eb8

Please sign in to comment.