Class: Nifty::Generators::LayoutGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/nifty/layout/layout_generator.rb

Instance Method Summary collapse

Methods inherited from Base

banner, source_root

Instance Method Details

#copy_imageObject



27
28
29
30
31
32
33
34
# File 'lib/generators/nifty/layout/layout_generator.rb', line 27

def copy_image
  puts File.dirname(__FILE__)
  Dir.foreach(File.join(File.dirname(__FILE__),"templates","assets",'images','aslon_scaffold')) do |filename|
    if File.file?(File.join(File.dirname(__FILE__),"templates","assets",'images','aslon_scaffold',filename))
       copy_file "assets/images/aslon_scaffold/#{filename}", "app/assets/images/aslon_scaffold/#{filename}"
    end
  end
end

#copy_localesObject



22
23
24
25
26
# File 'lib/generators/nifty/layout/layout_generator.rb', line 22

def copy_locales
  %w(aslon_scaffold.fr.yml).each do |filename|
    copy_file "locales/#{filename}", "app/config/locales/#{filename}"
  end
end

#copy_stylesheetObject



17
18
19
20
21
# File 'lib/generators/nifty/layout/layout_generator.rb', line 17

def copy_stylesheet
  %w( base formtastic formtastic_changes table_coffee_with_milk ).each do |filename|
    copy_file "assets/stylesheets/aslon_scaffold/#{filename}.css.sass", "assets/stylesheets/aslon_scaffold/#{filename}.css.sass"
  end
end

#create_layoutObject



10
11
12
13
14
15
16
# File 'lib/generators/nifty/layout/layout_generator.rb', line 10

def create_layout
    template '_default.html.haml', "app/views/layouts/_default.html.haml"
    template 'layout.html.haml', "app/views/layouts/#{file_name}.html.haml"

  copy_file 'layout_helper.rb', 'app/helpers/layout_helper.rb'
  copy_file 'error_messages_helper.rb', 'app/helpers/error_messages_helper.rb'
end