Class: SmartListing::Generators::ViewsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/smart_listing/views_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

:nodoc:



6
7
8
9
10
11
12
# File 'lib/generators/smart_listing/views_generator.rb', line 6

def self.banner #:nodoc:
  <<-BANNER.chomp
rails g smart_listing:views

    Copies all smart listing partials templates to your application.
BANNER
end

Instance Method Details

#copy_viewsObject



15
16
17
18
19
20
# File 'lib/generators/smart_listing/views_generator.rb', line 15

def copy_views
  filename_pattern = File.join self.class.source_root, "*.html.erb"
  Dir.glob(filename_pattern).map {|f| File.basename f}.each do |f|
    copy_file f, "app/views/smart_listing/#{f}"
  end
end