1

I'm using Rails 4.0.0.

I am aware of the commands rails new ... used to create a Rails project via terminal. Are there methods to do this programmatically?

I want to avoid having code invoke a pop-up terminal as not all users may have Linux.

Possible Solution

Programmatially copy existing base Rails project. Write to new directory.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
ma77c
  • 1,052
  • 14
  • 31
  • Yep, just copy a pre-created template. – Sergio Tulentsev Oct 21 '14 at 15:38
  • Have you read this part about [application templates](http://guides.rubyonrails.org/generators.html#application-templates)? Might be relevant for you. It does not get rid of the terminal, but it can help to setup a more complex Rails project. – zwippie Oct 21 '14 at 15:51

1 Answers1

0

You can use the same generator the command rails new uses, for example:

require 'rails/generators/rails/app/app_generator'
Rails::Generators::AppGenerator.start ['bar', '--skip-bundle']

# Output:
# create  
# create  README.rdoc
# create  Rakefile
# create  config.ru
# create  .gitignore
# ...
toro2k
  • 19,020
  • 7
  • 64
  • 71