Sha256: a05b0076e78537f7d4349598927112a5eb8f75faf8d7192052c24bc860508a69

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

namespace :sunspot do
  desc 'setup solr data dir'
  task :setup_solr_data_dir do
    on roles :app do
      within shared_path do
        execute :mkdir, "-p #{shared_path}/solr"
      end
    end
  end

  desc 'link to solr shared dirs'
  task :link_to_solr_shared_dirs do
    on roles :app do
      within shared_path do
        execute :rm, "-rf #{release_path}/solr/solr"
        execute :ln, "-s #{shared_path}/solr #{release_path}/solr"
        execute :ln, "-s #{shared_path}/pids #{release_path}/solr/pids"
      end
    end
  end

  desc 'start solr'
  task :start do
    on roles :app do
      within release_path do
        execute :rake, "sunspot:solr:start RAILS_ENV=#{fetch :stage}"
      end
    end
  end

  desc 'stop solr'
  task :stop do
    on roles :app do
      within release_path do
        execute :rake, "sunspot:solr:stop RAILS_ENV=#{fetch :stage};true"
      end
    end
  end

  desc 'reindex solr'
  task :reindex do
    on roles :app do
      within release_path do
        execute :rake, "sunspot:solr:reindex RAILS_ENV=#{fetch :stage};true"
      end
    end
  end

  desc 'restart solr'
  task :restart do
    invoke 'sunspot:stop'
    sleep 1
    invoke 'sunspot:start'
  end
end

after 'deploy:check', 'sunspot:setup_solr_data_dir'

before 'deploy:publishing', 'sunspot:link_to_solr_shared_dirs'
before 'deploy:publishing', 'sunspot:reindex'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
h2ocube_rails_sunspot-0.0.5 lib/capistrano/tasks/sunspot.cap