public
Description: A simple and easy to use generator system for Ruby
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/genosaurus.git
Click here to lend your support to: genosaurus and make a donation at www.pledgie.com !
Removed mack_ruby_core_extensions gem requirement
markbates (author)
Sun Jun 29 12:51:40 -0700 2008
commit  f9aa5a36b445305fa48918f15c22a3b682603ebc
tree    79de8a778bc597192eca4ca0b0686f5fbe13a408
parent  037dee95ca3efafdae7b61d0e29f35779adbb361
...
8
9
10
11
 
12
13
14
...
26
27
28
29
30
31
32
...
8
9
10
 
11
12
13
14
...
26
27
28
 
29
30
31
0
@@ -8,7 +8,7 @@ require 'rubyforge'
0
 require 'rubygems'
0
 require 'rubygems/gem_runner'
0
 
0
-GEM_VERSION = "1.1.7"
0
+GEM_VERSION = "1.1.8"
0
 GEM_NAME = "genosaurus"
0
 GEM_RUBYFORGE_PROJECT = "magrathea"
0
 
0
@@ -26,7 +26,6 @@ gem_spec = Gem::Specification.new do |s|
0
   s.files = FileList['lib/**/*.rb', 'README', 'doc/**/*.*', 'bin/**/*.*']
0
   s.require_paths << 'lib'
0
 
0
- s.add_dependency("facets")
0
   s.add_dependency("erubis")
0
   s.extra_rdoc_files = ["README"]
0
   s.has_rdoc = true
...
1
2
3
4
5
6
7
8
9
10
 
 
 
 
 
 
 
 
 
 
11
12
13
...
32
33
34
35
36
 
37
38
39
...
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
105
106
107
 
108
109
110
...
1
 
2
3
4
5
6
 
 
 
7
8
9
10
11
12
13
14
15
16
17
18
19
...
38
39
40
 
 
41
42
43
44
...
88
89
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
 
 
108
109
110
111
112
0
@@ -1,13 +1,19 @@
0
 require 'rubygems'
0
-require 'facets/style'
0
 require 'fileutils'
0
 require 'erb'
0
 require 'yaml'
0
 require 'erubis'
0
 
0
-# class String
0
-# include Style
0
-# end
0
+class String
0
+ def underscore
0
+ camel_cased_word = self.dup
0
+ camel_cased_word.to_s.gsub(/::/, '/').
0
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
0
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
0
+ tr("-", "_").
0
+ downcase
0
+ end
0
+end
0
 
0
 class Genosaurus
0
 
0
@@ -32,8 +38,7 @@ class Genosaurus
0
       raise ::ArgumentError.new("The required parameter '#{p.to_s.upcase}' is missing for this generator!") unless param(p)
0
     end
0
     @generator_name = self.class.name
0
- @generator_name_underscore = String::Style.underscore(@generator_name)#.underscore
0
- puts "@generator_name_underscore: #{@generator_name_underscore}"
0
+ @generator_name_underscore = @generator_name.underscore #String::Style.underscore(@generator_name)#.underscore
0
     @templates_directory_path = nil
0
     @manifest_path = nil
0
     $".each do |f|
0
@@ -83,28 +88,25 @@ class Genosaurus
0
   # with ERB and returned. If there is not manifest.yml then an implied manifest is generated from the contents
0
   # of the templates_directory_path.
0
   def manifest
0
- ivar_cache do
0
- if File.exists?(manifest_path)
0
- # run using the yml file
0
- template = ERB.new(File.open(manifest_path).read, nil, "->")
0
- man = YAML.load(template.result(binding))
0
- else
0
- files = Dir.glob(File.join(templates_directory_path, "**/*.template"))
0
- man = {}
0
- files.each_with_index do |f, i|
0
- output_path = f.gsub(templates_directory_path, "")
0
- output_path.gsub!(".template", "")
0
- output_path.gsub!(/^\//, "")
0
- man["template_#{i+1}"] = {
0
- "type" => File.directory?(f) ? "directory" : "file",
0
- "template_path" => f,
0
- "output_path" => Erubis::Eruby.new(output_path, :pattern => '% %').result(binding)
0
- }
0
- end
0
+ if File.exists?(manifest_path)
0
+ # run using the yml file
0
+ template = ERB.new(File.open(manifest_path).read, nil, "->")
0
+ man = YAML.load(template.result(binding))
0
+ else
0
+ files = Dir.glob(File.join(templates_directory_path, "**/*.template"))
0
+ man = {}
0
+ files.each_with_index do |f, i|
0
+ output_path = f.gsub(templates_directory_path, "")
0
+ output_path.gsub!(".template", "")
0
+ output_path.gsub!(/^\//, "")
0
+ man["template_#{i+1}"] = {
0
+ "type" => File.directory?(f) ? "directory" : "file",
0
+ "template_path" => f,
0
+ "output_path" => Erubis::Eruby.new(output_path, :pattern => '% %').result(binding)
0
+ }
0
       end
0
- # puts man.inspect
0
- man
0
     end
0
+ man
0
   end
0
   
0
   # Used to define arguments that are required by the generator.
...
13
14
15
 
 
 
 
 
 
16
17
18
19
...
13
14
15
16
17
18
19
20
21
22
23
24
25
0
@@ -13,6 +13,12 @@ puts "$genosaurus_output_directory: #{$genosaurus_output_directory}"
0
 
0
 Dir.glob(File.join(File.dirname(__FILE__), "lib", "**/*.rb")).each {|f| require f}
0
 
0
+class String
0
+ def capitalize_all_words
0
+ self.gsub(/\b\w/) {|s| s.upcase}
0
+ end
0
+end
0
+
0
 class Test::Unit::TestCase
0
   
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.