Sha256: 3bdb0a2faa6eb735d521c08691001fe4281891f7026adf5cfb7a8a6ff5571074

Contents?: true

Size: 817 Bytes

Versions: 13

Compression:

Stored size: 817 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'rails/generators'

module Curate::Work
  class WithDoiGenerator <  Rails::Generators::Base
    argument :targets, type: :array, required: true, banner: "target, target"
    def append_doi_initializer
      options = targets
      options << [%(--target='{|obj| Curate.permanent_url_for(obj) }')]
      options << [%(--creator=:creator)]
      options << [%(--title=:title)]
      options << [%(--publisher='{|o| Array(o.publisher).join("; ")}')]
      options << [%(--publication_year='{|o| o.date_uploaded.year }')]
      options << [%(--set_identifier='{|o,value| o.identifier = value; o.save }')]
      args = ['hydra:remote_identifier:doi', options.join(" ")]

      if behavior == :revoke
        destroy(*args)
      else
        generate(*args)
      end

    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
curate-0.6.6 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.6.5 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.6.4 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.6.3 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.6.1 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.6.0 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.5.6 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.5.5 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.5.4 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.5.2 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.5.1 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.5.0 lib/generators/curate/work/with_doi/with_doi_generator.rb
curate-0.4.2 lib/generators/curate/work/with_doi/with_doi_generator.rb