Class: PoiseApplicationRuby::Resources::Rails::Resource

Inherits:
Chef::Resource
  • Object
show all
Includes:
AppMixin
Defined in:
lib/poise_application_ruby/resources/rails.rb

Overview

An application_rails resource to configure Ruby on Rails applications.

Examples:

application '/srv/myapp' do
  git '...'
  bundle_install
  rails do
    database do
      host node['rails_host']
    end
  end
  unicorn do
    port 8080
  end
end

Since:

  • 4.0.0

Instance Attribute Summary collapse

Instance Attribute Details

#databaseHash

Option collector attribute for Rails database configuration.

Examples:

Setting via block

database do
  adapter 'postgresql'
  database 'blog'
end

Setting via URL

database 'postgresql://localhost/blog'

Returns:

  • (Hash)


60
# File 'lib/poise_application_ruby/resources/rails.rb', line 60

attribute(:database, option_collector: true, parser: :parse_database_url)

#database_configPoise::Helpers::TemplateContent

TODO:

Redo this doc to cover the actual attributes created.

Template content attribute for the contents of database.yml.

Returns:

  • (Poise::Helpers::TemplateContent)


65
# File 'lib/poise_application_ruby/resources/rails.rb', line 65

attribute(:database_config, template: true, default_source: 'database.yml.erb', default_options: lazy { default_database_options })

#migrateBoolean

Run database migrations. This is a bad idea for real apps. Please do not use it.

Returns:

  • (Boolean)


70
# File 'lib/poise_application_ruby/resources/rails.rb', line 70

attribute(:migrate, equal_to: [true, false], default: false)

#precompile_assetsBoolean

Set to true to run rake assets:precompile. By default will try to auto-detect if Sprockets is in use by looking at config/initializers.

Returns:

  • (Boolean)

See Also:

  • #default_precompile_assets


76
# File 'lib/poise_application_ruby/resources/rails.rb', line 76

attribute(:precompile_assets, equal_to: [true, false], default: lazy { default_precompile_assets })

#rails_envString

Rails environment name. Defaults to the Chef environment name or production if none is set.

Returns:

  • (String)

See Also:

  • #default_rails_env


82
# File 'lib/poise_application_ruby/resources/rails.rb', line 82

attribute(:rails_env, kind_of: String, default: lazy { default_rails_env })

#secret_tokenString

Secret token for Rails session verification and other purposes. On Rails 4.2 this will be used for secret_key_base. If not set, no secrets configuration is written.

Returns:

  • (String)


88
# File 'lib/poise_application_ruby/resources/rails.rb', line 88

attribute(:secret_token, kind_of: [String, FalseClass])

#secrets_configPoise::Helpers::TemplateContent

TODO:

Redo this doc to cover the actual attributes created.

Template content attribute for the contents of secrets.yml. Only used when secrets_mode is :yaml.

Returns:

  • (Poise::Helpers::TemplateContent)


94
# File 'lib/poise_application_ruby/resources/rails.rb', line 94

attribute(:secrets_config, template: true, default_source: 'secrets.yml.erb', default_options: lazy { default_secrets_options })

#secrets_modeSymbol

Secrets configuration mode. Set to :yaml to generate a Rails 4.2 secrets.yml. Set to :initializer to update config/initializers/secret_token.rb. If unspecified this is auto-detected based on what files exist.

Returns:

  • (Symbol)


101
# File 'lib/poise_application_ruby/resources/rails.rb', line 101

attribute(:secrets_mode, equal_to: [:yaml, :initializer], default: lazy { default_secrets_mode })