padrino-core 0.14.0.rc2 → 0.14.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8404b8357ac37d668e460e0d3c696917e6ff9856
4
- data.tar.gz: 3db11b004865f9764c20d32c4e46593a6e72245b
3
+ metadata.gz: 40709f499ebbaa2e4cd92c62e2142eac2f9c2ab9
4
+ data.tar.gz: ff33963d9f849f0bd9676be85e58083c3b932f41
5
5
  SHA512:
6
- metadata.gz: 0fcac954da380e620eb81d654682c88c58b3a7693e2bc5b5826576588983a8e5fce2ea5a2315adaee44dc3c05640b6d95a234e5319cec9512aff2a132bbb0074
7
- data.tar.gz: b733600e6602e99991f2a73dcac2cba57eb3e0fdfa7d4b03cb905b7f286f9f105e239aed3be9412df6d62b4546b5e62b4511eed9017d27dd772b1b583164b237
6
+ metadata.gz: 057ae19651da64cc6b475f705bbe28f0990d38011883458f7caeec8ed1d2f34e66654e0f8d3da9e1e979757c493b57eaa1c7a21c78f5e20303040c9f8213e968
7
+ data.tar.gz: 0d2fdf09929e900e98a25a39dbfbfaa7cadf831c10b8a4ac7bc2d26c80ae840fb645d6b6a16abee3f764e1bafd60738bd354508a35830efd72746476b08536f3
@@ -142,7 +142,7 @@ module Padrino
142
142
  # require_dependencies("#{Padrino.root}/lib/**/*.rb")
143
143
  #
144
144
  def require_dependencies(*paths)
145
- options = (paths.last.is_a?(Hash) ? paths.pop : {}).merge( :cyclic => true )
145
+ options = { :cyclic => true }.update(paths.last.is_a?(Hash) ? paths.pop : {})
146
146
 
147
147
  files = paths.flatten.flat_map{ |path| Dir.glob(path).sort_by{ |filename| filename.count('/') } }.uniq
148
148
 
@@ -155,6 +155,7 @@ module Padrino
155
155
  files.delete(file)
156
156
  loaded = true
157
157
  rescue NameError, LoadError => error
158
+ raise if Reloader.exclude.any?{ |path| file.start_with?(path) } || options[:cyclic] == false
158
159
  logger.devel "Cyclic dependency reload for #{error.class}: #{error.message}"
159
160
  rescue Exception => fatal
160
161
  break
@@ -108,6 +108,7 @@ module Padrino
108
108
  app_obj.set :static, public_folder_exists
109
109
  app_obj.set :cascade, app_data.cascade
110
110
  else
111
+ app_obj.cascade = app_data.cascade
111
112
  app_obj.uri_root = uri_root
112
113
  app_obj.public_folder = Padrino.root('public', uri_root) unless public_folder_exists
113
114
  end
@@ -1,7 +1,7 @@
1
1
  module Padrino
2
2
  class Mounter
3
3
  module ApplicationExtension
4
- attr_accessor :uri_root, :mounter_options
4
+ attr_accessor :uri_root, :mounter_options, :cascade
5
5
  attr_writer :public_folder
6
6
 
7
7
  def dependencies
@@ -6,7 +6,7 @@
6
6
  #
7
7
  module Padrino
8
8
  # The version constant for the current version of Padrino.
9
- VERSION = '0.14.0.rc2' unless defined?(Padrino::VERSION)
9
+ VERSION = '0.14.0' unless defined?(Padrino::VERSION)
10
10
 
11
11
  #
12
12
  # The current Padrino version.
@@ -1,7 +1,11 @@
1
1
 
2
2
  class RackApp
3
- def self.call(_)
4
- [200, {}, ["hello rack app"]]
3
+ def self.call(env)
4
+ if env['PATH_INFO'] == '/404'
5
+ [404, {}, ["not found ;("]]
6
+ else
7
+ [200, {}, ["hello rack app"]]
8
+ end
5
9
  end
6
10
 
7
11
  def self.prerequisites
@@ -0,0 +1 @@
1
+ raise LoadError
@@ -9,7 +9,6 @@ require 'builder'
9
9
  require 'rack/test'
10
10
  require 'yaml'
11
11
  require 'padrino-core'
12
- require 'tilt/haml'
13
12
 
14
13
  require 'ext/minitest-spec'
15
14
  require 'ext/rack-test-methods'
@@ -1,5 +1,4 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/helper')
2
- require 'haml'
3
2
 
4
3
  class PadrinoPristine < Padrino::Application; end
5
4
  class PadrinoTestApp < Padrino::Application; end
@@ -53,5 +53,17 @@ describe "Dependencies" do
53
53
  assert_equal ["name"], F.fields
54
54
  assert_equal "", @io.string
55
55
  end
56
+
57
+ it 'should not silence LoadError raised in dependencies excluded from reloading' do
58
+ capture_io do
59
+ assert_raises(LoadError) do
60
+ Padrino::Reloader.exclude << Padrino.root("fixtures/dependencies/linear/h.rb")
61
+ Padrino.require_dependencies(
62
+ Padrino.root("fixtures/dependencies/linear/h.rb"),
63
+ Padrino.root("fixtures/dependencies/linear/i.rb"),
64
+ )
65
+ end
66
+ end
67
+ end
56
68
  end
57
69
  end
@@ -272,6 +272,16 @@ describe "Mounter" do
272
272
  assert_equal [], RackApp.prerequisites
273
273
  end
274
274
 
275
+ it 'should support the Rack Application with cascading style' do
276
+ path = File.expand_path(File.dirname(__FILE__) + '/fixtures/apps/mountable_apps/rack_apps')
277
+ require path
278
+ Padrino.mount('rack_app', :app_class => 'RackApp', :app_file => path, cascade: false).to('/rack_app')
279
+ Padrino.mount('sinatra_app', :app_class => 'SinatraApp', :app_file => path).to('/')
280
+ app = Padrino.application
281
+ res = Rack::MockRequest.new(app).get("/rack_app/404")
282
+ assert_equal "not found ;(", res.body
283
+ end
284
+
275
285
  it 'should support the Rack Application inside padrino project' do
276
286
  path = File.expand_path(File.dirname(__FILE__) + '/fixtures/apps/demo_project/app')
277
287
  api_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/apps/demo_project/api/app')
@@ -550,7 +550,7 @@ describe "Routing" do
550
550
 
551
551
  it 'should generate routes for format simple' do
552
552
  mock_app do
553
- get(:foo, :provides => [:html, :rss]) { render :haml, "Test" }
553
+ get(:foo, :provides => [:html, :rss]) { "Test\n" }
554
554
  end
555
555
  get "/foo"
556
556
  assert_equal "Test\n", body
@@ -664,8 +664,8 @@ describe "Routing" do
664
664
  it 'should generate routes for format with controller' do
665
665
  mock_app do
666
666
  controller :posts do
667
- get(:index, :provides => [:html, :rss, :atom, :js]) { render :haml, "Index.#{content_type}" }
668
- get(:show, :with => :id, :provides => [:html, :rss, :atom]) { render :haml, "Show.#{content_type}" }
667
+ get(:index, :provides => [:html, :rss, :atom, :js]) { "Index.#{content_type}\n" }
668
+ get(:show, :with => :id, :provides => [:html, :rss, :atom]) { "Show.#{content_type}\n" }
669
669
  end
670
670
  end
671
671
  get "/posts"
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.14.0.rc2
4
+ version: 0.14.0
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: 2017-01-19 00:00:00.000000000 Z
14
+ date: 2017-03-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: padrino-support
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.14.0.rc2
22
+ version: 0.14.0
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.14.0.rc2
29
+ version: 0.14.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: sinatra
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -180,6 +180,8 @@ files:
180
180
  - test/fixtures/dependencies/circular/f.rb
181
181
  - test/fixtures/dependencies/circular/g.rb
182
182
  - test/fixtures/dependencies/d.rb
183
+ - test/fixtures/dependencies/linear/h.rb
184
+ - test/fixtures/dependencies/linear/i.rb
183
185
  - test/fixtures/reloadable_apps/external/app/app.rb
184
186
  - test/fixtures/reloadable_apps/external/app/controllers/base.rb
185
187
  - test/fixtures/reloadable_apps/main/app.rb
@@ -219,12 +221,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
219
221
  version: '0'
220
222
  required_rubygems_version: !ruby/object:Gem::Requirement
221
223
  requirements:
222
- - - ">"
224
+ - - ">="
223
225
  - !ruby/object:Gem::Version
224
- version: 1.3.1
226
+ version: 1.3.6
225
227
  requirements: []
226
228
  rubyforge_project: padrino-core
227
- rubygems_version: 2.6.6
229
+ rubygems_version: 2.6.10
228
230
  signing_key:
229
231
  specification_version: 4
230
232
  summary: The required Padrino core gem