Skip to content

Commit

Permalink
move generator templates into correct directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Julie Allinson committed Dec 3, 2018
1 parent 62692c9 commit 68ebfea
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# DogBiscuits

[![Build Status](https://travis-ci.org/samvera-labs/dog_biscuits.svg?branch=cleanup)](https://travis-ci.org/samvera-labs/dog_biscuits)
Code: [![Build Status](https://travis-ci.org/samvera-labs/dog_biscuits.svg?branch=cleanup)](https://travis-ci.org/samvera-labs/dog_biscuits)
[![Coverage Status](https://coveralls.io/repos/github/samvera-labs/dog_biscuits/badge.svg?branch=master)](https://coveralls.io/github/samvera-labs/dog_biscuits?branch=master)
[![Maintainability](https://api.codeclimate.com/v1/badges/10912dcb2451a6c4490c/maintainability)](https://codeclimate.com/github/samvera-labs/dog_biscuits/maintainability)
[![Inline docs](http://inch-ci.org/github/samvera-labs/dog_biscuits.svg?branch=master)](http://inch-ci.org/github/samvera-labs/dog_biscuits)
Expand Down
10 changes: 3 additions & 7 deletions lib/generators/dog_biscuits/authority_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def inject_into_dog_biscuits

def inject_into_authority_service
file_path = 'app/services/authority_service.rb'
copy_file 'authority_service.rb', file_path
copy_file 'app/services/authority_service.rb', file_path

::DogBiscuits::Terms.constants.each do |term|
t = term.to_s
Expand All @@ -67,11 +67,7 @@ def inject_into_authority_service
end
end

def copy_local_authority_concern
copy_file 'local_authority_concern.rb', 'app/services/concerns/local_authority_concern.rb'
end

def copy_file_authority_concern
copy_file 'file_authority_concern.rb', 'app/services/concerns/file_authority_concern.rb'
def copy_concerns
directory 'app/services/concerns', 'app/services/concerns'
end
end
21 changes: 4 additions & 17 deletions lib/generators/dog_biscuits/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def create_dog_biscuits
copy_file 'config/initializers/dog_biscuits.rb', init_path unless File.exist?(init_path)
end

def create_app
directory 'app', 'app'
end

def update_initializer
gsub_file 'config/initializers/dog_biscuits.rb', /# Available models are:/, "# Available models are: #{DogBiscuits.config.available_models.join(', ')}"
end
Expand All @@ -43,36 +47,19 @@ def create_authorities
generate 'dog_biscuits:authority'
end

def create_local_form_metadata_service
copy_file 'app/services/local_form_metadata_service.rb', 'app/services/local_form_metadata_service.rb'
end

def create_helpers
db_injection = ' include ::DogBiscuitsHelper'
unless File.read('app/helpers/hyrax_helper.rb').include? db_injection
inject_into_file 'app/helpers/hyrax_helper.rb', after: "Hyrax::HyraxHelperBehavior\n" do
"#{db_injection}\n"
end
end
directory 'app/helpers/', 'app/helpers/'
end

def create_renderers
directory 'app/renderers/', 'app/renderers/'
end

def create_schema_org
generate 'dog_biscuits:schema_org'
end

def create_edit_fields_and_inputs
directory 'app/views/records', 'app/views/records'
end

def add_custom_form
copy_file 'app/views/hyrax/base/_form_metadata.html.erb', 'app/views/hyrax/base/_form_metadata.html.erb'
end

# TODO: remove when fixed
def create_views
copy_file 'app/views/hyrax/base/_work_description.erb', 'app/views/hyrax/base/_work_description.erb'
Expand Down

0 comments on commit 68ebfea

Please sign in to comment.