Class: Virgo::ViewsGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_viewsObject


5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/virgo/views/views_generator.rb', line 5

def copy_views
  Dir["#{engine_root}/app/views/**/*"].reject { |f|
    f.include?('admin') ||
    f.include?('shortcode_templates')
  }.each do |abs_path|
    relative_path = abs_path.gsub("#{engine_root}/", '')

    unless File.directory?(abs_path)
      copy_file relative_path, relative_path
    end
  end
end

#engine_rootObject


18
19
20
# File 'lib/generators/virgo/views/views_generator.rb', line 18

def engine_root
  File.expand_path('../../../../..', __FILE__)
end