Class: Stall::ViewGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/stall/view/view_generator.rb

Defined Under Namespace

Classes: ViewNotFound

Constant Summary collapse

VIEWS_DIR =
File.expand_path('../../../../../app/views', __FILE__)

Instance Method Summary collapse

Instance Method Details

#copy_view_templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/stall/view/view_generator.rb', line 10

def copy_view_template
  paths = file_paths.map do |file_path|
    source_path = source_path_for(file_path)
    raise ViewNotFound, "Could not find any stall view for #{ file_path }" unless File.exist?(source_path)
    target_path = "app/views/#{ file_path_with_ext_for(file_path) }"

    [source_path, target_path]
  end

  paths.each do |source_path, target_path|
    template(source_path, target_path)
  end
end