class Object

Public Instance Methods

_app_setup_aditional() click to toggle source
# File lib/capistrano/recipes/application.rb, line 73
def _app_setup_aditional
  fetch(:app_setup_aditional, [])
end
_database_local_path() click to toggle source
# File lib/capistrano/recipes/database.rb, line 46
def _database_local_path
  File.join(local_rails_root, fetch(:database_local_path, 'config/database.yml'))
end
_database_remote_path() click to toggle source
# File lib/capistrano/recipes/database.rb, line 42
def _database_remote_path
  File.join(shared_path, fetch(:database_remote_path, 'config/database.yml'))
end
_database_template() click to toggle source
# File lib/capistrano/recipes/database.rb, line 50
def _database_template
  fetch(:database_template, 'database.yml.erb')
end
_gateways_local_file() click to toggle source
# File lib/capistrano/recipes/gateways.rb, line 35
def _gateways_local_file
  File.join(local_rails_root, fetch(:gateways_local_file, 'config/gateways.yml'))
end
_gateways_remote_file() click to toggle source
# File lib/capistrano/recipes/gateways.rb, line 31
def _gateways_remote_file
  File.join(shared_path, fetch(:gateways_remote_file, 'config/gateways.yml'))
end
_gateways_template() click to toggle source
# File lib/capistrano/recipes/gateways.rb, line 39
def _gateways_template
  fetch(:gateways_template, 'gateways.yml.erb')
end
_mailer_local_file() click to toggle source
# File lib/capistrano/recipes/mailer.rb, line 34
def _mailer_local_file
  File.join(local_rails_root, fetch(:mailer_local_file, 'config/mailers.yml'))
end
_mailer_remote_file() click to toggle source
# File lib/capistrano/recipes/mailer.rb, line 30
def _mailer_remote_file
  File.join(shared_path, fetch(:mailer_remote_file, 'config/mailers.yml'))
end
_mailer_template() click to toggle source
# File lib/capistrano/recipes/mailer.rb, line 38
def _mailer_template
  fetch(:mailer_template, 'mailers.yml.erb')
end
_monit_remote_file() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 137
def _monit_remote_file
  File.join(_monit_root, application)
end
_monit_root() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 133
def _monit_root
  fetch(:monit_root) { "/home/#{fetch_user}/monit" }
end
_newrelic_local_path() click to toggle source
# File lib/capistrano/recipes/newrelic.rb, line 200
def _newrelic_local_path
  File.join(local_rails_root, fetch(:newrelic_local_path, 'config/newrelic.yml'))
end
_newrelic_remote_path() click to toggle source
# File lib/capistrano/recipes/newrelic.rb, line 196
def _newrelic_remote_path
  File.join(shared_path, fetch(:newrelic_remote_path, 'config/newrelic.yml'))
end
_newrelic_template() click to toggle source
# File lib/capistrano/recipes/newrelic.rb, line 204
def _newrelic_template
  fetch(:newrelic_template, 'newrelic.yml.erb')
end
_passenger_available_vhost() click to toggle source
# File lib/capistrano/recipes/passenger.rb, line 69
def _passenger_available_vhost
  File.join(_passenger_sites_available, _passenger_vhost_filename)
end
_passenger_enabled_vhost() click to toggle source
# File lib/capistrano/recipes/passenger.rb, line 73
def _passenger_enabled_vhost
  File.join(_passenger_sites_enabled, _passenger_vhost_filename)
end
_passenger_sites_available() click to toggle source
# File lib/capistrano/recipes/passenger.rb, line 81
def _passenger_sites_available
  fetch(:passenger_sites_available, "/home/#{fetch_user}/configs/apache/sites-available")
end
_passenger_sites_enabled() click to toggle source
# File lib/capistrano/recipes/passenger.rb, line 85
def _passenger_sites_enabled
  fetch(:passenger_sites_enabled, "/home/#{fetch_user}/configs/apache/sites-enabled")
end
_passenger_template() click to toggle source
# File lib/capistrano/recipes/passenger.rb, line 89
def _passenger_template
  fetch(:passenger_template, 'passenger.conf.erb')
end
_passenger_vhost_filename() click to toggle source
# File lib/capistrano/recipes/passenger.rb, line 77
def _passenger_vhost_filename
  fetch(:passenger_vhost_filename) { "#{application}.conf" }
end
_resque_local_file() click to toggle source
# File lib/capistrano/recipes/resque.rb, line 36
def _resque_local_file
  File.join(local_rails_root, fetch(:resque_local_file, 'config/resque.yml'))
end
_resque_remote_file() click to toggle source
# File lib/capistrano/recipes/resque.rb, line 32
def _resque_remote_file
  File.join(shared_path, fetch(:resque_remote_file, 'config/resque.yml'))
end
_resque_template() click to toggle source
# File lib/capistrano/recipes/resque.rb, line 40
def _resque_template
  fetch(:resque_template, 'resque.yml.erb')
end
_settler_local_file() click to toggle source
# File lib/capistrano/recipes/settler.rb, line 46
def _settler_local_file
  File.join(local_rails_root, fetch(:settler_local_file, 'config/settler.yml'))
end
_settler_remote_file() click to toggle source
# File lib/capistrano/recipes/settler.rb, line 42
def _settler_remote_file
  File.join(shared_path, fetch(:settler_remote_file, 'config/settler.yml'))
end
_settler_template() click to toggle source
# File lib/capistrano/recipes/settler.rb, line 50
def _settler_template
  fetch(:settler_template, 'settler.yml.erb')
end
_shards_local_path() click to toggle source
# File lib/capistrano/recipes/shards.rb, line 43
def _shards_local_path
  File.join(local_rails_root, fetch(:shards_local_path, 'config/shards.yml'))
end
_shards_remote_path() click to toggle source
# File lib/capistrano/recipes/shards.rb, line 39
def _shards_remote_path
  File.join(shared_path, fetch(:shards_remote_path, 'config/shards.yml'))
end
_shards_template() click to toggle source
# File lib/capistrano/recipes/shards.rb, line 47
def _shards_template
  fetch(:shards_template, 'shards.yml.erb')
end
_sunspot_local_file() click to toggle source
# File lib/capistrano/recipes/sunspot.rb, line 42
def _sunspot_local_file
  File.join(local_rails_root, fetch(:sunspot_local_file, 'config/sunspot.yml'))
end
_sunspot_remote_file() click to toggle source
# File lib/capistrano/recipes/sunspot.rb, line 38
def _sunspot_remote_file
  File.join(shared_path, fetch(:sunspot_remote_file, 'config/sunspot.yml'))
end
_sunspot_template() click to toggle source
# File lib/capistrano/recipes/sunspot.rb, line 46
def _sunspot_template
  fetch(:sunspot_template, 'sunspot.yml.erb')
end
_thin_bin() click to toggle source

The wrapped bin to start thin This is necessary if you’re using rvm

# File lib/capistrano/recipes/thin.rb, line 56
def _thin_bin
  fetch(:thin_bin, 'bundle exec thin')
end
_thin_cmd(action) click to toggle source
# File lib/capistrano/recipes/thin.rb, line 50
def _thin_cmd(action)
  "cd #{current_path}; #{_thin_bin} -C #{_thin_current_config_path} #{action}"
end
_thin_current_config_path() click to toggle source

The remote location of thin’s config file. Used by god to fire it up

# File lib/capistrano/recipes/thin.rb, line 61
def _thin_current_config_path
  File.join(current_path, 'config', 'thin.yml')
end
_thin_local_path() click to toggle source
# File lib/capistrano/recipes/thin.rb, line 69
def _thin_local_path
  File.join(local_rails_root, fetch(:thin_local_path, 'config/thin.yml'))
end
_thin_remote_path() click to toggle source
# File lib/capistrano/recipes/thin.rb, line 65
def _thin_remote_path
  File.join(shared_path, fetch(:thin_remote_path, 'config/thin.yml'))
end
_thin_template() click to toggle source
# File lib/capistrano/recipes/thin.rb, line 73
def _thin_template
  fetch(:thin_template, 'thin.yml.erb')
end
_tire_local_file() click to toggle source
# File lib/capistrano/recipes/tire.rb, line 38
def _tire_local_file
  File.join(local_rails_root, fetch(:tire_local_file, 'config/tire.yml'))
end
_tire_remote_file() click to toggle source
# File lib/capistrano/recipes/tire.rb, line 34
def _tire_remote_file
  File.join(shared_path, fetch(:tire_remote_file, 'config/tire.yml'))
end
_tire_template() click to toggle source
# File lib/capistrano/recipes/tire.rb, line 42
def _tire_template
  fetch(:tire_template, 'tire.yml.erb')
end
_unicorn_bin() click to toggle source

The wrapped bin to start unicorn This is necessary if you’re using rvm

# File lib/capistrano/recipes/unicorn.rb, line 99
def _unicorn_bin
  fetch(:unicorn_bin, 'bundle exec unicorn')
end
_unicorn_current_file() click to toggle source

The remote location of unicorn’s config file. Used by god to fire it up

# File lib/capistrano/recipes/unicorn.rb, line 113
def _unicorn_current_file
  File.join(current_path, fetch(:unicorn_remote_file, 'config/unicorn.rb'))
end
_unicorn_local_file() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 121
def _unicorn_local_file
  File.join(local_rails_root, fetch(:unicorn_local_file, 'config/unicorn.rb'))
end
_unicorn_monit_template() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 129
def _unicorn_monit_template
  fetch(:unicorn_monit_template, 'unicorn_monit.erb')
end
_unicorn_pid() click to toggle source

Defines where the unicorn pid will live.

# File lib/capistrano/recipes/unicorn.rb, line 104
def _unicorn_pid
  fetch(:unicorn_pid) { File.join(shared_path, "pids", "unicorn.pid") }
end
_unicorn_pids_root() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 108
def _unicorn_pids_root
  _unicorn_pid.split('/').tap{|x| x.pop }.join('/')
end
_unicorn_shared_file() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 117
def _unicorn_shared_file
  File.join(shared_path, fetch(:unicorn_remote_file, 'config/unicorn.rb'))
end
_unicorn_template() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 125
def _unicorn_template
  fetch(:unicorn_template, 'unicorn.rb.erb')
end
_uploader_local_file() click to toggle source
# File lib/capistrano/recipes/uploader.rb, line 35
def _uploader_local_file
  File.join(local_rails_root, fetch(:uploader_local_file, 'config/uploader.yml'))
end
_uploader_remote_file() click to toggle source
# File lib/capistrano/recipes/uploader.rb, line 31
def _uploader_remote_file
  File.join(shared_path, fetch(:uploader_remote_file, 'config/uploader.yml'))
end
_uploader_template() click to toggle source
# File lib/capistrano/recipes/uploader.rb, line 39
def _uploader_template
  fetch(:uploader_template, 'uploader.yml.erb')
end
database_setup_defaults() click to toggle source
# File lib/capistrano/recipes/database.rb, line 25
def database_setup_defaults
  HashWithIndifferentAccess.new({
    'common'      => {
      'adapter'   => fetch(:database_adapter, 'mysql2'),
      'encoding'  => fetch(:database_encoding, 'utf8'),
      'reconnect' => fetch(:database_reconnect, false),
      'username'  => fetch(:database_username) { fetch_user },
      'password'  => self[:database_password],
      'host'      => fetch(:database_host, '127.0.1.1')
    }
  }.reverse_merge(default_rails_environments_hash))
end
database_template_settings() click to toggle source
# File lib/capistrano/recipes/database.rb, line 38
def database_template_settings
  DeepToHash.to_hash database_setup_defaults.deep_merge(fetch(:db_setup_settings, {}))
end
default_rails_environments() click to toggle source
# File lib/capistrano/recipes/application.rb, line 89
def default_rails_environments
  fetch(:rails_environments, %w(production development staging test))
end
default_rails_environments_hash() click to toggle source
# File lib/capistrano/recipes/application.rb, line 85
def default_rails_environments_hash
  default_rails_environments.inject({}){|r, v| r.merge Hash[v, {}] }
end
fetch_group() click to toggle source
# File lib/capistrano/recipes/application.rb, line 81
def fetch_group
  fetch(:group, 'app')
end
fetch_user() click to toggle source
# File lib/capistrano/recipes/application.rb, line 77
def fetch_user
  fetch(:user, 'app')
end
gateways_setup_defaults() click to toggle source
# File lib/capistrano/recipes/gateways.rb, line 23
def gateways_setup_defaults
  HashWithIndifferentAccess.new({'common'=>{}}.reverse_merge(default_rails_environments_hash))
end
gateways_template_settings() click to toggle source
# File lib/capistrano/recipes/gateways.rb, line 27
def gateways_template_settings
  DeepToHash.to_hash gateways_setup_defaults.deep_merge(fetch(:gateways_setup_settings, {}))
end
mailer_setup_defaults() click to toggle source
# File lib/capistrano/recipes/mailer.rb, line 22
def mailer_setup_defaults
  HashWithIndifferentAccess.new({'common'=>{}}.reverse_merge(default_rails_environments_hash))
end
mailer_template_settings() click to toggle source
# File lib/capistrano/recipes/mailer.rb, line 26
def mailer_template_settings
  DeepToHash.to_hash mailer_setup_defaults.deep_merge(fetch(:mailer_setup_settings, {}))
end
newrelic_setup_defaults() click to toggle source
# File lib/capistrano/recipes/newrelic.rb, line 26
def newrelic_setup_defaults
  HashWithIndifferentAccess.new({
    'common'      => {
      # ============================== LICENSE KEY ===============================

      # You must specify the license key associated with your New Relic
      # account.  This key binds your Agent's data to your account in the
      # New Relic service.
      'license_key' => self[:newrelic_license_key],
      # Agent Enabled (Ruby/Rails Only)
      # Use this setting to force the agent to run or not run.
      # Default is 'auto' which means the agent will install and run only
      # if a valid dispatcher such as Mongrel is running.  This prevents
      # it from running with Rake or the console.  Set to false to
      # completely turn the agent off regardless of the other settings.
      # Valid values are true, false and auto.
      # 'agent_enabled' => 'auto'

      # Application Name
      # Set this to be the name of your application as you'd like it show
      # up in New Relic.  New Relic will then auto-map instances of your application
      # into a New Relic "application" on your home dashboard page. If you want
      # to map this instance into multiple apps, like "AJAX Requests" and
      # "All UI" then specify a semicolon-separated list of up to three
      # distinct names.  If you comment this out, it defaults to the
      # capitalized RAILS_ENV (i.e., Production, Staging, etc)
      'app_name' => fetch(:application),

      # When "true", the agent collects performance data about your
      # application and reports this data to the New Relic service at
      # newrelic.com. This global switch is normally overridden for each
      # environment below. (formerly called 'enabled')
      'monitor_mode' => false,

      # Developer mode should be off in every environment but
      # development as it has very high overhead in memory.
      'developer_mode' => false,

      # The newrelic agent generates its own log file to keep its logging
      # information separate from that of your application.  Specify its
      # log level here.
      'log_level' => 'info',

      # The newrelic agent communicates with the New Relic service via http by
      # default.  If you want to communicate via https to increase
      # security, then turn on SSL by setting this value to true.  Note,
      # this will result in increased CPU overhead to perform the
      # encryption involved in SSL communication, but this work is done
      # asynchronously to the threads that process your application code,
      # so it should not impact response times.
      'ssl' => false,

      # EXPERIMENTAL: enable verification of the SSL certificate sent by
      # the server. This setting has no effect unless SSL is enabled
      # above. This may block your application. Only enable it if the data
      # you send us needs end-to-end verified certificates.
      #
      # This means we cannot cache the DNS lookup, so each request to the
      # New Relic service will perform a lookup. It also means that we cannot
      # use a non-blocking lookup, so in a worst case, if you have DNS
      # problems, your app may block indefinitely.
      # 'verify_certificate' => true,

      # Proxy settings for connecting to the New Relic server.
      #
      # If a proxy is used, the host setting is required.  Other settings
      # are optional.  Default port is 8080.
      #
      # 'proxy_host' => 'hostname'
      # 'proxy_port' => 8080
      # 'proxy_user' => ''
      # 'proxy_pass' => ''

      # Tells transaction tracer and error collector (when enabled)
      # whether or not to capture HTTP params.  When true, frameworks can
      # exclude HTTP parameters from being captured.
      # Rails: the RoR filter_parameter_logging excludes parameters
      # Java: create a config setting called "ignored_params" and set it to
      #     a comma separated list of HTTP parameter names.
      #     ex: ignored_params: credit_card, ssn, password
      'capture_params' => true,

      # Transaction tracer captures deep information about slow
      # transactions and sends this to the New Relic service once a
      # minute. Included in the transaction is the exact call sequence of
      # the transactions including any SQL statements issued.
      'transaction_tracer' => {
        # Transaction tracer is enabled by default. Set this to false to
        # turn it off. This feature is only available at the Professional
        # product level.
        'enabled' => true,

        # Threshold in seconds for when to collect a transaction
        # trace. When the response time of a controller action exceeds
        # this threshold, a transaction trace will be recorded and sent to
        # New Relic. Valid values are any float value, or (default) "apdex_f",
        # which will use the threshold for an dissatisfying Apdex
        # controller action - four times the Apdex T value.
        'transaction_threshold' => 'apdex_f',

        # When transaction tracer is on, SQL statements can optionally be
        # recorded. The recorder has three modes, "off" which sends no
        # SQL, "raw" which sends the SQL statement in its original form,
        # and "obfuscated", which strips out numeric and string literals.
        'record_sql' => 'raw',

        # Threshold in seconds for when to collect stack trace for a SQL
        # call. In other words, when SQL statements exceed this threshold,
        # then capture and send to New Relic the current stack trace. This is
        # helpful for pinpointing where long SQL calls originate from.
        'stack_trace_threshold' => 0.500

        # Determines whether the agent will capture query plans for slow
        # SQL queries.  Only supported in mysql and postgres.  Should be
        # set to false when using other adapters.
        # 'explain_enabled' => true

        # Threshold for query execution time below which query plans will not
        # not be captured.  Relevant only when `explain_enabled` is true.
        # 'explain_threshold' => 0.5
      },


      # Error collector captures information about uncaught exceptions and
      # sends them to New Relic for viewing
      'error_collector' => {
        # Error collector is enabled by default. Set this to false to turn
        # it off. This feature is only available at the Professional
        # product level.
        'enabled' => true,

        # Rails Only - tells error collector whether or not to capture a
        # source snippet around the place of the error when errors are View
        # related.
        'capture_source' => true,

        # To stop specific errors from reporting to New Relic, set this property
        # to comma-separated values.  Default is to ignore routing errors,
        # which are how 404's get triggered.
        'ignore_errors' => 'ActionController::RoutingError'
      },

      # (Advanced) Uncomment this to ensure the CPU and memory samplers
      # won't run.  Useful when you are using the agent to monitor an
      # external resource
      # 'disable_samplers' => true

      # If you aren't interested in visibility in these areas, you can
      # disable the instrumentation to reduce overhead.
      #
      # 'disable_view_instrumentation' => true,
      # 'disable_activerecord_instrumentation' => true,
      # 'disable_memcache_instrumentation' => true,
      # 'disable_dj' => true,

      # Certain types of instrumentation such as GC stats will not work if
      # you are running multi-threaded.  Please let us know.
      # 'multi_threaded' => false
    },
    'development' => {'developer_mode'  => true},
    'staging'     => {'developer_mode'  => true},
    'test'        => {},
    'production'  => {'monitor_mode'    => true}
  }.reverse_merge(default_rails_environments_hash))
end
newrelic_template_settings() click to toggle source
# File lib/capistrano/recipes/newrelic.rb, line 192
def newrelic_template_settings
  DeepToHash.to_hash newrelic_setup_defaults.deep_merge(fetch(:newrelic_setup_settings, {}))
end
passenger_setup_defaults() click to toggle source
# File lib/capistrano/recipes/passenger.rb, line 57
def passenger_setup_defaults
  HashWithIndifferentAccess.new({
    'server_name'       => fetch(:domain),
    'document_root'     => File.join(current_path, 'public'),
    'rails_env'         => fetch(:rails_env, 'production')
  })
end
passenger_template_settings() click to toggle source
# File lib/capistrano/recipes/passenger.rb, line 65
def passenger_template_settings
  DeepToHash.to_hash passenger_setup_defaults.deep_merge(fetch(:passenger_setup_settings, {}))
end
resque_setup_defaults() click to toggle source
# File lib/capistrano/recipes/resque.rb, line 22
def resque_setup_defaults
  HashWithIndifferentAccess.new(default_rails_environments.inject({}){|r, v|
    r.merge Hash[v, 'localhost:6379']
  })
end
resque_template_settings() click to toggle source
# File lib/capistrano/recipes/resque.rb, line 28
def resque_template_settings
  DeepToHash.to_hash resque_setup_defaults.deep_merge(fetch(:resque_setup_settings, {}))
end
settler_template_settings() click to toggle source
# File lib/capistrano/recipes/settler.rb, line 22
def settler_template_settings
  fetch(:settler_setup_settings, {}).inject({}) do |r, (k,v)|
    case v.class.name
    when 'Hash', 'ActiveSupport::HashWithIndifferentAccess'
      r[k] = v
    when 'Float'
      r[k] = {'alt' => k.to_s, 'value' => v.to_s, 'typecast' => 'float'}
    when 'Fixnum'
      r[k] = {'alt' => k.to_s, 'value' => v.to_s, 'typecast' => 'integer'}
    when 'TrueClass', 'FalseClass'
      r[k] = {'alt' => k.to_s, 'value' => v.to_s, 'typecast' => 'boolean'}
    when 'DateTime', 'Date', 'Time'
      r[k] = {'alt' => k.to_s, 'value' => v.to_s, 'typecast' => 'datetime'}
    else
      r[k] = {'alt' => k.to_s, 'value' => v.to_s}
    end
    r
  end
end
shards_setup_defaults() click to toggle source
# File lib/capistrano/recipes/shards.rb, line 28
def shards_setup_defaults
  HashWithIndifferentAccess.new({
    'environments'      => %w(production),
    'databases'         => {}
  })
end
shards_template_settings() click to toggle source
# File lib/capistrano/recipes/shards.rb, line 35
def shards_template_settings
  DeepToHash.to_hash shards_setup_defaults.deep_merge(fetch(:shards_setup_settings, {}))
end
sunspot_setup_defaults() click to toggle source
# File lib/capistrano/recipes/sunspot.rb, line 22
def sunspot_setup_defaults
  HashWithIndifferentAccess.new({
    'common'  => {
      'solr' => {
        'hostname'  => fetch(:sunspot_solr_localhost, 'localhost'),
        'port'      => fetch(:sunspot_solr_port, 'WARNING'),
        'log_level' => fetch(:sunspot_solr_log_level, 'WARNING')
      }
    }
  }.reverse_merge(default_rails_environments_hash))
end
sunspot_template_settings() click to toggle source
# File lib/capistrano/recipes/sunspot.rb, line 34
def sunspot_template_settings
  DeepToHash.to_hash sunspot_setup_defaults.deep_merge(fetch(:sunspot_setup_settings, {}))
end
thin_setup_defaults() click to toggle source
# File lib/capistrano/recipes/thin.rb, line 37
def thin_setup_defaults
  HashWithIndifferentAccess.new({
    'chdir'       => fetch(:current_path),
    'timeout'     => fetch(:thin_timeout, 30),
    'servers'     => fetch(:thin_servers, 4),
    'rails_env'   => fetch(:rails_env, 'production')
  })
end
thin_template_settings() click to toggle source
# File lib/capistrano/recipes/thin.rb, line 46
def thin_template_settings
  DeepToHash.to_hash thin_setup_defaults.deep_merge(fetch(:thin_setup_settings, {}))
end
tire_setup_defaults() click to toggle source
# File lib/capistrano/recipes/tire.rb, line 22
def tire_setup_defaults
  HashWithIndifferentAccess.new({
    'common'=>{
      'url' => 'http://localhost:9200'
    }
  }.reverse_merge(default_rails_environments_hash))
end
tire_template_settings() click to toggle source
# File lib/capistrano/recipes/tire.rb, line 30
def tire_template_settings
  DeepToHash.to_hash tire_setup_defaults.deep_merge(fetch(:tire_setup_settings, {}))
end
unicorn_kill_cmd(arg) click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 93
def unicorn_kill_cmd(arg)
  "kill -#{arg} `cat #{_unicorn_pid}`"
end
unicorn_setup_defaults() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 62
def unicorn_setup_defaults
  HashWithIndifferentAccess.new({
    # Number of workers (Rule of thumb is 2 per CPU)
    # Just be aware that every worker needs to cache all classes and thus eat some
    # of your RAM.
    'workers'          => fetch(:unicorn_workers, 4),
    # Workers timeout in the amount of seconds below, when the master kills it and
    # forks another one.
    'workers_timeout'  => fetch(:unicorn_workers_timeout, 30),
    # Workers are started with this user/group
    # By default we get the user/group set in capistrano.
    'user'              => fetch(:unicorn_user) { fetch_user },
    'group'             => fetch(:unicorn_group) { fetch_group },
    'rails_env'         => fetch(:rails_env, 'production'),
    # configs for the monit template
    'pids_root'         => _unicorn_pids_root,
    'application'       => fetch(:application),
    'current_path'      => current_path,
    'shared_path'       => shared_path,
    'remote_config'     => _unicorn_current_file
  })
end
unicorn_start_cmd() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 89
def unicorn_start_cmd
  "cd #{current_path} && #{_unicorn_bin} -c #{_unicorn_current_file} -E #{rails_env} -D"
end
unicorn_template_settings() click to toggle source
# File lib/capistrano/recipes/unicorn.rb, line 85
def unicorn_template_settings
  DeepToHash.to_hash unicorn_setup_defaults.deep_merge(fetch(:unicorn_setup_settings, {}))
end
uploader_setup_defaults() click to toggle source
# File lib/capistrano/recipes/uploader.rb, line 23
def uploader_setup_defaults
  HashWithIndifferentAccess.new({'common'=>{}}.reverse_merge(default_rails_environments_hash))
end
uploader_template_settings() click to toggle source
# File lib/capistrano/recipes/uploader.rb, line 27
def uploader_template_settings
  DeepToHash.to_hash uploader_setup_defaults.deep_merge(fetch(:uploader_setup_settings, {}))
end