Class: Pwnstyles::AllGenerator

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

Overview

rails g pwnstyles:all

Instance Method Summary collapse

Instance Method Details

#copy_layoutObject



10
11
12
13
14
15
16
17
18
# File 'lib/pwnstyles_rails/generators/all_generator.rb', line 10

def copy_layout
  dir = File.expand_path 'layouts', File.dirname(__FILE__)
  Dir.glob(File.join(dir, '*'), File::FNM_DOTMATCH).each do |source|
    next if File.directory?(source)
    source_file = source[(dir.length + 1)..-1]
    dest = Rails.root.join 'app', 'views', 'layouts', source_file
    copy_file source, dest
  end
end

#copy_static_assetsObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pwnstyles_rails/generators/all_generator.rb', line 20

def copy_static_assets
  dir = File.expand_path 'assets',
                         File.dirname(__FILE__)
  Dir.glob(File.join(dir, '**', '*'), File::FNM_DOTMATCH).each do |source|
    next if File.directory?(source)
    source_file = source[(dir.length + 1)..-1]
    
    dest = Rails.root.join 'app', 'assets', source_file
    copy_file source, dest
  end
end