Class: SpreeCms::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/spree_cms/install/install_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/generators/spree_cms/install/install_generator.rb', line 8

def self.next_migration_number(dirname)
  if ActiveRecord::Base.timestamped_migrations
    Time.now.utc.strftime("%Y%m%d%H%M%S%L")
  else
    "%.3d" % (current_migration_number(dirname) + 1)
  end
end

Instance Method Details

#copy_assetsObject



16
17
18
# File 'lib/generators/spree_cms/install/install_generator.rb', line 16

def copy_assets
  directory "public", "public"
end

#copy_config_filesObject



20
21
22
# File 'lib/generators/spree_cms/install/install_generator.rb', line 20

def copy_config_files
  copy_file "config/disqus_config.yml", "config/disqus_config.yml"
end

#generate_migrationsObject



24
25
26
27
28
29
# File 'lib/generators/spree_cms/install/install_generator.rb', line 24

def generate_migrations
  migration_template "db/migrate/create_pages.rb", "db/migrate/create_pages.rb" rescue true
  migration_template "db/migrate/create_posts.rb", "db/migrate/create_posts.rb" rescue true
  migration_template "db/migrate/add_display_name_to_user.rb", "db/migrate/add_display_name_to_user.rb" rescue true
  migration_template "db/migrate/is_taggable_migration.rb", "db/migrate/is_taggable_migration.rb" rescue true
end

#generate_routesObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/generators/spree_cms/install/install_generator.rb', line 31

def generate_routes
  # route('resources :posts')
  #         route('match "'+Spree::Config[:cms_permalink]+'/tags/:tag_name" => "posts#tags", :as => "tag_posts"')
  #         route('resources :pages')
  #         route('namespace :admin do
  #           resource :cms_settings
  #           resources :posts
  #           resources :pagess
  #         end')
end