Class: Blacklight::Install

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

Instance Method Summary collapse

Instance Method Details

#add_default_catalog_routeObject



78
79
80
# File 'lib/generators/blacklight/install_generator.rb', line 78

def add_default_catalog_route
  route("root to: \"#{controller_name}#index\"")
end

#add_routesObject



97
98
99
# File 'lib/generators/blacklight/install_generator.rb', line 97

def add_routes
  route "mount Blacklight::Engine => '/'"
end

#add_solr_wrapperObject



32
33
34
# File 'lib/generators/blacklight/install_generator.rb', line 32

def add_solr_wrapper
  generate 'blacklight:solr' unless options[:'skip-solr']
end

#bundle_installObject



45
46
47
48
49
50
51
# File 'lib/generators/blacklight/install_generator.rb', line 45

def bundle_install
  inside destination_root do
    Bundler.with_unbundled_env do
      run "bundle install"
    end
  end
end

#copy_public_assetsObject

Copy all files in templates/public/ directory to public/ Call external generator in AssetsGenerator, so we can leave that callable seperately too.



39
40
41
42
43
# File 'lib/generators/blacklight/install_generator.rb', line 39

def copy_public_assets
  generated_options = "--bootstrap-version='#{Shellwords.escape(options[:'bootstrap-version'])}'" if options[:'bootstrap-version']

  generate "blacklight:assets", generated_options unless options[:'skip-assets']
end

#generate_blacklight_documentObject



53
54
55
# File 'lib/generators/blacklight/install_generator.rb', line 53

def generate_blacklight_document
  generate 'blacklight:document', document_name
end

#generate_blacklight_marc_demoObject



86
87
88
89
90
91
92
93
94
95
# File 'lib/generators/blacklight/install_generator.rb', line 86

def generate_blacklight_marc_demo
  return unless options[:marc]

  blacklight_marc = String.new('blacklight-marc')
  gem blacklight_marc, '~> 8.0'

  bundle_install

  generate 'blacklight:marc:install'
end

#generate_blacklight_modelsObject



61
62
63
# File 'lib/generators/blacklight/install_generator.rb', line 61

def generate_blacklight_models
  generate 'blacklight:models'
end

#generate_blacklight_userObject



65
66
67
68
69
70
71
72
# File 'lib/generators/blacklight/install_generator.rb', line 65

def generate_blacklight_user
  generator_args = [model_name]
  if options[:devise]
    generator_args << "--devise #{options[:devise]}"
  end

  generate 'blacklight:user', generator_args.join(" ")
end

#generate_controllerObject



74
75
76
# File 'lib/generators/blacklight/install_generator.rb', line 74

def generate_controller
  generate 'blacklight:controller', controller_name
end

#generate_search_builderObject



57
58
59
# File 'lib/generators/blacklight/install_generator.rb', line 57

def generate_search_builder
  generate 'blacklight:search_builder', search_builder_name
end

#inject_blacklight_i18n_stringsObject



82
83
84
# File 'lib/generators/blacklight/install_generator.rb', line 82

def inject_blacklight_i18n_strings
  copy_file "blacklight.en.yml", "config/locales/blacklight.en.yml"
end