r3_plugin_toolbox 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/r3_plugin_toolbox/extender/util.rb +9 -8
- data/lib/r3_plugin_toolbox/macro.rb +8 -5
- data/r3_plugin_toolbox.gemspec +47 -49
- metadata +5 -6
- data/.gitignore +0 -21
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
@@ -2,9 +2,6 @@ module Rails3
|
|
2
2
|
class Plugin
|
3
3
|
class Extender
|
4
4
|
module Util
|
5
|
-
INIT = :initialize
|
6
|
-
ACTIVE_MODULES = {:AR => :active_record, :view => :action_view, :controller => :action_controller, :mailer => :action_mailer}
|
7
|
-
|
8
5
|
def get_base_class type
|
9
6
|
type = get_load_type(type).to_s
|
10
7
|
const = act_type?(type) ? rails_const_base(type) : "#{type.to_s.camelize}"
|
@@ -27,8 +24,8 @@ module Rails3
|
|
27
24
|
end
|
28
25
|
|
29
26
|
def get_load_type type
|
30
|
-
return
|
31
|
-
return type if
|
27
|
+
return active_modules[type] if active_modules[type]
|
28
|
+
return type if active_modules.values.include? type
|
32
29
|
return type if type == :i18n
|
33
30
|
logger.warn "WARNING: The Rails 3 load handler for the component #{type} is not part of the default load process."
|
34
31
|
end
|
@@ -45,17 +42,21 @@ module Rails3
|
|
45
42
|
end
|
46
43
|
|
47
44
|
protected
|
45
|
+
|
46
|
+
def active_modules
|
47
|
+
{:AR => :active_record, :view => :action_view, :controller => :action_controller, :mailer => :action_mailer}
|
48
|
+
end
|
48
49
|
|
49
50
|
def valid_before_hook? type
|
50
|
-
[
|
51
|
+
[:initialize, :configuration, :eager_load].include?(type)
|
51
52
|
end
|
52
53
|
|
53
54
|
def valid_after_hook? type
|
54
|
-
|
55
|
+
:initialize == type
|
55
56
|
end
|
56
57
|
|
57
58
|
def valid_load_hook? type
|
58
|
-
@valid_load_hooks ||= [
|
59
|
+
@valid_load_hooks ||= [active_modules.keys, active_modules.values, :i18n].flatten
|
59
60
|
@valid_load_hooks.include?(type)
|
60
61
|
end
|
61
62
|
end
|
@@ -12,8 +12,6 @@ module Rails3
|
|
12
12
|
include Rails3::Plugin::Extender::Util
|
13
13
|
end
|
14
14
|
|
15
|
-
MACRO = Rails3::Plugin::Extender::Macro
|
16
|
-
|
17
15
|
def with_engine name, &block
|
18
16
|
Rails3::Engine.new name do |e|
|
19
17
|
yield e
|
@@ -33,7 +31,7 @@ module Rails3
|
|
33
31
|
end
|
34
32
|
|
35
33
|
def after_init component, &block
|
36
|
-
type =
|
34
|
+
type = macro.get_load_type component
|
37
35
|
Rails3::Plugin::Extender.new do
|
38
36
|
extend_rails type do
|
39
37
|
after :initialize do
|
@@ -47,10 +45,15 @@ module Rails3
|
|
47
45
|
app = "#{app_name.to_s.camelize}::Application".constantize
|
48
46
|
app.initialize!
|
49
47
|
railties.each do |railtie|
|
50
|
-
|
48
|
+
macro.get_base_class(railtie).constantize
|
51
49
|
end
|
52
50
|
end
|
53
|
-
|
51
|
+
|
52
|
+
protected
|
53
|
+
|
54
|
+
def macro
|
55
|
+
Rails3::Plugin::Extender::Macro
|
56
|
+
end
|
54
57
|
end
|
55
58
|
end
|
56
59
|
end
|
data/r3_plugin_toolbox.gemspec
CHANGED
@@ -1,75 +1,73 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{r3_plugin_toolbox}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-18}
|
13
13
|
s.description = %q{Provides a more intuitive DSL for Rails 3 plugin configuration and a specialized RSpec 2 matcher. Makes it much easier to develop Rails 3 plugins!}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.markdown"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
"wiki/how_to_guide.markdown"
|
21
|
+
".rspec",
|
22
|
+
"LICENSE",
|
23
|
+
"README.markdown",
|
24
|
+
"Rakefile",
|
25
|
+
"VERSION",
|
26
|
+
"config/database.yml",
|
27
|
+
"lib/r3_plugin_toolbox.rb",
|
28
|
+
"lib/r3_plugin_toolbox/engine.rb",
|
29
|
+
"lib/r3_plugin_toolbox/extender.rb",
|
30
|
+
"lib/r3_plugin_toolbox/extender/load_handler.rb",
|
31
|
+
"lib/r3_plugin_toolbox/extender/util.rb",
|
32
|
+
"lib/r3_plugin_toolbox/macro.rb",
|
33
|
+
"lib/r3_plugin_toolbox/main.rb",
|
34
|
+
"lib/r3_plugin_toolbox/railtie.rb",
|
35
|
+
"lib/r3_plugin_toolbox/rspec/config.rb",
|
36
|
+
"lib/r3_plugin_toolbox/rspec/matchers/be_extended_with.rb",
|
37
|
+
"lib/r3_plugin_toolbox/shortcuts.rb",
|
38
|
+
"log/development.log",
|
39
|
+
"r3_plugin_toolbox.gemspec",
|
40
|
+
"spec/fixtures/extension_modules.rb",
|
41
|
+
"spec/r3_plugin_toolbox/engine_macro_spec.rb",
|
42
|
+
"spec/r3_plugin_toolbox/engine_spec.rb",
|
43
|
+
"spec/r3_plugin_toolbox/extender/extend_view_content_spec.rb",
|
44
|
+
"spec/r3_plugin_toolbox/extender/extender_action_spec.rb",
|
45
|
+
"spec/r3_plugin_toolbox/extender/extender_i18n_spec.rb",
|
46
|
+
"spec/r3_plugin_toolbox/extender/extender_macro_view_spec.rb",
|
47
|
+
"spec/r3_plugin_toolbox/extender_spec.rb",
|
48
|
+
"spec/r3_plugin_toolbox/railtie_spec.rb",
|
49
|
+
"spec/r3_plugin_toolbox/shortcuts_spec.rb",
|
50
|
+
"spec/spec_helper.rb",
|
51
|
+
"wiki/add_rake_tasks.markdown",
|
52
|
+
"wiki/engine.markdown",
|
53
|
+
"wiki/how_to_guide.markdown"
|
55
54
|
]
|
56
55
|
s.homepage = %q{http://github.com/kristianmandrup/rails3_plugin_toolbox}
|
57
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
58
56
|
s.require_paths = ["lib"]
|
59
57
|
s.rubygems_version = %q{1.3.7}
|
60
58
|
s.summary = %q{Toolbox to facilitate Rails 3 plugin development}
|
61
59
|
s.test_files = [
|
62
60
|
"spec/fixtures/extension_modules.rb",
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
61
|
+
"spec/r3_plugin_toolbox/engine_macro_spec.rb",
|
62
|
+
"spec/r3_plugin_toolbox/engine_spec.rb",
|
63
|
+
"spec/r3_plugin_toolbox/extender/extend_view_content_spec.rb",
|
64
|
+
"spec/r3_plugin_toolbox/extender/extender_action_spec.rb",
|
65
|
+
"spec/r3_plugin_toolbox/extender/extender_i18n_spec.rb",
|
66
|
+
"spec/r3_plugin_toolbox/extender/extender_macro_view_spec.rb",
|
67
|
+
"spec/r3_plugin_toolbox/extender_spec.rb",
|
68
|
+
"spec/r3_plugin_toolbox/railtie_spec.rb",
|
69
|
+
"spec/r3_plugin_toolbox/shortcuts_spec.rb",
|
70
|
+
"spec/spec_helper.rb"
|
73
71
|
]
|
74
72
|
|
75
73
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 1
|
9
|
+
version: 0.4.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-18 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -87,7 +87,6 @@ extra_rdoc_files:
|
|
87
87
|
- README.markdown
|
88
88
|
files:
|
89
89
|
- .document
|
90
|
-
- .gitignore
|
91
90
|
- .rspec
|
92
91
|
- LICENSE
|
93
92
|
- README.markdown
|
@@ -126,8 +125,8 @@ homepage: http://github.com/kristianmandrup/rails3_plugin_toolbox
|
|
126
125
|
licenses: []
|
127
126
|
|
128
127
|
post_install_message:
|
129
|
-
rdoc_options:
|
130
|
-
|
128
|
+
rdoc_options: []
|
129
|
+
|
131
130
|
require_paths:
|
132
131
|
- lib
|
133
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|