cap-strap 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cap-strap might be problematic. Click here for more details.

data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .vagrant
data/Capfile ADDED
@@ -0,0 +1,4 @@
1
+ load 'deploy' if respond_to?(:namespace) #cap2 differentiator
2
+ Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
3
+
4
+ load 'config/deploy'
@@ -0,0 +1,6 @@
1
+ guard 'rspec', :cli => "--color --fail-fast --drb", :version => 2 do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { "spec" }
5
+ end
6
+
data/README.md CHANGED
@@ -1,19 +1,19 @@
1
- # CapStrap
1
+ # cap-strap
2
2
 
3
- CapStrap is a Capistrano Extension that bootstraps a machine for future capistrano tasks.
4
- It installs System-wide Rvm and specified rubies and gems. It will create a user for future capistrano
5
- deploy tasks.
3
+ cap-strap is a Capistrano Extension that bootstraps a machine for future capistrano tasks.
4
+ It installs System-wide RVM and specified rubies and gems. It will create a deploy user, upload authorized_keys and
5
+ deploy key.
6
6
 
7
7
  ## Notes
8
8
 
9
- Currently only Ubuntu 10.04 and 10.10 have been tested.
9
+ Currently cap-strap has only been tested on Ubuntu 10.04 and 10.10.
10
10
 
11
11
 
12
12
  ## Installation
13
13
 
14
14
  Add this line to your application's Gemfile:
15
15
 
16
- gem 'cap-strap', :git => 'git@github.com:substantial/cap-strap.git'
16
+ gem 'cap-strap'
17
17
 
18
18
  And then execute:
19
19
 
@@ -22,9 +22,12 @@ And then execute:
22
22
  ## Usage
23
23
 
24
24
  You will be prompted for the name of the future deploy_user, location of authorized keys and
25
- the deploy_key. Deploy key isn't required, and you may skip.
25
+ the deploy user's deploy_key. Deploy key isn't required, and you may skip.
26
+
27
+ You may re-run the deploy_key task by `$ cap <stage> bootstrap:upload_deploy_key`
26
28
 
27
29
  In your deploy.rb, you may override the following variables:
30
+
28
31
  Note: Paths are relative to the root
29
32
 
30
33
  * `set :deploy_user, "<name of user for future deployes>"`
@@ -51,7 +54,23 @@ Note: Run from project root
51
54
  We're https://github.com/technicalpickles/capistrano-spec for testing the capistrano
52
55
  configuration.
53
56
 
54
- ###TODO: Use Vagrant to test cap-strap.
57
+ ### Testing with Vagrant
58
+
59
+ Vagrant will fetch a lucid-64 box and boot it up. Once started, it will run
60
+ cap bootstrap on the vagrant box.
61
+
62
+ To run: `bundle exec rake vagrant_test`
63
+
64
+ To reload the box and run again: `bundle exec rake vagrant_test:restart`
65
+
66
+ Vagrant Notes:
67
+
68
+ * `vagrant ssh` - will ssh into the vagrant VM.
69
+ * lucid64 root user and password is "vagrant"
70
+ * vagrant box runs on port 2222
71
+ * `vagrant destroy` - will destroy the current vagrant VM. It doesn't remove the large downloaded box.
72
+
73
+ For more information regarding Vagrant: http://vagrantup.com/
55
74
 
56
75
  ## Contributing
57
76
 
data/Rakefile CHANGED
@@ -3,6 +3,33 @@ require "rspec/core/rake_task"
3
3
 
4
4
  task :default => :spec
5
5
 
6
+ desc "Test cap-strap on a local virtual machine, courtesy of vagrant."
7
+ task :vagrant_test => ["vagrant_test:default"]
8
+
9
+ namespace :vagrant_test do
10
+
11
+ task :default => [:up, :test]
12
+
13
+ task :test do
14
+ puts "Running cap bootstrap"
15
+ %x[bundle exec cap bootstrap]
16
+ end
17
+
18
+ task :restart => [:down, :up, :test]
19
+
20
+ task :down do
21
+ puts "Forcing vagrant shutdown"
22
+ %x[bundle exec vagrant destroy --force]
23
+ end
24
+
25
+ task :up do
26
+ puts "WARNING: This will take a while..."
27
+ puts "Starting up vagrant"
28
+ %x[bundle exec vagrant up]
29
+ puts "Vagrant is up."
30
+ end
31
+ end
32
+
6
33
  Rspec::Core::RakeTask.new do |t|
7
34
  t.pattern = "./spec/*_spec.rb"
8
35
  end
@@ -0,0 +1,10 @@
1
+ Vagrant::Config.run do |config|
2
+
3
+ config.vm.box = "lucid64"
4
+
5
+ config.vm.box_url = "http://files.vagrantup.com/lucid64.box"
6
+
7
+ config.vm.forward_port 80, 8080
8
+ config.vm.forward_port 22, 2222
9
+ config.ssh.forward_agent = true
10
+ end
@@ -1,14 +1,13 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require "cap-strap/version"
4
3
 
5
4
  Gem::Specification.new do |s|
6
5
  s.name = "cap-strap"
7
- s.version = "0.0.3"
6
+ s.version = "0.0.4"
8
7
  s.authors = ["Shaun Dern"]
9
8
  s.email = ["shaun@substantial.com"]
10
- s.homepage = ""
11
- s.summary = %q{Bootstrap a new machine for future Capistrano tasks.}
9
+ s.homepage = "http://github.com/substantial/cap-strap"
10
+ s.summary = %q{Bootstrap a new machine. Use with Capistrano to fully automate your provisioning.}
12
11
  s.description = %q{Bootstrap a machine. Create a deploy user, upload authorized keys and deploy key. Uses RVM to install desired rubies, with patch support.}
13
12
 
14
13
  s.rubyforge_project = "cap-strap"
@@ -18,9 +17,13 @@ Gem::Specification.new do |s|
18
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
18
  s.require_paths = ["lib"]
20
19
 
20
+ s.add_development_dependency "rake", "~> 0.9.2.2"
21
21
  s.add_development_dependency "capistrano", '>= 2.0.0'
22
- s.add_development_dependency "capistrano-spec"
23
- s.add_development_dependency "rspec"
22
+ s.add_development_dependency "capistrano-spec","~> 0.1.0"
23
+ s.add_development_dependency "rspec", "~> 2.9.0"
24
+ s.add_development_dependency "guard-rspec", "~> 0.7.0"
25
+ s.add_development_dependency "vagrant", "~> 1.0.2"
26
+
24
27
 
25
28
  s.add_runtime_dependency "capistrano", ">= 2.0.0"
26
29
  end
@@ -0,0 +1,24 @@
1
+ require 'cap-strap'
2
+
3
+ server "localhost", :test
4
+
5
+ set :port, 2222
6
+
7
+ set :user, "vagrant"
8
+ set :password, "vagrant"
9
+
10
+ set :gemset, "build-agent"
11
+ set :rubies, [
12
+ "1.9.3-p125",
13
+ {
14
+ :version => "1.9.3-p125-perf",
15
+ :patch => "falcon,debug --force-autoconf -j 3"
16
+ }
17
+ ]
18
+
19
+ set :default_ruby, "1.9.3-p125-perf"
20
+
21
+ set :deploy_user, "deploy"
22
+ set :group, "rvm"
23
+ set :authorized_keys_file, "config/test-authorized-keys"
24
+ set :deploy_key_file, "config/test-deploy-key"
@@ -0,0 +1 @@
1
+ Authorized Keys
@@ -0,0 +1 @@
1
+ deploy_user's deploy key
@@ -43,15 +43,22 @@ def user_exists?(user)
43
43
  end
44
44
 
45
45
  def default_known_hosts
46
- <<-TEXT
46
+ <<TEXT
47
47
  github.com,207.97.227.239 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
48
- TEXT
48
+ TEXT
49
+ end
50
+
51
+ def ruby_installed?(ruby)
52
+ ruby_test = "source /etc/profile.d/rvm.sh && if rvm list | grep -q '#{ruby} '; then echo 'true'; else echo 'false'; fi"
53
+ return capture(rvm_wrapper(ruby_test)).include?("true")
49
54
  end
50
55
 
51
56
  def install_ruby(ruby, patch = nil)
52
- command = "rvm install #{ruby}"
53
- command << " --patch #{patch}" if patch
54
- sudo rvm_wrapper(command)
57
+ unless ruby_installed?(ruby)
58
+ command = "rvm install #{ruby}"
59
+ command << " --patch #{patch}" if patch
60
+ sudo rvm_wrapper(command)
61
+ end
55
62
  end
56
63
 
57
64
  def install_global_gem(ruby, gem)
@@ -59,7 +66,7 @@ def install_global_gem(ruby, gem)
59
66
  end
60
67
 
61
68
  def rvm_wrapper(command)
62
- "bash -c '. /etc/profile.d/rvm.sh && #{command}'"
69
+ "bash -c \". /etc/profile.d/rvm.sh && #{command}\""
63
70
  end
64
71
 
65
72
  def gemrc
@@ -20,7 +20,7 @@ module Capistrano
20
20
  _cset(:known_hosts) { default_known_hosts }
21
21
 
22
22
  namespace :bootstrap do
23
- desc "bootstraps a fresh box."
23
+ desc "Bootstraps a fresh box. Install RVM, create the deploy user, upload keys."
24
24
  task :default do
25
25
  rvm.default
26
26
  bootstrap.create_deploy_user
@@ -36,6 +36,8 @@ module Capistrano
36
36
  add_user_to_group(deploy_user, "admin")
37
37
  end
38
38
 
39
+ desc "Upload authorized keys for the deploy_user. Override by setting :authorized_keys_file. This
40
+ is the relative path from the project root"
39
41
  task :upload_deploy_authorized_keys do
40
42
  begin
41
43
  authorized_keys_path = File.join(File.expand_path(Dir.pwd), authorized_keys_file)
@@ -7,7 +7,7 @@ module Capistrano
7
7
 
8
8
  _cset :default_ruby , "1.9.3-p125"
9
9
  _cset :gemset, "global"
10
- _cset :rubies, []
10
+ _cset :rubies, ["1.9.3-p125"]
11
11
  _cset(:user) { Capistrano::CLI.ui.ask("bootstrap root user: ") }
12
12
  _cset :global_gems, ["bundler"]
13
13
 
@@ -31,7 +31,6 @@ module Capistrano
31
31
  end
32
32
 
33
33
  task :install_rubies do
34
- rubies << default_ruby
35
34
  rubies.each do |rubie|
36
35
  if rubie.is_a?(Hash)
37
36
  ruby = rubie.fetch(:version)
@@ -22,8 +22,13 @@ describe Capistrano::RVM do
22
22
  @configuration.fetch(:gemset).should be
23
23
  end
24
24
 
25
- it "defaults to empty ruby set" do
26
- @configuration.fetch(:rubies).length.should be 0
25
+ it "has a rubie ruby set" do
26
+ @configuration.fetch(:rubies).length.should be 1
27
+ end
28
+
29
+ it "ruby is the default rubie" do
30
+ default_ruby = @configuration.fetch(:default_ruby)
31
+ @configuration.fetch(:rubies).first.should == default_ruby
27
32
  end
28
33
 
29
34
  it "has bundler in it's global gems" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-strap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,59 +9,77 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-19 00:00:00.000000000 Z
12
+ date: 2012-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: capistrano
16
- requirement: !ruby/object:Gem::Requirement
15
+ name: rake
16
+ requirement: &70250544779080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 2.0.0
21
+ version: 0.9.2.2
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
24
+ version_requirements: *70250544779080
25
+ - !ruby/object:Gem::Dependency
26
+ name: capistrano
27
+ requirement: &70250544778420 !ruby/object:Gem::Requirement
25
28
  none: false
26
29
  requirements:
27
30
  - - ! '>='
28
31
  - !ruby/object:Gem::Version
29
32
  version: 2.0.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70250544778420
30
36
  - !ruby/object:Gem::Dependency
31
37
  name: capistrano-spec
32
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &70250544777660 !ruby/object:Gem::Requirement
33
39
  none: false
34
40
  requirements:
35
- - - ! '>='
41
+ - - ~>
36
42
  - !ruby/object:Gem::Version
37
- version: '0'
43
+ version: 0.1.0
38
44
  type: :development
39
45
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
46
+ version_requirements: *70250544777660
47
+ - !ruby/object:Gem::Dependency
48
+ name: rspec
49
+ requirement: &70250544777100 !ruby/object:Gem::Requirement
41
50
  none: false
42
51
  requirements:
43
- - - ! '>='
52
+ - - ~>
44
53
  - !ruby/object:Gem::Version
45
- version: '0'
54
+ version: 2.9.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70250544777100
46
58
  - !ruby/object:Gem::Dependency
47
- name: rspec
48
- requirement: !ruby/object:Gem::Requirement
59
+ name: guard-rspec
60
+ requirement: &70250544776580 !ruby/object:Gem::Requirement
49
61
  none: false
50
62
  requirements:
51
- - - ! '>='
63
+ - - ~>
52
64
  - !ruby/object:Gem::Version
53
- version: '0'
65
+ version: 0.7.0
54
66
  type: :development
55
67
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
68
+ version_requirements: *70250544776580
69
+ - !ruby/object:Gem::Dependency
70
+ name: vagrant
71
+ requirement: &70250544776120 !ruby/object:Gem::Requirement
57
72
  none: false
58
73
  requirements:
59
- - - ! '>='
74
+ - - ~>
60
75
  - !ruby/object:Gem::Version
61
- version: '0'
76
+ version: 1.0.2
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70250544776120
62
80
  - !ruby/object:Gem::Dependency
63
81
  name: capistrano
64
- requirement: !ruby/object:Gem::Requirement
82
+ requirement: &70250544775660 !ruby/object:Gem::Requirement
65
83
  none: false
66
84
  requirements:
67
85
  - - ! '>='
@@ -69,12 +87,7 @@ dependencies:
69
87
  version: 2.0.0
70
88
  type: :runtime
71
89
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: 2.0.0
90
+ version_requirements: *70250544775660
78
91
  description: Bootstrap a machine. Create a deploy user, upload authorized keys and
79
92
  deploy key. Uses RVM to install desired rubies, with patch support.
80
93
  email:
@@ -84,10 +97,16 @@ extensions: []
84
97
  extra_rdoc_files: []
85
98
  files:
86
99
  - .gitignore
100
+ - Capfile
87
101
  - Gemfile
102
+ - Guardfile
88
103
  - README.md
89
104
  - Rakefile
105
+ - Vagrantfile
90
106
  - cap-strap.gemspec
107
+ - config/deploy.rb
108
+ - config/test-authorized-keys
109
+ - config/test-deploy-key
91
110
  - lib/cap-strap.rb
92
111
  - lib/cap-strap/helpers.rb
93
112
  - lib/cap-strap/recipes/bootstrap.rb
@@ -95,7 +114,7 @@ files:
95
114
  - spec/bootstrap_spec.rb
96
115
  - spec/rvm_spec.rb
97
116
  - spec/spec_helper.rb
98
- homepage: ''
117
+ homepage: http://github.com/substantial/cap-strap
99
118
  licenses: []
100
119
  post_install_message:
101
120
  rdoc_options: []
@@ -115,10 +134,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
134
  version: '0'
116
135
  requirements: []
117
136
  rubyforge_project: cap-strap
118
- rubygems_version: 1.8.22
137
+ rubygems_version: 1.8.10
119
138
  signing_key:
120
139
  specification_version: 3
121
- summary: Bootstrap a new machine for future Capistrano tasks.
140
+ summary: Bootstrap a new machine. Use with Capistrano to fully automate your provisioning.
122
141
  test_files:
123
142
  - spec/bootstrap_spec.rb
124
143
  - spec/rvm_spec.rb