class DogBiscuits::WorkGenerator
Public Instance Methods
create_actor()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 48 def create_actor template('actor.rb.erb', File.join('app/actors/hyrax/actors', class_path, "#{file_name}_actor.rb")) end
create_attribute_rows()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 76 def create_attribute_rows attributes_file = "app/views/hyrax/#{file_name.pluralize}/_attribute_rows.html.erb" copy_file '_attribute_rows.html.erb', attributes_file end
create_form()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 68 def create_form template('form.rb.erb', File.join('app/forms/hyrax', class_path, "#{file_name}_form.rb")) end
create_indexer()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 52 def create_indexer if options[:skipmodel] say_status("info", "SKIPPING INDEXER GENERATION", :blue) else template('indexer.rb.erb', File.join('app/indexers', class_path, "#{file_name}_indexer.rb")) end end
create_model()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 60 def create_model if options[:skipmodel] say_status("info", "SKIPPING MODEL GENERATION", :blue) else template('model.rb.erb', File.join('app/models/', class_path, "#{file_name}.rb")) end end
create_presenter()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 72 def create_presenter generate "dog_biscuits:presenter #{class_name}", '-f' end
create_schema_org()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 85 def create_schema_org generate 'dog_biscuits:schema_org', '-f' end
display_readme()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 89 def display_readme readme 'README' end
hyrax_work_generator()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 33 def hyrax_work_generator unless options[:force] if File.exist? File.join('app/models/', class_path, "#{file_name}.rb") question = 'It looks like you ran the Hyrax work generator. Changes to the generated files will be overwritten. Continue?)' answer = ask question, default: 'Y' unless answer == 'Y' say_status("info", "CANCELLING", :red) exit 0 end end end say_status("info", "RUNNING rails generate hyrax:work #{class_name}", :blue) generate "hyrax:work #{class_name}", '-f' end
supported_model()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 26 def supported_model unless DogBiscuits.config.available_models.include? class_name say_status("error", "UNSUPPORTED MODEL. SUPPORTED MODELS ARE: #{DogBiscuits.config.available_models.map { |m| m }.join(', ')}", :red) exit 0 end end
update_locales()
click to toggle source
# File lib/generators/dog_biscuits/work/work_generator.rb, line 81 def update_locales generate 'dog_biscuits:locales', '-f' end