deployml 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.document +3 -0
  2. data/.rspec +1 -0
  3. data/.yardopts +1 -0
  4. data/ChangeLog.md +22 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +107 -0
  7. data/Rakefile +35 -0
  8. data/bin/deployml +5 -0
  9. data/deployml.gemspec +10 -0
  10. data/gemspec.yml +21 -0
  11. data/lib/deployml/cli.rb +192 -0
  12. data/lib/deployml/configuration.rb +149 -0
  13. data/lib/deployml/environment.rb +273 -0
  14. data/lib/deployml/exceptions/config_not_found.rb +4 -0
  15. data/lib/deployml/exceptions/invalid_config.rb +4 -0
  16. data/lib/deployml/exceptions/missing_option.rb +6 -0
  17. data/lib/deployml/exceptions/unknown_environment.rb +4 -0
  18. data/lib/deployml/exceptions/unknown_framework.rb +6 -0
  19. data/lib/deployml/exceptions/unknown_server.rb +6 -0
  20. data/lib/deployml/frameworks/rails2.rb +9 -0
  21. data/lib/deployml/frameworks/rails3.rb +20 -0
  22. data/lib/deployml/frameworks.rb +2 -0
  23. data/lib/deployml/local_shell.rb +54 -0
  24. data/lib/deployml/options/mongrel.rb +46 -0
  25. data/lib/deployml/options/thin.rb +72 -0
  26. data/lib/deployml/options.rb +1 -0
  27. data/lib/deployml/project.rb +304 -0
  28. data/lib/deployml/remote_shell.rb +130 -0
  29. data/lib/deployml/servers/apache.rb +19 -0
  30. data/lib/deployml/servers/mongrel.rb +41 -0
  31. data/lib/deployml/servers/thin.rb +41 -0
  32. data/lib/deployml/servers.rb +3 -0
  33. data/lib/deployml/shell.rb +46 -0
  34. data/lib/deployml/version.rb +4 -0
  35. data/lib/deployml.rb +2 -0
  36. data/spec/configuration_spec.rb +73 -0
  37. data/spec/deployml_spec.rb +11 -0
  38. data/spec/environment_spec.rb +34 -0
  39. data/spec/helpers/projects/bad_config/config/deploy.yml +1 -0
  40. data/spec/helpers/projects/basic/config/deploy.yml +3 -0
  41. data/spec/helpers/projects/invalid_server/config/deploy.yml +4 -0
  42. data/spec/helpers/projects/missing_config/.gitkeep +0 -0
  43. data/spec/helpers/projects/missing_dest/config/deploy.yml +2 -0
  44. data/spec/helpers/projects/missing_source/config/deploy.yml +2 -0
  45. data/spec/helpers/projects/rails/config/deploy/production.yml +10 -0
  46. data/spec/helpers/projects/rails/config/deploy/staging.yml +10 -0
  47. data/spec/helpers/projects/rails/config/deploy.yml +3 -0
  48. data/spec/helpers/projects.rb +11 -0
  49. data/spec/project_spec.rb +66 -0
  50. data/spec/spec_helper.rb +8 -0
  51. metadata +207 -0
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ require 'deployml/project'
4
+
5
+ describe Environment do
6
+ let(:name) { :staging }
7
+ subject do
8
+ Environment.new(name, {
9
+ 'source' => 'git@github.com:user/project.git',
10
+ 'dest' => 'ssh://user@www.example.com/srv/project',
11
+ 'framework' => 'rails3',
12
+ 'orm' => 'datamapper',
13
+ 'server' => {
14
+ 'name' => 'thin',
15
+ 'options' => {
16
+ 'config' => '/etc/thin/project.yml',
17
+ 'socket' => '/tmp/thin.project.sock'
18
+ }
19
+ }
20
+ })
21
+ end
22
+
23
+ it "should default 'environment' to the name of the environment" do
24
+ subject.environment.should == name
25
+ end
26
+
27
+ it "should include the framework mixin" do
28
+ subject.should be_kind_of(Frameworks::Rails3)
29
+ end
30
+
31
+ it "should include the server mixin" do
32
+ subject.should be_kind_of(Servers::Thin)
33
+ end
34
+ end
@@ -0,0 +1 @@
1
+ not YAML
@@ -0,0 +1,3 @@
1
+ scm: git
2
+ source: git@dev.example.com/var/git/project1.git
3
+ dest: deploy@dev.example.com/var/www/project1
@@ -0,0 +1,4 @@
1
+ scm: git
2
+ source: git@example.com
3
+ dest: deploy@example.com
4
+ server: yet_another_async_web_server
File without changes
@@ -0,0 +1,2 @@
1
+ scm: future_scm
2
+ source: user@example.com
@@ -0,0 +1,2 @@
1
+ scm: future_scm
2
+ dest: deploy@example.com
@@ -0,0 +1,10 @@
1
+ dest:
2
+ scheme: ssh
3
+ user: deploy
4
+ host: www.example.com
5
+ path: /srv/project
6
+ server:
7
+ name: thin
8
+ options:
9
+ config: /etc/thin/example.yml
10
+ socket: /tmp/thin.example.sock
@@ -0,0 +1,10 @@
1
+ dest:
2
+ scheme: ssh
3
+ user: deploy
4
+ host: www.example.com
5
+ path: /srv/staging
6
+ server:
7
+ name: thin
8
+ options:
9
+ config: /etc/thin/staging.yml
10
+ socket: /tmp/thin.staging.sock
@@ -0,0 +1,3 @@
1
+ source: git@github.com:user/project.git
2
+ framework: rails3
3
+ orm: datamapper
@@ -0,0 +1,11 @@
1
+ require 'yaml'
2
+
3
+ module Helpers
4
+ module Projects
5
+ PROJECTS_DIR = File.join(File.dirname(__FILE__),'projects')
6
+
7
+ def project_dir(name)
8
+ File.join(PROJECTS_DIR,name.to_s)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,66 @@
1
+ require 'spec_helper'
2
+ require 'helpers/projects'
3
+
4
+ require 'deployml/project'
5
+
6
+ describe Project do
7
+ include Helpers::Projects
8
+
9
+ describe "new" do
10
+ it "should find deploy.yml in the 'config/' directory" do
11
+ lambda {
12
+ Project.new(project_dir(:basic))
13
+ }.should_not raise_error
14
+ end
15
+
16
+ it "should raise ConfigNotFound when deploy.yml cannot be found" do
17
+ lambda {
18
+ Project.new(project_dir(:missing_config))
19
+ }.should raise_error(ConfigNotFound)
20
+ end
21
+
22
+ it "should raise InvalidConfig when deploy.yml does not contain a Hash" do
23
+ lambda {
24
+ Project.new(project_dir(:bad_config))
25
+ }.should raise_error(InvalidConfig)
26
+ end
27
+
28
+ it "should raise InvalidConfig if :source is missing" do
29
+ lambda {
30
+ Project.new(project_dir(:missing_source))
31
+ }.should raise_error(InvalidConfig)
32
+ end
33
+
34
+ it "should raise InvalidConfig if :dest is missing" do
35
+ lambda {
36
+ Project.new(project_dir(:missing_dest))
37
+ }.should raise_error(InvalidConfig)
38
+ end
39
+
40
+ it "should raise InvalidConfig if :server is unknown" do
41
+ lambda {
42
+ Project.new(project_dir(:invalid_server))
43
+ }.should raise_error(InvalidConfig)
44
+ end
45
+
46
+ it "should load the :production environment if thats the only env" do
47
+ project = Project.new(project_dir(:basic))
48
+
49
+ project.environments.keys.should == [:production]
50
+ end
51
+
52
+ it "should load multiple environments" do
53
+ project = Project.new(project_dir(:rails))
54
+
55
+ project.environments.keys.should =~ [:production, :staging]
56
+ end
57
+
58
+ it "should load the base config into multiple environments" do
59
+ project = Project.new(project_dir(:rails))
60
+
61
+ project.environments.all? { |name,env|
62
+ env.framework == :rails3 && env.orm == :datamapper
63
+ }.should == true
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+
3
+ gem 'rspec', '~> 2.1.0'
4
+ require 'rspec'
5
+
6
+ require 'deployml/version'
7
+
8
+ include DeploYML
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: deployml
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
+ platform: ruby
11
+ authors:
12
+ - Postmodern
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-21 00:00:00 -08:00
18
+ default_executable: deployml
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: addressable
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 1
31
+ - 1
32
+ version: 2.1.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rprogram
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 0
45
+ - 2
46
+ - 0
47
+ version: 0.2.0
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: thor
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 0
60
+ - 14
61
+ - 3
62
+ version: 0.14.3
63
+ type: :runtime
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: ore-tasks
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 0
75
+ - 3
76
+ - 0
77
+ version: 0.3.0
78
+ type: :development
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: rspec
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 2
90
+ - 1
91
+ - 0
92
+ version: 2.1.0
93
+ type: :development
94
+ version_requirements: *id005
95
+ - !ruby/object:Gem::Dependency
96
+ name: yard
97
+ prerelease: false
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ segments:
104
+ - 0
105
+ - 6
106
+ - 0
107
+ version: 0.6.0
108
+ type: :development
109
+ version_requirements: *id006
110
+ description: DeploYML is a simple deployment solution that uses a single YAML file, Git and SSH.
111
+ email: postmodern.mod3@gmail.com
112
+ executables:
113
+ - deployml
114
+ extensions: []
115
+
116
+ extra_rdoc_files:
117
+ - README.md
118
+ - LICENSE.txt
119
+ - ChangeLog.md
120
+ files:
121
+ - .document
122
+ - .rspec
123
+ - .yardopts
124
+ - ChangeLog.md
125
+ - LICENSE.txt
126
+ - README.md
127
+ - Rakefile
128
+ - bin/deployml
129
+ - deployml.gemspec
130
+ - gemspec.yml
131
+ - lib/deployml.rb
132
+ - lib/deployml/cli.rb
133
+ - lib/deployml/configuration.rb
134
+ - lib/deployml/environment.rb
135
+ - lib/deployml/exceptions/config_not_found.rb
136
+ - lib/deployml/exceptions/invalid_config.rb
137
+ - lib/deployml/exceptions/missing_option.rb
138
+ - lib/deployml/exceptions/unknown_environment.rb
139
+ - lib/deployml/exceptions/unknown_framework.rb
140
+ - lib/deployml/exceptions/unknown_server.rb
141
+ - lib/deployml/frameworks.rb
142
+ - lib/deployml/frameworks/rails2.rb
143
+ - lib/deployml/frameworks/rails3.rb
144
+ - lib/deployml/local_shell.rb
145
+ - lib/deployml/options.rb
146
+ - lib/deployml/options/mongrel.rb
147
+ - lib/deployml/options/thin.rb
148
+ - lib/deployml/project.rb
149
+ - lib/deployml/remote_shell.rb
150
+ - lib/deployml/servers.rb
151
+ - lib/deployml/servers/apache.rb
152
+ - lib/deployml/servers/mongrel.rb
153
+ - lib/deployml/servers/thin.rb
154
+ - lib/deployml/shell.rb
155
+ - lib/deployml/version.rb
156
+ - spec/configuration_spec.rb
157
+ - spec/deployml_spec.rb
158
+ - spec/environment_spec.rb
159
+ - spec/helpers/projects.rb
160
+ - spec/helpers/projects/bad_config/config/deploy.yml
161
+ - spec/helpers/projects/basic/config/deploy.yml
162
+ - spec/helpers/projects/invalid_server/config/deploy.yml
163
+ - spec/helpers/projects/missing_config/.gitkeep
164
+ - spec/helpers/projects/missing_dest/config/deploy.yml
165
+ - spec/helpers/projects/missing_source/config/deploy.yml
166
+ - spec/helpers/projects/rails/config/deploy.yml
167
+ - spec/helpers/projects/rails/config/deploy/production.yml
168
+ - spec/helpers/projects/rails/config/deploy/staging.yml
169
+ - spec/project_spec.rb
170
+ - spec/spec_helper.rb
171
+ has_rdoc: yard
172
+ homepage: http://github.com/postmodern/deployml
173
+ licenses:
174
+ - MIT
175
+ post_install_message:
176
+ rdoc_options: []
177
+
178
+ require_paths:
179
+ - lib
180
+ required_ruby_version: !ruby/object:Gem::Requirement
181
+ none: false
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ segments:
186
+ - 0
187
+ version: "0"
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
+ none: false
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ segments:
194
+ - 0
195
+ version: "0"
196
+ requirements: []
197
+
198
+ rubyforge_project: deployml
199
+ rubygems_version: 1.3.7
200
+ signing_key:
201
+ specification_version: 3
202
+ summary: A simple deployment solution that works.
203
+ test_files:
204
+ - spec/project_spec.rb
205
+ - spec/environment_spec.rb
206
+ - spec/configuration_spec.rb
207
+ - spec/deployml_spec.rb