geoip_server 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source :rubygems
2
+
3
+ gem 'sinatra'
4
+ gem 'activesupport'
5
+ gem 'geoip'
6
+ gem 'i18n'
7
+ gem 'newrelic_rpm'
data/Gemfile.lock ADDED
@@ -0,0 +1,22 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.0.3)
5
+ geoip (0.8.8)
6
+ i18n (0.5.0)
7
+ newrelic_rpm (2.13.4)
8
+ rack (1.2.1)
9
+ sinatra (1.1.2)
10
+ rack (~> 1.1)
11
+ tilt (~> 1.2)
12
+ tilt (1.2.1)
13
+
14
+ PLATFORMS
15
+ ruby
16
+
17
+ DEPENDENCIES
18
+ activesupport
19
+ geoip
20
+ i18n
21
+ newrelic_rpm
22
+ sinatra
data/config.ru CHANGED
@@ -1,3 +1,5 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
1
3
  require File.expand_path(File.join(File.dirname(__FILE__), 'lib/geoip_server'))
2
4
 
3
5
  ## There is no need to set directories here anymore;
@@ -0,0 +1,70 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{geoip_server}
8
+ s.version = "1.1.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jack Danger Canty"]
12
+ s.date = %q{2011-04-10}
13
+ s.description = %q{Query the MaxMind GeoIP data records via a web service}
14
+ s.email = %q{gitcommit@6brand.com}
15
+ s.extra_rdoc_files = [
16
+ "README.markdown"
17
+ ]
18
+ s.files = [
19
+ "Gemfile",
20
+ "Gemfile.lock",
21
+ "README.markdown",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "config.ru",
25
+ "geoip_server.gemspec",
26
+ "lib/geoip_server.rb",
27
+ "test.rb"
28
+ ]
29
+ s.homepage = %q{http://github.com/JackDanger/geoip_server}
30
+ s.require_paths = ["lib"]
31
+ s.rubygems_version = %q{1.4.2}
32
+ s.summary = %q{Query the MaxMind GeoIP data records via a web service}
33
+
34
+ if s.respond_to? :specification_version then
35
+ s.specification_version = 3
36
+
37
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
38
+ s.add_runtime_dependency(%q<sinatra>, [">= 0"])
39
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
40
+ s.add_runtime_dependency(%q<geoip>, [">= 0"])
41
+ s.add_runtime_dependency(%q<i18n>, [">= 0"])
42
+ s.add_runtime_dependency(%q<newrelic_rpm>, [">= 0"])
43
+ s.add_runtime_dependency(%q<sinatra>, [">= 1.0.0"])
44
+ s.add_runtime_dependency(%q<active_support>, [">= 0"])
45
+ s.add_runtime_dependency(%q<geoip>, [">= 0"])
46
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
47
+ else
48
+ s.add_dependency(%q<sinatra>, [">= 0"])
49
+ s.add_dependency(%q<activesupport>, [">= 0"])
50
+ s.add_dependency(%q<geoip>, [">= 0"])
51
+ s.add_dependency(%q<i18n>, [">= 0"])
52
+ s.add_dependency(%q<newrelic_rpm>, [">= 0"])
53
+ s.add_dependency(%q<sinatra>, [">= 1.0.0"])
54
+ s.add_dependency(%q<active_support>, [">= 0"])
55
+ s.add_dependency(%q<geoip>, [">= 0"])
56
+ s.add_dependency(%q<shoulda>, [">= 0"])
57
+ end
58
+ else
59
+ s.add_dependency(%q<sinatra>, [">= 0"])
60
+ s.add_dependency(%q<activesupport>, [">= 0"])
61
+ s.add_dependency(%q<geoip>, [">= 0"])
62
+ s.add_dependency(%q<i18n>, [">= 0"])
63
+ s.add_dependency(%q<newrelic_rpm>, [">= 0"])
64
+ s.add_dependency(%q<sinatra>, [">= 1.0.0"])
65
+ s.add_dependency(%q<active_support>, [">= 0"])
66
+ s.add_dependency(%q<geoip>, [">= 0"])
67
+ s.add_dependency(%q<shoulda>, [">= 0"])
68
+ end
69
+ end
70
+
data/lib/geoip_server.rb CHANGED
@@ -9,6 +9,16 @@ data_file = File.expand_path(File.join(File.dirname(__FILE__), '..', 'vendor', '
9
9
 
10
10
  ## Application
11
11
 
12
+ configure :production do
13
+ ENV['APP_ROOT'] ||= File.dirname(__FILE__)
14
+ begin
15
+ $:.unshift "#{ENV['APP_ROOT']}/vendor/plugins/newrelic_rpm/lib"
16
+ require 'newrelic_rpm'
17
+ rescue LoadError
18
+ rescue
19
+ end
20
+ end
21
+
12
22
  get '/' do
13
23
  %Q{
14
24
  <html><title>Detect a computer's location by IP address</title>
@@ -30,7 +40,7 @@ get '/:ip' do
30
40
 
31
41
  data = GeoIP.new(data_file).city(params[:ip])
32
42
 
33
- content_type 'application/json'
43
+ content_type 'application/json;charset=ascii-8bit'
34
44
  headers['Cache-Control'] = "public; max-age=#{365*24*60*60}"
35
45
 
36
46
  return "{}" unless data
data/test.rb CHANGED
@@ -33,7 +33,8 @@ class GeoipServerTest < Test::Unit::TestCase
33
33
  assert last_response.ok?
34
34
  end
35
35
  should "return json content-type" do
36
- assert_equal 'application/json;charset=utf-8', last_response.headers['Content-Type']
36
+ assert_equal 'application/json', last_response.headers['Content-Type']
37
+ assert_equal 'application/json;charset=ascii-8bit', last_response.headers['Content-Type']
37
38
  end
38
39
  end
39
40
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoip_server
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 23
5
+ prerelease:
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 1
9
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jack Danger Canty
@@ -14,63 +15,137 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-11-29 00:00:00 -08:00
18
+ date: 2011-04-10 00:00:00 -07:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- name: sinatra
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
22
+ type: :runtime
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
+ hash: 3
28
29
  segments:
29
- - 1
30
- - 0
31
30
  - 0
32
- version: 1.0.0
33
- type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: active_support
31
+ version: "0"
32
+ requirement: *id001
37
33
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
34
+ name: sinatra
35
+ - !ruby/object:Gem::Dependency
36
+ type: :runtime
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
38
  none: false
40
39
  requirements:
41
40
  - - ">="
42
41
  - !ruby/object:Gem::Version
42
+ hash: 3
43
43
  segments:
44
44
  - 0
45
45
  version: "0"
46
- type: :runtime
47
- version_requirements: *id002
46
+ requirement: *id002
47
+ prerelease: false
48
+ name: activesupport
48
49
  - !ruby/object:Gem::Dependency
50
+ type: :runtime
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ requirement: *id003
61
+ prerelease: false
49
62
  name: geoip
63
+ - !ruby/object:Gem::Dependency
64
+ type: :runtime
65
+ version_requirements: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ requirement: *id004
50
75
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
76
+ name: i18n
77
+ - !ruby/object:Gem::Dependency
78
+ type: :runtime
79
+ version_requirements: &id005 !ruby/object:Gem::Requirement
52
80
  none: false
53
81
  requirements:
54
82
  - - ">="
55
83
  - !ruby/object:Gem::Version
84
+ hash: 3
56
85
  segments:
57
86
  - 0
58
87
  version: "0"
88
+ requirement: *id005
89
+ prerelease: false
90
+ name: newrelic_rpm
91
+ - !ruby/object:Gem::Dependency
59
92
  type: :runtime
60
- version_requirements: *id003
93
+ version_requirements: &id006 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 23
99
+ segments:
100
+ - 1
101
+ - 0
102
+ - 0
103
+ version: 1.0.0
104
+ requirement: *id006
105
+ prerelease: false
106
+ name: sinatra
61
107
  - !ruby/object:Gem::Dependency
62
- name: shoulda
108
+ type: :runtime
109
+ version_requirements: &id007 !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ hash: 3
115
+ segments:
116
+ - 0
117
+ version: "0"
118
+ requirement: *id007
63
119
  prerelease: false
64
- requirement: &id004 !ruby/object:Gem::Requirement
120
+ name: active_support
121
+ - !ruby/object:Gem::Dependency
122
+ type: :runtime
123
+ version_requirements: &id008 !ruby/object:Gem::Requirement
65
124
  none: false
66
125
  requirements:
67
126
  - - ">="
68
127
  - !ruby/object:Gem::Version
128
+ hash: 3
69
129
  segments:
70
130
  - 0
71
131
  version: "0"
132
+ requirement: *id008
133
+ prerelease: false
134
+ name: geoip
135
+ - !ruby/object:Gem::Dependency
72
136
  type: :development
73
- version_requirements: *id004
137
+ version_requirements: &id009 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ hash: 3
143
+ segments:
144
+ - 0
145
+ version: "0"
146
+ requirement: *id009
147
+ prerelease: false
148
+ name: shoulda
74
149
  description: Query the MaxMind GeoIP data records via a web service
75
150
  email: gitcommit@6brand.com
76
151
  executables: []
@@ -80,11 +155,13 @@ extensions: []
80
155
  extra_rdoc_files:
81
156
  - README.markdown
82
157
  files:
83
- - .gems
158
+ - Gemfile
159
+ - Gemfile.lock
84
160
  - README.markdown
85
161
  - Rakefile
86
162
  - VERSION
87
163
  - config.ru
164
+ - geoip_server.gemspec
88
165
  - lib/geoip_server.rb
89
166
  - test.rb
90
167
  has_rdoc: true
@@ -92,8 +169,8 @@ homepage: http://github.com/JackDanger/geoip_server
92
169
  licenses: []
93
170
 
94
171
  post_install_message:
95
- rdoc_options:
96
- - --charset=UTF-8
172
+ rdoc_options: []
173
+
97
174
  require_paths:
98
175
  - lib
99
176
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -101,6 +178,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
178
  requirements:
102
179
  - - ">="
103
180
  - !ruby/object:Gem::Version
181
+ hash: 3
104
182
  segments:
105
183
  - 0
106
184
  version: "0"
@@ -109,13 +187,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
187
  requirements:
110
188
  - - ">="
111
189
  - !ruby/object:Gem::Version
190
+ hash: 3
112
191
  segments:
113
192
  - 0
114
193
  version: "0"
115
194
  requirements: []
116
195
 
117
196
  rubyforge_project:
118
- rubygems_version: 1.3.7
197
+ rubygems_version: 1.4.2
119
198
  signing_key:
120
199
  specification_version: 3
121
200
  summary: Query the MaxMind GeoIP data records via a web service
data/.gems DELETED
@@ -1,4 +0,0 @@
1
- sinatra
2
- activesupport
3
- geoip
4
- i18n