forked from mensfeld/pgmq-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
55 lines (44 loc) · 1.49 KB
/
Copy pathRakefile
File metadata and controls
55 lines (44 loc) · 1.49 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
# frozen_string_literal: true
require "bundler/setup"
require "bundler/gem_tasks"
require "minitest/test_task"
Minitest::TestTask.create(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.test_globs = ["test/**/*_test.rb"]
t.test_prelude = 'require "test_helper"; require "minitest/autorun"'
end
task default: :test
namespace :examples do
desc "Run all examples (validates gem functionality)"
task :run do
exec(File.expand_path("bin/integrations", __dir__))
end
desc "Run a specific example by name (e.g., rake examples:run_one[basic_produce_consume])"
task :run_one, [:name] do |_t, args|
examples_dir = File.expand_path("spec/integration", __dir__)
pattern = File.join(examples_dir, "*#{args[:name]}*_spec.rb")
matches = Dir.glob(pattern)
if matches.empty?
puts "No example found matching: #{args[:name]}"
exit(1)
end
exec(File.expand_path("bin/integrations", __dir__), matches.first)
end
desc "List all available examples"
task :list do
examples_dir = File.expand_path("spec/integration", __dir__)
example_files = Dir.glob(File.join(examples_dir, "*_spec.rb")).sort
puts "Available examples:"
example_files.each do |f|
name = File.basename(f, "_spec.rb")
puts " #{name}"
end
puts
puts "Run with: bin/integrations spec/integration/NAME_spec.rb"
puts "Example: bin/integrations spec/integration/basic_produce_consume_spec.rb"
end
end
# Shorthand task
desc "Run all examples"
task examples: "examples:run"