Solution :
#!/usr/bin/env ruby
class X
def test2
require File.dirname(__FILE__) + ''/../config/boot''
require "#{RAILS_ROOT}/config/environment"
require ''rails_generator''
require ''rails_generator/scripts/generate''
Rails::Generator::Scripts::Generate.new.run([''controller'',''dil''])
end
end
On Jun 12, 1:38 pm, halvor
<goo...-VB7vxwriQfy6NMhornyX/PXRex20P6io@public.gmane.org>
wrote:> Hello,
>
> this should be a straightfoward question.
> I was wondering how to do the equivalent of :
> ruby script/generate controller MyNewController
>
> from within a .rb file.
> I would then want to call the .rb script from my rails application.
> Thanks in advance
>
> Hal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---