merb-slices 1.1.0.pre → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/merb-slices.rb +26 -28
- data/lib/merb-slices/version.rb +2 -2
- metadata +33 -14
data/Rakefile
CHANGED
data/lib/merb-slices.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require "merb-core"
|
2
|
+
|
3
|
+
require "merb-slices/version"
|
4
|
+
require "merb-slices/module"
|
3
5
|
|
4
|
-
if defined?(Merb::Plugins)
|
5
|
-
|
6
6
|
Merb::Plugins.add_rakefiles "merb-slices/merbtasks"
|
7
|
-
|
7
|
+
|
8
8
|
Merb::Plugins.config[:merb_slices] ||= {}
|
9
|
-
|
9
|
+
|
10
10
|
require "merb-slices/module_mixin"
|
11
11
|
require "merb-slices/controller_mixin"
|
12
12
|
require "merb-slices/router_ext"
|
13
|
-
|
13
|
+
|
14
14
|
# Enable slice behaviour for any class inheriting from AbstractController.
|
15
15
|
# To use this call controller_for_slice in your controller class.
|
16
16
|
Merb::AbstractController.send(:include, Merb::Slices::ControllerMixin)
|
17
|
-
|
17
|
+
|
18
18
|
# Load Slice classes before the app's classes are loaded.
|
19
19
|
#
|
20
20
|
# This allows the application to override/merge any slice-level classes.
|
@@ -29,33 +29,33 @@ if defined?(Merb::Plugins)
|
|
29
29
|
Merb::Slices.register_slices_from_search_path! if auto_register?
|
30
30
|
Merb::Slices.each_slice { |slice| slice.load_slice }
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
# Load a single file and its requirements.
|
34
34
|
#
|
35
35
|
# @param file<String> The file to load.
|
36
36
|
def load_file(file)
|
37
37
|
Merb::BootLoader::LoadClasses.load_file file
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
# Remove a single file and the classes loaded by it from ObjectSpace.
|
41
41
|
#
|
42
42
|
# @param file<String> The file to load.
|
43
43
|
def remove_classes_in_file(file)
|
44
44
|
Merb::BootLoader::LoadClasses.remove_classes_in_file file
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
# Load classes from given paths - using path/glob pattern.
|
48
48
|
#
|
49
49
|
# @param *paths <Array> Array of paths to load classes from - may contain glob pattern
|
50
50
|
def load_classes(*paths)
|
51
51
|
Merb::BootLoader::LoadClasses.load_classes paths
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
# Reload the router - takes all_slices into account to load slices at runtime.
|
55
55
|
def reload_router!
|
56
56
|
Merb::BootLoader::Router.reload!
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
# Slice-level paths for all loaded slices.
|
60
60
|
#
|
61
61
|
# @return <Array[String]> Any slice-level paths that have been loaded.
|
@@ -64,7 +64,7 @@ if defined?(Merb::Plugins)
|
|
64
64
|
Merb::Slices.each_slice { |slice| paths += slice.collected_slice_paths }
|
65
65
|
paths
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
# App-level paths for all loaded slices.
|
69
69
|
#
|
70
70
|
# @return <Array[String]> Any app-level paths that have been loaded.
|
@@ -73,37 +73,37 @@ if defined?(Merb::Plugins)
|
|
73
73
|
Merb::Slices.each_slice { |slice| paths += slice.collected_app_paths }
|
74
74
|
paths
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
private
|
78
|
-
|
78
|
+
|
79
79
|
# Whether slices from search paths should be registered automatically.
|
80
80
|
# Defaults to true if not explicitly set.
|
81
81
|
def auto_register?
|
82
82
|
Merb::Plugins.config[:merb_slices][:auto_register] || !Merb::Plugins.config[:merb_slices].key?(:auto_register)
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
end
|
86
86
|
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
# Call initialization method for each registered Slice.
|
90
90
|
#
|
91
91
|
# This is done just before the app's after_load_callbacks are run.
|
92
92
|
# The application has been practically loaded completely, letting
|
93
93
|
# the callbacks work with what has been loaded.
|
94
94
|
class Merb::Slices::Initialize < Merb::BootLoader
|
95
|
-
|
95
|
+
|
96
96
|
before AfterAppLoads
|
97
|
-
|
97
|
+
|
98
98
|
def self.run
|
99
99
|
Merb::Slices.each_slice do |slice|
|
100
|
-
Merb.logger.verbose!("Initializing slice '#{slice}' ...")
|
100
|
+
Merb.logger.verbose!("Initializing slice '#{slice}' ...")
|
101
101
|
slice.init if slice.respond_to?(:init)
|
102
102
|
end
|
103
103
|
end
|
104
|
-
|
104
|
+
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
# Call activation method for each registered Slice.
|
108
108
|
#
|
109
109
|
# This is done right after the app's after_load_callbacks are run.
|
@@ -112,16 +112,14 @@ if defined?(Merb::Plugins)
|
|
112
112
|
# @note Activation will only take place if the slice has been routed;
|
113
113
|
# this means you need have at least one slice route setup.
|
114
114
|
class Merb::Slices::Activate < Merb::BootLoader
|
115
|
-
|
115
|
+
|
116
116
|
after AfterAppLoads
|
117
|
-
|
117
|
+
|
118
118
|
def self.run
|
119
119
|
Merb::Slices.each_slice do |slice|
|
120
120
|
Merb.logger.info!("Activating slice '#{slice}' ...")
|
121
121
|
slice.activate if slice.respond_to?(:activate) && slice.routed?
|
122
122
|
end
|
123
123
|
end
|
124
|
-
|
124
|
+
|
125
125
|
end
|
126
|
-
|
127
|
-
end
|
data/lib/merb-slices/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb-slices
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: true
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- rc1
|
10
|
+
version: 1.1.0.rc1
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Fabien Franzen
|
@@ -9,29 +15,38 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-03-14 00:00:00 +00:00
|
13
19
|
default_executable: slice
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: merb-core
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
25
|
requirements:
|
21
26
|
- - ~>
|
22
27
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
28
|
+
segments:
|
29
|
+
- 1
|
30
|
+
- 1
|
31
|
+
- 0
|
32
|
+
- rc1
|
33
|
+
version: 1.1.0.rc1
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: rspec
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
40
|
requirements:
|
31
41
|
- - ">="
|
32
42
|
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 2
|
46
|
+
- 9
|
33
47
|
version: 1.2.9
|
34
|
-
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
35
50
|
description: Merb plugin that supports reusable application 'slices'.
|
36
51
|
email: info@fabien.be
|
37
52
|
executables:
|
@@ -154,18 +169,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
169
|
requirements:
|
155
170
|
- - ">="
|
156
171
|
- !ruby/object:Gem::Version
|
172
|
+
segments:
|
173
|
+
- 0
|
157
174
|
version: "0"
|
158
|
-
version:
|
159
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
176
|
requirements:
|
161
177
|
- - ">"
|
162
178
|
- !ruby/object:Gem::Version
|
179
|
+
segments:
|
180
|
+
- 1
|
181
|
+
- 3
|
182
|
+
- 1
|
163
183
|
version: 1.3.1
|
164
|
-
version:
|
165
184
|
requirements: []
|
166
185
|
|
167
186
|
rubyforge_project:
|
168
|
-
rubygems_version: 1.3.
|
187
|
+
rubygems_version: 1.3.6
|
169
188
|
signing_key:
|
170
189
|
specification_version: 3
|
171
190
|
summary: Merb plugin for using and creating application 'slices' which help you modularize your application.
|