rubigen 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.3.3 2008-10-21
2
+
3
+ * prepend_sources correctly places arguments at start of sources list
4
+
1
5
  == 1.3.2 2008-05-19
2
6
 
3
7
  * app_gen/bin - includes #!/usr/bin/env ruby
data/Manifest.txt CHANGED
@@ -32,7 +32,6 @@ lib/rubigen/scripts/generate.rb
32
32
  lib/rubigen/scripts/update.rb
33
33
  lib/rubigen/simple_logger.rb
34
34
  lib/rubigen/spec.rb
35
- lib/rubigen/version.rb
36
35
  rubygems_generators/application_generator/USAGE
37
36
  rubygems_generators/application_generator/application_generator_generator.rb
38
37
  rubygems_generators/application_generator/templates/bin
@@ -52,14 +51,10 @@ rubygems_generators/component_generator/templates/usage
52
51
  script/destroy
53
52
  script/generate
54
53
  script/txt2html
55
- script/txt2js
56
54
  setup.rb
57
55
  tasks/deployment.rake
58
56
  tasks/environment.rake
59
57
  tasks/website.rake
60
- test/examples_from_rails/generator_test_helper.rb
61
- test/examples_from_rails/test_rails_resource_generator.rb
62
- test/examples_from_rails/test_rails_scaffold_generator.rb
63
58
  test/test_application_generator_generator.rb
64
59
  test/test_component_generator_generator.rb
65
60
  test/test_generate_builtin_application.rb
data/README.txt CHANGED
@@ -107,7 +107,7 @@ The `bin/newgem` script is very simple, and looks like:
107
107
 
108
108
  if %w(-v --version).include? ARGV.first
109
109
  require 'newgem/version'
110
- puts "#{File.basename($0)} #{Newgem::VERSION::STRING}"
110
+ puts "#{File.basename($0)} #{Newgem::VERSION}"
111
111
  exit(0)
112
112
  end
113
113
 
@@ -5,7 +5,7 @@ require 'rubigen'
5
5
 
6
6
  if %w(-v --version).include? ARGV.first
7
7
  require 'rubigen/version'
8
- puts "#{File.basename($0)} (via rubigen - #{Rubigen::VERSION::STRING})"
8
+ puts "#{File.basename($0)} (via rubigen - #{RubiGen::VERSION})"
9
9
  exit(0)
10
10
  end
11
11
 
data/bin/ruby_app CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/../lib/rubigen/version'
4
4
  if %w(--version -v).include? ARGV.first
5
- puts "Rails #{RubiGen::VERSION::STRING}"
5
+ puts "Rails #{RubiGen::VERSION}"
6
6
  exit(0)
7
7
  end
8
8
 
data/config/hoe.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'rubigen/version'
1
+ require 'rubigen'
2
2
 
3
3
  AUTHOR = ['Dr Nic Williams', 'Jeremy Kemper'] # can also be an array of Authors
4
4
  EMAIL = "drnicwilliams@gmail.com"
@@ -34,7 +34,7 @@ end
34
34
  REV = nil
35
35
  # UNCOMMENT IF REQUIRED:
36
36
  # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
37
- VERS = Rubigen::VERSION::STRING + (REV ? ".#{REV}" : "")
37
+ VERS = RubiGen::VERSION
38
38
  RDOC_OPTS = ['--quiet', '--title', 'rubigen documentation',
39
39
  "--opname", "index.html",
40
40
  "--line-numbers",
@@ -62,7 +62,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
62
62
 
63
63
  # == Optional
64
64
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
65
- p.extra_deps = [ ['activesupport', '>= 1.4.4'] ] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
65
+ p.extra_deps = [ [ 'activesupport', '>= 1.4.4'] ] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
66
66
 
67
67
  #p.spec_extras = {} # A hash of extra values to set in the gemspec.
68
68
 
@@ -84,6 +84,8 @@ module RubiGen
84
84
 
85
85
  # Add a source to the beginning of the list.
86
86
  def prepend_sources(*args)
87
+ sources = self.sources
88
+ reset_sources
87
89
  write_inheritable_array(:sources, args.flatten + sources)
88
90
  invalidate_cache!
89
91
  end
@@ -151,7 +153,7 @@ module RubiGen
151
153
  unless @found[generator_name]
152
154
  chars = generator_name.scan(/./).map{|c|"#{c}.*?"}
153
155
  rx = /^#{chars}$/
154
- gns = cache.select{|spec| spec.name =~ rx }
156
+ gns = cache.select {|spec| spec.name =~ rx }
155
157
  @found[generator_name] ||= gns.first if gns.length == 1
156
158
  raise GeneratorError, "Pattern '#{generator_name}' matches more than one generator: #{gns.map{|sp|sp.name}.join(', ')}" if gns.length > 1
157
159
  end
data/lib/rubigen.rb CHANGED
@@ -8,6 +8,10 @@ rescue LoadError
8
8
  require 'active_support'
9
9
  end
10
10
 
11
+ module RubiGen
12
+ VERSION = '1.3.3'
13
+ end
14
+
11
15
  require 'rubigen/base'
12
16
  require 'rubigen/lookup'
13
17
  require 'rubigen/commands'
@@ -5,7 +5,7 @@ require 'rubigen'
5
5
 
6
6
  if %w(-v --version).include? ARGV.first
7
7
  require '<%= name %>/version'
8
- puts "#{File.basename($0)} #{<%= app_model_name %>::VERSION::STRING}"
8
+ puts "#{File.basename($0)} #{<%= app_model_name %>::VERSION}"
9
9
  exit(0)
10
10
  end
11
11
 
@@ -17,10 +17,12 @@ class <%= class_name %> < <%= superclass_name %>
17
17
  m.directory 'some_folder'
18
18
 
19
19
  # Create stubs
20
- # m.template "template.rb", "some_file_after_erb.rb"
20
+ # m.template "template.rb.erb", "some_file_after_erb.rb"
21
21
  # m.template_copy_each ["template.rb", "template2.rb"]
22
- # m.file "file", "some_file_copied"
22
+ # m.template_copy_each ["template.rb", "template2.rb"], "some/path"
23
+ # m.file "file", "some_file_copied"
23
24
  # m.file_copy_each ["path/to/file", "path/to/file2"]
25
+ # m.file_copy_each ["path/to/file", "path/to/file2"], "some/path"
24
26
  end
25
27
  end
26
28
 
@@ -32,7 +32,8 @@ class Test<%= class_name %> < Test::Unit::TestCase
32
32
  def test_generator_without_options
33
33
  name = "myapp"
34
34
  run_generator('<%= name %>', [name], sources)
35
- assert_generated_file("some_file")
35
+ assert_directory_exists "some/directory"
36
+ assert_generated_file "some_file"
36
37
  end
37
38
 
38
39
  private
data/script/txt2html CHANGED
@@ -11,9 +11,9 @@ end
11
11
  require 'redcloth'
12
12
  require 'syntax/convertors/html'
13
13
  require 'erb'
14
- require File.dirname(__FILE__) + '/../lib/rubigen/version.rb'
14
+ require File.dirname(__FILE__) + '/../lib/rubigen'
15
15
 
16
- version = Rubigen::VERSION::STRING
16
+ version = RubiGen::VERSION
17
17
  download = 'http://rubyforge.org/projects/rubigen'
18
18
 
19
19
  class Fixnum
data/tasks/website.rake CHANGED
@@ -3,8 +3,6 @@ task :website_generate => :ruby_env do
3
3
  (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
4
  sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
5
  end
6
- sh %{ #{RUBY_APP} script/txt2js website/version.txt > website/version.js }
7
- sh %{ #{RUBY_APP} script/txt2js website/version-raw.txt > website/version-raw.js }
8
6
  end
9
7
 
10
8
  desc 'Upload website files to rubyforge'
data/website/index.html CHANGED
@@ -23,179 +23,124 @@
23
23
  }
24
24
  var versionBox = new curvyCorners(settings, document.getElementById("version"));
25
25
  versionBox.applyCornersToAll();
26
+
27
+ var twitterBox = new curvyCorners(settings, document.getElementById("twitter_search"));
28
+ twitterBox.applyCornersToAll();
26
29
  }
27
30
  </script>
28
31
  </head>
29
32
  <body>
30
33
  <div id="main">
31
34
  <h1>rubigen</h1>
32
- <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rubigen"; return false'>
33
- <p>Get Version</p>
34
- <a href="http://rubyforge.org/projects/rubigen" class="numbers">1.3.2</a>
35
+ <div class="sidebar">
36
+ <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rubigen"; return false'>
37
+ <p>Get Version</p>
38
+ <a href="http://rubyforge.org/projects/rubigen" class="numbers">1.3.3</a>
39
+ </div>
40
+
41
+ <div id="twitter_search">
42
+ <h3>Heard on twitter ('rubigen')...</h3>
43
+ <!-- HELP FILE - http://twitterwidget.jazzychad.com/tw/ -->
44
+ <script language = "javascript">
45
+ var jtw_search = 'rubigen';
46
+ var jtw_widget_background = 'd77';
47
+ var jtw_widget_border = '0';
48
+ var jtw_tweet_textcolor = 'fff';
49
+ var jtw_tweet_background = '000';
50
+ var jtw_tweet_border = '0px';
51
+ </script>
52
+ <script src="http://twitterwidget.jazzychad.com/tw/searchwidget.js" type="text/javascript"></script>
53
+ </div>
54
+
35
55
  </div>
36
56
  <h1>Ruby Generator Framework</h1>
37
-
38
-
39
- <h2>What</h2>
40
-
41
-
42
- <p>A framework to allow Ruby applications to generate file/folder stubs
43
- (like the <code>rails</code> command does for Ruby on Rails, and the &#8216;script/generate&#8217;
44
- command within a Rails application during development).</p>
45
-
46
-
47
- <p>The RubyConf 2007 presentation is now <a href="http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html">online</a> together with the theme from the A-Team.</p>
48
-
49
-
50
- <h2>Background</h2>
51
-
52
-
53
- <p>RubiGen is originally extracted from Ruby on Rails (specifically the rails_generator
54
- from its railties gem).</p>
55
-
56
-
57
- <p>The rails_generator was hardcoded with Rails-specific dependencies (<code>RAILS_ROOT</code>),
58
- Rails generators (&#8216;app&#8217; = Rails application; &#8216;model&#8217; = Rails model+tests+migration),
59
- and generally assumed it was the only generator framework within the Ruby world (it was).
60
- So, any RubyGem whose name ended with &#8216;_generator&#8217; was assumed to be a generator for
61
- a Rails application.</p>
62
-
63
-
64
- <p>But if you are developing a Merb application, then you may want a different set of generators.
57
+ <h2>What</h2>
58
+ <p>A framework to allow Ruby applications to generate file/folder stubs (like the <code>rails</code> command does for Ruby on Rails, and the &#8216;script/generate&#8217; command within a Rails application during development).</p>
59
+ <p>The RubyConf 2007 presentation is now <a href="http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html">online</a> together with the theme from the A-Team.</p>
60
+ <h2>Background</h2>
61
+ <p>RubiGen is originally extracted from Ruby on Rails (specifically the rails_generator from its railties gem).</p>
62
+ <p>The rails_generator was hardcoded with Rails-specific dependencies (<code>RAILS_ROOT</code>), Rails generators (&#8216;app&#8217; = Rails application; &#8216;model&#8217; = Rails model+tests+migration), and generally assumed it was the only generator framework within the Ruby world (it was). So, any RubyGem whose name ended with &#8216;_generator&#8217; was assumed to be a generator for a Rails application.</p>
63
+ <p>But if you are developing a Merb application, then you may want a different set of generators.<br />
65
64
  If you are developing a RubyGem, then you will want a different set of generators.</p>
66
-
67
-
68
- <p>RubiGen exists to give different development environments their own generator framework.</p>
69
-
70
-
71
- <h2>Installing</h2>
72
-
73
-
74
- <p>RubiGen is only required at development time, and normally isn&#8217;t required at deployment time
75
- (unless your application uses it to generate files etc for its users).</p>
76
-
77
-
78
- <p>On your development machine:</p>
79
-
80
-
81
- <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">rubigen</span></pre></p>
82
-
83
-
84
- <h2>Usage</h2>
85
-
86
-
87
- <p>RubiGen will be normally integrated into another RubyGem, such as <code>newgem</code> or <code>merb</code> or <code>camping</code>,
88
- rather than be used on its own.</p>
89
-
90
-
91
- <p>These frameworks might use RubiGen for two reasons:</p>
92
-
93
-
94
- <ol>
95
- <li>To generate an initial stub for developers, e.g. <code>rails</code> generated a stub to write a Rails application. <code>newgem</code> generates a stub to write a RubyGem. <br/>
65
+ <p>RubiGen exists to give different development environments their own generator framework.</p>
66
+ <h2>Installing</h2>
67
+ <p>RubiGen is only required at development time, and normally isn&#8217;t required at deployment time (unless your application uses it to generate files etc for its users).</p>
68
+ <p>On your development machine:</p>
69
+ <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">rubigen</span></pre></p>
70
+ <h2>Usage</h2>
71
+ <p>RubiGen will be normally integrated into another RubyGem, such as <code>newgem</code> or <code>merb</code> or <code>camping</code>, rather than be used on its own.</p>
72
+ <p>These frameworks might use RubiGen for two reasons:</p>
73
+ <ol>
74
+ <li>To generate an initial stub for developers, e.g. <code>rails</code> generated a stub to write a Rails application. <code>newgem</code> generates a stub to write a RubyGem. <br/><br />
96
75
  <span class="caps">BTW</span> &#8211; RubiGen has a builtin application <code>ruby_app</code> which generates a bare-bones Ruby application stub (lib, test, and script folders, plus a Rakefile, and a script/generate script)</li>
97
- <li>To generate components within their development areas, e.g. Rails had its <code>script/generate</code> script within each Rails application, which hooked back into the rails_generator to lookup and execute generators.</li>
98
- </ol>
99
-
100
-
101
- <p>So, there are two steps to integrating RubiGen into your framework:</p>
102
-
103
-
104
- <ol>
105
- <li>Use it to generate an initial stub for the developers of your framework. This would create the folders
106
- (<code>lib/app</code>, <code>test</code>, <code>script</code>, <code>doc</code>, <code>log</code>, etc) and starting files (<code>Rakefile</code>,
107
- <code>README.txt</code>, <code>test/test_helper.rb</code> etc). Importantly, it would generate a <code>script/generate</code> file.
108
- The <code>script/generate</code> file (example below) will allow developers of your framework to
109
- generate components/extensions within the framework. <br />
110
- RubiGen allows you to restrict which generators are available. For example, within
111
- RubyGem development environment (as generated by <code>newgem</code>), the <code>script/generator</code>
112
- only shows <code>rubygem</code>-related generators. Merb could restrict <code>script/generator</code>
76
+ <li>To generate components within their development areas, e.g. Rails had its <code>script/generate</code> script within each Rails application, which hooked back into the rails_generator to lookup and execute generators.</li>
77
+ </ol>
78
+ <p>So, there are two steps to integrating RubiGen into your framework:</p>
79
+ <ol>
80
+ <li>Use it to generate an initial stub for the developers of your framework. This would create the folders <br />
81
+ (<code>lib/app</code>, <code>test</code>, <code>script</code>, <code>doc</code>, <code>log</code>, etc) and starting files (<code>Rakefile</code>, <br />
82
+ <code>README.txt</code>, <code>test/test_helper.rb</code> etc). Importantly, it would generate a <code>script/generate</code> file.<br />
83
+ The <code>script/generate</code> file (example below) will allow developers of your framework to <br />
84
+ generate components/extensions within the framework. <br /><br />
85
+ RubiGen allows you to restrict which generators are available. For example, within<br />
86
+ RubyGem development environment (as generated by <code>newgem</code>), the <code>script/generator</code><br />
87
+ only shows <code>rubygem</code>-related generators. Merb could restrict <code>script/generator</code><br />
113
88
  to only show Merb related generators (or perhaps Merb and/or Rails generators)</li>
114
- <li>Your framework RubyGem (e.g. <code>newgem</code> or <code>merb</code> RubyGems) needs to add <code>rubigen</code> as a
89
+ <li>Your framework RubyGem (e.g. <code>newgem</code> or <code>merb</code> RubyGems) needs to add <code>rubigen</code> as a <br />
115
90
  dependency, so that users of your RubyGem can access the generator framework.</li>
116
- </ol>
117
-
118
-
119
- <h1>Creating generators</h1>
120
-
121
-
122
- <p>There are two types of generators:</p>
123
-
124
-
125
- <ol>
126
- <li>Application Generators &#8211; used by developers of your framework to get started.
127
- Generally, you will create one Application Generator for your framework.
128
- It generates a base stub (such as the <code>rails</code> stub for new Rails applications)
91
+ </ol>
92
+ <h1>Creating generators</h1>
93
+ <p>There are two types of generators:</p>
94
+ <ol>
95
+ <li>Application Generators &#8211; used by developers of your framework to get started. <br />
96
+ Generally, you will create one Application Generator for your framework.<br />
97
+ It generates a base stub (such as the <code>rails</code> stub for new Rails applications)<br />
129
98
  for your framework users.</li>
130
- <li>Component Generators &#8211; used by developers to extend their application.
131
- You may include 1+ built-in generators with your framework.
132
- Developers can also write generators for your framework, and like Rails&#8217; generator
99
+ <li>Component Generators &#8211; used by developers to extend their application.<br />
100
+ You may include 1+ built-in generators with your framework.<br />
101
+ Developers can also write generators for your framework, and like Rails&#8217; generator<br />
133
102
  install them in various places and have access to their via RubiGen.</li>
134
- </ol>
135
-
136
-
137
- <h2>Creating an Application Generator for your Framework</h2>
138
-
139
-
140
- <h3>Easy way</h3>
141
-
142
-
143
- <p><a href="http://newgem.rubyforge.org/">newgem</a> (v0.13.0+) can generate an Application Generator
103
+ </ol>
104
+ <h2>Creating an Application Generator for your Framework</h2>
105
+ <h3>Easy way</h3>
106
+ <p><a href="http://newgem.rubyforge.org/">newgem</a> (v0.13.0+) can generate an Application Generator<br />
144
107
  for a RubyGem.</p>
145
-
146
-
147
- <ol>
108
+ <ol>
148
109
  <li>Create new RubyGem: <code>newgem foobar</code></li>
149
- <li>Create generator: <code>script/generator application_generator foobar</code></li>
150
- <li>Update tests + generator</li>
151
- <li>Install</li>
152
- <li>Run with: foobar</li>
153
- </ol>
154
-
155
-
156
- <p>For more documentation, run <code>script/generator application_generator</code></p>
157
-
158
-
159
- <h3><span class="caps">DIY</span></h3>
160
-
161
-
162
- <p>Without RubiGen, to give your users a head start and create a stub for them, you will
163
- copiously use <code>mkdir_p</code> and <code>File.open</code>. Your script will either be primitive (only
164
- create the bare folders and very few files) or it will be very long and unreadable
165
- (ok, perhaps I&#8217;m just talking about the <code>newgem</code> script, which I am dubiously responsible
110
+ <li>Create generator: <code>script/generator application_generator foobar</code></li>
111
+ <li>Update tests + generator</li>
112
+ <li>Install</li>
113
+ <li>Run with: foobar</li>
114
+ </ol>
115
+ <p>For more documentation, run <code>script/generator application_generator</code></p>
116
+ <h3><span class="caps">DIY</span></h3>
117
+ <p>Without RubiGen, to give your users a head start and create a stub for them, you will <br />
118
+ copiously use <code>mkdir_p</code> and <code>File.open</code>. Your script will either be primitive (only<br />
119
+ create the bare folders and very few files) or it will be very long and unreadable<br />
120
+ (ok, perhaps I&#8217;m just talking about the <code>newgem</code> script, which I am dubiously responsible<br />
166
121
  for&#8230; :P).</p>
167
-
168
-
169
- <p>With RubiGen, you can create stubs using powerful, yet simple, syntax. Templates are
170
- extracted into a <code>templates</code> folder, and activating the generator from a script requires
122
+ <p>With RubiGen, you can create stubs using powerful, yet simple, syntax. Templates are<br />
123
+ extracted into a <code>templates</code> folder, and activating the generator from a script requires<br />
171
124
  only a few lines of code.</p>
172
-
173
-
174
- <p>These are the <code>newgem</code> files related to its Application Generator.</p>
175
-
176
-
177
- <pre><code>bin/
178
- bin/newgem # Appliction Generator script; Usage: newgem gemname [options]
125
+ <p>These are the <code>newgem</code> files related to its Application Generator.</p>
126
+ bin/
127
+ bin/newgem # Appliction Generator script; Usage: newgem gemname [options]
179
128
  app_generators/
180
- app_generators/newgem/
181
- app_generators/newgem/newgem_generator.rb
182
- app_generators/newgem/USAGE
183
- app_generators/newgem/templates/
184
- app_generators/newgem/templates/app.rb
185
- app_generators/newgem/templates/History.txt
186
- app_generators/newgem/templates/... lots and lots of templates</code></pre>
187
-
188
-
189
- <p>The <code>bin/newgem</code> script is very simple, and looks like:</p>
190
-
191
-
192
- <p><pre class='syntax'>
129
+ app_generators/newgem/
130
+ app_generators/newgem/newgem_generator.rb
131
+ app_generators/newgem/<span class="caps">USAGE</span>
132
+ app_generators/newgem/templates/
133
+ app_generators/newgem/templates/app.rb
134
+ app_generators/newgem/templates/History.txt
135
+ app_generators/newgem/templates/&#8230; lots and lots of templates
136
+ <p>The <code>bin/newgem</code> script is very simple, and looks like:</p>
137
+ <p><pre class='syntax'>
193
138
  <span class="ident">require</span> <span class="punct">'</span><span class="string">rubygems</span><span class="punct">'</span>
194
139
  <span class="ident">require</span> <span class="punct">'</span><span class="string">rubigen</span><span class="punct">'</span>
195
140
 
196
141
  <span class="keyword">if</span> <span class="punct">%w(</span><span class="string">-v --version</span><span class="punct">).</span><span class="ident">include?</span> <span class="constant">ARGV</span><span class="punct">.</span><span class="ident">first</span>
197
142
  <span class="ident">require</span> <span class="punct">'</span><span class="string">newgem/version</span><span class="punct">'</span>
198
- <span class="ident">puts</span> <span class="punct">&quot;</span><span class="string"><span class="expr">#{File.basename($0)}</span> <span class="expr">#{Newgem::VERSION::STRING}</span></span><span class="punct">&quot;</span>
143
+ <span class="ident">puts</span> <span class="punct">&quot;</span><span class="string"><span class="expr">#{File.basename($0)}</span> <span class="expr">#{Newgem::VERSION}</span></span><span class="punct">&quot;</span>
199
144
  <span class="ident">exit</span><span class="punct">(</span><span class="number">0</span><span class="punct">)</span>
200
145
  <span class="keyword">end</span>
201
146
 
@@ -203,26 +148,16 @@ app_generators/
203
148
  <span class="constant">RubiGen</span><span class="punct">::</span><span class="constant">Base</span><span class="punct">.</span><span class="ident">use_application_sources!</span>
204
149
  <span class="constant">RubiGen</span><span class="punct">::</span><span class="constant">Scripts</span><span class="punct">::</span><span class="constant">Generate</span><span class="punct">.</span><span class="ident">new</span><span class="punct">.</span><span class="ident">run</span><span class="punct">(</span><span class="constant">ARGV</span><span class="punct">,</span> <span class="symbol">:generator</span> <span class="punct">=&gt;</span> <span class="punct">'</span><span class="string">newgem</span><span class="punct">')</span>
205
150
  </pre></p>
206
-
207
-
208
- <p>You can copy and paste this for your own generator script, and place it in your RubyGem&#8217;s <code>bin</code> folder.
151
+ <p>You can copy and paste this for your own generator script, and place it in your RubyGem&#8217;s <code>bin</code> folder.<br />
209
152
  Change <code>newgem</code> to your RubyGem&#8217;s name in the script above (and in all the folders listed above too)</p>
210
-
211
-
212
- <p><span class="caps">NOTE</span>: If you leave <code>newgem</code> there, then it will execute the <code>newgem_generator.rb</code> generator;
153
+ <p><span class="caps">NOTE</span>: If you leave <code>newgem</code> there, then it will execute the <code>newgem_generator.rb</code> generator; <br />
213
154
  as the generators are loaded from all RubyGem&#8217;s having <code>/app_generators</code> folders.</p>
214
-
215
-
216
- <p>So, for your RubyGem, you need to keep the <code>/app_generators</code> folder (as you are creating an
217
- Application Generator, not a Component Generator), but change <code>newgem</code> to <code>your gem name</code> in
218
- all the subfolders and files. <span class="caps">ESPECIALLY</span> <code>newgem_generator.rb</code> -&gt; <code>yourgem_generator.rb</code>,
155
+ <p>So, for your RubyGem, you need to keep the <code>/app_generators</code> folder (as you are creating an <br />
156
+ Application Generator, not a Component Generator), but change <code>newgem</code> to <code>your gem name</code> in<br />
157
+ all the subfolders and files. <span class="caps">ESPECIALLY</span> <code>newgem_generator.rb</code> &#8594; <code>yourgem_generator.rb</code>,<br />
219
158
  as this is how the generator is discovered (via <code>RubiGen::Base.use_application_sources!</code>).</p>
220
-
221
-
222
- <p>All the generator work is performed within <code>yourgem_generator.rb</code>. A stub for it will be:</p>
223
-
224
-
225
- <p><pre class='syntax'>
159
+ <p>All the generator work is performed within <code>yourgem_generator.rb</code>. A stub for it will be:</p>
160
+ <p><pre class='syntax'>
226
161
  <span class="ident">require</span> <span class="punct">'</span><span class="string">rbconfig</span><span class="punct">'</span>
227
162
 
228
163
  <span class="keyword">class </span><span class="class">YourgemGenerator</span> <span class="punct">&lt;</span> <span class="constant">RubiGen</span><span class="punct">::</span><span class="constant">Base</span>
@@ -297,78 +232,37 @@ Usage: <span class="expr">#{File.basename $0}</span> /path/to/your/app [options]
297
232
  </span><span class="punct">)</span>
298
233
  <span class="keyword">end</span>
299
234
  </pre></p>
300
-
301
-
302
- <p>Easy peasy.</p>
303
-
304
-
305
- <h2>Creating a Component Generator for your Framework</h2>
306
-
307
-
308
- <p>You can include Component Generators in RubyGems, and they will be automatially picked up
235
+ <p>Easy peasy.</p>
236
+ <h2>Creating a Component Generator for your Framework</h2>
237
+ <p>You can include Component Generators in RubyGems, and they will be automatially picked up<br />
309
238
  by your framework&#8217;s <code>script/generate</code> script.</p>
310
-
311
-
312
- <h3>Easy way</h3>
313
-
314
-
315
- <p>Use <a href="http://newgem.rubyforge.org/">newgem</a>, (v0.13.0+), and run:</p>
316
-
317
-
239
+ <h3>Easy way</h3>
240
+ <p>Use <a href="http://newgem.rubyforge.org/">newgem</a>, (v0.13.0+), and run:</p>
318
241
  <pre>
319
242
  script/generate component_generator
320
243
  </pre>
321
-
322
- <p>and follow the instructions.</p>
323
-
324
-
325
- <h2>Live at RubyConf 2007</h2>
326
-
327
-
328
- <p>RubiGen had the 9am, Sunday timeslot at RubyConf 2007 and was <a href="http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html">recorded for your viewing pleasure</a>.</p>
329
-
330
-
331
- <h2>Forum</h2>
332
-
333
-
334
- <p><a href="http://groups.google.com/group/rubigen">http://groups.google.com/group/rubigen</a></p>
335
-
336
-
337
- <h2>How to submit patches</h2>
338
-
339
-
340
- <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
341
-
342
-
343
- <p>The source for this project is available via git. You can <a href="http://github.com/drnic/rubigen/tree/master">browse and/or fork the source</a>, or to clone the project locally:</p>
344
-
345
-
346
- <pre>git clone git://github.com/drnic/rubigen.git</pre>
347
-
348
- <p>The original Subversion repository is <code>svn://rubyforge.org/var/svn/rubigen/trunk</code> for anonymous access.</p>
349
-
350
-
351
- <h2>Thanks go to&#8230;</h2>
352
-
353
-
354
- <p><a href="http://bitsweat.net/">Jeremy Kemper</a> (bitsweat) who wrote the original <a href="http://dev.rubyonrails.org">Rails Generator</a>.</p>
355
-
356
-
357
- <h2>License</h2>
358
-
359
-
360
- <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
361
-
362
-
363
- <h2>Contact</h2>
364
-
365
-
366
- <p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a> via the <a href="http://groups.google.com/group/rubigen">forum</a></p>
244
+ <p>and follow the instructions.</p>
245
+ <h2>Live at RubyConf 2007</h2>
246
+ <p>RubiGen had the 9am, Sunday timeslot at RubyConf 2007 and was <a href="http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html">recorded for your viewing pleasure</a>.</p>
247
+ <h2>Forum</h2>
248
+ <p><a href="http://groups.google.com/group/rubigen">http://groups.google.com/group/rubigen</a></p>
249
+ <h2>How to submit patches</h2>
250
+ <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
251
+ <p>The source for this project is available via git. You can <a href="http://github.com/drnic/rubigen/tree/master">browse and/or fork the source</a>, or to clone the project locally:<br />
252
+ <br />
253
+ <pre>git clone git://github.com/drnic/rubigen.git</pre></p>
254
+ <p>The original Subversion repository is <code>svn://rubyforge.org/var/svn/rubigen/trunk</code> for anonymous access.</p>
255
+ <h2>Thanks go to&#8230;</h2>
256
+ <p><a href="http://bitsweat.net/">Jeremy Kemper</a> (bitsweat) who wrote the original <a href="http://dev.rubyonrails.org">Rails Generator</a>.</p>
257
+ <h2>License</h2>
258
+ <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
259
+ <h2>Contact</h2>
260
+ <p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a> via the <a href="http://groups.google.com/group/rubigen">forum</a></p>
367
261
  <p class="coda">
368
- <a href="drnicwilliams@gmail.com">Dr Nic Williams</a>, 19th May 2008<br>
262
+ <a href="drnicwilliams@gmail.com">Dr Nic Williams</a>, 26th October 2008<br>
369
263
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
370
264
  </p>
371
265
  </div>
372
266
  <!-- insert site tracking codes here, like Google Urchin -->
373
267
  </body>
374
- </html>
268
+ </html>