Commit bab5b63f42f1b1fc362123470eaae7cfbfbd6f85
1 parent
3e4fb862
Exists in
master
and in
1 other branch
Noosfero recipe: create file /etc/noosfero/application.rb
Set the correct timezone
Showing
2 changed files
with
115 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,110 @@ |
1 | +require File.expand_path('../boot', __FILE__) | |
2 | + | |
3 | +require 'rails/all' | |
4 | +require 'active_support/dependencies' | |
5 | + | |
6 | +# FIXME this silences the warnings about Rails 2.3-style plugins under | |
7 | +# vendor/plugins, which are deprecated. Hiding those warnings makes it easier | |
8 | +# to work for now, but we should really look at putting those plugins away. | |
9 | +ActiveSupport::Deprecation.silenced = true | |
10 | + | |
11 | +Bundler.require(:default, :assets, Rails.env) | |
12 | + | |
13 | +module Noosfero | |
14 | + class Application < Rails::Application | |
15 | + | |
16 | + require 'noosfero/plugin' | |
17 | + | |
18 | + require 'noosfero/multi_tenancy' | |
19 | + config.middleware.use Noosfero::MultiTenancy::Middleware | |
20 | + | |
21 | + config.action_controller.include_all_helpers = false | |
22 | + | |
23 | + # Settings in config/environments/* take precedence over those specified here. | |
24 | + # Application configuration should go into files in config/initializers | |
25 | + # -- all .rb files in that directory are automatically loaded. | |
26 | + | |
27 | + # Custom directories with classes and modules you want to be autoloadable. | |
28 | + config.autoload_paths += %W( #{config.root.join('app', 'sweepers')} ) | |
29 | + config.autoload_paths += Dir["#{config.root}/lib"] | |
30 | + config.autoload_paths += Dir["#{config.root}/app/controllers/**/"] | |
31 | + config.autoload_paths += %W( #{config.root.join('test', 'mocks', Rails.env)} ) | |
32 | + | |
33 | + # Only load the plugins named here, in the order given (default is alphabetical). | |
34 | + # :all can be used as a placeholder for all plugins not explicitly named. | |
35 | + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] | |
36 | + | |
37 | + # Activate observers that should always be running. | |
38 | + # Sweepers are observers | |
39 | + # don't load the sweepers while loading the database | |
40 | + ignore_rake_commands = %w[ | |
41 | + db:schema:load | |
42 | + gems:install | |
43 | + clobber | |
44 | + noosfero:translations:compile | |
45 | + makemo | |
46 | + ] | |
47 | + if $PROGRAM_NAME =~ /rake$/ && (ignore_rake_commands.include?(ARGV.first)) | |
48 | + Noosfero::Plugin.should_load = false | |
49 | + else | |
50 | + config.active_record.observers = :article_sweeper, :role_assignment_sweeper, :friendship_sweeper, :category_sweeper, :block_sweeper | |
51 | + end | |
52 | + | |
53 | + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. | |
54 | + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. | |
55 | + config.time_zone = 'Brasilia' | |
56 | + | |
57 | + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. | |
58 | + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] | |
59 | + config.i18n.default_locale = nil | |
60 | + | |
61 | + # Configure the default encoding used in templates for Ruby 1.9. | |
62 | + config.encoding = "utf-8" | |
63 | + | |
64 | + # Configure sensitive parameters which will be filtered from the log file. | |
65 | + config.filter_parameters += [:password] | |
66 | + | |
67 | + # Enable escaping HTML in JSON. | |
68 | + ActiveSupport::JSON::Encoding.escape_html_entities_in_json = true | |
69 | + | |
70 | + # Use SQL instead of Active Record's schema dumper when creating the database. | |
71 | + # This is necessary if your schema can't be completely dumped by the schema dumper, | |
72 | + # like if you have constraints or database-specific column types | |
73 | + # config.active_record.schema_format = :sql | |
74 | + | |
75 | + # Enforce whitelist mode for mass assignment. | |
76 | + # This will create an empty whitelist of attributes available for mass-assignment for all models | |
77 | + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible | |
78 | + # parameters by using an attr_accessible or attr_protected declaration. | |
79 | + config.active_record.whitelist_attributes = true | |
80 | + | |
81 | + # Asset pipeline | |
82 | + config.assets.paths = | |
83 | + Dir.glob("app/assets/plugins/*/{,stylesheets,javascripts}") + | |
84 | + Dir.glob("app/assets/{,stylesheets,javascripts}") + | |
85 | + # no precedence over core | |
86 | + Dir.glob("app/assets/designs/{icons,themes,user_themes}/*") | |
87 | + | |
88 | + # disable strong_parameters before migration from protected_attributes | |
89 | + config.action_controller.permit_all_parameters = true | |
90 | + # Version of your assets, change this if you want to expire all your assets | |
91 | + config.assets.version = '1.0' | |
92 | + | |
93 | + config.sass.preferred_syntax = :scss | |
94 | + config.sass.cache = true | |
95 | + config.sass.line_comments = false | |
96 | + | |
97 | + config.action_dispatch.session = { | |
98 | + :key => '_noosfero_session', | |
99 | + } | |
100 | + config.session_store :active_record_store, key: '_noosfero_session' | |
101 | + | |
102 | + config.paths['db/migrate'].concat Dir.glob("#{Rails.root}/{baseplugins,config/plugins}/*/db/migrate") | |
103 | + config.i18n.load_path.concat Dir.glob("#{Rails.root}/{baseplugins,config/plugins}/*/locales/*.{rb,yml}") | |
104 | + | |
105 | + config.eager_load = true | |
106 | + | |
107 | + Noosfero::Plugin.setup(config) | |
108 | + | |
109 | + end | |
110 | +end | ... | ... |
cookbooks/noosfero/recipes/default.rb
... | ... | @@ -111,6 +111,11 @@ cookbook_file '/etc/noosfero/unicorn.rb' do |
111 | 111 | notifies :restart, 'service[noosfero]' |
112 | 112 | end |
113 | 113 | |
114 | +cookbook_file '/etc/noosfero/application.rb' do | |
115 | + owner 'root'; group 'root'; mode 0644 | |
116 | + notifies :restart, 'service[noosfero]' | |
117 | +end | |
118 | + | |
114 | 119 | cookbook_file '/etc/default/noosfero' do |
115 | 120 | owner 'root'; group 'root'; mode 0644 |
116 | 121 | source 'noosfero-default' | ... | ... |