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,243 +0,0 @@
|
|
1
|
-
== Welcome to Rails
|
2
|
-
|
3
|
-
Rails is a web-application framework that includes everything needed to create
|
4
|
-
database-backed web applications according to the Model-View-Control pattern.
|
5
|
-
|
6
|
-
This pattern splits the view (also called the presentation) into "dumb" templates
|
7
|
-
that are primarily responsible for inserting pre-built data in between HTML tags.
|
8
|
-
The model contains the "smart" domain objects (such as Account, Product, Person,
|
9
|
-
Post) that holds all the business logic and knows how to persist themselves to
|
10
|
-
a database. The controller handles the incoming requests (such as Save New Account,
|
11
|
-
Update Product, Show Post) by manipulating the model and directing data to the view.
|
12
|
-
|
13
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
14
|
-
layer entitled Active Record. This layer allows you to present the data from
|
15
|
-
database rows as objects and embellish these data objects with business logic
|
16
|
-
methods. You can read more about Active Record in
|
17
|
-
link:files/vendor/rails/activerecord/README.html.
|
18
|
-
|
19
|
-
The controller and view are handled by the Action Pack, which handles both
|
20
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
21
|
-
are bundled in a single package due to their heavy interdependence. This is
|
22
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
23
|
-
more separate. Each of these packages can be used independently outside of
|
24
|
-
Rails. You can read more about Action Pack in
|
25
|
-
link:files/vendor/rails/actionpack/README.html.
|
26
|
-
|
27
|
-
|
28
|
-
== Getting Started
|
29
|
-
|
30
|
-
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
|
31
|
-
and your application name. Ex: rails myapp
|
32
|
-
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
33
|
-
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
|
34
|
-
4. Follow the guidelines to start developing your application
|
35
|
-
|
36
|
-
|
37
|
-
== Web Servers
|
38
|
-
|
39
|
-
By default, Rails will try to use Mongrel if it's are installed when started with script/server, otherwise Rails will use WEBrick, the webserver that ships with Ruby. But you can also use Rails
|
40
|
-
with a variety of other web servers.
|
41
|
-
|
42
|
-
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
|
43
|
-
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
44
|
-
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
45
|
-
More info at: http://mongrel.rubyforge.org
|
46
|
-
|
47
|
-
Say other Ruby web servers like Thin and Ebb or regular web servers like Apache or LiteSpeed or
|
48
|
-
Lighttpd or IIS. The Ruby web servers are run through Rack and the latter can either be setup to use
|
49
|
-
FCGI or proxy to a pack of Mongrels/Thin/Ebb servers.
|
50
|
-
|
51
|
-
== Apache .htaccess example for FCGI/CGI
|
52
|
-
|
53
|
-
# General Apache options
|
54
|
-
AddHandler fastcgi-script .fcgi
|
55
|
-
AddHandler cgi-script .cgi
|
56
|
-
Options +FollowSymLinks +ExecCGI
|
57
|
-
|
58
|
-
# If you don't want Rails to look in certain directories,
|
59
|
-
# use the following rewrite rules so that Apache won't rewrite certain requests
|
60
|
-
#
|
61
|
-
# Example:
|
62
|
-
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
63
|
-
# RewriteRule .* - [L]
|
64
|
-
|
65
|
-
# Redirect all requests not available on the filesystem to Rails
|
66
|
-
# By default the cgi dispatcher is used which is very slow
|
67
|
-
#
|
68
|
-
# For better performance replace the dispatcher with the fastcgi one
|
69
|
-
#
|
70
|
-
# Example:
|
71
|
-
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
72
|
-
RewriteEngine On
|
73
|
-
|
74
|
-
# If your Rails application is accessed via an Alias directive,
|
75
|
-
# then you MUST also set the RewriteBase in this htaccess file.
|
76
|
-
#
|
77
|
-
# Example:
|
78
|
-
# Alias /myrailsapp /path/to/myrailsapp/public
|
79
|
-
# RewriteBase /myrailsapp
|
80
|
-
|
81
|
-
RewriteRule ^$ index.html [QSA]
|
82
|
-
RewriteRule ^([^.]+)$ $1.html [QSA]
|
83
|
-
RewriteCond %{REQUEST_FILENAME} !-f
|
84
|
-
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
85
|
-
|
86
|
-
# In case Rails experiences terminal errors
|
87
|
-
# Instead of displaying this message you can supply a file here which will be rendered instead
|
88
|
-
#
|
89
|
-
# Example:
|
90
|
-
# ErrorDocument 500 /500.html
|
91
|
-
|
92
|
-
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
93
|
-
|
94
|
-
|
95
|
-
== Debugging Rails
|
96
|
-
|
97
|
-
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
98
|
-
will help you debug it and get it back on the rails.
|
99
|
-
|
100
|
-
First area to check is the application log files. Have "tail -f" commands running
|
101
|
-
on the server.log and development.log. Rails will automatically display debugging
|
102
|
-
and runtime information to these files. Debugging info will also be shown in the
|
103
|
-
browser on requests from 127.0.0.1.
|
104
|
-
|
105
|
-
You can also log your own messages directly into the log file from your code using
|
106
|
-
the Ruby logger class from inside your controllers. Example:
|
107
|
-
|
108
|
-
class WeblogController < ActionController::Base
|
109
|
-
def destroy
|
110
|
-
@weblog = Weblog.find(params[:id])
|
111
|
-
@weblog.destroy
|
112
|
-
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
The result will be a message in your log file along the lines of:
|
117
|
-
|
118
|
-
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
119
|
-
|
120
|
-
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
121
|
-
|
122
|
-
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
123
|
-
|
124
|
-
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
125
|
-
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
126
|
-
|
127
|
-
These two online (and free) books will bring you up to speed on the Ruby language
|
128
|
-
and also on programming in general.
|
129
|
-
|
130
|
-
|
131
|
-
== Debugger
|
132
|
-
|
133
|
-
Debugger support is available through the debugger command when you start your Mongrel or
|
134
|
-
Webrick server with --debugger. This means that you can break out of execution at any point
|
135
|
-
in the code, investigate and change the model, AND then resume execution!
|
136
|
-
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
|
137
|
-
Example:
|
138
|
-
|
139
|
-
class WeblogController < ActionController::Base
|
140
|
-
def index
|
141
|
-
@posts = Post.find(:all)
|
142
|
-
debugger
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
So the controller will accept the action, run the first line, then present you
|
147
|
-
with a IRB prompt in the server window. Here you can do things like:
|
148
|
-
|
149
|
-
>> @posts.inspect
|
150
|
-
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
151
|
-
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
152
|
-
>> @posts.first.title = "hello from a debugger"
|
153
|
-
=> "hello from a debugger"
|
154
|
-
|
155
|
-
...and even better is that you can examine how your runtime objects actually work:
|
156
|
-
|
157
|
-
>> f = @posts.first
|
158
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
159
|
-
>> f.
|
160
|
-
Display all 152 possibilities? (y or n)
|
161
|
-
|
162
|
-
Finally, when you're ready to resume execution, you enter "cont"
|
163
|
-
|
164
|
-
|
165
|
-
== Console
|
166
|
-
|
167
|
-
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
168
|
-
Here you'll have all parts of the application configured, just like it is when the
|
169
|
-
application is running. You can inspect domain models, change values, and save to the
|
170
|
-
database. Starting the script without arguments will launch it in the development environment.
|
171
|
-
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
172
|
-
|
173
|
-
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
174
|
-
|
175
|
-
== dbconsole
|
176
|
-
|
177
|
-
You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
|
178
|
-
You would be connected to the database with the credentials defined in database.yml.
|
179
|
-
Starting the script without arguments will connect you to the development database. Passing an
|
180
|
-
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
|
181
|
-
Currently works for mysql, postgresql and sqlite.
|
182
|
-
|
183
|
-
== Description of Contents
|
184
|
-
|
185
|
-
app
|
186
|
-
Holds all the code that's specific to this particular application.
|
187
|
-
|
188
|
-
app/controllers
|
189
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
190
|
-
automated URL mapping. All controllers should descend from ApplicationController
|
191
|
-
which itself descends from ActionController::Base.
|
192
|
-
|
193
|
-
app/models
|
194
|
-
Holds models that should be named like post.rb.
|
195
|
-
Most models will descend from ActiveRecord::Base.
|
196
|
-
|
197
|
-
app/views
|
198
|
-
Holds the template files for the view that should be named like
|
199
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
|
200
|
-
syntax.
|
201
|
-
|
202
|
-
app/views/layouts
|
203
|
-
Holds the template files for layouts to be used with views. This models the common
|
204
|
-
header/footer method of wrapping views. In your views, define a layout using the
|
205
|
-
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
|
206
|
-
call <% yield %> to render the view using this layout.
|
207
|
-
|
208
|
-
app/helpers
|
209
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
210
|
-
for you automatically when using script/generate for controllers. Helpers can be used to
|
211
|
-
wrap functionality for your views into methods.
|
212
|
-
|
213
|
-
config
|
214
|
-
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
215
|
-
|
216
|
-
db
|
217
|
-
Contains the database schema in schema.rb. db/migrate contains all
|
218
|
-
the sequence of Migrations for your schema.
|
219
|
-
|
220
|
-
doc
|
221
|
-
This directory is where your application documentation will be stored when generated
|
222
|
-
using <tt>rake doc:app</tt>
|
223
|
-
|
224
|
-
lib
|
225
|
-
Application specific libraries. Basically, any kind of custom code that doesn't
|
226
|
-
belong under controllers, models, or helpers. This directory is in the load path.
|
227
|
-
|
228
|
-
public
|
229
|
-
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
230
|
-
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
231
|
-
set as the DOCUMENT_ROOT of your web server.
|
232
|
-
|
233
|
-
script
|
234
|
-
Helper scripts for automation and generation.
|
235
|
-
|
236
|
-
test
|
237
|
-
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
238
|
-
test files will be generated for you and placed in this directory.
|
239
|
-
|
240
|
-
vendor
|
241
|
-
External libraries that the application depends on. Also includes the plugins subdirectory.
|
242
|
-
If the app has frozen rails, those gems also go here, under vendor/rails/.
|
243
|
-
This directory is in the load path.
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
-
|
4
|
-
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
-
|
6
|
-
require 'rake'
|
7
|
-
require 'rake/testtask'
|
8
|
-
require 'rake/rdoctask'
|
9
|
-
|
10
|
-
require 'tasks/rails'
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class DocomoGuidBaseController < ApplicationController
|
2
|
-
def link
|
3
|
-
render :inline=>%{<%= link_to "linkto" %>}
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
class DocomoGuidAlwaysController < DocomoGuidBaseController
|
8
|
-
docomo_guid :always
|
9
|
-
end
|
10
|
-
|
11
|
-
class DocomoGuidDocomoController < DocomoGuidBaseController
|
12
|
-
docomo_guid :docomo
|
13
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
class TransSidBaseController < ApplicationController
|
2
|
-
ActionController::Base.session_options[:key] = '_session_id'
|
3
|
-
def form
|
4
|
-
render :inline=>%{<% form_tag do %>Hello<% end %>}
|
5
|
-
end
|
6
|
-
def link
|
7
|
-
render :inline=>%{<%= link_to "linkto" %>}
|
8
|
-
end
|
9
|
-
def redirect
|
10
|
-
redirect_to('/')
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class TransSidAlwaysController < TransSidBaseController
|
15
|
-
trans_sid :always
|
16
|
-
end
|
17
|
-
|
18
|
-
class TransSidNoneController < TransSidBaseController
|
19
|
-
trans_sid :none
|
20
|
-
end
|
21
|
-
|
22
|
-
class TransSidMobileController < TransSidBaseController
|
23
|
-
trans_sid :mobile
|
24
|
-
end
|
25
|
-
|
26
|
-
class TransSidAlwaysAndSessionOffController < TransSidBaseController
|
27
|
-
trans_sid :always
|
28
|
-
end
|
File without changes
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
<h2>_partial.html.erb</h2>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h2>_partial_mobile.html.erb</h2>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h2>_partial_mobile_docomo.html.erb</h2>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>index.html.erb<h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>index_mobile.html.erb</h1>
|
@@ -1 +0,0 @@
|
|
1
|
-
<h1>index_mobile_docomo.html.erb</h1>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
-
development:
|
4
|
-
adapter: sqlite3
|
5
|
-
database: db/development.sqlite3
|
6
|
-
pool: 5
|
7
|
-
timeout: 5000
|
8
|
-
|
9
|
-
# Warning: The database defined as "test" will be erased and
|
10
|
-
# re-generated from your development database when you run "rake".
|
11
|
-
# Do not set this db to the same as development or production.
|
12
|
-
test:
|
13
|
-
adapter: sqlite3
|
14
|
-
database: db/test.sqlite3
|
15
|
-
pool: 5
|
16
|
-
timeout: 5000
|
17
|
-
|
18
|
-
production:
|
19
|
-
adapter: sqlite3
|
20
|
-
database: db/production.sqlite3
|
21
|
-
pool: 5
|
22
|
-
timeout: 5000
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# These settings change the behavior of Rails 2 apps and will be defaults
|
4
|
-
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
5
|
-
|
6
|
-
if defined?(ActiveRecord)
|
7
|
-
# Include Active Record class name as root for JSON serialized output.
|
8
|
-
ActiveRecord::Base.include_root_in_json = true
|
9
|
-
|
10
|
-
# Store the full class name (including module namespace) in STI type column.
|
11
|
-
ActiveRecord::Base.store_full_sti_class = true
|
12
|
-
end
|
13
|
-
|
14
|
-
ActionController::Routing.generate_best_match = false
|
15
|
-
|
16
|
-
# Use ISO 8601 format for JSON serialized times and dates.
|
17
|
-
ActiveSupport.use_standard_json_time_format = true
|
18
|
-
|
19
|
-
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
20
|
-
# if you're including raw json in an HTML page.
|
21
|
-
ActiveSupport.escape_html_entities_in_json = false
|
Binary file
|
Binary file
|
@@ -1,165 +0,0 @@
|
|
1
|
-
gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
|
2
|
-
|
3
|
-
# Don't load rspec if running "rake gems:*"
|
4
|
-
unless ARGV.any? {|a| a =~ /^gems/}
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'spec/rake/spectask'
|
8
|
-
rescue MissingSourceFile
|
9
|
-
module Spec
|
10
|
-
module Rake
|
11
|
-
class SpecTask
|
12
|
-
def initialize(name)
|
13
|
-
task name do
|
14
|
-
# if rspec-rails is a configured gem, this will output helpful material and exit ...
|
15
|
-
require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
|
16
|
-
|
17
|
-
# ... otherwise, do this:
|
18
|
-
raise <<-MSG
|
19
|
-
|
20
|
-
#{"*" * 80}
|
21
|
-
* You are trying to run an rspec rake task defined in
|
22
|
-
* #{__FILE__},
|
23
|
-
* but rspec can not be found in vendor/gems, vendor/plugins or system gems.
|
24
|
-
#{"*" * 80}
|
25
|
-
MSG
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
Rake.application.instance_variable_get('@tasks').delete('default')
|
34
|
-
|
35
|
-
spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
|
36
|
-
task :noop do
|
37
|
-
end
|
38
|
-
|
39
|
-
task :default => :spec
|
40
|
-
task :stats => "spec:statsetup"
|
41
|
-
|
42
|
-
desc "Run all specs in spec directory (excluding plugin specs)"
|
43
|
-
Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
|
44
|
-
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
45
|
-
t.spec_files = FileList['spec/**/*/*_spec.rb']
|
46
|
-
end
|
47
|
-
|
48
|
-
namespace :spec do
|
49
|
-
desc "Run all specs in spec directory with RCov (excluding plugin specs)"
|
50
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
51
|
-
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
52
|
-
t.spec_files = FileList['spec/**/*/*_spec.rb']
|
53
|
-
t.rcov = true
|
54
|
-
t.rcov_opts = lambda do
|
55
|
-
IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
desc "Print Specdoc for all specs (excluding plugin specs)"
|
60
|
-
Spec::Rake::SpecTask.new(:doc) do |t|
|
61
|
-
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
62
|
-
t.spec_files = FileList['spec/**/*/*_spec.rb']
|
63
|
-
end
|
64
|
-
|
65
|
-
desc "Print Specdoc for all plugin examples"
|
66
|
-
Spec::Rake::SpecTask.new(:plugin_doc) do |t|
|
67
|
-
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
68
|
-
t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
|
69
|
-
end
|
70
|
-
|
71
|
-
[:models, :controllers, :views, :helpers, :lib].each do |sub|
|
72
|
-
desc "Run the code examples in spec/#{sub}"
|
73
|
-
Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
|
74
|
-
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
75
|
-
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
desc "Run the code examples in vendor/plugins (except RSpec's own)"
|
80
|
-
Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
|
81
|
-
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
82
|
-
t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
|
83
|
-
end
|
84
|
-
|
85
|
-
namespace :plugins do
|
86
|
-
desc "Runs the examples for rspec_on_rails"
|
87
|
-
Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
|
88
|
-
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
89
|
-
t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
# Setup specs for stats
|
94
|
-
task :statsetup do
|
95
|
-
require 'code_statistics'
|
96
|
-
::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
|
97
|
-
::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
|
98
|
-
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
|
99
|
-
::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
|
100
|
-
::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
|
101
|
-
::STATS_DIRECTORIES << %w(Routing\ specs spec/lib) if File.exist?('spec/routing')
|
102
|
-
::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
|
103
|
-
::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
|
104
|
-
::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
|
105
|
-
::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
|
106
|
-
::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
|
107
|
-
::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
|
108
|
-
end
|
109
|
-
|
110
|
-
namespace :db do
|
111
|
-
namespace :fixtures do
|
112
|
-
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
|
113
|
-
task :load => :environment do
|
114
|
-
ActiveRecord::Base.establish_connection(Rails.env)
|
115
|
-
base_dir = File.join(Rails.root, 'spec', 'fixtures')
|
116
|
-
fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
|
117
|
-
|
118
|
-
require 'active_record/fixtures'
|
119
|
-
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
|
120
|
-
Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
namespace :server do
|
127
|
-
daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
|
128
|
-
|
129
|
-
desc "start spec_server."
|
130
|
-
task :start do
|
131
|
-
if File.exist?(daemonized_server_pid)
|
132
|
-
$stderr.puts "spec_server is already running."
|
133
|
-
else
|
134
|
-
$stderr.puts %Q{Starting up spec_server ...}
|
135
|
-
FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
|
136
|
-
system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
desc "stop spec_server."
|
141
|
-
task :stop do
|
142
|
-
unless File.exist?(daemonized_server_pid)
|
143
|
-
$stderr.puts "No server running."
|
144
|
-
else
|
145
|
-
$stderr.puts "Shutting down spec_server ..."
|
146
|
-
system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
|
147
|
-
File.delete(daemonized_server_pid)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
desc "restart spec_server."
|
152
|
-
task :restart => [:stop, :start]
|
153
|
-
|
154
|
-
desc "check if spec server is running"
|
155
|
-
task :status do
|
156
|
-
if File.exist?(daemonized_server_pid)
|
157
|
-
$stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
|
158
|
-
else
|
159
|
-
$stderr.puts "No server running."
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
end
|