diff --git a/Gemfile b/Gemfile index 4ea6a99..9a5a8ee 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ gem 'rails_autolink' # Please don't update hoptoad_notifier to airbrake. # It's for internal use only, and we monkeypatch certain methods gem 'hoptoad_notifier', "~> 2.4" -gem 'draper', :require => false +gem 'draper' gem 'errbit_plugin', github: 'errbit/errbit_plugin' gem 'errbit_github_plugin', github: 'errbit/errbit_github_plugin' diff --git a/Rakefile b/Rakefile index a216334..504ccec 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,9 @@ -#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) -Errbit::Application.load_tasks +Rails.application.load_tasks begin require 'rspec/core/rake_task' diff --git a/config.ru b/config.ru index c48f97e..fb56fe7 100644 --- a/config.ru +++ b/config.ru @@ -2,4 +2,4 @@ require ::File.expand_path('../config/environment', __FILE__) use Rack::Deflater -run Errbit::Application +run Rails.application diff --git a/config/application.rb b/config/application.rb index 9806e94..28ff73f 100644 --- a/config/application.rb +++ b/config/application.rb @@ -5,8 +5,8 @@ require "action_mailer/railtie" require 'mongoid/railtie' require "sprockets/railtie" -require 'draper' - +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Errbit @@ -18,10 +18,6 @@ module Errbit # Custom directories with classes and modules you want to be autoloadable. config.autoload_paths += [Rails.root.join('lib')] - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' @@ -41,23 +37,7 @@ module Errbit # IssueTracker subclasses use inheritance, so preloading models provides querying consistency in dev mode. config.mongoid.preload_models = true - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - # Configure Devise mailer to use our mailer layout. config.to_prepare { Devise::Mailer.layout "mailer" } - - - # Enable the asset pipeline - config.assets.enabled = true - - # Need to initialize Rails environment for issue_tracker_icons.css.erb - config.assets.initialize_on_precompile = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' end end diff --git a/config/boot.rb b/config/boot.rb index 6254847..5e5f0c1 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,14 +1,4 @@ -require 'rubygems' - # Set up gems listed in the Gemfile. -gemfile = File.expand_path('../../Gemfile', __FILE__) -begin - ENV['BUNDLE_GEMFILE'] = gemfile - require 'bundler' - Bundler.setup -rescue Bundler::GemNotFound => e - STDERR.puts e.message - STDERR.puts "Try running `bundle install`." - exit! -end if File.exist?(gemfile) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/config/cloud/cloud66/deploy_hooks.yml b/config/cloud/cloud66/deploy_hooks.yml index b7a4538..141503c 100644 --- a/config/cloud/cloud66/deploy_hooks.yml +++ b/config/cloud/cloud66/deploy_hooks.yml @@ -16,10 +16,6 @@ production: destination: <%= ENV['RAILS_STACK_PATH'] %>/config/mongoid.yml target: rails run_on: all_servers - - source: /config/cloud/cloud66/files/secret_token.rb - destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/secret_token.rb - target: rails - run_on: all_servers - source: /config/cloud/cloud66/files/seeds.rb destination: <%= ENV['RAILS_STACK_PATH'] %>/db/seeds.rb target: rails @@ -59,10 +55,6 @@ staging: destination: <%= ENV['RAILS_STACK_PATH'] %>/config/mongoid.yml target: rails run_on: all_servers - - source: /config/cloud/cloud66/files/secret_token.rb - destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/secret_token.rb - target: rails - run_on: all_servers - source: /config/cloud/cloud66/files/seeds.rb destination: <%= ENV['RAILS_STACK_PATH'] %>/db/seeds.rb target: rails @@ -103,10 +95,6 @@ development: destination: <%= ENV['RAILS_STACK_PATH'] %>/config/mongoid.yml target: rails run_on: all_servers - - source: /config/cloud/cloud66/files/secret_token.rb - destination: <%= ENV['RAILS_STACK_PATH'] %>/config/initializers/secret_token.rb - target: rails - run_on: all_servers - source: /config/cloud/cloud66/files/seeds.rb destination: <%= ENV['RAILS_STACK_PATH'] %>/db/seeds.rb target: rails diff --git a/config/cloud/cloud66/files/secret_token.rb b/config/cloud/cloud66/files/secret_token.rb deleted file mode 100644 index d5358c2..0000000 --- a/config/cloud/cloud66/files/secret_token.rb +++ /dev/null @@ -1,2 +0,0 @@ -Errbit::Application.config.secret_token = '<%= ENV['SECRET_TOKEN'] %>' -Devise.secret_key = Errbit::Application.config.secret_token diff --git a/config/deploy.example.rb b/config/deploy.example.rb index b51348c..05e786c 100644 --- a/config/deploy.example.rb +++ b/config/deploy.example.rb @@ -23,7 +23,6 @@ set :linked_files, fetch(:linked_files, []) + %w( config/config.yml config/mongoid.yml config/newrelic.yml - config/initializers/secret_token.rb ) set :linked_dirs, fetch(:linked_dirs, []) + %w( diff --git a/config/environment.rb b/config/environment.rb index a04540e..ee8d90d 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,5 +1,5 @@ -# Load the rails application +# Load the Rails application. require File.expand_path('../application', __FILE__) -# Initialize the rails application -Errbit::Application.initialize! +# Initialize the Rails application. +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 2058a7e..98b1e56 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,28 +1,37 @@ -Errbit::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the webserver when you make code changes. + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. config.cache_classes = false + # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching + # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false - # Don't care if the mailer can't send + # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - config.action_mailer.default_url_options = { :host => 'localhost:3000' } - # Print deprecation notices to the Rails logger + # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Do not compress assets - config.assets.compress = false + # Raise an error on page load if there are pending migrations. + # config.active_record.migration_error = :page_load - # Expands the lines which load the assets + # Debug mode disables concatenation and preprocessing of assets. + # This option may cause significant delays in view rendering with a large + # number of complex assets. config.assets.debug = true -end + # Adds additional error checking when serving assets at runtime. + # Checks for improperly declared sprockets dependencies. + # Raises helpful error messages. + config.assets.raise_runtime_errors = false + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/environments/production.rb b/config/environments/production.rb index 9c7bf4f..fc236c6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,66 +1,78 @@ -Errbit::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. - # The production environment is meant for finished, "live" apps. - # Code is not reloaded between requests + # Code is not reloaded between requests. config.cache_classes = true + # Eager load code on boot. This eager loads most of Rails and + # your application in memory, allowing both threaded web servers + # and those relying on copy on write to perform better. + # Rake tasks automatically ignore this option for performance. config.eager_load = true - # Shows or hides all error details if something goes wrong inside Errbit + # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false - # Caching is turned on config.action_controller.perform_caching = true - # Specifies the header that your server uses for sending files - config.action_dispatch.x_sendfile_header = "X-Sendfile" + # Enable Rack::Cache to put a simple HTTP cache in front of your application + # Add `rack-cache` to your Gemfile before enabling this. + # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. + # config.action_dispatch.rack_cache = true - # For nginx: - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' + # Disable Rails's static asset server (Apache or nginx will already do this). + config.serve_static_assets = false - # If you have no front-end server that supports something like X-Sendfile, - # just comment this out and Rails will serve the files + # Compress JavaScripts and CSS. + config.assets.js_compressor = :uglifier + # config.assets.css_compressor = :sass - # See everything in the log (default is :info) - # config.log_level = :debug + # Do not fallback to assets pipeline if a precompiled asset is missed. + config.assets.compile = false - # Use a different logger for distributed setups - # config.logger = SyslogLogger.new + # Generate digests for assets URLs. + config.assets.digest = true - # Use a different cache store in production - # config.cache_store = :mem_cache_store + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Disable Rails's static asset server - # In production, Apache or nginx will already do this - config.serve_static_assets = false + # Specifies the header that your server uses for sending files. + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx - # Compress JavaScripts and CSS - config.assets.compress = true + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true - # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false + # Set to :debug to see everything in the log. + config.log_level = :info - # Generate digests for assets URLs - config.assets.digest = true + # Prepend all log lines with the following tags. + # config.log_tags = [ :subdomain, :uuid ] - # Enable serving of images, stylesheets, and javascripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" + # Use a different logger for distributed setups. + # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) - # Disable delivery errors, bad email addresses will be ignored - # config.action_mailer.raise_delivery_errors = false + # Use a different cache store in production. + # config.cache_store = :mem_cache_store - # Set default host for ActionMailer links - config.action_mailer.default_url_options = { :host => ENV['ERRBIT_HOST'] } if ENV['ERRBIT_HOST'] + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = "http://assets.example.com" - # Enable threaded mode - # config.threadsafe! + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found) + # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true - # Send deprecation notices to registered listeners + # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - config.static_cache_control = "public, max-age=7200" -end + # Disable automatic flushing of the log to improve performance. + # config.autoflush_log = false + + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Do not dump schema after migrations. + # config.active_record.dump_schema_after_migration = false +end diff --git a/config/environments/test.rb b/config/environments/test.rb index 6e1759f..053f5b6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,36 +1,39 @@ -Errbit::Application.configure do - # Settings specified here will take precedence over those in config/environment.rb +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that + # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! + # and recreated between test runs. Don't rely on the data there! config.cache_classes = true + # Do not eager load code on boot. This avoids loading your whole application + # just for the purpose of running a single test. If you are using a tool that + # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Show full error reports and disable caching + # Configure static asset server for tests with Cache-Control for performance. + config.serve_static_assets = true + config.static_cache_control = 'public, max-age=3600' + + # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false - # Raise exceptions instead of rendering exception templates + # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - config.action_mailer.default_url_options = { :host => 'test.host' } - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - # Print deprecation notices to the stderr + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr -end + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true +end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 0000000..df7ec59 --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) + +# Need to initialize Rails environment for issue_tracker_icons.css.erb +Rails.application.config.assets.initialize_on_precompile = true diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index ff96070..59385cd 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -5,4 +5,3 @@ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers! - diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 0000000..54516e3 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,3 @@ +# Be sure to restart your server when you modify this file. + +Rails.application.config.action_dispatch.cookies_serializer = :hybrid diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 5095bf2..8bebf14 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,13 +1,19 @@ # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| + # The secret key used by Devise. Devise uses this key to generate + # random tokens. Changing this key will render invalid all existing + # confirmation, reset password and unlock tokens in the database. + # config.secret_key = '2970917daf24e79762e7f370c2121b17417d729bdc587874c769b298a580824ff79b4cfd8ad6f3da94c6bbd1d5e12b483dbd2fd78b343777adc1fd15692dbcb2' + # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, - # note that it will be overwritten if you use your own mailer class with default "from" parameter. + # note that it will be overwritten if you use your own mailer class + # with default "from" parameter. config.mailer_sender = Errbit::Config.email_from # Configure the class responsible to send e-mails. - # config.mailer = "Devise::Mailer" + # config.mailer = 'Devise::Mailer' # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and @@ -50,19 +56,16 @@ Devise.setup do |config| # Tell if authentication through HTTP Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the - # given strategies, for example, `config.http_authenticatable = [:token]` will - # enable it only for token authentication. The supported strategies are: + # given strategies, for example, `config.http_authenticatable = [:database]` will + # enable it only for database authentication. The supported strategies are: # :database = Support basic authentication with authentication key + password - # :token = Support basic authentication with token authentication key - # :token_options = Support token authentication with options as defined in - # http://api.rubyonrails.org/classes/ActionController/HttpAuthentication/Token.html # config.http_authenticatable = false - # If http headers should be returned for AJAX requests. True by default. + # If 401 status code should be returned for AJAX requests. True by default. # config.http_authenticatable_on_xhr = true - # The realm used in Http Basic Authentication. "Application" by default. - # config.http_authentication_realm = "Application" + # The realm used in Http Basic Authentication. 'Application' by default. + # config.http_authentication_realm = 'Application' # It will change confirmation, password recovery and other workflows # to behave the same regardless if the e-mail provided was right or wrong. @@ -70,30 +73,38 @@ Devise.setup do |config| # config.paranoid = true # By default Devise will store the user in session. You can skip storage for - # :http_auth and :token_auth by adding those symbols to the array below. + # particular strategies by setting this option. # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by - # passing :skip => :sessions to `devise_for` in your config/routes.rb + # passing skip: :sessions to `devise_for` in your config/routes.rb config.skip_session_storage = [:http_auth] + # By default, Devise cleans up the CSRF token on authentication to + # avoid CSRF token fixation attacks. This means that, when using AJAX + # requests for sign in and sign up, you need to get a new CSRF token + # from the server. You can disable this option at your own risk. + # config.clean_up_csrf_token_on_authentication = true + # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 10. If # using other encryptors, it sets how many times you want the password re-encrypted. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use - # a value less than 10 in other environments. + # a value less than 10 in other environments. Note that, for bcrypt (the default + # encryptor), the cost increases exponentially with the number of stretches (e.g. + # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). config.stretches = Rails.env.test? ? 1 : 10 # Setup a pepper to generate the encrypted password. - config.pepper = "425f10f555c1a4718aff3370ef9dd2d97a21622beb0400fde6b52177375ddcbe37a2dac6af9bca835c988e00c32887ee940ba111a78eab48234d8799936d36b9" + config.pepper = '425f10f555c1a4718aff3370ef9dd2d97a21622beb0400fde6b52177375ddcbe37a2dac6af9bca835c988e00c32887ee940ba111a78eab48234d8799936d36b9' # ==> Configuration for :confirmable # A period that the user is allowed to access the website even without - # confirming his account. For instance, if set to 2.days, the user will be - # able to access the website for two days without confirming his account, + # confirming their account. For instance, if set to 2.days, the user will be + # able to access the website for two days without confirming their account, # access will be blocked just in the third day. Default is 0.days, meaning - # the user cannot access the website without confirming his account. + # the user cannot access the website without confirming their account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their @@ -106,8 +117,8 @@ Devise.setup do |config| # If true, requires any email changes to be confirmed (exactly the same way as # initial account confirmation) to be applied. Requires additional unconfirmed_email - # db field (see migrations). Until confirmed new email is stored in - # unconfirmed email column, and copied to email column on successful confirmation. + # db field (see migrations). Until confirmed, new email is stored in + # unconfirmed_email column, and copied to email column on successful confirmation. config.reconfirmable = true # Defines which key will be used when confirming an account @@ -117,15 +128,18 @@ Devise.setup do |config| # The time the user will be remembered without asking for credentials again. config.remember_for = 2.weeks + # Invalidates all the remember me tokens when the user signs out. + config.expire_all_remember_me_on_sign_out = true + # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false # Options to be passed to the created cookie. For instance, you can set - # :secure => true in order to force SSL only cookies. + # secure: true in order to force SSL only cookies. # config.rememberable_options = {} # ==> Configuration for :validatable - # Range for password length. Default is 8..128. + # Range for password length. config.password_length = 6..1024 # Email regex used to validate email formats. It simply asserts that @@ -165,6 +179,9 @@ Devise.setup do |config| # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour + # Warn on the last attempt before the account is locked. + # config.last_attempt_warning = true + # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account @@ -208,7 +225,7 @@ Devise.setup do |config| # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. - # config.navigational_formats = ["*/*", :html] + # config.navigational_formats = ['*/*', :html] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete @@ -216,7 +233,7 @@ Devise.setup do |config| # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. - # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' + # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' if Errbit::Config.github_authentication || Rails.env.test? config.omniauth :github, @@ -232,7 +249,7 @@ Devise.setup do |config| # # config.warden do |manager| # manager.intercept_401 = false - # manager.default_strategies(:scope => :user).unshift :some_external_strategy + # manager.default_strategies(scope: :user).unshift :some_external_strategy # end # ==> Mountable engine configurations @@ -240,12 +257,12 @@ Devise.setup do |config| # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # - # mount MyEngine, at: "/my_engine" + # mount MyEngine, at: '/my_engine' # # The router that invoked `devise_for`, in the example above, would be: # config.router_name = :my_engine # # When using omniauth, Devise cannot automatically set Omniauth path, # so you need to do it manually. For the users scope, it would be: - # config.omniauth_path_prefix = "/my_engine/users/auth" + # config.omniauth_path_prefix = '/my_engine/users/auth' end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..4a994e1 --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 50ab8a9..ac033bf 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,11 +1,16 @@ # Be sure to restart your server when you modify this file. -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 1c5053b..dc18996 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,5 +2,3 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone - diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb deleted file mode 100644 index 22124e9..0000000 --- a/config/initializers/secret_token.rb +++ /dev/null @@ -1,35 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. - -# Everyone can share the same token for development/test -if ENV['SECRET_TOKEN'].present? - Errbit::Application.config.secret_token = ENV['SECRET_TOKEN'] - - # Do not raise an error if secret token is not available during assets precompilation -elsif %w(development test).include?(Rails.env) || ENV['RAILS_GROUPS'] == 'assets' - Errbit::Application.config.secret_token = 'f258ed69266dc8ad0ca79363c3d2f945c388a9c5920fc9a1ae99a98fbb619f135001c6434849b625884a9405a60cd3d50fc3e3b07ecd38cbed7406a4fccdb59c' -elsif !Errbit::Application.config.secret_token - raise <<-ERROR - - You must generate a unique secret token for your Errbit instance. - - If you are deploying via capistrano, please ensure that your `config/deploy.rb` contains - the new `errbit:setup_configs` and `errbit:symlink_configs` tasks from `config/deploy.example.rb`. - Next time you deploy, your secret token will be automatically generated. - - If you are deploying to Heroku, please run the following command to set your secret token: - heroku config:add SECRET_TOKEN="$(bundle exec rake secret)" - - If you are deploying in some other way, please run the following command to generate a new secret token, - and commit the new `config/initializers/__secret_token.rb`: - - echo "Errbit::Application.config.secret_token = '$(bundle exec rake secret)'" > config/initializers/__secret_token.rb - - ERROR -end - -Devise.secret_key = Errbit::Application.config.secret_token diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 33c0e3a..b00aaf0 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,9 +1,8 @@ # Be sure to restart your server when you modify this file. -Errbit::Application.config.session_store :cookie_store, :key => '_errbit_session' +Rails.application.config.session_store :cookie_store, key: '_errbit_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with "rake db:sessions:create") -# Errbit::Application.config.session_store :active_record_store - +# Rails.application.config.session_store :active_record_store diff --git a/config/initializers/ssl_enforcer.rb b/config/initializers/ssl_enforcer.rb index 03c8ed8..d950a5f 100755 --- a/config/initializers/ssl_enforcer.rb +++ b/config/initializers/ssl_enforcer.rb @@ -2,7 +2,7 @@ if Errbit::Config.enforce_ssl require 'rack/ssl-enforcer' ActionMailer::Base.default_url_options.merge!(:protocol => 'https://') - Errbit::Application.configure do + Rails.application.configure do config.middleware.use Rack::SslEnforcer, :except => /^\/deploys/ end end diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..33725e9 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. + +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters format: [:json] if respond_to?(:wrap_parameters) +end + +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end diff --git a/config/routes.rb b/config/routes.rb index d45faac..3305bc0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -Errbit::Application.routes.draw do +Rails.application.routes.draw do devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } diff --git a/config/secrets.yml b/config/secrets.yml new file mode 100644 index 0000000..121bd8a --- /dev/null +++ b/config/secrets.yml @@ -0,0 +1,22 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rake secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: f258ed69266dc8ad0ca79363c3d2f945c388a9c5920fc9a1ae99a98fbb619f135001c6434849b625884a9405a60cd3d50fc3e3b07ecd38cbed7406a4fccdb59c + +test: + secret_key_base: f258ed69266dc8ad0ca79363c3d2f945c388a9c5920fc9a1ae99a98fbb619f135001c6434849b625884a9405a60cd3d50fc3e3b07ecd38cbed7406a4fccdb59c + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> -- libgit2 0.21.2