automatthew-genitor 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/genitor.gemspec +3 -3
- data/lib/genitor.rb +17 -9
- data/lib/genitor/polite_file.rb +2 -0
- data/test/test_genitor.rb +1 -0
- metadata +1 -1
data/genitor.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Genitor-0.6.
|
2
|
+
# Gem::Specification for Genitor-0.6.2
|
3
3
|
# Originally generated by Echoe
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = %q{genitor}
|
7
|
-
s.version = "0.6.
|
7
|
+
s.version = "0.6.2"
|
8
8
|
|
9
9
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
10
10
|
|
@@ -33,7 +33,7 @@ end
|
|
33
33
|
# require dep
|
34
34
|
# end
|
35
35
|
#
|
36
|
-
# Version = '0.6.
|
36
|
+
# Version = '0.6.2'
|
37
37
|
#
|
38
38
|
# task :default => [:test]
|
39
39
|
#
|
data/lib/genitor.rb
CHANGED
@@ -3,12 +3,15 @@ require 'rake'
|
|
3
3
|
require 'rake/tasklib'
|
4
4
|
require 'genitor/polite_file'
|
5
5
|
require 'erubis'
|
6
|
+
require "highline/import"
|
6
7
|
|
7
8
|
class Genitor < Rake::TaskLib
|
8
9
|
|
9
10
|
# Name of the primary Rake task
|
10
11
|
attr_accessor :name
|
11
12
|
|
13
|
+
attr_accessor :description
|
14
|
+
|
12
15
|
# Directory to use as source
|
13
16
|
attr_writer :source
|
14
17
|
|
@@ -20,6 +23,8 @@ class Genitor < Rake::TaskLib
|
|
20
23
|
|
21
24
|
# List of files to be copied
|
22
25
|
attr_accessor :copy_files
|
26
|
+
attr_accessor :all_files
|
27
|
+
attr_accessor :files
|
23
28
|
|
24
29
|
# List of files to be processed (using, e.g. Erubis)
|
25
30
|
attr_accessor :template_files
|
@@ -63,6 +68,8 @@ class Genitor < Rake::TaskLib
|
|
63
68
|
end
|
64
69
|
@copy_files = @files - @directories - @template_files
|
65
70
|
|
71
|
+
@all_files = @files - @template_files + @template_files.map { |f| f.chomp(File.extname(f)) }
|
72
|
+
|
66
73
|
@target_executables = @executables.map { |f| target(f) }
|
67
74
|
|
68
75
|
define
|
@@ -86,23 +93,24 @@ class Genitor < Rake::TaskLib
|
|
86
93
|
# Define the necessary Genitor tasks
|
87
94
|
def define
|
88
95
|
desc "Create or update project using Genitor"
|
89
|
-
task name => @
|
96
|
+
task name => @all_files.map { |f| target(f) }
|
90
97
|
|
91
98
|
# default is namespace(:app)
|
92
99
|
namespace name do
|
93
100
|
|
94
|
-
@copy_files.each do |
|
95
|
-
source_file, target_file = source(
|
96
|
-
|
101
|
+
@copy_files.each do |cf|
|
102
|
+
source_file, target_file = source(cf), target(cf)
|
103
|
+
polite_file target_file => source_file do
|
97
104
|
cp source_file, target_file
|
98
105
|
end
|
99
106
|
end
|
100
107
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
108
|
+
@template_files.each do |tf|
|
109
|
+
extension = File.extname(tf)
|
110
|
+
source_file, target_file = source(tf), target(tf.chomp(extension))
|
111
|
+
block = @template_processors[extension[1..-1]]
|
112
|
+
polite_file target_file do
|
113
|
+
block.call(source_file, target_file)
|
106
114
|
end
|
107
115
|
end
|
108
116
|
|
data/lib/genitor/polite_file.rb
CHANGED
data/test/test_genitor.rb
CHANGED
@@ -39,6 +39,7 @@ context "Simple genitor" do
|
|
39
39
|
|
40
40
|
specify "should have all directories in the directories list" do
|
41
41
|
@generator.directories.to_a.should == @directories
|
42
|
+
# @generator.template_files.should == 1
|
42
43
|
end
|
43
44
|
|
44
45
|
specify "should have all non-erb files in the copy list" do
|