forked from pact-foundation/pact_broker-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
40 lines (31 loc) · 1.35 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
require "bundler/gem_tasks"
# When running the release action, we don't want to load all the 'prod' gems
# because they're not installed on the release Docker image
require 'rspec/core/rake_task'
require 'conventional_changelog'
Dir.glob('lib/tasks/**/*.rake').each { |task| load "#{Dir.pwd}/#{task}" }
Dir.glob('tasks/**/*.rake').each { |task| load "#{Dir.pwd}/#{task}" }
RSpec::Core::RakeTask.new(:spec) do | task |
task.rspec_opts = "--pattern spec/lib/**/*_spec.rb"
end
RSpec::Core::RakeTask.new('spec:providers') do | task |
task.rspec_opts = "--pattern spec/service_providers/**/*_spec.rb"
end
# Must be run after spec:providers because it relies on the generated pact
RSpec::Core::RakeTask.new('spec:integration') do | task |
task.rspec_opts = "--pattern spec/integration/**/*_spec.rb"
end
task :default => [:spec, 'spec:providers', 'spec:integration']
task :generate_changelog do
require 'pact_broker/client/version'
ConventionalChangelog::Generator.new.generate! version: "v#{PactBroker::Client::VERSION}"
end
desc 'List provider states'
task 'pact:list_provider_states' do
require 'json'
require 'pact_broker/client/backports'
puts Dir.glob("spec/pacts/**.json").collect { | pact_file |
puts pact_file
JSON.parse(File.read(pact_file))['interactions'].collect{ | interaction| interaction['providerState'] }
}.flatten.compact.sort.uniq
end