sweetloader 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -64,17 +64,19 @@ The mode `:require` is used to execute require statements directly. The `:autolo
64
64
  You can also specify the SweetLoader options directly as an option hash on the `#autoload_modules` call:
65
65
 
66
66
  ```ruby
67
- autoload_modules :Configuration, :mode => :require
68
- autoload_modules :Configuration, :Factory, :root => 'helpers'
69
- autoload_modules :Configuration, :Factory, :Permit, :ns => {:CanTango => 'cantango'} # or use :namespaces
67
+ sweetload :Configuration, :mode => :require
68
+ sweetload :Configuration, :Factory, :root => 'helpers'
69
+ sweetload :Configuration, :Factory, :Permit, :ns => {:CanTango => 'cantango'} # or use :namespaces
70
70
  ```
71
71
 
72
+ Note: `#autoload_modules` is deprecated in place of `#sweetload`
73
+
72
74
  ## Mutate path option
73
75
 
74
76
  This option is only available for `autoload_modules`. It can be used to execute more general substitution logic on the generated file path:
75
77
 
76
78
  ```ruby
77
- autoload_modules :Configuration, :Factory, :Permit, :mutate_path => Proc.new {|path| path.sub(/(ies)/, 'y') }
79
+ sweetload :Configuration, :Factory, :Permit, :mutate_path => Proc.new {|path| path.sub(/(ies)/, 'y') }
78
80
  ```
79
81
 
80
82
  ## Scopes
@@ -85,17 +87,19 @@ A Scope allows options to be specified that are effective on all `autoload_modul
85
87
  module AutoloadModules
86
88
  module Configuration
87
89
  # the scope options only have effect for autoload_modules statements within it!
88
- autoload_scope
90
+ sweet_scope
89
91
  :ns => { :AutoloadModules => 'fixtures/autoload_modulez'},
90
92
  :mutate_path => Proc.new {|path| path.sub(/(ies)/, 'y') } do
91
- autoload_modules :Admin
93
+ sweetload :Admin
92
94
  end
93
95
 
94
- autoload_modules :Editor
96
+ sweetload :Editor
95
97
  end
96
98
  end
97
99
  ```
98
100
 
101
+ Note: `#autoload_scope` is deprecated in place of `#sweet_scope`
102
+
99
103
  ## ClassExt
100
104
 
101
105
  Sweetloader also encludes a convenient extension called `ClassExt`, which can be used to find a Module or Class based on a name.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5
1
+ 0.1.6
@@ -46,6 +46,7 @@ module SweetLoader
46
46
  end
47
47
  end
48
48
  alias_method :autoload_module, :autoload_modules
49
+ alias_method :sweetload, :autoload_modules
49
50
 
50
51
  def mode_logic mode
51
52
  case mode
@@ -61,9 +62,11 @@ module SweetLoader
61
62
  def autoload_scope options = {}, &block
62
63
  if block_given?
63
64
  block.arity == 1 ? yield(self) : SweetLoader::Scope.new(self, options).instance_eval(&block)
64
- end
65
- end
66
- end
65
+ end
66
+ end
67
+ alias_method :sweetload_scope, :autoload_scope
68
+ alias_method :sweet_scope, :autoload_scope
69
+ end
67
70
 
68
71
  class Module
69
72
  include SweetLoader
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sweetloader}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
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-11-29}
12
+ s.date = %q{2011-12-04}
13
13
  s.description = %q{sweet autoloading using file structure conventions while allowing configuration overrides for special cases}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweetloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
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-11-29 00:00:00.000000000Z
12
+ date: 2011-12-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70281404735240 !ruby/object:Gem::Requirement
16
+ requirement: &70176552946280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70281404735240
24
+ version_requirements: *70176552946280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: i18n
27
- requirement: &70281404734700 !ruby/object:Gem::Requirement
27
+ requirement: &70176552943640 !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: :runtime
34
34
  prerelease: false
35
- version_requirements: *70281404734700
35
+ version_requirements: *70176552943640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70281404733980 !ruby/object:Gem::Requirement
38
+ requirement: &70176552934880 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.5.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70281404733980
46
+ version_requirements: *70176552934880
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70281404733120 !ruby/object:Gem::Requirement
49
+ requirement: &70176552933420 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.1.rc
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70281404733120
57
+ version_requirements: *70176552933420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70281404732360 !ruby/object:Gem::Requirement
60
+ requirement: &70176552931360 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70281404732360
68
+ version_requirements: *70176552931360
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70281404731500 !ruby/object:Gem::Requirement
71
+ requirement: &70176552913880 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70281404731500
79
+ version_requirements: *70176552913880
80
80
  description: sweet autoloading using file structure conventions while allowing configuration
81
81
  overrides for special cases
82
82
  email: kmandrup@gmail.com
@@ -140,7 +140,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  segments:
142
142
  - 0
143
- hash: 1025158195221417970
143
+ hash: -3706147507744026007
144
144
  required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements: