exvo_warez 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Tomasz Mazur
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = exvo_warez
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Tomasz Mazur. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+
6
+ desc 'Default: run unit tests.'
7
+ task :default => :test
8
+
9
+ desc 'Run all tests'
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << 'lib'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ begin
17
+ require 'jeweler'
18
+ Jeweler::Tasks.new do |gemspec|
19
+ gemspec.name = "exvo_warez"
20
+ gemspec.authors = ["Tomasz Mazur"]
21
+ gemspec.email = "defkode@gmail.com"
22
+ gemspec.homepage = "http://github.com/defkode/rack-useragent"
23
+ gemspec.summary = "ExvoWarez"
24
+ gemspec.add_dependency("rack-useragent-filter", "0.1.7")
25
+ gemspec.add_dependency("rack-google-analytics", "0.9.2")
26
+ gemspec.add_dependency("rack_referral", "0.0.1")
27
+ end
28
+ rescue LoadError
29
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.3
@@ -0,0 +1,58 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{exvo_warez}
8
+ s.version = "0.0.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tomasz Mazur"]
12
+ s.date = %q{2010-09-03}
13
+ s.email = %q{defkode@gmail.com}
14
+ s.extra_rdoc_files = [
15
+ "LICENSE",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "LICENSE",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "exvo_warez.gemspec",
25
+ "lib/exvo_warez.rb",
26
+ "test/helper.rb",
27
+ "test/test_exvo_warez.rb"
28
+ ]
29
+ s.homepage = %q{http://github.com/defkode/rack-useragent}
30
+ s.rdoc_options = ["--charset=UTF-8"]
31
+ s.require_paths = ["lib"]
32
+ s.rubygems_version = %q{1.3.7}
33
+ s.summary = %q{ExvoWarez}
34
+ s.test_files = [
35
+ "test/helper.rb",
36
+ "test/test_exvo_warez.rb"
37
+ ]
38
+
39
+ if s.respond_to? :specification_version then
40
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<rack-useragent-filter>, ["= 0.1.7"])
45
+ s.add_runtime_dependency(%q<rack-google-analytics>, ["= 0.9.2"])
46
+ s.add_runtime_dependency(%q<rack_referral>, ["= 0.0.1"])
47
+ else
48
+ s.add_dependency(%q<rack-useragent-filter>, ["= 0.1.7"])
49
+ s.add_dependency(%q<rack-google-analytics>, ["= 0.9.2"])
50
+ s.add_dependency(%q<rack_referral>, ["= 0.0.1"])
51
+ end
52
+ else
53
+ s.add_dependency(%q<rack-useragent-filter>, ["= 0.1.7"])
54
+ s.add_dependency(%q<rack-google-analytics>, ["= 0.9.2"])
55
+ s.add_dependency(%q<rack_referral>, ["= 0.0.1"])
56
+ end
57
+ end
58
+
data/lib/exvo_warez.rb ADDED
@@ -0,0 +1,59 @@
1
+ require "rack/google-analytics"
2
+ require "rack/useragent/filter"
3
+
4
+ module Rack
5
+ class ExvoWarez
6
+
7
+ def initialize(app)
8
+ @app = app
9
+ end
10
+
11
+ def apply_middlewares
12
+ unless env == "development"
13
+ apply_referral
14
+ apply_useragent_filter
15
+ end
16
+
17
+ if env == "production"
18
+ apply_analytics
19
+ end
20
+ end
21
+
22
+ def call(env)
23
+ apply_middlewares if env == production
24
+ @app.call(env)
25
+ end
26
+
27
+ protected
28
+
29
+ def env
30
+ ENV['RACK_ENV'] || "development"
31
+ end
32
+
33
+ def auth_host
34
+ env == "production" ? "http://auth.exvo.com" : "http://staging.auth.exvo.com"
35
+ end
36
+
37
+ def apply_useragent_filter
38
+ required_products = [
39
+ ["Internet Explorer", "8.0"],
40
+ ["Opera", "10.0"],
41
+ ["Firefox", "3.0"],
42
+ ["Safari", "4.0"],
43
+ ["Chrome", "4"]
44
+ ]
45
+
46
+ @app = Rack::UserAgent::Filter.new(@app, required_products, :force_with_cookie => "deprecated_browser")
47
+ # :template => "#{RAILS_ROOT}/public/browser_unsupported.html.erb"
48
+ end
49
+
50
+ def apply_referral
51
+ @app = Rack::Referral.new(@app, :url => "#{auth_host}/referrals/<REF>?return_to=<RETURN_TO>")
52
+ end
53
+
54
+ def apply_analytics
55
+ @app = Rack::GoogleAnalytics.new(@app, :tracker => 'UA-2491324-1', :multiple => true, :domain => ".exvo.com")
56
+ end
57
+
58
+ end
59
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'exvo_warez'
8
+
9
+ class Test::Unit::TestCase
10
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestExvoWarez < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,124 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: exvo_warez
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
11
+ platform: ruby
12
+ authors:
13
+ - Tomasz Mazur
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-03 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rack-useragent-filter
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - "="
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 0
32
+ - 1
33
+ - 7
34
+ version: 0.1.7
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rack-google-analytics
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - "="
44
+ - !ruby/object:Gem::Version
45
+ hash: 63
46
+ segments:
47
+ - 0
48
+ - 9
49
+ - 2
50
+ version: 0.9.2
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: rack_referral
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - "="
60
+ - !ruby/object:Gem::Version
61
+ hash: 29
62
+ segments:
63
+ - 0
64
+ - 0
65
+ - 1
66
+ version: 0.0.1
67
+ type: :runtime
68
+ version_requirements: *id003
69
+ description:
70
+ email: defkode@gmail.com
71
+ executables: []
72
+
73
+ extensions: []
74
+
75
+ extra_rdoc_files:
76
+ - LICENSE
77
+ - README.rdoc
78
+ files:
79
+ - .gitignore
80
+ - LICENSE
81
+ - README.rdoc
82
+ - Rakefile
83
+ - VERSION
84
+ - exvo_warez.gemspec
85
+ - lib/exvo_warez.rb
86
+ - test/helper.rb
87
+ - test/test_exvo_warez.rb
88
+ has_rdoc: true
89
+ homepage: http://github.com/defkode/rack-useragent
90
+ licenses: []
91
+
92
+ post_install_message:
93
+ rdoc_options:
94
+ - --charset=UTF-8
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ hash: 3
112
+ segments:
113
+ - 0
114
+ version: "0"
115
+ requirements: []
116
+
117
+ rubyforge_project:
118
+ rubygems_version: 1.3.7
119
+ signing_key:
120
+ specification_version: 3
121
+ summary: ExvoWarez
122
+ test_files:
123
+ - test/helper.rb
124
+ - test/test_exvo_warez.rb