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
41
|
# File 'lib/rails/generators/dev_page_install/dev_page_install_generator.rb', line 6
def setup
current_root = File.expand_path("../templates", __FILE__)
if(!File.exist? 'app/controllers/pages_controller.rb')
puts 'create pages_controller'
copy_file "pages_controller.rb", "app/controllers/pages_controller.rb"
end
if(!File.exist? 'app/controllers/page_parts_controller.rb')
puts 'create page_parts_controller'
copy_file "page_parts_controller.rb", "app/controllers/page_parts_controller.rb"
end
if(!File.directory? 'app/views/pages/')
puts 'mkdir app/views/pages'
FileUtils.mkdir 'app/views/pages'
end
if(!File.directory? 'app/assets/javascripts/cms')
puts 'copy cms js'
FileUtils.cp_r current_root + '/cms', 'app/assets/javascripts/cms'
end
if(!File.directory? 'app/assets/javascripts/minified')
FileUtils.cp_r current_root + '/minified', 'app/assets/javascripts/minified'
end
if(!File.directory? 'app/views/page_parts')
FileUtils.cp_r current_root + '/page_parts', 'app/views/page_parts/'
end
copy_file "migrate_page_parts.rb", "db/migrate/#{Time.now.to_i}_migrate_page_parts.rb"
copy_file "page_part.rb", "app/models/page_part.rb"
copy_file "col-2-left.html.erb", "app/views/layouts/col-2-left.html.erb"
route("resources :page_parts")
end
|