jpmobile 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__)) + '/helper'
2
-
3
- module Jpmobile
4
- module Mobile
5
- require 'jpmobile/mobile/abstract_mobile'
6
- end
7
- end
8
-
9
- class TestAutoLoad < Test::Unit::TestCase
10
- def test_display_info_docomo
11
- require 'jpmobile/mobile/docomo'
12
- assert_nothing_raised { Jpmobile::Mobile::Docomo::DISPLAY_INFO }
13
- assert_kind_of(Hash, Jpmobile::Mobile::Docomo::DISPLAY_INFO)
14
- end
15
- end
@@ -1,50 +0,0 @@
1
- #!/usr/bin/ruby -Ku
2
- # -*- coding: utf-8 -*-
3
- require 'rubygems'
4
- require 'open-uri'
5
- require 'hpricot'
6
- require 'pp'
7
-
8
- src = URI("http://www.nttdocomo.co.jp/service/imode/make/content/spec/screen_area/index.html").read.toutf8
9
- src.gsub!(/&mu;/,"myu")
10
- user_agents = {}
11
-
12
- (Hpricot(src)/"//div[@id='maincol']//table").each do |table|
13
- (table/"tr[@class='acenter']").each do |tr|
14
- a = (tr/:td).map {|x| x.inner_text }
15
- i = 0
16
- if a.size == 7
17
- if a[0] =~ /[A-Z]{1,2}\-\d{2}A/ # iモードブラウザ2.0
18
- i = 1
19
- else
20
- a.shift # remove rowspan
21
- end
22
- elsif a.size != 6
23
- raise "something is wrong"
24
- end
25
- a[0].sub!(/(.*)/,"")
26
- a[0].sub!(/\(.+\)/,"")
27
- a[0].sub!(/-/,'') # F-01A -> F01A
28
- a[0].sub!(/$/,'3') if i == 1 # iモードブラウザ2.0
29
-
30
- a[3+i].sub!(/^.*?(\d+×\d+).*$/,'\1')
31
- width, height = a[3+i].split(/×/,2).map{|x| x.to_i}
32
- case a[5+i]
33
- when /^カラー\s*(\d+)色$/
34
- color_p = true
35
- colors = $1.to_i
36
- when /^白黒(\d+)階調$/
37
- color_p = false
38
- colors = $1.to_i
39
- else
40
- raise "something is wrong (in detecting colors)"
41
- end
42
- user_agents[a[0]] = {:browser_width=>width, :browser_height=>height, :color_p=>color_p, :colors=>colors}
43
- end
44
- end
45
-
46
- # 書き出し
47
- open("lib/jpmobile/mobile/z_display_info_docomo.rb","w") do |f|
48
- f.puts "Jpmobile::Mobile::Docomo::DISPLAY_INFO ="
49
- f.puts user_agents.pretty_inspect
50
- end
@@ -1,30 +0,0 @@
1
- #!/usr/bin/env ruby -Ku
2
- # -*- coding: utf-8 -*-
3
- # auのwebページからIPリストを抽出する場当たり的なスクリプト。
4
-
5
- require 'open-uri'
6
- require 'pp'
7
- require 'rubygems'
8
- require 'hpricot'
9
- require 'nkf'
10
-
11
- ips = []
12
-
13
- src = NKF.nkf("-m0 -Sw", open("http://www.au.kddi.com/ezfactory/tec/spec/ezsava_ip.html").read)
14
- doc = Hpricot(src)
15
- (doc/'//table').each do |table|
16
- trs = (table/'tr')
17
- next if trs.first && (trs.first/'td[2]').inner_text != 'IPアドレス'
18
- trs.each do |tr|
19
- a = (tr/'td').to_a.map{|t| t.inner_text}
20
- next if a[1] == 'IPアドレス'
21
- ips << a[1..2].join if a[3] != '廃止'
22
- end
23
- end
24
- ips.uniq!
25
-
26
- # 書き出し
27
- open("lib/jpmobile/mobile/z_ip_addresses_au.rb","w") do |f|
28
- f.puts "Jpmobile::Mobile::Au::IP_ADDRESSES = "
29
- f.puts "#{ips.pretty_inspect.chomp }.map {|ip| IPAddr.new(ip) }"
30
- end
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby -Ku
2
- # willcomのwebページからIPリストを抽出する場当たり的なスクリプト。
3
-
4
- require 'open-uri'
5
- require 'pp'
6
- require 'nkf'
7
-
8
- src = NKF.nkf("-m0 -Sw", open("http://www.willcom-inc.com/ja/service/contents_service/create/center_info/index.html").read)
9
-
10
- src.sub!(%r{^.*<b>Webアクセス時のIPアドレス帯域</b>(.+?)</table>.*$}m, '\\1')
11
- ips = src.scan(/(\d+\.\d+\.\d+\.\d+\/\d+)/).flatten
12
-
13
- # 書き出し
14
- open("lib/jpmobile/mobile/z_ip_addresses_willcom.rb","w") do |f|
15
- f.puts "Jpmobile::Mobile::Willcom::IP_ADDRESSES ="
16
- f.puts "#{ips.pretty_inspect.chomp }.map {|ip| IPAddr.new(ip) }"
17
- end