jpmobile 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/{test/rails/rails_root/vendor/plugins/jpmobile/MIT-LICENSE → MIT-LICENSE} +0 -0
- data/README.rdoc +16 -6
- data/Rakefile +14 -0
- data/VERSION.yml +4 -0
- data/init.rb +3 -0
- data/install.rb +1 -0
- data/jpmobile.gemspec +299 -0
- data/lib/jpmobile.rb +0 -2
- data/lib/jpmobile/emoticon.rb +16 -2
- data/lib/jpmobile/emoticon/z_combine.rb +17 -4
- data/lib/jpmobile/filter.rb +2 -3
- data/lib/jpmobile/mobile/abstract_mobile.rb +6 -0
- data/lib/jpmobile/mobile/docomo.rb +24 -1
- data/lib/jpmobile/mobile/z_ip_addresses_au.rb +3 -2
- data/lib/jpmobile/mobile/z_ip_addresses_docomo.rb +4 -1
- data/lib/jpmobile/request_with_mobile.rb +4 -1
- data/{test/rails/rails_root/vendor/plugins/jpmobile/spec → spec}/spec.opts +0 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/unit/detect_by_email_spec.rb +31 -0
- data/{test/rails/rails_root/vendor/plugins/jpmobile/spec → spec}/unit/detect_by_ua_spec.rb +11 -13
- data/spec/unit/is_carrier_spec.rb +93 -0
- data/spec/unit/spec_helper.rb +5 -0
- data/spec/unit/util_spec.rb +30 -0
- data/spec/unit/valid_ip_spec.rb +60 -0
- data/{test/rails/rails_root/vendor/plugins/jpmobile/tasks → tasks}/jpmobile_tasks.rake +3 -3
- data/test/legacy/autoload_test.rb +2 -1
- data/test/legacy/docomo_test.rb +39 -0
- data/test/legacy/emoticon_functional_test.rb +21 -19
- data/test/legacy/emoticon_test.rb +12 -12
- data/test/legacy/filter_test.rb +10 -8
- data/test/legacy/helper.rb +32 -3
- data/test/legacy/softbank_test.rb +2 -0
- data/test/rails/.gitignore +1 -0
- data/test/rails/overrides/app/controllers/filter_controller.rb +10 -0
- data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +2 -0
- data/test/rails/overrides/spec/controllers/docomo_spec.rb +2 -0
- data/test/rails/overrides/spec/controllers/emobile_spec.rb +2 -0
- data/test/rails/overrides/spec/controllers/filter_spec.rb +8 -7
- data/test/rails/overrides/spec/controllers/pc_spec.rb +2 -0
- data/test/rails/overrides/spec/controllers/softbank_emulator_spec.rb +2 -0
- data/test/rails/overrides/spec/controllers/template_path_spec.rb +2 -0
- data/test/rails/overrides/spec/controllers/trans_sid_spec.rb +1 -0
- data/test/rails/overrides/spec/helpers/helpers_spec.rb +2 -0
- data/test/rails/overrides/spec/spec_helper.rb +15 -0
- data/test/rails/rails_root/app/controllers/filter_controller.rb +0 -23
- data/test/rails/rails_root/app/controllers/mobile_spec_controller.rb +1 -1
- data/test/rails/rails_root/app/controllers/template_path_controller.rb +3 -0
- data/test/rails/rails_root/app/helpers/application_helper.rb +0 -1
- data/test/rails/rails_root/config/boot.rb +13 -110
- data/test/rails/rails_root/config/environment.rb +4 -41
- data/test/rails/rails_root/config/environments/development.rb +22 -13
- data/test/rails/rails_root/config/environments/production.rb +41 -20
- data/test/rails/rails_root/config/environments/test.rb +35 -28
- data/test/rails/rails_root/config/initializers/backtrace_silencers.rb +2 -2
- data/test/rails/rails_root/config/initializers/inflections.rb +1 -1
- data/test/rails/rails_root/config/initializers/session_store.rb +2 -15
- data/test/rails/rails_root/config/routes.rb +6 -42
- data/test/rails/rails_root/db/schema.rb +24 -7
- data/test/rails/rails_root/db/seeds.rb +2 -2
- data/test/rails/rails_root/spec/helpers/helpers_spec.rb +4 -2
- data/test/rails/rails_root/spec/spec_helper.rb +19 -35
- data/test/rails/rails_root/test/performance/browsing_test.rb +2 -2
- data/test/rails/rails_root/test/test_helper.rb +2 -27
- data/test/rails/rails_root/vendor/plugins/jpmobile/init.rb +1 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb +39 -25
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/docomo_guid.rb +2 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/email.rb +3 -4
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +24 -8
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb +10 -9
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb +17 -4
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb +43 -136
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb +5 -18
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +24 -16
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +42 -85
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb +25 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +28 -3
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/display.rb +29 -26
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb +60 -11
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +16 -41
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/willcom.rb +1 -10
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_au.rb +3 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/z_ip_addresses_docomo.rb +4 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/position.rb +4 -3
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/request_with_mobile.rb +14 -13
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb +52 -35
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb +68 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/spec/spec_helper.rb +3 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/detect_by_email_spec.rb +21 -27
- data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/is_carrier_spec.rb +56 -84
- data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/spec_helper.rb +1 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/util_spec.rb +8 -2
- data/test/rails/rails_root/vendor/plugins/jpmobile/spec/unit/valid_ip_spec.rb +43 -52
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/disabled_update_display_info_docomo.rb +0 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/tools/update_ip_addresses_au.rb +0 -0
- data/tools/emoji/genregexp.rb +47 -0
- metadata +348 -253
- data/test/rails/rails_root/README +0 -243
- data/test/rails/rails_root/Rakefile +0 -10
- data/test/rails/rails_root/app/controllers/docomo_guid_controller.rb +0 -13
- data/test/rails/rails_root/app/controllers/trans_sid_controller.rb +0 -28
- data/test/rails/rails_root/app/views/filter/index.html.erb +0 -0
- data/test/rails/rails_root/app/views/hankaku_filter/index.html.erb +0 -0
- data/test/rails/rails_root/app/views/template_path/_partial.html.erb +0 -1
- data/test/rails/rails_root/app/views/template_path/_partial_mobile.html.erb +0 -1
- data/test/rails/rails_root/app/views/template_path/_partial_mobile_docomo.html.erb +0 -1
- data/test/rails/rails_root/app/views/template_path/index.html.erb +0 -1
- data/test/rails/rails_root/app/views/template_path/index_mobile.html.erb +0 -1
- data/test/rails/rails_root/app/views/template_path/index_mobile_docomo.html.erb +0 -1
- data/test/rails/rails_root/app/views/template_path/partial.html.erb +0 -2
- data/test/rails/rails_root/config/database.yml +0 -22
- data/test/rails/rails_root/config/initializers/new_rails_defaults.rb +0 -21
- data/test/rails/rails_root/config/locales/en.yml +0 -5
- data/test/rails/rails_root/db/development.sqlite3 +0 -0
- data/test/rails/rails_root/db/test.sqlite3 +0 -0
- data/test/rails/rails_root/doc/README_FOR_APP +0 -2
- data/test/rails/rails_root/lib/tasks/rspec.rake +0 -165
- data/test/rails/rails_root/log/development.log +0 -38
- data/test/rails/rails_root/log/production.log +0 -0
- data/test/rails/rails_root/log/server.log +0 -0
- data/test/rails/rails_root/log/test.log +0 -451
- data/test/rails/rails_root/public/404.html +0 -30
- data/test/rails/rails_root/public/422.html +0 -30
- data/test/rails/rails_root/public/500.html +0 -30
- data/test/rails/rails_root/public/favicon.ico +0 -0
- data/test/rails/rails_root/public/images/rails.png +0 -0
- data/test/rails/rails_root/public/index.html +0 -275
- data/test/rails/rails_root/public/javascripts/application.js +0 -2
- data/test/rails/rails_root/public/javascripts/controls.js +0 -963
- data/test/rails/rails_root/public/javascripts/dragdrop.js +0 -973
- data/test/rails/rails_root/public/javascripts/effects.js +0 -1128
- data/test/rails/rails_root/public/javascripts/prototype.js +0 -4320
- data/test/rails/rails_root/public/robots.txt +0 -5
- data/test/rails/rails_root/script/about +0 -4
- data/test/rails/rails_root/script/console +0 -3
- data/test/rails/rails_root/script/dbconsole +0 -3
- data/test/rails/rails_root/script/destroy +0 -3
- data/test/rails/rails_root/script/generate +0 -3
- data/test/rails/rails_root/script/performance/benchmarker +0 -3
- data/test/rails/rails_root/script/performance/profiler +0 -3
- data/test/rails/rails_root/script/plugin +0 -3
- data/test/rails/rails_root/script/runner +0 -3
- data/test/rails/rails_root/script/server +0 -3
- data/test/rails/rails_root/spec/controllers/docomo_guid_spec.rb +0 -77
- data/test/rails/rails_root/spec/controllers/docomo_spec.rb +0 -28
- data/test/rails/rails_root/spec/controllers/emobile_spec.rb +0 -35
- data/test/rails/rails_root/spec/controllers/filter_spec.rb +0 -157
- data/test/rails/rails_root/spec/controllers/pc_spec.rb +0 -11
- data/test/rails/rails_root/spec/controllers/softbank_emulator_spec.rb +0 -40
- data/test/rails/rails_root/spec/controllers/template_path_spec.rb +0 -115
- data/test/rails/rails_root/spec/controllers/trans_sid_spec.rb +0 -99
- data/test/rails/rails_root/spec/rcov.opts +0 -2
- data/test/rails/rails_root/spec/rspec.rake +0 -165
- data/test/rails/rails_root/spec/spec.opts +0 -4
- data/test/rails/rails_root/vendor/plugins/jpmobile/CHANGELOG +0 -7
- data/test/rails/rails_root/vendor/plugins/jpmobile/README.rdoc +0 -239
- data/test/rails/rails_root/vendor/plugins/jpmobile/Rakefile +0 -116
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_request.rb +0 -5
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/auth.rb +0 -55
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/combined_logger.rb +0 -54
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/request.rb +0 -7
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/trans_sid.rb +0 -14
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/version.rb +0 -9
@@ -1,14 +1,31 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead
|
2
|
-
# please use the migrations feature of Active Record to
|
3
|
-
# then regenerate this schema definition.
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
4
|
#
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your
|
6
|
-
# to create the application database on another
|
7
|
-
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
8
9
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
9
10
|
#
|
10
11
|
# It's strongly recommended to check this file into your version control system.
|
11
12
|
|
12
|
-
ActiveRecord::Schema.define(:version =>
|
13
|
+
ActiveRecord::Schema.define(:version => 20100824062306) do
|
14
|
+
|
15
|
+
create_table "sessions", :force => true do |t|
|
16
|
+
t.string "session_id", :null => false
|
17
|
+
t.text "data"
|
18
|
+
t.datetime "created_at"
|
19
|
+
t.datetime "updated_at"
|
20
|
+
end
|
21
|
+
|
22
|
+
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
23
|
+
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
|
24
|
+
|
25
|
+
create_table "users", :force => true do |t|
|
26
|
+
t.string "name"
|
27
|
+
t.datetime "created_at"
|
28
|
+
t.datetime "updated_at"
|
29
|
+
end
|
13
30
|
|
14
31
|
end
|
@@ -2,6 +2,6 @@
|
|
2
2
|
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
3
|
#
|
4
4
|
# Examples:
|
5
|
-
#
|
5
|
+
#
|
6
6
|
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
-
#
|
7
|
+
# Mayor.create(:name => 'Daley', :city => cities.first)
|
@@ -1,13 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
1
3
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
4
|
|
3
5
|
describe Jpmobile::Helpers do
|
4
6
|
include Jpmobile::Helpers
|
5
7
|
it "docomo_guid_link_to が guid=ON を付けたリンクを生成すること" do
|
6
|
-
docomo_guid_link_to("STRING", :controller => "
|
8
|
+
docomo_guid_link_to("STRING", :controller => "filter", :action => "rawdata").should == %{<a href="/filter/rawdata?guid=ON">STRING</a>}
|
7
9
|
end
|
8
10
|
|
9
11
|
it "softbank_location_link_to がリンク先にパラメータを含んでいても正常に動作すること" do
|
10
12
|
# http://d.hatena.ne.jp/mizincogrammer/20090123/1232702067
|
11
|
-
softbank_location_link_to("STRING", :controller => "
|
13
|
+
softbank_location_link_to("STRING", :controller => "filter", :action => "rawdata", :p => "param").should == %{<a href="location:auto?url=http://test.host/filter/rawdata&p=param">STRING</a>}
|
12
14
|
end
|
13
15
|
end
|
@@ -1,47 +1,31 @@
|
|
1
1
|
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
2
|
# from the project root directory.
|
3
3
|
ENV["RAILS_ENV"] ||= 'test'
|
4
|
-
require File.
|
5
|
-
require '
|
6
|
-
require 'spec/rails'
|
4
|
+
require File.expand_path("../../config/environment", __FILE__)
|
5
|
+
require 'rspec/rails'
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# in your config/boot.rb
|
12
|
-
config.use_transactional_fixtures = true
|
13
|
-
config.use_instantiated_fixtures = false
|
14
|
-
config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
15
10
|
|
16
|
-
|
17
|
-
#
|
18
|
-
# You can declare fixtures for each example_group like this:
|
19
|
-
# describe "...." do
|
20
|
-
# fixtures :table_a, :table_b
|
21
|
-
#
|
22
|
-
# Alternatively, if you prefer to declare them only once, you can
|
23
|
-
# do so right here. Just uncomment the next line and replace the fixture
|
24
|
-
# names with your fixtures.
|
25
|
-
#
|
26
|
-
# config.global_fixtures = :table_a, :table_b
|
27
|
-
#
|
28
|
-
# If you declare global fixtures, be aware that they will be declared
|
29
|
-
# for all of your examples, even those that don't use them.
|
30
|
-
#
|
31
|
-
# You can also declare which fixtures to use (for example fixtures for test/fixtures):
|
32
|
-
#
|
33
|
-
# config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
|
34
|
-
#
|
11
|
+
RSpec.configure do |config|
|
35
12
|
# == Mock Framework
|
36
13
|
#
|
37
|
-
#
|
38
|
-
# use mocha, flexmock or RR, uncomment the appropriate line:
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
39
15
|
#
|
40
16
|
# config.mock_with :mocha
|
41
17
|
# config.mock_with :flexmock
|
42
18
|
# config.mock_with :rr
|
43
|
-
|
44
|
-
|
45
|
-
#
|
46
|
-
|
19
|
+
config.mock_with :rspec
|
20
|
+
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
24
|
+
# examples within a transaction, comment the following line or assign false
|
25
|
+
# instead of true.
|
26
|
+
config.use_transactional_fixtures = true
|
27
|
+
config.include Webrat::HaveTagMatcher
|
28
|
+
config.include Jpmobile::Util
|
47
29
|
end
|
30
|
+
|
31
|
+
require 'pp'
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require 'performance_test_help'
|
2
|
+
require 'rails/performance_test_help'
|
3
3
|
|
4
4
|
# Profiling results for each test method are written to tmp/performance.
|
5
|
-
class BrowsingTest <
|
5
|
+
class BrowsingTest < ActionDispatch::PerformanceTest
|
6
6
|
def test_homepage
|
7
7
|
get '/'
|
8
8
|
end
|
@@ -1,33 +1,8 @@
|
|
1
1
|
ENV["RAILS_ENV"] = "test"
|
2
|
-
require File.expand_path(
|
3
|
-
require 'test_help'
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
3
|
+
require 'rails/test_help'
|
4
4
|
|
5
5
|
class ActiveSupport::TestCase
|
6
|
-
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
-
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
-
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
-
# between every test method. Fewer database queries means faster tests.
|
10
|
-
#
|
11
|
-
# Read Mike Clark's excellent walkthrough at
|
12
|
-
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
-
#
|
14
|
-
# Every Active Record database supports transactions except MyISAM tables
|
15
|
-
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
-
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
-
# is recommended.
|
18
|
-
#
|
19
|
-
# The only drawback to using transactional fixtures is when you actually
|
20
|
-
# need to test transactions. Since your test is bracketed by a transaction,
|
21
|
-
# any transactions started in your code will be automatically rolled back.
|
22
|
-
self.use_transactional_fixtures = true
|
23
|
-
|
24
|
-
# Instantiated fixtures are slow, but give you @david where otherwise you
|
25
|
-
# would need people(:david). If you don't want to migrate your existing
|
26
|
-
# test cases which use the @david style and don't mind the speed hit (each
|
27
|
-
# instantiated fixtures translates to a database query per test method),
|
28
|
-
# then set this back to true.
|
29
|
-
self.use_instantiated_fixtures = false
|
30
|
-
|
31
6
|
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
32
7
|
#
|
33
8
|
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
@@ -1,42 +1,56 @@
|
|
1
|
-
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) ||
|
3
|
+
$:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
4
|
|
3
5
|
module Jpmobile
|
4
|
-
autoload :Email
|
5
|
-
autoload :Emoticon,
|
6
|
-
autoload :Position,
|
6
|
+
autoload :Email, 'jpmobile/email'
|
7
|
+
autoload :Emoticon, 'jpmobile/emoticon'
|
8
|
+
autoload :Position, 'jpmobile/position'
|
7
9
|
autoload :RequestWithMobile, 'jpmobile/request_with_mobile'
|
8
|
-
autoload :Util,
|
10
|
+
autoload :Util, 'jpmobile/util'
|
11
|
+
autoload :Encoding, 'jpmobile/encoding'
|
12
|
+
autoload :Version, 'jpmobile/version'
|
13
|
+
autoload :DatumConv, 'jpmobile/datum_conv'
|
9
14
|
|
15
|
+
# autoload mobile classes
|
10
16
|
module Mobile
|
11
|
-
autoload :Docomo,
|
12
|
-
autoload :Au,
|
13
|
-
autoload :Softbank,
|
14
|
-
autoload :Vodafone,
|
15
|
-
autoload :
|
16
|
-
autoload :
|
17
|
-
autoload :
|
18
|
-
autoload :
|
17
|
+
autoload :Docomo, 'jpmobile/mobile/docomo'
|
18
|
+
autoload :Au, 'jpmobile/mobile/au'
|
19
|
+
autoload :Softbank, 'jpmobile/mobile/softbank'
|
20
|
+
autoload :Vodafone, 'jpmobile/mobile/vodafone'
|
21
|
+
autoload :Emobile, 'jpmobile/mobile/emobile'
|
22
|
+
autoload :Willcom, 'jpmobile/mobile/willcom'
|
23
|
+
autoload :Ddipocket, 'jpmobile/mobile/ddipocket'
|
24
|
+
autoload :SmartPhone, 'jpmobile/mobile/smart_phone'
|
25
|
+
autoload :Iphone, 'jpmobile/mobile/iphone'
|
26
|
+
autoload :Android, 'jpmobile/mobile/android'
|
27
|
+
autoload :WindowsPhone, 'jpmobile/mobile/windows_phone'
|
28
|
+
|
29
|
+
autoload :Display, 'jpmobile/mobile/display'
|
30
|
+
|
31
|
+
DEFAULT_CARRIERS = %w(Docomo Au Softbank Vodafone Emobile Willcom Ddipocket Iphone Android WindowsPhone)
|
19
32
|
|
20
33
|
def self.carriers
|
21
|
-
@carriers ||=
|
34
|
+
@carriers ||= DEFAULT_CARRIERS.dup
|
22
35
|
end
|
23
36
|
|
24
37
|
def self.carriers=(ary)
|
25
38
|
@carriers = ary
|
26
39
|
end
|
40
|
+
|
41
|
+
require 'jpmobile/mobile/abstract_mobile'
|
27
42
|
end
|
28
|
-
end
|
29
43
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
jpmobile/
|
34
|
-
|
35
|
-
|
44
|
+
# autoload Rack middlewares
|
45
|
+
module Rack
|
46
|
+
autoload :MobileCarrier, 'jpmobile/rack/mobile_carrier'
|
47
|
+
autoload :ParamsFilter, 'jpmobile/rack/params_filter'
|
48
|
+
autoload :Filter, 'jpmobile/rack/filter'
|
49
|
+
autoload :Config, 'jpmobile/rack/config'
|
50
|
+
end
|
51
|
+
autoload :Configuration, 'jpmobile/rack'
|
36
52
|
end
|
37
53
|
|
38
|
-
if defined?
|
39
|
-
|
40
|
-
require lib
|
41
|
-
}
|
54
|
+
if defined?(Rails)
|
55
|
+
require 'jpmobile/rails'
|
42
56
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
#DoCoMoの時guid=onの付与
|
2
3
|
class ActionController::Base #:nodoc:
|
3
4
|
class_inheritable_accessor :docomo_guid_mode
|
@@ -13,7 +14,7 @@ end
|
|
13
14
|
|
14
15
|
module Jpmobile::DocomoGuid #:nodoc:
|
15
16
|
protected
|
16
|
-
def default_url_options
|
17
|
+
def default_url_options
|
17
18
|
result = super || {}
|
18
19
|
return result unless request # for test process
|
19
20
|
return result unless apply_add_guid?
|
@@ -1,19 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
# =メールアドレスモジュール
|
2
3
|
#
|
3
4
|
module Jpmobile
|
4
5
|
# email関連の処理
|
5
6
|
module Email
|
6
|
-
|
7
7
|
# メールアドレスよりキャリア情報を取得する
|
8
8
|
# _param1_:: email メールアドレス
|
9
9
|
# return :: Jpmobile::Mobileで定義されている携帯キャリアクラス
|
10
10
|
def self.detect(email)
|
11
|
-
|
12
|
-
c =
|
11
|
+
Mobile.carriers.each do |const|
|
12
|
+
c = Mobile.const_get(const)
|
13
13
|
return c if c::MAIL_ADDRESS_REGEXP && email =~ c::MAIL_ADDRESS_REGEXP
|
14
14
|
end
|
15
15
|
nil
|
16
16
|
end
|
17
|
-
|
18
17
|
end
|
19
18
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'scanf'
|
1
4
|
require 'nkf'
|
2
5
|
|
3
6
|
module Jpmobile
|
@@ -13,10 +16,10 @@ module Jpmobile
|
|
13
16
|
%w( CONVERSION_TABLE_TO_DOCOMO CONVERSION_TABLE_TO_AU CONVERSION_TABLE_TO_SOFTBANK ).each do |const|
|
14
17
|
autoload const, 'jpmobile/emoticon/conversion_table'
|
15
18
|
end
|
16
|
-
%w(
|
17
|
-
SJIS_TO_UNICODE UNICODE_TO_SJIS
|
18
|
-
SJIS_REGEXP SOFTBANK_WEBCODE_REGEXP DOCOMO_SJIS_REGEXP AU_SJIS_REGEXP SOFTBANK_UNICODE_REGEXP
|
19
|
-
EMOTICON_UNICODES UTF8_REGEXP
|
19
|
+
%w(
|
20
|
+
SJIS_TO_UNICODE UNICODE_TO_SJIS
|
21
|
+
SJIS_REGEXP SOFTBANK_WEBCODE_REGEXP DOCOMO_SJIS_REGEXP AU_SJIS_REGEXP SOFTBANK_UNICODE_REGEXP
|
22
|
+
EMOTICON_UNICODES UTF8_REGEXP
|
20
23
|
).each do |const|
|
21
24
|
autoload const, 'jpmobile/emoticon/z_combine'
|
22
25
|
end
|
@@ -87,17 +90,30 @@ module Jpmobile
|
|
87
90
|
when Integer
|
88
91
|
# 変換先がUnicodeで指定されている。つまり対応する絵文字がある。
|
89
92
|
if sjis = UNICODE_TO_SJIS[converted]
|
90
|
-
|
93
|
+
if to_sjis
|
94
|
+
sjis_emotion = [sjis].pack('n')
|
95
|
+
if sjis_emotion.respond_to?(:force_encoding)
|
96
|
+
sjis_emotion.force_encoding("Shift_JIS")
|
97
|
+
end
|
98
|
+
sjis_emotion
|
99
|
+
else
|
100
|
+
[converted].pack("U")
|
101
|
+
end
|
91
102
|
elsif webcode = SOFTBANK_UNICODE_TO_WEBCODE[converted-0x1000]
|
92
|
-
|
103
|
+
[converted-0x1000].pack('U')
|
93
104
|
else
|
94
105
|
# キャリア変換テーブルに指定されていたUnicodeに対応する
|
95
106
|
# 携帯側エンコーディングが見つからない(変換テーブルの不備の可能性あり)。
|
96
107
|
match
|
97
108
|
end
|
98
109
|
when String
|
99
|
-
#
|
100
|
-
|
110
|
+
# 変換先が数値参照だと、再変換する
|
111
|
+
if converted.match(/&#x([0-9a-f]{4});/i)
|
112
|
+
self.unicodecr_to_external(converted, conversion_table, to_sjis)
|
113
|
+
else
|
114
|
+
# 変換先が文字列で指定されている。
|
115
|
+
to_sjis ? Jpmobile::Util.utf8_to_sjis(converted) : converted
|
116
|
+
end
|
101
117
|
when nil
|
102
118
|
# 変換先が定義されていない。
|
103
119
|
match
|
data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO = {
|
2
3
|
0xE63E=>0xE63E,
|
3
4
|
0xE63F=>0xE63F,
|
@@ -417,7 +418,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO = {
|
|
417
418
|
0xE58A=>'[リンク]',
|
418
419
|
0xE51F=>0xE685,
|
419
420
|
0xE520=>0xE6D0,
|
420
|
-
0xE48E=>'
|
421
|
+
0xE48E=>'',
|
421
422
|
0xE4B3=>0xE662,
|
422
423
|
0xE4B4=>0xE6A3,
|
423
424
|
0xE4C8=>'[サイコロ]',
|
@@ -740,7 +741,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO = {
|
|
740
741
|
0xEAF0=>'[サンタ]',
|
741
742
|
0xEAF1=>0xE6B3,
|
742
743
|
0xEAF2=>'[虹]',
|
743
|
-
0xEAF3=>'
|
744
|
+
0xEAF3=>'',
|
744
745
|
0xEAF4=>0xE63E,
|
745
746
|
0xEAF5=>0xE67C,
|
746
747
|
0xEAF6=>'[デパート]',
|
@@ -1156,7 +1157,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO = {
|
|
1156
1157
|
0xF40F=>0xE723,
|
1157
1158
|
0xF410=>0xE6F4,
|
1158
1159
|
0xF411=>0xE72D,
|
1159
|
-
0xF412=>'
|
1160
|
+
0xF412=>'',
|
1160
1161
|
0xF413=>0xE72E,
|
1161
1162
|
0xF414=>0xE6F0,
|
1162
1163
|
0xF415=>0xE6F0,
|
@@ -1185,7 +1186,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO = {
|
|
1185
1186
|
0xF449=>0xE63E,
|
1186
1187
|
0xF44A=>0xE63E,
|
1187
1188
|
0xF44B=>0xE6B3,
|
1188
|
-
0xF501=>'
|
1189
|
+
0xF501=>'',
|
1189
1190
|
0xF502=>0xE67B,
|
1190
1191
|
0xF503=>0xE67C,
|
1191
1192
|
0xF507=>0xE677,
|
@@ -1394,7 +1395,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_AU = {
|
|
1394
1395
|
0xE71F=>0xE57A,
|
1395
1396
|
0xE720=>0xEAC0,
|
1396
1397
|
0xE721=>0xEAC5,
|
1397
|
-
0xE722=>'
|
1398
|
+
0xE722=>'',
|
1398
1399
|
0xE723=>0xE5C6,
|
1399
1400
|
0xE724=>0xEB5D,
|
1400
1401
|
0xE725=>0xEAC9,
|
@@ -2728,7 +2729,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK = {
|
|
2728
2729
|
0xE714=>'[ドア]',
|
2729
2730
|
0xE715=>0xF12F,
|
2730
2731
|
0xE716=>0xF00C,
|
2731
|
-
0xE717=>'
|
2732
|
+
0xE717=>'',
|
2732
2733
|
0xE718=>'[レンチ]',
|
2733
2734
|
0xE719=>0xF301,
|
2734
2735
|
0xE71A=>0xF10E,
|
@@ -2739,7 +2740,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK = {
|
|
2739
2740
|
0xE71F=>'[腕時計]',
|
2740
2741
|
0xE720=>0xF403,
|
2741
2742
|
0xE721=>0xF40A,
|
2742
|
-
0xE722=>'
|
2743
|
+
0xE722=>'',
|
2743
2744
|
0xE723=>0xF108,
|
2744
2745
|
0xE724=>0xF416,
|
2745
2746
|
0xE725=>0xF40E,
|
@@ -2958,7 +2959,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK = {
|
|
2958
2959
|
0xE58A=>'[リンク]',
|
2959
2960
|
0xE51F=>0xF112,
|
2960
2961
|
0xE520=>0xF00B,
|
2961
|
-
0xE48E=>'
|
2962
|
+
0xE48E=>'',
|
2962
2963
|
0xE4B3=>0xF01D,
|
2963
2964
|
0xE4B4=>0xF01C,
|
2964
2965
|
0xE4C8=>'[サイコロ]',
|
@@ -3414,7 +3415,7 @@ Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK = {
|
|
3414
3415
|
0xEB75=>0xF327,
|
3415
3416
|
0xEB76=>0xF523,
|
3416
3417
|
0xEB77=>'[ジーンズ]',
|
3417
|
-
0xEB78=>'
|
3418
|
+
0xEB78=>'',
|
3418
3419
|
0xEB79=>'↑↓',
|
3419
3420
|
0xEB7A=>'⇔',
|
3420
3421
|
0xEB7B=>'↑↓',
|