sunshine 1.2.2 → 1.2.3

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.
@@ -558,49 +558,6 @@ class TestApp < Test::Unit::TestCase
558
558
  end
559
559
 
560
560
 
561
- def test_upload_tasks
562
- path = "/path/to/tasks"
563
-
564
- @app.upload_tasks 'common', 'tpkg',
565
- :host => 'some_server.com',
566
- :remote_path => path
567
-
568
- shell = @app.find(:host => 'some_server.com').first.shell
569
-
570
- use_remote_shell shell
571
-
572
- assert_ssh_call "mkdir -p /path/to/tasks"
573
-
574
- %w{common tpkg}.each do |task|
575
- from = "#{Sunshine::ROOT}/templates/tasks/#{task}.rake"
576
- to = "#{shell.host}:#{path}/#{task}.rake"
577
-
578
- assert_rsync from, to
579
- end
580
- end
581
-
582
-
583
- def test_upload_tasks_simple
584
- @app.upload_tasks
585
-
586
- path = "#{@app.checkout_path}/lib/tasks"
587
-
588
- tasks =
589
- Dir.glob("#{Sunshine::ROOT}/templates/tasks/*").map{|t| File.basename t}
590
-
591
- each_remote_shell do |ds|
592
- assert_ssh_call "mkdir -p #{path}"
593
-
594
- tasks.each do |task|
595
- from = "#{Sunshine::ROOT}/templates/tasks/#{task}"
596
- to = "#{ds.host}:#{path}/#{task}"
597
-
598
- assert_rsync from, to
599
- end
600
- end
601
- end
602
-
603
-
604
561
  def test_with_filter
605
562
  app = Sunshine::App.new :repo => {:type => "svn", :url => @svn_url},
606
563
  :remote_shells => ["user@server1.com", "user@server2.com"]
@@ -45,7 +45,7 @@ class TestNginx < Test::Unit::TestCase
45
45
 
46
46
  def test_sudo_cmd
47
47
  ds = @passenger.app.server_apps.first.shell
48
- ds.set_mock_response 0, "gem list passenger -d" => [:out, @gemout]
48
+ ds.set_mock_response 0, "gem list passenger -d" => [:out, ""]
49
49
 
50
50
  @passenger.start
51
51
  @passenger.stop
@@ -174,24 +174,23 @@ class TestServerApp < Test::Unit::TestCase
174
174
 
175
175
 
176
176
  def test_get_deploy_info
177
+ @sa.shell.mock :call, :args => "whoami", :return => "user"
178
+ @sa.shell.mock :call, :args => "date", :return => "now"
179
+
177
180
  test_info = {
178
- :deployed_at => Time.now.to_s,
179
- :deployed_as => @sa.shell.call("whoami"),
181
+ :deployed_at => "now",
182
+ :deployed_as => "user",
180
183
  :deployed_by => Sunshine.shell.user,
181
184
  :deploy_name => File.basename(@app.checkout_path),
182
185
  :name => @sa.name,
183
186
  :env => @sa.shell_env,
184
187
  :roles => @sa.roles,
185
188
  :path => @app.root_path,
189
+ :ports => Hash.new,
186
190
  :sunshine_version => Sunshine::VERSION
187
- }.merge @sa.info
188
-
189
- deploy_info = @sa.get_deploy_info
191
+ }
190
192
 
191
- deploy_info.each do |key, val|
192
- next if key == :deployed_at
193
- assert_equal test_info[key], val
194
- end
193
+ assert_equal test_info, @sa.get_deploy_info
195
194
  end
196
195
 
197
196
 
@@ -270,7 +269,7 @@ class TestServerApp < Test::Unit::TestCase
270
269
 
271
270
  @sa.register_as_deployed
272
271
 
273
- args = [@app.root_path, {'servers' => [@sa.shell]}]
272
+ args = ["#{@app.name}:#{@app.root_path}", {'servers' => [@sa.shell]}]
274
273
  assert Sunshine::AddCommand.method_called?(:exec, :args => args)
275
274
  end
276
275
 
@@ -364,7 +363,7 @@ class TestServerApp < Test::Unit::TestCase
364
363
 
365
364
  def test_not_running?
366
365
  set_mock_response_for @sa, 13,
367
- "#{@sa.root_path}/status" => [:err, "THE SYSTEM IS DOWN!"]
366
+ "#{@sa.scripts_path}/status" => [:err, "THE SYSTEM IS DOWN!"]
368
367
 
369
368
  assert_equal false, @sa.running?
370
369
  end
@@ -372,7 +371,7 @@ class TestServerApp < Test::Unit::TestCase
372
371
 
373
372
  def test_errored_running?
374
373
  set_mock_response_for @sa, 1,
375
- "#{@sa.root_path}/status" => [:err, "KABLAM!"]
374
+ "#{@sa.scripts_path}/status" => [:err, "KABLAM!"]
376
375
 
377
376
  assert_raises Sunshine::CmdError do
378
377
  @sa.running?
@@ -409,73 +408,6 @@ class TestServerApp < Test::Unit::TestCase
409
408
  end
410
409
 
411
410
 
412
- def test_upload_tasks
413
- files = %w{task1 task2}
414
-
415
- @sa.upload_tasks(*files)
416
-
417
- assert_server_call "mkdir -p #{@app.checkout_path}/lib/tasks"
418
-
419
- files.each do |f|
420
- args = ["#{Sunshine::ROOT}/templates/tasks/#{f}.rake",
421
- "#{@app.checkout_path}/lib/tasks/#{f}.rake"]
422
-
423
- assert @sa.shell.method_called?(:upload, :args => args)
424
- end
425
- end
426
-
427
-
428
- def test_upload_tasks_with_remote_path
429
- files = %w{task1 task2}
430
- path = "/path/to/remote/tasks"
431
-
432
- @sa.upload_tasks files[0], files[1], :remote_path => path
433
-
434
- assert_server_call "mkdir -p #{path}"
435
-
436
- files.each do |f|
437
- args = ["#{Sunshine::ROOT}/templates/tasks/#{f}.rake",
438
- "#{path}/#{f}.rake"]
439
-
440
- assert @sa.shell.method_called?(:upload, :args => args)
441
- end
442
- end
443
-
444
-
445
- def test_upload_tasks_with_local_path
446
- files = %w{task1 task2}
447
- path = "/path/to/local/tasks"
448
- args = files.dup << {:local_path => path}
449
-
450
- @sa.upload_tasks(*args)
451
-
452
- assert_server_call "mkdir -p #{@sa.checkout_path}/lib/tasks"
453
-
454
- files.each do |f|
455
- args = ["#{path}/#{f}.rake",
456
- "#{@sa.checkout_path}/lib/tasks/#{f}.rake"]
457
-
458
- assert @sa.shell.method_called?(:upload, :args => args)
459
- end
460
- end
461
-
462
-
463
- def test_upload_tasks_all
464
- files = Dir.glob("templates/tasks/*").map{|f| File.basename(f, ".rake")}
465
-
466
- @sa.upload_tasks
467
-
468
- assert_server_call "mkdir -p #{@app.checkout_path}/lib/tasks"
469
-
470
- files.each do |f|
471
- args = ["#{Sunshine::ROOT}/templates/tasks/#{f}.rake",
472
- "#{@app.checkout_path}/lib/tasks/#{f}.rake"]
473
-
474
- assert @sa.shell.method_called?(:upload, :args => args)
475
- end
476
- end
477
-
478
-
479
411
  def test_upload_codebase
480
412
  @sa.shell.mock(:upload)
481
413
 
@@ -533,16 +465,14 @@ class TestServerApp < Test::Unit::TestCase
533
465
 
534
466
 
535
467
  def test_symlink_scripts_to_root
536
- @sa.shell.mock :call,
537
- :args => ["ls -1 #{@sa.scripts_path}"],
538
- :return => "script_name\n"
539
-
540
- args = ["#{@app.scripts_path}/script_name",
541
- "#{@app.root_path}/script_name"]
542
-
543
468
  @sa.symlink_scripts_to_root
544
469
 
545
- assert @sa.shell.method_called?(:symlink, :args => args)
470
+ @sa.scripts.each do |name, val|
471
+ args = ["#{@app.scripts_path}/#{name}",
472
+ "#{@app.root_path}/#{name}"]
473
+
474
+ assert @sa.shell.method_called?(:symlink, :args => args)
475
+ end
546
476
  end
547
477
 
548
478
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sunshine
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 25
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 2
8
- - 2
9
- version: 1.2.2
9
+ - 3
10
+ version: 1.2.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jeremie Castagna
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-10-13 00:00:00 -07:00
18
+ date: 2011-02-11 00:00:00 -08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -23,8 +24,9 @@ dependencies:
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
24
25
  none: false
25
26
  requirements:
26
- - - ">="
27
+ - - ~>
27
28
  - !ruby/object:Gem::Version
29
+ hash: 21
28
30
  segments:
29
31
  - 1
30
32
  - 0
@@ -38,8 +40,9 @@ dependencies:
38
40
  requirement: &id002 !ruby/object:Gem::Requirement
39
41
  none: false
40
42
  requirements:
41
- - - ">="
43
+ - - ~>
42
44
  - !ruby/object:Gem::Version
45
+ hash: 31
43
46
  segments:
44
47
  - 1
45
48
  - 0
@@ -53,8 +56,9 @@ dependencies:
53
56
  requirement: &id003 !ruby/object:Gem::Requirement
54
57
  none: false
55
58
  requirements:
56
- - - ">="
59
+ - - ~>
57
60
  - !ruby/object:Gem::Version
61
+ hash: 1
58
62
  segments:
59
63
  - 1
60
64
  - 5
@@ -68,8 +72,9 @@ dependencies:
68
72
  requirement: &id004 !ruby/object:Gem::Requirement
69
73
  none: false
70
74
  requirements:
71
- - - ">="
75
+ - - ~>
72
76
  - !ruby/object:Gem::Version
77
+ hash: 31
73
78
  segments:
74
79
  - 1
75
80
  - 2
@@ -78,35 +83,21 @@ dependencies:
78
83
  type: :runtime
79
84
  version_requirements: *id004
80
85
  - !ruby/object:Gem::Dependency
81
- name: rubyforge
86
+ name: hoe
82
87
  prerelease: false
83
88
  requirement: &id005 !ruby/object:Gem::Requirement
84
89
  none: false
85
90
  requirements:
86
91
  - - ">="
87
92
  - !ruby/object:Gem::Version
93
+ hash: 47
88
94
  segments:
89
95
  - 2
96
+ - 8
90
97
  - 0
91
- - 4
92
- version: 2.0.4
98
+ version: 2.8.0
93
99
  type: :development
94
100
  version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: hoe
97
- prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
99
- none: false
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- segments:
104
- - 2
105
- - 6
106
- - 2
107
- version: 2.6.2
108
- type: :development
109
- version_requirements: *id006
110
101
  description: |-
111
102
  Sunshine is a framework for rack and rails application deployment.
112
103
 
@@ -158,7 +149,6 @@ files:
158
149
  - lib/sunshine/dependencies.rb
159
150
  - lib/sunshine/dependency_lib.rb
160
151
  - lib/sunshine/exceptions.rb
161
- - lib/sunshine/healthcheck.rb
162
152
  - lib/sunshine/output.rb
163
153
  - lib/sunshine/package_managers/apt.rb
164
154
  - lib/sunshine/package_managers/dependency.rb
@@ -178,7 +168,6 @@ files:
178
168
  - templates/nginx/nginx_optimize.conf
179
169
  - templates/nginx/nginx_proxy.conf
180
170
  - templates/rainbows/rainbows.conf.erb
181
- - templates/sunshine/middleware/health.rb
182
171
  - templates/sunshine/sunshine.rake
183
172
  - templates/thin/thin.conf.erb
184
173
  - templates/unicorn/unicorn.conf.erb
@@ -193,7 +182,6 @@ files:
193
182
  - test/unit/test_crontab.rb
194
183
  - test/unit/test_daemon.rb
195
184
  - test/unit/test_git_repo.rb
196
- - test/unit/test_healthcheck.rb
197
185
  - test/unit/test_nginx.rb
198
186
  - test/unit/test_rainbows.rb
199
187
  - test/unit/test_remote_shell.rb
@@ -220,7 +208,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
220
208
  requirements:
221
209
  - - ">="
222
210
  - !ruby/object:Gem::Version
223
- hash: 3148348221185696029
211
+ hash: 3
224
212
  segments:
225
213
  - 0
226
214
  version: "0"
@@ -229,13 +217,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
217
  requirements:
230
218
  - - ">="
231
219
  - !ruby/object:Gem::Version
220
+ hash: 3
232
221
  segments:
233
222
  - 0
234
223
  version: "0"
235
224
  requirements: []
236
225
 
237
226
  rubyforge_project: sunshine
238
- rubygems_version: 1.3.7
227
+ rubygems_version: 1.5.2
239
228
  signing_key:
240
229
  specification_version: 3
241
230
  summary: Sunshine is a framework for rack and rails application deployment
@@ -246,7 +235,6 @@ test_files:
246
235
  - test/unit/test_crontab.rb
247
236
  - test/unit/test_daemon.rb
248
237
  - test/unit/test_git_repo.rb
249
- - test/unit/test_healthcheck.rb
250
238
  - test/unit/test_nginx.rb
251
239
  - test/unit/test_rainbows.rb
252
240
  - test/unit/test_remote_shell.rb
@@ -1,98 +0,0 @@
1
- module Sunshine
2
-
3
- ##
4
- # Healthcheck objects handle enabling and disabling health checking for
5
- # load balancers by touching health.enabled and health.disabled files on
6
- # an app's shell.
7
- #
8
- # If you would like to use Sunshine's healthcheck rack middleware, use
9
- # the following command:
10
- # sunshine --middleware your_middleware_dir
11
- #
12
- # Then simply specify the following in your config.ru:
13
- # require 'your_middleware_dir/health'
14
- # use Sunshine::Health
15
- #
16
- # Sunshine::Health supports the following options:
17
- # :uri_path:: The path that healthcheck will be used on.
18
- # :health_file:: The file to check for health.
19
- #
20
- # use Sunshine::Health, :uri_path => "/health.txt",
21
- # :health_file => "health.txt"
22
-
23
- class Healthcheck
24
-
25
- ENABLED_FILE = "health.enabled"
26
- DISABLED_FILE = "health.disabled"
27
-
28
- attr_accessor :shell, :enabled_file, :disabled_file
29
-
30
- def initialize path, shell
31
- @shell = shell
32
- @enabled_file = File.join path, ENABLED_FILE
33
- @disabled_file = File.join path, DISABLED_FILE
34
- end
35
-
36
-
37
- ##
38
- # Disables healthcheck - status: :disabled
39
-
40
- def disable
41
- @shell.call "touch #{@disabled_file} && rm -f #{@enabled_file}"
42
- end
43
-
44
-
45
- ##
46
- # Check if healthcheck is disabled.
47
-
48
- def disabled?
49
- @shell.file? @disabled_file
50
- end
51
-
52
-
53
- ##
54
- # Check if healthcheck is down.
55
-
56
- def down?
57
- !@shell.file?(@disabled_file) && !@shell.file?(@enabled_file)
58
- end
59
-
60
-
61
- ##
62
- # Enables healthcheck which should set status to :ok
63
-
64
- def enable
65
- @shell.call "rm -f #{@disabled_file} && touch #{@enabled_file}"
66
- end
67
-
68
-
69
- ##
70
- # Check if healthcheck is enabled.
71
-
72
- def enabled?
73
- @shell.file? @enabled_file
74
- end
75
-
76
-
77
- ##
78
- # Remove the healthcheck file - status: :down
79
-
80
- def remove
81
- @shell.call "rm -f #{@disabled_file} #{@enabled_file}"
82
- end
83
-
84
-
85
- ##
86
- # Get the health status from the shell.
87
- # Returns one of three states:
88
- # :enabled: everything is great
89
- # :disabled: healthcheck was explicitely turned off
90
- # :down: um, something is wrong
91
-
92
- def status
93
- return :disabled if disabled?
94
- return :enabled if enabled?
95
- :down
96
- end
97
- end
98
- end