112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/plugins/shared/core_plugin_test_helper.rb', line 112
def __find_plugin_path_from_caller(frames_back = 2)
caller_path = Pathname.new(caller_locations(frames_back, 1).first.absolute_path)
cursor = caller_path
until cursor.basename.to_s == "test" && cursor.parent.basename.to_s =~ /^(inspec|train)-/
cursor = cursor.parent
break if cursor.nil?
end
raise "Could not comprehend plugin project directory structure" if cursor.nil?
project_dir = cursor.parent
plugin_name = project_dir.basename
entry_point = File.join(project_dir.to_s, "lib", plugin_name.to_s + ".rb")
raise "Could not find plugin entry point" unless File.exist?(entry_point)
entry_point
end
|