|
1 | 1 | # frozen_string_literal: true
|
2 | 2 |
|
3 | 3 | COPYRIGHT_NOTICE = <<~COPYRIGHT_NOTICE
|
4 |
| -# Copyright The OpenTelemetry Authors |
5 |
| -# |
6 |
| -# Licensed under the Apache License, Version 2.0 (the "License"); |
7 |
| -# you may not use this file except in compliance with the License. |
8 |
| -# You may obtain a copy of the License at |
9 |
| -# |
10 |
| -# http://www.apache.org/licenses/LICENSE-2.0 |
11 |
| -# |
12 |
| -# Unless required by applicable law or agreed to in writing, software |
13 |
| -# distributed under the License is distributed on an "AS IS" BASIS, |
14 |
| -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 |
| -# See the License for the specific language governing permissions and |
16 |
| -# limitations under the License. |
17 |
| -# |
18 |
| -# SPDX-License-Identifier: Apache-2.0 |
| 4 | + # Copyright The OpenTelemetry Authors |
| 5 | + # |
| 6 | + # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + # you may not use this file except in compliance with the License. |
| 8 | + # You may obtain a copy of the License at |
| 9 | + # |
| 10 | + # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + # |
| 12 | + # Unless required by applicable law or agreed to in writing, software |
| 13 | + # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + # See the License for the specific language governing permissions and |
| 16 | + # limitations under the License. |
| 17 | + # |
| 18 | + # SPDX-License-Identifier: Apache-2.0 |
19 | 19 | COPYRIGHT_NOTICE
|
20 | 20 |
|
21 | 21 | require 'bundler/gem_tasks'
|
@@ -91,24 +91,24 @@ task generate_require_rollups: %i[generate_semconv] do
|
91 | 91 | puts "\n+++ Generating rollup/barrel files for semconv namespaces.\n"
|
92 | 92 |
|
93 | 93 | Rake::FileList[ # find all the generated semconv files
|
94 |
| - semconv_output_dir + "**" + "attributes.rb", |
95 |
| - semconv_output_dir + "**" + "metrics.rb", |
| 94 | + semconv_output_dir.join('**', 'attributes.rb'), |
| 95 | + semconv_output_dir.join('**', 'metrics.rb'), |
96 | 96 | ]
|
97 |
| - .pathmap("%d") # turn the list into the parent directories (root_namespaces) |
| 97 | + .pathmap('%d') # turn the list into the parent directories (root_namespaces) |
98 | 98 | .uniq # remove duplicates
|
99 | 99 | .each do |namespace_dir| # in each directory, write out a file to require the generated signal names
|
100 | 100 | directory = Pathname.new(namespace_dir)
|
101 | 101 | rollup_filename = directory.dirname + "#{directory.basename}.rb"
|
102 |
| - File.open(rollup_filename, "w") do |rollup| |
| 102 | + File.open(rollup_filename, 'w') do |rollup| |
103 | 103 | rollup << <<~FILE_HEADER
|
104 | 104 | # frozen_string_literal: true
|
105 | 105 |
|
106 | 106 | #{COPYRIGHT_NOTICE}
|
107 | 107 | # This file was autogenerated. Do not edit it by hand.
|
108 | 108 |
|
109 | 109 | FILE_HEADER
|
110 |
| - rollup << "require_relative './#{directory.basename}/attributes.rb'\n" if File.exist?(directory + "attributes.rb") |
111 |
| - rollup << "require_relative './#{directory.basename}/metrics.rb'\n" if File.exist?(directory + "metrics.rb") |
| 110 | + rollup << "require_relative './#{directory.basename}/attributes.rb'\n" if File.exist?(directory.join('attributes.rb')) |
| 111 | + rollup << "require_relative './#{directory.basename}/metrics.rb'\n" if File.exist?(directory.join('metrics.rb')) |
112 | 112 | end
|
113 | 113 | puts "✅ Generated file \"#{rollup_filename}\""
|
114 | 114 | end
|
|
0 commit comments