noodall-articles 1.0.0
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.
- data/MIT-LICENSE +20 -0
- data/README.markdown +33 -0
- data/Rakefile +39 -0
- data/app/assets/javascripts/noodall-articles/categories.js +7 -0
- data/app/controllers/admin/categories_controller.rb +7 -0
- data/app/helpers/articles_helper.rb +126 -0
- data/app/models/article.rb +58 -0
- data/app/models/article_list.rb +49 -0
- data/app/models/latest_articles.rb +28 -0
- data/app/views/admin/components/_latest_articles.html.erb +21 -0
- data/app/views/admin/nodes/_article.html.erb +55 -0
- data/app/views/admin/nodes/_article_list.html.erb +45 -0
- data/app/views/application/_article_sidebar.html.erb +74 -0
- data/app/views/components/_latest_articles.html.erb +18 -0
- data/app/views/nodes/article.html.erb +31 -0
- data/app/views/nodes/article_list.html.erb +41 -0
- data/app/views/nodes/article_list.rss.builder +19 -0
- data/config/cucumber.yml +8 -0
- data/config/routes.rb +5 -0
- data/lib/generators/noodall/articles/views/USAGE +5 -0
- data/lib/generators/noodall/articles/views/views_generator.rb +7 -0
- data/lib/noodall/articles/archive.rb +56 -0
- data/lib/noodall/articles/categories.rb +39 -0
- data/lib/noodall/articles/custom_link_renderer.rb +25 -0
- data/lib/noodall/articles/engine.rb +9 -0
- data/lib/noodall/articles/version.rb +5 -0
- data/lib/noodall-articles.rb +1 -0
- data/lib/tasks/cucumber.rake +65 -0
- data/lib/tasks/noodall-articles_tasks.rake +4 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +26 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/models/content_page.rb +5 -0
- data/test/dummy/app/models/user.rb +31 -0
- data/test/dummy/app/views/admin/nodes/_content_page.html.erb +45 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/nodes/content_page.html.erb +6 -0
- data/test/dummy/config/application.rb +51 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +30 -0
- data/test/dummy/config/environments/production.rb +60 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/noodall.rb +1 -0
- data/test/dummy/config/initializers/noodall_dragonfly.rb +8 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +10 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/mongo.yml +6 -0
- data/test/dummy/config/routes.rb +9 -0
- data/test/dummy/config/sitemap.yml +6 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/integration/navigation_test.rb +9 -0
- data/test/noodall-articles_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +165 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
xml.instruct! :xml, :version=>"1.0"
|
2
|
+
xml.rss(:version=>"2.0") do
|
3
|
+
xml.channel do
|
4
|
+
xml.title(@node.title)
|
5
|
+
xml.description(@node.description)
|
6
|
+
xml.link(node_url(@node))
|
7
|
+
xml.language('en-gb')
|
8
|
+
for article in articles_rss_feed(@node)
|
9
|
+
xml.item do
|
10
|
+
xml.title(article.title)
|
11
|
+
xml.category(article.category_list) unless article.categories.blank?
|
12
|
+
xml.description(article.description)
|
13
|
+
xml.pubDate(article.published_at.rfc822)
|
14
|
+
xml.link(node_url(article))
|
15
|
+
xml.guid(node_url(article))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/config/cucumber.yml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
<%
|
2
|
+
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
|
+
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip"
|
5
|
+
%>
|
6
|
+
default: <%= std_opts %> features
|
7
|
+
wip: --tags @wip:3 --wip features
|
8
|
+
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
|
data/config/routes.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Noodall
|
2
|
+
module Articles
|
3
|
+
module Archive
|
4
|
+
def archive(query = {})
|
5
|
+
result = self.collection.map_reduce(archive_map, archive_reduce, {:query => query, :finalize => archive_finalize, :out => "tmp_archives"})
|
6
|
+
years = result.find.to_a.map{ |hash| Year.new(hash['_id'],hash['value']) }.sort{ |a,b| b.year <=> a.year }
|
7
|
+
years
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def archive_map(field = 'created_at')
|
13
|
+
%{
|
14
|
+
function(){
|
15
|
+
emit(new Date(this.#{field}).getFullYear(), { months: [new Date(this.#{field}).getMonth()]} )
|
16
|
+
};
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def archive_reduce
|
21
|
+
"function( key , values ){" +
|
22
|
+
"var months = [];" +
|
23
|
+
"for ( var i=0; i<values.length; i++ ){" +
|
24
|
+
"months = months.concat(values[i].months);" +
|
25
|
+
"}" +
|
26
|
+
"return { months: months };" +
|
27
|
+
"}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def archive_finalize
|
31
|
+
"function( key , value ){" +
|
32
|
+
"var month_array = [0,0,0,0,0,0,0,0,0,0,0,0];" +
|
33
|
+
"for ( var i=0; i<value.months.length; i++ ){" +
|
34
|
+
"month_array[value.months[i]] += 1;" +
|
35
|
+
"}" +
|
36
|
+
"return month_array;" +
|
37
|
+
"}"
|
38
|
+
end
|
39
|
+
|
40
|
+
class Year
|
41
|
+
attr_reader :year, :months, :total
|
42
|
+
|
43
|
+
def initialize(year, value)
|
44
|
+
@year = year.to_i
|
45
|
+
if value.is_a?( Enumerable )
|
46
|
+
@months = value.map{ |m| m.to_i }
|
47
|
+
else
|
48
|
+
@months = [0,0,0,0,0,0,0,0,0,0,0,0]
|
49
|
+
@months[value.to_i] = 1
|
50
|
+
end
|
51
|
+
@total = @months.inject {|sum, n| (sum + n).to_i }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Noodall
|
2
|
+
module Articles
|
3
|
+
module Categories
|
4
|
+
|
5
|
+
def all_categories(query = {})
|
6
|
+
result = self.collection.map_reduce(category_map, category_reduce, {:query => query, :out => "tmp_categories"})
|
7
|
+
categories = result.find.to_a.map{|c| c['_id']}
|
8
|
+
categories.sort
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def category_map
|
14
|
+
<<-JS
|
15
|
+
function(){
|
16
|
+
if (this.categories) {
|
17
|
+
this.categories.forEach(function(category){
|
18
|
+
emit(category, 1);
|
19
|
+
});
|
20
|
+
}
|
21
|
+
}
|
22
|
+
JS
|
23
|
+
end
|
24
|
+
|
25
|
+
def category_reduce
|
26
|
+
<<-JS
|
27
|
+
function(prev, current) {
|
28
|
+
var count = 0;
|
29
|
+
for (index in current) {
|
30
|
+
count += current[index];
|
31
|
+
}
|
32
|
+
return count;
|
33
|
+
}
|
34
|
+
JS
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Noodall
|
2
|
+
module Articles
|
3
|
+
class CustomLinkRenderer < WillPaginate::ActionView::LinkRenderer
|
4
|
+
|
5
|
+
def container_attributes
|
6
|
+
super.except(:first_label, :last_label)
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def pagination
|
12
|
+
page_links = @options[:page_links] ? windowed_page_numbers : []
|
13
|
+
[:first_page, :previous_page, page_links, :next_page, :last_page].flatten
|
14
|
+
end
|
15
|
+
|
16
|
+
def first_page
|
17
|
+
previous_or_next_page(current_page == 1 ? nil : 1, @options[:first_label], "first_page")
|
18
|
+
end
|
19
|
+
|
20
|
+
def last_page
|
21
|
+
previous_or_next_page(current_page == total_pages ? nil : total_pages, @options[:last_label], "last_page")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "noodall/articles/engine"
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
+
# files.
|
6
|
+
|
7
|
+
|
8
|
+
unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
|
9
|
+
|
10
|
+
vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
|
11
|
+
$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'cucumber/rake/task'
|
15
|
+
|
16
|
+
namespace :cucumber do
|
17
|
+
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
18
|
+
t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
|
19
|
+
t.fork = true # You may get faster startup if you set this to false
|
20
|
+
t.profile = 'default'
|
21
|
+
end
|
22
|
+
|
23
|
+
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
24
|
+
t.binary = vendored_cucumber_bin
|
25
|
+
t.fork = true # You may get faster startup if you set this to false
|
26
|
+
t.profile = 'wip'
|
27
|
+
end
|
28
|
+
|
29
|
+
Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
|
30
|
+
t.binary = vendored_cucumber_bin
|
31
|
+
t.fork = true # You may get faster startup if you set this to false
|
32
|
+
t.profile = 'rerun'
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Run all features'
|
36
|
+
task :all => [:ok, :wip]
|
37
|
+
|
38
|
+
task :statsetup do
|
39
|
+
require 'rails/code_statistics'
|
40
|
+
::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
|
41
|
+
::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
desc 'Alias for cucumber:ok'
|
45
|
+
task :cucumber => 'cucumber:ok'
|
46
|
+
|
47
|
+
task :default => :cucumber
|
48
|
+
|
49
|
+
task :features => :cucumber do
|
50
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
51
|
+
end
|
52
|
+
|
53
|
+
# In case we don't have ActiveRecord, append a no-op task that we can depend upon.
|
54
|
+
task 'db:test:prepare' do
|
55
|
+
end
|
56
|
+
|
57
|
+
task :stats => 'cucumber:statsetup'
|
58
|
+
rescue LoadError
|
59
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
60
|
+
task :cucumber do
|
61
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
+
|
5
|
+
require File.expand_path('../config/application', __FILE__)
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,9 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require jquery
|
8
|
+
//= require jquery_ujs
|
9
|
+
//= require_tree .
|
@@ -0,0 +1,7 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree .
|
7
|
+
*/
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
protect_from_forgery
|
3
|
+
@@current_user = User.find_or_create_by_full_name("Demo User")
|
4
|
+
|
5
|
+
def self.current_user=(user)
|
6
|
+
@@current_user = user
|
7
|
+
end
|
8
|
+
|
9
|
+
def current_user
|
10
|
+
@@current_user
|
11
|
+
end
|
12
|
+
helper_method :current_user
|
13
|
+
|
14
|
+
def destroy_user_session_path
|
15
|
+
''
|
16
|
+
end
|
17
|
+
helper_method :destroy_user_session_path
|
18
|
+
|
19
|
+
def authenticate_user!
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def anybody_signed_in?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class User
|
2
|
+
include MongoMapper::Document
|
3
|
+
include Canable::Cans
|
4
|
+
plugin Noodall::Tagging
|
5
|
+
|
6
|
+
key :name, String
|
7
|
+
key :permalink, String, :index => true
|
8
|
+
key :email, String
|
9
|
+
|
10
|
+
alias_method :groups=, :tags=
|
11
|
+
alias_method :groups, :tags
|
12
|
+
alias_method :group_list=, :tag_list=
|
13
|
+
alias_method :group_list, :tag_list
|
14
|
+
|
15
|
+
cattr_accessor :editor_groups
|
16
|
+
|
17
|
+
def admin?
|
18
|
+
groups.include?('website administrator')
|
19
|
+
end
|
20
|
+
|
21
|
+
def editor?
|
22
|
+
return true if self.class.editor_groups.blank?
|
23
|
+
admin? or (self.class.editor_groups & groups).size > 0
|
24
|
+
end
|
25
|
+
|
26
|
+
before_save :set_permalink
|
27
|
+
def set_permalink
|
28
|
+
self.permalink = full_name.parameterize
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
<%= render :partial => 'noodall/admin/nodes/body', :locals => { :f => f } %>
|
2
|
+
<% content_for :component_table do %>
|
3
|
+
<!--
|
4
|
+
modify this table to look like your template and link slots to correct anchors
|
5
|
+
<table class="component-table">
|
6
|
+
<tr>
|
7
|
+
<td rowspan="2" class="content"></td>
|
8
|
+
<td colspan="2" rowspan="4" class="content"></td>
|
9
|
+
<td><a href="#small_component_form_0" class="slot_link">4</a></td>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<td><a href="#small_component_form_1" class="slot_link">5</a></td>
|
13
|
+
</tr>
|
14
|
+
<tr>
|
15
|
+
<td></td>
|
16
|
+
<td><a href="#small_component_form_2" class="slot_link">6</a></td>
|
17
|
+
</tr>
|
18
|
+
<tr>
|
19
|
+
<td></td>
|
20
|
+
<td><a href="#small_component_form_3" class="slot_link">7</a></td>
|
21
|
+
</tr>
|
22
|
+
<tr>
|
23
|
+
<td></td>
|
24
|
+
<td colspan="2"><a href="#wide_component_form_0" class="slot_link">1</a></td>
|
25
|
+
<td></td>
|
26
|
+
</tr>
|
27
|
+
<tr>
|
28
|
+
<td></td>
|
29
|
+
<td colspan="2"><a href="#wide_component_form_1" class="slot_link">2</a></td>
|
30
|
+
<td></td>
|
31
|
+
</tr>
|
32
|
+
<tr>
|
33
|
+
<td></td>
|
34
|
+
<td colspan="2"><a href="#wide_component_form_2" class="slot_link">3</a></td>
|
35
|
+
<td></td>
|
36
|
+
</tr>
|
37
|
+
<tr>
|
38
|
+
<td></td>
|
39
|
+
<td></td>
|
40
|
+
<td></td>
|
41
|
+
<td></td>
|
42
|
+
</tr>
|
43
|
+
</table>
|
44
|
+
-->
|
45
|
+
<% end -%>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
# require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_mailer/railtie"
|
7
|
+
require "active_resource/railtie"
|
8
|
+
require "sprockets/railtie"
|
9
|
+
require "rails/test_unit/railtie"
|
10
|
+
|
11
|
+
Bundler.require
|
12
|
+
require "noodall-articles"
|
13
|
+
|
14
|
+
module Dummy
|
15
|
+
class Application < Rails::Application
|
16
|
+
# Settings in config/environments/* take precedence over those specified here.
|
17
|
+
# Application configuration should go into files in config/initializers
|
18
|
+
# -- all .rb files in that directory are automatically loaded.
|
19
|
+
|
20
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
21
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
22
|
+
|
23
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
24
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
25
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
26
|
+
|
27
|
+
# Activate observers that should always be running.
|
28
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
29
|
+
|
30
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
31
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
32
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
33
|
+
|
34
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
35
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
36
|
+
# config.i18n.default_locale = :de
|
37
|
+
|
38
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
39
|
+
config.encoding = "utf-8"
|
40
|
+
|
41
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
42
|
+
config.filter_parameters += [:password]
|
43
|
+
|
44
|
+
# Enable the asset pipeline
|
45
|
+
config.assets.enabled = true
|
46
|
+
|
47
|
+
# Version of your assets, change this if you want to expire all your assets
|
48
|
+
config.assets.version = '1.0'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -0,0 +1,30 @@
|
|
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
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
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
|
+
# Only use best-standards-support built into browsers
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
24
|
+
|
25
|
+
# Do not compress assets
|
26
|
+
config.assets.compress = false
|
27
|
+
|
28
|
+
# Expands the lines which load the assets
|
29
|
+
config.assets.debug = true
|
30
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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
|
+
# Full error reports are disabled and caching is turned on
|
8
|
+
config.consider_all_requests_local = false
|
9
|
+
config.action_controller.perform_caching = true
|
10
|
+
|
11
|
+
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
+
config.serve_static_assets = false
|
13
|
+
|
14
|
+
# Compress JavaScripts and CSS
|
15
|
+
config.assets.compress = true
|
16
|
+
|
17
|
+
# Don't fallback to assets pipeline if a precompiled asset is missed
|
18
|
+
config.assets.compile = false
|
19
|
+
|
20
|
+
# Generate digests for assets URLs
|
21
|
+
config.assets.digest = true
|
22
|
+
|
23
|
+
# Defaults to Rails.root.join("public/assets")
|
24
|
+
# config.assets.manifest = YOUR_PATH
|
25
|
+
|
26
|
+
# Specifies the header that your server uses for sending files
|
27
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
28
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
29
|
+
|
30
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
31
|
+
# config.force_ssl = true
|
32
|
+
|
33
|
+
# See everything in the log (default is :info)
|
34
|
+
# config.log_level = :debug
|
35
|
+
|
36
|
+
# Use a different logger for distributed setups
|
37
|
+
# config.logger = SyslogLogger.new
|
38
|
+
|
39
|
+
# Use a different cache store in production
|
40
|
+
# config.cache_store = :mem_cache_store
|
41
|
+
|
42
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
43
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
44
|
+
|
45
|
+
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
|
46
|
+
# config.assets.precompile += %w( search.js )
|
47
|
+
|
48
|
+
# Disable delivery errors, bad email addresses will be ignored
|
49
|
+
# config.action_mailer.raise_delivery_errors = false
|
50
|
+
|
51
|
+
# Enable threaded mode
|
52
|
+
# config.threadsafe!
|
53
|
+
|
54
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
55
|
+
# the I18n.default_locale when a translation can not be found)
|
56
|
+
config.i18n.fallbacks = true
|
57
|
+
|
58
|
+
# Send deprecation notices to registered listeners
|
59
|
+
config.active_support.deprecation = :notify
|
60
|
+
end
|
@@ -0,0 +1,39 @@
|
|
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
|
+
# Configure static asset server for tests with Cache-Control for performance
|
11
|
+
config.serve_static_assets = true
|
12
|
+
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
# Log error messages when you accidentally call methods on nil
|
15
|
+
config.whiny_nils = true
|
16
|
+
|
17
|
+
# Show full error reports and disable caching
|
18
|
+
config.consider_all_requests_local = true
|
19
|
+
config.action_controller.perform_caching = false
|
20
|
+
|
21
|
+
# Raise exceptions instead of rendering exception templates
|
22
|
+
config.action_dispatch.show_exceptions = false
|
23
|
+
|
24
|
+
# Disable request forgery protection in test environment
|
25
|
+
config.action_controller.allow_forgery_protection = false
|
26
|
+
|
27
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
28
|
+
# The :test delivery method accumulates sent emails in the
|
29
|
+
# ActionMailer::Base.deliveries array.
|
30
|
+
config.action_mailer.delivery_method = :test
|
31
|
+
|
32
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
33
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
34
|
+
# like if you have constraints or database-specific column types
|
35
|
+
# config.active_record.schema_format = :sql
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
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,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|