<?xml version="1.0" encoding="UTF-8"?>
<ticket>
  <assigned-user-id type="integer">5118</assigned-user-id>
  <attachments-count type="integer">0</attachments-count>
  <closed type="boolean">false</closed>
  <created-at type="datetime">2009-01-20T23:05:50+10:00</created-at>
  <creator-id type="integer">10387</creator-id>
  <milestone-due-on type="datetime" nil="true"></milestone-due-on>
  <milestone-id type="integer" nil="true"></milestone-id>
  <number type="integer">7</number>
  <permalink>rails-dependencies-introduced-in-rubigen-150</permalink>
  <priority type="integer">30</priority>
  <project-id type="integer">19471</project-id>
  <raw-data type="binary" nil="true" encoding="base64"></raw-data>
  <state>new</state>
  <tag nil="true"></tag>
  <title>Rails dependencies introduced in rubigen &gt;1.5.0</title>
  <updated-at type="datetime">2009-01-20T23:15:40+10:00</updated-at>
  <user-id type="integer">5118</user-id>
  <user-name>Dr Nic</user-name>
  <creator-name>Aitor Garc&#237;a Rey</creator-name>
  <assigned-user-name>Dr Nic</assigned-user-name>
  <url>http://drnic.lighthouseapp.com/projects/19471/tickets/7</url>
  <original-body>Generate a RubiGen::Base based application generator:
@@@ ruby
newgem foobar
script/generate application_generator foobar
@@@

add this to manifest method on foobar_generator.rb:

@@@ ruby
m.migration_template 'test.rb', 'db/migrate',:migration_file_name =&gt; 'test'
@@@

and a simple migration template:

@@@ ruby 
class Test &lt; ActiveRecord::Migration
  def self.up
  end

  def self.down
  end
end
@@@
Then try to use this generator:

@@@ ruby
chmod +x bin/foobar
bin/foobar test_app
@@@

This throws an &quot;uninitialized constant&quot; error related to Rails dependencies no satisfied in [RUBIGEN_PATH]/lib/rubigen/commands.rb line 65:

@@@ ruby
Dir.glob(&quot;#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb&quot;).inject(0) do |max, file_path|
@@@

and line 88:
 
@@@ ruby 
if ActiveRecord::Base.timestamped_migrations
@@@

A simple require 'active_record' would fix it.</original-body>
  <latest-body>Generate a RubiGen::Base based application generator:
@@@ ruby
newgem foobar
script/generate application_generator foobar
@@@

add this to manifest method on foobar_generator.rb:

@@@ ruby
m.migration_template 'test.rb', 'db/migrate',:migration_file_name =&gt; 'test'
@@@

and a simple migration template:

@@@ ruby 
class Test &lt; ActiveRecord::Migration
  def self.up
  end

  def self.down
  end
end
@@@
Then try to use this generator:

@@@ ruby
chmod +x bin/foobar
bin/foobar test_app
@@@

This throws an &quot;uninitialized constant&quot; error related to Rails dependencies no satisfied in [RUBIGEN_PATH]/lib/rubigen/commands.rb line 65:

@@@ ruby
Dir.glob(&quot;#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb&quot;).inject(0) do |max, file_path|
@@@

and line 88:
 
@@@ ruby 
if ActiveRecord::Base.timestamped_migrations
@@@

A simple require 'active_record' would fix it.</latest-body>
  <original-body-html>&lt;div&gt;&lt;p&gt;Generate a RubiGen::Base based application generator:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
newgem foobar
script/generate application_generator foobar
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;add this to manifest method on foobar_generator.rb:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
m.migration_template 'test.rb', 'db/migrate',:migration_file_name =&amp;gt; 'test'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and a simple migration template:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
class Test &amp;lt; ActiveRecord::Migration
  def self.up
  end

  def self.down
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then try to use this generator:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
chmod +x bin/foobar
bin/foobar test_app
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This throws an &quot;uninitialized constant&quot; error related to Rails
dependencies no satisfied in [RUBIGEN_PATH]/lib/rubigen/commands.rb
line 65:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
Dir.glob(&amp;quot;#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb&amp;quot;).inject(0) do |max, file_path|
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and line 88:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
if ActiveRecord::Base.timestamped_migrations
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A simple require 'active_record' would fix it.&lt;/p&gt;&lt;/div&gt;</original-body-html>
  <versions type="array">
    <version type="Ticket::Version">
      <assigned-user-id type="integer">5118</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Generate a RubiGen::Base based application generator:
@@@ ruby
newgem foobar
script/generate application_generator foobar
@@@

add this to the manifest method on foobar_generator.rb to test the migration generation process:
@@@ ruby
m.migration_template 'test.rb', 'db/migrate',:migration_file_name =&gt; 'test'
@@@

and add a simple migration template:

@@@ ruby 
class Test &lt; ActiveRecord::Migration
  def self.up
  end

  def self.down
  end
end
@@@
Then try to use this generator:

@@@ ruby
chmod +x bin/foobar
bin/foobar test_app
@@@

This throws an &quot;uninitialized constant&quot;:

@@@ ruby
uninitialized constant RubiGen::Commands::Base::ActiveRecord
@@@

I think this error is related to Rails dependencies no satisfied in [RUBIGEN_PATH]/lib/rubigen/commands.rb line 65:

@@@ ruby
Dir.glob(&quot;#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb&quot;).inject(0) do |max, file_path|
@@@

and line 88:
 
@@@ ruby 
if ActiveRecord::Base.timestamped_migrations
@@@

As workaround a simple require 'active_record' would fix it. Obviously this Rails dependencies could be not desired and a few changes in the rubigen gem will remove this dependency. 

Let me know if a you a few test to clarify this issue.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Generate a RubiGen::Base based application generator:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
newgem foobar
script/generate application_generator foobar
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;add this to the manifest method on foobar_generator.rb to test
the migration generation process:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
m.migration_template 'test.rb', 'db/migrate',:migration_file_name =&amp;gt; 'test'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and add a simple migration template:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
class Test &amp;lt; ActiveRecord::Migration
  def self.up
  end

  def self.down
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then try to use this generator:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
chmod +x bin/foobar
bin/foobar test_app
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This throws an &quot;uninitialized constant&quot;:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
uninitialized constant RubiGen::Commands::Base::ActiveRecord
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think this error is related to Rails dependencies no satisfied
in [RUBIGEN_PATH]/lib/rubigen/commands.rb line 65:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
Dir.glob(&amp;quot;#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb&amp;quot;).inject(0) do |max, file_path|
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and line 88:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;
if ActiveRecord::Base.timestamped_migrations
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As workaround a simple require 'active_record' would fix it.
Obviously this Rails dependencies could be not desired and a few
changes in the rubigen gem will remove this dependency.&lt;/p&gt;
&lt;p&gt;Let me know if a you a few test to clarify this issue.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-20T23:05:50+10:00</created-at>
      <creator-id type="integer">10387</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">7</number>
      <permalink>rails-dependencies-introduced-in-rubigen-150</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">19471</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Rails dependencies introduced in rubigen &gt;1.5.0</title>
      <updated-at type="datetime">2009-01-20T23:10:05+10:00</updated-at>
      <user-id type="integer">10387</user-id>
      <user-name>Aitor Garc&#237;a Rey</user-name>
      <creator-name>Aitor Garc&#237;a Rey</creator-name>
      <assigned-user-name>Dr Nic</assigned-user-name>
      <url>http://drnic.lighthouseapp.com/projects/19471/tickets/7</url>
    </version>
    <version type="Ticket::Version">
      <assigned-user-id type="integer">5118</assigned-user-id>
      <attachments-count type="integer">0</attachments-count>
      <body>Sweet, thanks for the summary of the bug. I'll look in to it soon.</body>
      <body-html>&lt;div&gt;&lt;p&gt;Sweet, thanks for the summary of the bug. I'll look in to it
soon.&lt;/p&gt;&lt;/div&gt;</body-html>
      <closed type="boolean">false</closed>
      <created-at type="datetime">2009-01-20T23:15:40+10:00</created-at>
      <creator-id type="integer">10387</creator-id>
      <diffable-attributes type="yaml">--- {}

</diffable-attributes>
      <milestone-id type="integer" nil="true"></milestone-id>
      <number type="integer">7</number>
      <permalink>rails-dependencies-introduced-in-rubigen-150</permalink>
      <priority type="integer">0</priority>
      <project-id type="integer">19471</project-id>
      <state>new</state>
      <tag nil="true"></tag>
      <title>Rails dependencies introduced in rubigen &gt;1.5.0</title>
      <updated-at type="datetime">2009-01-20T23:15:40+10:00</updated-at>
      <user-id type="integer">5118</user-id>
      <user-name>Dr Nic</user-name>
      <creator-name>Aitor Garc&#237;a Rey</creator-name>
      <assigned-user-name>Dr Nic</assigned-user-name>
      <url>http://drnic.lighthouseapp.com/projects/19471/tickets/7</url>
    </version>
  </versions>
</ticket>
