sports_db 0.0.9 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
- html,body {
2
- height: 100%;
1
+ body {
3
2
  background-color: $page_bg;
4
3
  }
5
4
  * {
@@ -23,49 +22,3 @@ body.ios {
23
22
  body.android {
24
23
  font-family: sans-serif;
25
24
  }
26
-
27
-
28
-
29
- // Default
30
- html { font-size: 10px; }
31
- // 480 wide
32
- @media (min-width: 460px) and (-webkit-min-device-pixel-ratio: 1.5) {
33
- html { font-size: 15px; }
34
- }
35
- // 540 wide
36
- @media (min-width: 520px) and (-webkit-min-device-pixel-ratio: 1.5) {
37
- html { font-size: 16.875px; }
38
- }
39
- // 600 wide
40
- @media (min-width: 580px) and (-webkit-min-device-pixel-ratio: 1.5) {
41
- html { font-size: 18.75px; }
42
- }
43
- // 720 wide
44
- @media (min-width: 700px) and (-webkit-min-device-pixel-ratio: 1.5) {
45
- html { font-size: 22.5px; }
46
- }
47
- // Nexus 4, 768 wide
48
- @media (min-width: 748px) and (-webkit-min-device-pixel-ratio: 1.5) {
49
- html { font-size: 24px; }
50
- }
51
- // 800 wide
52
- @media (min-width: 780px) and (-webkit-min-device-pixel-ratio: 1.5) {
53
- html { font-size: 25px; }
54
- }
55
- // Nexus 7 (has a device pixel ratio of ~1.32)
56
- @media (min-width: 780px) and (-webkit-min-device-pixel-ratio: 1.32) {
57
- html { font-size: 25px; }
58
- }
59
- // iPads
60
- // The device-height is reqd in order to differenciate from 768px wide devices (Nexus 4, etc.)
61
- @media
62
- (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 1),
63
- (device-width: 1024px) and (device-height: 768px) and (-webkit-device-pixel-ratio: 1),
64
- (device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2),
65
- (device-width: 1024px) and (device-height: 768px) and (-webkit-device-pixel-ratio: 2) {
66
- html { font-size: 10px; }
67
- }
68
- // for bug 21664 (see base.js)
69
- html.kindle {
70
- font-size: 18.75px;
71
- }
@@ -3,31 +3,53 @@
3
3
  <head>
4
4
  <title><%= CONFIG.app_path.downcase %></title>
5
5
  <meta id="meta_viewport" name="viewport" content="user-scalable=no, initial-scale=1, target-densityDpi=device-dpi">
6
- <%= stylesheet_link_tag "/#{CONFIG.app_path.downcase}/assets/application" %>
7
6
  <script>
8
- // FIXED FB#21664.
9
- if (navigator.userAgent.match(/Kindle/i)) {
10
- document.documentElement.className += ' ' + 'kindle';
7
+ // Set the base font size for the rem-based layout and type sizing.
8
+ (function() {
9
+ var isAndroid = navigator.userAgent.match(/android/i);
10
+ var fontSize = 10; // iOS uses 10 as the base font size.
11
+
12
+ // Get the base font size for Android
13
+ if (isAndroid) {
14
+ var obj = {};
15
+ document.location.search.substring(1).split('&').forEach(function(keyValue) {
16
+ var pair = keyValue.split('=');
17
+ var key = decodeURIComponent(pair[0]).replace(/\+/g, ' ');
18
+ var value = decodeURIComponent(pair[1]).replace(/\+/g, ' ');
19
+ obj[key] = value;
20
+ });
21
+
22
+ obj.deviceWidth = obj.dw || screen.width;
23
+
24
+ if (navigator.userAgent.match(/android/i)) {
25
+ fontSize = (obj.deviceWidth / 320) * 10;
26
+ }
11
27
  }
28
+
29
+ // Set the base font size
30
+ document.documentElement.style.fontSize = fontSize + 'px';
31
+ })()
12
32
  </script>
33
+ <%= stylesheet_link_tag "application" %>
13
34
  </head>
14
35
  <body>
15
36
  <%= yield %>
16
- <loading id="loading" style="display: none;"><loading_text id="loading_text">Loading&hellip;</loading_text></loading>
17
- <div id="flash" style="display: none;"></div>
18
- <div id="buffer" style="display: none;"></div>
19
- <div id="tmp" style="display: none;"></div>
20
- <%= javascript_include_tag "/#{CONFIG.app_path.downcase}/assets/application" %>
37
+ <loading id="loading" style="display:none"><loading_text id="loading_text">Loading&hellip;</loading_text></loading>
38
+ <div id="flash" style="display:none"></div>
39
+ <div id="buffer" style="display:none"></div>
40
+ <div id="tmp" style="display:none"></div>
41
+ <%= javascript_include_tag "application" %>
21
42
  <%# Allows us to use mock on test or production without screwing up caching of page. %>
22
43
  <script>
23
44
  if (Application.params.mock) {
24
- document.write("<link rel='stylesheet' href='/<%= CONFIG.app_path %>/assets/mock.css'>");
25
- document.write("<script src='/<%= CONFIG.app_path %>/assets/core/Mock.js'><\/script>");
45
+ document.write("<link rel='stylesheet' href='/<%= CONFIG.app_path %>/cache/<%= CONFIG.app_path %>/assets/mock.css'>");
46
+ document.write("<script src='/<%= CONFIG.app_path %>/cache/<%= CONFIG.app_path %>/assets/core/Mock.js'><\/script>");
26
47
  }
27
48
  </script>
28
- <% if request.host == 'localhost' %>
29
- <link rel='stylesheet' href='/<%= CONFIG.app_path %>/assets/mock.css'>
30
- <script src='/<%= CONFIG.app_path %>/assets/core/Mock.js'></script>
49
+ <%# turn on mock automatically if using localhost or pow %>
50
+ <% if request.host == 'localhost' || request.host.include?(".dev") %>
51
+ <link rel='stylesheet' href='/<%= CONFIG.app_path %>/cache/<%= CONFIG.app_path %>/assets/mock.css'>
52
+ <script src='/<%= CONFIG.app_path %>/cache/<%= CONFIG.app_path %>/assets/core/Mock.js'></script>
31
53
  <% end %>
32
54
  </body>
33
55
  </html>
@@ -1,61 +1,67 @@
1
1
  module SportsDb
2
- class TwitterBuilder
3
-
2
+ class TwitterBuilder
3
+
4
4
  def self.update_twitter
5
- new_tweets = []
6
-
7
- config = SimpleConfig.for(:feeds)
8
- config.twitter_feeds.each do |feed_title, url|
9
- parse_feed(new_tweets, url, feed_title)
10
- end
11
-
12
- Twitter.transaction do
5
+ new_tweets = []
6
+
7
+ config = SimpleConfig.for(:feeds)
8
+ config.twitter_feeds.each do |feed_title, url|
9
+ parse_feed(new_tweets, url, feed_title)
10
+ end
11
+
12
+ Twitter.transaction do
13
13
  Twitter.delete_all()
14
- new_tweets.each {|t| t.save}
15
- p "Tweets saved: #{new_tweets.length}"
16
- end
17
- end
18
-
19
- def self.update_ncaa_twitter
14
+ new_tweets.each {|t| t.save}
15
+ p "Tweets saved: #{new_tweets.length}"
16
+ end
17
+ end
18
+
19
+ def self.update_ncaa_twitter
20
20
  new_tweets = []
21
-
21
+
22
22
  config = SimpleConfig.for(:feeds)
23
- config.twitter_feeds.each do |feed_title, url|
23
+ config.twitter_feeds.each do |feed_title, url|
24
24
  parse_feed(new_tweets, url, feed_title)
25
25
  end
26
-
27
- ExternalFeed.find(:all, :conditions => ["content_type = ? and provider = ?", "twitter", "Sporting News"]).each do |feed_obj|
28
- feed_url = feed_obj.woven_feed_url
29
- if SimpleConfig.for(:application).woven_feed_server != "woven.zumobi.net"
30
- feed_url = feed_url.gsub("woven.zumobi.net", SimpleConfig.for(:application).woven_feed_server)
31
- end
32
-
33
- team_obj = Team.find(feed_obj.team_id)
34
- feed_name = (team_obj.nil? ? "Unknown" : team_obj.city_name)
35
- parse_feed(new_tweets, feed_url, feed_name, feed_obj.team_id)
26
+
27
+ ExternalFeed.find(:all, :conditions => ["content_type = ? and provider = ?", "twitter", "Sporting News"]).each do |feed_obj|
28
+ feed_url = feed_obj.woven_feed_url
29
+ if SimpleConfig.for(:application).woven_feed_server != "woven.zumobi.net"
30
+ feed_url = feed_url.gsub("woven.zumobi.net", SimpleConfig.for(:application).woven_feed_server)
31
+ end
32
+
33
+ begin
34
+ team_obj = Team.find_by_id!(feed_obj.team_id)
35
+ feed_name = (team_obj.nil? ? "Unknown" : team_obj.city_name)
36
+ parse_feed(new_tweets, feed_url, feed_name, feed_obj.team_id)
37
+
38
+ rescue ActiveRecord::RecordNotFound
39
+ p "--- Couldn't update feed, no matching team: #{feed_url}"
40
+ end
36
41
  end
37
-
42
+
38
43
  Twitter.transaction do
39
44
  Twitter.delete_all()
40
- new_tweets.each {|t| t.save}
41
- p "Tweets saved: #{new_tweets.length}"
42
- end
43
-
45
+ new_tweets.each {|t| t.save}
46
+ p "Tweets saved: #{new_tweets.length}"
47
+ end
48
+
44
49
  rescue Exception => e
45
50
  Zumobi::ExceptionHandler.error e
46
51
  end
47
52
 
48
53
 
49
- def self.parse_feed(new_tweets, url, feed_title, team_id=nil)
50
- require 'open-uri'
51
- p "Twitter - #{feed_title} - #{url}"
52
-
54
+ def self.parse_feed(new_tweets, url, feed_title, team_id=nil)
55
+ require 'open-uri'
56
+ p "Twitter - #{feed_title} - #{url}"
57
+
53
58
  begin
54
59
  open(url) do |file|
55
60
  doc = Nokogiri::XML(file.read)
56
61
  source = doc.xpath('/rss/channel/title').text
62
+ source = adjust_titles(source)
63
+ # this has to come after adjust_titles or it gomers it all up
57
64
  source = source.gsub('Twitter', '').strip
58
- source = title_changes(source)
59
65
 
60
66
  if !doc.nil? && !source.nil?
61
67
  doc.xpath('//item').each do |node|
@@ -71,15 +77,15 @@ class TwitterBuilder
71
77
  t.contents = t.title
72
78
 
73
79
  team_key = team_mapping(t.source)
74
-
75
- if !team_key.blank?
76
- if Team.column_names.include?("tsn_key") && !Team.find_by_tsn_key(team_key).blank?
77
- t.team_id = Team.find_by_tsn_key(team_key).id
78
- elsif !Team.find_by_key(team_key).blank?
79
- t.team_id = Team.find_by_key(team_key).id
80
- end
80
+
81
+ if !team_key.blank?
82
+ if Team.column_names.include?("tsn_key") && !Team.find_by_tsn_key(team_key).blank?
83
+ t.team_id = Team.find_by_tsn_key(team_key).id
84
+ elsif !Team.find_by_key(team_key).blank?
85
+ t.team_id = Team.find_by_key(team_key).id
86
+ end
81
87
  end
82
-
88
+
83
89
  new_tweets << t
84
90
  end
85
91
  end
@@ -87,34 +93,40 @@ class TwitterBuilder
87
93
  rescue OpenURI::HTTPError => http_e
88
94
  p 'unable to retrieve feed'
89
95
  rescue EOFError
90
- p 'connection error'
96
+ p 'connection error'
91
97
  rescue Errno::ECONNRESET
92
- p 'connection error'
98
+ p 'connection error'
93
99
  rescue Errno::ECONNREFUSED
94
- p 'connection error'
95
- end
100
+ p 'connection error'
101
+ end
96
102
  rescue Exception => e
97
103
  Zumobi::ExceptionHandler.error e
98
104
  end
99
105
 
100
- def self.title_changes(source)
101
- titles = {'Official NFL Twitter Feed' => 'NFL',
102
- 'The Trenches Twitter' => 'The Trenches'}
103
-
104
- return (titles[source].nil?) ? source : titles[source]
106
+ # Adjust the title for a couple of feeds.
107
+ # Return the original title if it doesn't
108
+ # need to be adjusted.
109
+ def self.adjust_titles(title)
110
+ if title == 'Official NFL Twitter Feed'
111
+ return 'NFL'
112
+ elsif title == 'The Trenches Twitter'
113
+ return 'The Trenches'
114
+ else
115
+ return title
116
+ end
105
117
  end
106
-
118
+
107
119
  def self.add_hash_highlight(str)
108
120
  formatted_text = []
109
121
  each_word = str.split(' ')
110
- each_word.each do |word|
122
+ each_word.each do |word|
111
123
  if word[0,7] == "http://"
112
124
  new_word = "<a href='#{word}'>#{word}</a>"
113
125
  formatted_text << new_word
114
126
  elsif word.include? "http://"
115
127
  phrase = word
116
128
  pieces = word.split("http://")
117
-
129
+
118
130
  phrase = "#{pieces[0]} <a href='http://#{pieces[1]}'>http://#{pieces[1]}</a>"
119
131
  formatted_text << phrase
120
132
  else
@@ -156,7 +168,7 @@ class TwitterBuilder
156
168
  'Carolina Panthers' => 'l.nfl.com-t.29',
157
169
  'New Orleans Saints' => 'l.nfl.com-t.30',
158
170
  'Tampa Bay Bucs' => 'l.nfl.com-t.26',
159
- 'Arizona Diamondbacks' => 'l.mlb.com-t.26',
171
+ 'Arizona Diamondbacks' => 'l.mlb.com-t.26',
160
172
  'Atlanta Braves' => 'l.mlb.com-t.15',
161
173
  'Baltimore Orioles' => 'l.mlb.com-t.1',
162
174
  'Boston Red Sox' => 'l.mlb.com-t.2',
@@ -168,7 +180,7 @@ class TwitterBuilder
168
180
  'Detroit Tigers' => 'l.mlb.com-t.8',
169
181
  'Miami Marlins' => 'l.mlb.com-t.16',
170
182
  'Houston Astros' => 'l.mlb.com-t.22',
171
- 'Kansas City Royals' => 'l.mlb.com-t.9',
183
+ 'Kansas City Royals' => 'l.mlb.com-t.9',
172
184
  'Los Angeles Angels' => 'l.mlb.com-t.11',
173
185
  'Los Angeles Dodgers' => 'l.mlb.com-t.28',
174
186
  'Milwaukee Brewers' => 'l.mlb.com-t.23',
@@ -177,7 +189,7 @@ class TwitterBuilder
177
189
  'New York Yankees' => 'l.mlb.com-t.3',
178
190
  'Oakland Athletics' => 'l.mlb.com-t.12',
179
191
  'Philadelphia Phillies' => 'l.mlb.com-t.19',
180
- 'Pittsburgh Pirates' => 'l.mlb.com-t.24',
192
+ 'Pittsburgh Pirates' => 'l.mlb.com-t.24',
181
193
  'San Diego Padres' => 'l.mlb.com-t.29',
182
194
  'San Francisco Giants' => 'l.mlb.com-t.30',
183
195
  'Seattle Mariners' => 'l.mlb.com-t.13',
@@ -186,7 +198,7 @@ class TwitterBuilder
186
198
  'Texas Rangers' => 'l.mlb.com-t.14',
187
199
  'Toronto Blue Jays' => 'l.mlb.com-t.5',
188
200
  'Washington Nationals' => 'l.mlb.com-t.17',
189
- 'Boston Celtics' => 'l.nba.com-t.1',
201
+ 'Boston Celtics' => 'l.nba.com-t.1',
190
202
  'Brooklyn Nets' => 'l.nba.com-t.3',
191
203
  'New York Knicks' => 'l.nba.com-t.4',
192
204
  'Philadelphia 76ers' => 'l.nba.com-t.6',
@@ -199,7 +211,7 @@ class TwitterBuilder
199
211
  'Atlanta Hawks' => 'l.nba.com-t.8',
200
212
  'Charlotte Bobcats' => 'l.nba.com-t.32',
201
213
  'Miami Heat' => 'l.nba.com-t.2',
202
- 'Orlando Magic' => 'l.nba.com-t.5',
214
+ 'Orlando Magic' => 'l.nba.com-t.5',
203
215
  'Washington Wizards' => 'l.nba.com-t.7',
204
216
  'Denver Nuggets' => 'l.nba.com-t.17',
205
217
  'Minnesota Timberwolves' => 'l.nba.com-t.20',
@@ -208,7 +220,7 @@ class TwitterBuilder
208
220
  'Utah Jazz' => 'l.nba.com-t.22',
209
221
  'Golden State Warriors' => 'l.nba.com-t.23',
210
222
  'Los Angeles Clippers' => 'l.nba.com-t.24',
211
- 'Los Angeles Lakers' => 'l.nba.com-t.25',
223
+ 'Los Angeles Lakers' => 'l.nba.com-t.25',
212
224
  'Phoenix Suns' => 'l.nba.com-t.26',
213
225
  'Sacramento Kings' => 'l.nba.com-t.28',
214
226
  'Dallas Mavericks' => 'l.nba.com-t.16',
@@ -221,4 +233,4 @@ class TwitterBuilder
221
233
  end
222
234
 
223
235
  end
224
- end
236
+ end
@@ -1,3 +1,3 @@
1
1
  module SportsDb
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.13"
3
3
  end
metadata CHANGED
@@ -1,63 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sports_db
3
- version: !ruby/object:Gem::Version
4
- hash: 13
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.13
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 9
10
- version: 0.0.9
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Alx Dark
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-05-16 00:00:00 -06:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2013-05-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: rails
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 21
30
- segments:
31
- - 3
32
- - 2
33
- - 13
20
+ - !ruby/object:Gem::Version
34
21
  version: 3.2.13
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: sqlite3
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.13
30
+ - !ruby/object:Gem::Dependency
31
+ name: sqlite3
32
+ requirement: !ruby/object:Gem::Requirement
41
33
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
49
38
  type: :development
50
- version_requirements: *id002
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
51
46
  description: Shared code for the Zumobi sports applications
52
- email:
53
- - "alx.dark@zumobi.com\t"
47
+ email:
48
+ - ! "alx.dark@zumobi.com\t"
54
49
  executables: []
55
-
56
50
  extensions: []
57
-
58
51
  extra_rdoc_files: []
59
-
60
- files:
52
+ files:
61
53
  - app/assets/javascripts/clients/android/client.js
62
54
  - app/assets/javascripts/clients/ios/client.js
63
55
  - app/assets/javascripts/core/Application.js
@@ -170,41 +162,31 @@ files:
170
162
  - test/dummy/script/rails
171
163
  - test/sports_db_test.rb
172
164
  - test/test_helper.rb
173
- has_rdoc: true
174
165
  homepage: http://www.zumobi.com/
175
166
  licenses: []
176
-
177
167
  post_install_message:
178
168
  rdoc_options: []
179
-
180
- require_paths:
169
+ require_paths:
181
170
  - lib
182
- required_ruby_version: !ruby/object:Gem::Requirement
171
+ required_ruby_version: !ruby/object:Gem::Requirement
183
172
  none: false
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- hash: 3
188
- segments:
189
- - 0
190
- version: "0"
191
- required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
178
  none: false
193
- requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- hash: 3
197
- segments:
198
- - 0
199
- version: "0"
179
+ requirements:
180
+ - - ! '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
200
183
  requirements: []
201
-
202
184
  rubyforge_project:
203
- rubygems_version: 1.6.2
185
+ rubygems_version: 1.8.23
204
186
  signing_key:
205
187
  specification_version: 3
206
188
  summary: Shared code for the Zumobi sports applications
207
- test_files:
189
+ test_files:
208
190
  - test/dummy/app/assets/javascripts/application.js
209
191
  - test/dummy/app/assets/stylesheets/application.css
210
192
  - test/dummy/app/controllers/application_controller.rb