trackman 0.2.65 → 0.2.80
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.
@@ -10,10 +10,10 @@ module Trackman
|
|
10
10
|
root = working_dir.realpath
|
11
11
|
|
12
12
|
path = url
|
13
|
-
path.slice!
|
13
|
+
path.slice! /^(\/assets|assets\/)/
|
14
14
|
path = Pathname.new path
|
15
15
|
|
16
|
-
if path.relative?
|
16
|
+
if path.relative?
|
17
17
|
folder = (root + Pathname.new(parent_url)).parent.realpath
|
18
18
|
path = (folder + path).to_s
|
19
19
|
path.slice! sprockets.paths.select{|p| path.include? p }.first
|
@@ -28,16 +28,16 @@ module Trackman
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def init_env
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
31
|
+
if defined?(::Rails) && ::Rails.application
|
32
|
+
env = ::Rails.application.class.assets
|
33
|
+
else
|
34
|
+
env = ::Sprockets::Environment.new
|
35
|
+
paths = ['app', 'lib', 'vendor'].inject([]) do |array, f|
|
36
|
+
array + ["images", "stylesheets", "javascripts"].map{|p| "#{working_dir}/#{f}/assets/#{p}" }
|
37
|
+
end
|
38
|
+
paths << "#{working_dir}/public"
|
39
|
+
paths.each{|p| env.append_path p }
|
38
40
|
end
|
39
|
-
paths << "#{working_dir}/public"
|
40
|
-
paths.each{|p| env.append_path p }
|
41
41
|
|
42
42
|
env
|
43
43
|
end
|
data/lib/trackman/version.rb
CHANGED
@@ -51,6 +51,26 @@ describe Rails32PathResolver do
|
|
51
51
|
actual.should == expected
|
52
52
|
end
|
53
53
|
|
54
|
+
it "works for nested paths" do
|
55
|
+
parent_url = 'app/assets/stylesheets/a/css.css'
|
56
|
+
url = '3/32/allo.png'
|
57
|
+
|
58
|
+
actual = Rails32Tester.translate url, parent_url
|
59
|
+
expected = 'app/assets/images/a/3/32/allo.png'
|
60
|
+
|
61
|
+
actual.should == expected
|
62
|
+
end
|
63
|
+
|
64
|
+
it "works for nested paths with assets/img.png" do
|
65
|
+
parent_url = 'app/assets/stylesheets/css.css'
|
66
|
+
url = 'assets/img.png'
|
67
|
+
|
68
|
+
actual = Rails32Tester.translate url, parent_url
|
69
|
+
expected = 'app/assets/images/img.png'
|
70
|
+
|
71
|
+
actual.should == expected
|
72
|
+
end
|
73
|
+
|
54
74
|
it "serves a favicon" do
|
55
75
|
parent_url = 'public/503.html'
|
56
76
|
url = '/favicon.png'
|
@@ -61,22 +81,22 @@ describe Rails32PathResolver do
|
|
61
81
|
actual.should == expected
|
62
82
|
end
|
63
83
|
|
64
|
-
it "
|
65
|
-
parent_url = '
|
66
|
-
url = '
|
84
|
+
it "public is not buggy" do
|
85
|
+
parent_url = 'public/500.html'
|
86
|
+
url = 'assets/assets/rails.png'
|
67
87
|
|
68
88
|
actual = Rails32Tester.translate url, parent_url
|
69
|
-
expected = '
|
89
|
+
expected = 'public/assets/rails.png'
|
70
90
|
|
71
91
|
actual.should == expected
|
72
92
|
end
|
73
93
|
|
74
|
-
it "public is not buggy" do
|
94
|
+
it "public is not buggy 2" do
|
75
95
|
parent_url = 'public/500.html'
|
76
|
-
url = 'assets/
|
96
|
+
url = 'assets/img.png'
|
77
97
|
|
78
98
|
actual = Rails32Tester.translate url, parent_url
|
79
|
-
expected = '
|
99
|
+
expected = 'app/assets/images/img.png'
|
80
100
|
|
81
101
|
actual.should == expected
|
82
102
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.80
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-07-
|
13
|
+
date: 2012-07-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
@@ -488,7 +488,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
488
488
|
version: '0'
|
489
489
|
requirements: []
|
490
490
|
rubyforge_project:
|
491
|
-
rubygems_version: 1.8.
|
491
|
+
rubygems_version: 1.8.24
|
492
492
|
signing_key:
|
493
493
|
specification_version: 3
|
494
494
|
summary: Client version of the Trackman addon on Heroku
|