generator_extensions 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/generator_extensions.gemspec +2 -2
- data/lib/generator_extensions.rb +6 -7
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{generator_extensions}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
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{
|
12
|
+
s.date = %q{2010-01-05}
|
13
13
|
s.description = %q{Generators can be a bit of a pain to write. This little gem smooths out
|
14
14
|
some rough edges, by letting you mirror an entire directory in one line,
|
15
15
|
and providing convenience functions to add entire blocks of code
|
data/lib/generator_extensions.rb
CHANGED
@@ -11,13 +11,12 @@ module RailsGeneratorExtensions
|
|
11
11
|
relative_destination ||= relative_source
|
12
12
|
path_to_delete = "#{source_root}/"
|
13
13
|
|
14
|
-
Find.find(source) do |
|
15
|
-
source =
|
14
|
+
Find.find(source) do |name|
|
15
|
+
source = name.sub(path_to_delete, '')
|
16
16
|
target = File.join(relative_destination, source.sub(relative_source, ''))
|
17
|
-
|
18
|
-
when File.file?(f)
|
17
|
+
if File.file?(name)
|
19
18
|
file source, target
|
20
|
-
|
19
|
+
elsif File.directory?(name)
|
21
20
|
directory target unless self.class.to_s.include? "Destroy"
|
22
21
|
end
|
23
22
|
end
|
@@ -47,8 +46,8 @@ module Rails
|
|
47
46
|
|
48
47
|
def add_to_file(file, sentinel, text)
|
49
48
|
first_line = text.split("\n")[0]
|
50
|
-
|
51
|
-
logger.send(
|
49
|
+
matched = /:in `([^']+)'$/.match(caller.first)
|
50
|
+
logger.send(matched[1].to_sym, first_line) if matched
|
52
51
|
unless options[:pretend]
|
53
52
|
gsub_file file, /(#{Regexp.escape(sentinel)})/mi do |match|
|
54
53
|
"#{match}\n#{text}\n"
|
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.3.
|
4
|
+
version: 0.3.2
|
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:
|
12
|
+
date: 2010-01-05 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|