Class: Blacklight::ModelsGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/blacklight/models_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_routesObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/generators/blacklight/models_generator.rb', line 30

def add_routes
  route "\n  concern :exportable, Blacklight::Routes::Exportable.new\n\n  resources :solr_documents, only: [:show], path: '/catalog', controller: 'catalog' do\nconcerns :exportable\n  end\n\n  resources :bookmarks, only: [:index, :update, :create, :destroy] do\nconcerns :exportable\n\ncollection do\n  delete 'clear'\nend\n  end\n  EOF\nend\n"

#copy_migrationsObject

Setup the database migrations



26
27
28
# File 'lib/generators/blacklight/models_generator.rb', line 26

def copy_migrations
  rake "blacklight:install:migrations"
end

#create_configuration_filesObject

Copy all files in templates/config directory to host config



20
21
22
23
# File 'lib/generators/blacklight/models_generator.rb', line 20

def create_configuration_files
  copy_file "config/blacklight.yml", "config/blacklight.yml"
  gsub_file 'config/blacklight.yml', '__VERSION__', Blacklight::VERSION
end