exvo_warez 0.2.35 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -1
- data/Gemfile +1 -3
- data/Rakefile +10 -2
- data/exvo_warez.gemspec +3 -6
- data/lib/exvo_warez.rb +4 -48
- data/lib/rack/exvo/{seo.rb → stats.rb} +2 -9
- data/lib/rack/exvo/templates/{links.erb → stats.erb} +0 -5
- data/lib/version.rb +1 -1
- data/spec/exvo_warez_spec.rb +15 -0
- data/spec/spec_helper.rb +6 -0
- metadata +18 -32
- data/.bundle/config +0 -2
- data/Gemfile.lock +0 -76
- data/VERSION +0 -0
- data/test/exvo_warez_test.rb +0 -20
- data/test/helper.rb +0 -4
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,2 +1,10 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
|
3
|
+
require 'rspec/core'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
7
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :spec
|
data/exvo_warez.gemspec
CHANGED
@@ -7,23 +7,20 @@ Gem::Specification.new do |s|
|
|
7
7
|
|
8
8
|
s.required_rubygems_version = ">= 1.3.6"
|
9
9
|
s.authors = ["Tomasz Mazur"]
|
10
|
-
s.description = %q{
|
10
|
+
s.description = %q{Append google analytics & chartbeat to the html pages}
|
11
11
|
s.email = %q{defkode@gmail.com}
|
12
12
|
s.summary = %q{ExvoWarez}
|
13
13
|
s.extra_rdoc_files = [
|
14
14
|
"LICENSE",
|
15
15
|
"README.rdoc"
|
16
16
|
]
|
17
|
-
s.homepage = %q{http://github.com/defkode/rack-useragent}
|
18
17
|
s.rubyforge_project = %q{exvo_warez}
|
19
|
-
|
20
|
-
s.add_dependency 'rack-useragent-filter', ['>= 0.1.9']
|
21
|
-
s.add_dependency 'rack_referral', ['>= 0.0.1']
|
22
|
-
s.add_dependency 'exvo-auth', ['> 0.9.6']
|
23
18
|
|
24
19
|
s.files = `git ls-files`.split("\n")
|
25
20
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
26
21
|
s.require_path = 'lib'
|
22
|
+
s.add_development_dependency 'rspec', ['>= 2.6']
|
23
|
+
s.add_development_dependency 'rack', ['>= 1.1.0']
|
27
24
|
end
|
28
25
|
|
29
26
|
|
data/lib/exvo_warez.rb
CHANGED
@@ -1,35 +1,11 @@
|
|
1
|
-
require "rack/exvo/
|
2
|
-
require "rack/useragent/filter"
|
3
|
-
require "rack_referral"
|
4
|
-
require 'exvo-auth'
|
1
|
+
require "rack/exvo/stats"
|
5
2
|
|
6
3
|
module Rack
|
7
4
|
class ExvoWarez
|
8
5
|
|
9
6
|
def initialize(app)
|
10
7
|
@app = app
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
def apply_middlewares
|
15
|
-
if env == "development"
|
16
|
-
# apply_referral
|
17
|
-
apply_useragent_filter
|
18
|
-
# apply_seo
|
19
|
-
end
|
20
|
-
|
21
|
-
if env == "staging"
|
22
|
-
apply_referral
|
23
|
-
apply_useragent_filter
|
24
|
-
apply_seo if ExvoAuth::Config.client_id
|
25
|
-
end
|
26
|
-
|
27
|
-
if env == "production"
|
28
|
-
apply_referral
|
29
|
-
apply_useragent_filter
|
30
|
-
apply_seo if ExvoAuth::Config.client_id
|
31
|
-
end
|
32
|
-
|
8
|
+
apply_stats if env == "production" && ExvoAuth::Config.client_id
|
33
9
|
end
|
34
10
|
|
35
11
|
def call(env)
|
@@ -41,29 +17,9 @@ module Rack
|
|
41
17
|
def env
|
42
18
|
ENV['RACK_ENV'] || "development"
|
43
19
|
end
|
44
|
-
|
45
|
-
def auth_host
|
46
|
-
env == "production" ? "http://auth.exvo.com" : "http://staging.auth.exvo.com"
|
47
|
-
end
|
48
|
-
|
49
|
-
def apply_useragent_filter
|
50
|
-
required_products = [
|
51
|
-
["Internet Explorer", "8.0"],
|
52
|
-
["Opera", "10.0"],
|
53
|
-
["Firefox", "3.0"]
|
54
|
-
]
|
55
|
-
|
56
|
-
@app = Rack::UserAgent::Filter.new(@app, required_products, :force_with_cookie => "deprecated_browser", :template => "http://www.exvo.com/browser_unsupported.html")
|
57
|
-
# :template => "#{RAILS_ROOT}/public/browser_unsupported.html.erb"
|
58
|
-
end
|
59
20
|
|
60
|
-
def
|
61
|
-
@app = Rack::ExvoWarez::
|
21
|
+
def apply_stats
|
22
|
+
@app = Rack::ExvoWarez::Stats.new(@app)
|
62
23
|
end
|
63
|
-
|
64
|
-
def apply_referral
|
65
|
-
@app = Rack::Referral.new(@app, :url => "#{auth_host}/referrals/<REF>?return_to=<RETURN_TO>")
|
66
|
-
end
|
67
|
-
|
68
24
|
end
|
69
25
|
end
|
@@ -1,10 +1,9 @@
|
|
1
1
|
module Rack
|
2
2
|
class ExvoWarez
|
3
|
-
class
|
3
|
+
class Stats
|
4
4
|
def initialize(app)
|
5
5
|
@app = app
|
6
|
-
@
|
7
|
-
@payload = ERB.new(::File.read(::File.expand_path("../templates/links.erb", __FILE__))).result(binding)
|
6
|
+
@payload = ERB.new(::File.read(::File.expand_path("../templates/stats.erb", __FILE__))).result(binding)
|
8
7
|
end
|
9
8
|
|
10
9
|
def call(env)
|
@@ -42,12 +41,6 @@ module Rack
|
|
42
41
|
|
43
42
|
private
|
44
43
|
|
45
|
-
def apps_index
|
46
|
-
ExvoAuth::Autonomous::Auth.instance.get("/api/private/apps/published").parsed_response.reject do |app|
|
47
|
-
app["client_id"] == ExvoAuth::Config.client_id
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
44
|
def html?(headers)
|
52
45
|
/html/ === headers['Content-Type']
|
53
46
|
end
|
@@ -18,11 +18,6 @@
|
|
18
18
|
})();
|
19
19
|
//]]>
|
20
20
|
</script>
|
21
|
-
<footer style="display: none">
|
22
|
-
<% @apps.each do |app| %>
|
23
|
-
<a href="<%= app["url"] %>"><%= app["name"] %></a>
|
24
|
-
<% end %>
|
25
|
-
</footer>
|
26
21
|
<script type='text/javascript'>
|
27
22
|
//<![CDATA[
|
28
23
|
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
data/lib/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Rack::ExvoWarez do
|
4
|
+
|
5
|
+
it "should inject script before body tag" do
|
6
|
+
app = lambda {|env| [200, {"Content-Type" => "text/html"}, ["foo", "bar", "</body>"]]}
|
7
|
+
a = Rack::ExvoWarez::Stats.new(app)
|
8
|
+
p = a.instance_variable_get(:@payload)
|
9
|
+
s, h, b = a.call({})
|
10
|
+
body = "".tap{|s| b.each{|c| s << c}}
|
11
|
+
|
12
|
+
p.length.should_not eql(0)
|
13
|
+
body.should eql("foobar#{p}</body>")
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exvo_warez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,42 +9,31 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-11 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
15
|
+
name: rspec
|
16
|
+
requirement: &2153366480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
22
|
-
type: :
|
21
|
+
version: '2.6'
|
22
|
+
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153366480
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
26
|
+
name: rack
|
27
|
+
requirement: &2153365380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
-
type: :
|
32
|
+
version: 1.1.0
|
33
|
+
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
|
37
|
-
name: exvo-auth
|
38
|
-
requirement: &2161000520 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ! '>'
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 0.9.6
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *2161000520
|
47
|
-
description: Maintain Exvo Notifications in external apps
|
35
|
+
version_requirements: *2153365380
|
36
|
+
description: Append google analytics & chartbeat to the html pages
|
48
37
|
email: defkode@gmail.com
|
49
38
|
executables: []
|
50
39
|
extensions: []
|
@@ -52,22 +41,19 @@ extra_rdoc_files:
|
|
52
41
|
- LICENSE
|
53
42
|
- README.rdoc
|
54
43
|
files:
|
55
|
-
- .bundle/config
|
56
44
|
- .gitignore
|
57
45
|
- Gemfile
|
58
|
-
- Gemfile.lock
|
59
46
|
- LICENSE
|
60
47
|
- README.rdoc
|
61
48
|
- Rakefile
|
62
|
-
- VERSION
|
63
49
|
- exvo_warez.gemspec
|
64
50
|
- lib/exvo_warez.rb
|
65
|
-
- lib/rack/exvo/
|
66
|
-
- lib/rack/exvo/templates/
|
51
|
+
- lib/rack/exvo/stats.rb
|
52
|
+
- lib/rack/exvo/templates/stats.erb
|
67
53
|
- lib/version.rb
|
68
|
-
-
|
69
|
-
-
|
70
|
-
homepage:
|
54
|
+
- spec/exvo_warez_spec.rb
|
55
|
+
- spec/spec_helper.rb
|
56
|
+
homepage:
|
71
57
|
licenses: []
|
72
58
|
post_install_message:
|
73
59
|
rdoc_options: []
|
data/.bundle/config
DELETED
data/Gemfile.lock
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
exvo_warez (0.2.33)
|
5
|
-
exvo-auth (> 0.9.6)
|
6
|
-
rack-useragent-filter (>= 0.1.9)
|
7
|
-
rack_referral (>= 0.0.1)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: http://rubygems.org/
|
11
|
-
specs:
|
12
|
-
abstract (1.0.0)
|
13
|
-
actionpack (3.0.7)
|
14
|
-
activemodel (= 3.0.7)
|
15
|
-
activesupport (= 3.0.7)
|
16
|
-
builder (~> 2.1.2)
|
17
|
-
erubis (~> 2.6.6)
|
18
|
-
i18n (~> 0.5.0)
|
19
|
-
rack (~> 1.2.1)
|
20
|
-
rack-mount (~> 0.6.14)
|
21
|
-
rack-test (~> 0.5.7)
|
22
|
-
tzinfo (~> 0.3.23)
|
23
|
-
activemodel (3.0.7)
|
24
|
-
activesupport (= 3.0.7)
|
25
|
-
builder (~> 2.1.2)
|
26
|
-
i18n (~> 0.5.0)
|
27
|
-
activesupport (3.0.7)
|
28
|
-
addressable (2.2.6)
|
29
|
-
builder (2.1.2)
|
30
|
-
crack (0.1.8)
|
31
|
-
erubis (2.6.6)
|
32
|
-
abstract (>= 1.0.0)
|
33
|
-
exvo-auth (0.12.2)
|
34
|
-
actionpack (~> 3.0.0)
|
35
|
-
activemodel (~> 3.0.0)
|
36
|
-
httparty (~> 0.6.1)
|
37
|
-
oa-oauth (~> 0.0.4)
|
38
|
-
faraday (0.4.6)
|
39
|
-
addressable (>= 2.1.1)
|
40
|
-
rack (>= 1.0.1)
|
41
|
-
httparty (0.6.1)
|
42
|
-
crack (= 0.1.8)
|
43
|
-
i18n (0.5.0)
|
44
|
-
multi_json (0.0.5)
|
45
|
-
nokogiri (1.4.7)
|
46
|
-
oa-core (0.0.5)
|
47
|
-
rack (~> 1.1)
|
48
|
-
oa-oauth (0.0.5)
|
49
|
-
multi_json (~> 0.0.2)
|
50
|
-
nokogiri (~> 1.4.2)
|
51
|
-
oa-core (= 0.0.5)
|
52
|
-
oauth (~> 0.4.0)
|
53
|
-
oauth2 (~> 0.0.10)
|
54
|
-
oauth (0.4.5)
|
55
|
-
oauth2 (0.0.13)
|
56
|
-
faraday (~> 0.4.1)
|
57
|
-
multi_json (>= 0.0.4)
|
58
|
-
rack (1.2.4)
|
59
|
-
rack-mount (0.6.14)
|
60
|
-
rack (>= 1.0.0)
|
61
|
-
rack-test (0.5.7)
|
62
|
-
rack (>= 1.0)
|
63
|
-
rack-useragent-filter (0.2.0)
|
64
|
-
rack (>= 0.9.1)
|
65
|
-
tilt (>= 1.0.0)
|
66
|
-
useragent (>= 0.1.5)
|
67
|
-
rack_referral (0.0.1)
|
68
|
-
tilt (1.3.3)
|
69
|
-
tzinfo (0.3.29)
|
70
|
-
useragent (0.4.4)
|
71
|
-
|
72
|
-
PLATFORMS
|
73
|
-
ruby
|
74
|
-
|
75
|
-
DEPENDENCIES
|
76
|
-
exvo_warez!
|
data/VERSION
DELETED
File without changes
|
data/test/exvo_warez_test.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestExvoWarez < Test::Unit::TestCase
|
4
|
-
test "sanity" do
|
5
|
-
app = lambda {|env| [200, {"Content-Type" => "text/html"}, ["foo", "bar", "</body>"]]}
|
6
|
-
Rack::ExvoWarez::Seo.send :define_method, :apps_index do # poor man's mock
|
7
|
-
[
|
8
|
-
{"url" => "url1", "name" => "name1"},
|
9
|
-
{"url" => "url2", "name" => "name2"}
|
10
|
-
]
|
11
|
-
end
|
12
|
-
a = Rack::ExvoWarez::Seo.new(app)
|
13
|
-
p = a.instance_variable_get(:@payload)
|
14
|
-
s, h, b = a.call({})
|
15
|
-
body = "".tap{|s| b.each{|c| s << c}}
|
16
|
-
|
17
|
-
assert p.length > 0
|
18
|
-
assert_equal "foobar#{p}</body>", body
|
19
|
-
end
|
20
|
-
end
|
data/test/helper.rb
DELETED