padrino-core 0.6.7 → 0.7.0
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.
- data/README.rdoc +49 -0
- data/VERSION +1 -1
- data/lib/padrino-core.rb +1 -1
- data/lib/padrino-core/application.rb +13 -15
- data/padrino-core.gemspec +2 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -389,6 +389,32 @@ An application can explicitly enable / disable reloading through the use of opti
|
|
389
389
|
|
390
390
|
By default, reloading is enabled in development and disabled in the test and production environments.
|
391
391
|
|
392
|
+
If you want to build a standalone app you need to take some precautions see example:
|
393
|
+
|
394
|
+
# simple_demo.rb
|
395
|
+
PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
|
396
|
+
require 'padrino-core'
|
397
|
+
|
398
|
+
class SimpleDemo < Padrino::Application
|
399
|
+
set :reload, true
|
400
|
+
|
401
|
+
get "/" do
|
402
|
+
"This is a simple Demo!!!"
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
Padrino.mount_core("SimpleDemo")
|
407
|
+
|
408
|
+
Padrino.run! unless Padrino.loaded? # If you enable reloader prevent to re-run the app
|
409
|
+
|
410
|
+
Padrino.load!
|
411
|
+
|
412
|
+
Now you can run simple_demo.rb with:
|
413
|
+
|
414
|
+
$ ruby simple_demo.rb
|
415
|
+
|
416
|
+
Browse http://localhost:3000 edit your file and refresh your page for see changes!
|
417
|
+
|
392
418
|
=== Terminal Commands
|
393
419
|
|
394
420
|
Padrino also comes equipped with multiple useful terminal commands which can be activated to perform
|
@@ -415,6 +441,29 @@ The following commands are available:
|
|
415
441
|
|
416
442
|
Using these commands can simplify common tasks making development that much smoother.
|
417
443
|
|
444
|
+
=== Special Folders
|
445
|
+
|
446
|
+
Padrino load these paths:
|
447
|
+
|
448
|
+
project/lib
|
449
|
+
project/models
|
450
|
+
project/shared/lib
|
451
|
+
project/shared/models
|
452
|
+
project/each_app/models
|
453
|
+
|
454
|
+
This mean that you are free to store for example +models+ where you prefer, if you have two or more apps with same
|
455
|
+
models you can use +project+/+shared+/+models+ or +root+/+models+.
|
456
|
+
|
457
|
+
If you have only one app you still use +project+/+app+/+models+ (this is the default padrino-gen choice)
|
458
|
+
|
459
|
+
Remember that if you need to load other paths you can use:
|
460
|
+
|
461
|
+
Padrino.set_load_paths("path/one")
|
462
|
+
|
463
|
+
and if you need to load dependencies use:
|
464
|
+
|
465
|
+
Padrino.require_dependencies("path/one/**/*.rb")
|
466
|
+
|
418
467
|
== Copyright
|
419
468
|
|
420
469
|
Copyright (c) 2010 Padrino. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
data/lib/padrino-core.rb
CHANGED
@@ -188,7 +188,7 @@ module Padrino
|
|
188
188
|
unless options.static? && options.public? && (request.get? || request.head?) && static_file?(request.path_info)
|
189
189
|
request.path_info =~ /\.([^\.\/]+)$/
|
190
190
|
@_content_type = ($1 || :html).to_sym
|
191
|
-
content_type(@_content_type) rescue content_type('application/octet-stream')
|
191
|
+
content_type(@_content_type, :charset => 'utf-8') rescue content_type('application/octet-stream')
|
192
192
|
end
|
193
193
|
end
|
194
194
|
end
|
@@ -296,7 +296,7 @@ module Padrino
|
|
296
296
|
path += "/" unless path =~ /\/$/
|
297
297
|
path += Array(params).collect(&:inspect).join("/")
|
298
298
|
end
|
299
|
-
|
299
|
+
|
300
300
|
# Now we need to parse our respond_to
|
301
301
|
if format = options.delete(:respond_to)
|
302
302
|
path += case format
|
@@ -309,10 +309,10 @@ module Padrino
|
|
309
309
|
else ".{:format,#{format}}"
|
310
310
|
end
|
311
311
|
end
|
312
|
-
|
312
|
+
|
313
313
|
# Build our controller
|
314
314
|
controller = Array(@_controller).collect(&:to_s)
|
315
|
-
|
315
|
+
|
316
316
|
unless controller.empty?
|
317
317
|
# Now we need to add our controller path only if not mapped directly
|
318
318
|
if map.blank?
|
@@ -325,7 +325,7 @@ module Padrino
|
|
325
325
|
name = "#{controller_name}_#{name}".to_sym unless controller_name.blank?
|
326
326
|
end
|
327
327
|
end
|
328
|
-
|
328
|
+
|
329
329
|
# We need to have a path that start with / in some circumstances and that don't end with /
|
330
330
|
if path != "(/)" && path != "/"
|
331
331
|
path = "/" + path if path !~ /^\//
|
@@ -391,15 +391,13 @@ module Padrino
|
|
391
391
|
# serving files from the public directory
|
392
392
|
#
|
393
393
|
def static_file?(path_info)
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
return path
|
402
|
-
end
|
394
|
+
return if (public_dir = options.public).nil?
|
395
|
+
public_dir = File.expand_path(public_dir)
|
396
|
+
|
397
|
+
path = File.expand_path(public_dir + unescape(path_info))
|
398
|
+
return if path[0, public_dir.length] != public_dir
|
399
|
+
return unless File.file?(path)
|
400
|
+
return path
|
403
401
|
end
|
404
402
|
|
405
403
|
private
|
@@ -484,7 +482,7 @@ module Padrino
|
|
484
482
|
if (options[:layout].nil? || options[:layout] == true) && !self.class.templates.has_key?(:layout)
|
485
483
|
layout = self.class.instance_variable_defined?(:@_layout) ? self.class.instance_variable_get(:@_layout) : :application
|
486
484
|
if layout
|
487
|
-
options[:layout] = File.join('layouts', layout.to_s).to_sym
|
485
|
+
options[:layout] = Dir["#{self.options.views}/#{layout}.*"].size == 0 ? File.join('layouts', layout.to_s).to_sym : layout.to_sym
|
488
486
|
logger.debug "Rendering layout #{options[:layout]}"
|
489
487
|
end
|
490
488
|
end
|
data/padrino-core.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{padrino-core}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.7.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-31}
|
13
13
|
s.default_executable = %q{padrino}
|
14
14
|
s.description = %q{The Padrino core gem required for use of this framework}
|
15
15
|
s.email = %q{nesquena@gmail.com}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2010-01-
|
15
|
+
date: 2010-01-31 00:00:00 +01:00
|
16
16
|
default_executable: padrino
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|