Skip to content

Commit

Permalink
Provide a way to run tasks after test_app generation
Browse files Browse the repository at this point in the history
  • Loading branch information
dlpierce committed Sep 1, 2017
1 parent 5170f8e commit fae0ac6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .rubocop_fixme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ Style/PredicateName:
Exclude:
- 'app/helpers/hyrax/collections_helper.rb'

Style/SpecialGlobalVars:
Exclude:
- 'tasks/hyrax_dev.rake'

Rails/Output:
Exclude:
- 'lib/generators/**/*'
Expand Down
21 changes: 21 additions & 0 deletions tasks/hyrax_dev.rake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ task :i18n_sorter do
end
end

if Gem.loaded_specs.key? :engine_cart
namespace :engine_cart do
# This generate task should only add its action to an existing engine_cart:generate task
raise 'engine_cart:generate task should already be defined' unless Rake::Task.task_defined?('engine_cart:generate')
task :generate do |_task|
puts 'Running post-generation operations...'
Rake::Task['engine_cart:after_generate'].invoke
end

desc 'Operations that need to run after the test_app migrations have run'
task :after_generate do
puts 'Creating default collection type...'
EngineCart.within_test_app do
unless system "bundle exec rake hyrax:default_collection_types:create"
raise "EngineCart failed on with: #{$?}"
end
end
end
end
end

desc 'Generate the engine_cart and spin up test servers and run specs'
task ci: ['rubocop', 'engine_cart:generate'] do
puts 'running continuous integration'
Expand Down

0 comments on commit fae0ac6

Please sign in to comment.