Top Level Namespace

Defined Under Namespace

Modules: Caplets

Instance Method Summary collapse

Instance Method Details

#cache_dirObject

Defaults



2
# File 'lib/caplets/cache.rb', line 2

_cset :cache_dir, 'cache'

#config_filesObject

Defaults



2
# File 'lib/caplets/yaml.rb', line 2

_cset :config_files, {}

#db_hostObject

Defaults



6
# File 'lib/caplets/db.rb', line 6

_cset :db_host, 'localhost'

#deployObject

Tasks



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
57
58
# File 'lib/caplets/db.rb', line 31

namespace :deploy do
  namespace :db do
    desc "write out database.yml"
    task :config, :roles => :app do
      put YAML.dump(fetch(:db_config)), "#{shared_path}/config/database.yml"
    end
  end

  # migrate runs on the app server (no need for the code on the DB server)
  task :migrate, :roles => :app, :only => { :primary => true } do
    rake 'db:migrate'
  end

  desc <<-DESC
  Do a deploy with migrations.

  Use this when you need to completely disable the site and run migrations.
  This will put up a maintenance page, run the migrations and completely
  restart the app server processes.
  DESC
  task :migrations do
    web.disable
    update
    migrate
    restart
    web.enable
  end
end

#gitObject

Tasks



2
3
4
5
6
7
8
9
10
11
# File 'lib/caplets/git-tag.rb', line 2

namespace :git do
  desc 'Tag and push tag for current release'
  task :tag_current_release, :roles => :app, :only => {:primary => true} do
    if ENV['NO_TAG'].nil?
      tag = "deploy-#{environment}-#{Time.now.to_i}"
      `git tag #{tag} #{fetch(:current_revision)}`
      `git push origin #{tag}`
    end
  end
end

#memcached_serversObject

Defaults



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/caplets/memcached.rb', line 2

_cset(:memcached_servers) do
  if roles[:memcached].servers.any?
    unless roles[:memcached].servers.all? {|s| s.options[:private_ip] }
      abort "Set :private_ip for all :memcached servers or "+
            "set :memcached_servers explicitly."
    end
    roles[:memcached].servers.map {|s| s.options[:private_ip] + ":11211" }
  else
    %w[localhost:11211]
  end
end

#networkfs_pathObject

Defaults



5
# File 'lib/caplets/networkfs.rb', line 5

_cset :networkfs_path, '/srv/share'

#sphinx_addressObject

Defaults



5
6
7
8
# File 'lib/caplets/thinking-sphinx.rb', line 5

_cset(:sphinx_address) {
  roles[:sphinx].servers.detect {|s| s.options[:primary] }.options[:private_ip] ||
  '127.0.0.1'
}