sugar-high 0.4.9.3 → 0.4.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -64,6 +64,9 @@ File object
64
64
  ### Class Extension
65
65
 
66
66
  * autoload_modules (by @stanislaw)
67
+
68
+ Makes it easy to autoload multiple modules by standard folder-to-module mapping convention
69
+
67
70
  * is_class?
68
71
  * is_module?
69
72
  * class_exists?
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.9.3
1
+ 0.4.9.5
@@ -16,7 +16,8 @@ class Module
16
16
 
17
17
  options = args.extract_options!
18
18
  root = options[:root] || AutoLoader.root || ''
19
- from = options[:from] || File.join(root, self.name.to_s.underscore)
19
+ path = root.strip.empty? ? self.name.to_s.underscore : [root, self.name.to_s.underscore].join('/')
20
+ from = options[:from] || path
20
21
 
21
22
  # Here also could be adding of the file in top of load_paths like: $:.unshift File.dirname(__FILE__)
22
23
  # It is very useful for situations of having not load_paths built Rails or Gems way.
@@ -0,0 +1,6 @@
1
+ module AutoloadBlankRoot
2
+ module Hello
3
+ def self.test
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module AutoloadBlankRoot
2
+ autoload_modules :Hello
3
+ end
@@ -56,19 +56,26 @@ describe Module do
56
56
  require 'fixtures/autoload_modules'
57
57
  AutoloadModules::Third.should respond_to(:test)
58
58
  end
59
-
60
- it 'should autoload modules using ClassExt#autoload_root' do
61
- AutoLoader.root = 'fixtures'
62
- require 'fixtures/autoload_modules_root'
63
- AutoloadModulesRoot::Third.should respond_to(:test)
64
- end
65
-
59
+
66
60
  it "should autoload modules from __FILE__'s dir if :from is omitted'" do
67
61
  require 'fixtures/autoload_modulez'
68
62
  AutoloadModulez::ThirdOneHere.should respond_to(:test)
69
63
  end
64
+
65
+ context 'using AutoLoader.root' do
66
+ it 'empty root' do
67
+ AutoLoader.root = ''
68
+ require 'autoload_blank_root'
69
+ AutoloadBlankRoot::Hello.should respond_to(:test)
70
+ end
71
+
72
+ it 'should autoload modules using ClassExt#autoload_root' do
73
+ AutoLoader.root = 'fixtures'
74
+ require 'fixtures/autoload_modules_root'
75
+ AutoloadModulesRoot::Third.should respond_to(:test)
76
+ end
77
+ end
70
78
  end
71
-
72
79
  end
73
80
 
74
81
  describe ClassExt do
data/sugar-high.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sugar-high}
8
- s.version = "0.4.9.3"
8
+ s.version = "0.4.9.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Kristian Mandrup}]
12
- s.date = %q{2011-06-24}
12
+ s.date = %q{2011-06-30}
13
13
  s.description = %q{More Ruby sugar - inspired by the 'zuker' project}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -58,6 +58,8 @@ Gem::Specification.new do |s|
58
58
  "lib/sugar-high/rspec/matchers/have_aliases.rb",
59
59
  "lib/sugar-high/string.rb",
60
60
  "sandbox/test_routes_mutate.rb",
61
+ "spec/autoload_blank_root.rb",
62
+ "spec/autoload_blank_root/hello.rb",
61
63
  "spec/fixtures/application_file.rb",
62
64
  "spec/fixtures/autoload_modules.rb",
63
65
  "spec/fixtures/autoload_modules/subdir/first.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugar-high
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9.3
4
+ version: 0.4.9.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-24 00:00:00.000000000Z
12
+ date: 2011-06-30 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2160205840 !ruby/object:Gem::Requirement
16
+ requirement: &2161649020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2160205840
24
+ version_requirements: *2161649020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: active_support
27
- requirement: &2160205180 !ruby/object:Gem::Requirement
27
+ requirement: &2161648440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2160205180
35
+ version_requirements: *2161648440
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &2160204680 !ruby/object:Gem::Requirement
38
+ requirement: &2161647840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '2.5'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2160204680
46
+ version_requirements: *2161647840
47
47
  description: More Ruby sugar - inspired by the 'zuker' project
48
48
  email: kmandrup@gmail.com
49
49
  executables: []
@@ -93,6 +93,8 @@ files:
93
93
  - lib/sugar-high/rspec/matchers/have_aliases.rb
94
94
  - lib/sugar-high/string.rb
95
95
  - sandbox/test_routes_mutate.rb
96
+ - spec/autoload_blank_root.rb
97
+ - spec/autoload_blank_root/hello.rb
96
98
  - spec/fixtures/application_file.rb
97
99
  - spec/fixtures/autoload_modules.rb
98
100
  - spec/fixtures/autoload_modules/subdir/first.rb