app:update and modifying configurations

This commit is contained in:
shlok007 2016-08-10 17:20:10 -04:00
parent 81ef17f346
commit 519a3616ac
25 changed files with 364 additions and 167 deletions

3
bin/bundle Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')

View file

@ -1,6 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands' require 'rails/commands'

4
bin/rake Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run

34
bin/setup Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end

29
bin/update Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
puts "\n== Updating database =="
system! 'bin/rails db:migrate'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end

View file

@ -1,14 +1,10 @@
require File.expand_path('../boot', __FILE__) require_relative 'boot'
require 'rails/all' require 'rails/all'
include ActionView::Helpers::NumberHelper
if defined?(Bundler) # Require the gems listed in Gemfile, including any gems
# If you precompile assets before deploying to production, use this line # you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups(assets: %w(development test))) Bundler.require(*Rails.groups)
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
module Osem module Osem
class Application < Rails::Application class Application < Rails::Application
@ -16,26 +12,11 @@ module Osem
# Application configuration should go into files in config/initializers # Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded. # -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# 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 ]
# Activate observers that should always be running. # Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
config.active_record.observers = :revision_observer config.active_record.observers = :revision_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Configure the default encoding used in templates for Ruby 2.3.1.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = 'utf-8' config.encoding = 'utf-8'
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
@ -44,23 +25,9 @@ module Osem
# Enable escaping HTML in JSON. # Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true config.active_support.escape_html_entities_in_json = true
# Use SQL instead of Active Record's schema dumper when creating the 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
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
# config.active_record.whitelist_attributes = true
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' config.assets.version = '1.0'
# Errors raised within `after_rollback`/`after_commit` propagate normally # Errors raised within `after_rollback`/`after_commit` propagate normally
# like in other Active Record callbacks. # like in other Active Record callbacks.
config.active_record.raise_in_transactional_callbacks = true config.active_record.raise_in_transactional_callbacks = true

View file

@ -1,4 +1,3 @@
# Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) # Set up gems listed in the Gemfile.

9
config/cable.yml Normal file
View file

@ -0,0 +1,9 @@
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: redis://localhost:6379/1

View file

@ -1,5 +1,5 @@
# Load the rails application # Load the Rails application.
require File.expand_path('../application', __FILE__) require_relative 'application'
# Load the configuration file # Load the configuration file
path = Rails.root.join('config', 'config.yml') path = Rails.root.join('config', 'config.yml')
@ -21,5 +21,5 @@ bundle exec rake data:migrate:config2dotenv RAILS_ENV=production
" "
end end
# Initialize the rails application # Initialize the Rails application.
Osem::Application.initialize! Rails.application.initialize!

View file

@ -1,5 +1,5 @@
Osem::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb.
# Use letter_opener_web for Vagrant (launchy won't work) # Use letter_opener_web for Vagrant (launchy won't work)
config.action_mailer.delivery_method = ENV['USER'] == 'vagrant' ? :letter_opener_web : :letter_opener config.action_mailer.delivery_method = ENV['USER'] == 'vagrant' ? :letter_opener_web : :letter_opener
@ -9,33 +9,54 @@ Osem::Application.configure do
# since you don't have to restart the web server when you make code changes. # since you don't have to restart the web server when you make code changes.
config.cache_classes = false config.cache_classes = false
# 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
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
# Raise exception on mass assignment protection for Active Record models
# config.active_record.mass_assignment_sanitizer = :strict
# Do not compress assets
config.assets.compress = false
# Expands the lines which load the assets
config.assets.debug = true
# Do not eager load code on boot. # Do not eager load code on boot.
config.eager_load = false config.eager_load = false
# Set the detault url for action mailer # Show full error reports.
config.action_mailer.default_url_options = { host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000') } config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
*# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Do not compress assets
config.assets.compress = false
# 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
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Set the secret key base if it's not set via other means # Set the secret key base if it's not set via other means
config.secret_key_base ||= 'f4be765bc98e516de82ac01daa8f8aa11c5ca13cb6c911887851ac89457b6c0b056b2361a21b5c08926c9386e0f91eef84fc0b103d522bf00bc0c78ea8ce7c58' config.secret_key_base ||= 'f4be765bc98e516de82ac01daa8f8aa11c5ca13cb6c911887851ac89457b6c0b056b2361a21b5c08926c9386e0f91eef84fc0b103d522bf00bc0c78ea8ce7c58'

View file

@ -1,86 +1,96 @@
Osem::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests # Code is not reloaded between requests.
config.cache_classes = true config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Eager load code on boot. This eager loads most of Rails and # Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers # your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better. # and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance. # Rake tasks automatically ignore this option for performance.
config.eager_load = true config.eager_load = true
# Disable Rails's static asset server (Apache or nginx will already do this) # Full error reports are disabled and caching is turned on.
config.serve_static_files = false config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = false
# Compress JavaScripts and CSS # Compress JavaScripts and CSS
config.assets.compress = true config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed # Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false config.assets.compile = false
# Generate digests for assets URLs # Generate digests for assets URLs
config.assets.digest = true config.assets.digest = true
# Defaults to nil and saved in location specified by config.assets.prefix # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# config.assets.manifest = YOUR_PATH
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# 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
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Specifies the header that your server uses for sending files # 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-Sendfile' # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # Use the lowest log level to ensure availability of diagnostic information
# config.force_ssl = true # when problems arise.
config.log_level = :debug
# See everything in the log (default is :info) # Prepend all log lines with the following tags.
# config.log_level = :debug config.log_tags = [ :request_id ]
# Prepend all log lines with the following tags # Use a different cache store in production.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server # Use a real queuing backend for Active Job (and separate queues per environment)
# config.action_controller.asset_host = "http://assets.example.com" # config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "osem_#{Rails.env}"
config.action_mailer.perform_caching = false
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) # Ignore bad email addresses and do not raise email delivery errors.
# config.assets.precompile += %w( search.js ) # Set this to true and configure the email server for immediate delivery to raise delivery errors.
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false # config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to # 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 config.i18n.fallbacks = true
# Send deprecation notices to registered listeners # Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify config.active_support.deprecation = :notify
# Set the detault url for action mailer # Use default logging formatter so that PID and timestamp are not suppressed.
config.action_mailer.default_url_options = { host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000') } config.log_formatter = ::Logger::Formatter.new
# Set the smtp configuration of your service provider # Use a different logger for distributed setups.
# For further details of each configuration checkout: http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration # require 'syslog/logger'
config.action_mailer.smtp_settings = { # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
address: ENV['OSEM_SMTP_ADDRESS'],
port: ENV['OSEM_SMTP_PORT'],
user_name: ENV['OSEM_SMTP_USERNAME'],
password: ENV['OSEM_SMTP_PASSWORD'],
authentication: ENV['OSEM_SMTP_AUTHENTICATION'].try(:to_sym),
domain: ENV['OSEM_SMTP_DOMAIN'],
enable_starttls_auto: true
}
# Set the secret_key_base from the env, if not set by any other means if ENV["RAILS_LOG_TO_STDOUT"].present?
config.secret_key_base ||= ENV["SECRET_KEY_BASE"] logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end end

View file

@ -1,5 +1,5 @@
Osem::Application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb # Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's # 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
@ -7,43 +7,48 @@ Osem::Application.configure do
# 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 config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance config.active_support.test_order = :sorted
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Do not eager load code on boot. # 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 config.eager_load = false
# Show full error reports and disable caching # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600'
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false 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 config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment # Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world. # Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array. # ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
# Raise exception on mass assignment protection for Active Record models
# config.active_record.mass_assignment_sanitizer = :strict
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
# Set the detault url for action mailer
config.action_mailer.default_url_options = { host: 'localhost:3000' }
# Do not perform deliveries on test # Do not perform deliveries on test
config.action_mailer.perform_deliveries = false config.action_mailer.perform_deliveries = false
# Set the detault url for action mailer
config.action_mailer.default_url_options = { host: 'localhost:3000' }
# Set the secret key base if it's not set via other means # Set the secret key base if it's not set via other means
config.secret_key_base ||= 'f4be765bc98e516de82ac01daa8f8aa11c5ca13cb6c911887851ac89457b6c0b056b2361a21b5c08926c9386e0f91eef84fc0b103d522bf00bc0c78ea8ce7c58' config.secret_key_base ||= 'f4be765bc98e516de82ac01daa8f8aa11c5ca13cb6c911887851ac89457b6c0b056b2361a21b5c08926c9386e0f91eef84fc0b103d522bf00bc0c78ea8ce7c58'
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
config.after_initialize do config.after_initialize do
ActiveRecord::Base.logger = nil ActiveRecord::Base.logger = nil
# Set Time.now to May 1, 2014 00:01:00 AM (at this instant), but allow it to move forward # Set Time.now to May 1, 2014 00:01:00 AM (at this instant), but allow it to move forward
@ -52,4 +57,7 @@ Osem::Application.configure do
ActiveSupport::Deprecation.silenced = true ActiveSupport::Deprecation.silenced = true
end end
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end end

View file

@ -0,0 +1,6 @@
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )

View file

@ -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'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# 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 )

View file

@ -0,0 +1,5 @@
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json

View file

@ -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]

View file

@ -1,15 +1,16 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format # Add new inflection rules using the following format. Inflections
# (all these examples are active by default): # are locale specific, and you may define rules for as many different
# ActiveSupport::Inflector.inflections do |inflect| # locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en' # inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1' # inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people' # inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep ) # inflect.uncountable %w( fish sheep )
# end # end
#
# These inflection rules are supported but not enabled by default: # These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections do |inflect| # ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful' # inflect.acronym 'RESTful'
# end # end

View file

@ -2,4 +2,3 @@
# Add new mime types for use in respond_to blocks: # Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf # Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone

View file

@ -0,0 +1,23 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = false
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = false
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = false
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = true

View file

@ -1,8 +1,3 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
Osem::Application.config.session_store :cookie_store, key: '_osem_session' Rails.application.config.session_store :cookie_store, key: '_osem_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 "rails generate session_migration")
# Osem::Application.config.session_store :active_record_store

View file

@ -1,5 +1,5 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which # This file contains settings for ActionController::ParamsWrapper which
# is enabled by default. # is enabled by default.
@ -8,7 +8,7 @@ ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] wrap_parameters format: [:json]
end end
# Disable root element in JSON by default. # To enable root element in JSON for ActiveRecord objects.
ActiveSupport.on_load(:active_record) do # ActiveSupport.on_load(:active_record) do
self.include_root_in_json = false # self.include_root_in_json = true
end # end

View file

@ -1,8 +1,26 @@
# Sample localization file for English. Add more files in this directory for other locales. # Files in the config/locales directory are used for internationalization
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. # and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en: en:
hello: "Hello world" hello: "Hello world"
time: time:
formats: formats:
short: "%Y-%m-%dT%H:%M:%S" short: "%Y-%m-%dT%H:%M:%S"

47
config/puma.rb Normal file
View file

@ -0,0 +1,47 @@
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
# option you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby
# cannot share connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

View file

@ -1,5 +1,5 @@
Osem::Application.routes.draw do Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
if ENV['OSEM_ICHAIN_ENABLED'] == 'true' if ENV['OSEM_ICHAIN_ENABLED'] == 'true'
devise_for :users, controllers: { registrations: :registrations } devise_for :users, controllers: { registrations: :registrations }
else else

6
config/spring.rb Normal file
View file

@ -0,0 +1,6 @@
%w(
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
).each { |path| Spring.watch(path) }