statistrano 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +7 -0
  2. data/changelog.md +161 -0
  3. data/doc/config/file-permissions.md +33 -0
  4. data/doc/config/log-files.md +32 -0
  5. data/doc/config/task-definitions.md +88 -0
  6. data/doc/getting-started.md +96 -0
  7. data/doc/strategies/base.md +38 -0
  8. data/doc/strategies/branches.md +82 -0
  9. data/doc/strategies/releases.md +110 -0
  10. data/doc/strategies.md +17 -0
  11. data/lib/statistrano/config/configurable.rb +53 -0
  12. data/lib/statistrano/config/rake_task_with_context_creation.rb +43 -0
  13. data/lib/statistrano/config.rb +52 -0
  14. data/lib/statistrano/deployment/log_file.rb +44 -0
  15. data/lib/statistrano/deployment/manifest.rb +88 -0
  16. data/lib/statistrano/deployment/rake_tasks.rb +74 -0
  17. data/lib/statistrano/deployment/registerable.rb +11 -0
  18. data/lib/statistrano/deployment/releaser/revisions.rb +163 -0
  19. data/lib/statistrano/deployment/releaser/single.rb +48 -0
  20. data/lib/statistrano/deployment/releaser.rb +2 -0
  21. data/lib/statistrano/deployment/strategy/base.rb +132 -0
  22. data/lib/statistrano/deployment/strategy/branches/index/template.html.erb +78 -0
  23. data/lib/statistrano/deployment/strategy/branches/index.rb +40 -0
  24. data/lib/statistrano/deployment/strategy/branches/release.rb +73 -0
  25. data/lib/statistrano/deployment/strategy/branches.rb +198 -0
  26. data/lib/statistrano/deployment/strategy/check_git.rb +43 -0
  27. data/lib/statistrano/deployment/strategy/invoke_tasks.rb +58 -0
  28. data/lib/statistrano/deployment/strategy/releases.rb +76 -0
  29. data/lib/statistrano/deployment/strategy.rb +37 -0
  30. data/lib/statistrano/deployment.rb +10 -0
  31. data/lib/statistrano/log/default_logger.rb +105 -0
  32. data/lib/statistrano/log.rb +33 -0
  33. data/lib/statistrano/remote/file.rb +79 -0
  34. data/lib/statistrano/remote.rb +111 -0
  35. data/lib/statistrano/shell.rb +17 -0
  36. data/lib/statistrano/util/file_permissions.rb +34 -0
  37. data/lib/statistrano/util.rb +27 -0
  38. data/lib/statistrano/version.rb +3 -0
  39. data/lib/statistrano.rb +55 -0
  40. data/readme.md +247 -0
  41. data/spec/integration_tests/base_integration_spec.rb +103 -0
  42. data/spec/integration_tests/branches_integration_spec.rb +189 -0
  43. data/spec/integration_tests/releases/deploy_integration_spec.rb +116 -0
  44. data/spec/integration_tests/releases/list_releases_integration_spec.rb +38 -0
  45. data/spec/integration_tests/releases/prune_releases_integration_spec.rb +86 -0
  46. data/spec/integration_tests/releases/rollback_release_integration_spec.rb +46 -0
  47. data/spec/lib/statistrano/config/configurable_spec.rb +88 -0
  48. data/spec/lib/statistrano/config/rake_task_with_context_creation_spec.rb +73 -0
  49. data/spec/lib/statistrano/config_spec.rb +34 -0
  50. data/spec/lib/statistrano/deployment/log_file_spec.rb +75 -0
  51. data/spec/lib/statistrano/deployment/manifest_spec.rb +171 -0
  52. data/spec/lib/statistrano/deployment/rake_tasks_spec.rb +107 -0
  53. data/spec/lib/statistrano/deployment/registerable_spec.rb +19 -0
  54. data/spec/lib/statistrano/deployment/releaser/revisions_spec.rb +486 -0
  55. data/spec/lib/statistrano/deployment/releaser/single_spec.rb +59 -0
  56. data/spec/lib/statistrano/deployment/strategy/base_spec.rb +158 -0
  57. data/spec/lib/statistrano/deployment/strategy/branches_spec.rb +19 -0
  58. data/spec/lib/statistrano/deployment/strategy/check_git_spec.rb +39 -0
  59. data/spec/lib/statistrano/deployment/strategy/invoke_tasks_spec.rb +66 -0
  60. data/spec/lib/statistrano/deployment/strategy/releases_spec.rb +257 -0
  61. data/spec/lib/statistrano/deployment/strategy_spec.rb +76 -0
  62. data/spec/lib/statistrano/deployment_spec.rb +4 -0
  63. data/spec/lib/statistrano/log/default_logger_spec.rb +172 -0
  64. data/spec/lib/statistrano/log_spec.rb +36 -0
  65. data/spec/lib/statistrano/remote/file_spec.rb +166 -0
  66. data/spec/lib/statistrano/remote_spec.rb +226 -0
  67. data/spec/lib/statistrano/util/file_permissions_spec.rb +25 -0
  68. data/spec/lib/statistrano/util_spec.rb +23 -0
  69. data/spec/lib/statistrano_spec.rb +52 -0
  70. data/spec/spec_helper.rb +86 -0
  71. data/spec/support/given.rb +39 -0
  72. metadata +223 -0
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe Statistrano do
4
+
5
+ describe "#define_deployment" do
6
+ it "creates a new deployment with a name" do
7
+ deployment = define_deployment("hello")
8
+ expect( deployment.name ).to eq "hello"
9
+ end
10
+
11
+ it "creates a new deployment with the specified type" do
12
+ default = define_deployment("base")
13
+ releases = define_deployment("releases", :releases)
14
+ branches = define_deployment("branches", :branches)
15
+
16
+ expect( default.class ).to eq Statistrano::Deployment::Strategy::Base
17
+ expect( releases.class ).to eq Statistrano::Deployment::Strategy::Releases
18
+ expect( branches.class ).to eq Statistrano::Deployment::Strategy::Branches
19
+ end
20
+
21
+ it "raises and ArgumentError if a deployment type isn't defined" do
22
+ expect{ define_deployment("foo", :foo) }.to raise_error Statistrano::Deployment::Strategy::UndefinedStrategy
23
+ end
24
+
25
+ it "allows the deployment to be configured" do
26
+ deployment = define_deployment "hello" do |config|
27
+ config.remote_dir = "/var/www/example.com"
28
+ end
29
+
30
+ releases = define_deployment "releases", :releases do |config|
31
+ config.build_task = "build:something"
32
+ end
33
+
34
+ branch = define_deployment "branch", :branches do |config|
35
+ config.base_domain = "foo.com"
36
+ end
37
+
38
+ expect( deployment.config.remote_dir ).to eq "/var/www/example.com"
39
+ expect( branch.config.base_domain ).to eq "foo.com"
40
+ expect( releases.config.build_task ).to eq "build:something"
41
+ end
42
+
43
+ it "has a 'sugar' syntax for configuration" do
44
+ deployment = define_deployment "hello" do
45
+ remote_dir "/var/www/sugarandspice.com"
46
+ end
47
+
48
+ expect( deployment.config.remote_dir ).to eq "/var/www/sugarandspice.com"
49
+ end
50
+ end
51
+
52
+ end
@@ -0,0 +1,86 @@
1
+ require 'rspec'
2
+ require 'rake'
3
+ require 'rainbow'
4
+ require 'fileutils'
5
+ require 'catch_and_release'
6
+ require 'catch_and_release/rspec'
7
+
8
+ RSpec.configure do |c|
9
+
10
+ c.mock_with :rspec do |mocks|
11
+ mocks.verify_doubled_constant_names = true
12
+ mocks.verify_partial_doubles = true
13
+ end
14
+
15
+ c.include CatchAndRelease::RSpec
16
+ end
17
+
18
+ if ENV['DEBUG']
19
+ require 'pry'
20
+ end
21
+
22
+ # for eating up stdout & stderr
23
+ unless ENV['VERBOSE'] || ENV['DEBUG']
24
+ stdout = StringIO.open('','w+')
25
+ $stdout = stdout
26
+
27
+ stderr = StringIO.open('','w+')
28
+ $stderr = stderr
29
+ end
30
+
31
+ unless ENV['RAINBOW']
32
+ Rainbow.enabled = false
33
+ end
34
+
35
+ ROOT = Dir.pwd
36
+
37
+ require 'support/given'
38
+
39
+ # Rake Helpers
40
+ # ----------------------------------------------------
41
+
42
+ include ::Rake::DSL
43
+ namespace :remote do
44
+ task :copy do
45
+ `cp -r source/ build/ 2> /dev/null`
46
+ end
47
+ task :error do
48
+ raise "error during the build"
49
+ end
50
+ end
51
+
52
+ def reenable_rake_tasks
53
+ Rake::Task.tasks.each { |t| t.reenable }
54
+ end
55
+
56
+ def release_folder_contents
57
+ Dir[ "deployment/releases/**" ].map { |d| d.gsub("deployment/releases/", '' ) }
58
+ end
59
+
60
+ def deployment_folder_contents
61
+ Dir[ "deployment/**" ].map { |d| d.gsub("deployment/", '' ) }
62
+ end
63
+
64
+ def multi_release_folder_contents
65
+ Dir[ "deployment/**/**" ].keep_if do |path|
66
+ path.match /releases\/(.+)/
67
+ end.keep_if do |path|
68
+ File.directory?(path)
69
+ end.map do |dir|
70
+ dir.sub("deployment/",'')
71
+ end
72
+ end
73
+
74
+ def tracer msg
75
+ STDOUT.puts "\n\n==========================\n\n#{msg}\n\n==========================\n"
76
+ end
77
+
78
+ # Startup SimpleCov
79
+ # ----------------------------------------------------
80
+
81
+ require 'simplecov'
82
+ SimpleCov.start do
83
+ add_filter 'spec'
84
+ end
85
+
86
+ require 'statistrano'
@@ -0,0 +1,39 @@
1
+ module Given
2
+ ROOT = Dir.pwd
3
+ TMP = File.join( Dir.pwd, 'tmp' )
4
+
5
+ class << self
6
+
7
+ def fixture name
8
+ cleanup!
9
+
10
+ `rsync -av ./spec/fixtures/#{name}/ #{TMP}/`
11
+ Dir.chdir TMP
12
+ end
13
+
14
+ def no_file name
15
+ FileUtils.rm name, force: true
16
+ end
17
+
18
+ def symlink source, destination
19
+ no_file destination
20
+ FileUtils.symlink File.expand_path(source),
21
+ File.expand_path(destination),
22
+ force: true
23
+ end
24
+
25
+ def file name, content
26
+ file_path = File.join( TMP, name )
27
+ FileUtils.mkdir_p( File.dirname(file_path) )
28
+ File.open( file_path, 'w' ) do |file|
29
+ file.write content
30
+ end
31
+ end
32
+
33
+ def cleanup!
34
+ Dir.chdir ROOT
35
+ `rm -rf #{TMP}`
36
+ end
37
+
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,223 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: statistrano
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Jordan Andree
8
+ - Steven Sloan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-12-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '10.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '10.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rainbow
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '1.99'
35
+ - - "<"
36
+ - !ruby/object:Gem::Version
37
+ version: '2.1'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '1.99'
45
+ - - "<"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.1'
48
+ - !ruby/object:Gem::Dependency
49
+ name: slugity
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: here_or_there
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.1'
69
+ type: :runtime
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.1'
76
+ - !ruby/object:Gem::Dependency
77
+ name: asgit
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.1'
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.1'
90
+ description: " Deployment tool focused on static sites. Has different modes for releases
91
+ with rollbacks, or for multiple branches allowing rapid prototyping. "
92
+ email: marketing-dev@mailchimp.com
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - changelog.md
98
+ - doc/config/file-permissions.md
99
+ - doc/config/log-files.md
100
+ - doc/config/task-definitions.md
101
+ - doc/getting-started.md
102
+ - doc/strategies.md
103
+ - doc/strategies/base.md
104
+ - doc/strategies/branches.md
105
+ - doc/strategies/releases.md
106
+ - lib/statistrano.rb
107
+ - lib/statistrano/config.rb
108
+ - lib/statistrano/config/configurable.rb
109
+ - lib/statistrano/config/rake_task_with_context_creation.rb
110
+ - lib/statistrano/deployment.rb
111
+ - lib/statistrano/deployment/log_file.rb
112
+ - lib/statistrano/deployment/manifest.rb
113
+ - lib/statistrano/deployment/rake_tasks.rb
114
+ - lib/statistrano/deployment/registerable.rb
115
+ - lib/statistrano/deployment/releaser.rb
116
+ - lib/statistrano/deployment/releaser/revisions.rb
117
+ - lib/statistrano/deployment/releaser/single.rb
118
+ - lib/statistrano/deployment/strategy.rb
119
+ - lib/statistrano/deployment/strategy/base.rb
120
+ - lib/statistrano/deployment/strategy/branches.rb
121
+ - lib/statistrano/deployment/strategy/branches/index.rb
122
+ - lib/statistrano/deployment/strategy/branches/index/template.html.erb
123
+ - lib/statistrano/deployment/strategy/branches/release.rb
124
+ - lib/statistrano/deployment/strategy/check_git.rb
125
+ - lib/statistrano/deployment/strategy/invoke_tasks.rb
126
+ - lib/statistrano/deployment/strategy/releases.rb
127
+ - lib/statistrano/log.rb
128
+ - lib/statistrano/log/default_logger.rb
129
+ - lib/statistrano/remote.rb
130
+ - lib/statistrano/remote/file.rb
131
+ - lib/statistrano/shell.rb
132
+ - lib/statistrano/util.rb
133
+ - lib/statistrano/util/file_permissions.rb
134
+ - lib/statistrano/version.rb
135
+ - readme.md
136
+ - spec/integration_tests/base_integration_spec.rb
137
+ - spec/integration_tests/branches_integration_spec.rb
138
+ - spec/integration_tests/releases/deploy_integration_spec.rb
139
+ - spec/integration_tests/releases/list_releases_integration_spec.rb
140
+ - spec/integration_tests/releases/prune_releases_integration_spec.rb
141
+ - spec/integration_tests/releases/rollback_release_integration_spec.rb
142
+ - spec/lib/statistrano/config/configurable_spec.rb
143
+ - spec/lib/statistrano/config/rake_task_with_context_creation_spec.rb
144
+ - spec/lib/statistrano/config_spec.rb
145
+ - spec/lib/statistrano/deployment/log_file_spec.rb
146
+ - spec/lib/statistrano/deployment/manifest_spec.rb
147
+ - spec/lib/statistrano/deployment/rake_tasks_spec.rb
148
+ - spec/lib/statistrano/deployment/registerable_spec.rb
149
+ - spec/lib/statistrano/deployment/releaser/revisions_spec.rb
150
+ - spec/lib/statistrano/deployment/releaser/single_spec.rb
151
+ - spec/lib/statistrano/deployment/strategy/base_spec.rb
152
+ - spec/lib/statistrano/deployment/strategy/branches_spec.rb
153
+ - spec/lib/statistrano/deployment/strategy/check_git_spec.rb
154
+ - spec/lib/statistrano/deployment/strategy/invoke_tasks_spec.rb
155
+ - spec/lib/statistrano/deployment/strategy/releases_spec.rb
156
+ - spec/lib/statistrano/deployment/strategy_spec.rb
157
+ - spec/lib/statistrano/deployment_spec.rb
158
+ - spec/lib/statistrano/log/default_logger_spec.rb
159
+ - spec/lib/statistrano/log_spec.rb
160
+ - spec/lib/statistrano/remote/file_spec.rb
161
+ - spec/lib/statistrano/remote_spec.rb
162
+ - spec/lib/statistrano/util/file_permissions_spec.rb
163
+ - spec/lib/statistrano/util_spec.rb
164
+ - spec/lib/statistrano_spec.rb
165
+ - spec/spec_helper.rb
166
+ - spec/support/given.rb
167
+ homepage: http://github.com/mailchimp/statistrano
168
+ licenses:
169
+ - New-BSD
170
+ metadata: {}
171
+ post_install_message:
172
+ rdoc_options: []
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ requirements: []
186
+ rubyforge_project:
187
+ rubygems_version: 2.4.3
188
+ signing_key:
189
+ specification_version: 4
190
+ summary: deployment tool for static sites
191
+ test_files:
192
+ - spec/integration_tests/base_integration_spec.rb
193
+ - spec/integration_tests/branches_integration_spec.rb
194
+ - spec/integration_tests/releases/deploy_integration_spec.rb
195
+ - spec/integration_tests/releases/list_releases_integration_spec.rb
196
+ - spec/integration_tests/releases/prune_releases_integration_spec.rb
197
+ - spec/integration_tests/releases/rollback_release_integration_spec.rb
198
+ - spec/lib/statistrano/config/configurable_spec.rb
199
+ - spec/lib/statistrano/config/rake_task_with_context_creation_spec.rb
200
+ - spec/lib/statistrano/config_spec.rb
201
+ - spec/lib/statistrano/deployment/log_file_spec.rb
202
+ - spec/lib/statistrano/deployment/manifest_spec.rb
203
+ - spec/lib/statistrano/deployment/rake_tasks_spec.rb
204
+ - spec/lib/statistrano/deployment/registerable_spec.rb
205
+ - spec/lib/statistrano/deployment/releaser/revisions_spec.rb
206
+ - spec/lib/statistrano/deployment/releaser/single_spec.rb
207
+ - spec/lib/statistrano/deployment/strategy/base_spec.rb
208
+ - spec/lib/statistrano/deployment/strategy/branches_spec.rb
209
+ - spec/lib/statistrano/deployment/strategy/check_git_spec.rb
210
+ - spec/lib/statistrano/deployment/strategy/invoke_tasks_spec.rb
211
+ - spec/lib/statistrano/deployment/strategy/releases_spec.rb
212
+ - spec/lib/statistrano/deployment/strategy_spec.rb
213
+ - spec/lib/statistrano/deployment_spec.rb
214
+ - spec/lib/statistrano/log/default_logger_spec.rb
215
+ - spec/lib/statistrano/log_spec.rb
216
+ - spec/lib/statistrano/remote/file_spec.rb
217
+ - spec/lib/statistrano/remote_spec.rb
218
+ - spec/lib/statistrano/util/file_permissions_spec.rb
219
+ - spec/lib/statistrano/util_spec.rb
220
+ - spec/lib/statistrano_spec.rb
221
+ - spec/spec_helper.rb
222
+ - spec/support/given.rb
223
+ has_rdoc: