generator_extensions 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.rdoc +27 -3
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/generator_extensions.gemspec +4 -3
- data/lib/generator_extensions.rb +5 -1
- metadata +3 -2
data/.gitignore
ADDED
data/README.rdoc
CHANGED
@@ -12,15 +12,39 @@ I was bothered by the lack of a recursive directory copy in the
|
|
12
12
|
Generator commands. As it stands, you can copy individual files like
|
13
13
|
so:
|
14
14
|
|
15
|
-
|
15
|
+
m.file 'layout.html.erb', 'app/views/layouts/application.html.erb'
|
16
16
|
|
17
17
|
You can create a directory like this:
|
18
18
|
|
19
|
-
|
19
|
+
m.directory 'public/stylesheets/blueprint'
|
20
20
|
|
21
21
|
But you can't copy an entire directory tree over like this:
|
22
22
|
|
23
23
|
m.directory_copy 'blueprint', 'public/stylesheets/blueprint'
|
24
24
|
|
25
|
-
Well, with this little gem you can.
|
25
|
+
Well, with this little gem you can. But wait, there's more! One fairly
|
26
|
+
common pattern is a straight copy of files without any fancy template
|
27
|
+
work. This gem makes it a cinch. Just create a directory inside your
|
28
|
+
template directory containing a partially duplicated Rails directory
|
29
|
+
structure (obviously, only include the directories you need):
|
30
|
+
|
31
|
+
your_generator.rb
|
32
|
+
templates
|
33
|
+
-mirror
|
34
|
+
-public
|
35
|
+
-stylesheets
|
36
|
+
your_stylesheet.css
|
37
|
+
-app
|
38
|
+
-controllers
|
39
|
+
your_controller.rb
|
40
|
+
|
41
|
+
Then put this in your manifest definition:
|
42
|
+
|
43
|
+
m.mirror 'name-of-directory-to-mirror'
|
44
|
+
|
45
|
+
As an added bonus, if you name your directory 'mirror', you can just
|
46
|
+
do this:
|
47
|
+
|
48
|
+
m.mirror
|
49
|
+
|
26
50
|
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -5,18 +5,19 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{generator_extensions}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcel Levy"]
|
12
|
-
s.date = %q{2009-12-
|
12
|
+
s.date = %q{2009-12-14}
|
13
13
|
s.description = %q{Functions that make it easier to write a Rails generator.}
|
14
14
|
s.email = %q{heymarcel@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
"
|
19
|
+
".gitignore",
|
20
|
+
"README.rdoc",
|
20
21
|
"Rakefile",
|
21
22
|
"VERSION",
|
22
23
|
"generator_extensions.gemspec",
|
data/lib/generator_extensions.rb
CHANGED
@@ -3,9 +3,12 @@ require 'find'
|
|
3
3
|
module Rails
|
4
4
|
module Generator
|
5
5
|
module Commands
|
6
|
-
|
7
6
|
class Create < Base
|
8
7
|
|
8
|
+
def mirror(origin='mirror')
|
9
|
+
directory_copy(origin, '')
|
10
|
+
end
|
11
|
+
|
9
12
|
def directory_copy(relative_source, relative_destination=nil)
|
10
13
|
source = source_path(relative_source)
|
11
14
|
relative_destination ||= relative_source
|
@@ -22,6 +25,7 @@ module Rails
|
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
28
|
+
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: generator_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcel Levy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-14 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -22,6 +22,7 @@ extensions: []
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README.rdoc
|
24
24
|
files:
|
25
|
+
- .gitignore
|
25
26
|
- README.rdoc
|
26
27
|
- Rakefile
|
27
28
|
- VERSION
|