padrino-core 0.12.5 → 0.12.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4fabe3c04b7784dac19fe6673af74663794e3477
4
- data.tar.gz: 73e8310a4d9f5a9207ed8f19379c492135c28e00
3
+ metadata.gz: a00a9aa092a6863518b87ff722f5caeecad136f0
4
+ data.tar.gz: 3a03270ae3055db921d9a65c0ebabfef56307158
5
5
  SHA512:
6
- metadata.gz: 4d3814cb0118bfdbd1c358b1a0da1e4b66a3a5336ed11316489a43a968cf45821cde9d04708932e25d3d396885b693fd0d4ce60564a82bd5bce9748f3d20c61f
7
- data.tar.gz: 08a08b2236f7b41cfabc97bcb0273ec8a4036e99058f137ee0c56b9efb78ae63f52e7cfd3fbcf5237de7dbbbe48341352c0dbdd548c8f4b90ed4c3e695eb5d05
6
+ metadata.gz: d91332ef20783e0dd5e1580b79e235f8a3435bf98194558f2ac81b87eb1993e80361efefffb5faa514432546ed0607a1d04fc9853368217f555b893362371456
7
+ data.tar.gz: 7f3a2c369c6c5634e7cef139f5ebfcb210ae0a137c8f7d7f3084a468dabd3f2c264db25b8dbc1b665e40901344e973ef23b9823622cde25eab0d0ecb023a3544
@@ -394,7 +394,7 @@ module Padrino
394
394
  replace_instance_variable(:@_controller, args)
395
395
  replace_instance_variable(:@_defaults, options)
396
396
  replace_instance_variable(:@filters, :before => @filters[:before].dup, :after => @filters[:after].dup)
397
- replace_instance_variable(:@layout, nil)
397
+ replace_instance_variable(:@layout, @layout)
398
398
 
399
399
  yield
400
400
 
@@ -715,8 +715,7 @@ module Padrino
715
715
  if types.include?(accept_format)
716
716
  content_type(accept_format || :html, :charset => 'utf-8')
717
717
  else
718
- halt 406 unless catch_all
719
- false
718
+ catch_all ? true : halt(406)
720
719
  end
721
720
  end
722
721
  end
@@ -1,6 +1,6 @@
1
1
  Dir["{lib/tasks/**,tasks/**,test,spec}/*.rake"].each do |file|
2
2
  begin
3
- load(file)
3
+ load(File.expand_path(file))
4
4
  rescue LoadError => e
5
5
  warn "#{file}: #{e.message}"
6
6
  end
@@ -74,7 +74,8 @@ module Padrino
74
74
  #
75
75
  def lock!
76
76
  klasses = ObjectSpace.classes do |klass|
77
- klass._orig_klass_name.split('::').first
77
+ original_klass_name = klass._orig_klass_name
78
+ original_klass_name.split('::').first if original_klass_name
78
79
  end
79
80
  klasses |= Padrino.mounted_apps.map(&:app_class)
80
81
  exclude_constants.merge(klasses)
@@ -251,18 +252,13 @@ module Padrino
251
252
  #
252
253
  def external_constant?(const)
253
254
  sources = object_sources(const)
254
- begin
255
- if sample = ObjectSpace.each_object(const).first
256
- sources += object_sources(sample)
257
- end
258
- rescue RuntimeError => error # JRuby 1.7.12 fails to ObjectSpace.each_object
259
- raise unless RUBY_PLATFORM =='java' && error.message.start_with?("ObjectSpace is disabled")
260
- end
255
+ # consider methodless constants not external
256
+ return false if sources.empty?
261
257
  !sources.any?{ |source| source.start_with?(Padrino.root) }
262
258
  end
263
259
 
264
260
  ##
265
- # Gets all the sources in which target's class or instance methods are defined.
261
+ # Gets all the sources in which target class is defined.
266
262
  #
267
263
  # Note: Method#source_location is for Ruby 1.9.3+ only.
268
264
  #
@@ -271,7 +267,14 @@ module Padrino
271
267
  target.methods.each do |method_name|
272
268
  next unless method_name.kind_of?(Symbol)
273
269
  method_object = target.method(method_name)
274
- if method_object.owner == (target.class == Class ? target.singleton_class : target.class)
270
+ if method_object.owner == target.singleton_class
271
+ sources << method_object.source_location.first
272
+ end
273
+ end
274
+ target.instance_methods.each do |method_name|
275
+ next unless method_name.kind_of?(Symbol)
276
+ method_object = target.instance_method(method_name)
277
+ if method_object.owner == target
275
278
  sources << method_object.source_location.first
276
279
  end
277
280
  end
@@ -6,7 +6,7 @@
6
6
  #
7
7
  module Padrino
8
8
  # The version constant for the current version of Padrino.
9
- VERSION = '0.12.5' unless defined?(Padrino::VERSION)
9
+ VERSION = '0.12.6' unless defined?(Padrino::VERSION)
10
10
 
11
11
  #
12
12
  # The current Padrino version.
@@ -0,0 +1,7 @@
1
+ PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
2
+
3
+ class SystemStealthyClassDemo < Padrino::Application
4
+ set :reload, true
5
+ end
6
+
7
+ Padrino.load!
@@ -0,0 +1,13 @@
1
+ class Boo
2
+ def self.class_method
3
+ "BooClass"
4
+ end
5
+ end
6
+
7
+ class Woo < Boo
8
+ def poo
9
+ end
10
+ end
11
+
12
+ class Soo < Boo
13
+ end
@@ -109,5 +109,15 @@ describe "SystemReloader" do
109
109
  FileUtils.rm tmp_file
110
110
  end
111
111
  end
112
+
113
+ it 'should not fail with superclass mismatch when reloading descendant classes with no instances' do
114
+ Padrino.clear!
115
+ require File.expand_path(File.dirname(__FILE__) + '/fixtures/apps/stealthy/app.rb')
116
+ @app = SystemStealthyClassDemo
117
+ Padrino.mount(SystemStealthyClassDemo).to("/")
118
+ get '/'
119
+ FileUtils.touch File.expand_path(File.dirname(__FILE__) + '/fixtures/apps/stealthy/helpers/stealthy_class_helpers.rb')
120
+ Padrino.reload!
121
+ end
112
122
  end
113
123
  end
@@ -406,6 +406,16 @@ describe "Routing" do
406
406
  assert_equal 406, status
407
407
  end
408
408
 
409
+ it 'should provide proper content when :provides is specified and Accept: `*/*` requested' do
410
+ mock_app do
411
+ get(:text, :provides => :text) { "text" }
412
+ end
413
+ header 'Accept', '*/*'
414
+ get "/text"
415
+ assert_equal 200, status
416
+ assert_equal "text", body
417
+ end
418
+
409
419
  it 'should return 404 on file extensions it does not provide and flag is not set' do
410
420
  mock_app do
411
421
  get(:a, :provides => [:html, :js]){ content_type }
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.12.5
4
+ version: 0.12.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-03-04 00:00:00.000000000 Z
14
+ date: 2016-05-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: padrino-support
@@ -19,96 +19,96 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.12.5
22
+ version: 0.12.6
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.12.5
29
+ version: 0.12.6
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rack
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
- - - <
34
+ - - "<"
35
35
  - !ruby/object:Gem::Version
36
36
  version: 1.6.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - <
41
+ - - "<"
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.6.0
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: sinatra
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - ~>
48
+ - - "~>"
49
49
  - !ruby/object:Gem::Version
50
50
  version: 1.4.2
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - ~>
55
+ - - "~>"
56
56
  - !ruby/object:Gem::Version
57
57
  version: 1.4.2
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: http_router
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - ~>
62
+ - - "~>"
63
63
  - !ruby/object:Gem::Version
64
64
  version: 0.11.0
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - ~>
69
+ - - "~>"
70
70
  - !ruby/object:Gem::Version
71
71
  version: 0.11.0
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: thor
74
74
  requirement: !ruby/object:Gem::Requirement
75
75
  requirements:
76
- - - ~>
76
+ - - "~>"
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0.18'
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ~>
83
+ - - "~>"
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0.18'
86
86
  - !ruby/object:Gem::Dependency
87
87
  name: activesupport
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - '>='
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '3.1'
93
93
  type: :runtime
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '3.1'
100
100
  - !ruby/object:Gem::Dependency
101
101
  name: rack-protection
102
102
  requirement: !ruby/object:Gem::Requirement
103
103
  requirements:
104
- - - '>='
104
+ - - ">="
105
105
  - !ruby/object:Gem::Version
106
106
  version: 1.5.0
107
107
  type: :runtime
108
108
  prerelease: false
109
109
  version_requirements: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: 1.5.0
114
114
  description: The Padrino core gem required for use of this framework
@@ -119,9 +119,9 @@ extensions: []
119
119
  extra_rdoc_files:
120
120
  - README.rdoc
121
121
  files:
122
- - .document
123
- - .gitignore
124
- - .yardopts
122
+ - ".document"
123
+ - ".gitignore"
124
+ - ".yardopts"
125
125
  - LICENSE.txt
126
126
  - README.rdoc
127
127
  - Rakefile
@@ -183,6 +183,8 @@ files:
183
183
  - test/fixtures/apps/simple.rb
184
184
  - test/fixtures/apps/static.html
185
185
  - test/fixtures/apps/static.rb
186
+ - test/fixtures/apps/stealthy/app.rb
187
+ - test/fixtures/apps/stealthy/helpers/stealthy_class_helpers.rb
186
188
  - test/fixtures/apps/system.rb
187
189
  - test/fixtures/apps/system_class_methods_demo.rb
188
190
  - test/fixtures/apps/system_instance_methods_demo.rb
@@ -220,22 +222,22 @@ licenses:
220
222
  metadata: {}
221
223
  post_install_message:
222
224
  rdoc_options:
223
- - --charset=UTF-8
225
+ - "--charset=UTF-8"
224
226
  require_paths:
225
227
  - lib
226
228
  required_ruby_version: !ruby/object:Gem::Requirement
227
229
  requirements:
228
- - - '>='
230
+ - - ">="
229
231
  - !ruby/object:Gem::Version
230
232
  version: '0'
231
233
  required_rubygems_version: !ruby/object:Gem::Requirement
232
234
  requirements:
233
- - - '>='
235
+ - - ">="
234
236
  - !ruby/object:Gem::Version
235
237
  version: 1.3.6
236
238
  requirements: []
237
239
  rubyforge_project: padrino-core
238
- rubygems_version: 2.0.6
240
+ rubygems_version: 2.4.8
239
241
  signing_key:
240
242
  specification_version: 4
241
243
  summary: The required Padrino core gem
@@ -264,6 +266,8 @@ test_files:
264
266
  - test/fixtures/apps/simple.rb
265
267
  - test/fixtures/apps/static.html
266
268
  - test/fixtures/apps/static.rb
269
+ - test/fixtures/apps/stealthy/app.rb
270
+ - test/fixtures/apps/stealthy/helpers/stealthy_class_helpers.rb
267
271
  - test/fixtures/apps/system.rb
268
272
  - test/fixtures/apps/system_class_methods_demo.rb
269
273
  - test/fixtures/apps/system_instance_methods_demo.rb