garnish 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ workfiles/
@@ -1,6 +1,13 @@
1
1
  rvm:
2
- # - 1.8.7 # (current default)
2
+ - 1.8.7
3
+ - ree
3
4
  - 1.9.2
4
5
  - 1.9.3
5
- # - rbx-2.0
6
- # - ree
6
+ - rbx
7
+ - rbx-18mode
8
+ - rbx-19mode
9
+ - jruby
10
+ - jruby-18mode
11
+ - jruby-19mode
12
+ - ruby-head
13
+ - 2.0.0
@@ -1,3 +1,22 @@
1
+ 0.0.7 (March 11, 2013)
2
+
3
+ * Fixed deprecation warnings.
4
+ * Fixed broken image.
5
+ * Removed gemnasium dependency.
6
+ * Added code climate.
7
+ * Tested on Ruby 2.0.0
8
+
9
+ 0.0.6.1 (March 4, 2012)
10
+
11
+ * Added support for jruby.
12
+ * Updated readme.
13
+ * Updated spec readme.
14
+ * Added dependency status via Gemnasium.
15
+
16
+ 0.0.6 (March 3, 2012)
17
+
18
+ * Added support for Ruby 1.8.7, REE & Rubinius
19
+
1
20
  0.0.5 (February 29, 2012)
2
21
 
3
22
  * Remove cruft from Guardfile so Guard works again. Fix broken tests from last
@@ -1,4 +1,6 @@
1
- = Garnish {<img src="http://travis-ci.org/brianp/garnish.png" />}[http://travis-ci.org/brianp/garnish]
1
+ http://www.brianpearce.ca/images/garnish.png
2
+
3
+ {<img src="https://secure.travis-ci.org/brianp/garnish.png" alt="Build Status" />}[http://travis-ci.org/brianp/garnish] {<img src="https://codeclimate.com/github/brianp/garnish.png" />}[https://codeclimate.com/github/brianp/garnish]
2
4
 
3
5
  RDocs[http://rdoc.info/projects/brianp/garnish]
4
6
 
@@ -15,7 +17,8 @@ Garnish is a Presenter / Decorator pattern for models in Rails. It gives a home
15
17
  Garnish Has been tested with
16
18
 
17
19
  * Rails 3
18
- * Ruby 1.9.2, 1.9.3
20
+ * Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, REE, JRuby, Rubinius
21
+ * ActiveRecord, Mongoid
19
22
 
20
23
  == Installation
21
24
 
@@ -23,11 +26,6 @@ In <b>Rails 3</b>, add this to your Gemfile and run the +bundle+ command.
23
26
 
24
27
  gem "garnish"
25
28
 
26
- Alternatively, you can install it as a plugin.
27
-
28
- rails plugin install git://github.com/brianp/garnish.git
29
-
30
-
31
29
  == Getting Started
32
30
 
33
31
  A lot of magic happens with Garnish in an attempt to make things incredibly simple for you.
@@ -2,39 +2,36 @@ module Garnish
2
2
  module Converter
3
3
  extend ActiveSupport::Concern
4
4
 
5
- module InstanceMethods
5
+ def module_exists?(class_name)
6
+ klass = Module.const_get(class_name)
7
+ return klass.is_a?(Module)
8
+ rescue NameError
9
+ return false
10
+ end
11
+
12
+ def convert(record, view = nil)
13
+ view ||= self.template
6
14
 
7
- def module_exists?(class_name)
8
- klass = Module.const_get(class_name)
9
- return klass.is_a?(Module)
10
- rescue NameError
11
- return false
15
+ if record.respond_to?(:each)
16
+ klass = record.first.class
17
+ else
18
+ klass = record.class
12
19
  end
13
20
 
14
- def convert(record, view = nil)
15
- view ||= self.template
21
+ presenter_name = "#{klass.to_s}Presenter"
16
22
 
23
+ if module_exists?(presenter_name.to_sym)
17
24
  if record.respond_to?(:each)
18
- klass = record.first.class
19
- else
20
- klass = record.class
21
- end
22
-
23
- presenter_name = "#{klass.to_s}Presenter"
24
-
25
- if module_exists?(presenter_name.to_sym)
26
- if record.respond_to?(:each)
27
- record.map do |v|
28
- v.extend(presenter_name.constantize)
29
- v.template = view
30
- end
31
- else
32
- record.extend(presenter_name.constantize)
33
- record.template = view
25
+ record.map do |v|
26
+ v.extend(presenter_name.constantize)
27
+ v.template = view
34
28
  end
29
+ else
30
+ record.extend(presenter_name.constantize)
31
+ record.template = view
35
32
  end
36
-
37
33
  end
34
+
38
35
  end
39
36
 
40
37
  end
@@ -12,13 +12,10 @@ module Garnish
12
12
  end
13
13
  end
14
14
 
15
- module InstanceMethods
15
+ protected
16
16
 
17
- protected
18
-
19
- def method_missing(method, *args, &block)
20
- self.template.send(method, *args, &block) unless @template.blank?
21
- end
17
+ def method_missing(method, *args, &block)
18
+ self.template.send(method, *args, &block) unless @template.blank?
22
19
  end
23
20
 
24
21
  end
@@ -3,13 +3,13 @@ module Garnish
3
3
  module Relationships
4
4
 
5
5
  def self.extended(base)
6
- base.extend Garnish::Converter::InstanceMethods
6
+ base.extend Garnish::Converter
7
7
  base.class_eval do
8
8
  relationships = Garnish::ModelAdapters::AbstractAdapter.adapter_class.defined_relationships(self)
9
9
 
10
10
  relationships.map do |key|
11
11
  alias_method "#{key}_orig".to_sym, key.to_sym
12
- define_method "#{key}" do |opts = nil, *rest|
12
+ define_method "#{key}" do |*rest|
13
13
  records = self.send("#{key}_orig")
14
14
  Garnish::Collection.new(records, template)
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Garnish
2
- VERSION = "0.0.5"
2
+ VERSION = '0.0.7'
3
3
  end
@@ -7,4 +7,4 @@ To run the specs first run the +bundle+ command to install the necessary gems an
7
7
  bundle
8
8
  rake
9
9
 
10
- The specs currently require Ruby 1.9.2+ support for 1.8.7 may come if required.
10
+ The specs currently run on Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, REE, JRuby and Rubinius.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: garnish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
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: 2012-03-01 00:00:00.000000000 Z
12
+ date: 2013-03-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70136304742880 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70136304742880
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &70136304742360 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '0'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70136304742360
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
36
46
  description: Provides an easy to use and transparent system for implementing the Decorator
37
47
  Pattern
38
48
  email:
@@ -90,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
100
  version: '0'
91
101
  requirements: []
92
102
  rubyforge_project: garnish
93
- rubygems_version: 1.8.10
103
+ rubygems_version: 1.8.23
94
104
  signing_key:
95
105
  specification_version: 3
96
106
  summary: Provides the decorator design pattern
@@ -103,3 +113,4 @@ test_files:
103
113
  - spec/garnish/presenter_spec.rb
104
114
  - spec/garnish/responder_spec.rb
105
115
  - spec/spec_helper.rb
116
+ has_rdoc: