cap-strap 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

data/Guardfile CHANGED
@@ -1,6 +1,5 @@
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" }
1
+ guard 'minitest' do
2
+ watch(%r|^spec/(.*)_spec\.rb|)
3
+ watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "spec/#{m[2]}_spec.rb" }
4
+ watch(%r|^spec/spec_helper\.rb|) { "spec" }
5
5
  end
6
-
data/Rakefile CHANGED
@@ -1,7 +1,13 @@
1
1
  require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
2
+ require 'rake/testtask'
3
3
 
4
- task :default => :spec
4
+ Rake::TestTask.new do |t|
5
+ t.libs.push "lib"
6
+ t.test_files = FileList['spec/*_spec.rb']
7
+ t.verbose = true
8
+ end
9
+
10
+ task :default => :test
5
11
 
6
12
  desc "Test cap-strap on a local virtual machine, courtesy of vagrant."
7
13
  task :vagrant_test => ["vagrant_test:default"]
@@ -29,7 +35,3 @@ namespace :vagrant_test do
29
35
  puts "Vagrant is up."
30
36
  end
31
37
  end
32
-
33
- Rspec::Core::RakeTask.new do |t|
34
- t.pattern = "./spec/*_spec.rb"
35
- end
data/cap-strap.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "cap-strap"
6
- s.version = "0.0.4"
6
+ s.version = "0.0.5"
7
7
  s.authors = ["Shaun Dern"]
8
8
  s.email = ["shaun@substantial.com"]
9
9
  s.homepage = "http://github.com/substantial/cap-strap"
@@ -17,13 +17,12 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_development_dependency "rake", "~> 0.9.2.2"
21
- s.add_development_dependency "capistrano", '>= 2.0.0'
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"
20
+ s.add_development_dependency "minitest", "~> 2.12.0"
21
+ s.add_development_dependency "minitest-capistrano", "~> 0.0.8"
22
+ s.add_development_dependency "minitest-colorize", "~> 0.0.4"
23
+ s.add_development_dependency "guard-minitest", "~> 0.5.0"
24
+ s.add_development_dependency "mocha", "~> 0.11.1"
25
25
  s.add_development_dependency "vagrant", "~> 1.0.2"
26
26
 
27
-
28
- s.add_runtime_dependency "capistrano", ">= 2.0.0"
27
+ s.add_dependency "capistrano", ">= 2.0.0"
29
28
  end
@@ -2,7 +2,7 @@ require 'cap-strap/helpers'
2
2
  require 'cap-strap/recipes/rvm'
3
3
  require 'capistrano/cli'
4
4
 
5
- module Capistrano
5
+ module Capistrano::CapStrap
6
6
  module Bootstrap
7
7
  def self.load_into(configuration)
8
8
  configuration.load do
@@ -30,6 +30,10 @@ module Capistrano
30
30
  bootstrap.upload_deploy_key
31
31
  end
32
32
 
33
+ task :set_deploy_ownership do
34
+ sudo "chown -R #{deploy_user}:#{group} #{deploy_to}"
35
+ end
36
+
33
37
  task :create_deploy_user do
34
38
  create_user(deploy_user)
35
39
  add_user_to_group(deploy_user, "rvm")
@@ -1,6 +1,7 @@
1
1
  require 'cap-strap/helpers'
2
+ require 'capistrano/cli'
2
3
 
3
- module Capistrano
4
+ module Capistrano::CapStrap
4
5
  module RVM
5
6
  def self.load_into(configuration)
6
7
  configuration.load do
data/lib/cap-strap.rb CHANGED
@@ -5,8 +5,8 @@ require "cap-strap/recipes/rvm"
5
5
  require "cap-strap/recipes/bootstrap"
6
6
 
7
7
  if instance = Capistrano::Configuration.instance
8
- Capistrano::RVM.load_into(instance)
9
- Capistrano::Bootstrap.load_into(instance)
8
+ Capistrano::CapStrap::RVM.load_into(instance)
9
+ Capistrano::CapStrap::Bootstrap.load_into(instance)
10
10
 
11
11
  instance.load do
12
12
  ssh_options[:forward_agent] = true
@@ -1,49 +1,53 @@
1
- require 'spec_helper'
2
-
3
- describe Capistrano::Bootstrap do
4
- let(:ui) { double("ui", :ask => 'prompt') }
5
- before do
6
- @configuration = Capistrano::Configuration.new
7
- @configuration.extend(Capistrano::Spec::ConfigurationExtension)
8
- Capistrano::Bootstrap.load_into(@configuration)
9
- Capistrano::CLI.stub(:ui).and_return { ui }
10
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Capistrano::CapStrap::Bootstrap do
4
+ load_capistrano_recipe(Capistrano::CapStrap::Bootstrap)
11
5
 
12
6
  describe "default variables" do
7
+ before do
8
+ Capistrano::CLI.ui.stubs(:ask).returns('prompt')
9
+ end
10
+
13
11
  it "prompts for a bootstrap user" do
14
- @configuration.fetch(:user).should == 'prompt'
12
+ recipe.fetch(:user).must_equal 'prompt'
15
13
  end
16
14
 
17
15
  it "prompts for a deploy user" do
18
- @configuration.fetch(:deploy_user).should == 'prompt'
16
+ recipe.fetch(:deploy_user).must_equal 'prompt'
19
17
  end
20
18
 
21
19
  it 'prompts for authorized keys if no path set' do
22
- @configuration.fetch(:authorized_keys_file).should == 'prompt'
20
+ recipe.fetch(:authorized_keys_file).must_equal 'prompt'
23
21
  end
24
22
 
25
23
  it "prompts for deploy key location if not set" do
26
- @configuration.fetch(:deploy_key_file).should == 'prompt'
24
+ recipe.fetch(:deploy_key_file).must_equal 'prompt'
27
25
  end
28
26
  end
29
27
 
30
28
  describe "variables set" do
31
29
  before do
32
- @configuration.set(:user, "foo")
33
- @configuration.set(:deploy_user, "bar")
34
- @configuration.set(:known_hosts, "baz")
30
+ recipe.set(:user, "foo")
31
+ recipe.set(:deploy_user, "bar")
32
+ recipe.set(:known_hosts, "baz")
35
33
  end
36
34
 
37
35
  it "doesn't prompted for a bootstrap user" do
38
- @configuration.fetch(:user).should == "foo"
36
+ recipe.fetch(:user).must_equal "foo"
39
37
  end
40
38
 
41
39
  it "doesn't prompted for a deploy user" do
42
- @configuration.fetch(:deploy_user).should == "bar"
40
+ recipe.fetch(:deploy_user).must_equal "bar"
43
41
  end
44
42
 
45
43
  it "replaces known_hosts with ones that are set" do
46
- @configuration.fetch(:known_hosts).should == "baz"
44
+ recipe.fetch(:known_hosts).must_equal "baz"
45
+ end
46
+ end
47
+
48
+ describe "callbacks" do
49
+ it "installs rvm dependencies before installing system rvm" do
50
+ recipe.must_have_callback_before "rvm:install_system_wide_rvm", "bootstrap:install_rvm_dependencies"
47
51
  end
48
52
  end
49
53
  end
data/spec/rvm_spec.rb CHANGED
@@ -1,38 +1,36 @@
1
- require 'spec_helper'
2
-
3
- describe Capistrano::RVM do
4
- let(:ui) { double("ui", :ask => 'prompt') }
5
- before do
6
- @configuration = Capistrano::Configuration.new
7
- @configuration.extend(Capistrano::Spec::ConfigurationExtension)
8
- Capistrano::RVM.load_into(@configuration)
9
- Capistrano::CLI.stub(:ui).and_return { ui }
10
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Capistrano::CapStrap::RVM do
4
+ load_capistrano_recipe(Capistrano::CapStrap::RVM)
11
5
 
12
6
  describe "default variables" do
7
+ let(:default_ruby) { "1.9.3-p125" }
8
+ before do
9
+ Capistrano::CLI.ui.stubs(:ask).returns('prompt')
10
+ end
11
+
13
12
  it "has a prompts for a bootstrap user" do
14
- @configuration.fetch(:user).should == 'prompt'
13
+ recipe.fetch(:user).must_equal "prompt"
15
14
  end
16
15
 
17
16
  it "has a default ruby" do
18
- @configuration.fetch(:default_ruby).should be
17
+ recipe.fetch(:default_ruby).must_equal default_ruby
19
18
  end
20
19
 
21
20
  it "has a default gemset" do
22
- @configuration.fetch(:gemset).should be
21
+ recipe.fetch(:gemset).must_equal "global"
23
22
  end
24
23
 
25
24
  it "has a rubie ruby set" do
26
- @configuration.fetch(:rubies).length.should be 1
25
+ recipe.fetch(:rubies).length.must_equal 1
27
26
  end
28
27
 
29
- it "ruby is the default rubie" do
30
- default_ruby = @configuration.fetch(:default_ruby)
31
- @configuration.fetch(:rubies).first.should == default_ruby
28
+ it "default ruby is in rubies" do
29
+ recipe.fetch(:rubies).must_include default_ruby
32
30
  end
33
31
 
34
32
  it "has bundler in it's global gems" do
35
- @configuration.fetch(:global_gems).include?("bundler").should == true
33
+ recipe.fetch(:global_gems).must_include 'bundler'
36
34
  end
37
35
  end
38
36
  end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,26 @@
1
1
  require 'capistrano'
2
+
3
+ require 'minitest/autorun'
4
+ require 'minitest/capistrano'
5
+ require 'minitest/colorize'
6
+ require 'mocha'
7
+
2
8
  require 'cap-strap'
3
9
 
4
- require 'capistrano-spec'
5
10
 
6
- Rspec.configure do |config|
7
- config.include Capistrano::Spec::Matchers
11
+ def load_capistrano_recipe(recipe)
12
+ before do
13
+ @config = Capistrano::Configuration.new
14
+ @config.extend(MiniTest::Capistrano::ConfigurationExtension)
15
+ @orig_config = Capistrano::Configuration.instance
16
+ Capistrano::Configuration.instance = @config
17
+ recipe.send(:load_into, @config)
18
+ end
19
+
20
+ after do
21
+ Capistrano::Configuration.instance = @orig_config
22
+ end
23
+
24
+ subject {@config}
25
+ let(:recipe) { @config }
8
26
  end
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.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,66 +9,66 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-20 00:00:00.000000000 Z
12
+ date: 2012-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rake
16
- requirement: &70250544779080 !ruby/object:Gem::Requirement
15
+ name: minitest
16
+ requirement: &70195146425940 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.9.2.2
21
+ version: 2.12.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70250544779080
24
+ version_requirements: *70195146425940
25
25
  - !ruby/object:Gem::Dependency
26
- name: capistrano
27
- requirement: &70250544778420 !ruby/object:Gem::Requirement
26
+ name: minitest-capistrano
27
+ requirement: &70195146424860 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ! '>='
30
+ - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: 2.0.0
32
+ version: 0.0.8
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70250544778420
35
+ version_requirements: *70195146424860
36
36
  - !ruby/object:Gem::Dependency
37
- name: capistrano-spec
38
- requirement: &70250544777660 !ruby/object:Gem::Requirement
37
+ name: minitest-colorize
38
+ requirement: &70195146424260 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.1.0
43
+ version: 0.0.4
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70250544777660
46
+ version_requirements: *70195146424260
47
47
  - !ruby/object:Gem::Dependency
48
- name: rspec
49
- requirement: &70250544777100 !ruby/object:Gem::Requirement
48
+ name: guard-minitest
49
+ requirement: &70195146423440 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 2.9.0
54
+ version: 0.5.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70250544777100
57
+ version_requirements: *70195146423440
58
58
  - !ruby/object:Gem::Dependency
59
- name: guard-rspec
60
- requirement: &70250544776580 !ruby/object:Gem::Requirement
59
+ name: mocha
60
+ requirement: &70195146461640 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
64
64
  - !ruby/object:Gem::Version
65
- version: 0.7.0
65
+ version: 0.11.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70250544776580
68
+ version_requirements: *70195146461640
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: vagrant
71
- requirement: &70250544776120 !ruby/object:Gem::Requirement
71
+ requirement: &70195146460720 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.2
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70250544776120
79
+ version_requirements: *70195146460720
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: capistrano
82
- requirement: &70250544775660 !ruby/object:Gem::Requirement
82
+ requirement: &70195146459460 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 2.0.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70250544775660
90
+ version_requirements: *70195146459460
91
91
  description: Bootstrap a machine. Create a deploy user, upload authorized keys and
92
92
  deploy key. Uses RVM to install desired rubies, with patch support.
93
93
  email: