rails-controller-assets 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +35 -0
- data/Rakefile +26 -0
- data/lib/rails-controller-assets.rb +1 -0
- data/lib/rails_controller_assets/controller_assets_helper.rb +71 -0
- data/lib/rails_controller_assets/engine.rb +12 -0
- data/lib/rails_controller_assets/precompiler.rb +63 -0
- data/lib/rails_controller_assets/version.rb +3 -0
- data/lib/rails_controller_assets.rb +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +1 -0
- data/spec/dummy/app/assets/javascripts/comments_index.js +1 -0
- data/spec/dummy/app/assets/javascripts/posts.js +1 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/comments_index.css +1 -0
- data/spec/dummy/app/assets/stylesheets/posts.css +1 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/comments_controller.rb +3 -0
- data/spec/dummy/app/controllers/posts_controller.rb +2 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -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 +14 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -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/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/routes.rb +56 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -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/assets/application-be76c17ef80a57c5a75a6b5386fae588.css +16 -0
- data/spec/dummy/public/assets/application-be76c17ef80a57c5a75a6b5386fae588.css.gz +0 -0
- data/spec/dummy/public/assets/application-c6ccfb97230df9a638c94fcda47ec572.js +2 -0
- data/spec/dummy/public/assets/application-c6ccfb97230df9a638c94fcda47ec572.js.gz +0 -0
- data/spec/dummy/public/assets/comments_index-ccfb097412d4349399feb80f110472d7.js +1 -0
- data/spec/dummy/public/assets/comments_index-ccfb097412d4349399feb80f110472d7.js.gz +0 -0
- data/spec/dummy/public/assets/comments_index-f6e5ecbeedbb4d0236b2a90c42a70c2a.css +1 -0
- data/spec/dummy/public/assets/comments_index-f6e5ecbeedbb4d0236b2a90c42a70c2a.css.gz +0 -0
- data/spec/dummy/public/assets/manifest-56281636a8877a2bccb62ed5735d8c69.json +1 -0
- data/spec/dummy/public/assets/posts-5c2cbfb9aa866a49bc73f0aabe462942.css +1 -0
- data/spec/dummy/public/assets/posts-5c2cbfb9aa866a49bc73f0aabe462942.css.gz +0 -0
- data/spec/dummy/public/assets/posts-6003715dc6a2a0bc732e57a79f59c270.js +1 -0
- data/spec/dummy/public/assets/posts-6003715dc6a2a0bc732e57a79f59c270.js.gz +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1e8f75a6b5b33970fb8e397347caa0a1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/24204f742af588c8166d3160b500d20f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/62900b09db994747c646c1a8a2cad2ae +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7ddd06f06023365be23872cb5768ceb9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8f8dc63ea45a2e403e10a0625e75c81b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ad62e50a8bf2623c0cb5b8e285e1acd3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c43e417f6b59ee20425870f841e1363d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d066c004d1fd26ae76a61303a7a18145 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f3797dd294a807eec294aa8bd1f8363f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1e8f75a6b5b33970fb8e397347caa0a1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/24204f742af588c8166d3160b500d20f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3ba4d260ef2acf31fa4f8ecdbbb742de +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/416150dc3ac35079c94273cc46e90aa6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5384ad85f52d3272dbc64d46ef3876a4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/62900b09db994747c646c1a8a2cad2ae +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7ddd06f06023365be23872cb5768ceb9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8b1bcae374c481a3ccafebe5018932e2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8f8dc63ea45a2e403e10a0625e75c81b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ad62e50a8bf2623c0cb5b8e285e1acd3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c43e417f6b59ee20425870f841e1363d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c85016e7bbd4f3adbb7635d01f85d39b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d066c004d1fd26ae76a61303a7a18145 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e6af6faede0b3537396eb6b6048506a6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f3797dd294a807eec294aa8bd1f8363f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/integration/precompile_spec.rb +41 -0
- data/spec/spec_helper.rb +12 -0
- metadata +253 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 81055161486ff2971a4e360f78ca1322a1c3d16f
|
4
|
+
data.tar.gz: c95aa373cc72d0e50096fdaa65a3a4a9487ad01b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dc341a48218318768182404e0f265715544028dc52395af6ea85935afcc627d737460892987fe174dfc430f9e6aea3bc7fd8eafa0e2938089b829227843a551d
|
7
|
+
data.tar.gz: af5cdf8b9ffce841445aaf25f027319a57c3709a7b52eb3a9cc3a5b13af0ba341db8bdb6676ee98465adf6072b5f297b072bcc3089480a5052f08eab7537a499
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Piotr Usewicz
|
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.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# RailsControllerAssets
|
2
|
+
|
3
|
+
This gems allows to automatically precompile bundles of assets per controller or controller/action pair.
|
4
|
+
|
5
|
+
It's great when you want to keep action or controller specific CSS/JavaScript in a separate file.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
In your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rails-controller-assets'
|
13
|
+
```
|
14
|
+
|
15
|
+
Create new bundle files (eg. like application.css) for a `PostsController`:
|
16
|
+
|
17
|
+
In `app/assets/stylesheets/posts.css`:
|
18
|
+
|
19
|
+
```css
|
20
|
+
.post-title { color: red }
|
21
|
+
```
|
22
|
+
|
23
|
+
In your application layout add to your stylesheets definition:
|
24
|
+
|
25
|
+
```erb
|
26
|
+
<%= stylesheets_link_tag 'application', *controller_stylesheets %>
|
27
|
+
<%= javascript_include_tag 'application', *controller_javascripts %>
|
28
|
+
```
|
29
|
+
|
30
|
+
And that's it!
|
31
|
+
|
32
|
+
The gem will look for bundle files that match:
|
33
|
+
|
34
|
+
* `{controller_name}.{js|css}`
|
35
|
+
* `{controller_name}_{action_name}.{js|css}`
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
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
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'RailsControllerAssets'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
Bundler::GemHelper.install_tasks
|
21
|
+
|
22
|
+
require 'rspec/core/rake_task'
|
23
|
+
|
24
|
+
RSpec::Core::RakeTask.new(:spec)
|
25
|
+
|
26
|
+
task :default => :spec
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'rails_controller_assets'
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module RailsControllerAssets::ControllerAssetsHelper
|
2
|
+
def controller_stylesheets
|
3
|
+
styles = []
|
4
|
+
styles << controller_stylesheet if controller_stylesheet?
|
5
|
+
styles << controller_and_action_stylesheet if controller_and_action_stylesheet?
|
6
|
+
styles
|
7
|
+
end
|
8
|
+
|
9
|
+
def controller_and_action
|
10
|
+
[controller_path, action_name].join('_')
|
11
|
+
end
|
12
|
+
|
13
|
+
def controller_stylesheet?
|
14
|
+
controller_asset?(:css)
|
15
|
+
end
|
16
|
+
|
17
|
+
def controller_and_action_stylesheet?
|
18
|
+
controller_and_action_asset?(:css)
|
19
|
+
end
|
20
|
+
|
21
|
+
def controller_javascripts
|
22
|
+
scripts = []
|
23
|
+
scripts << controller_javascript if controller_javascript?
|
24
|
+
scripts << controller_and_action_javascript if controller_and_action_javascript?
|
25
|
+
scripts
|
26
|
+
end
|
27
|
+
|
28
|
+
def controller_javascript?
|
29
|
+
controller_asset?(:js)
|
30
|
+
end
|
31
|
+
|
32
|
+
def controller_and_action_javascript?
|
33
|
+
controller_and_action_asset?(:js)
|
34
|
+
end
|
35
|
+
|
36
|
+
def controller_asset?(type)
|
37
|
+
Rails.application.assets.find_asset(controller_asset(type))
|
38
|
+
end
|
39
|
+
|
40
|
+
def controller_and_action_asset?(type)
|
41
|
+
Rails.application.assets.find_asset(controller_and_action_asset(type))
|
42
|
+
end
|
43
|
+
|
44
|
+
def controller_asset(type)
|
45
|
+
"#{controller_path}.#{type}"
|
46
|
+
end
|
47
|
+
|
48
|
+
def controller_and_action_asset(type)
|
49
|
+
"#{controller_and_action}.#{type}"
|
50
|
+
end
|
51
|
+
|
52
|
+
def controller_javascript
|
53
|
+
controller_asset(:js)
|
54
|
+
end
|
55
|
+
|
56
|
+
def controller_and_action_javascript
|
57
|
+
controller_and_action_asset(:js)
|
58
|
+
end
|
59
|
+
|
60
|
+
def controller_stylesheet
|
61
|
+
controller_asset(:css)
|
62
|
+
end
|
63
|
+
|
64
|
+
def controller_and_action_stylesheet
|
65
|
+
controller_and_action_asset(:css)
|
66
|
+
end
|
67
|
+
|
68
|
+
def skip_controller_stylesheet!
|
69
|
+
stylesheet_bundles.delete(controller_stylesheet)
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rails_controller_assets/precompiler'
|
2
|
+
require 'rails_controller_assets/controller_assets_helper'
|
3
|
+
|
4
|
+
module RailsControllerAssets
|
5
|
+
class Engine < ::Rails::Engine
|
6
|
+
config.assets.precompile << RailsControllerAssets::Precompiler.new
|
7
|
+
|
8
|
+
config.to_prepare do
|
9
|
+
ApplicationController.helper(RailsControllerAssets::ControllerAssetsHelper)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class RailsControllerAssets::Precompiler
|
2
|
+
def call(asset, filename)
|
3
|
+
return false unless filename =~ /\/app\/assets/
|
4
|
+
if include?(asset)
|
5
|
+
puts "Including #{asset}"
|
6
|
+
true
|
7
|
+
else
|
8
|
+
false
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def arity
|
13
|
+
2
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def controller_paths
|
19
|
+
@controller_paths ||= find_controller_paths
|
20
|
+
end
|
21
|
+
|
22
|
+
def controller_actions
|
23
|
+
@controller_actions ||= find_controller_actions
|
24
|
+
end
|
25
|
+
|
26
|
+
def include?(asset)
|
27
|
+
return false unless asset =~ /\.(css|js)\z/
|
28
|
+
return false if partial?(asset)
|
29
|
+
|
30
|
+
controller_asset?(asset) || action_asset?(asset)
|
31
|
+
end
|
32
|
+
|
33
|
+
def partial?(asset)
|
34
|
+
asset.split('/').last.start_with?('_')
|
35
|
+
end
|
36
|
+
|
37
|
+
def controller_asset?(asset)
|
38
|
+
controller_paths.any? { |path| asset.include?(path) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def action_asset?(asset)
|
42
|
+
controller_actions.any? { |action| asset.include?(action) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def controllers
|
46
|
+
@eager_load ||= Rails.application.eager_load!
|
47
|
+
@controllers ||= ::ActionController::Base.descendants
|
48
|
+
end
|
49
|
+
|
50
|
+
def find_controller_actions
|
51
|
+
controllers.map do |controller|
|
52
|
+
controller.action_methods.map do |action|
|
53
|
+
"#{controller.controller_path}_#{action}"
|
54
|
+
end
|
55
|
+
end.flatten
|
56
|
+
end
|
57
|
+
|
58
|
+
def find_controller_paths
|
59
|
+
controllers.map do |controller|
|
60
|
+
controller.controller_path
|
61
|
+
end
|
62
|
+
end
|
63
|
+
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 @@
|
|
1
|
+
// Nothing to watch here
|
@@ -0,0 +1 @@
|
|
1
|
+
CommentsIndex = function() {};
|
@@ -0,0 +1 @@
|
|
1
|
+
Posts = function() {};
|
@@ -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 @@
|
|
1
|
+
body#comments-index {}
|
@@ -0,0 +1 @@
|
|
1
|
+
body#posts {}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", *controller_stylesheets, media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", *controller_javascripts, "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,14 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'action_controller/railtie'
|
4
|
+
require 'sprockets/railtie'
|
5
|
+
|
6
|
+
Bundler.require(*Rails.groups)
|
7
|
+
require 'rails_controller_assets'
|
8
|
+
|
9
|
+
module Dummy
|
10
|
+
class Application < Rails::Application
|
11
|
+
config.assets.digest = false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -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
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
# config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr.
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = '7c1650c3a83bb6dc05d3b96a370facd237af7e59b768663a7a6c2c20846e3178dc0ae11a6baaf9f0c75a00b231946cb935f4623323ded000ac6c68d80b264338'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|