padrino-core 0.14.4 → 0.15.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
  SHA256:
3
- metadata.gz: d970982e5c919bfa97c39b3898bd59d396681d17c5b9eaf17854667ce52715ff
4
- data.tar.gz: 4be78f1700017e77554317d4eeca9f94ccc00a685a1c47f1139e2b80816b80f7
3
+ metadata.gz: 5520efda2e9601c24dc69dbb5cb9bdb80cf27e615067349e29182c0dea990ea8
4
+ data.tar.gz: a7051cfec9da81eda972e3d15c0d7fd8a740d06edb7ac4fc6626d66d33c9bf18
5
5
  SHA512:
6
- metadata.gz: 0cbf8c80aba78a17cab9ff325110d4045eb8363803ce47f94cc8b40b022bdeb3864e0a3804434cb5250c5bcb49df3b92c3577e87945b5c1642bf188d3ba59b7e
7
- data.tar.gz: 4fcc0feb28750c7fe358162a7f40d2da0c73147610baa8e61b36d24eda1bc7119e31694178b59fed06a8d9eb865513b3ef250c8f2a5c0849de593b344081a826
6
+ metadata.gz: d671957c0b9c0812edfc15e25a0b6c55b161b3cfc0f7f6333095b5a854d2f5a322230bc8b5963e0a2d8e799f8776a98f53ac04f5e89a298fef202c5cdc80e378
7
+ data.tar.gz: b60663258c732efbd194056184ff26328c6cf23c0800d46b13701f3a7bb8a3bc78c6b20772fa25bd834bfd83d94b8146ae9e4420c6aa77d43359fd001ff99f96
@@ -19,7 +19,7 @@ module Padrino
19
19
  if File.file?(binstub)
20
20
  exec Gem.ruby, binstub, *ARGV
21
21
  else
22
- puts 'Please run `bundler install --binstubs` from your project root to generate bundle-specific executables'
22
+ puts 'Please run `bundle install --binstubs` from your project root to generate bundle-specific executables'
23
23
  exit!
24
24
  end
25
25
  end
@@ -90,7 +90,7 @@ module Padrino
90
90
  return unless options[:force] || file_changed?(file)
91
91
  return require(file) if feature_excluded?(file)
92
92
 
93
- Storage.prepare(file, MTIMES) # might call #safe_load recursively
93
+ Storage.prepare(file) # might call #safe_load recursively
94
94
  logger.devel(file_new?(file) ? :loading : :reload, began_at, file)
95
95
  begin
96
96
  with_silence{ require(file) }
@@ -101,7 +101,7 @@ module Padrino
101
101
  logger.exception exception, :short
102
102
  logger.error "Failed to load #{file}; removing partially defined constants"
103
103
  end
104
- Storage.rollback(file, MTIMES)
104
+ Storage.rollback(file)
105
105
  raise
106
106
  end
107
107
  end
@@ -18,13 +18,12 @@ module Padrino
18
18
  files.delete(name)
19
19
  end
20
20
 
21
- def prepare(name, mtimes)
21
+ def prepare(name)
22
22
  file = remove(name)
23
23
  @old_entries ||= {}
24
24
  @old_entries[name] = {
25
25
  :constants => object_classes,
26
- :features => old_features = Set.new($LOADED_FEATURES.dup),
27
- :mtimes => mtimes.dup
26
+ :features => old_features = Set.new($LOADED_FEATURES.dup)
28
27
  }
29
28
  features = file && file[:features] || []
30
29
  features.each{ |feature| Reloader.safe_load(feature, :force => true) }
@@ -40,11 +39,14 @@ module Padrino
40
39
  @old_entries.delete(name)
41
40
  end
42
41
 
43
- def rollback(name, mtimes)
44
- new_constants = new_classes(@old_entries[name][:constants]).reject do |constant|
45
- newly_commited_constant?(constant, mtimes, @old_entries[name][:mtimes])
42
+ def rollback(name)
43
+ new_classes(@old_entries[name][:constants]).each do |klass|
44
+ loaded_in_name = files.each do |file, data|
45
+ next if file == name
46
+ break if data[:constants].include?(klass)
47
+ end
48
+ Reloader.remove_constant(klass) if loaded_in_name
46
49
  end
47
- new_constants.each{ |klass| Reloader.remove_constant(klass) }
48
50
  @old_entries.delete(name)
49
51
  end
50
52
 
@@ -81,26 +83,6 @@ module Padrino
81
83
  snapshot.include?(klass) ? nil : klass
82
84
  end
83
85
  end
84
-
85
- ##
86
- # Returns true if and only if constant is commited after prepare
87
- #
88
- def newly_commited_constant?(constant, mtimes, old_mtimes)
89
- newly_commited_files(files, mtimes, old_mtimes).each do |_, entry|
90
- return true if entry[:constants].include?(constant)
91
- end
92
- false
93
- end
94
-
95
- ##
96
- # Returns a list of entries in "files" that is commited after prepare
97
- #
98
- def newly_commited_files(files, mtimes, old_mtimes)
99
- files.select do |file, _|
100
- next true unless old_mtimes[file]
101
- old_mtimes[file] < mtimes[file]
102
- end
103
- end
104
86
  end
105
87
  end
106
88
  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.14.4' unless defined?(Padrino::VERSION)
9
+ VERSION = '0.15.0' unless defined?(Padrino::VERSION)
10
10
 
11
11
  #
12
12
  # The current Padrino version.
@@ -5,7 +5,6 @@ require File.expand_path("../lib/padrino-core/version.rb", __FILE__)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "padrino-core"
8
- s.rubyforge_project = "padrino-core"
9
8
  s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
10
9
  s.email = "padrinorb@gmail.com"
11
10
  s.summary = "The required Padrino core gem"
@@ -0,0 +1,2 @@
1
+ class OOO < RRR
2
+ end
@@ -0,0 +1,2 @@
1
+ class PPP
2
+ end
@@ -0,0 +1,4 @@
1
+ Padrino.require_dependencies(
2
+ Padrino.root("fixtures/dependencies/nested/rrr.rb"),
3
+ Padrino.root("fixtures/dependencies/nested/sss.rb")
4
+ )
@@ -0,0 +1,5 @@
1
+ class RRR
2
+ def self.hello
3
+ "hello"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ class RollbackTarget
2
+ def self.hello
3
+ "hello"
4
+ end
5
+ end
6
+
7
+ class SSS < OOO
8
+ end
@@ -76,5 +76,34 @@ describe "Dependencies" do
76
76
  end
77
77
  assert_equal "hello", M.hello
78
78
  end
79
+
80
+
81
+ describe "change log level for :devel" do
82
+ before do
83
+ @log_level_devel = Padrino::Logger::Config[:test]
84
+ @io = StringIO.new
85
+ Padrino::Logger::Config[:test] = { :log_level => :devel, :stream => @io }
86
+ Padrino::Logger.setup!
87
+ end
88
+
89
+ after do
90
+ Padrino::Logger::Config[:test] = @log_level_devel
91
+ Padrino::Logger.setup!
92
+ end
93
+
94
+ it 'should resolve interdependence by out/in side nested require_dependencies' do
95
+ capture_io do
96
+ Padrino.require_dependencies(
97
+ Padrino.root("fixtures/dependencies/nested/ooo.rb"),
98
+ Padrino.root("fixtures/dependencies/nested/ppp.rb"),
99
+ Padrino.root("fixtures/dependencies/nested/qqq.rb")
100
+ )
101
+ end
102
+ assert_equal "hello", RRR.hello
103
+ assert_equal "hello", OOO.hello
104
+ assert_equal "hello", RollbackTarget.hello
105
+ assert_match /Removed constant RollbackTarget from Object/, @io.string
106
+ end
107
+ end
79
108
  end
80
109
  end
@@ -2122,7 +2122,7 @@ describe "Routing" do
2122
2122
  mock_app { set :environment, :development }
2123
2123
  get "/"
2124
2124
  assert_equal 404, status
2125
- assert_match %r{(Sinatra doesn&rsquo;t know this ditty.|<h1>Not Found</h1>)}, body
2125
+ assert_match %r{GET /}, body
2126
2126
  end
2127
2127
 
2128
2128
  it 'should render a custom NotFound page' do
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.4
4
+ version: 0.15.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: 2018-11-05 00:00:00.000000000 Z
14
+ date: 2020-05-14 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.4
22
+ version: 0.15.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.4
29
+ version: 0.15.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: sinatra
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -159,6 +159,11 @@ files:
159
159
  - test/fixtures/dependencies/nested/l.rb
160
160
  - test/fixtures/dependencies/nested/m.rb
161
161
  - test/fixtures/dependencies/nested/n.rb
162
+ - test/fixtures/dependencies/nested/ooo.rb
163
+ - test/fixtures/dependencies/nested/ppp.rb
164
+ - test/fixtures/dependencies/nested/qqq.rb
165
+ - test/fixtures/dependencies/nested/rrr.rb
166
+ - test/fixtures/dependencies/nested/sss.rb
162
167
  - test/fixtures/reloadable_apps/external/app/app.rb
163
168
  - test/fixtures/reloadable_apps/external/app/controllers/base.rb
164
169
  - test/fixtures/reloadable_apps/main/app.rb
@@ -202,9 +207,85 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
207
  - !ruby/object:Gem::Version
203
208
  version: 1.3.6
204
209
  requirements: []
205
- rubyforge_project: padrino-core
206
- rubygems_version: 2.7.8
210
+ rubygems_version: 3.0.6
207
211
  signing_key:
208
212
  specification_version: 4
209
213
  summary: The required Padrino core gem
210
- test_files: []
214
+ test_files:
215
+ - test/fixtures/app_gem/Gemfile
216
+ - test/fixtures/app_gem/app/app.rb
217
+ - test/fixtures/app_gem/app_gem.gemspec
218
+ - test/fixtures/app_gem/lib/app_gem.rb
219
+ - test/fixtures/app_gem/lib/app_gem/version.rb
220
+ - test/fixtures/apps/complex.rb
221
+ - test/fixtures/apps/concerned/app.rb
222
+ - test/fixtures/apps/concerned/models/mixins/badmodule.rb
223
+ - test/fixtures/apps/custom_dependencies/custom_dependencies.rb
224
+ - test/fixtures/apps/custom_dependencies/my_dependencies/my_dependency.rb
225
+ - test/fixtures/apps/demo_app.rb
226
+ - test/fixtures/apps/demo_demo.rb
227
+ - test/fixtures/apps/demo_project/api/app.rb
228
+ - test/fixtures/apps/demo_project/api/lib/api_lib.rb
229
+ - test/fixtures/apps/demo_project/app.rb
230
+ - test/fixtures/apps/external_apps/fake_lib.rb
231
+ - test/fixtures/apps/external_apps/fake_root.rb
232
+ - test/fixtures/apps/helpers/class_methods_helpers.rb
233
+ - test/fixtures/apps/helpers/instance_methods_helpers.rb
234
+ - test/fixtures/apps/helpers/system_helpers.rb
235
+ - test/fixtures/apps/kiq.rb
236
+ - test/fixtures/apps/lib/myklass.rb
237
+ - test/fixtures/apps/lib/myklass/mysubklass.rb
238
+ - test/fixtures/apps/models/child.rb
239
+ - test/fixtures/apps/models/parent.rb
240
+ - test/fixtures/apps/mountable_apps/rack_apps.rb
241
+ - test/fixtures/apps/mountable_apps/static.html
242
+ - test/fixtures/apps/precompiled_app.rb
243
+ - test/fixtures/apps/simple.rb
244
+ - test/fixtures/apps/static.rb
245
+ - test/fixtures/apps/stealthy/app.rb
246
+ - test/fixtures/apps/stealthy/helpers/stealthy_class_helpers.rb
247
+ - test/fixtures/apps/system.rb
248
+ - test/fixtures/apps/system_class_methods_demo.rb
249
+ - test/fixtures/apps/system_instance_methods_demo.rb
250
+ - test/fixtures/dependencies/a.rb
251
+ - test/fixtures/dependencies/b.rb
252
+ - test/fixtures/dependencies/c.rb
253
+ - test/fixtures/dependencies/circular/e.rb
254
+ - test/fixtures/dependencies/circular/f.rb
255
+ - test/fixtures/dependencies/circular/g.rb
256
+ - test/fixtures/dependencies/d.rb
257
+ - test/fixtures/dependencies/linear/h.rb
258
+ - test/fixtures/dependencies/linear/i.rb
259
+ - test/fixtures/dependencies/nested/j.rb
260
+ - test/fixtures/dependencies/nested/k.rb
261
+ - test/fixtures/dependencies/nested/l.rb
262
+ - test/fixtures/dependencies/nested/m.rb
263
+ - test/fixtures/dependencies/nested/n.rb
264
+ - test/fixtures/dependencies/nested/ooo.rb
265
+ - test/fixtures/dependencies/nested/ppp.rb
266
+ - test/fixtures/dependencies/nested/qqq.rb
267
+ - test/fixtures/dependencies/nested/rrr.rb
268
+ - test/fixtures/dependencies/nested/sss.rb
269
+ - test/fixtures/reloadable_apps/external/app/app.rb
270
+ - test/fixtures/reloadable_apps/external/app/controllers/base.rb
271
+ - test/fixtures/reloadable_apps/main/app.rb
272
+ - test/helper.rb
273
+ - test/test_application.rb
274
+ - test/test_configuration.rb
275
+ - test/test_core.rb
276
+ - test/test_csrf_protection.rb
277
+ - test/test_dependencies.rb
278
+ - test/test_filters.rb
279
+ - test/test_flash.rb
280
+ - test/test_locale.rb
281
+ - test/test_logger.rb
282
+ - test/test_mounter.rb
283
+ - test/test_params_protection.rb
284
+ - test/test_reloader_complex.rb
285
+ - test/test_reloader_external.rb
286
+ - test/test_reloader_simple.rb
287
+ - test/test_reloader_storage.rb
288
+ - test/test_reloader_system.rb
289
+ - test/test_restful_routing.rb
290
+ - test/test_router.rb
291
+ - test/test_routing.rb