sugar-high 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,5 +2,6 @@ source 'http://rubygems.org'
2
2
 
3
3
  group :development, :test do
4
4
  gem "rspec"
5
+ gem "active_support"
5
6
  end
6
7
 
data/README.markdown CHANGED
@@ -63,6 +63,7 @@ File object
63
63
 
64
64
  ### Class Extension
65
65
 
66
+ * autoload_modules (by @stanislaw)
66
67
  * is_class?
67
68
  * is_module?
68
69
  * class_exists?
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.8
1
+ 0.4.9
@@ -92,9 +92,7 @@ class Object
92
92
  def autoload_modules *args
93
93
 
94
94
  options = args.extract_options!
95
- from = options[:from]
96
-
97
- raise "Define load path like :from => '#{self.name.to_s.downcase}'" unless from
95
+ from = options[:from] || self.name.to_s.underscore
98
96
 
99
97
  # Here also could be adding of the file in top of load_paths like: $:.unshift File.dirname(__FILE__)
100
98
  # It is very useful for situations of having not load_paths built Rails or Gems way.
@@ -4,6 +4,5 @@ module AutoloadModules
4
4
  #autoload :First, 'autoload_modules/first'
5
5
  #autoload :Second, 'autoload_modules/second'
6
6
  #autoload :Third, 'autoload_modules/third'
7
- autoload_modules :First, :Second, :Third, :from => 'autoload_modules'
7
+ autoload_modules :First, :Second, :Third, :from => 'autoload_modules/subdir'
8
8
  end
9
-
@@ -0,0 +1,6 @@
1
+ $:.unshift File.dirname(__FILE__)
2
+
3
+ module AutoloadModulez
4
+ autoload_modules :First, :Second, :Third
5
+ end
6
+
@@ -0,0 +1,7 @@
1
+ module AutoloadModulez
2
+ module First
3
+ def test
4
+ puts "here is the test"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ module AutoloadModulez
2
+ class Second
3
+ extend AutoloadModulez::First
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module AutoloadModulez
2
+ class Third < AutoloadModulez::Second
3
+ end
4
+ end
@@ -37,10 +37,14 @@ end
37
37
 
38
38
  describe Object do
39
39
  describe "#autoload_modules" do
40
- it "should autoload modules" do
40
+ it "should autoload modules using :from => path" do
41
41
  require 'fixtures/autoload_modules'
42
42
  AutoloadModules::Third.should respond_to(:test)
43
43
  end
44
+ it "should autoload modules from __FILE__'s dir if :from is omitted'" do
45
+ require 'fixtures/autoload_modulez'
46
+ AutoloadModulez::Third.should respond_to(:test)
47
+ end
44
48
  end
45
49
  end
46
50
 
data/sugar-high.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sugar-high}
8
- s.version = "0.4.8"
8
+ s.version = "0.4.9"
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}]
@@ -60,9 +60,13 @@ Gem::Specification.new do |s|
60
60
  "sandbox/test_routes_mutate.rb",
61
61
  "spec/fixtures/application_file.rb",
62
62
  "spec/fixtures/autoload_modules.rb",
63
- "spec/fixtures/autoload_modules/first.rb",
64
- "spec/fixtures/autoload_modules/second.rb",
65
- "spec/fixtures/autoload_modules/third.rb",
63
+ "spec/fixtures/autoload_modules/subdir/first.rb",
64
+ "spec/fixtures/autoload_modules/subdir/second.rb",
65
+ "spec/fixtures/autoload_modules/subdir/third.rb",
66
+ "spec/fixtures/autoload_modulez.rb",
67
+ "spec/fixtures/autoload_modulez/first.rb",
68
+ "spec/fixtures/autoload_modulez/second.rb",
69
+ "spec/fixtures/autoload_modulez/third.rb",
66
70
  "spec/fixtures/class_file.rb",
67
71
  "spec/fixtures/class_file.txt",
68
72
  "spec/fixtures/content_file.txt",
@@ -107,13 +111,16 @@ Gem::Specification.new do |s|
107
111
 
108
112
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
109
113
  s.add_development_dependency(%q<rspec>, [">= 0"])
114
+ s.add_development_dependency(%q<active_support>, [">= 0"])
110
115
  s.add_development_dependency(%q<rspec>, [">= 2.5"])
111
116
  else
112
117
  s.add_dependency(%q<rspec>, [">= 0"])
118
+ s.add_dependency(%q<active_support>, [">= 0"])
113
119
  s.add_dependency(%q<rspec>, [">= 2.5"])
114
120
  end
115
121
  else
116
122
  s.add_dependency(%q<rspec>, [">= 0"])
123
+ s.add_dependency(%q<active_support>, [">= 0"])
117
124
  s.add_dependency(%q<rspec>, [">= 2.5"])
118
125
  end
119
126
  end
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.8
4
+ version: 0.4.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-06-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2156725160 !ruby/object:Gem::Requirement
16
+ requirement: &2156742720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2156725160
24
+ version_requirements: *2156742720
25
+ - !ruby/object:Gem::Dependency
26
+ name: active_support
27
+ requirement: &2156742160 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2156742160
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rspec
27
- requirement: &2156724680 !ruby/object:Gem::Requirement
38
+ requirement: &2156741580 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,7 +43,7 @@ dependencies:
32
43
  version: '2.5'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *2156724680
46
+ version_requirements: *2156741580
36
47
  description: More Ruby sugar - inspired by the 'zuker' project
37
48
  email: kmandrup@gmail.com
38
49
  executables: []
@@ -84,9 +95,13 @@ files:
84
95
  - sandbox/test_routes_mutate.rb
85
96
  - spec/fixtures/application_file.rb
86
97
  - spec/fixtures/autoload_modules.rb
87
- - spec/fixtures/autoload_modules/first.rb
88
- - spec/fixtures/autoload_modules/second.rb
89
- - spec/fixtures/autoload_modules/third.rb
98
+ - spec/fixtures/autoload_modules/subdir/first.rb
99
+ - spec/fixtures/autoload_modules/subdir/second.rb
100
+ - spec/fixtures/autoload_modules/subdir/third.rb
101
+ - spec/fixtures/autoload_modulez.rb
102
+ - spec/fixtures/autoload_modulez/first.rb
103
+ - spec/fixtures/autoload_modulez/second.rb
104
+ - spec/fixtures/autoload_modulez/third.rb
90
105
  - spec/fixtures/class_file.rb
91
106
  - spec/fixtures/class_file.txt
92
107
  - spec/fixtures/content_file.txt