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
|
# File 'lib/abtest/asset.rb', line 3
def find_asset(path, options = {})
logical_path = path
pathname = Pathname.new(path)
if pathname.absolute?
return unless stat(pathname)
logical_path = attributes_for(pathname).logical_path
else
begin
pathname = resolve(logical_path)
if File.extname(logical_path) == ""
expanded_logical_path = attributes_for(pathname).logical_path
logical_path += File.extname(expanded_logical_path)
end
rescue FileNotFound
if (path.starts_with?("experiments"))
Abtest.abtest_config.registered_tests.each do |test_hash|
if (path.starts_with?("experiments/#{test_hash[:name]}"))
experiment_path = path.sub("experiments/#{test_hash[:name]}/", '')
manifest = Abtest::ManifestManager.instance.retrieve_manifest(test_hash[:name])
return manifest.environment.index.find_asset(experiment_path, options)
end
end
end
return nil
end
end
build_asset(logical_path, pathname, options)
end
|