Class: Motion::Project::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-dryer/controllers_extension.rb

Instance Method Summary collapse

Instance Method Details

#add_dependency(app) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/motion-dryer/controllers_extension.rb', line 7

def add_dependency(app)     
  @controllers ||= []
  @controllers = [@controllers] unless @controllers.is_a?(Array)
  common_views   = Dir.glob("app/views/common/*.rb")
  common_helpers = Dir.glob("app/helpers/application_helper.rb")
  @controllers.each do |controller|
    controller_file = Dir.glob("app/*/#{controller}_controller.rb").first
    helper_files = Dir.glob("app/helpers/#{controller}_helper.rb")
    views_files = Dir.glob("app/views/#{controller}/*.rb")
    app.file_dependencies controller_file => (common_helpers + common_views + helper_files + views_files)
  end
end