Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move generator templates into correct directories #110

Merged
1 commit merged into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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