padrino-core 0.9.25 → 0.9.26
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/padrino-core/application.rb +9 -3
- data/lib/padrino-core/loader.rb +10 -7
- data/lib/padrino-core/logger.rb +2 -1
- data/lib/padrino-core/mounter.rb +1 -1
- data/lib/padrino-core/version.rb +1 -1
- data/padrino-core.gemspec +9 -6
- data/test/fixtures/apps/.components +6 -0
- data/test/fixtures/apps/.gitignore +7 -0
- data/test/test_logger.rb +11 -1
- metadata +34 -16
- data/test/tmp/cache/%2Ffoo +0 -2
@@ -133,6 +133,7 @@ module Padrino
|
|
133
133
|
set :padrino_logging, true
|
134
134
|
set :method_override, true
|
135
135
|
set :sessions, false
|
136
|
+
set :session_path, '/'
|
136
137
|
set :public, Proc.new { Padrino.root('public', uri_root) }
|
137
138
|
set :views, Proc.new { File.join(root, "views") }
|
138
139
|
set :images_path, Proc.new { File.join(public, "images") }
|
@@ -210,9 +211,14 @@ module Padrino
|
|
210
211
|
end
|
211
212
|
|
212
213
|
private
|
214
|
+
|
213
215
|
def setup_sessions(builder)
|
214
|
-
return unless sessions
|
215
|
-
|
216
|
+
return unless sessions?
|
217
|
+
options = {}
|
218
|
+
options[:secret] = session_secret if session_secret?
|
219
|
+
options[:path] = session_path if session_path?
|
220
|
+
options.merge!(sessions.to_hash) if sessions.respond_to?(:to_hash)
|
221
|
+
builder.use Rack::Session::Cookie, options
|
216
222
|
end
|
217
223
|
end # self
|
218
224
|
|
@@ -225,4 +231,4 @@ module Padrino
|
|
225
231
|
}.map! { |line| line.gsub(/^\.\//, '') }
|
226
232
|
end
|
227
233
|
end # Application
|
228
|
-
end # Padrino
|
234
|
+
end # Padrino
|
data/lib/padrino-core/loader.rb
CHANGED
@@ -98,17 +98,20 @@ module Padrino
|
|
98
98
|
# Extract all files to load
|
99
99
|
files = paths.map { |path| Dir[path] }.flatten.uniq.sort
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
size_at_start = files.size
|
101
|
+
# We need a size to make sure things are loading
|
102
|
+
size_at_start = files.size
|
104
103
|
|
104
|
+
while files.present?
|
105
105
|
# List of errors and failed files
|
106
106
|
errors, failed = [], []
|
107
107
|
|
108
|
-
# Now we try to require our dependencies
|
109
|
-
|
108
|
+
# Now we try to require our dependencies, we dup files
|
109
|
+
# so we don't perform delete on the original array during
|
110
|
+
# iteration, this prevent problems with rubinus
|
111
|
+
files.dup.each do |file|
|
110
112
|
begin
|
111
113
|
Reloader::Stat.safe_load(file)
|
114
|
+
files.delete(file)
|
112
115
|
rescue LoadError => e
|
113
116
|
errors << e
|
114
117
|
failed << file
|
@@ -121,8 +124,8 @@ module Padrino
|
|
121
124
|
end
|
122
125
|
|
123
126
|
# Stop processing if nothing loads or if everything has loaded
|
124
|
-
raise errors.last if
|
125
|
-
break if
|
127
|
+
raise errors.last if files.size == size_at_start && files.present?
|
128
|
+
break if files.empty?
|
126
129
|
end
|
127
130
|
end
|
128
131
|
|
data/lib/padrino-core/logger.rb
CHANGED
@@ -215,6 +215,7 @@ module Padrino
|
|
215
215
|
flush if @auto_flush
|
216
216
|
message
|
217
217
|
end
|
218
|
+
alias :write :<<
|
218
219
|
|
219
220
|
##
|
220
221
|
# Generate the logging methods for Padrino.logger for each log level.
|
@@ -328,4 +329,4 @@ module Kernel #:nodoc:
|
|
328
329
|
def logger
|
329
330
|
Padrino.logger
|
330
331
|
end
|
331
|
-
end # Kernel
|
332
|
+
end # Kernel
|
data/lib/padrino-core/mounter.rb
CHANGED
@@ -133,7 +133,7 @@ module Padrino
|
|
133
133
|
candidates = []
|
134
134
|
candidates << app_constant.app_file if app_constant.respond_to?(:app_file) && File.exist?(app_constant.app_file.to_s)
|
135
135
|
candidates << Padrino.first_caller if File.identical?(Padrino.first_caller.to_s, Padrino.called_from.to_s)
|
136
|
-
candidates << Padrino.mounted_root(name, "app.rb")
|
136
|
+
candidates << Padrino.mounted_root(name.downcase, "app.rb")
|
137
137
|
candidates << Padrino.root("app", "app.rb")
|
138
138
|
candidates.find { |candidate| File.exist?(candidate) }
|
139
139
|
end
|
data/lib/padrino-core/version.rb
CHANGED
data/padrino-core.gemspec
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
require File.expand_path("../lib/padrino-core/version.rb", __FILE__)
|
2
3
|
|
3
4
|
Gem::Specification.new do |s|
|
@@ -8,18 +9,20 @@ Gem::Specification.new do |s|
|
|
8
9
|
s.summary = "The required Padrino core gem"
|
9
10
|
s.homepage = "http://www.padrinorb.com"
|
10
11
|
s.description = "The Padrino core gem required for use of this framework"
|
11
|
-
s.default_executable = "padrino"
|
12
|
-
s.executables = ["padrino"]
|
13
12
|
s.required_rubygems_version = ">= 1.3.6"
|
14
13
|
s.version = Padrino.version
|
15
14
|
s.date = Time.now.strftime("%Y-%m-%d")
|
15
|
+
|
16
16
|
s.extra_rdoc_files = Dir["*.rdoc"]
|
17
|
-
s.files
|
18
|
-
s.
|
19
|
-
s.
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
22
|
+
|
20
23
|
s.add_dependency("tilt", "~> 1.3.0")
|
21
24
|
s.add_dependency("sinatra", "~> 1.2.3")
|
22
|
-
s.add_dependency("http_router", "~> 0.7.
|
25
|
+
s.add_dependency("http_router", "~> 0.7.5")
|
23
26
|
s.add_dependency("thor", ">=0.14.3")
|
24
27
|
s.add_dependency("activesupport", ">= 3.0.0")
|
25
28
|
s.add_dependency("tzinfo")
|
data/test/test_logger.rb
CHANGED
@@ -44,6 +44,16 @@ class TestPadrinoLogger < Test::Unit::TestCase
|
|
44
44
|
assert_match(/Yep this can be logged/, @log.string)
|
45
45
|
end
|
46
46
|
|
47
|
+
should 'respond to #write for Rack::CommonLogger' do
|
48
|
+
setup_logger(:log_level => :error)
|
49
|
+
@logger.error "Error message"
|
50
|
+
assert_match /Error message/, @log.string
|
51
|
+
@logger << "logged anyways"
|
52
|
+
assert_match /logged anyways/, @log.string
|
53
|
+
@logger.write "log via alias"
|
54
|
+
assert_match /log via alias/, @log.string
|
55
|
+
end
|
56
|
+
|
47
57
|
should 'log an application' do
|
48
58
|
mock_app { get("/"){ "Foo" } }
|
49
59
|
get "/"
|
@@ -69,4 +79,4 @@ class TestPadrinoLogger < Test::Unit::TestCase
|
|
69
79
|
end
|
70
80
|
end
|
71
81
|
end
|
72
|
-
end
|
82
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 26
|
10
|
+
version: 0.9.26
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Padrino Team
|
@@ -18,8 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-04-
|
22
|
-
default_executable: padrino
|
21
|
+
date: 2011-04-28 00:00:00 Z
|
23
22
|
dependencies:
|
24
23
|
- !ruby/object:Gem::Dependency
|
25
24
|
name: tilt
|
@@ -61,12 +60,12 @@ dependencies:
|
|
61
60
|
requirements:
|
62
61
|
- - ~>
|
63
62
|
- !ruby/object:Gem::Version
|
64
|
-
hash:
|
63
|
+
hash: 9
|
65
64
|
segments:
|
66
65
|
- 0
|
67
66
|
- 7
|
68
|
-
-
|
69
|
-
version: 0.7.
|
67
|
+
- 5
|
68
|
+
version: 0.7.5
|
70
69
|
type: :runtime
|
71
70
|
version_requirements: *id003
|
72
71
|
- !ruby/object:Gem::Dependency
|
@@ -129,12 +128,12 @@ files:
|
|
129
128
|
- LICENSE
|
130
129
|
- README.rdoc
|
131
130
|
- Rakefile
|
132
|
-
- padrino-core.gemspec
|
133
131
|
- bin/padrino
|
132
|
+
- lib/padrino-core.rb
|
133
|
+
- lib/padrino-core/application.rb
|
134
134
|
- lib/padrino-core/application/rendering.rb
|
135
135
|
- lib/padrino-core/application/routing.rb
|
136
136
|
- lib/padrino-core/application/showexceptions.rb
|
137
|
-
- lib/padrino-core/application.rb
|
138
137
|
- lib/padrino-core/caller.rb
|
139
138
|
- lib/padrino-core/cli/adapter.rb
|
140
139
|
- lib/padrino-core/cli/base.rb
|
@@ -169,7 +168,9 @@ files:
|
|
169
168
|
- lib/padrino-core/support_lite.rb
|
170
169
|
- lib/padrino-core/tasks.rb
|
171
170
|
- lib/padrino-core/version.rb
|
172
|
-
-
|
171
|
+
- padrino-core.gemspec
|
172
|
+
- test/fixtures/apps/.components
|
173
|
+
- test/fixtures/apps/.gitignore
|
173
174
|
- test/fixtures/apps/complex.rb
|
174
175
|
- test/fixtures/apps/simple.rb
|
175
176
|
- test/fixtures/dependencies/a.rb
|
@@ -188,8 +189,6 @@ files:
|
|
188
189
|
- test/test_router.rb
|
189
190
|
- test/test_routing.rb
|
190
191
|
- test/test_server.rb
|
191
|
-
- test/tmp/cache/%2Ffoo
|
192
|
-
has_rdoc: true
|
193
192
|
homepage: http://www.padrinorb.com
|
194
193
|
licenses: []
|
195
194
|
|
@@ -221,9 +220,28 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
220
|
requirements: []
|
222
221
|
|
223
222
|
rubyforge_project: padrino-core
|
224
|
-
rubygems_version: 1.
|
223
|
+
rubygems_version: 1.7.2
|
225
224
|
signing_key:
|
226
225
|
specification_version: 3
|
227
226
|
summary: The required Padrino core gem
|
228
|
-
test_files:
|
229
|
-
|
227
|
+
test_files:
|
228
|
+
- test/fixtures/apps/.components
|
229
|
+
- test/fixtures/apps/.gitignore
|
230
|
+
- test/fixtures/apps/complex.rb
|
231
|
+
- test/fixtures/apps/simple.rb
|
232
|
+
- test/fixtures/dependencies/a.rb
|
233
|
+
- test/fixtures/dependencies/b.rb
|
234
|
+
- test/fixtures/dependencies/c.rb
|
235
|
+
- test/fixtures/dependencies/d.rb
|
236
|
+
- test/helper.rb
|
237
|
+
- test/test_application.rb
|
238
|
+
- test/test_core.rb
|
239
|
+
- test/test_dependencies.rb
|
240
|
+
- test/test_logger.rb
|
241
|
+
- test/test_mounter.rb
|
242
|
+
- test/test_reloader_complex.rb
|
243
|
+
- test/test_reloader_simple.rb
|
244
|
+
- test/test_rendering.rb
|
245
|
+
- test/test_router.rb
|
246
|
+
- test/test_routing.rb
|
247
|
+
- test/test_server.rb
|
data/test/tmp/cache/%2Ffoo
DELETED