Class: Fullstack::Cms::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/fullstack/cms/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#assetsObject



35
36
37
38
39
40
41
42
43
# File 'lib/generators/fullstack/cms/install_generator.rb', line 35

def assets
  append_to_file "config/assets.yml" do
<<-eos
- site/site.css
- site/site.js          
eos
    
  end
end

#install_fullstack_adminObject



11
12
13
# File 'lib/generators/fullstack/cms/install_generator.rb', line 11

def install_fullstack_admin
    generate "fullstack:admin:install  --host='#{host}' --user='#{user}'  --title='#{title}' --slogan='#{slogan}'"
end

#install_librariesObject



15
16
17
18
19
20
21
# File 'lib/generators/fullstack/cms/install_generator.rb', line 15

def install_libraries
  
  generate "ars_permalink:install"
  generate "has_attached:install"  
  generate "acts_as_taggable_on:migration"
          
end

#install_migrationsObject



63
64
65
# File 'lib/generators/fullstack/cms/install_generator.rb', line 63

def install_migrations
  generate "migration:from link menu page_part page redirect setting attachment photo text_page_part text_with_title_page_part"
end

#routes_rbObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/generators/fullstack/cms/install_generator.rb', line 45

def routes_rb
  
  route '''
  # namespace :site, :path => "/" do
  #   mount_controller "site" 
  # end
  
  '''

  route '''
  constraints(:host => /^#{Regexp.escape(Settings.app.domain)}/) do
    root :to => redirect("http://www.#{Settings.app.domain}")
    match \'/*path\', :to => redirect {|params| "http://www.#{Settings.app.domain}/#{params[:path]}"}
  end
     
  '''
end

#templates_treeObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/generators/fullstack/cms/install_generator.rb', line 23

def templates_tree
  remove_file "public"
  remove_file "app/assets/javascripts/application.js"
  remove_file "app/assets/javascripts/application.css"
  remove_file "app/views/layouts/application.html.erb"
  remove_file "public/404.html"
  remove_file "public/robots.txt"
  remove_file "config/styles.yml"
  
  directory "rails", Rails.root
end