food_court 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -22,3 +22,4 @@ rdoc
22
22
  pkg
23
23
 
24
24
  ## PROJECT::SPECIFIC
25
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # A sample Gemfile
2
+ source "http://rubygems.org"
3
+
4
+ group :development do
5
+ gem "rspec", '1.2.9'
6
+ gem "yard"
7
+ gem 'json', '~> 1.4.6'
8
+ gem 'activesupport', '~> 2.3.9'
9
+ gem 'highline', '~> 1.4.0'
10
+ gem 'capistrano', '~> 2.5.5'
11
+ gem 'sprinkle', '~> 0.3.1'
12
+ gem 'fakefs'
13
+ end
14
+
15
+ # gem "rails"
data/Gemfile.lock ADDED
@@ -0,0 +1,39 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (2.3.9)
5
+ capistrano (2.5.19)
6
+ highline
7
+ net-scp (>= 1.0.0)
8
+ net-sftp (>= 2.0.0)
9
+ net-ssh (>= 2.0.14)
10
+ net-ssh-gateway (>= 1.0.0)
11
+ fakefs (0.2.1)
12
+ highline (1.4.0)
13
+ json (1.4.6)
14
+ net-scp (1.0.3)
15
+ net-ssh (>= 1.99.1)
16
+ net-sftp (2.0.5)
17
+ net-ssh (>= 2.0.9)
18
+ net-ssh (2.0.23)
19
+ net-ssh-gateway (1.0.1)
20
+ net-ssh (>= 1.99.1)
21
+ rspec (1.2.9)
22
+ sprinkle (0.3.1)
23
+ activesupport (>= 2.0.2)
24
+ capistrano (>= 2.5.5)
25
+ highline (>= 1.4.0)
26
+ yard (0.6.1)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ activesupport (~> 2.3.9)
33
+ capistrano (~> 2.5.5)
34
+ fakefs
35
+ highline (~> 1.4.0)
36
+ json (~> 1.4.6)
37
+ rspec (= 1.2.9)
38
+ sprinkle (~> 0.3.1)
39
+ yard
data/README.rdoc CHANGED
@@ -14,7 +14,9 @@ Food Court is a streamlined way to use chef-solo and capistrano for VPS's such a
14
14
 
15
15
  = Gotchas
16
16
  Since Food Court uses Chef you are bound to run into some Chef specific issues
17
+
17
18
  Chef help: http://wiki.opscode.com/display/chef/Home
19
+
18
20
  A good intro to chef-solo: http://akitaonrails.com/2010/02/20/cooking-solo-with-chef
19
21
 
20
22
  a common issue on slicehost is the fqdn in /etc/hosts
@@ -23,12 +25,9 @@ should be
23
25
  67.xx.xx.xx my-slice.local my-slice
24
26
 
25
27
  = Roadmap
26
- * create a default template that works on Ubuntu with Nginx and Passenger
27
- * add generators for stubbing site-cookbooks in the current project repo
28
28
  * enable rollingback a deployment
29
+ * add generators for stubbing site-cookbooks in the current project repo
29
30
  * enable setup to accept a remote location for template packages
30
- * setup a site to house common template packages (similar to the chef cookbooks site)
31
- * add ability to package up a template package and send to package site
32
31
 
33
32
  == Note on Patches/Pull Requests
34
33
 
@@ -46,7 +45,9 @@ Copyright (c) 2010 Gabe Varela. See LICENSE for details.
46
45
 
47
46
  == Inspiration
48
47
  Josh Peek: http://github.com/josh/slicehost/
48
+
49
49
  Thomas Balthazar: http://github.com/suitmymind/ubuntu-machine/
50
+
50
51
  Mike Hale: http://github.com/mikehale/drive-thru/
51
52
 
52
53
  == Thanks
data/Rakefile CHANGED
@@ -24,21 +24,21 @@ rescue LoadError
24
24
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
25
25
  end
26
26
 
27
- #require 'spec/rake/spectask'
28
- #Spec::Rake::SpecTask.new(:spec) do |spec|
29
- # spec.libs << 'lib' << 'spec'
30
- # spec.spec_files = FileList['spec/**/*_spec.rb']
31
- #end
32
- #
33
- #Spec::Rake::SpecTask.new(:rcov) do |spec|
34
- # spec.libs << 'lib' << 'spec'
35
- # spec.pattern = 'spec/**/*_spec.rb'
36
- # spec.rcov = true
37
- #end
38
- #
39
- #task :spec => :check_dependencies
40
- #
41
- #task :default => :spec
27
+ require 'spec/rake/spectask'
28
+ Spec::Rake::SpecTask.new(:spec) do |spec|
29
+ spec.libs << 'lib' << 'spec'
30
+ spec.spec_files = FileList['spec/**/*_spec.rb']
31
+ end
32
+
33
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
34
+ spec.libs << 'lib' << 'spec'
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :spec => :check_dependencies
40
+
41
+ task :default => :spec
42
42
  #
43
43
  #begin
44
44
  # require 'yard'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.2
data/food_court.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{food_court}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gabe Varela"]
12
- s.date = %q{2010-09-19}
12
+ s.date = %q{2010-10-09}
13
13
  s.default_executable = %q{food-court}
14
14
  s.description = %q{Bootstrap and provision your ubuntu slice with ease}
15
15
  s.email = %q{gvarela@gmail.com}
@@ -22,6 +22,8 @@ Gem::Specification.new do |s|
22
22
  ".document",
23
23
  ".gitignore",
24
24
  ".rvmrc",
25
+ "Gemfile",
26
+ "Gemfile.lock",
25
27
  "LICENSE",
26
28
  "README.rdoc",
27
29
  "Rakefile",
@@ -51,7 +53,7 @@ Gem::Specification.new do |s|
51
53
  s.homepage = %q{http://github.com/gvarela/food_court}
52
54
  s.rdoc_options = ["--charset=UTF-8"]
53
55
  s.require_paths = ["lib"]
54
- s.rubygems_version = %q{1.3.6}
56
+ s.rubygems_version = %q{1.3.7}
55
57
  s.summary = %q{Bootstrap and provision your ubuntu slice with ease}
56
58
  s.test_files = [
57
59
  "spec/command_spec.rb",
@@ -64,7 +66,7 @@ Gem::Specification.new do |s|
64
66
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
65
67
  s.specification_version = 3
66
68
 
67
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
69
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
68
70
  s.add_runtime_dependency(%q<json>, ["~> 1.4.6"])
69
71
  s.add_runtime_dependency(%q<activesupport>, ["~> 2.3.9"])
70
72
  s.add_runtime_dependency(%q<highline>, ["~> 1.4.0"])
@@ -12,8 +12,8 @@ module FoodCourt
12
12
  def compile()
13
13
  time = Time.now
14
14
 
15
- deployment_dir = File.join(current_path, 'config/chef/deployments', time.strftime('%Y-%m-%d-%h-%M-%S'))
16
- FileUtils.mkdir_p deployment_dir, :verbose => true
15
+ deployment_dir = File.join(current_path, 'config/chef/deployments', time.strftime('%Y-%m-%d-%H-%M-%S'))
16
+ FileUtils.mkdir_p deployment_dir
17
17
 
18
18
  dna = config[:dna]
19
19
  File.open(deployment_dir + "/dna.json", "w"){ |f| f.write(dna.to_json) }
data/spec/command_spec.rb CHANGED
@@ -5,9 +5,9 @@ describe "FoodCourt::Command" do
5
5
  stub_template
6
6
  end
7
7
 
8
- context "#setup" do
8
+ context "#init" do
9
9
  before do
10
- @command = FoodCourt::Command.new('setup', 'slicehost')
10
+ @command = FoodCourt::Command.new('init', 'slicehost')
11
11
  end
12
12
 
13
13
  it "should create a chef directory" do
@@ -7,26 +7,27 @@ describe "FoodCourt::Packager" do
7
7
 
8
8
  context "#configure" do
9
9
  before do
10
- FoodCourt::Command.new('setup', 'slicehost')
11
- @command = FoodCourt::Packager.new(@path)
12
- @command.configure
10
+ FoodCourt::Command.new('init', 'slicehost')
11
+ @packager = FoodCourt::Packager.new(@path)
12
+ @packager.configure
13
13
  end
14
14
 
15
15
  it "should eval file into @config as a hash" do
16
- @command.config.should be_a Hash
16
+ @packager.config.should be_a Hash
17
17
  end
18
18
 
19
19
  it "should have :dna in the config hash" do
20
- @command.config[:dna].should be_a Hash
20
+ @packager.config[:dna].should be_a Hash
21
21
  end
22
22
  end
23
23
 
24
24
  context "#compile" do
25
25
  before do
26
- FoodCourt::Command.new('setup', 'slicehost')
27
- @command = FoodCourt::Packager.new(@path)
28
- @command.configure
29
- @command.compile
26
+ FoodCourt::Command.new('init', 'slicehost')
27
+ @packager = FoodCourt::Packager.new(@path)
28
+ @packager.should_receive(:`).with("cd #{File.expand_path( File.join( File.dirname(__FILE__), 'fixtures', 'config/chef/deployments', Time.now.strftime('%Y-%m-%d-%H-%M-%S'))) } && tar czvf site-cookbooks.tar.gz site-cookbooks").and_return(true)
29
+ @packager.configure
30
+ @packager.compile
30
31
  end
31
32
 
32
33
  it "should compile dna.json" do
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,7 @@
1
+ require "rubygems"
2
+ require "bundler"
3
+ Bundler.setup(:default, :development)
4
+
1
5
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
7
  require 'food_court'
@@ -13,10 +17,20 @@ end
13
17
 
14
18
  def stub_template
15
19
  @path = File.expand_path(File.dirname(__FILE__) + '/fixtures')
16
- ENV['PATH'] = @path
20
+ FileUtils.mkdir_p @path
21
+
22
+ ENV['PATH'] = @path
23
+
24
+ @bootstrap = File.open( File.join( FoodCourt::Command::TEMPLATE_PATH, '/slicehost', 'bootstrap.rb'), 'w') do |f|
25
+ f.write <<-EOH
26
+ set :user, 'root'
27
+ role :bootstrap, ''
28
+ set :run_method, :run
29
+ EOH
30
+ end
17
31
 
18
- @order = File.open( File.join( FoodCourt::Command::TEMPLATE_PATH, '/slicehost', 'order.rb'), 'w' ) do |f|
19
- f.write <<-EOH
32
+ @order = File.open( File.join( FoodCourt::Command::TEMPLATE_PATH, '/slicehost', 'order.rb'), 'w' ) do |f|
33
+ f.write <<-EOH
20
34
  {
21
35
  :file_cache_path => "/var/chef",
22
36
  :cookbooks => [ '' ],
@@ -39,8 +53,11 @@ def stub_template
39
53
  ]
40
54
  }
41
55
  }
42
- EOH
56
+ EOH
57
+
58
+ end
59
+
60
+ @default_recipe = File.open( File.join( FoodCourt::Command::TEMPLATE_PATH, '/slicehost/site-cookbooks/applications/recipes', 'default.rb'), 'w' ) { |f| f.write 'test' }
43
61
 
44
- end
45
- @default_recipe = File.open( File.join( FoodCourt::Command::TEMPLATE_PATH, '/slicehost/site-cookbooks/applications/recipes', 'default.rb'), 'w' ) { |f| f.write 'test' }
62
+ Dir.chdir @path
46
63
  end
@@ -1,5 +1,24 @@
1
- application = "my-application.com"
1
+ # your application name
2
+ application = "my-application"
3
+ # domain of your site
4
+ domain = "my-application.com"
5
+ # user you want to create for deployments
2
6
  user = :deploy
7
+ # openssl passwd -l
8
+ user_password_hash = "..."
9
+ # your public ssh key
10
+ user_ssh_key = "ssh-rsa ... ==email@example.com"
11
+ #your mysql root user password
12
+ mysql_root_password = "..."
13
+
14
+ # To deploy you must add a new remote origin to your local git repo
15
+ # git remote add production deploy@xx.xx.xx.xx:~/repos/my-application.git
16
+ # Then to deploy your code changes
17
+ # git push production master
18
+ # See: http://akitaonrails.com/2010/02/20/cooking-solo-with-chef for info
19
+
20
+ # Assumes you are using bundler and that your code is on the master branch
21
+ # If you understand how chef works feel free to update the code below
3
22
 
4
23
  {
5
24
  :file_cache_path => "/var/chef",
@@ -9,14 +28,13 @@ user = :deploy
9
28
  :dna => {
10
29
  :users => {
11
30
  user => {
12
- # openssl passwd -l
13
- :password => "password-hash",
31
+ :password => user_password_hash,
14
32
  :comment => "Deploy User"
15
33
  }
16
34
  },
17
35
 
18
36
  :ssh_keys => {
19
- user => "ssh-rsa ... ==email@example.com"
37
+ user => user_ssh_key
20
38
  },
21
39
 
22
40
  :authorization => {
@@ -26,7 +44,7 @@ user = :deploy
26
44
  },
27
45
 
28
46
  :mysql => {
29
- :server_root_password => "root-password",
47
+ :server_root_password => mysql_root_password,
30
48
  :bind_address => "127.0.0.1"
31
49
  },
32
50
 
@@ -35,7 +53,7 @@ user = :deploy
35
53
  :install_path => "/usr/local",
36
54
  :ruby_bin => "/usr/local/bin/ruby",
37
55
  :gems_dir => "/usr/local/lib/ruby/gems/1.8",
38
- :url => "http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.01"
56
+ :url => "http://rubyforge.org/frs/download.php/68719/ruby-enterprise-1.8.7-2010.01"
39
57
  },
40
58
 
41
59
  :passenger_enterprise => {
@@ -53,10 +71,10 @@ user = :deploy
53
71
 
54
72
  :apps => [
55
73
  {
56
- :name => "my-application",
74
+ :name => application,
57
75
  :username => user,
58
76
  :git_branch => "master",
59
- :server => "my-application.local",
77
+ :server => domain,
60
78
  :pre_migration => "bundle install"
61
79
  }
62
80
  ],
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: food_court
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 0
9
- version: 0.1.0
9
+ - 2
10
+ version: 0.1.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Gabe Varela
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-09-19 00:00:00 -06:00
18
+ date: 2010-10-09 00:00:00 -06:00
18
19
  default_executable: food-court
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: json
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ~>
26
28
  - !ruby/object:Gem::Version
29
+ hash: 11
27
30
  segments:
28
31
  - 1
29
32
  - 4
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: activesupport
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ~>
40
44
  - !ruby/object:Gem::Version
45
+ hash: 17
41
46
  segments:
42
47
  - 2
43
48
  - 3
@@ -49,9 +54,11 @@ dependencies:
49
54
  name: highline
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ~>
54
60
  - !ruby/object:Gem::Version
61
+ hash: 7
55
62
  segments:
56
63
  - 1
57
64
  - 4
@@ -63,9 +70,11 @@ dependencies:
63
70
  name: capistrano
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ~>
68
76
  - !ruby/object:Gem::Version
77
+ hash: 17
69
78
  segments:
70
79
  - 2
71
80
  - 5
@@ -77,9 +86,11 @@ dependencies:
77
86
  name: sprinkle
78
87
  prerelease: false
79
88
  requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
80
90
  requirements:
81
91
  - - ~>
82
92
  - !ruby/object:Gem::Version
93
+ hash: 17
83
94
  segments:
84
95
  - 0
85
96
  - 3
@@ -91,9 +102,11 @@ dependencies:
91
102
  name: rspec
92
103
  prerelease: false
93
104
  requirement: &id006 !ruby/object:Gem::Requirement
105
+ none: false
94
106
  requirements:
95
107
  - - ">="
96
108
  - !ruby/object:Gem::Version
109
+ hash: 13
97
110
  segments:
98
111
  - 1
99
112
  - 2
@@ -105,9 +118,11 @@ dependencies:
105
118
  name: yard
106
119
  prerelease: false
107
120
  requirement: &id007 !ruby/object:Gem::Requirement
121
+ none: false
108
122
  requirements:
109
123
  - - ">="
110
124
  - !ruby/object:Gem::Version
125
+ hash: 3
111
126
  segments:
112
127
  - 0
113
128
  version: "0"
@@ -126,6 +141,8 @@ files:
126
141
  - .document
127
142
  - .gitignore
128
143
  - .rvmrc
144
+ - Gemfile
145
+ - Gemfile.lock
129
146
  - LICENSE
130
147
  - README.rdoc
131
148
  - Rakefile
@@ -161,23 +178,27 @@ rdoc_options:
161
178
  require_paths:
162
179
  - lib
163
180
  required_ruby_version: !ruby/object:Gem::Requirement
181
+ none: false
164
182
  requirements:
165
183
  - - ">="
166
184
  - !ruby/object:Gem::Version
185
+ hash: 3
167
186
  segments:
168
187
  - 0
169
188
  version: "0"
170
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
+ none: false
171
191
  requirements:
172
192
  - - ">="
173
193
  - !ruby/object:Gem::Version
194
+ hash: 3
174
195
  segments:
175
196
  - 0
176
197
  version: "0"
177
198
  requirements: []
178
199
 
179
200
  rubyforge_project:
180
- rubygems_version: 1.3.6
201
+ rubygems_version: 1.3.7
181
202
  signing_key:
182
203
  specification_version: 3
183
204
  summary: Bootstrap and provision your ubuntu slice with ease