Class: KisoThemes::Generators::ContentBlocksGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
HandlerSupport
Defined in:
lib/generators/kiso_themes/content_blocks_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_content_blocksObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/generators/kiso_themes/content_blocks_generator.rb', line 14

def copy_content_blocks
  layouts_path = "app/views/content_blocks"
  source_path = "../../../../app/views/content_blocks"
  target_full_base_path = Pathname.new(File.expand_path(source_path, __FILE__))
  layouts = Dir.glob(File.expand_path("#{source_path}/**/*", __FILE__)).select { |lf|
    lf.end_with? handler
  }.map { |lf|
    Pathname.new(lf).relative_path_from(target_full_base_path).to_s
  }

  layouts.each do |name|
    copy_file File.join(source_path, name), "#{layouts_path}/#{name}"
  end
end