bushido 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,28 +17,32 @@ module Bushido
17
17
 
18
18
  def call(env)
19
19
  status, headers, response = @app.call(env)
20
-
21
- content = ""
22
- response.each { |part| content += part }
23
-
24
- # "claiming" bar + stats ?
25
- content.gsub!(/<\/body>/i, <<-STR
26
- <script type="text/javascript">
27
- var _bushido_app = '#{@bushido_app_name}';
28
- var _bushido_claimed = #{@bushido_claimed.to_s};
29
- var _bushido_metrics_token = '#{@bushido_metrics_token}';
30
- (function() {
31
- var bushido = document.createElement('script'); bushido.type = 'text/javascript'; bushido.async = true;
32
- bushido.src = '#{BUSHIDO_JS_URL}?#{::Bushido::VERSION.gsub('.', '')}';
33
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bushido, s);
34
- })();
35
- </script>
36
- </body>
37
- STR
38
- )
39
-
40
- headers['content-length'] = bytesize(content).to_s
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
 
@@ -1,4 +1,4 @@
1
1
  module Bushido
2
2
  # Current version of the Bushido gem
3
- VERSION = "0.0.26"
3
+ VERSION = "0.0.27"
4
4
  end
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
- app.middleware.use Bushido::Middleware
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: 43
4
+ hash: 41
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 26
10
- version: 0.0.26
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-17 00:00:00 -07:00
19
+ date: 2011-06-20 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency