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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjhkNTQ2NTU0YjljNTc3NmMwNWNhYWQyOWIxYmJlZjFkYjM0YmUwZA==
4
+ ZWJlODJjYTMxMDk3ZTIyZDBmNTU5MTA4OWI1NGI3YTI5NzJhYjgzNw==
5
5
  data.tar.gz: !binary |-
6
- YjRmM2NiZmZmMjJmYmEzYTFhYjc2NTBiM2U1MmYwODRjZTY5ZTg3Nw==
6
+ MDNjYWFkNTRmYTZlZmRkNTliMmFiZWFkNGQwZWZjMzM2NTJkMDYyZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTcwOWJhODFkNDRjNzUzNzQ2OGNkNmJjNWZmNjBkZTg2NmE4MDBmNGY4ZWU2
10
- NzExMWM1Y2M2NTMxZTllMjBiNThhZjlhMGMzZDFhYTA1Zjk5YmNkZTE2ODZm
11
- ZTY3OTlkZDg0MjI1MjVjZTZiYzU1MjFmZmFjNDg5NDAyZjFmYWQ=
9
+ ZDUzMWY2OGViYzhmOTIxYTc0YmI2N2RiNGIzOWEwM2E0NTE4ZTVmMDk5ODI4
10
+ ZTRiZWIyOWI0ODQ4MDNlZjJiNTc3MjNkZjQ3YmJiNDI5YmZkMmJmODg3NmZk
11
+ OTUwNDZiMzhiMjc0MzRkOGY3YzQ2MDU2YWI2NjVkZjY4NGUyOWU=
12
12
  data.tar.gz: !binary |-
13
- NzIxYTYyZGJmMDc2YjI1NWQ3NDlmYTkxMDViMDViMmZiNjRlMzRmMzdkMDdm
14
- YTg5MmNjOWI3ZDA1M2U3YTY0MjUyNDljZTNlYzIyYjM5NzQyZTRhMTZiOWFh
15
- YWNkNGI2M2ZiZTE5MjY0ODAzMWU5YzhmN2M3N2RmMjM3ZGEyMjA=
13
+ ZWNmYzVkMTE5YTFlMjM5OTQ2MDkzNWRlZDZiMzBkNjFiZDhkYTBmNzJjOTQ5
14
+ MDUxMDNkZWY0Zjg1ZThkYjkxMmM1YzE0OGFkYTMxNTdhN2NjNjczNmRkNmYy
15
+ NWFlNTY3YTgxMWMyM2U0NzY3MjJiY2U4Njk3NzBkNWI3ZTNiODU=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- copy_tuner_client (0.1.1.beta)
4
+ copy_tuner_client (0.1.1.beta2)
5
5
  i18n (>= 0.5.0)
6
6
  json
7
7
 
@@ -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.body.sub(/<body[^>]*>/) { "#{$~}\n#{css_tag}" }
13
- # if Rails.application.config.assets.debug
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
- # Appends the given `script_name` after the `after_script_name`.
28
- def append_js!(html, after_script_name, script_name)
29
- # Matches:
30
- # <script src="/assets/jquery.js"></script>
31
- # <script src="/assets/jquery-min.js"></script>
32
- # <script src="/assets/jquery.min.1.9.1.js"></script>
33
- html.sub!(/<script[^>]+\/#{after_script_name}([-.]{1}[\d\.]+)?([-.]{1}min)?\.js[^>]+><\/script>/) do
34
- "#{$~}\n" + helpers.javascript_include_tag(script_name)
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
 
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.1.1.beta'
3
+ VERSION = '0.1.1.beta2'
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copy_tuner_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.beta
4
+ version: 0.1.1.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden