Commit f4e0c79d1fa1604e868e7cbf23d30bfc1ad33f95
1 parent
4da5f433
Exists in
master
and in
1 other branch
noosfero.spec: use application.rb in /etc/noosfero
Make config/application.rb as a config file available in /etc/noosfero
Showing
1 changed file
with
116 additions
and
1 deletions
Show diff stats
src/pkg-rpm/noosfero/noosfero.spec
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | |
| 4 | 4 | Name: noosfero |
| 5 | 5 | Version: 1.5.0+spb9 |
| 6 | -Release: 1 | |
| 6 | +Release: 2 | |
| 7 | 7 | Summary: Social Networking Platform |
| 8 | 8 | Group: Applications/Publishing |
| 9 | 9 | License: AGPLv3 |
| ... | ... | @@ -66,6 +66,7 @@ EOF |
| 66 | 66 | mkdir -p %{buildroot}/etc/noosfero/plugins |
| 67 | 67 | ln -sf /etc/noosfero/database.yml %{buildroot}/usr/lib/noosfero/config/database.yml |
| 68 | 68 | ln -sf /etc/noosfero/unicorn.rb %{buildroot}/usr/lib/noosfero/config/unicorn.rb |
| 69 | +ln -sf /etc/noosfero/application.rb %{buildroot}/usr/lib/noosfero/config/application.rb | |
| 69 | 70 | |
| 70 | 71 | mkdir -p %{buildroot}/etc/noosfero/plugins |
| 71 | 72 | cp config/plugins/README %{buildroot}/etc/noosfero/plugins |
| ... | ... | @@ -105,6 +106,119 @@ production: |
| 105 | 106 | port: 5432 |
| 106 | 107 | EOF |
| 107 | 108 | |
| 109 | +cat > %{buildroot}/etc/noosfero/application.rb <<EOF | |
| 110 | +require File.expand_path('../boot', __FILE__) | |
| 111 | + | |
| 112 | +require 'rails/all' | |
| 113 | +require 'active_support/dependencies' | |
| 114 | + | |
| 115 | +# FIXME this silences the warnings about Rails 2.3-style plugins under | |
| 116 | +# vendor/plugins, which are deprecated. Hiding those warnings makes it easier | |
| 117 | +# to work for now, but we should really look at putting those plugins away. | |
| 118 | +ActiveSupport::Deprecation.silenced = true | |
| 119 | + | |
| 120 | +Bundler.require(:default, :assets, Rails.env) | |
| 121 | + | |
| 122 | +module Noosfero | |
| 123 | + class Application < Rails::Application | |
| 124 | + | |
| 125 | + require 'noosfero/plugin' | |
| 126 | + | |
| 127 | + require 'noosfero/multi_tenancy' | |
| 128 | + config.middleware.use Noosfero::MultiTenancy::Middleware | |
| 129 | + | |
| 130 | + config.action_controller.include_all_helpers = false | |
| 131 | + | |
| 132 | + # Settings in config/environments/* take precedence over those specified here. | |
| 133 | + # Application configuration should go into files in config/initializers | |
| 134 | + # -- all .rb files in that directory are automatically loaded. | |
| 135 | + | |
| 136 | + # Custom directories with classes and modules you want to be autoloadable. | |
| 137 | + config.autoload_paths += %W( #{config.root.join('app', 'sweepers')} ) | |
| 138 | + config.autoload_paths += Dir["#{config.root}/lib"] | |
| 139 | + config.autoload_paths += Dir["#{config.root}/app/controllers/**/"] | |
| 140 | + config.autoload_paths += %W( #{config.root.join('test', 'mocks', Rails.env)} ) | |
| 141 | + | |
| 142 | + # Only load the plugins named here, in the order given (default is alphabetical). | |
| 143 | + # :all can be used as a placeholder for all plugins not explicitly named. | |
| 144 | + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] | |
| 145 | + | |
| 146 | + # Activate observers that should always be running. | |
| 147 | + # Sweepers are observers | |
| 148 | + # don't load the sweepers while loading the database | |
| 149 | + ignore_rake_commands = %w[ | |
| 150 | + db:schema:load | |
| 151 | + gems:install | |
| 152 | + clobber | |
| 153 | + noosfero:translations:compile | |
| 154 | + makemo | |
| 155 | + ] | |
| 156 | + if $PROGRAM_NAME =~ /rake$/ && (ignore_rake_commands.include?(ARGV.first)) | |
| 157 | + Noosfero::Plugin.should_load = false | |
| 158 | + else | |
| 159 | + config.active_record.observers = :article_sweeper, :role_assignment_sweeper, :friendship_sweeper, :category_sweeper, :block_sweeper | |
| 160 | + end | |
| 161 | + | |
| 162 | + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. | |
| 163 | + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. | |
| 164 | + config.time_zone = 'Brasilia' | |
| 165 | + | |
| 166 | + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. | |
| 167 | + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] | |
| 168 | + config.i18n.default_locale = nil | |
| 169 | + | |
| 170 | + # Configure the default encoding used in templates for Ruby 1.9. | |
| 171 | + config.encoding = "utf-8" | |
| 172 | + | |
| 173 | + # Configure sensitive parameters which will be filtered from the log file. | |
| 174 | + config.filter_parameters += [:password] | |
| 175 | + | |
| 176 | + # Enable escaping HTML in JSON. | |
| 177 | + ActiveSupport::JSON::Encoding.escape_html_entities_in_json = true | |
| 178 | + | |
| 179 | + # Use SQL instead of Active Record's schema dumper when creating the database. | |
| 180 | + # This is necessary if your schema can't be completely dumped by the schema dumper, | |
| 181 | + # like if you have constraints or database-specific column types | |
| 182 | + # config.active_record.schema_format = :sql | |
| 183 | + | |
| 184 | + # Enforce whitelist mode for mass assignment. | |
| 185 | + # This will create an empty whitelist of attributes available for mass-assignment for all models | |
| 186 | + # in your app. As such, your models will need to explicitly whitelist or blacklist accessible | |
| 187 | + # parameters by using an attr_accessible or attr_protected declaration. | |
| 188 | + config.active_record.whitelist_attributes = true | |
| 189 | + | |
| 190 | + # Asset pipeline | |
| 191 | + config.assets.paths = | |
| 192 | + Dir.glob("app/assets/plugins/*/{,stylesheets,javascripts}") + | |
| 193 | + Dir.glob("app/assets/{,stylesheets,javascripts}") + | |
| 194 | + # no precedence over core | |
| 195 | + Dir.glob("app/assets/designs/{icons,themes,user_themes}/*") | |
| 196 | + | |
| 197 | + # disable strong_parameters before migration from protected_attributes | |
| 198 | + config.action_controller.permit_all_parameters = true | |
| 199 | + # Version of your assets, change this if you want to expire all your assets | |
| 200 | + config.assets.version = '1.0' | |
| 201 | + | |
| 202 | + config.sass.preferred_syntax = :scss | |
| 203 | + config.sass.cache = true | |
| 204 | + config.sass.line_comments = false | |
| 205 | + | |
| 206 | + config.action_dispatch.session = { | |
| 207 | + :key => '_noosfero_session', | |
| 208 | + } | |
| 209 | + config.session_store :active_record_store, key: '_noosfero_session' | |
| 210 | + | |
| 211 | + config.paths['db/migrate'].concat Dir.glob("#{Rails.root}/{baseplugins,config/plugins}/*/db/migrate") | |
| 212 | + config.i18n.load_path.concat Dir.glob("#{Rails.root}/{baseplugins,config/plugins}/*/locales/*.{rb,yml}") | |
| 213 | + | |
| 214 | + config.eager_load = true | |
| 215 | + | |
| 216 | + Noosfero::Plugin.setup(config) | |
| 217 | + | |
| 218 | + end | |
| 219 | +end | |
| 220 | +EOF | |
| 221 | + | |
| 108 | 222 | mkdir -p %{buildroot}/etc/default |
| 109 | 223 | cat > %{buildroot}/etc/default/noosfero <<EOF |
| 110 | 224 | NOOSFERO_DIR="/usr/lib/noosfero" |
| ... | ... | @@ -173,4 +287,5 @@ systemctl disable noosfero |
| 173 | 287 | %config(noreplace) /etc/default/noosfero |
| 174 | 288 | %config(noreplace) /etc/noosfero/database.yml |
| 175 | 289 | %config(noreplace) /etc/noosfero/unicorn.rb |
| 290 | +%config(noreplace) /etc/noosfero/application.rb | |
| 176 | 291 | %doc | ... | ... |