Top Level Namespace

Defined Under Namespace

Modules: Capistrano

Instance Method Summary collapse

Instance Method Details

#airbrakeObject

Tasks



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/capistrano/novelys/airbrake.rb', line 8

namespace :airbrake do
  desc "Copy airbrake API Key"
  task :copy do
    upload "config/initializers/airbrake.rb", "#{shared_path}/config/initializers/airbrake.rb", :via => :scp
  end

  desc "Link the config/initializers/airbrake.rb file in the release_path"
  task :symlink do
    run "test -f #{release_path}/config/initializers/airbrake.rb || ln -s #{shared_path}/config/initializers/airbrake.rb #{release_path}/config/initializers/airbrake.rb"
  end
end

#bundle_cmdObject

Bundle



14
# File 'lib/capistrano/novelys/core.rb', line 14

set(:bundle_cmd)       { 'bundle' }

#databaseObject

Tasks



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/capistrano/novelys/database.rb', line 5

namespace :database do
  desc "Database create"
  task :create do
    run "cd #{current_path} && #{bundle_cmd} exec rake db:create:all"
  end

  desc "Database seeds population"
  task :seed do
    run "cd #{current_path} && #{bundle_cmd} exec rake db:seed"
  end

  desc "Copy database config"
  task :copy do
    upload "config/database.yml", "#{shared_path}/config/database.yml", :via => :scp
  end

  desc "Link the config/database.yml file in the release_path"
  task :symlink do
    run "test -f #{release_path}/config/database.yml || ln -s #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
end

#deployObject

Tasks



26
27
28
29
30
31
# File 'lib/capistrano/novelys/core.rb', line 26

namespace :deploy do
  desc "Create directories required for correct symlinking"
  task :mkdir_config do
    run "mkdir -p #{shared_path}/config/initializers"
  end
end

#logsObject

Tasks



2
3
4
5
6
7
# File 'lib/capistrano/novelys/logs.rb', line 2

namespace :logs do
  desc "Tail Rails logs"
  task :tail do
    stream "tail -f #{shared_path}/log/#{rails_env}.log"
  end
end

#mongoidObject

Tasks



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/capistrano/novelys/mongoid.rb', line 5

namespace :mongoid do
  desc "Copy mongoid config"
  task :copy do
    upload "config/mongoid.yml", "#{shared_path}/config/mongoid.yml", :via => :scp
  end

  desc "Link the mongoid config in the release_path"
  task :symlink do
    run "test -f #{release_path}/config/mongoid.yml || ln -s #{shared_path}/config/mongoid.yml #{release_path}/config/mongoid.yml"
  end

  desc "Create MongoDB indexes"
  task :index do
    run "cd #{current_path} && #{bundle_cmd} exec rake db:mongoid:create_indexes", :once => true
  end
end

#railsObject

Tasks



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/capistrano/novelys/rails.rb', line 7

namespace :rails do
  namespace :secret_token do
    desc "Copy the secret token file to the server"
    task :copy do
      upload "config/initializers/secret_token.rb", "#{shared_path}/config/initializes/secret_token.rb", :via => :scp
    end

    desc "Symlink the secret token file in the current release"
    task :symlink do
      run "test -f #{release_path}/config/initializers/secret_token.rb || ln -s #{shared_path}/config/initializers/secret_token.rb #{release_path}/config/initializers/secret_token.rb"
    end
  end

  desc "Open a Rails console"
  task :console do
    run_interactively "bundle exec rails console #{rails_env}"
  end

  desc "Open a DBConsole"
  task :dbconsole do
    run_interactively "bundle exec rails dbconsole #{rails_env}"
  end
end

#remoteObject

Dependencies



2
# File 'lib/capistrano/novelys/core.rb', line 2

depend :remote, :command, 'git'

#run_interactively(command, server = nil) ⇒ Object



31
32
33
34
# File 'lib/capistrano/novelys/rails.rb', line 31

def run_interactively(command, server = nil)
  server ||= find_servers_for_task(current_task).first
  exec %Q(ssh #{user}@#{server.host} -t 'cd #{current_path} && #{command}')
end

#s3Object

Tasks



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/capistrano/novelys/s3.rb', line 5

namespace :s3 do
  desc "Copy amazon S3 config"
  task :copy do
    upload "config/amazon_s3.yml", "#{shared_path}/config/amazon_s3.yml", :via => :scp
  end

  desc "Link the config/amazon_s3.yml file in the release_path"
  task :symlink do
    run "test -f #{release_path}/config/amazon_s3.yml || ln -s #{shared_path}/config/amazon_s3.yml #{release_path}/config/amazon_s3.yml"
  end
end

#scmObject

Default configuration



5
# File 'lib/capistrano/novelys/core.rb', line 5

set(:scm)              { :git }

#sunspotObject

Tasks



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/capistrano/novelys/sunspot.rb', line 5

namespace :sunspot do
  desc "Copy sunspot config"
  task :copy do
    upload "config/sunspot.yml", "#{shared_path}/config/sunspot.yml", :via => :scp
  end

  desc "Link the config/sunspot.yml file in the release_path"
  task :symlink do
    run "test -f #{release_path}/config/sunspot.yml || ln -s #{shared_path}/config/sunspot.yml #{release_path}/config/sunspot.yml"
  end
end

#thinking_sphinxObject

Tasks



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/capistrano/novelys/sphinx.rb', line 6

namespace :thinking_sphinx do
  desc "Copy local sphinx config"
  task :copy do
    upload "config/development.sphinx.conf", "#{shared_path}/config/#{rails_env}.sphinx.conf", :via => :scp
  end

  desc "Link the config/*.sphinx.conf file in the release_path"
  task :symlink do
    run "test -f #{release_path}/config/#{rails_env}.sphinx.conf || ln -s #{shared_path}/config/#{rails_env}.sphinx.conf #{release_path}/config/#{rails_env}.sphinx.conf"
  end

  desc "Generate the Sphinx configuration file"
  task :configure do
    Novelys::Helpers.run_remote_rake(self, "thinking_sphinx:configure")
  end

  desc "Index data"
  task :index do
    Novelys::Helpers.run_remote_rake(self, "thinking_sphinx:index")
  end

  desc "Start the Sphinx daemon"
  task :start do
    configure
    Novelys::Helpers.run_remote_rake(self, "thinking_sphinx:start")
  end

  desc "Stop the Sphinx daemon"
  task :stop do
    configure
    Novelys::Helpers.run_remote_rake(self, "thinking_sphinx:stop")
  end

  desc "Stop and then start the Sphinx daemon"
  task :restart do
    stop
    start
  end

  desc "Stop, re-index and then start the Sphinx daemon"
  task :rebuild do
    stop
    index
    start
  end

  desc "Add the shared folder for sphinx files for the current environment"
  task :shared_sphinx_folder, :roles => :web do
    run "mkdir -p #{shared_path}/db/sphinx/#{rails_env}"
  end
end

#tsObject

Alias for thinking_sphinx namespace



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/capistrano/novelys/sphinx.rb', line 59

namespace :ts do
  desc "Generate the Sphinx configuration file"
  task(:configure) { thinking_sphinx.configure }

  desc "Index data"
  task(:index) { thinking_sphinx.index }

  desc "Stop, re-index and then start the Sphinx daemon"
  task(:rebuild) { thinking_sphinx.rebuild }

  desc "Stop and then start the Sphinx daemon"
  task(:restart) { thinking_sphinx.restart }

  desc "Add the shared folder for sphinx files for the production environment"
  task(:shared_sphinx_folder) { thinking_sphinx.shared_sphinx_folder }

  desc "Start the Sphinx daemon"
  task(:start) { thinking_sphinx.start }

  desc "Stop the Sphinx daemon"
  task(:stop) { thinking_sphinx.stop }

  desc "Copy local sphinx config"
  task(:copy) { thinking_sphinx.copy }

  desc "Link the config/*.sphinx.conf file in the release_path"
  task(:symlink) { thinking_sphinx.symlink }
end

#unicorn_binaryObject

Unicorn Config



2
# File 'lib/capistrano/novelys/unicorn.rb', line 2

set(:unicorn_binary) { 'bundle exec unicorn_rails' }

#userObject

Default Novelys app configuration



3
# File 'lib/capistrano/novelys/novelys.rb', line 3

set(:user)             { application }

#whenever_commandObject

Whenever



4
# File 'lib/capistrano/novelys/whenever.rb', line 4

set(:whenever_command)     { 'bundle exec whenever' }