From d649bf158be130515566aed987f83d36ac9b0ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 6 Oct 2010 17:18:59 +0200 Subject: Provide a cleaner syntax for paths configuration that does not rely on method_missing. --- railties/lib/rails/engine.rb | 59 ++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 27 deletions(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 3981e8dfd5..bd3e612153 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -90,17 +90,17 @@ module Rails # The available paths in an Engine are: # # class MyEngine < Rails::Engine - # paths.app = "app" - # paths.app.controllers = "app/controllers" - # paths.app.helpers = "app/helpers" - # paths.app.models = "app/models" - # paths.app.views = "app/views" - # paths.lib = "lib" - # paths.lib.tasks = "lib/tasks" - # paths.config = "config" - # paths.config.initializers = "config/initializers" - # paths.config.locales = "config/locales" - # paths.config.routes = "config/routes.rb" + # paths["app"] #=> ["app"] + # paths["app/controllers"] #=> ["app/controllers"] + # paths["app/helpers"] #=> ["app/helpers"] + # paths["app/models"] #=> ["app/models"] + # paths["app/views"] #=> ["app/views"] + # paths["lib"] #=> ["lib"] + # paths["lib/tasks"] #=> ["lib/tasks"] + # paths["config"] #=> ["config"] + # paths["config/initializers"] #=> ["config/initializers"] + # paths["config/locales"] #=> ["config/locales"] + # paths["config/routes"] #=> ["config/routes.rb"] # end # # Your Application class adds a couple more paths to this set. And as in your Application, @@ -276,11 +276,11 @@ module Rails # end # end # - # There is also 'app' helper that gives you access to application's routes inside Engine: + # There is also 'main_app' helper that gives you access to application's routes inside Engine: # # module MyEngine # class BarController - # app.foo_path #=> /foo + # main_app.foo_path #=> /foo # end # end # @@ -381,7 +381,7 @@ module Rails def load_tasks super - config.paths.lib.tasks.to_a.sort.each { |ext| load(ext) } + paths["lib/tasks"].existent.sort.each { |ext| load(ext) } end def eager_load! @@ -441,7 +441,7 @@ module Rails # # Blog::Engine.load_seed def load_seed - seed_file = config.paths.db.seeds.to_a.first + seed_file = paths["db/seeds"].existent.first load(seed_file) if File.exist?(seed_file) end @@ -469,20 +469,22 @@ module Rails end initializer :add_routing_paths do |app| - app.routes_reloader.blocks[routes] = routes_draw_block - paths.config.routes.to_a.each do |route| - app.routes_reloader.paths.unshift(route) if File.exists?(route) + paths = self.paths["config/routes"].existent + + if routes? || paths.any? + app.routes_reloader.blocks[routes] = routes_draw_block + app.routes_reloader.paths.unshift(*paths) end end # I18n load paths are a special case since the ones added # later have higher priority. initializer :add_locales do - config.i18n.railties_load_path.concat(paths.config.locales.to_a) + config.i18n.railties_load_path.concat(paths["config/locales"].existent) end initializer :add_view_paths do - views = paths.app.views.to_a + views = paths["app/views"].existent unless views.empty? ActiveSupport.on_load(:action_controller){ prepend_view_path(views) } ActiveSupport.on_load(:action_mailer){ prepend_view_path(views) } @@ -490,28 +492,27 @@ module Rails end initializer :load_environment_config, :before => :load_environment_hook do - environment = config.paths.config.environments.to_a.first + environment = paths["config/environments"].existent.first require environment if environment end initializer :append_asset_paths do config.asset_path ||= "/#{engine_name}%s" - public_path = config.paths.public.to_a.first + public_path = paths["public"].first if config.compiled_asset_path && File.exist?(public_path) config.static_asset_paths[config.compiled_asset_path] = public_path end end - initializer :prepend_helpers_path do - unless namespaced? - config.helpers_paths = [] unless config.respond_to?(:helpers_paths) - config.helpers_paths = config.paths.app.helpers.to_a + config.helpers_paths + initializer :prepend_helpers_path do |app| + if !namespaced? || (app == self) + app.config.helpers_paths.unshift(*paths["app/helpers"].existent) end end initializer :load_config_initializers do - paths.config.initializers.to_a.sort.each do |initializer| + config.paths["config/initializers"].existent.sort.each do |initializer| load(initializer) end end @@ -524,6 +525,10 @@ module Rails protected attr_accessor :routes_draw_block + def routes? + defined?(@routes) + end + def find_root_with_flag(flag, default=nil) root_path = self.class.called_from -- cgit v1.2.3 From 3ca6988b782f7ae9da736b090fbf1edd8bc02fcb Mon Sep 17 00:00:00 2001 From: Thomas McDonald Date: Wed, 6 Oct 2010 22:11:03 +0100 Subject: Fixed typo in engine documentation --- railties/lib/rails/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 0620b8608e..5e2bdb7340 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -17,7 +17,7 @@ module Rails # In Rails versions before to 3.0, your gems automatically behaved as Engine, however # this coupled Rails to Rubygems. Since Rails 3.0, if you want a gem to automatically # behave as Engine, you have to specify an Engine for it somewhere inside your plugin - # lib folder (similar with how we spceify a Railtie): + # lib folder (similar to how we specify a Railtie): # # # lib/my_engine.rb # module MyEngine -- cgit v1.2.3 From 08f4713dba1ae013d5b3c9815cb7e33ea5533be5 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 6 Oct 2010 15:54:28 +0200 Subject: Refactored routes reloading to use RouteSet#append instead keeping block in Engine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- railties/lib/rails/engine.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 1aa24b6808..f8caaef213 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -419,9 +419,9 @@ module Rails } end - def routes(&block) + def routes @routes ||= ActionDispatch::Routing::RouteSet.new - self.routes_draw_block = block if block_given? + @routes.append(&Proc.new) if block_given? @routes end @@ -472,8 +472,8 @@ module Rails paths = self.paths["config/routes"].existent if routes? || paths.any? - app.routes_reloader.blocks[routes] = routes_draw_block app.routes_reloader.paths.unshift(*paths) + app.routes_reloader.route_sets << routes end end @@ -523,8 +523,6 @@ module Rails end protected - attr_accessor :routes_draw_block - def routes? defined?(@routes) end -- cgit v1.2.3 From 5d5eb2b18d364cb27d2062668bd3b1921b1040a8 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 9 Oct 2010 20:59:20 +0200 Subject: Rename namespace method to isolate_namespace. This change caused by confusion caused by calling engine "namespaced". Stuff inside engine can be namespaced for every engine. This method is not actually namespacing anything, it's isolating engine within the given namespace. --- railties/lib/rails/engine.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index f8caaef213..909840da04 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -214,11 +214,11 @@ module Rails # as they would be created inside application. One of the cosequences of that is including # application's helpers and url_helpers inside controller. Sometimes, especially when your # engine provides its own routes, you don't want that. To isolate engine's stuff from application - # you can use namespace method: + # you can use isolate_namespace method: # # module MyEngine # class Engine < Rails::Engine - # namespace MyEngine + # isolate_namespace MyEngine # end # end # @@ -252,7 +252,7 @@ module Rails # end # # - # Additionaly namespaced engine will set its name according to namespace, so in that case: + # Additionaly isolated engine will set its name according to namespace, so in that case: # MyEngine::Engine.engine_name #=> "my_engine" and it will set MyEngine.table_name_prefix # to "my_engine_". # @@ -315,7 +315,7 @@ module Rails autoload :Configuration, "rails/engine/configuration" class << self - attr_accessor :called_from, :namespaced + attr_accessor :called_from, :isolated alias :engine_name :railtie_name def inherited(base) @@ -350,12 +350,12 @@ module Rails @endpoint end - def namespace(mod) + def isolate_namespace(mod) engine_name(generate_railtie_name(mod)) name = engine_name self.routes.default_scope = {:module => name} - self.namespaced = true + self.isolated = true unless mod.respond_to?(:_railtie) _railtie = self @@ -371,13 +371,13 @@ module Rails end end - def namespaced? - !!namespaced + def isolated? + !!isolated end end delegate :middleware, :root, :paths, :to => :config - delegate :engine_name, :namespaced?, :to => "self.class" + delegate :engine_name, :isolated?, :to => "self.class" def load_tasks super @@ -506,7 +506,7 @@ module Rails end initializer :prepend_helpers_path do |app| - if !namespaced? || (app == self) + if !isolated? || (app == self) app.config.helpers_paths.unshift(*paths["app/helpers"].existent) end end -- cgit v1.2.3 From a9bf91ea5640ab9ed9d6d7ba9da780ea1dfbd6e3 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 9 Oct 2010 20:15:45 +0200 Subject: Add 'foo:install:migrations' task to copy migrations from foo engine --- railties/lib/rails/engine.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 909840da04..4acebb4769 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -522,6 +522,20 @@ module Rails # consistently executed after all the initializers above across all engines. end + rake_tasks do + next if self.is_a?(Rails::Application) + + namespace railtie_name do + namespace :install do + desc "Copy migrations from #{railtie_name} to application" + task :migrations do + ENV["FROM"] = railtie_name + Rake::Task["railties:install:migrations"].invoke + end + end + end + end + protected def routes? defined?(@routes) -- cgit v1.2.3 From a8b1780410a86be58ac0f341ae6b079800783fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 11 Oct 2010 10:29:31 +0200 Subject: Updated DOCS for engines and added a couple TODOs. Also, commented internal railties rake tasks description. --- railties/lib/rails/engine.rb | 82 ++++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 34 deletions(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 4acebb4769..e9ce9610b8 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -77,14 +77,14 @@ module Rails # you need to do is: # # class MyEngine < Rails::Engine - # paths.app.controllers = "lib/controllers" + # paths["app/controllers"] = "lib/controllers" # end # # You can also have your controllers being loaded from both "app/controllers" and # "lib/controllers": # # class MyEngine < Rails::Engine - # paths.app.controllers << "lib/controllers" + # paths["app/controllers"] << "lib/controllers" # end # # The available paths in an Engine are: @@ -185,19 +185,21 @@ module Rails # == Serving static files # # By default, rails use ActionDispatch::Static to serve static files in development mode. This is ok - # while you develop your application, but when you want to deploy it, assets from engine will not be served. + # while you develop your application, but when you want to deploy it, assets from engine will not be + # served by default. You should choose one of the two following strategies: # - # You can fix it in one of two ways: # * enable serving static files by setting config.serve_static_assets to true # * symlink engines' public directories in application's public directory by running - # `rake railties:create_symlinks` + # `rake ENGINE_NAME:install:assets`, where ENGINE_NAME is usually my_engine for the + # examples above # # == Engine name # # There are some places where engine's name is used. + # # * routes: when you mount engine with mount(MyEngine::Engine => '/my_engine'), it's used as default :as option - # * migrations: when you copy engine's migrations, they will be decorated with suffix based on engine_name, for example: - # 2010010203121314_create_users.my_engine.rb + # + # * rake tasks: engines have a few rake tasks. They are usually under my_engine namespace. # # Engine name is set by default based on class name. For MyEngine::Engine it will be my_engine_engine. # You can change it manually it manually using engine_name method: @@ -210,11 +212,13 @@ module Rails # # == Namespaced Engine # - # Normally, when you create controllers, helpers and models inside engine, they are treated - # as they would be created inside application. One of the cosequences of that is including - # application's helpers and url_helpers inside controller. Sometimes, especially when your - # engine provides its own routes, you don't want that. To isolate engine's stuff from application - # you can use isolate_namespace method: + # Normally when you create controllers, helpers and models inside engine, they are treated + # as they were created inside the application. This means all applications helpers and named routes + # will be available to your engine controllers. + # + # However, sometimes you want to isolate your engine from the application, specially if your engine + # have its own router. To do that, you simply need to call +isolate_namespace+. This method requires + # you to pass a module where all your controllers, helpers and models should be nested to: # # module MyEngine # class Engine < Rails::Engine @@ -235,15 +239,21 @@ module Rails # url_helpers from MyEngine::Engine.routes. # # The next thing that changes in isolated engine is routes behaviour. Normally, when you namespace - # your controllers, you need to use scope or namespace method in routes. With isolated engine, - # the namespace is applied by default, so you can ignore it in routes. Further more, you don't need - # to use longer url helpers like "my_engine_articles_path". As the prefix is not set you can just use - # articles_path as you would normally do. + # your controllers, you also need to do namespace all your routes. With isolated engine, + # the namespace is applied by default, so you can ignore it in routes: + # + # MyEngine::Engine.routes.draw do + # resources :articles + # end + # + # The routes above will automatically point to MyEngine::ApplicationContoller. Further more, you don't + # need to use longer url helpers like "my_engine_articles_path". Instead, you shuold simply use + # articles_path as you would do with your application. # # To make that behaviour consistent with other parts of framework, isolated engine has influence also on # ActiveModel::Naming. When you use namespaced model, like MyEngine::Article, it will normally - # use the prefix "my_engine". In isolated engine, the prefix will be ommited in most of the places, - # like url helpers or form fields. + # use the prefix "my_engine". In isolated engine, the prefix will be ommited in url helpers and + # form fields for convenience. # # polymorphic_url(MyEngine::Article.new) #=> "articles_path" # @@ -251,16 +261,15 @@ module Rails # text_field :title #=> # end # - # - # Additionaly isolated engine will set its name according to namespace, so in that case: - # MyEngine::Engine.engine_name #=> "my_engine" and it will set MyEngine.table_name_prefix - # to "my_engine_". + # Additionaly isolated engine will set its name according to namespace, so + # MyEngine::Engine.engine_name #=> "my_engine". It will also set MyEngine.table_name_prefix + # to "my_engine_", changing MyEngine::Article model to use my_engine_article table. # # == Using Engine's routes outside Engine # - # Since you can mount engine inside application's routes now, you do not have direct access to engine's - # url_helpers inside application. When you mount Engine in application's routes special helper is - # created to allow doing that. Consider such scenario: + # Since now you can mount engine inside application's routes, you do not have direct access to engine's + # url_helpers inside application. When you mount Engine in application's routes, a special helper is + # created to allow you to do that. Consider such scenario: # # # APP/config/routes.rb # MyApplication::Application.routes.draw do @@ -268,7 +277,7 @@ module Rails # match "/foo" => "foo#index" # end # - # Now, you can use my_engine helper: + # Now, you can use my_engine helper inside your application: # # class FooController < ApplicationController # def index @@ -280,20 +289,23 @@ module Rails # # module MyEngine # class BarController - # main_app.foo_path #=> /foo + # def index + # main_app.foo_path #=> /foo + # end # end # end # - # Note that :as option takes engine_name as default, so most of the time you can ommit it. - # - # If you want to generate url to engine's route using polymorphic_url, you can also use that helpers. + # Note that the :as option given to mount takes the engine_name as default, so most of the time + # you can simply ommit it. # - # Let's say that you want to create a form pointing to one of the engine's routes. All you need to do - # is passing helper as the first element in array with attributes for url: + # Finally, if you want to generate url to engine's route using polymorphic_url, you also need + # to pass the engine helper. Let's say that you want to create a form pointing to one of the + # engine's routes. All you need to do is pass the helper as the first element in array with + # attributes for url: # # form_for([my_engine, @user]) # - # This code will use my_engine.user_path(@user) to generate proper route. + # This code will use my_engine.user_path(@user) to generate the proper route. # # == Migrations & seed data # @@ -303,7 +315,7 @@ module Rails # To use engine's migrations in application you can use rake task, which copies them to # application's dir: # - # rake railties:copy_migrations + # rake ENGINE_NAME:install:migrations # # If your engine has migrations, you may also want to prepare data for the database in # seeds.rb file. You can load that data using load_seed method, e.g. @@ -527,6 +539,8 @@ module Rails namespace railtie_name do namespace :install do + # TODO Add assets copying to this list + # TODO Skip this if there is no paths["db/migrate"] for the engine desc "Copy migrations from #{railtie_name} to application" task :migrations do ENV["FROM"] = railtie_name -- cgit v1.2.3 From f07cbec865093c30299ad038d52e3e70e2527848 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sun, 10 Oct 2010 15:03:57 +0200 Subject: Do not treat information about skipped migrations as WARNINGs but as a NOTEs, also puts to stdin --- railties/lib/rails/engine.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index e9ce9610b8..86a8374ded 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -547,6 +547,12 @@ module Rails Rake::Task["railties:install:migrations"].invoke end end + + desc "Copy assets from #{railtie_name} to application" + task :assets do + ENV["FROM"] = railtie_name + Rake::Task["railties:install:assets"].invoke + end end end -- cgit v1.2.3 From 959f8576f2b70c35a2fd5c2c9563e695977f37b6 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 13 Oct 2010 16:20:09 +0300 Subject: Added foo:install:assets task that copies assets from plugins public directory to application's public directory This is the most simple and naive approach: just copy every files from engine to app. The only exception is when file has changed, in that case developer will be asked if he wants to rename the field. There is no need to make this task more sophisticated as 3.1 will be shipped with better assets handling and it will be the default way to handle things. --- railties/lib/rails/engine.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 86a8374ded..b004724757 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -546,12 +546,12 @@ module Rails ENV["FROM"] = railtie_name Rake::Task["railties:install:migrations"].invoke end - end - desc "Copy assets from #{railtie_name} to application" - task :assets do - ENV["FROM"] = railtie_name - Rake::Task["railties:install:assets"].invoke + desc "Copy assets from #{railtie_name} to application" + task :assets do + ENV["FROM"] = railtie_name + Rake::Task["railties:install:assets"].invoke + end end end end -- cgit v1.2.3 From 43215de208a6feabdbc5f4ec29551beef4f89885 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 13 Oct 2010 23:01:46 +0300 Subject: Add task foo:install (where foo is plugin) as a shortcutinstall:migrations and foo:install:assets --- railties/lib/rails/engine.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index b004724757..2ff28043c9 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -538,6 +538,12 @@ module Rails next if self.is_a?(Rails::Application) namespace railtie_name do + desc "Shortcut for running both rake #{railtie_name}:install:migrations and #{railtie_name}:install:assets" + task :install do + Rake::Task["#{railtie_name}:install:migrations"].invoke + Rake::Task["#{railtie_name}:install:assets"].invoke + end + namespace :install do # TODO Add assets copying to this list # TODO Skip this if there is no paths["db/migrate"] for the engine -- cgit v1.2.3 From a2c52f100446ab328cbde0e505216a99c602bc57 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Wed, 13 Oct 2010 23:14:15 +0300 Subject: Update documentation for new tasks --- railties/lib/rails/engine.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 2ff28043c9..7f0d96a2ff 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -189,17 +189,14 @@ module Rails # served by default. You should choose one of the two following strategies: # # * enable serving static files by setting config.serve_static_assets to true - # * symlink engines' public directories in application's public directory by running - # `rake ENGINE_NAME:install:assets`, where ENGINE_NAME is usually my_engine for the - # examples above + # * copy engine's public files to application's public folder with rake ENGINE_NAME:install:assets, for example + # rake my_engine:install:assets # # == Engine name # - # There are some places where engine's name is used. - # + # There are some places where engine's name is used: # * routes: when you mount engine with mount(MyEngine::Engine => '/my_engine'), it's used as default :as option - # - # * rake tasks: engines have a few rake tasks. They are usually under my_engine namespace. + # * some of the rake tasks are based on engine name, e.g. my_engine:install:migrations, my_engine:install:assets # # Engine name is set by default based on class name. For MyEngine::Engine it will be my_engine_engine. # You can change it manually it manually using engine_name method: @@ -317,6 +314,10 @@ module Rails # # rake ENGINE_NAME:install:migrations # + # Note that some of the migrations may be skipped if migration with the same name already exists + # in application. In such situation you must decide whether to leave that migration or rename the + # migration in application and rerun copying migrations. + # # If your engine has migrations, you may also want to prepare data for the database in # seeds.rb file. You can load that data using load_seed method, e.g. # -- cgit v1.2.3 From 11558a11fe2b1b614a9ae3f1e5c190b65a8d22ad Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 14 Oct 2010 00:09:36 +0300 Subject: Use railtie_name to correctly get name from plugins --- railties/lib/rails/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib/rails/engine.rb') diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 7f0d96a2ff..25ca8c4758 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -510,7 +510,7 @@ module Rails end initializer :append_asset_paths do - config.asset_path ||= "/#{engine_name}%s" + config.asset_path ||= "/#{railtie_name}%s" public_path = paths["public"].first if config.compiled_asset_path && File.exist?(public_path) -- cgit v1.2.3