r3_plugin_toolbox 0.3.13 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -15,6 +15,10 @@ _INFO_: [Rails 3 plugin architecture](https://gist.github.com/af7e572c2dc973add2
15
15
 
16
16
  <code>gem install r3_plugin_toolbox</code>
17
17
 
18
+ ## Compatibility
19
+
20
+ This gem has only been tested with Rails 3 and Ruby 1.9.
21
+
18
22
  ## Usage
19
23
 
20
24
  <pre>
data/Rakefile CHANGED
@@ -10,7 +10,8 @@ begin
10
10
 
11
11
  gem.add_development_dependency "rspec", "~> 2.0.0.beta.22"
12
12
  gem.add_dependency "rails", "~> 3.0.0"
13
- gem.add_dependency "require_all", "~> 1.2.0"
13
+ gem.add_dependency "require_all", "~> 1.2.0"
14
+ gem.add_dependency "sugar-high", "~> 0.2.11"
14
15
 
15
16
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
17
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.13
1
+ 0.3.14
@@ -4,6 +4,7 @@ end
4
4
  require 'require_all'
5
5
  require 'active_support/inflector'
6
6
  require 'r3_plugin_toolbox/main'
7
+ require 'sugar-high/arguments'
7
8
 
8
9
 
9
10
  require_all File.dirname(__FILE__) + '/r3_plugin_toolbox'
@@ -25,15 +25,17 @@ module Rails3
25
25
  end
26
26
 
27
27
  # convenience method to extend with multiple modules all within the same base module
28
- def extend_from_module base_name, *module_names, options
29
- raise ArgumentError, "You must specify an options Hash as the last argument for #extend_from_module" if !options.kind_of? Hash
28
+ def extend_from_module base_name, *module_names
29
+ options = last_option(module_names)
30
+ raise ArgumentError, "You must specify an options Hash as the last argument for #extend_from_module" if !options || !options.kind_of?(Hash)
30
31
  module_names.each do |name|
31
32
  extend_with get_constant(base_name, name), options
32
33
  end
33
34
  end
34
35
 
35
- def extend_with *module_names, options
36
- raise ArgumentError, "You must specify an options Hash as the last argument for #extend_with" if !options.kind_of? Hash
36
+ def extend_with *module_names
37
+ options = last_option(module_names)
38
+ raise ArgumentError, "You must specify an options Hash as the last argument for #extend_with" if !options || !options.kind_of?(Hash)
37
39
  type = options[:in]
38
40
  raise ArgumentError, "You must specify an :in option to indicate which Rails 3 component base class to extend with #{module_names}" if !type
39
41
  module_names.each do |name|
@@ -1,5 +1,11 @@
1
1
  module Rails3
2
- class Plugin
2
+ def self.with_configuration &block
3
+ if block
4
+ block.arity < 1 ? Rails.configuration.instance_eval(&block) : block.call(Rails.configuration)
5
+ end
6
+ end
7
+
8
+ class Plugin
3
9
  class Extender
4
10
  module Macro
5
11
  class << self
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{r3_plugin_toolbox}
8
- s.version = "0.3.13"
8
+ s.version = "0.3.14"
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{2010-09-26}
12
+ s.date = %q{2010-10-03}
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 = [
@@ -80,15 +80,18 @@ Gem::Specification.new do |s|
80
80
  s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
81
81
  s.add_runtime_dependency(%q<rails>, ["~> 3.0.0"])
82
82
  s.add_runtime_dependency(%q<require_all>, ["~> 1.2.0"])
83
+ s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.11"])
83
84
  else
84
85
  s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
85
86
  s.add_dependency(%q<rails>, ["~> 3.0.0"])
86
87
  s.add_dependency(%q<require_all>, ["~> 1.2.0"])
88
+ s.add_dependency(%q<sugar-high>, ["~> 0.2.11"])
87
89
  end
88
90
  else
89
91
  s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.22"])
90
92
  s.add_dependency(%q<rails>, ["~> 3.0.0"])
91
93
  s.add_dependency(%q<require_all>, ["~> 1.2.0"])
94
+ s.add_dependency(%q<sugar-high>, ["~> 0.2.11"])
92
95
  end
93
96
  end
94
97
 
@@ -64,7 +64,11 @@ describe Rails3::Plugin::Extender do
64
64
  end
65
65
 
66
66
  it "should extend Action View" do
67
- after_init :view do
67
+ after_init :view do
68
+ Rails3.with_configuration do
69
+ greeting = 'hello'
70
+ end
71
+
68
72
  puts "View initialized!"
69
73
 
70
74
  :view.should be_extended_with Helper::View, :panel, :window, :button, :form
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 13
9
- version: 0.3.13
8
+ - 14
9
+ version: 0.3.14
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: 2010-09-26 00:00:00 +02:00
17
+ date: 2010-10-03 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -64,6 +64,21 @@ dependencies:
64
64
  version: 1.2.0
65
65
  type: :runtime
66
66
  version_requirements: *id003
67
+ - !ruby/object:Gem::Dependency
68
+ name: sugar-high
69
+ prerelease: false
70
+ requirement: &id004 !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ - 2
78
+ - 11
79
+ version: 0.2.11
80
+ type: :runtime
81
+ version_requirements: *id004
67
82
  description: 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!
68
83
  email: kmandrup@gmail.com
69
84
  executables: []