capper 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capper (0.2.1)
4
+ capper (0.2.2)
5
5
  capistrano
6
6
  capistrano_colors
7
7
  erubis
data/capper.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "capper"
3
- s.version = "0.2.1"
3
+ s.version = "0.2.2"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.licenses = ["MIT"]
6
6
  s.authors = ["Benedikt Böhm"]
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Use at least one worker per core if you're on a dedicated server,
8
8
  # more will usually help for _short_ waits on databases/caches.
9
- worker_processes <%= unicorn_worker_processes %>
9
+ worker_processes <%= worker_processes %>
10
10
 
11
11
  # Help ensure your application will always spawn in the symlinked
12
12
  # "current" directory that Capistrano sets up.
@@ -37,9 +37,9 @@ Capper.load do
37
37
  desc "Generate unicorn configuration files"
38
38
  task :setup, :roles => :app, :except => { :no_release => true } do
39
39
  upload_template("unicorn.rb", unicorn_config,
40
- :mode => "0644")
40
+ :mode => "0644", :prefix => "unicorn")
41
41
  upload_template("unicorn.sh", unicorn_script,
42
- :mode => "0755")
42
+ :mode => "0755", :prefix => "unicorn")
43
43
  end
44
44
 
45
45
  desc "Kill unicorn (this should only be used if all else fails)"
@@ -15,6 +15,7 @@ class Capper
15
15
  end
16
16
 
17
17
  erb = Erubis::Eruby.new(File.open(template).read)
18
+ prefix = options.delete(:prefix)
18
19
 
19
20
  if task = current_task
20
21
  servers = find_servers_for_task(task, options)
@@ -27,7 +28,7 @@ class Capper
27
28
  end
28
29
 
29
30
  servers.each do |server|
30
- result = erb.result(get_binding(server.host))
31
+ result = erb.result(get_binding(prefix, server.host))
31
32
  put(result, path, options.merge!(:host => server.host))
32
33
  end
33
34
  end
@@ -38,10 +39,12 @@ class Capper
38
39
  # "app1.example.com" => 4,
39
40
  # "app2.example.com" => 8,
40
41
  # }
41
- def get_binding(server)
42
+ def get_binding(prefix, server)
42
43
  b = binding()
43
44
 
44
- variables.keys.each do |k|
45
+ variables.keys.select do |k|
46
+ k =~ /^#{prefix}_/
47
+ end.each do |k|
45
48
  v = fetch(k)
46
49
 
47
50
  if v.kind_of?(Hash)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-07-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubis
16
- requirement: &11915860 !ruby/object:Gem::Requirement
16
+ requirement: &16425020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *11915860
24
+ version_requirements: *16425020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: capistrano
27
- requirement: &11915420 !ruby/object:Gem::Requirement
27
+ requirement: &16424580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *11915420
35
+ version_requirements: *16424580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: capistrano_colors
38
- requirement: &11915000 !ruby/object:Gem::Requirement
38
+ requirement: &16424160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *11915000
46
+ version_requirements: *16424160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &11914500 !ruby/object:Gem::Requirement
49
+ requirement: &16423660 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *11914500
57
+ version_requirements: *16423660
58
58
  description: Capistrano is a collection of opinionated Capistrano recipes
59
59
  email:
60
60
  - bb@xnull.de