generator_extensions 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +26 -0
- data/Rakefile +16 -0
- data/VERSION +1 -0
- data/generator_extensions.gemspec +41 -0
- data/lib/generator_extensions.rb +28 -0
- metadata +59 -0
data/README.rdoc
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
= Generator Extensions
|
2
|
+
|
3
|
+
Rails gem that adds some useful commands to Generators
|
4
|
+
|
5
|
+
== Install
|
6
|
+
|
7
|
+
gem install generator_extensions --source http://gemcutter.org
|
8
|
+
|
9
|
+
== Usage
|
10
|
+
|
11
|
+
I was bothered by the lack of a recursive directory copy in the
|
12
|
+
Generator commands. As it stands, you can copy individual files like
|
13
|
+
so:
|
14
|
+
|
15
|
+
m.file 'layout.html.erb', 'app/views/layouts/application.html.erb'
|
16
|
+
|
17
|
+
You can create a directory like this:
|
18
|
+
|
19
|
+
m.directory 'public/stylesheets/blueprint'
|
20
|
+
|
21
|
+
But you can't copy an entire directory tree over like this:
|
22
|
+
|
23
|
+
m.directory_copy 'blueprint', 'public/stylesheets/blueprint'
|
24
|
+
|
25
|
+
Well, with this little gem you can.
|
26
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gemspec|
|
7
|
+
gemspec.name = "generator_extensions"
|
8
|
+
gemspec.summary = 'Functions that make it easier to write a Rails generator.'
|
9
|
+
gemspec.description = 'Functions that make it easier to write a Rails generator.'
|
10
|
+
gemspec.email = 'heymarcel@gmail.com'
|
11
|
+
gemspec.homepage = 'http://github.com/heymarcel/generator_extensions'
|
12
|
+
gemspec.authors = ['Marcel Levy']
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
16
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{generator_extensions}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Marcel Levy"]
|
12
|
+
s.date = %q{2009-12-12}
|
13
|
+
s.description = %q{Functions that make it easier to write a Rails generator.}
|
14
|
+
s.email = %q{heymarcel@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
21
|
+
"VERSION",
|
22
|
+
"generator_extensions.gemspec",
|
23
|
+
"lib/generator_extensions.rb"
|
24
|
+
]
|
25
|
+
s.homepage = %q{http://github.com/heymarcel/generator_extensions}
|
26
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
s.rubygems_version = %q{1.3.5}
|
29
|
+
s.summary = %q{Functions that make it easier to write a Rails generator.}
|
30
|
+
|
31
|
+
if s.respond_to? :specification_version then
|
32
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
33
|
+
s.specification_version = 3
|
34
|
+
|
35
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
36
|
+
else
|
37
|
+
end
|
38
|
+
else
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'find'
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module Generator
|
5
|
+
module Commands
|
6
|
+
|
7
|
+
class Create < Base
|
8
|
+
|
9
|
+
def directory_copy(relative_source, relative_destination=nil)
|
10
|
+
source = source_path(relative_source)
|
11
|
+
relative_destination ||= relative_source
|
12
|
+
path_to_delete = "#{source_root}/"
|
13
|
+
|
14
|
+
Find.find(source) do |f|
|
15
|
+
source = f.sub(path_to_delete, '')
|
16
|
+
target = File.join(relative_destination, source.sub(relative_source, ''))
|
17
|
+
case
|
18
|
+
when File.file?(f)
|
19
|
+
file source, target
|
20
|
+
when File.directory?(f)
|
21
|
+
directory target
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: generator_extensions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Marcel Levy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-12 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Functions that make it easier to write a Rails generator.
|
17
|
+
email: heymarcel@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
files:
|
25
|
+
- README.rdoc
|
26
|
+
- Rakefile
|
27
|
+
- VERSION
|
28
|
+
- generator_extensions.gemspec
|
29
|
+
- lib/generator_extensions.rb
|
30
|
+
has_rdoc: true
|
31
|
+
homepage: http://github.com/heymarcel/generator_extensions
|
32
|
+
licenses: []
|
33
|
+
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options:
|
36
|
+
- --charset=UTF-8
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
requirements: []
|
52
|
+
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 1.3.5
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: Functions that make it easier to write a Rails generator.
|
58
|
+
test_files: []
|
59
|
+
|