marcosgz-cap-recipe 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -94,7 +94,6 @@ set :settler_setup_settings, {
94
94
  typecast: 'password'
95
95
  }
96
96
  }
97
-
98
97
  ```
99
98
 
100
99
  ### Shards
@@ -128,3 +127,24 @@ set :uploader_setup_settings, {
128
127
  }
129
128
  }
130
129
  ```
130
+
131
+ ### Sunspot
132
+ ```ruby
133
+ set :sunspot_setup_settings, {
134
+ common: {
135
+ solr: {
136
+ path: '/solr/foo'
137
+ }
138
+ },
139
+ development: {
140
+ log_level: 'INFO'
141
+ }
142
+ }
143
+ ```
144
+
145
+ ### Resque
146
+ ```ruby
147
+ set :resque_setup_settings, {
148
+ 'production' => 'example.com:6379'
149
+ }
150
+ ```
@@ -25,7 +25,7 @@ Capistrano::Configuration.instance(:must_exist).load do
25
25
 
26
26
  task :application_server, :roles => :app do
27
27
  # App Server
28
- case fetch(:app_server, nil).to_s
28
+ case fetch(:app_server_name, nil).to_s
29
29
  when 'passenger'
30
30
  passenger.setup
31
31
  when 'unicorn'
@@ -34,7 +34,7 @@ Capistrano::Configuration.instance(:must_exist).load do
34
34
  when 'thin'
35
35
  thin.setup
36
36
  else
37
- puts "WARNING: set :app_server with (passenger, unicorn or thin) to automatically run the <server>:setup task"
37
+ puts "WARNING: set :app_server_name with (passenger, unicorn or thin) to automatically run the <server>:setup task"
38
38
  end
39
39
  end
40
40
  end
@@ -0,0 +1,43 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ namespace :resque do
3
+ namespace :setup do
4
+ desc "Upload configs"
5
+ task :default, :roles => :app do
6
+ if exists?(:resque_setup_settings)
7
+ set(:recipe_settings) { resque_template_settings }
8
+ put template.render(_resque_template), _resque_remote_file
9
+ else
10
+ puts "[FATAL] - Resque template settings were not found"
11
+ abort
12
+ end
13
+ end
14
+
15
+ desc "Download configs"
16
+ task :get, :roles => :db do
17
+ download _resque_remote_file, _resque_local_file
18
+ end
19
+ end
20
+ end
21
+
22
+ def resque_setup_defaults
23
+ HashWithIndifferentAccess.new(default_rails_environments.inject({}){|r, v|
24
+ r.merge Hash[v, 'localhost:6379']
25
+ })
26
+ end
27
+
28
+ def resque_template_settings
29
+ DeepToHash.to_hash resque_setup_defaults.deep_merge(fetch(:resque_setup_settings, {}))
30
+ end
31
+
32
+ def _resque_remote_file
33
+ File.join(shared_path, fetch(:resque_remote_file, 'config/resque.yml'))
34
+ end
35
+
36
+ def _resque_local_file
37
+ File.join(local_rails_root, fetch(:resque_local_file, 'config/resque.yml'))
38
+ end
39
+
40
+ def _resque_template
41
+ fetch(:resque_template, 'resque.yml.erb')
42
+ end
43
+ end
@@ -5,10 +5,10 @@ Capistrano::Configuration.instance(:must_exist).load do
5
5
  task :default, :roles => :app do
6
6
  if exists?(:shards_setup_settings)
7
7
  set(:recipe_settings) do
8
- HashWithIndifferentAccess.new({
8
+ {
9
9
  'main' => database_template_settings,
10
10
  'shards' => shards_template_settings
11
- })
11
+ }
12
12
  end
13
13
  put template.render(_shards_template), _shards_remote_path
14
14
  else
@@ -0,0 +1,49 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ namespace :sunspot do
3
+ namespace :setup do
4
+ desc "Upload configs"
5
+ task :default, :roles => :app do
6
+ if exists?(:sunspot_setup_settings)
7
+ set(:recipe_settings) { sunspot_template_settings }
8
+ put template.render(_sunspot_template), _sunspot_remote_file
9
+ else
10
+ puts "[FATAL] - Sunspot template settings were not found"
11
+ abort
12
+ end
13
+ end
14
+
15
+ desc "Download configs"
16
+ task :get, :roles => :db do
17
+ download _sunspot_remote_file, _sunspot_local_file
18
+ end
19
+ end
20
+ end
21
+
22
+ def sunspot_setup_defaults
23
+ HashWithIndifferentAccess.new({
24
+ 'common' => {
25
+ 'solr' => {
26
+ 'hostname' => fetch(:sunspot_solr_localhost, 'localhost'),
27
+ 'port' => fetch(:sunspot_solr_port, 'WARNING'),
28
+ 'log_level' => fetch(:sunspot_solr_log_level, 'WARNING')
29
+ }
30
+ }
31
+ }.reverse_merge(default_rails_environments_hash))
32
+ end
33
+
34
+ def sunspot_template_settings
35
+ DeepToHash.to_hash sunspot_setup_defaults.deep_merge(fetch(:sunspot_setup_settings, {}))
36
+ end
37
+
38
+ def _sunspot_remote_file
39
+ File.join(shared_path, fetch(:sunspot_remote_file, 'config/sunspot.yml'))
40
+ end
41
+
42
+ def _sunspot_local_file
43
+ File.join(local_rails_root, fetch(:sunspot_local_file, 'config/sunspot.yml'))
44
+ end
45
+
46
+ def _sunspot_template
47
+ fetch(:sunspot_template, 'sunspot.yml.erb')
48
+ end
49
+ end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "marcosgz-cap-recipe"
6
- s.version = "0.0.9"
6
+ s.version = "0.0.10"
7
7
  s.authors = ["Marcos G. Zimmermann"]
8
8
  s.email = ["mgzmaster@gmail.com"]
9
9
  s.homepage = "https://github.com/marcosgz/capistrano-recipe"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marcosgz-cap-recipe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-03 00:00:00.000000000 Z
12
+ date: 2013-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -61,8 +61,10 @@ files:
61
61
  - lib/capistrano/recipes/mailer.rb
62
62
  - lib/capistrano/recipes/newrelic.rb
63
63
  - lib/capistrano/recipes/passenger.rb
64
+ - lib/capistrano/recipes/resque.rb
64
65
  - lib/capistrano/recipes/settler.rb
65
66
  - lib/capistrano/recipes/shards.rb
67
+ - lib/capistrano/recipes/sunspot.rb
66
68
  - lib/capistrano/recipes/thin.rb
67
69
  - lib/capistrano/recipes/tire.rb
68
70
  - lib/capistrano/recipes/unicorn.rb