Skip to content
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
11 changes: 6 additions & 5 deletions lib/solidus_dev_support/rake_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ module SolidusDevSupport
class RakeTasks
include Rake::DSL

def self.install(*args)
new(*args).tap(&:install)
def self.install(**args)
new(**args).tap(&:install)
end

def initialize(root: Dir.pwd)
def initialize(root: Dir.pwd, user_class: "Spree::LegacyUser")
@root = Pathname(root)
@test_app_path = @root.join(ENV.fetch('DUMMY_PATH', 'spec/dummy'))
@gemspec = Bundler.load_gemspec(@root.glob("{,*}.gemspec").first)
@user_class = user_class
end

attr_reader :test_app_path, :root, :gemspec
Expand All @@ -39,12 +40,12 @@ def install_test_app_task
# We need to go back to the gem root since the upstream
# extension:test_app changes the working directory to be the dummy app.
task :test_app do
Rake::Task['extension:test_app'].invoke
Rake::Task['extension:test_app'].invoke(@user_class)
cd root
end

directory ENV.fetch('DUMMY_PATH', nil) do
Rake::Task['extension:test_app'].invoke
Rake::Task['extension:test_app'].invoke(@user_class)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/solidus_dev_support/templates/extension/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

require "bundler/gem_tasks"
require 'solidus_dev_support/rake_tasks'
SolidusDevSupport::RakeTasks.install
SolidusDevSupport::RakeTasks.install(user_class: "Spree::User")

task default: 'extension:specs'