capistrano_recipes 1.0.0
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.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +89 -0
- data/Rakefile +7 -0
- data/capistrano_recipes.gemspec +24 -0
- data/lib/capistrano/recipes/bundle.rb +9 -0
- data/lib/capistrano/recipes/bundler.rb +2 -0
- data/lib/capistrano/recipes/git.rb +119 -0
- data/lib/capistrano/recipes/multistage.rb +73 -0
- data/lib/capistrano/recipes/mysql.rb +134 -0
- data/lib/capistrano/recipes/nginx.rb +75 -0
- data/lib/capistrano/recipes/rails_assets.rb +7 -0
- data/lib/capistrano/recipes/templates/mysql.yml.erb +7 -0
- data/lib/capistrano/recipes/templates/nginx.vhost.erb +139 -0
- data/lib/capistrano/recipes/templates/unicorn.rb.erb +47 -0
- data/lib/capistrano/recipes/templates/unicorn_init.erb +84 -0
- data/lib/capistrano/recipes/unicorn.rb +71 -0
- data/lib/capistrano/recipes.rb +1 -0
- data/lib/capistrano_recipes.rb +129 -0
- data/spec/bundle_spec.rb +15 -0
- data/spec/bundler_spec.rb +14 -0
- data/spec/git_spec.rb +57 -0
- data/spec/multistage_spec.rb +66 -0
- data/spec/mysql_spec.rb +14 -0
- data/spec/nginx_spec.rb +16 -0
- data/spec/rails_assets.rb +37 -0
- data/spec/spec_helper.rb +108 -0
- data/spec/unicorn_spec.rb +16 -0
- metadata +126 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'capistrano_recipes'
|
2
|
+
require 'capistrano/cli'
|
3
|
+
|
4
|
+
module CapistranoRecipes
|
5
|
+
module Spec
|
6
|
+
module ConfigurationExtension
|
7
|
+
def run(cmd, options={}, &block)
|
8
|
+
runned_commands[cmd] = {:options => options, :block => block}
|
9
|
+
end
|
10
|
+
|
11
|
+
def execute_task(task)
|
12
|
+
executed_tasks << task.fully_qualified_name
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def runned_commands
|
17
|
+
@runned_commands ||= {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def executed_tasks
|
21
|
+
@executed_tasks ||= []
|
22
|
+
end
|
23
|
+
|
24
|
+
def _cset(name, *args, &block)
|
25
|
+
unless exists?(name)
|
26
|
+
set(name, *args, &block)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module Helper
|
32
|
+
def mock_config(new_instance = false, &block)
|
33
|
+
if !@config || new_instance
|
34
|
+
@config = Capistrano::Configuration.new(:output => StringIO.new)
|
35
|
+
@config.extend(CapistranoRecipes::Spec::ConfigurationExtension)
|
36
|
+
CapistranoRecipes.load_into(@config)
|
37
|
+
end
|
38
|
+
|
39
|
+
@config.instance_eval(&block)
|
40
|
+
end
|
41
|
+
|
42
|
+
def config
|
43
|
+
@config
|
44
|
+
end
|
45
|
+
|
46
|
+
def cli_execute(*args)
|
47
|
+
config = @config
|
48
|
+
cli = Capistrano::CLI.parse(args.flatten)
|
49
|
+
cli.instance_eval do
|
50
|
+
(class << self; self end).send(:define_method, :instantiate_configuration) do |options|
|
51
|
+
config
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
cli.execute!
|
56
|
+
end
|
57
|
+
|
58
|
+
def with_stderr
|
59
|
+
original, $stderr = $stderr, StringIO.new
|
60
|
+
output = Object.new
|
61
|
+
class << output
|
62
|
+
instance_methods.each { |m| undef_method m unless m =~ /^__|^object_id$|^instance_eval$/ }
|
63
|
+
end
|
64
|
+
def output.method_missing(*args, &block)
|
65
|
+
($stderr.rewind && $stderr.read).__send__(*args, &block)
|
66
|
+
end
|
67
|
+
|
68
|
+
yield output
|
69
|
+
ensure
|
70
|
+
$stderr = original
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
module Matchers
|
75
|
+
extend RSpec::Matchers::DSL
|
76
|
+
|
77
|
+
define :have_run do |cmd|
|
78
|
+
match do |configuration|
|
79
|
+
configuration.runned_commands[cmd]
|
80
|
+
end
|
81
|
+
|
82
|
+
failure_message_for_should do |configuration|
|
83
|
+
"expected configuration to run #{cmd}, but it wasn't found in #{configuration.runned_commands.keys}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
define :have_executed do |*tasks|
|
88
|
+
match do |configuration|
|
89
|
+
expected = tasks.dup
|
90
|
+
configuration.executed_tasks.each do |actual|
|
91
|
+
expected.shift if actual == expected.first
|
92
|
+
end
|
93
|
+
|
94
|
+
expected.empty?
|
95
|
+
end
|
96
|
+
|
97
|
+
failure_message_for_should do |configuration|
|
98
|
+
"expected configuration to execute #{tasks}, but it executed #{configuration.executed_tasks.keys}"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
RSpec.configure do |config|
|
106
|
+
config.include CapistranoRecipes::Spec::Helper
|
107
|
+
config.include CapistranoRecipes::Spec::Matchers
|
108
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'unicorn' do
|
4
|
+
before do
|
5
|
+
mock_config { use_recipes :unicorn }
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'returns used recipe' do
|
9
|
+
config.used_recipes.should == [:unicorn]
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has default unicorn pid' do
|
13
|
+
mock_config { set :deploy_to, '/foo/bar' }
|
14
|
+
config.unicorn_pid_file.should == '/foo/bar/shared/pids/unicorn.pid'
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano_recipes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Fernando Aleman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.12'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.5'
|
55
|
+
description: Capistrano recipes to make your deployments fast and easy
|
56
|
+
email:
|
57
|
+
- fernandoaleman@mac.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- .rspec
|
64
|
+
- .travis.yml
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- capistrano_recipes.gemspec
|
70
|
+
- lib/capistrano/recipes.rb
|
71
|
+
- lib/capistrano/recipes/bundle.rb
|
72
|
+
- lib/capistrano/recipes/bundler.rb
|
73
|
+
- lib/capistrano/recipes/git.rb
|
74
|
+
- lib/capistrano/recipes/multistage.rb
|
75
|
+
- lib/capistrano/recipes/mysql.rb
|
76
|
+
- lib/capistrano/recipes/nginx.rb
|
77
|
+
- lib/capistrano/recipes/rails_assets.rb
|
78
|
+
- lib/capistrano/recipes/templates/mysql.yml.erb
|
79
|
+
- lib/capistrano/recipes/templates/nginx.vhost.erb
|
80
|
+
- lib/capistrano/recipes/templates/unicorn.rb.erb
|
81
|
+
- lib/capistrano/recipes/templates/unicorn_init.erb
|
82
|
+
- lib/capistrano/recipes/unicorn.rb
|
83
|
+
- lib/capistrano_recipes.rb
|
84
|
+
- spec/bundle_spec.rb
|
85
|
+
- spec/bundler_spec.rb
|
86
|
+
- spec/git_spec.rb
|
87
|
+
- spec/multistage_spec.rb
|
88
|
+
- spec/mysql_spec.rb
|
89
|
+
- spec/nginx_spec.rb
|
90
|
+
- spec/rails_assets.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
- spec/unicorn_spec.rb
|
93
|
+
homepage: https://github.com/fernandoaleman/capistrano_recipes
|
94
|
+
licenses:
|
95
|
+
- MIT
|
96
|
+
metadata: {}
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubyforge_project:
|
113
|
+
rubygems_version: 2.0.3
|
114
|
+
signing_key:
|
115
|
+
specification_version: 4
|
116
|
+
summary: Capistrano deployment recipes
|
117
|
+
test_files:
|
118
|
+
- spec/bundle_spec.rb
|
119
|
+
- spec/bundler_spec.rb
|
120
|
+
- spec/git_spec.rb
|
121
|
+
- spec/multistage_spec.rb
|
122
|
+
- spec/mysql_spec.rb
|
123
|
+
- spec/nginx_spec.rb
|
124
|
+
- spec/rails_assets.rb
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
- spec/unicorn_spec.rb
|