-
Notifications
You must be signed in to change notification settings - Fork 255
Expand file tree
/
Copy pathRakefile
More file actions
81 lines (66 loc) · 1.59 KB
/
Copy pathRakefile
File metadata and controls
81 lines (66 loc) · 1.59 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# frozen_string_literal: true
# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
namespace :each do
task :bundle_install do
foreach_gem('bundle install')
end
task :bundle_update do
foreach_gem('bundle update')
end
task :test do
foreach_gem('bundle exec rake test')
end
task :yard do
foreach_gem('bundle exec rake yard')
end
task :rubocop do
foreach_gem('bundle exec rake rubocop')
end
task :default do
foreach_gem('bundle exec rake')
end
task :build do
foreach_gem('bundle exec rake build')
end
task :install do
path = File.join(Dir.pwd, "vendor", "bundle")
foreach_gem([
"bundle config set path #{path}",
"bundle config set clean false",
"bundle install --jobs 4 --retry 3"
])
end
end
task each: 'each:default'
task build: ['each:build']
task install: ['each:install']
task yard: ['each:yard']
task default: [:each]
EXCLUDED_DIRS = %w[vendor]
def foreach_gem(cmds)
cmds = Array(cmds) # string → ["string"], array stays array
gemspecs =
Dir.glob("**/opentelemetry-*.gemspec")
.reject do |path|
EXCLUDED_DIRS.any? do |d|
path.include?("/#{d}/") || path.start_with?("#{d}/")
end
end
.sort
gemspecs.each do |gemspec|
name = File.basename(gemspec, ".gemspec")
dir = File.dirname(gemspec)
puts "**** Entering #{dir}"
Dir.chdir(dir) do
if defined?(Bundler)
Bundler.with_unbundled_env do
cmds.each { |cmd| sh(cmd) }
end
else
cmds.each { |cmd| sh(cmd) }
end
end
end
end