Skip to content

Commit

Permalink
Merge pull request #14472 from durandom/provider_generator
Browse files Browse the repository at this point in the history
Provider generator - tasks_private
  • Loading branch information
bdunne authored Mar 28, 2017
2 parents c4b880f + ac7f7fe commit b7933dc
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 25 deletions.
9 changes: 2 additions & 7 deletions lib/generators/provider/templates/Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'manageiq-providers-<%= provider_name %>'

begin
require 'rspec/core/rake_task'
Expand All @@ -9,12 +10,6 @@ begin
rescue LoadError
end

namespace :spec do
desc "Setup environment for specs"
task :setup => 'app:test:providers:<%= provider_name %>:setup'
end

desc "Run all <%= provider_name %> specs"
task :spec => 'app:test:providers:<%= provider_name %>'
FileList['lib/tasks_private/**/*.rake'].each { |r| load r }

task :default => :spec
10 changes: 10 additions & 0 deletions lib/generators/provider/templates/lib/tasks/%provider_name%.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#namespace :manageiq do
# namespace :providers do
# namespace :<%= provider_name %> do
# desc "Explaining what the task does"
# task :your_task do
# # Task goes here
# end
# end
# end
#end
6 changes: 6 additions & 0 deletions lib/generators/provider/templates/lib/tasks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Tasks (.rake files) in this directory will be available in the main ManageIQ app.
They can be executed in the provider gem via the app: namespace

bin/rails app:<task>

Task private to the provider should go into lib/tasks/tasks_private.
17 changes: 0 additions & 17 deletions lib/generators/provider/templates/lib/tasks/spec.rake

This file was deleted.

11 changes: 11 additions & 0 deletions lib/generators/provider/templates/lib/tasks_private/spec.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace :spec do
desc "Setup environment specs"
task :setup => ["app:test:initialize", "app:test:verify_no_db_access_loading_rails_environment", "app:test:setup_db"]
end

desc "Run all specs"
RSpec::Core::RakeTask.new(:spec => ["app:test:initialize", "app:evm:compile_sti_loader"]) do |t|
spec_dir = File.expand_path("../../spec", __dir__)
EvmTestHelper.init_rspec_task(t, ['--require', File.join(spec_dir, 'spec_helper')])
t.pattern = FileList[spec_dir + '/**/*_spec.rb'].exclude(spec_dir + '/manageiq/**/*_spec.rb')
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.description = "<%= class_name %> Provider for ManageIQ"
s.licenses = ["Apache-2.0"]
s.files = Dir["{app,config.lib}/**/*"]
s.files = Dir["{app,config,lib}/**/*"]
s.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
s.add_development_dependency "simplecov"
Expand Down

0 comments on commit b7933dc

Please sign in to comment.