capistrano-fanfare 0.0.1

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.
@@ -0,0 +1,42 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/capistrano'
3
+ require 'capistrano'
4
+ require 'capistrano/recipes/deploy/scm'
5
+ require 'capistrano/recipes/deploy/strategy/git_style'
6
+
7
+ describe Capistrano::Deploy::Strategy::GitStyle do
8
+ before do
9
+ @config = Capistrano::Configuration.new
10
+ @config.set :releases_path, "/u/apps/fooapp/releases"
11
+ @config.set :release_name, "20120101020304-gitABC123"
12
+ @config.set :current_path, "/u/apps/fooapp/current"
13
+ @config.set :real_revision, "gitABC123"
14
+ @config.set :source, Capistrano::Deploy::SCM.new(:git, @config)
15
+ @config.extend(MiniTest::Capistrano::ConfigurationExtension)
16
+
17
+ @strategy = Capistrano::Deploy::Strategy::GitStyle.new(@config)
18
+ end
19
+
20
+ def runs_msg(cmd)
21
+ runs_list = @config.runs.keys.sort.
22
+ map { |c|c.sub(/^/, '\'').sub(/$/, '\'')}.join(', ')
23
+ "Expected run call of '#{cmd}' in run list of: [#{runs_list}]"
24
+ end
25
+
26
+ it "deploys a git checkout if fresh and a git fetch if existing" do
27
+ @strategy.deploy!
28
+
29
+ cmd = [
30
+ "if [ -d /u/apps/fooapp/current/.git ]; then ",
31
+ "cd /u/apps/fooapp/current && git fetch -q origin && ",
32
+ "git fetch --tags -q origin && git reset -q --hard gitABC123 && ",
33
+ "git clean -q -d -x -f; ",
34
+ "else ",
35
+ "git clone -q /u/apps/fooapp/current && ",
36
+ "cd /u/apps/fooapp/current && git checkout -q -b deploy gitABC123; ",
37
+ "fi && ",
38
+ "(mkdir -p /u/apps/fooapp/releases/20120101020304-gitABC123)"
39
+ ]
40
+ @config.must_have_run cmd.join, runs_msg(cmd.join)
41
+ end
42
+ end
@@ -0,0 +1,26 @@
1
+ require 'minitest/autorun'
2
+ require 'capistrano/fanfare'
3
+
4
+ describe Capistrano::Fanfare do
5
+ before do
6
+ @config = Capistrano::Configuration.new
7
+ @config.load_paths << File.join(File.dirname(__FILE__), "fixtures")
8
+ @orig_config = Capistrano::Configuration.instance
9
+ Capistrano::Configuration.instance = @config
10
+ end
11
+
12
+ after do
13
+ Capistrano::Configuration.instance = @orig_config
14
+ end
15
+
16
+ it 'loads a fanfare capistrano recipe' do
17
+ @config.load 'fanfare/bark'
18
+
19
+ @config.find_and_execute_task("bark").must_equal "ruff ruff"
20
+ @config.fetch(:message).must_equal "ruff ruff"
21
+ end
22
+
23
+ it 'adds #fanfare_recipe onto Capistrano::Configuration' do
24
+ @config.must_respond_to :fanfare_recipe
25
+ end
26
+ end
@@ -0,0 +1,57 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/capistrano'
3
+ require 'capistrano/fanfare'
4
+ require 'capistrano/fanfare/multistage'
5
+ require 'stringio'
6
+
7
+ describe Capistrano::Fanfare::Multistage do
8
+ before do
9
+ @config = Capistrano::Configuration.new
10
+ Capistrano::Fanfare::Multistage.load_into(@config)
11
+ @config.extend(MiniTest::Capistrano::ConfigurationExtension)
12
+ @orig_config = Capistrano::Configuration.instance
13
+ Capistrano::Configuration.instance = @config
14
+ end
15
+
16
+ after do
17
+ Capistrano::Configuration.instance = @orig_config
18
+ end
19
+
20
+ describe "for variables" do
21
+ it "sets :stages array to staging and production" do
22
+ @config.fetch(:stages).must_equal ["staging", "production"]
23
+ end
24
+
25
+ it "sets :default_stage to staging" do
26
+ @config.fetch(:default_stage).must_equal "staging"
27
+ end
28
+ end
29
+
30
+ describe "for tasks" do
31
+ it "defines a task for each stage" do
32
+ @config = Capistrano::Configuration.new
33
+ @config.set :stages, %w{dev prod chickens}
34
+ Capistrano::Fanfare::Multistage.load_into(@config)
35
+ @config.extend(MiniTest::Capistrano::ConfigurationExtension)
36
+ @orig_config = Capistrano::Configuration.instance
37
+ Capistrano::Configuration.instance = @config
38
+
39
+ @config.must_have_task :dev
40
+ @config.must_have_task :prod
41
+ @config.must_have_task :chickens
42
+ end
43
+
44
+ it ":all_stages shows a list of all valid stages" do
45
+ io = StringIO.new
46
+ @config.logger = Capistrano::Logger.new(:output => io)
47
+ @config.find_and_execute_task("all_stages")
48
+
49
+ io.string.must_equal [
50
+ "*** Valid stages are:",
51
+ "*** ",
52
+ "*** * staging",
53
+ "*** * production"
54
+ ].join("\n").concat("\n")
55
+ end
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-fanfare
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Fletcher Nichol
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &70216612714240 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - =
20
+ - !ruby/object:Gem::Version
21
+ version: 2.10.0.pre
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70216612714240
25
+ - !ruby/object:Gem::Dependency
26
+ name: capistrano_colors
27
+ requirement: &70216612713480 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0.5'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70216612713480
36
+ - !ruby/object:Gem::Dependency
37
+ name: minitest
38
+ requirement: &70216612712740 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 2.10.0
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70216612712740
47
+ - !ruby/object:Gem::Dependency
48
+ name: minitest-capistrano
49
+ requirement: &70216612711920 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70216612711920
58
+ - !ruby/object:Gem::Dependency
59
+ name: timecop
60
+ requirement: &70216612711380 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '0.3'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70216612711380
69
+ description: Capistrano recipes (with full test suite) for fanfare application deployment
70
+ framework
71
+ email:
72
+ - fnichol@nichol.ca
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - .travis.yml
79
+ - Gemfile
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - capistrano-fanfare.gemspec
84
+ - lib/capistrano/fanfare.rb
85
+ - lib/capistrano/fanfare/bundler.rb
86
+ - lib/capistrano/fanfare/defaults.rb
87
+ - lib/capistrano/fanfare/foreman.rb
88
+ - lib/capistrano/fanfare/foreman/strategy.rb
89
+ - lib/capistrano/fanfare/foreman/strategy/base.rb
90
+ - lib/capistrano/fanfare/foreman/strategy/runit.rb
91
+ - lib/capistrano/fanfare/git_style.rb
92
+ - lib/capistrano/fanfare/multistage.rb
93
+ - lib/capistrano/fanfare/version.rb
94
+ - lib/capistrano/recipes/deploy/strategy/git_style.rb
95
+ - spec/bundler_spec.rb
96
+ - spec/defaults_spec.rb
97
+ - spec/fixtures/Procfile
98
+ - spec/fixtures/fanfare/bark.rb
99
+ - spec/fixtures/fanfare/meow.rb
100
+ - spec/foreman/strategy/runit_spec.rb
101
+ - spec/foreman_spec.rb
102
+ - spec/git_style_spec.rb
103
+ - spec/git_style_strategy_spec.rb
104
+ - spec/loading_spec.rb
105
+ - spec/multistage_spec.rb
106
+ homepage: https://github.com/fnichol/capistrano-fanfare
107
+ licenses: []
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ segments:
119
+ - 0
120
+ hash: -996615476762693867
121
+ required_rubygems_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ segments:
128
+ - 0
129
+ hash: -996615476762693867
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 1.8.10
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: Capistrano recipes (with full test suite) for fanfare application deployment
136
+ framework
137
+ test_files:
138
+ - spec/bundler_spec.rb
139
+ - spec/defaults_spec.rb
140
+ - spec/fixtures/Procfile
141
+ - spec/fixtures/fanfare/bark.rb
142
+ - spec/fixtures/fanfare/meow.rb
143
+ - spec/foreman/strategy/runit_spec.rb
144
+ - spec/foreman_spec.rb
145
+ - spec/git_style_spec.rb
146
+ - spec/git_style_strategy_spec.rb
147
+ - spec/loading_spec.rb
148
+ - spec/multistage_spec.rb