acts_as_rails3_generator 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ 0.0.1
2
+
3
+ Initial version. Just the things I needed for testbot.
4
+
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source "http://rubygems.org"
2
+ gemspec
data/LICENCE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Joakim Kolsjö
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ This is a wrapper that enables you to write your generator using the Rails 3 syntax but still support Rails 2.
2
+
3
+ Just add it as a gem dependency and require "acts_as_rails3_generator".
@@ -0,0 +1,14 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "acts_as_rails3_generator"
6
+ s.version = "0.0.1"
7
+ s.authors = ["Joakim Kolsjö"]
8
+ s.email = ["joakim.kolsjo@gmail.com"]
9
+ s.homepage = "http://github.com/joakimk/acts_as_rails3_generator"
10
+ s.summary = %q{Write Rails 2 generators with Rails 3 generator syntax.}
11
+ s.description = %q{This is a wrapper that enables you to write your generator using the Rails 3 syntax but still support Rails 2.}
12
+ s.files = Dir.glob("lib/*") + %w(Gemfile acts_as_rails3_generator.gemspec CHANGELOG README.markdown LICENCE)
13
+ end
14
+
@@ -0,0 +1,57 @@
1
+ module ActsAsRails3Generator
2
+
3
+ @@class_options = {}
4
+
5
+ def self.included(base)
6
+ base.send :cattr_accessor, :class_options
7
+ base.send :extend, ClassMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ def class_option(name, opts)
12
+ class_options[name] = opts
13
+ end
14
+
15
+ def source_root(path)
16
+ end
17
+
18
+ def acts_as_rails3_generator
19
+ send :include, InstanceMethods
20
+ end
21
+ end
22
+
23
+ module InstanceMethods
24
+ def add_options!(opt)
25
+ class_options.each { |key, opts|
26
+ opt.on("--#{key} VALUE", opts[:desc]) { |v| options[key] = v }
27
+ }
28
+ end
29
+
30
+ def template(template, target)
31
+ @templates ||= []
32
+ @templates << [ template, target ]
33
+ end
34
+
35
+ def manifest
36
+ # TODO: Lookup of methods defined in the generator and calling them
37
+ generate_config
38
+
39
+ record do |m|
40
+ @templates.each { |template, target| m.template(template, target) }
41
+ end
42
+ end
43
+
44
+ end
45
+ end
46
+
47
+ unless defined?(Rails::Generators::Base)
48
+ Rails::Generator::Base.send :include, ActsAsRails3Generator
49
+ module Rails
50
+ module Generators
51
+ class Base < Rails::Generator::Base
52
+ acts_as_rails3_generator
53
+ end
54
+ end
55
+ end
56
+ end
57
+
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_rails3_generator
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - "Joakim Kolsj\xC3\xB6"
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-11-28 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: This is a wrapper that enables you to write your generator using the Rails 3 syntax but still support Rails 2.
23
+ email:
24
+ - joakim.kolsjo@gmail.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - lib/acts_as_rails3_generator.rb
33
+ - Gemfile
34
+ - acts_as_rails3_generator.gemspec
35
+ - CHANGELOG
36
+ - README.markdown
37
+ - LICENCE
38
+ has_rdoc: true
39
+ homepage: http://github.com/joakimk/acts_as_rails3_generator
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options: []
44
+
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ hash: 3
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ hash: 3
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.3.7
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: Write Rails 2 generators with Rails 3 generator syntax.
72
+ test_files: []
73
+