Sha256: a7d65eb214d6b10593cf009fb6f4b7325ab7c5693ee3cc71eba913354d1895ae

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require_relative 'abstract_migration_generator'

class Sufia::ArkivoApiGenerator < Sufia::AbstractMigrationGenerator
  source_root File.expand_path('../templates', __FILE__)

  desc """
This generator sets up Zotero/Arkivo API integration for your application:
       """

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

  # Turn on the feature set in Sufia's config
  def inject_arkivo_config
    inject_into_file 'config/initializers/sufia.rb', after: /^Sufia\.config do.*$/ do
      "\n  # Sufia 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

  # Copy the routing constraint over
  def copy_routing_constraint
    copy_file 'config/arkivo_constraint.rb', 'config/initializers/arkivo_constraint.rb'
  end

  # Copy the database migration
  def copy_migration
    better_migration_template 'add_arkivo_to_users.rb'
  end

  # Copy the config files for Zotero and Arkivo
  def copy_config_files
    copy_file 'config/arkivo.yml', 'config/arkivo.yml'
    copy_file 'config/zotero.yml', 'config/zotero.yml'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sufia-7.0.0.beta3 lib/generators/sufia/arkivo_api_generator.rb
sufia-7.0.0.beta2 lib/generators/sufia/arkivo_api_generator.rb
sufia-7.0.0.beta1 lib/generators/sufia/arkivo_api_generator.rb