fingercap 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,6 @@
1
1
  require 'fingercap/recipes'
2
2
  require 'fingercap/persistant_directory'
3
3
 
4
- gem 'thinking-sphinx'
5
- require 'thinking_sphinx/deploy/capistrano'
6
-
7
4
  Capistrano::Configuration.instance(:must_exist).load do
8
5
  def _instances
9
6
  if ENV['INSTANCE']
@@ -35,6 +32,7 @@ Capistrano::Configuration.instance(:must_exist).load do
35
32
  role :app, *instances
36
33
  role :web, *instances
37
34
  role :db, primary_instance, :primary => true
35
+ role :master, primary_instance
38
36
 
39
37
  set :remote_secure_key_file, '/home/deploy/.ssh/secure.key'
40
38
  set :remote_ssh_options, "-o 'StrictHostKeyChecking no' -i #{remote_secure_key_file}"
@@ -115,14 +113,35 @@ Capistrano::Configuration.instance(:must_exist).load do
115
113
 
116
114
  namespace :sphinx do
117
115
  desc "Stop Sphinx"
118
- task :stop do
119
- run "if [ -f #{current_path}/Rakefile ]; then cd #{current_path}; rake thinking_sphinx:stop RAILS_ENV=production; fi"
116
+ task :stop, :roles => :master do
117
+ config_file = "#{current_path}/config/production.sphinx.conf"
118
+ sudo "touch #{config_file}"
119
+ sudo "chown app:app #{config_file}"
120
+ sudo "chown app:app #{current_path}/log"
121
+ run "if [ -f #{current_path}/Rakefile ]; then cd #{current_path}; sudo -u app rake thinking_sphinx:stop RAILS_ENV=production; fi"
122
+ end
123
+
124
+ desc "Perform additional configuration for the search daemon"
125
+ task :configure, :roles => :master do
126
+ config_file = "#{current_path}/config/environments/production.rb"
127
+ new_config_file = "#{current_path}/config/environments/production.rb.tmp"
128
+ run "cat #{config_file} | sed 's/ThinkingSphinx\..*//' > #{new_config_file}"
129
+ run "mv #{new_config_file} #{config_file}"
130
+
131
+ config_file = "#{current_path}/config/sphinx.yml"
132
+ new_config_file = "#{current_path}/config/sphinx.yml.tmp"
133
+ run "cat #{config_file} | sed 's/address:.*/address: 0.0.0.0/' > #{new_config_file}"
134
+ run "mv #{new_config_file} #{config_file}"
120
135
  end
121
136
 
122
137
  desc "Start the search daemon"
123
- task :start do
124
- thinking_sphinx.configure
125
- thinking_sphinx.start
138
+ task :start, :roles => :master do
139
+ config_file = "#{current_path}/config/production.sphinx.conf"
140
+ sudo "touch #{config_file}"
141
+ sudo "chown app:app #{config_file}"
142
+ sudo "chown app:app #{current_path}/log"
143
+ run "if [ -f #{current_path}/Rakefile ]; then cd #{current_path}; sudo -u app rake thinking_sphinx:configure RAILS_ENV=production; fi"
144
+ run "if [ -f #{current_path}/Rakefile ]; then cd #{current_path}; sudo -u app rake thinking_sphinx:start RAILS_ENV=production; fi"
126
145
  end
127
146
  end
128
147
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fingercap
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 3
10
+ version: 0.4.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Manfred Stienstra
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-10 00:00:00 +02:00
18
+ date: 2010-11-25 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21