bushido 0.0.26 → 0.0.27
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bushido/middleware.rb +26 -22
- data/lib/bushido/version.rb +1 -1
- data/lib/engine.rb +6 -1
- metadata +4 -4
data/lib/bushido/middleware.rb
CHANGED
@@ -17,28 +17,32 @@ module Bushido
|
|
17
17
|
|
18
18
|
def call(env)
|
19
19
|
status, headers, response = @app.call(env)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
var
|
32
|
-
|
33
|
-
var
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
20
|
+
|
21
|
+
puts 'lol middle ware'
|
22
|
+
puts @bushido_app_name.inspect
|
23
|
+
|
24
|
+
unless @bushido_app_name.empty?
|
25
|
+
content = ""
|
26
|
+
response.each { |part| content += part }
|
27
|
+
|
28
|
+
# "claiming" bar + stats ?
|
29
|
+
content.gsub!(/<\/head>/i, <<-STR
|
30
|
+
<script type="text/javascript">
|
31
|
+
var _bushido_app = '#{@bushido_app_name}';
|
32
|
+
var _bushido_claimed = #{@bushido_claimed.to_s};
|
33
|
+
var _bushido_metrics_token = '#{@bushido_metrics_token}';
|
34
|
+
(function() {
|
35
|
+
var bushido = document.createElement('script'); bushido.type = 'text/javascript'; bushido.async = true;
|
36
|
+
bushido.src = '#{BUSHIDO_JS_URL}?#{::Bushido::VERSION.gsub('.', '')}';
|
37
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bushido, s);
|
38
|
+
})();
|
39
|
+
</script>
|
40
|
+
</head>
|
41
|
+
STR
|
42
|
+
)
|
43
|
+
|
44
|
+
headers['content-length'] = bytesize(content).to_s
|
45
|
+
end
|
42
46
|
[status, headers, [content]]
|
43
47
|
end
|
44
48
|
|
data/lib/bushido/version.rb
CHANGED
data/lib/engine.rb
CHANGED
@@ -6,7 +6,12 @@ module Bushido
|
|
6
6
|
class Engine < Rails::Engine
|
7
7
|
|
8
8
|
initializer "bushido.add_middleware" do |app|
|
9
|
-
|
9
|
+
|
10
|
+
#Only include our middleware if its on our platform
|
11
|
+
unless ENV['BUSHIDO_APP'].nil?
|
12
|
+
app.middleware.use Bushido::Middleware
|
13
|
+
end
|
14
|
+
|
10
15
|
end
|
11
16
|
|
12
17
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bushido
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 41
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 27
|
10
|
+
version: 0.0.27
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Grove
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-06-
|
19
|
+
date: 2011-06-20 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|