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



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

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

#copy_config_filesObject

Copy the config files for Zotero and Arkivo



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

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



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

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



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

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