sinatra-drumkit 0.1.0 → 0.2.0

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: 626e0995f180d3eb78414b6c261dbfc107620dc2
4
- data.tar.gz: 4fd4d5ac512194a576f3cf57b2ba59d8a5515600
3
+ metadata.gz: 34212bbbbfe2445469d95e9cb35ec4ec0723e734
4
+ data.tar.gz: a473262be90e22cd8864f70f027f614887a0e471
5
5
  SHA512:
6
- metadata.gz: a87388a29538d03bccf44bcc7bf5f6f5eff5cca09357acb8f0ac658a93db1d1d2481e9cab2cac918b236506d5d373abeeb9f520c4d8df13fae0a1313a080f4ea
7
- data.tar.gz: 1a977b4dd551f55e3f9cf96e157dd5bb1486b3a2e683b3894612ee9588554d7f6cac41eb8465f70a9602af2dcb1ed685639bb5e63695ad2dedabd99889f29eeb
6
+ metadata.gz: 9d9e7a6b6148877be3c5a3ec8712e2cb64195fa8da6d0070f22e5feb3bb25fc7c3bb57a7b2395611136575fdae0e1d435d0ac3829a480a9d2f3d0c9000bb1ac8
7
+ data.tar.gz: cbfdbfeadeb05a6c1f8e0cc41fa2429bd67c93fa1dd21945954fe5826cb259d3a1df16cff93ed2ca99d27bc9b08e070d61e4b743823b603b6207eb3a720378d0
@@ -25,7 +25,14 @@ module Sinatra
25
25
  :const_missing, lambda { |const|
26
26
  @searched ||= {}
27
27
  raise "Class not found: #{const}" if @searched[const]
28
- require File.join(load_dir, "#{const.to_s.downcase}.rb")
28
+ filename = const.to_s
29
+ .gsub('::', '/')
30
+ .gsub(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
31
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
32
+ .downcase
33
+ filepath = File.join(load_dir, "#{filename}.rb")
34
+ raise("Class file \"#{filepath}\" for #{const}") unless File.readable?(filepath)
35
+ require filepath
29
36
  @searched[const] = true
30
37
  const_get(const) || raise("Class not found: #{const}")
31
38
  }
@@ -34,7 +41,7 @@ module Sinatra
34
41
  end
35
42
 
36
43
  def load_controllers(load_dir)
37
- Dir[::File.join(load_dir, '*.rb')].each do |file|
44
+ Dir[::File.join(load_dir, '**/*.rb')].each do |file|
38
45
  instance_eval(File.read(file), file)
39
46
  end
40
47
  end
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module Drumkit
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.2.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-drumkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Elliott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-23 00:00:00.000000000 Z
11
+ date: 2019-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.6.11
109
+ rubygems_version: 2.5.1
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: Provide clean MVC autoloading for sinatra