Skip to content

Commit

Permalink
fix for heroku read-only file system
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Oct 27, 2010
1 parent dfba415 commit 01d11f8
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions hobo/lib/hobo/engine.rb
Expand Up @@ -13,6 +13,7 @@ class Engine < Rails::Engine
h.routes_path = Pathname.new File.expand_path('config/hobo_routes.rb', Rails.root)
h.rapid_generators_path = Pathname.new File.expand_path('lib/hobo/rapid/generators', Hobo.root)
h.auto_taglibs_path = Pathname.new File.expand_path('app/views/taglibs/auto', Rails.root)
h.read_only_file_system = !!ENV['HEROKU_TYPE']
end

ActiveSupport.on_load(:action_controller) do
Expand Down Expand Up @@ -48,18 +49,28 @@ class Engine < Rails::Engine
initializer 'hobo.routes' do |app|
h = app.config.hobo
# generate at first boot, so no manual generation is required
Rails::Generators.invoke('hobo:routes', %w[-f -q]) unless File.exists?(h.routes_path)
unless File.exists?(h.routes_path)
if h.read_only_file_system
raise Hobo::Error, "No #{h.routes_path} found!"
else
Rails::Generators.invoke('hobo:routes', %w[-f -q])
end
end
app.routes_reloader.paths << h.routes_path
app.config.to_prepare do
Rails::Generators.configure!
# generate before each request in development
Rails::Generators.invoke('hobo:routes', %w[-f -q])
unless h.read_only_file_system
app.config.to_prepare do
Rails::Generators.configure!
# generate before each request in development
Rails::Generators.invoke('hobo:routes', %w[-f -q])
end
end
end

initializer 'hobo.dryml' do |app|
app.config.to_prepare do
Dryml::DrymlGenerator.run
unless app.config.hobo.read_only_file_system
app.config.to_prepare do
Dryml::DrymlGenerator.run
end
end
end

Expand Down

0 comments on commit 01d11f8

Please sign in to comment.