padrino-core 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +45 -45
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/padrino-core.rb +6 -6
- data/lib/padrino-core/application.rb +13 -18
- data/lib/padrino-core/application/mounter.rb +20 -20
- data/lib/padrino-core/application/rendering.rb +48 -21
- data/lib/padrino-core/application/routing.rb +20 -6
- data/lib/padrino-core/application/showexceptions.rb +25 -0
- data/lib/padrino-core/caller.rb +35 -36
- data/lib/padrino-core/cli/adapter.rb +4 -5
- data/lib/padrino-core/cli/base.rb +1 -1
- data/lib/padrino-core/cli/rake.rb +0 -1
- data/lib/padrino-core/loader.rb +12 -12
- data/lib/padrino-core/locale/en.yml +1 -1
- data/lib/padrino-core/locale/it.yml +4 -4
- data/lib/padrino-core/logger.rb +24 -24
- data/lib/padrino-core/reloader.rb +6 -6
- data/lib/padrino-core/server.rb +5 -5
- data/lib/padrino-core/support_lite.rb +9 -9
- data/lib/padrino-core/tasks.rb +4 -4
- data/lib/padrino-core/version.rb +3 -3
- data/padrino-core.gemspec +3 -2
- data/test/fixtures/apps/simple.rb +3 -3
- data/test/test_application.rb +61 -26
- data/test/test_mounter.rb +5 -5
- data/test/test_reloader_simple.rb +4 -4
- data/test/test_routing.rb +44 -0
- data/test/test_server.rb +1 -1
- metadata +4 -3
data/README.rdoc
CHANGED
@@ -4,9 +4,9 @@ Padrino is the godfather of Sinatra.
|
|
4
4
|
|
5
5
|
== Preface
|
6
6
|
|
7
|
-
Padrino is a ruby framework built upon the excellent {Sinatra Microframework}[http://www.sinatrarb.com].
|
8
|
-
Sinatra is a DSL for creating simple web applications in Ruby with speed and minimal effort.
|
9
|
-
This framework tries hard to make it as fun and easy as possible to code much more advanced web applications by
|
7
|
+
Padrino is a ruby framework built upon the excellent {Sinatra Microframework}[http://www.sinatrarb.com].
|
8
|
+
Sinatra is a DSL for creating simple web applications in Ruby with speed and minimal effort.
|
9
|
+
This framework tries hard to make it as fun and easy as possible to code much more advanced web applications by
|
10
10
|
building upon the Sinatra philosophies and foundation.
|
11
11
|
|
12
12
|
== Introduction
|
@@ -31,9 +31,9 @@ Mailer:: Fast and simple delivery support for sending emails (akin to ActionMail
|
|
31
31
|
Admin:: Builtin Admin interface (like Django)
|
32
32
|
Logging:: Provide a unified logger that can interact with your ORM or any library.
|
33
33
|
Reloading:: Automatically reloads server code during development.
|
34
|
-
Localization:: Full support of I18n language localization and can auto-set user’s locale.
|
34
|
+
Localization:: Full support of I18n language localization and can auto-set user’s locale.
|
35
35
|
|
36
|
-
Keep in mind, the user will be able to pull in these components
|
36
|
+
Keep in mind, the user will be able to pull in these components
|
37
37
|
{seperately into existing Sinatra applications}[http://wiki.github.com/padrino/padrino-framework/standalone-usage-in-sinatra]
|
38
38
|
or use them altogether for a comprehensive upgrade to Sinatra (a full-stack Padrino application).
|
39
39
|
|
@@ -42,21 +42,21 @@ or use them altogether for a comprehensive upgrade to Sinatra (a full-stack Padr
|
|
42
42
|
To install the padrino framework, simply grab the latest version from gemcutter:
|
43
43
|
|
44
44
|
$ sudo gem install padrino
|
45
|
-
|
45
|
+
|
46
46
|
This will install the necessary padrino gems to get you started.
|
47
47
|
Now you are ready to use this gem to enhance your sinatra projects or to create new Padrino applications.
|
48
48
|
|
49
|
-
For a more detailed look at Padrino installation,
|
49
|
+
For a more detailed look at Padrino installation,
|
50
50
|
check out the {Installation Guide}[http://wiki.github.com/padrino/padrino-framework/installation].
|
51
51
|
|
52
52
|
== Usage
|
53
53
|
|
54
|
-
Padrino is a framework which builds on the existing functionality and Sinatra and provides a variety of
|
54
|
+
Padrino is a framework which builds on the existing functionality and Sinatra and provides a variety of
|
55
55
|
additional tools and helpers to build upon that foundation. This README and Padrino documentation in general will focus
|
56
|
-
on the enhancements to the core Sinatra functionality. To use Padrino, one should be familiar with the basic
|
57
|
-
usage of Sinatra itself.
|
56
|
+
on the enhancements to the core Sinatra functionality. To use Padrino, one should be familiar with the basic
|
57
|
+
usage of Sinatra itself.
|
58
58
|
|
59
|
-
Please check out the
|
59
|
+
Please check out the
|
60
60
|
{Understanding Sinatra}[http://wiki.github.com/padrino/padrino-framework/underlying-sinatra-overview] guide
|
61
61
|
to learn more about these fundamentals.
|
62
62
|
|
@@ -80,7 +80,7 @@ functionality afforded by Sinatra.
|
|
80
80
|
|
81
81
|
Padrino has support for an enhanced base application class <tt>Padrino::Application</tt>. <tt>Padrino::Application</tt>
|
82
82
|
expands the capabilities of Sinatra::Application and automatically provides the resulting application access to all of
|
83
|
-
the padrino framework's functionalities.
|
83
|
+
the padrino framework's functionalities.
|
84
84
|
|
85
85
|
=== Simple Application Definition
|
86
86
|
|
@@ -95,7 +95,7 @@ Let us first take a look at the simplest possible Padrino application:
|
|
95
95
|
get '/' do
|
96
96
|
'Hello world'
|
97
97
|
end
|
98
|
-
|
98
|
+
|
99
99
|
# and for read better we can divide with controllers
|
100
100
|
controller '/admin' do
|
101
101
|
get '/foo' do
|
@@ -106,7 +106,7 @@ Let us first take a look at the simplest possible Padrino application:
|
|
106
106
|
|
107
107
|
=== Enhanced Route Definitions and Controllers
|
108
108
|
|
109
|
-
For a complete overview of the Padrino routing and controller system,
|
109
|
+
For a complete overview of the Padrino routing and controller system,
|
110
110
|
check out the {Routing and Controller guide}[http://wiki.github.com/padrino/padrino-framework/controllers].
|
111
111
|
|
112
112
|
Suppose we wanted to add additional routes to our Padrino application, and we want to organize the routes
|
@@ -118,7 +118,7 @@ within a more structured layout. Simply add a <tt>controllers</tt> or <tt>app/co
|
|
118
118
|
"Text to return"
|
119
119
|
end
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
You can also do more complex route alias definitions:
|
123
123
|
|
124
124
|
# app/controllers/example.rb
|
@@ -134,7 +134,7 @@ You can also do more complex route alias definitions:
|
|
134
134
|
end
|
135
135
|
|
136
136
|
as well as mapping the route aliases to an explicit url:
|
137
|
-
|
137
|
+
|
138
138
|
# app/controllers/example.rb
|
139
139
|
SimpleApp.controllers do
|
140
140
|
get :index, :map => '/index' do
|
@@ -145,9 +145,9 @@ as well as mapping the route aliases to an explicit url:
|
|
145
145
|
# access params[:name] and params[:index]
|
146
146
|
end
|
147
147
|
end
|
148
|
-
|
148
|
+
|
149
149
|
and even configure the respond_to for each route:
|
150
|
-
|
150
|
+
|
151
151
|
# app/controllers/example.rb
|
152
152
|
SimpleApp.controllers :admin do
|
153
153
|
get :show, :with => :id, :respond_to => :js do
|
@@ -174,23 +174,23 @@ or auto lookup for current locale or content_type
|
|
174
174
|
When you visit :+show+ and your I18n.locale == :ru Padrino try to look for "admin/show.ru.js.*" if nothing match that path
|
175
175
|
they try "admin/show.ru.*" then "admin/show.js.*" if none match return "admin/show.erb" (or other engine i.e. haml)
|
176
176
|
|
177
|
-
For a complete overview of the routing and controller system, check out the
|
177
|
+
For a complete overview of the routing and controller system, check out the
|
178
178
|
{Routing and Controller guide}[http://wiki.github.com/padrino/padrino-framework/controllers].
|
179
|
-
|
179
|
+
|
180
180
|
=== Rendering
|
181
181
|
|
182
182
|
Unlike Sinatra, Padrino supports automatic template lookups such as:
|
183
183
|
|
184
184
|
# searches for 'account/index.{erb,haml,...}
|
185
185
|
render 'account/index'
|
186
|
-
|
187
|
-
This render does not require any template engine to be specified and will choose the first one that is discovered.
|
186
|
+
|
187
|
+
This render does not require any template engine to be specified and will choose the first one that is discovered.
|
188
188
|
The existing render function works as well if an engine type should be specified:
|
189
189
|
|
190
190
|
# example.haml
|
191
191
|
render :haml, 'account/index'
|
192
192
|
|
193
|
-
For a complete overview of the Padrino rendering system, check out the
|
193
|
+
For a complete overview of the Padrino rendering system, check out the
|
194
194
|
{Routing and Controller guide}[http://wiki.github.com/padrino/padrino-framework/controllers].
|
195
195
|
|
196
196
|
=== Layout
|
@@ -198,39 +198,39 @@ For a complete overview of the Padrino rendering system, check out the
|
|
198
198
|
With Padrino you can (like rails do) use for your custom layout, disable it
|
199
199
|
|
200
200
|
class SimpleApp < Padrino::Application
|
201
|
-
|
201
|
+
|
202
202
|
# Disable layouts
|
203
203
|
disable layout
|
204
|
-
|
204
|
+
|
205
205
|
# Use the layout located in views/layouts/custom.haml
|
206
206
|
layout :custom
|
207
|
-
|
208
|
-
For a complete overview of the layout functionality,
|
207
|
+
|
208
|
+
For a complete overview of the layout functionality,
|
209
209
|
check out the {Routing and Controller guide}[http://wiki.github.com/padrino/padrino-framework/controllers].
|
210
210
|
|
211
211
|
=== Mounting Applications
|
212
212
|
|
213
213
|
Padrino applications are all automatically mountable into other Padrino projects. This means that a given Padrino
|
214
214
|
project directory can easily mount multiple applications. This allows for better organization of complex applications,
|
215
|
-
re-usable applications that can be applied (i.e admin, auth, blog) and even more flexibility.
|
215
|
+
re-usable applications that can be applied (i.e admin, auth, blog) and even more flexibility.
|
216
216
|
|
217
|
-
You can think of mountable applications as a 'full-featured' merb slice or rails engine. Instead of a separate construct,
|
217
|
+
You can think of mountable applications as a 'full-featured' merb slice or rails engine. Instead of a separate construct,
|
218
218
|
any application can simply be packaged and mounted into another project.
|
219
219
|
|
220
220
|
Padrino stores application mounting information by default within <tt>config/apps.rb</tt>. This file is intended
|
221
|
-
to keep all information regarding what applications are mounted to which uri's.
|
221
|
+
to keep all information regarding what applications are mounted to which uri's.
|
222
222
|
|
223
|
-
For a complete look at mounting applications within a Padrino project,
|
223
|
+
For a complete look at mounting applications within a Padrino project,
|
224
224
|
check out the guide on {Mounting Applications}[http://wiki.github.com/padrino/padrino-framework/mounting-applications].
|
225
225
|
|
226
226
|
=== Auto Load Paths
|
227
227
|
|
228
228
|
Padrino also intelligently supports requiring useful files within your application automatically and provides
|
229
229
|
functionality for easily splitting up your application into separate files. Padrino automatically requires <tt>config/database.rb</tt>
|
230
|
-
as a convention for establishing database connection. Also, any files within the <tt>lib</tt> folder will be required
|
230
|
+
as a convention for establishing database connection. Also, any files within the <tt>lib</tt> folder will be required
|
231
231
|
automatically by Padrino.
|
232
232
|
|
233
|
-
For a complete overview of auto-loaded paths within Padrino,
|
233
|
+
For a complete overview of auto-loaded paths within Padrino,
|
234
234
|
check out the {Padrino Development Guide}[http://wiki.github.com/padrino/padrino-framework/development-and-terminal-commands].
|
235
235
|
|
236
236
|
=== Application Logging
|
@@ -238,7 +238,7 @@ check out the {Padrino Development Guide}[http://wiki.github.com/padrino/padrino
|
|
238
238
|
Padrino also supports robust logging capabilities. By default, logging information will
|
239
239
|
go to the STDOUT in development (for use in a console) and in an environment-specific log file <tt>log/development.log</tt>
|
240
240
|
in test and production environments.
|
241
|
-
|
241
|
+
|
242
242
|
To use the logger within a Padrino application, simply refer to the <tt>logger</tt> method accessible
|
243
243
|
within your app and any controller or views:
|
244
244
|
|
@@ -246,20 +246,20 @@ within your app and any controller or views:
|
|
246
246
|
SimpleApp.controllers do
|
247
247
|
get("/test") { logger.info "This is a test" }
|
248
248
|
end
|
249
|
-
|
250
|
-
For a complete overview of Padrino logger functionality, check out the
|
249
|
+
|
250
|
+
For a complete overview of Padrino logger functionality, check out the
|
251
251
|
{Padrino Development Guide}[http://wiki.github.com/padrino/padrino-framework/development-and-terminal-commands].
|
252
252
|
|
253
253
|
=== Development Reloader
|
254
254
|
|
255
255
|
Padrino applications also have the enabled ability to automatically reload all changing application files without
|
256
256
|
the need to restart the server. Through the use of a customized Rack middleware, all files on the 'load path'
|
257
|
-
are monitored and reloaded whenever changes are applied.
|
257
|
+
are monitored and reloaded whenever changes are applied.
|
258
258
|
|
259
|
-
This makes rapid development much easier and provides a better alternative to 'shotgun' or 'rerun'
|
259
|
+
This makes rapid development much easier and provides a better alternative to 'shotgun' or 'rerun'
|
260
260
|
which requires the application server to be restarted which makes requests take much longer to complete.
|
261
261
|
|
262
|
-
For a complete overview of code reloading in development,
|
262
|
+
For a complete overview of code reloading in development,
|
263
263
|
check out the {Padrino Development Guide}[http://wiki.github.com/padrino/padrino-framework/development-and-terminal-commands].
|
264
264
|
|
265
265
|
=== Terminal Commands
|
@@ -272,21 +272,21 @@ The following commands are available:
|
|
272
272
|
# starts the app server (non-daemonized)
|
273
273
|
$ padrino start
|
274
274
|
# starts the app server (daemonized) with given port, environment and adapter
|
275
|
-
$ padrino start -d -p 3000 -e development -a thin
|
276
|
-
|
275
|
+
$ padrino start -d -p 3000 -e development -a thin
|
276
|
+
|
277
277
|
# Stops a daemonized app server
|
278
278
|
$ padrino stop
|
279
|
-
|
279
|
+
|
280
280
|
# Bootup the Padrino console (irb)
|
281
281
|
$ padrino console
|
282
|
-
|
282
|
+
|
283
283
|
# Run/List tasks
|
284
284
|
$ padrino rake
|
285
285
|
|
286
|
-
You can also create custom rake tasks as well. Using these commands can simplify common tasks
|
286
|
+
You can also create custom rake tasks as well. Using these commands can simplify common tasks
|
287
287
|
making development that much smoother.
|
288
288
|
|
289
|
-
For a complete overview of Padrino terminal commands, check out the
|
289
|
+
For a complete overview of Padrino terminal commands, check out the
|
290
290
|
{Padrino Commands Guide}[http://wiki.github.com/padrino/padrino-framework/development-and-terminal-commands].
|
291
291
|
|
292
292
|
== Copyright
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.7
|
data/lib/padrino-core.rb
CHANGED
@@ -15,25 +15,25 @@ module Padrino
|
|
15
15
|
# Helper method for file references.
|
16
16
|
#
|
17
17
|
# ==== Examples
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# # Referencing a file in config called settings.yml
|
20
20
|
# Padrino.root("config", "settings.yml")
|
21
21
|
# # returns PADRINO_ROOT + "/config/setting.yml"
|
22
|
-
#
|
22
|
+
#
|
23
23
|
def root(*args)
|
24
24
|
File.expand_path(File.join(PADRINO_ROOT, *args))
|
25
25
|
end
|
26
26
|
|
27
27
|
##
|
28
28
|
# Helper method that return PADRINO_ENV
|
29
|
-
#
|
29
|
+
#
|
30
30
|
def env
|
31
31
|
PADRINO_ENV.to_s.downcase.to_sym
|
32
32
|
end
|
33
33
|
|
34
34
|
##
|
35
35
|
# Returns the resulting rack builder mapping each 'mounted' application
|
36
|
-
#
|
36
|
+
#
|
37
37
|
def application
|
38
38
|
raise ApplicationLoadError.new("At least one app must be mounted!") unless self.mounted_apps && self.mounted_apps.any?
|
39
39
|
builder = Rack::Builder.new
|
@@ -53,7 +53,7 @@ module Padrino
|
|
53
53
|
|
54
54
|
##
|
55
55
|
# Returns the used $LOAD_PATHS from padrino
|
56
|
-
#
|
56
|
+
#
|
57
57
|
def load_paths
|
58
58
|
%w(
|
59
59
|
lib
|
@@ -65,7 +65,7 @@ module Padrino
|
|
65
65
|
##
|
66
66
|
# Return bundle status :+:locked+ if .bundle/environment.rb exist :+:unlocked if Gemfile exist
|
67
67
|
# otherwise return nil
|
68
|
-
#
|
68
|
+
#
|
69
69
|
def bundle
|
70
70
|
return :locked if File.exist?(root('.bundle/environment.rb'))
|
71
71
|
return :unlocked if File.exist?(root("Gemfile"))
|
@@ -35,20 +35,6 @@ module Padrino
|
|
35
35
|
super(*args, &bk)
|
36
36
|
end
|
37
37
|
|
38
|
-
##
|
39
|
-
# Use layout like rails does or if a block given then like sinatra.
|
40
|
-
# If used without a block, sets the current layout for the route.
|
41
|
-
#
|
42
|
-
# By default, searches in your +app/views/layouts/application.(haml|erb|xxx)+
|
43
|
-
#
|
44
|
-
# If you define +layout :custom+ then searches for your layouts in
|
45
|
-
# +app/views/layouts/custom.(haml|erb|xxx)+
|
46
|
-
#
|
47
|
-
def layout(name=:layout, &block)
|
48
|
-
return super(name, &block) if block_given?
|
49
|
-
@_layout = name
|
50
|
-
end
|
51
|
-
|
52
38
|
##
|
53
39
|
# Reloads the application files from all defined load paths
|
54
40
|
#
|
@@ -94,7 +80,6 @@ module Padrino
|
|
94
80
|
end
|
95
81
|
|
96
82
|
protected
|
97
|
-
|
98
83
|
##
|
99
84
|
# Defines default settings for Padrino application
|
100
85
|
#
|
@@ -189,7 +174,8 @@ module Padrino
|
|
189
174
|
# Returns the load_paths for the application (relative to the application root)
|
190
175
|
#
|
191
176
|
def load_paths
|
192
|
-
@load_paths ||= ["urls.rb", "config/urls.rb", "mailers/*.rb", "mailers.rb",
|
177
|
+
@load_paths ||= ["urls.rb", "config/urls.rb", "mailers/*.rb", "mailers.rb",
|
178
|
+
"controllers/**/*.rb", "controllers.rb", "helpers/**/*.rb", "helpers.rb"]
|
193
179
|
end
|
194
180
|
|
195
181
|
##
|
@@ -206,6 +192,15 @@ module Padrino
|
|
206
192
|
@view_paths = ["views"].collect { |path| File.join(self.root, path) }
|
207
193
|
@view_paths.find { |path| Dir[File.join(path, '/**/*')].any? }
|
208
194
|
end
|
209
|
-
end #
|
195
|
+
end # self
|
196
|
+
|
197
|
+
private
|
198
|
+
def clean_backtrace(trace)
|
199
|
+
return trace unless options.clean_trace?
|
200
|
+
trace.reject { |line|
|
201
|
+
line =~ /lib\/sinatra.*\.rb|lib\/padrino.*\.rb/ ||
|
202
|
+
(defined?(Gem) && line.include?(Gem.dir))
|
203
|
+
}.map! { |line| line.gsub(/^\.\//, '') }
|
204
|
+
end
|
210
205
|
end # Application
|
211
|
-
end # Padrino
|
206
|
+
end # Padrino
|
@@ -2,12 +2,12 @@ module Padrino
|
|
2
2
|
##
|
3
3
|
# Represents a particular mounted padrino application
|
4
4
|
# Stores the name of the application (app folder name) and url mount path
|
5
|
-
#
|
5
|
+
#
|
6
6
|
# ==== Examples
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# Mounter.new("blog_app", :app_class => "Blog").to("/blog")
|
9
9
|
# Mounter.new("blog_app", :app_file => "/path/to/blog/app.rb").to("/blog")
|
10
|
-
#
|
10
|
+
#
|
11
11
|
class Mounter
|
12
12
|
attr_accessor :name, :uri_root, :app_file, :app_class, :app_root, :app_obj
|
13
13
|
|
@@ -21,11 +21,11 @@ module Padrino
|
|
21
21
|
|
22
22
|
##
|
23
23
|
# Registers the mounted application onto Padrino
|
24
|
-
#
|
24
|
+
#
|
25
25
|
# ==== Examples
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# Mounter.new("blog_app").to("/blog")
|
28
|
-
#
|
28
|
+
#
|
29
29
|
def to(mount_url)
|
30
30
|
@uri_root = mount_url
|
31
31
|
Padrino.insert_mounted_app(self)
|
@@ -35,9 +35,9 @@ module Padrino
|
|
35
35
|
##
|
36
36
|
# Maps Padrino application onto a Rack::Builder
|
37
37
|
# For use in constructing a Rack application
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# @app.map_onto(@builder)
|
40
|
-
#
|
40
|
+
#
|
41
41
|
def map_onto(builder)
|
42
42
|
app_data, app_obj = self, @app_obj
|
43
43
|
builder.map self.uri_root do
|
@@ -52,7 +52,7 @@ module Padrino
|
|
52
52
|
|
53
53
|
##
|
54
54
|
# Return the class for the app
|
55
|
-
#
|
55
|
+
#
|
56
56
|
def app_object
|
57
57
|
app_class.constantize rescue Padrino.require_dependency(app_file)
|
58
58
|
app_class.constantize
|
@@ -60,7 +60,7 @@ module Padrino
|
|
60
60
|
|
61
61
|
##
|
62
62
|
# Returns the determined location of the mounted application main file
|
63
|
-
#
|
63
|
+
#
|
64
64
|
def locate_app_file
|
65
65
|
callers_are_identical = File.identical?(Padrino.first_caller.to_s, Padrino.called_from.to_s)
|
66
66
|
callers_are_identical ? Padrino.first_caller : Padrino.mounted_root(name, "app.rb")
|
@@ -68,7 +68,7 @@ module Padrino
|
|
68
68
|
|
69
69
|
##
|
70
70
|
# Makes two Mounters equal if they have the same name and uri_root
|
71
|
-
#
|
71
|
+
#
|
72
72
|
def ==(other)
|
73
73
|
other.is_a?(Mounter) && self.name == other.name && self.uri_root == other.uri_root
|
74
74
|
end
|
@@ -79,21 +79,21 @@ module Padrino
|
|
79
79
|
|
80
80
|
##
|
81
81
|
# Returns the root to the mounted apps base directory
|
82
|
-
#
|
82
|
+
#
|
83
83
|
def mounted_root(*args)
|
84
84
|
Padrino.root(@mounted_root ||= "", *args)
|
85
85
|
end
|
86
86
|
|
87
87
|
##
|
88
88
|
# Returns the mounted padrino applications (MountedApp objects)
|
89
|
-
#
|
89
|
+
#
|
90
90
|
def mounted_apps
|
91
91
|
@mounted_apps ||= []
|
92
92
|
end
|
93
93
|
|
94
94
|
##
|
95
95
|
# Inserts a Mounter object into the mounted applications (avoids duplicates)
|
96
|
-
#
|
96
|
+
#
|
97
97
|
def insert_mounted_app(mounter)
|
98
98
|
return false if Padrino.mounted_apps.include?(mounter)
|
99
99
|
Padrino.mounted_apps << mounter
|
@@ -101,12 +101,12 @@ module Padrino
|
|
101
101
|
|
102
102
|
##
|
103
103
|
# Mounts the core application onto Padrino project with given app settings (file, class, root)
|
104
|
-
#
|
104
|
+
#
|
105
105
|
# ==== Examples
|
106
|
-
#
|
106
|
+
#
|
107
107
|
# Padrino.mount_core("Blog")
|
108
108
|
# Padrino.mount_core(:app_file => "/path/to/file", :app_class => "Blog")
|
109
|
-
#
|
109
|
+
#
|
110
110
|
def mount_core(*args)
|
111
111
|
options = args.extract_options!
|
112
112
|
app_class = args.size > 0 ? args.first.to_s.camelize : nil
|
@@ -116,11 +116,11 @@ module Padrino
|
|
116
116
|
|
117
117
|
##
|
118
118
|
# Mounts a new sub-application onto Padrino project
|
119
|
-
#
|
119
|
+
#
|
120
120
|
# Padrino.mount("blog_app").to("/blog")
|
121
|
-
#
|
121
|
+
#
|
122
122
|
def mount(name, options={})
|
123
123
|
Mounter.new(name, options)
|
124
124
|
end
|
125
125
|
end # Mounter
|
126
|
-
end # Padrino
|
126
|
+
end # Padrino
|