Permalink
Browse files

inital commit

  • Loading branch information...
gvarela committed Nov 26, 2009
0 parents commit cdcbe3c60e915c1a60eb54eed7bdf4db4541f837
Showing with 266 additions and 0 deletions.
  1. +5 −0 .document
  2. +24 −0 .gitignore
  3. +20 −0 LICENSE
  4. +30 −0 README.rdoc
  5. +45 −0 Rakefile
  6. +8 −0 bin/food-court
  7. 0 lib/food_court.rb
  8. +59 −0 lib/food_court/command.rb
  9. +34 −0 lib/food_court/recipes.rb
  10. +7 −0 spec/food_court_spec.rb
  11. +1 −0 spec/spec.opts
  12. +9 −0 spec/spec_helper.rb
  13. +24 −0 templates/slicehost/menu.rb
@@ -0,0 +1,5 @@
+README.rdoc
+lib/**/*.rb
+bin/*
+features/**/*.feature
+LICENSE
@@ -0,0 +1,24 @@
+## MAC OS
+.DS_Store
+
+## TEXTMATE
+*.tmproj
+tmtags
+
+## RubyMine
+.idea
+
+## EMACS
+*~
+\#*
+.\#*
+
+## VIM
+*.swp
+
+## PROJECT::GENERAL
+coverage
+rdoc
+pkg
+
+## PROJECT::SPECIFIC
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2009 Gabe Varela
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
+= Food Court
+
+Food Court is a streamlined way to use chef-solo and capistrano for VPS's such as slicehost.
+
+= Instructions
+* cd into your project
+ food-court setup .
+* modify your dna.rb to change any default packages
+* the run the cap tasks to have chef-solo setup on the remote server
+ cap food_court:setup
+* lastly run the chauffeur tweaked chef-solo config on the remote server
+ cap food_court:deploy
+
+= TODO
+* add generators for creating site-cookbooks in the current project repo
+* enable setup to accept a remote location for templates
+
+== Note on Patches/Pull Requests
+
+* Fork the project.
+* Make your feature addition or bug fix.
+* Add tests for it. This is important so I don't break it in a
+ future version unintentionally.
+* Commit, do not mess with rakefile, version, or history.
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
+* Send me a pull request. Bonus points for topic branches.
+
+== Copyright
+
+Copyright (c) 2009 Gabe Varela. See LICENSE for details.
@@ -0,0 +1,45 @@
+require 'rubygems'
+require 'rake'
+
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = "Food Court"
+ gem.summary = %Q{TODO: one-line summary of your gem}
+ gem.description = %Q{TODO: longer description of your gem}
+ gem.email = "gvarela@gmail.com"
+ gem.homepage = "http://github.com/gvarela/food_court"
+ gem.authors = ["Gabe Varela"]
+ gem.add_development_dependency "rspec", ">= 1.2.9"
+ gem.add_development_dependency "yard", ">= 0"
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
+ end
+ Jeweler::GemcutterTasks.new
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+end
+
+require 'spec/rake/spectask'
+Spec::Rake::SpecTask.new(:spec) do |spec|
+ spec.libs << 'lib' << 'spec'
+ spec.spec_files = FileList['spec/**/*_spec.rb']
+end
+
+Spec::Rake::SpecTask.new(:rcov) do |spec|
+ spec.libs << 'lib' << 'spec'
+ spec.pattern = 'spec/**/*_spec.rb'
+ spec.rcov = true
+end
+
+task :spec => :check_dependencies
+
+task :default => :spec
+
+begin
+ require 'yard'
+ YARD::Rake::YardocTask.new
+rescue LoadError
+ task :yardoc do
+ abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
+ end
+end
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+require "#{File.dirname(__FILE__)}/../lib/food_court/command.rb"
+
+trap "INT" do
+ exit!
+end
+
+FoodCourt::Command.new(*ARGV)
No changes.
@@ -0,0 +1,59 @@
+require 'fileutils'
+module FoodCourt
+ class Command
+ TEMPLATE_PATH = File.join File.dirname(__FILE__), '/../../', 'templates'
+
+ def initialize(*args)
+ command = args.shift
+ if self.respond_to? command.to_sym
+ self.send command, *args
+ else
+ self.help
+ end
+ end
+
+ def setup(path, template='slicehost')
+ path = File.expand_path(path)
+ FileUtils.mkdir_p File.join path, 'config/chef'
+ FileUtils.mkdir_p File.join path, 'config/chef/site-cookbooks'
+ FileUtils.mkdir_p File.join path, 'config/chef/deployments'
+ FileUtils.cp File.join(TEMPLATE_PATH, template, 'menu.rb'), File.join(path, 'config/chef', 'menu.rb')
+ end
+
+ def help
+
+ end
+
+ def package()
+
+ end
+
+ def fetch_remote_cookbooks()
+
+ end
+
+ def create_cookbook(dir, name)
+ raise "Must provide a name" unless name
+ puts "** Creating cookbook #{name}"
+ sh "mkdir -p #{File.join(dir, name, "attributes")}"
+ sh "mkdir -p #{File.join(dir, name, "recipes")}"
+ sh "mkdir -p #{File.join(dir, name, "definitions")}"
+ sh "mkdir -p #{File.join(dir, name, "libraries")}"
+ sh "mkdir -p #{File.join(dir, name, "files", "default")}"
+ sh "mkdir -p #{File.join(dir, name, "templates", "default")}"
+ unless File.exists?(File.join(dir, name, "recipes", "default.rb"))
+ open(File.join(dir, name, "recipes", "default.rb"), "w") do |file|
+ file.puts <<-EOH
+#
+# Cookbook Name:: #{name}
+# Recipe:: default
+#
+# Copyright #{Time.now.year}, MY_COMPANY
+#
+ EOH
+ end
+ end
+ end
+
+ end
+end
@@ -0,0 +1,34 @@
+#
+# You need to add
+# require 'chauffeur/recipes'
+# to your deploy.rb
+#
+#
+make_notify_task = lambda do
+
+ namespace :food_court do
+
+ # run chauffeur chef-solo on the remote server
+ desc "setup"
+ task :setup, :only => {:chauffeur => true } do
+
+ end
+
+ desc "deploy your chauffeur chef-solo cookbooks"
+ task :deploy, :only => {:chauffeur => true } do
+
+ end
+ end
+
+end
+require 'capistrano/version'
+if Capistrano::Version::MAJOR < 2
+ STDERR.puts "Unable to load #{__FILE__}\nChauffeur Capistrano hooks require at least version 2.0.0"
+else
+ instance = Capistrano::Configuration.instance
+ if instance
+ instance.load &make_notify_task
+ else
+ make_notify_task.call
+ end
+end
@@ -0,0 +1,7 @@
+require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
+
+describe "FoodCourt" do
+ it "fails" do
+ fail "hey buddy, you should probably rename this file and start specing for real"
+ end
+end
@@ -0,0 +1 @@
+--color
@@ -0,0 +1,9 @@
+$LOAD_PATH.unshift(File.dirname(__FILE__))
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+require 'chauffeur'
+require 'spec'
+require 'spec/autorun'
+
+Spec::Runner.configure do |config|
+
+end
@@ -0,0 +1,24 @@
+application = "my_application"
+
+{
+ :file_cache_path => "/var/chef",
+ :keep_deployments => 2,
+ :cookbooks => [ '' ],
+
+ :dna => {
+ :apps_dir => "/data/#{application}",
+ :applications => [
+ {
+ :name => application,
+ :server_name => "#{application}.com",
+ :server_aliases => ["www.#{application}.com"],
+ }
+ ],
+ :recipes => [
+ "mysql",
+ "nginx",
+ "passenger",
+ "applications"
+ ]
+}
+}

0 comments on commit cdcbe3c

Please sign in to comment.