Class: ProjectFilesGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_template_filesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/generators/project_files/project_files_generator.rb', line 4

def copy_template_files
  gem_template_dir = File.expand_path('../templates', __FILE__) #this is for me : )
  app_root         = destination_root

  #copy view templates
  cmd = "mkdir -v #{app_root}/lib/templates"
  puts `#{cmd}`
  cmd = "cp -vR #{gem_template_dir}/view_templates/* #{app_root}/lib/templates/"
  puts `#{cmd}`

  #make shared dir
  cmd = "mkdir -v #{app_root}/app/views/shared/"
  puts `#{cmd}`
  
  #copy shared 
  cmd = "cp -vR #{gem_template_dir}/views/shared/* #{app_root}/app/views/shared/"
  puts `#{cmd}`
  
  #copy layout
  cmd = "cp -vR #{gem_template_dir}/views/application.html.haml  #{app_root}/app/views/layouts/"
  puts `#{cmd}`

  #remove erb layout file here
  cmd = "rm #{app_root}/app/views/layouts/application.html.erb"
  puts `#{cmd}`

  #copy images
  cmd = "cp -vR #{gem_template_dir}/images/* #{app_root}/public/images/"
  puts `#{cmd}`

  #copy stylesheets
  cmd = "cp -vR #{gem_template_dir}/stylesheets/* #{app_root}/public/stylesheets/"
  puts `#{cmd}`


  
end