Class: Hyrax::ArkivoApiGenerator

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

Instance Method Summary collapse

Instance Method Details



9
10
11
# File 'lib/generators/hyrax/arkivo_api_generator.rb', line 9

def banner
  say_status("info", "ADDING ZOTERO/ARKIVO API INTEGRATION", :blue)
end

#copy_config_filesObject

Copy the config files for Zotero and Arkivo



29
30
31
32
# File 'lib/generators/hyrax/arkivo_api_generator.rb', line 29

def copy_config_files
  copy_file 'config/arkivo.yml', 'config/arkivo.yml'
  copy_file 'config/zotero.yml', 'config/zotero.yml'
end

#copy_routing_constraintObject

Copy the routing constraint over



24
25
26
# File 'lib/generators/hyrax/arkivo_api_generator.rb', line 24

def copy_routing_constraint
  copy_file 'config/arkivo_constraint.rb', 'config/initializers/arkivo_constraint.rb'
end

#inject_arkivo_configObject

Turn on the feature set in Hyrax’s config



14
15
16
17
18
19
20
21
# File 'lib/generators/hyrax/arkivo_api_generator.rb', line 14

def inject_arkivo_config
  inject_into_file 'config/initializers/hyrax.rb', after: /^Hyrax\.config do.*$/ do
    "\n  # Hyrax can integrate with Zotero's Arkivo service for automatic deposit\n" \
      "  # of Zotero-managed research items.\n" \
      "  # Defaults to false.  See README for more info\n" \
      "  config.arkivo_api = true\n"
  end
end