Skip to content

Commit

Permalink
* Fix issue #556 now we resolve correctly prerequisites of your app
Browse files Browse the repository at this point in the history
* Enhancement for #556 now is possible to add custom prerequisites to our app
  • Loading branch information
DAddYE committed Jun 7, 2011
1 parent 434c4be commit f41d374
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rdoc
Expand Up @@ -10,6 +10,8 @@
* Fix Double loading of boot.rb in rake tasks. #560
* Fix an issue with haml rendering on rubinius
* Fix an issue with ordered hash on rubinius in our core tests
* Fix issue #556 now we resolve correctly prerequisites of your app
* Enhancement for #556 now is possible to add custom prerequisites to our app

== 0.9.29

Expand Down
28 changes: 24 additions & 4 deletions padrino-core/lib/padrino-core/application.rb
Expand Up @@ -18,10 +18,13 @@ def inherited(base) #:nodoc:
logger.devel "Setup #{base}"
CALLERS_TO_IGNORE.concat(PADRINO_IGNORE_CALLERS)
base.default_configuration!
Padrino.require_dependencies File.join(base.root, "/models.rb")
Padrino.require_dependencies File.join(base.root, "/models/**/*.rb")
Padrino.require_dependencies File.join(base.root, "/lib.rb")
Padrino.require_dependencies File.join(base.root, "/lib/**/*.rb")
base.prerequisites.concat([
File.join(base.root, "/models.rb"),
File.join(base.root, "/models/**/*.rb"),
File.join(base.root, "/lib.rb"),
File.join(base.root, "/lib/**/*.rb")
]).uniq!
Padrino.require_dependencies(base.prerequisites)
super(base) # Loading the subclass inherited method
end

Expand Down Expand Up @@ -137,6 +140,23 @@ def dependencies
].map { |file| Dir[File.join(self.root, file)] }.flatten
end

##
# An array of file to load before your app.rb, basically are files wich our app depends on.
#
# By default we look for files:
#
# yourapp/models.rb
# yourapp/models/**/*.rb
# yourapp/lib.rb
# yourapp/lib/**/*.rb
#
# ==== Examples
# MyApp.prerequisites << Padrino.root('my_app', 'custom_model.rb')
#
def prerequisites
@_prerequisites ||= []
end

protected
##
# Defines default settings for Padrino application
Expand Down

0 comments on commit f41d374

Please sign in to comment.