inherited_resources_views 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -27,11 +27,19 @@ If you are confused about the difference to some other similarly named projects,
27
27
 
28
28
  * [Inherited Resources](http://github.com/josevalim/inherited_resources)
29
29
 
30
+ ## Limitations
31
+
32
+ When using Rails 2, the generator only generates `Erb` templates, whereas using Rails 3 it generates `Erb` or `Haml` templates accordingly.
33
+
30
34
  ## Installation
31
35
 
32
36
  As a Rails plugin:
33
37
 
38
+ # rails 3
34
39
  rails plugin install git://github.com/fredwu/inherited_resources_views.git
40
+
41
+ # rails 2
42
+ script/plugin install git://github.com/fredwu/inherited_resources_views.git
35
43
 
36
44
  As a gem:
37
45
 
@@ -41,7 +49,11 @@ As a gem:
41
49
 
42
50
  It is *extremely* simple to use Inherited Resources Views. The only step you need to do after the installation is to customise the default views:
43
51
 
52
+ # rails 3
44
53
  rails generate inherited_resources_views
54
+
55
+ # rails 2
56
+ script/generate inherited_resources_views
45
57
 
46
58
  This will generate a set of views in your `app/views/inherited_resources` folder. Edit away!
47
59
 
data/Rakefile CHANGED
@@ -26,7 +26,6 @@ begin
26
26
  require 'jeweler'
27
27
  Jeweler::Tasks.new do |s|
28
28
  s.name = "inherited_resources_views"
29
- s.version = "0.2.0"
30
29
  s.summary = "A lot of times resources share the same views, so why not DRY 'em up using Inherited Resources Views!"
31
30
  s.description = "Using Inherited Resources is an excellent way to reduce the amount of repetition in your controllers. But what about views? A lot of times resources share the same views, so why not DRY 'em up using Inherited Resources Views!"
32
31
  s.email = "ifredwu@gmail.com"
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{inherited_resources_views}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Fred Wu"]
12
- s.date = %q{2010-08-07}
12
+ s.date = %q{2010-08-11}
13
13
  s.description = %q{Using Inherited Resources is an excellent way to reduce the amount of repetition in your controllers. But what about views? A lot of times resources share the same views, so why not DRY 'em up using Inherited Resources Views!}
14
14
  s.email = %q{ifredwu@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -20,14 +20,17 @@ Gem::Specification.new do |s|
20
20
  "MIT-LICENSE",
21
21
  "README.md",
22
22
  "Rakefile",
23
- "app/views/inherited_resources/_form.html.erb",
24
- "app/views/inherited_resources/edit.html.erb",
25
- "app/views/inherited_resources/index.html.erb",
26
- "app/views/inherited_resources/new.html.erb",
27
- "app/views/inherited_resources/show.html.erb",
23
+ "VERSION",
28
24
  "inherited_resources_views.gemspec",
29
25
  "init.rb",
30
- "lib/generators/inherited_resources_views_generator.rb",
26
+ "lib/generators/inherited_resources_views/generators/current_generator.rb",
27
+ "lib/generators/inherited_resources_views/generators/legacy_generator.rb",
28
+ "lib/generators/inherited_resources_views/inherited_resources_views_generator.rb",
29
+ "lib/generators/inherited_resources_views/templates/app/views/inherited_resources/_form.html.erb",
30
+ "lib/generators/inherited_resources_views/templates/app/views/inherited_resources/edit.html.erb",
31
+ "lib/generators/inherited_resources_views/templates/app/views/inherited_resources/index.html.erb",
32
+ "lib/generators/inherited_resources_views/templates/app/views/inherited_resources/new.html.erb",
33
+ "lib/generators/inherited_resources_views/templates/app/views/inherited_resources/show.html.erb",
31
34
  "lib/inherited_resources_views.rb",
32
35
  "lib/inherited_resources_views/action_view.rb",
33
36
  "test/inherited_resources_views_test.rb",
@@ -5,7 +5,7 @@ class InheritedResourcesViewsGenerator < Rails::Generators::Base
5
5
  :desc => "Template engine for the views. Available options are 'erb' and 'haml'."
6
6
 
7
7
  def self.source_root
8
- @_views_source_root ||= File.expand_path("../../../app/views", __FILE__)
8
+ @_views_source_root ||= File.expand_path("../../templates/app/views", __FILE__)
9
9
  end
10
10
 
11
11
  def copy_views
@@ -0,0 +1,13 @@
1
+ class InheritedResourcesViewsGenerator < Rails::Generator::Base
2
+ def manifest
3
+ directory = "app/views/inherited_resources"
4
+ record do |m|
5
+ m.directory directory
6
+ m.file "#{directory}/_form.html.erb", "#{directory}/_form.html.erb"
7
+ m.file "#{directory}/edit.html.erb", "#{directory}/edit.html.erb"
8
+ m.file "#{directory}/index.html.erb", "#{directory}/index.html.erb"
9
+ m.file "#{directory}/new.html.erb", "#{directory}/new.html.erb"
10
+ m.file "#{directory}/show.html.erb", "#{directory}/show.html.erb"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,2 @@
1
+ generator = defined?(Rails::Generators::Base) ? "current" : "legacy"
2
+ require File.dirname(__FILE__) + "/generators/#{generator}_generator"
@@ -1,10 +1,3 @@
1
1
  require 'inherited_resources_views/action_view'
2
2
 
3
- class ActionController::Base
4
- def self.inherited(base)
5
- super
6
- if base.respond_to?(:inherit_resources)
7
- ActionView::Base.send :include, InheritedResourcesViews::ActionView
8
- end
9
- end
10
- end
3
+ defined?(ActionView) and ActionView::Base.send :include, InheritedResourcesViews::ActionView
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Fred Wu
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-07 00:00:00 +10:00
17
+ date: 2010-08-11 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -44,14 +44,17 @@ files:
44
44
  - MIT-LICENSE
45
45
  - README.md
46
46
  - Rakefile
47
- - app/views/inherited_resources/_form.html.erb
48
- - app/views/inherited_resources/edit.html.erb
49
- - app/views/inherited_resources/index.html.erb
50
- - app/views/inherited_resources/new.html.erb
51
- - app/views/inherited_resources/show.html.erb
47
+ - VERSION
52
48
  - inherited_resources_views.gemspec
53
49
  - init.rb
54
- - lib/generators/inherited_resources_views_generator.rb
50
+ - lib/generators/inherited_resources_views/generators/current_generator.rb
51
+ - lib/generators/inherited_resources_views/generators/legacy_generator.rb
52
+ - lib/generators/inherited_resources_views/inherited_resources_views_generator.rb
53
+ - lib/generators/inherited_resources_views/templates/app/views/inherited_resources/_form.html.erb
54
+ - lib/generators/inherited_resources_views/templates/app/views/inherited_resources/edit.html.erb
55
+ - lib/generators/inherited_resources_views/templates/app/views/inherited_resources/index.html.erb
56
+ - lib/generators/inherited_resources_views/templates/app/views/inherited_resources/new.html.erb
57
+ - lib/generators/inherited_resources_views/templates/app/views/inherited_resources/show.html.erb
55
58
  - lib/inherited_resources_views.rb
56
59
  - lib/inherited_resources_views/action_view.rb
57
60
  - test/inherited_resources_views_test.rb