draper 1.0.0.beta2 → 1.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,5 +1,10 @@
1
1
  # Draper Changelog
2
2
 
3
+ ## 1.0.0.beta3
4
+
5
+ * Relaxed Rails version requirement to 3.0. Support for < 3.2 should be
6
+ considered experimental. Please file bug reports.
7
+
3
8
  ## 1.0.0.beta2
4
9
 
5
10
  * `has_finders` is now `decorates_finders`. [https://github.com/haines/draper/commit/33f18aa062e0d3848443dbd81047f20d5665579f](https://github.com/haines/draper/commit/33f18aa062e0d3848443dbd81047f20d5665579f)
data/draper.gemspec CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |s|
16
16
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  s.require_paths = ["lib"]
18
18
 
19
- s.add_dependency 'activesupport', '>= 3.2'
20
- s.add_dependency 'actionpack', '>= 3.2'
19
+ s.add_dependency 'activesupport', '>= 3.0'
20
+ s.add_dependency 'actionpack', '>= 3.0'
21
21
 
22
22
  s.add_development_dependency 'ammeter'
23
23
  s.add_development_dependency 'rake', '~> 0.9.2'
@@ -3,6 +3,8 @@ require 'rails/railtie'
3
3
  module ActiveModel
4
4
  class Railtie < Rails::Railtie
5
5
  generators do |app|
6
+ app ||= Rails.application # Rails 3.0.x does not yield `app`
7
+
6
8
  Rails::Generators.configure! app.config.generators
7
9
  require 'generators/resource_override'
8
10
  end
@@ -1,8 +1,17 @@
1
1
  require "rake/testtask"
2
- require "rails/test_unit/sub_test_task"
2
+
3
+ klass = nil
4
+
5
+ if Rails.version[0,3] == "3.0"
6
+ require 'rails/test_unit/railtie'
7
+ klass = Rake::TestTask
8
+ else
9
+ require "rails/test_unit/sub_test_task"
10
+ klass = Rails::SubTestTask
11
+ end
3
12
 
4
13
  namespace :test do
5
- Rails::SubTestTask.new(:decorators => "test:prepare") do |t|
14
+ klass.new(:decorators => "test:prepare") do |t|
6
15
  t.libs << "test"
7
16
  t.pattern = "test/decorators/**/*_test.rb"
8
17
  end
@@ -1,3 +1,3 @@
1
1
  module Draper
2
- VERSION = "1.0.0.beta2"
2
+ VERSION = "1.0.0.beta3"
3
3
  end
@@ -23,6 +23,14 @@ module Rails
23
23
  "Draper::Decorator"
24
24
  end
25
25
  end
26
- end
26
+
27
+
28
+ # Rails 3.0.X compatibility, stolen from https://github.com/jnunemaker/mongomapper/pull/385/files#L1R32
29
+ unless methods.include?(:module_namespacing)
30
+ def module_namespacing(&block)
31
+ yield if block
32
+ end
33
+ end
34
+ end
27
35
  end
28
36
  end
@@ -1,5 +1,9 @@
1
- <% module_namespacing do -%>
1
+ <%- module_namespacing do -%>
2
+ <%- if parent_class_name.present? -%>
2
3
  class <%= class_name %>Decorator < <%= parent_class_name %>
4
+ <%- else -%>
5
+ class <%= class_name %>
6
+ <%- end -%>
3
7
 
4
8
  # Accessing Helpers
5
9
  # You can access any helper via a proxy
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: draper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta2
4
+ version: 1.0.0.beta3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ! '>='
21
21
  - !ruby/object:Gem::Version
22
- version: '3.2'
22
+ version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ! '>='
29
29
  - !ruby/object:Gem::Version
30
- version: '3.2'
30
+ version: '3.0'
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: actionpack
33
33
  requirement: !ruby/object:Gem::Requirement
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ! '>='
37
37
  - !ruby/object:Gem::Version
38
- version: '3.2'
38
+ version: '3.0'
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
- version: '3.2'
46
+ version: '3.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: ammeter
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -276,7 +276,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
276
276
  version: '0'
277
277
  segments:
278
278
  - 0
279
- hash: 3275361325961868093
279
+ hash: -1515210213471723462
280
280
  required_rubygems_version: !ruby/object:Gem::Requirement
281
281
  none: false
282
282
  requirements: