Skip to content

Commit

Permalink
Merge pull request #3765 from samvera/uv_rake
Browse files Browse the repository at this point in the history
Add universal_viewer install task
  • Loading branch information
cjcolvar authored Jun 3, 2019
2 parents 0494067 + 2ccacca commit 0914819
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/generators/hyrax/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ def riiif_image_server
end

def universalviewer_files
copy_file 'package.json', 'package.json'
copy_file 'uv.html', 'config/uv/uv.html'
copy_file 'uv-config.json', 'config/uv/uv-config.json'
rake('hyrax:universal_viewer:install')
end

# Blacklight::Controller will by default add an after_action filter to discard all flash messages on xhr requests.
Expand Down
15 changes: 15 additions & 0 deletions lib/tasks/universal_viewer.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace :hyrax do
namespace :universal_viewer do
desc "Install Universal Viewer"
task install: :environment do
# Copy the files into place
hyrax_templates_path = File.join(Gem.loaded_specs['hyrax'].full_gem_path, 'lib', 'generators', 'hyrax', 'templates')
copy_file File.join(hyrax_templates_path, 'package.json'), Rails.root.join('package.json')
Dir.mkdir(Rails.root.join('config', 'uv')) unless File.exist?(Rails.root.join('config', 'uv'))
copy_file File.join(hyrax_templates_path, 'uv.html'), Rails.root.join('config', 'uv', 'uv.html')
copy_file File.join(hyrax_templates_path, 'uv-config.json'), Rails.root.join('config', 'uv', 'uv-config.json')

puts 'Universal Viewer (UV) configs copied into place, install UV by running yarn install or rake assets:precompile'
end
end
end

0 comments on commit 0914819

Please sign in to comment.