rubigen 1.2.4 → 1.3.0

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.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.3.0 2008-04-25
2
+
3
+ * component_generator: specific subclasses for rails + merb generators,
4
+ not the generic RubiGen::Base
5
+
1
6
  == 1.2.3 2008-02-22
2
7
 
3
8
  * Remove -wKU flags from install_rubigen_scripts + ruby_app apps
data/Manifest.txt CHANGED
@@ -8,7 +8,6 @@ app_generators/ruby_app/USAGE
8
8
  app_generators/ruby_app/ruby_app_generator.rb
9
9
  app_generators/ruby_app/templates/README.txt
10
10
  app_generators/ruby_app/templates/Rakefile
11
- app_generators/ruby_app/templates/configs/empty_log
12
11
  app_generators/ruby_app/templates/lib/module.rb
13
12
  app_generators/ruby_app/templates/test/test_helper.rb.erb
14
13
  bin/install_rubigen_scripts
@@ -34,7 +33,6 @@ lib/rubigen/scripts/update.rb
34
33
  lib/rubigen/simple_logger.rb
35
34
  lib/rubigen/spec.rb
36
35
  lib/rubigen/version.rb
37
- log/debug.log
38
36
  rubygems_generators/application_generator/USAGE
39
37
  rubygems_generators/application_generator/application_generator_generator.rb
40
38
  rubygems_generators/application_generator/templates/bin
@@ -2,7 +2,7 @@ require 'fileutils'
2
2
  include FileUtils
3
3
 
4
4
  require 'rubygems'
5
- %w[rake hoe newgem rubigen].each do |req_gem|
5
+ %w[rake hoe].each do |req_gem|
6
6
  begin
7
7
  require req_gem
8
8
  rescue LoadError
@@ -1,8 +1,8 @@
1
1
  module Rubigen #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
- MINOR = 2
5
- TINY = 4
4
+ MINOR = 3
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,9 +1,9 @@
1
1
  class ApplicationGeneratorGenerator < RubiGen::Base
2
2
 
3
- default_options
4
-
3
+ default_options
4
+
5
5
  attr_reader :name, :class_name, :app_model_name, :generator_path, :scopes, :scope_str
6
-
6
+
7
7
  def initialize(runtime_args, runtime_options = {})
8
8
  super
9
9
  usage if args.empty?
@@ -48,7 +48,7 @@ that are useful to developers.
48
48
  USAGE: #{$0} #{spec.name} name
49
49
  EOS
50
50
  end
51
-
51
+
52
52
  def add_options!(opts)
53
53
  # opts.separator ''
54
54
  # opts.separator 'Options:'
@@ -56,7 +56,7 @@ EOS
56
56
  # "Generated app file will include your name.",
57
57
  # "Default: none") { |options[:author]| }
58
58
  end
59
-
59
+
60
60
  def extract_options
61
61
  end
62
62
 
@@ -1,4 +1,8 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ begin
2
+ require File.dirname(__FILE__) + '/test_helper'
3
+ rescue LoadError
4
+ require 'test/unit'
5
+ end
2
6
  require 'fileutils'
3
7
 
4
8
  # Must set before requiring generator libs.
@@ -1,9 +1,10 @@
1
1
  class ComponentGeneratorGenerator < RubiGen::Base
2
-
3
- default_options
4
-
5
- attr_reader :name, :class_name, :generator_type, :generator_path
6
-
2
+
3
+ default_options
4
+
5
+ attr_reader :name, :class_name
6
+ attr_reader :generator_type, :generator_path
7
+
7
8
  def initialize(runtime_args, runtime_options = {})
8
9
  super
9
10
  usage if args.empty?
@@ -30,6 +31,17 @@ class ComponentGeneratorGenerator < RubiGen::Base
30
31
  end
31
32
  end
32
33
 
34
+ def superclass_name
35
+ case (generator_type.to_sym rescue nil)
36
+ when :rails
37
+ "Rails::Generator::NamedBase"
38
+ when :merb
39
+ "Merb::GeneratorBase"
40
+ else
41
+ "RubiGen::Base"
42
+ end
43
+ end
44
+
33
45
  protected
34
46
  def banner
35
47
  <<-EOS
@@ -46,7 +58,7 @@ EOS
46
58
  # "Generated app file will include your name.",
47
59
  # "Default: none") { |options[:author]| }
48
60
  end
49
-
61
+
50
62
  def extract_options
51
63
  end
52
64
  end
@@ -1,9 +1,9 @@
1
- class <%= class_name %> < RubiGen::Base
2
-
1
+ class <%= class_name %> < <%= superclass_name %>
2
+
3
3
  default_options :author => nil
4
-
4
+
5
5
  attr_reader :name
6
-
6
+
7
7
  def initialize(runtime_args, runtime_options = {})
8
8
  super
9
9
  usage if args.empty?
@@ -41,7 +41,7 @@ EOS
41
41
  # "Default: none") { |options[:author]| }
42
42
  # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
43
43
  end
44
-
44
+
45
45
  def extract_options
46
46
  # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
47
47
  # Templates can access these value via the attr_reader-generated methods, but not the
@@ -1,16 +1,26 @@
1
1
  require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
2
 
3
+ <% if generator_type.to_sym == :rails -%>
4
+ module Rails; module Generator; end; end
5
+ <% elsif generator_type.to_sym == :merb -%>
6
+ module Merb; end
7
+ <% end -%>
8
+ <% if superclass_name != "RubiGen::Base" -%>
9
+ class <%= superclass_name %> < RubiGen::Base
10
+ end
11
+ <% end -%>
12
+
3
13
  class Test<%= class_name %> < Test::Unit::TestCase
4
14
  include RubiGen::GeneratorTestHelper
5
15
 
6
16
  def setup
7
17
  bare_setup
8
18
  end
9
-
19
+
10
20
  def teardown
11
21
  bare_teardown
12
22
  end
13
-
23
+
14
24
  # Some generator-related assertions:
15
25
  # assert_generated_file(name, &block) # block passed the file contents
16
26
  # assert_directory_exists(name)
@@ -24,19 +34,19 @@ class Test<%= class_name %> < Test::Unit::TestCase
24
34
  # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
25
35
  # bare_setup - place this in setup method to create the APP_ROOT folder for each test
26
36
  # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
27
-
37
+
28
38
  def test_generator_without_options
29
39
  name = "myapp"
30
40
  run_generator('<%= name %>', [name], sources)
31
41
  assert_generated_file("some_file")
32
42
  end
33
-
43
+
34
44
  private
35
45
  def sources
36
46
  [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
37
47
  ]
38
48
  end
39
-
49
+
40
50
  def generator_path
41
51
  "<%= generator_path %>"
42
52
  end
@@ -1,4 +1,8 @@
1
- require File.dirname(__FILE__) + '/test_helper'
1
+ begin
2
+ require File.dirname(__FILE__) + '/test_helper'
3
+ rescue LoadError
4
+ require 'test/unit'
5
+ end
2
6
  require 'fileutils'
3
7
 
4
8
  # Must set before requiring generator libs.
data/script/destroy CHANGED
File without changes
data/script/generate CHANGED
File without changes
data/script/txt2html CHANGED
File without changes
data/script/txt2js CHANGED
File without changes
@@ -6,11 +6,11 @@ class TestGenerateComponentGenerator < Test::Unit::TestCase
6
6
  def setup
7
7
  bare_setup
8
8
  end
9
-
9
+
10
10
  def teardown
11
11
  bare_teardown
12
12
  end
13
-
13
+
14
14
  def test_generator_without_options
15
15
  name = "genname"
16
16
  run_generator('component_generator', [name], sources)
@@ -22,6 +22,10 @@ class TestGenerateComponentGenerator < Test::Unit::TestCase
22
22
  assert_generated_class("generators/#{name}/#{name}_generator") do |body|
23
23
  # assert_has_method body, "initialize" # as_has_m cannot pickup initialize(...) only initialize
24
24
  assert_has_method body, "manifest"
25
+
26
+ gen_class, superclass = body.match(%r{class ([\w:_]+) < ([\w:_]+)})[1..2]
27
+ assert_equal("GennameGenerator", gen_class)
28
+ assert_equal("RubiGen::Base", superclass)
25
29
  end
26
30
  assert_generated_class("test/test_#{name}_generator") do |body|
27
31
  assert_has_method body, "setup"
@@ -36,7 +40,7 @@ class TestGenerateComponentGenerator < Test::Unit::TestCase
36
40
  name = "genname"
37
41
  gen_type = "fooapp"
38
42
  run_generator('component_generator', [name, gen_type], sources)
39
-
43
+
40
44
  assert_generated_file "#{gen_type}_generators/#{name}/#{name}_generator.rb"
41
45
  assert_generated_file "#{gen_type}_generators/#{name}/USAGE"
42
46
  assert_generated_file "test/test_#{name}_generator.rb"
@@ -45,6 +49,61 @@ class TestGenerateComponentGenerator < Test::Unit::TestCase
45
49
  assert_generated_class "#{gen_type}_generators/#{name}/#{name}_generator" do |body|
46
50
  # assert_has_method body, "initialize" # as_has_m cannot pickup initialize(...) only initialize
47
51
  assert_has_method body, "manifest"
52
+ gen_class, superclass = body.match(%r{class ([\w:_]+) < ([\w:_]+)})[1..2]
53
+ assert_equal("GennameGenerator", gen_class)
54
+ assert_equal("RubiGen::Base", superclass)
55
+ end
56
+ assert_generated_class "test/test_#{name}_generator" do |body|
57
+ assert_has_method body, "setup"
58
+ assert_has_method body, "teardown"
59
+ assert_has_method body, "test_generator_without_options"
60
+ assert_has_method body, "sources"
61
+ assert_has_method body, "generator_path"
62
+ end
63
+ end
64
+
65
+ def test_generator_with_rails_generator_type
66
+ name = "genname"
67
+ gen_type = "rails"
68
+ run_generator('component_generator', [name, gen_type], sources)
69
+
70
+ assert_generated_file "#{gen_type}_generators/#{name}/#{name}_generator.rb"
71
+ assert_generated_file "#{gen_type}_generators/#{name}/USAGE"
72
+ assert_generated_file "test/test_#{name}_generator.rb"
73
+ assert_generated_file "test/test_generator_helper.rb"
74
+ assert_directory_exists "#{gen_type}_generators/#{name}/templates"
75
+ assert_generated_class "#{gen_type}_generators/#{name}/#{name}_generator" do |body|
76
+ # assert_has_method body, "initialize" # as_has_m cannot pickup initialize(...) only initialize
77
+ assert_has_method body, "manifest"
78
+ gen_class, superclass = body.match(%r{class ([\w:_]+) < ([\w:_]+)})[1..2]
79
+ assert_equal("GennameGenerator", gen_class)
80
+ assert_equal("Rails::Generator::NamedBase", superclass)
81
+ end
82
+ assert_generated_class "test/test_#{name}_generator" do |body|
83
+ assert_has_method body, "setup"
84
+ assert_has_method body, "teardown"
85
+ assert_has_method body, "test_generator_without_options"
86
+ assert_has_method body, "sources"
87
+ assert_has_method body, "generator_path"
88
+ end
89
+ end
90
+
91
+ def test_generator_with_merb_generator_type
92
+ name = "genname"
93
+ gen_type = "merb"
94
+ run_generator('component_generator', [name, gen_type], sources)
95
+
96
+ assert_generated_file "#{gen_type}_generators/#{name}/#{name}_generator.rb"
97
+ assert_generated_file "#{gen_type}_generators/#{name}/USAGE"
98
+ assert_generated_file "test/test_#{name}_generator.rb"
99
+ assert_generated_file "test/test_generator_helper.rb"
100
+ assert_directory_exists "#{gen_type}_generators/#{name}/templates"
101
+ assert_generated_class "#{gen_type}_generators/#{name}/#{name}_generator" do |body|
102
+ # assert_has_method body, "initialize" # as_has_m cannot pickup initialize(...) only initialize
103
+ assert_has_method body, "manifest"
104
+ gen_class, superclass = body.match(%r{class ([\w:_]+) < ([\w:_]+)})[1..2]
105
+ assert_equal("GennameGenerator", gen_class)
106
+ assert_equal("Merb::GeneratorBase", superclass)
48
107
  end
49
108
  assert_generated_class "test/test_#{name}_generator" do |body|
50
109
  assert_has_method body, "setup"
@@ -60,7 +119,7 @@ class TestGenerateComponentGenerator < Test::Unit::TestCase
60
119
  [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"../#{generator_path}"))
61
120
  ]
62
121
  end
63
-
122
+
64
123
  def generator_path
65
124
  "rubygems_generators"
66
125
  end
data/website/index.html CHANGED
@@ -31,7 +31,7 @@
31
31
  <h1>rubigen</h1>
32
32
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rubigen"; return false'>
33
33
  <p>Get Version</p>
34
- <a href="http://rubyforge.org/projects/rubigen" class="numbers">1.2.4</a>
34
+ <a href="http://rubyforge.org/projects/rubigen" class="numbers">1.3.0</a>
35
35
  </div>
36
36
  <h1>Ruby Generator Framework</h1>
37
37
 
@@ -44,6 +44,9 @@
44
44
  command within a Rails application during development).</p>
45
45
 
46
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
+
47
50
  <h2>Background</h2>
48
51
 
49
52
 
@@ -319,6 +322,12 @@ script/generate component_generator
319
322
  <p>and follow the instructions.</p>
320
323
 
321
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
+
322
331
  <h2>Forum</h2>
323
332
 
324
333
 
@@ -328,8 +337,15 @@ script/generate component_generator
328
337
  <h2>How to submit patches</h2>
329
338
 
330
339
 
331
- <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.
332
- The trunk repository is <code>svn://rubyforge.org/var/svn/rubigen/trunk</code> for anonymous access.</p>
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>
333
349
 
334
350
 
335
351
  <h2>Thanks go to&#8230;</h2>
@@ -349,7 +365,7 @@ The trunk repository is <code>svn://rubyforge.org/var/svn/rubigen/trunk</code> f
349
365
 
350
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>
351
367
  <p class="coda">
352
- <a href="drnicwilliams@gmail.com">Dr Nic Williams</a>, 4th November 2007<br>
368
+ <a href="drnicwilliams@gmail.com">Dr Nic Williams</a>, 5th March 2008<br>
353
369
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
354
370
  </p>
355
371
  </div>
data/website/index.txt CHANGED
@@ -8,6 +8,8 @@ A framework to allow Ruby applications to generate file/folder stubs
8
8
  (like the <code>rails</code> command does for Ruby on Rails, and the 'script/generate'
9
9
  command within a Rails application during development).
10
10
 
11
+ The RubyConf 2007 presentation is now "online":http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html together with the theme from the A-Team.
12
+
11
13
  h2. Background
12
14
 
13
15
  RubiGen is originally extracted from Ruby on Rails (specifically the rails_generator
@@ -234,6 +236,10 @@ script/generate component_generator
234
236
 
235
237
  and follow the instructions.
236
238
 
239
+ h2. Live at RubyConf 2007
240
+
241
+ RubiGen had the 9am, Sunday timeslot at RubyConf 2007 and was "recorded for your viewing pleasure":http://rubyconf2007.confreaks.com/d3t1p1_rubigen.html.
242
+
237
243
  h2. Forum
238
244
 
239
245
  "http://groups.google.com/group/rubigen":http://groups.google.com/group/rubigen
@@ -241,7 +247,12 @@ h2. Forum
241
247
  h2. How to submit patches
242
248
 
243
249
  Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
244
- The trunk repository is <code>svn://rubyforge.org/var/svn/rubigen/trunk</code> for anonymous access.
250
+
251
+ The source for this project is available via git. You can "browse and/or fork the source":http://github.com/drnic/rubigen/tree/master, or to clone the project locally:
252
+
253
+ <pre>git clone git://github.com/drnic/rubigen.git</pre>
254
+
255
+ The original Subversion repository is <code>svn://rubyforge.org/var/svn/rubigen/trunk</code> for anonymous access.
245
256
 
246
257
  h2. Thanks go to...
247
258
 
@@ -1,13 +1,13 @@
1
1
  body {
2
- background-color: #E1D1F1;
2
+ background-color: #F10B00;
3
3
  font-family: "Georgia", sans-serif;
4
4
  font-size: 16px;
5
5
  line-height: 1.6em;
6
6
  padding: 1.6em 0 0 0;
7
- color: #333;
7
+ color: #FFF;
8
8
  }
9
9
  h1, h2, h3, h4, h5, h6 {
10
- color: #444;
10
+ color: #FFF;
11
11
  }
12
12
  h1 {
13
13
  font-family: sans-serif;
@@ -101,12 +101,12 @@ pre, code {
101
101
  text-align: right;
102
102
  font-family: sans-serif;
103
103
  font-weight: normal;
104
- background-color: #B3ABFF;
105
- color: #141331;
104
+ background-color: #468EFF;
105
+ color: #EEE;
106
106
  padding: 15px 20px 10px 20px;
107
107
  margin: 0 auto;
108
108
  margin-top: 15px;
109
- border: 3px solid #141331;
109
+ border: 3px solid #DDD;
110
110
  }
111
111
 
112
112
  #version .numbers {
@@ -119,16 +119,16 @@ pre, code {
119
119
 
120
120
  #version p {
121
121
  text-decoration: none;
122
- color: #141331;
123
- background-color: #B3ABFF;
122
+ color: #EEE;
123
+ background-color: #468EFF;
124
124
  margin: 0;
125
125
  padding: 0;
126
126
  }
127
127
 
128
128
  #version a {
129
129
  text-decoration: none;
130
- color: #141331;
131
- background-color: #B3ABFF;
130
+ color: #EEE;
131
+ background-color: #468EFF;
132
132
  }
133
133
 
134
134
  .clickable {
@@ -1,3 +1,3 @@
1
1
  // Announcement JS file
2
- var version = "1.2.4";
2
+ var version = "1.3.0";
3
3
  MagicAnnouncement.show('compositekeys', version);
data/website/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Version JS file
2
- var version = "1.2.4";
2
+ var version = "1.3.0";
3
3
 
4
4
  document.write(" - " + version);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubigen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-02-29 00:00:00 +10:00
13
+ date: 2008-04-25 00:00:00 +10:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -50,7 +50,6 @@ files:
50
50
  - app_generators/ruby_app/ruby_app_generator.rb
51
51
  - app_generators/ruby_app/templates/README.txt
52
52
  - app_generators/ruby_app/templates/Rakefile
53
- - app_generators/ruby_app/templates/configs/empty_log
54
53
  - app_generators/ruby_app/templates/lib/module.rb
55
54
  - app_generators/ruby_app/templates/test/test_helper.rb.erb
56
55
  - bin/install_rubigen_scripts
@@ -76,7 +75,6 @@ files:
76
75
  - lib/rubigen/simple_logger.rb
77
76
  - lib/rubigen/spec.rb
78
77
  - lib/rubigen/version.rb
79
- - log/debug.log
80
78
  - rubygems_generators/application_generator/USAGE
81
79
  - rubygems_generators/application_generator/application_generator_generator.rb
82
80
  - rubygems_generators/application_generator/templates/bin
@@ -147,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
145
  requirements: []
148
146
 
149
147
  rubyforge_project: rubigen
150
- rubygems_version: 1.0.1
148
+ rubygems_version: 1.1.1
151
149
  signing_key:
152
150
  specification_version: 2
153
151
  summary: "A framework to allow Ruby applications to generate file/folder stubs (like the rails command does for Ruby on Rails, and the \xE2\x80\x98script/generate\xE2\x80\x99 command within a Rails application during development)."
File without changes
data/log/debug.log DELETED
File without changes