copy_tuner_client 0.1.1.beta → 0.1.1.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile.lock +1 -1
- data/lib/copy_tuner_client/copyray_middleware.rb +20 -13
- data/lib/copy_tuner_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWJlODJjYTMxMDk3ZTIyZDBmNTU5MTA4OWI1NGI3YTI5NzJhYjgzNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDNjYWFkNTRmYTZlZmRkNTliMmFiZWFkNGQwZWZjMzM2NTJkMDYyZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDUzMWY2OGViYzhmOTIxYTc0YmI2N2RiNGIzOWEwM2E0NTE4ZTVmMDk5ODI4
|
10
|
+
ZTRiZWIyOWI0ODQ4MDNlZjJiNTc3MjNkZjQ3YmJiNDI5YmZkMmJmODg3NmZk
|
11
|
+
OTUwNDZiMzhiMjc0MzRkOGY3YzQ2MDU2YWI2NjVkZjY4NGUyOWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWNmYzVkMTE5YTFlMjM5OTQ2MDkzNWRlZDZiMzBkNjFiZDhkYTBmNzJjOTQ5
|
14
|
+
MDUxMDNkZWY0Zjg1ZThkYjkxMmM1YzE0OGFkYTMxNTdhN2NjNjczNmRkNmYy
|
15
|
+
NWFlNTY3YTgxMWMyM2U0NzY3MjJiY2U4Njk3NzBkNWI3ZTNiODU=
|
data/Gemfile.lock
CHANGED
@@ -9,10 +9,8 @@ module CopyTunerClient
|
|
9
9
|
def call(env)
|
10
10
|
status, headers, response = @app.call(env)
|
11
11
|
if should_inject_xray?(status, headers, response)
|
12
|
-
body = response
|
13
|
-
|
14
|
-
append_js!(body, 'jquery', :copyray)
|
15
|
-
# end
|
12
|
+
body = append_css!(response)
|
13
|
+
body = append_js!(body)
|
16
14
|
headers['Content-Length'] = body.bytesize.to_s
|
17
15
|
end
|
18
16
|
[status, headers, (body ? [body] : response)]
|
@@ -24,19 +22,28 @@ module CopyTunerClient
|
|
24
22
|
ActionController::Base.helpers
|
25
23
|
end
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
25
|
+
def append_css!(response)
|
26
|
+
response.body.sub(/<body[^>]*>/) { "#{$~}\n#{css_tag}" }
|
27
|
+
end
|
28
|
+
|
29
|
+
def append_js!(html)
|
30
|
+
regexp = if ::Rails.application.config.assets.debug
|
31
|
+
# Matches:
|
32
|
+
# <script src="/assets/jquery.js"></script>
|
33
|
+
# <script src="/assets/jquery-min.js"></script>
|
34
|
+
# <script src="/assets/jquery.min.1.9.1.js"></script>
|
35
|
+
/<script[^>]+\/jquery([-.]{1}[\d\.]+)?([-.]{1}min)?\.js[^>]+><\/script>/
|
36
|
+
else
|
37
|
+
# Matches:
|
38
|
+
# <script src="/application-xxxxxxx.js"></script>
|
39
|
+
/<script[^>]+\/application-[\w]+\.js[^>]+><\/script>/
|
40
|
+
end
|
41
|
+
html.sub(regexp) do
|
42
|
+
"#{$~}\n" + helpers.javascript_include_tag(:copyray)
|
35
43
|
end
|
36
44
|
end
|
37
45
|
|
38
46
|
def css_tag
|
39
|
-
h = ActionController::Base.helpers
|
40
47
|
helpers.stylesheet_link_tag :copyray
|
41
48
|
end
|
42
49
|
|