mygen 0.3.13 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mygen/generator.rb +9 -2
- data/lib/mygen/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2c78bcafb1f9211495701f07c571eaa276e708da
|
|
4
|
+
data.tar.gz: e4dbc04ab967348f5aa6bf7500481099729131dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: baf1b50c0d389f2e8ce4908a7a83518966a85c3a2a28b633f76dce5fd3698b027cda85b21e623b6883b1afd44c81c7e768a1f290cf49de22f7de814644b15d19
|
|
7
|
+
data.tar.gz: dc822ef8141a4b8cd6c4295c950112a09c5f42b037e3968c128f093b241796845c1888722b9adc7b36b317a0a1dc041f13ebdd656def91a5db90f9fb6e0d6492
|
data/lib/mygen/generator.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'mygen/naming'
|
|
2
|
+
|
|
2
3
|
module Mygen
|
|
3
4
|
class Generator
|
|
4
5
|
include Mygen::Naming
|
|
@@ -59,10 +60,10 @@ module Mygen
|
|
|
59
60
|
template_dirs(File.join(dest_dir)).each do |dir|
|
|
60
61
|
dest = file_destination(dir, bindings)
|
|
61
62
|
parent_dir = File.expand_path("..", dest)
|
|
62
|
-
fileutils.mkdir_p(parent_dir)
|
|
63
|
+
fileutils.mkdir_p(parent_dir) if parent_dirs_dont_exist?(dest)
|
|
63
64
|
move_file_in_place(dir, dest)
|
|
64
65
|
end
|
|
65
|
-
#
|
|
66
|
+
# Filter files with erb
|
|
66
67
|
template_files(File.join(dest_dir)).each do |file|
|
|
67
68
|
dest = file_destination(file, bindings)
|
|
68
69
|
# This is where you parse the erb files and fill in the contens
|
|
@@ -73,6 +74,12 @@ module Mygen
|
|
|
73
74
|
end
|
|
74
75
|
end
|
|
75
76
|
|
|
77
|
+
def parent_dirs_dont_exist?(path)
|
|
78
|
+
parent_dir = File.expand_path("..", path)
|
|
79
|
+
return false if path.include?('__')
|
|
80
|
+
return !File.exist?(path)
|
|
81
|
+
end
|
|
82
|
+
|
|
76
83
|
def parse(file, bindings)
|
|
77
84
|
erb = ERB.new(File.read(file))
|
|
78
85
|
result = erb.result bindings
|
data/lib/mygen/version.rb
CHANGED