sunshine 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/History.txt +237 -0
  2. data/Manifest.txt +70 -0
  3. data/README.txt +277 -0
  4. data/Rakefile +46 -0
  5. data/bin/sunshine +5 -0
  6. data/examples/deploy.rb +61 -0
  7. data/examples/deploy_tasks.rake +112 -0
  8. data/examples/standalone_deploy.rb +31 -0
  9. data/lib/commands/add.rb +96 -0
  10. data/lib/commands/default.rb +169 -0
  11. data/lib/commands/list.rb +322 -0
  12. data/lib/commands/restart.rb +62 -0
  13. data/lib/commands/rm.rb +83 -0
  14. data/lib/commands/run.rb +151 -0
  15. data/lib/commands/start.rb +72 -0
  16. data/lib/commands/stop.rb +61 -0
  17. data/lib/sunshine/app.rb +876 -0
  18. data/lib/sunshine/binder.rb +70 -0
  19. data/lib/sunshine/crontab.rb +143 -0
  20. data/lib/sunshine/daemon.rb +380 -0
  21. data/lib/sunshine/daemons/ar_sendmail.rb +28 -0
  22. data/lib/sunshine/daemons/delayed_job.rb +30 -0
  23. data/lib/sunshine/daemons/nginx.rb +104 -0
  24. data/lib/sunshine/daemons/rainbows.rb +35 -0
  25. data/lib/sunshine/daemons/server.rb +66 -0
  26. data/lib/sunshine/daemons/unicorn.rb +26 -0
  27. data/lib/sunshine/dependencies.rb +103 -0
  28. data/lib/sunshine/dependency_lib.rb +200 -0
  29. data/lib/sunshine/exceptions.rb +54 -0
  30. data/lib/sunshine/healthcheck.rb +83 -0
  31. data/lib/sunshine/output.rb +131 -0
  32. data/lib/sunshine/package_managers/apt.rb +48 -0
  33. data/lib/sunshine/package_managers/dependency.rb +349 -0
  34. data/lib/sunshine/package_managers/gem.rb +54 -0
  35. data/lib/sunshine/package_managers/yum.rb +62 -0
  36. data/lib/sunshine/remote_shell.rb +241 -0
  37. data/lib/sunshine/repo.rb +128 -0
  38. data/lib/sunshine/repos/git_repo.rb +122 -0
  39. data/lib/sunshine/repos/rsync_repo.rb +29 -0
  40. data/lib/sunshine/repos/svn_repo.rb +78 -0
  41. data/lib/sunshine/server_app.rb +554 -0
  42. data/lib/sunshine/shell.rb +384 -0
  43. data/lib/sunshine.rb +391 -0
  44. data/templates/logrotate/logrotate.conf.erb +11 -0
  45. data/templates/nginx/nginx.conf.erb +109 -0
  46. data/templates/nginx/nginx_optimize.conf +23 -0
  47. data/templates/nginx/nginx_proxy.conf +13 -0
  48. data/templates/rainbows/rainbows.conf.erb +18 -0
  49. data/templates/tasks/sunshine.rake +114 -0
  50. data/templates/unicorn/unicorn.conf.erb +6 -0
  51. data/test/fixtures/app_configs/test_app.yml +11 -0
  52. data/test/fixtures/sunshine_test/test_upload +0 -0
  53. data/test/mocks/mock_object.rb +179 -0
  54. data/test/mocks/mock_open4.rb +117 -0
  55. data/test/test_helper.rb +188 -0
  56. data/test/unit/test_app.rb +489 -0
  57. data/test/unit/test_binder.rb +20 -0
  58. data/test/unit/test_crontab.rb +128 -0
  59. data/test/unit/test_git_repo.rb +26 -0
  60. data/test/unit/test_healthcheck.rb +70 -0
  61. data/test/unit/test_nginx.rb +107 -0
  62. data/test/unit/test_rainbows.rb +26 -0
  63. data/test/unit/test_remote_shell.rb +102 -0
  64. data/test/unit/test_repo.rb +42 -0
  65. data/test/unit/test_server.rb +324 -0
  66. data/test/unit/test_server_app.rb +425 -0
  67. data/test/unit/test_shell.rb +97 -0
  68. data/test/unit/test_sunshine.rb +157 -0
  69. data/test/unit/test_svn_repo.rb +55 -0
  70. data/test/unit/test_unicorn.rb +22 -0
  71. metadata +217 -0
@@ -0,0 +1,55 @@
1
+ require 'test/test_helper'
2
+
3
+ class TestSvnRepo < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @svn = Sunshine::SvnRepo.new("svn://someurl/proj_name/somebranch")
7
+ @ds = mock_remote_shell
8
+ mock_svn_response @svn.url
9
+ end
10
+
11
+ def test_get_repo_info
12
+ info = @svn.get_repo_info "path/to/checkout", @ds
13
+
14
+ assert_equal "777", info[:revision]
15
+ assert_equal "user", info[:committer]
16
+ assert_equal "somebranch", info[:branch]
17
+
18
+ assert_equal "finished testing server.rb", info[:message]
19
+
20
+ date = Time.parse "2010-01-26T01:49:17.372152Z"
21
+ assert_equal date, info[:date]
22
+ end
23
+
24
+ def test_checkout_to
25
+ path = "/test/checkout/path"
26
+
27
+ @svn.checkout_to path, @ds
28
+
29
+ assert_ssh_call "test -d #{path} && rm -rf #{path} || echo false"
30
+ assert_ssh_call "mkdir -p #{path}"
31
+ assert_ssh_call "svn checkout #{@svn.scm_flags} #{@svn.url} #{path}"
32
+ end
33
+
34
+
35
+ def test_name
36
+ svn = Sunshine::SvnRepo.new "svn://myrepo/project/trunk"
37
+ assert_equal "project", svn.name
38
+
39
+ svn = Sunshine::SvnRepo.new "svn://myrepo/project/branches/blah"
40
+ assert_equal "project", svn.name
41
+
42
+ svn = Sunshine::SvnRepo.new "svn://myrepo/project/tags/blah"
43
+ assert_equal "project", svn.name
44
+ end
45
+
46
+
47
+ def test_invalid_name
48
+ svn = Sunshine::SvnRepo.new "svn://myrepo/project"
49
+ svn.name
50
+ raise "SvnRepo didn't catch invalid naming scheme: #{svn.url}"
51
+ rescue => e
52
+ assert_equal "Svn url must match #{Sunshine::SvnRepo::NAME_MATCH.inspect}",
53
+ e.message
54
+ end
55
+ end
@@ -0,0 +1,22 @@
1
+ require 'test/test_helper'
2
+
3
+ class TestUnicorn < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @app = Sunshine::App.new TEST_APP_CONFIG_FILE
7
+ @server = Sunshine::Unicorn.new @app
8
+ end
9
+
10
+ def test_start_cmd
11
+ cmd = "cd #{@app.current_path} && #{@server.bin} -D -E"+
12
+ " #{@app.deploy_env} -p #{@server.port} -c #{@server.config_file_path};"
13
+
14
+ assert_equal cmd, @server.start_cmd
15
+ end
16
+
17
+ def test_stop_cmd
18
+ cmd = "test -f #{@server.pid} && kill -QUIT $(cat #{@server.pid})"+
19
+ " || echo 'No #{@server.name} process to stop for #{@app.name}';"+
20
+ "sleep 2; rm -f #{@server.pid};"
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,217 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sunshine
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: true
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ - pre
10
+ version: 1.0.0.pre
11
+ platform: ruby
12
+ authors:
13
+ - Jeremie Castagna
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-03-23 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: open4
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 0
31
+ - 1
32
+ version: 1.0.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rainbow
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 1
44
+ - 0
45
+ - 4
46
+ version: 1.0.4
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: highline
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ segments:
57
+ - 1
58
+ - 5
59
+ - 1
60
+ version: 1.5.1
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: hoe
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ segments:
71
+ - 2
72
+ - 3
73
+ - 3
74
+ version: 2.3.3
75
+ type: :development
76
+ version_requirements: *id004
77
+ description: |-
78
+ Sunshine is an object-oriented api for rack application deployment.
79
+
80
+ Sunshine is open and it can do a lot! It's meant to be dug into and understood.
81
+ Knowing how it works will let you do really neat things: classes are
82
+ decoupled as much as possible to allow for optimal flexibility,
83
+ and most can be used independently.
84
+
85
+ This gem was made possible by the sponsoring of AT&T Interactive
86
+ (http://attinteractive.com).
87
+ email:
88
+ - jcastagna@attinteractive.com
89
+ executables:
90
+ - sunshine
91
+ extensions: []
92
+
93
+ extra_rdoc_files:
94
+ - History.txt
95
+ - Manifest.txt
96
+ - README.txt
97
+ files:
98
+ - History.txt
99
+ - Manifest.txt
100
+ - README.txt
101
+ - Rakefile
102
+ - bin/sunshine
103
+ - examples/deploy.rb
104
+ - examples/deploy_tasks.rake
105
+ - examples/standalone_deploy.rb
106
+ - lib/commands/add.rb
107
+ - lib/commands/default.rb
108
+ - lib/commands/list.rb
109
+ - lib/commands/restart.rb
110
+ - lib/commands/rm.rb
111
+ - lib/commands/run.rb
112
+ - lib/commands/start.rb
113
+ - lib/commands/stop.rb
114
+ - lib/sunshine.rb
115
+ - lib/sunshine/app.rb
116
+ - lib/sunshine/binder.rb
117
+ - lib/sunshine/crontab.rb
118
+ - lib/sunshine/daemon.rb
119
+ - lib/sunshine/daemons/ar_sendmail.rb
120
+ - lib/sunshine/daemons/delayed_job.rb
121
+ - lib/sunshine/daemons/nginx.rb
122
+ - lib/sunshine/daemons/rainbows.rb
123
+ - lib/sunshine/daemons/server.rb
124
+ - lib/sunshine/daemons/unicorn.rb
125
+ - lib/sunshine/dependencies.rb
126
+ - lib/sunshine/dependency_lib.rb
127
+ - lib/sunshine/exceptions.rb
128
+ - lib/sunshine/healthcheck.rb
129
+ - lib/sunshine/output.rb
130
+ - lib/sunshine/package_managers/apt.rb
131
+ - lib/sunshine/package_managers/dependency.rb
132
+ - lib/sunshine/package_managers/gem.rb
133
+ - lib/sunshine/package_managers/yum.rb
134
+ - lib/sunshine/remote_shell.rb
135
+ - lib/sunshine/repo.rb
136
+ - lib/sunshine/repos/git_repo.rb
137
+ - lib/sunshine/repos/rsync_repo.rb
138
+ - lib/sunshine/repos/svn_repo.rb
139
+ - lib/sunshine/server_app.rb
140
+ - lib/sunshine/shell.rb
141
+ - templates/logrotate/logrotate.conf.erb
142
+ - templates/nginx/nginx.conf.erb
143
+ - templates/nginx/nginx_optimize.conf
144
+ - templates/nginx/nginx_proxy.conf
145
+ - templates/rainbows/rainbows.conf.erb
146
+ - templates/tasks/sunshine.rake
147
+ - templates/unicorn/unicorn.conf.erb
148
+ - test/fixtures/app_configs/test_app.yml
149
+ - test/fixtures/sunshine_test/test_upload
150
+ - test/mocks/mock_object.rb
151
+ - test/mocks/mock_open4.rb
152
+ - test/test_helper.rb
153
+ - test/unit/test_app.rb
154
+ - test/unit/test_binder.rb
155
+ - test/unit/test_crontab.rb
156
+ - test/unit/test_git_repo.rb
157
+ - test/unit/test_healthcheck.rb
158
+ - test/unit/test_nginx.rb
159
+ - test/unit/test_rainbows.rb
160
+ - test/unit/test_remote_shell.rb
161
+ - test/unit/test_repo.rb
162
+ - test/unit/test_server.rb
163
+ - test/unit/test_server_app.rb
164
+ - test/unit/test_shell.rb
165
+ - test/unit/test_sunshine.rb
166
+ - test/unit/test_svn_repo.rb
167
+ - test/unit/test_unicorn.rb
168
+ has_rdoc: true
169
+ homepage: http://betalabs.yellowpages.com/
170
+ licenses: []
171
+
172
+ post_install_message:
173
+ rdoc_options:
174
+ - --main
175
+ - README.txt
176
+ require_paths:
177
+ - lib
178
+ required_ruby_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ segments:
183
+ - 0
184
+ version: "0"
185
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">"
188
+ - !ruby/object:Gem::Version
189
+ segments:
190
+ - 1
191
+ - 3
192
+ - 1
193
+ version: 1.3.1
194
+ requirements: []
195
+
196
+ rubyforge_project: sunshine
197
+ rubygems_version: 1.3.6
198
+ signing_key:
199
+ specification_version: 3
200
+ summary: Sunshine is an object-oriented api for rack application deployment
201
+ test_files:
202
+ - test/test_helper.rb
203
+ - test/unit/test_app.rb
204
+ - test/unit/test_binder.rb
205
+ - test/unit/test_crontab.rb
206
+ - test/unit/test_git_repo.rb
207
+ - test/unit/test_healthcheck.rb
208
+ - test/unit/test_nginx.rb
209
+ - test/unit/test_rainbows.rb
210
+ - test/unit/test_remote_shell.rb
211
+ - test/unit/test_repo.rb
212
+ - test/unit/test_server.rb
213
+ - test/unit/test_server_app.rb
214
+ - test/unit/test_shell.rb
215
+ - test/unit/test_sunshine.rb
216
+ - test/unit/test_svn_repo.rb
217
+ - test/unit/test_unicorn.rb