copy_tuner_client 0.1.1.beta18 → 0.1.1.beta19
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.
- data/Gemfile.lock +1 -1
- data/app/assets/javascripts/copyray.js.coffee +6 -1
- data/app/assets/stylesheets/copyray.css +17 -0
- data/lib/copy_tuner_client/configuration.rb +17 -0
- data/lib/copy_tuner_client/copyray_middleware.rb +2 -8
- data/lib/copy_tuner_client/process_guard.rb +20 -11
- data/lib/copy_tuner_client/version.rb +1 -1
- metadata +3 -2
data/Gemfile.lock
CHANGED
@@ -24,6 +24,8 @@ Copyray.init = do ->
|
|
24
24
|
new Copyray.Overlay
|
25
25
|
# Go ahead and do a pass on the DOM to find templates.
|
26
26
|
Copyray.findBlurbs()
|
27
|
+
|
28
|
+
Copyray.addToggleButton()
|
27
29
|
# Ready to rock.
|
28
30
|
console?.log "Ready to Copyray. Press #{if is_mac then 'cmd+shift+k' else 'ctrl+shift+k'} to scan your UI."
|
29
31
|
|
@@ -77,6 +79,9 @@ Copyray.hide = ->
|
|
77
79
|
Copyray.toggleSettings = ->
|
78
80
|
Copyray.Overlay.instance().settings.toggle()
|
79
81
|
|
82
|
+
Copyray.addToggleButton = ->
|
83
|
+
$('body').append("<a href='javascript:Copyray.show()' class='copyray-toggle-button'>Open CopyTuner</a>")
|
84
|
+
|
80
85
|
# Wraps a DOM element that Copyray is tracking. This is subclassed by
|
81
86
|
# Copyray.Blurbsspecimen
|
82
87
|
class Copyray.Specimen
|
@@ -107,7 +112,7 @@ class Copyray.Specimen
|
|
107
112
|
@constructor.all.splice(idx, 1) unless idx == -1
|
108
113
|
|
109
114
|
isVisible: ->
|
110
|
-
@$contents.length
|
115
|
+
@$contents.length
|
111
116
|
|
112
117
|
makeBox: ->
|
113
118
|
@bounds = util.computeBoundingBox(@$contents)
|
@@ -79,3 +79,20 @@
|
|
79
79
|
color: #fff;
|
80
80
|
}
|
81
81
|
|
82
|
+
a.copyray-toggle-button {
|
83
|
+
display: block;
|
84
|
+
position: fixed;
|
85
|
+
left: 0;
|
86
|
+
bottom: 0;
|
87
|
+
color: white;
|
88
|
+
background: black;
|
89
|
+
padding: 16px 20px;
|
90
|
+
border-radius: 0 10px 0 0;
|
91
|
+
opacity: 0;
|
92
|
+
transition: opacity 0.6s ease-in-out;
|
93
|
+
z-index: 10000;
|
94
|
+
}
|
95
|
+
|
96
|
+
a.copyray-toggle-button:hover {
|
97
|
+
opacity: 1;
|
98
|
+
}
|
@@ -110,6 +110,12 @@ module CopyTunerClient
|
|
110
110
|
# @return [Regexp] Regular expression to exclude keys.
|
111
111
|
attr_accessor :exclude_key_regexp
|
112
112
|
|
113
|
+
# @return [Regexp] Copyray js injection pattern for debug
|
114
|
+
attr_accessor :copyray_js_injection_regexp_for_debug
|
115
|
+
|
116
|
+
# @return [Regexp] Copyray js injection pattern for precompiled
|
117
|
+
attr_accessor :copyray_js_injection_regexp_for_precompiled
|
118
|
+
|
113
119
|
alias_method :secure?, :secure
|
114
120
|
|
115
121
|
# Instantiated from {CopyTunerClient.configure}. Sets defaults.
|
@@ -127,6 +133,17 @@ module CopyTunerClient
|
|
127
133
|
self.sync_interval_staging = 0
|
128
134
|
self.secure = false
|
129
135
|
self.test_environments = %w(test cucumber)
|
136
|
+
|
137
|
+
# Matches:
|
138
|
+
# <script src="/assets/jquery.js"></script>
|
139
|
+
# <script src="/assets/jquery-min.js"></script>
|
140
|
+
# <script src="/assets/jquery.min.1.9.1.js"></script>
|
141
|
+
self.copyray_js_injection_regexp_for_debug = /<script[^>]+\/jquery([-.]{1}[\d\.]+)?([-.]{1}min)?\.js[^>]+><\/script>/
|
142
|
+
|
143
|
+
# Matches:
|
144
|
+
# <script src="/application-xxxxxxx.js"></script>
|
145
|
+
# <script src="/application.js"></script>
|
146
|
+
self.copyray_js_injection_regexp_for_precompiled = /<script[^>]+\/application.*\.js[^>]+><\/script>/
|
130
147
|
@applied = false
|
131
148
|
end
|
132
149
|
|
@@ -37,15 +37,9 @@ module CopyTunerClient
|
|
37
37
|
|
38
38
|
def append_js!(html)
|
39
39
|
regexp = if ::Rails.application.config.assets.debug
|
40
|
-
|
41
|
-
# <script src="/assets/jquery.js"></script>
|
42
|
-
# <script src="/assets/jquery-min.js"></script>
|
43
|
-
# <script src="/assets/jquery.min.1.9.1.js"></script>
|
44
|
-
/<script[^>]+\/jquery([-.]{1}[\d\.]+)?([-.]{1}min)?\.js[^>]+><\/script>/
|
40
|
+
CopyTunerClient.configuration.copyray_js_injection_regexp_for_debug
|
45
41
|
else
|
46
|
-
|
47
|
-
# <script src="/application-xxxxxxx.js"></script>
|
48
|
-
/<script[^>]+\/application-[\w]+\.js[^>]+><\/script>/
|
42
|
+
CopyTunerClient.configuration.copyray_js_injection_regexp_for_precompiled
|
49
43
|
end
|
50
44
|
html.sub(regexp) do
|
51
45
|
"#{$~}\n" + helpers.javascript_include_tag(:copyray)
|
@@ -30,7 +30,7 @@ module CopyTunerClient
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def spawner?
|
33
|
-
passenger_spawner? || unicorn_spawner?
|
33
|
+
passenger_spawner? || unicorn_spawner? || delayed_job_spawner?
|
34
34
|
end
|
35
35
|
|
36
36
|
def passenger_spawner?
|
@@ -41,11 +41,17 @@ module CopyTunerClient
|
|
41
41
|
$0.include?("unicorn") && !caller.any? { |line| line.include?("worker_loop") }
|
42
42
|
end
|
43
43
|
|
44
|
+
def delayed_job_spawner?
|
45
|
+
$0.include?('delayed_job')
|
46
|
+
end
|
47
|
+
|
44
48
|
def register_spawn_hooks
|
45
49
|
if defined?(PhusionPassenger)
|
46
50
|
register_passenger_hook
|
47
51
|
elsif defined?(Unicorn::HttpServer)
|
48
52
|
register_unicorn_hook
|
53
|
+
elsif defined?(Delayed::Worker)
|
54
|
+
register_delayed_hook
|
49
55
|
end
|
50
56
|
end
|
51
57
|
|
@@ -68,6 +74,19 @@ module CopyTunerClient
|
|
68
74
|
end
|
69
75
|
end
|
70
76
|
|
77
|
+
def register_delayed_hook
|
78
|
+
@logger.info("Registered Delayed::Job start hook")
|
79
|
+
poller = @poller
|
80
|
+
|
81
|
+
Delayed::Worker.class_eval do
|
82
|
+
alias_method :start_without_copy_tuner, :start
|
83
|
+
define_method :start do
|
84
|
+
poller.start
|
85
|
+
start_without_copy_tuner
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
71
90
|
def register_exit_hooks
|
72
91
|
at_exit do
|
73
92
|
@cache.flush
|
@@ -86,16 +105,6 @@ module CopyTunerClient
|
|
86
105
|
job_was_performed
|
87
106
|
end
|
88
107
|
end
|
89
|
-
elsif defined?(Delayed::Worker)
|
90
|
-
@logger.info("Registered Delayed::Job start hook")
|
91
|
-
poller = @poller
|
92
|
-
Delayed::Worker.class_eval do
|
93
|
-
alias_method :start_without_copy_tuner, :start
|
94
|
-
define_method :start do
|
95
|
-
poller.start
|
96
|
-
start_without_copy_tuner
|
97
|
-
end
|
98
|
-
end
|
99
108
|
end
|
100
109
|
end
|
101
110
|
end
|
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.
|
4
|
+
version: 0.1.1.beta19
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
@@ -386,3 +386,4 @@ test_files:
|
|
386
386
|
- spec/support/fake_unicorn.rb
|
387
387
|
- spec/support/middleware_stack.rb
|
388
388
|
- spec/support/writing_cache.rb
|
389
|
+
has_rdoc:
|