maven_logger 0.0.1.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +49 -0
- data/Rakefile +20 -0
- data/config/locales/en.yml +7 -0
- data/lib/generators/maven_logger/install_generator.rb +25 -0
- data/lib/generators/templates/logger_entry.rb +22 -0
- data/lib/generators/templates/logger_schema.rb +12 -0
- data/lib/generators/templates/maven_logger.rb +9 -0
- data/lib/maven_logger/action.rb +19 -0
- data/lib/maven_logger/engine.rb +24 -0
- data/lib/maven_logger/initializer.rb +12 -0
- data/lib/maven_logger/redefiner.rb +59 -0
- data/lib/maven_logger/schema.rb +20 -0
- data/lib/maven_logger/version.rb +3 -0
- data/lib/maven_logger.rb +13 -0
- data/lib/tasks/maven_logger_tasks.rake +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/posts_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/models/logger_entry.rb +22 -0
- data/spec/dummy/app/models/logger_schema.rb +12 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +24 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/maven_logger.rb +9 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/locales/maven_logger.en.yml +9 -0
- data/spec/dummy/config/mongoid.yml +86 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/log/test.log +185 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/logger_spec.rb +42 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/mongoid.rb +3 -0
- metadata +237 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a75fedeba0df43a70e64852c3dbf330f5d8cf837
|
4
|
+
data.tar.gz: 3101f0d0129e0304abaa3c918bd87974b472740a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 06584688213c1d96a6f6f93ee3770bd5d98c7b4fd8403b8f64d0922bd6042e099726a67fd7ba180ca4a6e957a62225ea2bbb90d7a14efc45f8653383ad97998d
|
7
|
+
data.tar.gz: 31fae3f5b95f05516bb0da65d4b85648b2a19e634e5d9e6ac4d0ec3f0649547e6e58685c9d5e61cf6459bbcfbe976488ba70012efc475bde48c9fabe58437846
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
= MavenLogger
|
2
|
+
|
3
|
+
Easily logger for mongoid
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
MavenLogger requires you to have a LoggerEntry and LoggerSchema models.
|
8
|
+
The simplest way is to use the generator for install maven_logger:
|
9
|
+
|
10
|
+
rails generate maven_logger:install
|
11
|
+
|
12
|
+
Next step is to determine in config maven_logger.rb file what generates an event in your various classes.
|
13
|
+
|
14
|
+
MavenLogger.setup do |config|
|
15
|
+
config.class_actions = [
|
16
|
+
[PostsController, %i[new create]],
|
17
|
+
[Post, %i[import]],
|
18
|
+
...
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
and add description text to maven_logger.en.yml that should be written in description in LoggerEntry
|
23
|
+
Name of locale method should contain name of class with underscore. For example:
|
24
|
+
|
25
|
+
maven_logger:
|
26
|
+
posts_controller:
|
27
|
+
new: 'new post event called'
|
28
|
+
create: 'post created'
|
29
|
+
post:
|
30
|
+
import: 'the new post imported'
|
31
|
+
|
32
|
+
You can add schema statements to classes to log some info about it.
|
33
|
+
For example to save of count results:
|
34
|
+
|
35
|
+
class LoggerSchema < MavenLogger::Schema
|
36
|
+
add_schema_for Post, :import, :data_fetched
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def self.data_fetched(result)
|
41
|
+
{ count: result.count }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
== Credits
|
46
|
+
|
47
|
+
Thank you, Arkadiy Butermanov for sharing your modules and other scripts from which I derived inspiration for items in this project.
|
48
|
+
|
49
|
+
Copyright (c) 2014 Ildus Sadykov. It is free software and may be redistributed under the terms specified in the MIT-LICENSE file.
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
8
|
+
load 'rails/tasks/engine.rake'
|
9
|
+
|
10
|
+
Bundler::GemHelper.install_tasks
|
11
|
+
|
12
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
|
13
|
+
|
14
|
+
require 'rspec/core'
|
15
|
+
require 'rspec/core/rake_task'
|
16
|
+
|
17
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
18
|
+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
19
|
+
|
20
|
+
task :default => :spec
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
require 'securerandom'
|
3
|
+
|
4
|
+
module MavenLogger
|
5
|
+
module Generators
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path('../../templates', __FILE__)
|
8
|
+
|
9
|
+
desc 'Creates a MavenLogger initializer and copy locale files to your application.'
|
10
|
+
|
11
|
+
def copy_initializer
|
12
|
+
template 'maven_logger.rb', 'config/initializers/maven_logger.rb'
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_locale
|
16
|
+
copy_file '../../../config/locales/en.yml', 'config/locales/maven_logger.en.yml'
|
17
|
+
end
|
18
|
+
|
19
|
+
def copy_models
|
20
|
+
copy_file 'logger_entry.rb', 'app/models/logger_entry.rb'
|
21
|
+
copy_file 'logger_schema.rb', 'app/models/logger_schema.rb'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class LoggerEntry
|
2
|
+
include Mongoid::Document
|
3
|
+
include Mongoid::Timestamps
|
4
|
+
|
5
|
+
field :object_type, type: String
|
6
|
+
field :object_id, type: String
|
7
|
+
field :action_type, type: String
|
8
|
+
field :description, type: String
|
9
|
+
field :data, type: Hash
|
10
|
+
|
11
|
+
attr_accessor :result
|
12
|
+
|
13
|
+
before_create :prepare_result
|
14
|
+
|
15
|
+
validates :object_type, :object_id, :action_type, :description, presence: true
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def prepare_result
|
20
|
+
self.data = LoggerSchema.prepare(self)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class LoggerSchema < MavenLogger::Schema
|
2
|
+
# add some schema for classes
|
3
|
+
# add_schema_for SomeClass, :some_action, :some_method
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
# WARNING: These methods should be whitelisted in RBP
|
8
|
+
|
9
|
+
#def self.some_method(result)
|
10
|
+
# { some_info: result }
|
11
|
+
#end
|
12
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module MavenLogger
|
2
|
+
module Action
|
3
|
+
def add_action(logged_methods)
|
4
|
+
logged_methods.each do |method_name|
|
5
|
+
if instance_methods.include?(method_name)
|
6
|
+
Redefiner.redefine_instance_method(
|
7
|
+
self,
|
8
|
+
method_name
|
9
|
+
)
|
10
|
+
else
|
11
|
+
Redefiner.redefine_class_method(
|
12
|
+
self,
|
13
|
+
method_name
|
14
|
+
)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module MavenLogger
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
#isolate_namespace MavenLogger
|
4
|
+
config.maven_logger = MavenLogger
|
5
|
+
|
6
|
+
config.generators do |g|
|
7
|
+
g.test_framework :rspec, :fixture => false
|
8
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
9
|
+
g.assets false
|
10
|
+
g.helper false
|
11
|
+
g.orm :mongoid
|
12
|
+
end
|
13
|
+
|
14
|
+
initializer 'maven_logger.logger_configure' do
|
15
|
+
Initializer.configure do |config|
|
16
|
+
MavenLogger.class_actions.each do |class_name, actions|
|
17
|
+
config.log_class class_name do |klass|
|
18
|
+
klass.add_action actions
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module MavenLogger
|
2
|
+
module Redefiner
|
3
|
+
def self.redefine_instance_method(mixer_class, method_name)
|
4
|
+
original_method = "#{method_name}_original"
|
5
|
+
|
6
|
+
mixer_class.class_eval do
|
7
|
+
alias_method original_method, method_name
|
8
|
+
|
9
|
+
send :define_method, method_name do |*args|
|
10
|
+
result = send(original_method, *args)
|
11
|
+
MavenLogger::Redefiner.create_log_entry(
|
12
|
+
mixer_class,
|
13
|
+
method_name,
|
14
|
+
result
|
15
|
+
)
|
16
|
+
result
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.redefine_class_method(mixer_class, method_name)
|
22
|
+
name = "#{name}_original"
|
23
|
+
|
24
|
+
mixer_class.instance_eval do
|
25
|
+
mixer_class.singleton_class.send(:alias_method, name, method_name)
|
26
|
+
|
27
|
+
mixer_class.singleton_class.send :define_method, method_name do |*args|
|
28
|
+
result = send(name.to_s, *args)
|
29
|
+
MavenLogger::Redefiner.create_log_entry(
|
30
|
+
mixer_class,
|
31
|
+
method_name,
|
32
|
+
result
|
33
|
+
)
|
34
|
+
result
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.create_log_entry(mixer_class, method_name, result)
|
40
|
+
if mixer_class.respond_to?(:id)
|
41
|
+
object_id = mixer_class.id
|
42
|
+
else
|
43
|
+
object_id = mixer_class.object_id
|
44
|
+
end
|
45
|
+
|
46
|
+
log_name = mixer_class.to_s.demodulize.underscore
|
47
|
+
|
48
|
+
log_info = {
|
49
|
+
object_type: mixer_class.to_s,
|
50
|
+
object_id: object_id,
|
51
|
+
action_type: method_name.to_s,
|
52
|
+
description: I18n.t("maven_logger.#{log_name}.#{method_name}"),
|
53
|
+
result: result
|
54
|
+
}
|
55
|
+
|
56
|
+
LoggerEntry.create(log_info)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module MavenLogger
|
2
|
+
class Schema
|
3
|
+
cattr_accessor :schema
|
4
|
+
self.schema = {}
|
5
|
+
|
6
|
+
def self.prepare(entry)
|
7
|
+
class_name = entry.object_type.underscore.to_sym
|
8
|
+
method_name = entry.action_type.to_sym
|
9
|
+
|
10
|
+
send(schema[class_name][method_name], entry.result) if schema[class_name] && schema[class_name][method_name]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.add_schema_for(klass, method, handler)
|
14
|
+
class_name = klass.name.underscore.to_sym
|
15
|
+
schema[class_name] = {} unless schema[class_name]
|
16
|
+
|
17
|
+
schema[class_name][method] = handler
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/maven_logger.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'maven_logger/action'
|
2
|
+
require 'maven_logger/engine'
|
3
|
+
require 'maven_logger/initializer'
|
4
|
+
require 'maven_logger/redefiner'
|
5
|
+
require 'maven_logger/schema'
|
6
|
+
|
7
|
+
module MavenLogger
|
8
|
+
mattr_accessor :class_actions
|
9
|
+
|
10
|
+
def self.setup
|
11
|
+
yield self
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class LoggerEntry
|
2
|
+
include Mongoid::Document
|
3
|
+
include Mongoid::Timestamps
|
4
|
+
|
5
|
+
field :object_type, type: String
|
6
|
+
field :object_id, type: String
|
7
|
+
field :action_type, type: String
|
8
|
+
field :description, type: String
|
9
|
+
field :data, type: Hash
|
10
|
+
|
11
|
+
attr_accessor :result
|
12
|
+
|
13
|
+
before_create :prepare_result
|
14
|
+
|
15
|
+
validates :object_type, :object_id, :action_type, :description, presence: true
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def prepare_result
|
20
|
+
self.data = LoggerSchema.prepare(self)
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class LoggerSchema < MavenLogger::Schema
|
2
|
+
# add some schema for classes
|
3
|
+
# add_schema_for SomeClass, :some_action, :some_method
|
4
|
+
|
5
|
+
private
|
6
|
+
|
7
|
+
# WARNING: These methods should be whitelisted in RBP
|
8
|
+
|
9
|
+
#def self.some_method(result)
|
10
|
+
# { some_info: result }
|
11
|
+
#end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "action_controller/railtie"
|
4
|
+
require "action_mailer/railtie"
|
5
|
+
|
6
|
+
Bundler.require(*Rails.groups)
|
7
|
+
require "maven_logger"
|
8
|
+
|
9
|
+
module Dummy
|
10
|
+
class Application < Rails::Application
|
11
|
+
# Settings in config/environments/* take precedence over those specified here.
|
12
|
+
# Application configuration should go into files in config/initializers
|
13
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
|
+
|
15
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
16
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
17
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
18
|
+
|
19
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
20
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
21
|
+
# config.i18n.default_locale = :de
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both thread web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
+
# config.action_dispatch.rack_cache = true
|
21
|
+
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.js_compressor = :uglifier
|
27
|
+
# config.assets.css_compressor = :sass
|
28
|
+
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
+
config.assets.compile = false
|
31
|
+
|
32
|
+
# Generate digests for assets URLs.
|
33
|
+
config.assets.digest = true
|
34
|
+
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
36
|
+
config.assets.version = '1.0'
|
37
|
+
|
38
|
+
# Specifies the header that your server uses for sending files.
|
39
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
+
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
+
# config.force_ssl = true
|
44
|
+
|
45
|
+
# Set to :debug to see everything in the log.
|
46
|
+
config.log_level = :info
|
47
|
+
|
48
|
+
# Prepend all log lines with the following tags.
|
49
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
+
|
51
|
+
# Use a different logger for distributed setups.
|
52
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
+
|
54
|
+
# Use a different cache store in production.
|
55
|
+
# config.cache_store = :mem_cache_store
|
56
|
+
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
+
|
60
|
+
# Precompile additional assets.
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
+
# config.assets.precompile += %w( search.js )
|
63
|
+
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
66
|
+
# config.action_mailer.raise_delivery_errors = false
|
67
|
+
|
68
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
70
|
+
config.i18n.fallbacks = true
|
71
|
+
|
72
|
+
# Send deprecation notices to registered listeners.
|
73
|
+
config.active_support.deprecation = :notify
|
74
|
+
|
75
|
+
# Disable automatic flushing of the log to improve performance.
|
76
|
+
# config.autoflush_log = false
|
77
|
+
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
80
|
+
end
|