-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
43 lines (36 loc) · 1.21 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'bundler/setup'
require 'rspec/core/rake_task'
def clear_specs
base_path = File.join(Dir.pwd, 'spec')
FileUtils.rm_rf(base_path) if File.exist?(base_path)
end
desc 'Update Git submodules.'
task :update_submodules do
`git submodule foreach git pull origin master`
end
task :copy_and_run_doorkeeper_specs do
# Clear specs dir
clear_specs
# Copy native Doorkepeer specs
if Dir['doorkeeper/*'].empty?
`git submodule init`
`git submodule update`
end
`cp -r -n doorkeeper/spec .`
# Replace ORM-independent files (configs, models, etc)
FileUtils.cp_r('stubs/spec_helper_integration.rb', 'spec/spec_helper_integration.rb')
FileUtils.cp_r('stubs/models/user.rb', 'spec/dummy/app/models/user.rb')
FileUtils.cp_r('stubs/config/application.rb', 'spec/dummy/config/application.rb')
FileUtils.cp_r('stubs/support/orm/dynamoid.rb', 'spec/support/orm/dynamoid.rb')
FileUtils.rm('spec/support/orm/active_record.rb')
# Run specs
`bundle exec rspec`
end
desc 'Default: run specs.'
task default: :spec
desc 'Clone doorkeeper specs, prepare it for run'
task spec: :copy_and_run_doorkeeper_specs
RSpec::Core::RakeTask.new(:spec) do |config|
config.verbose = false
end
Bundler::GemHelper.install_tasks