openapi-ruby 3.5.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 420f08f5a6cc99f77fc5ecd23c7e280a52b1bc930996ca637c2f61828822cc54
|
|
4
|
+
data.tar.gz: 831c0a52dd27d6ed1c60986b82d0e71ca271290ea5c22b40653698fd969895ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e0c13aaa9b0d389f067224265cb11a358679228fafd7e864cefb4cb4a037b3b80b823b4d30050e7b667eb7849c509611490403e042e4f072b78a3af88526e60
|
|
7
|
+
data.tar.gz: d075ef796755e29033fee117fff4cb6a4177b30749afbd6a57993e9a47273d111cce9f7c672fb87c841af3107e150120dac59655c32652da19108ca60e017821
|
|
@@ -67,14 +67,40 @@ module OpenapiRuby
|
|
|
67
67
|
# so the two test frameworks don't both register Rails lazy
|
|
68
68
|
# hooks in the same process — only the DSL needs to be live for
|
|
69
69
|
# schema generation.
|
|
70
|
+
#
|
|
71
|
+
# Each glob runs with its own framework's directory at the head
|
|
72
|
+
# of $LOAD_PATH so the typical `require "openapi_helper"` /
|
|
73
|
+
# `require "rails_helper"` / `require "test_helper"` resolves
|
|
74
|
+
# to the right file. Without this, both spec/ and test/ getting
|
|
75
|
+
# unshifted in one block leads to whichever was unshifted last
|
|
76
|
+
# winning every lookup — and the wrong helper getting loaded
|
|
77
|
+
# for the other side's files.
|
|
70
78
|
def hybrid_script(pattern)
|
|
79
|
+
globs = pattern.split(",").map(&:strip)
|
|
80
|
+
spec_globs = globs.grep(%r{\bspec/})
|
|
81
|
+
test_globs = globs.grep(%r{\btest/})
|
|
82
|
+
other_globs = globs - spec_globs - test_globs
|
|
83
|
+
|
|
71
84
|
<<~RUBY
|
|
72
85
|
require "rspec/core"
|
|
73
86
|
require "openapi_ruby/rspec"
|
|
74
87
|
require "openapi_ruby/minitest"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
|
|
89
|
+
load_with_path = lambda do |dir, glob|
|
|
90
|
+
path = File.expand_path(dir)
|
|
91
|
+
added = !$LOAD_PATH.include?(path)
|
|
92
|
+
$LOAD_PATH.unshift(path) if added
|
|
93
|
+
begin
|
|
94
|
+
Dir.glob(glob).sort.each { |f| require File.expand_path(f) }
|
|
95
|
+
ensure
|
|
96
|
+
$LOAD_PATH.delete(path) if added
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
#{spec_globs.map { |g| "load_with_path.call(\"spec\", #{g.inspect})" }.join("\n ")}
|
|
101
|
+
#{test_globs.map { |g| "load_with_path.call(\"test\", #{g.inspect})" }.join("\n ")}
|
|
102
|
+
#{other_globs.map { |g| %[Dir.glob(#{g.inspect}).sort.each { |f| require File.expand_path(f) }] }.join("\n ")}
|
|
103
|
+
|
|
78
104
|
OpenapiRuby::Generator::SchemaWriter.generate_all!
|
|
79
105
|
RUBY
|
|
80
106
|
end
|
data/lib/openapi_ruby/version.rb
CHANGED