Sha256: 37e4870a82725045f2be79ebd7634ce781e6b997d8fcfc2884d36556f078b289

Contents?: true

Size: 1.48 KB

Versions: 3

Compression:

Stored size: 1.48 KB

Contents

def with_git(message)
  yield if block_given?
  if ! options.fetch('skip_git', false)
    git :init
    git add: '.'
    git commit: "-a -m '#{message}'"
  end
end
def yes_with_banner?(message, banner = "*" * 80)
  yes?("\n#{banner}\n\n#{message}\n#{banner}\nType y(es) to confirm:")
end

with_git("Initial commit")

with_git("Adding curate gem") do
  gem 'curate', "~> <%= Curate::VERSION %>"
end

DOI_QUESTION =
<<-QUESTION_TO_ASK
Would you like to allow remote minting of Digital Object Identifiers (DOI)s?

More information at http://simple.wikipedia.org/wiki/Doi
QUESTION_TO_ASK

with_doi_answer = yes_with_banner?(DOI_QUESTION)

command = [:curate, "--with-doi=#{with_doi_answer}"]

with_git("Install curate gem with#{with_doi_answer ? '' : 'out' } DOI support\n\nWith generator: #{command.join(' ')}") do
  generate(*command)
end

JETTY_QUESTION =
<<-QUESTION_TO_ASK
Would you like to use jettywrapper for your SOLR and Fedora?

More information at https://github.com/projecthydra/jettywrapper/
QUESTION_TO_ASK

if yes_with_banner?(JETTY_QUESTION)
  with_git("Configuring to ignore jetty dir") do
    append_file '.gitignore', "\njetty/\n"
  end

  with_git("Installing jettywrapper") do
    gem 'jettywrapper', group: [:development, :test]
    run 'bundle install'
  end

  with_git("Downloading jettywrapper") do
    if yes_with_banner?("Would you like to download jetty now?\n\nThis will take quite awhile based on download speeds.")
      rake "jetty:download"
      rake "jetty:config"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
curate-0.5.1 lib/generators/curate/application_template.rb.erb
curate-0.5.0 lib/generators/curate/application_template.rb.erb
curate-0.4.2 lib/generators/curate/application_template.rb.erb