I've been stuck on this one for a while. I'm trying to run a rails shell command from my cocoa application to create a news rails app. When I run
~/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/bin/rails new projectname
I'm able to create a new project. But if I run something like this
NSString *path = @"~/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/bin/rails";
NSString *script = [NSString stringWithFormat:@"%@ new ~/Desktop/testapp", path];
system([script UTF8String]);
or this
- (IBAction)buildProject:(NSButton *)sender
{
NSString *path = @"~/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/bin/rails";
NSArray *args = [NSArray arrayWithObjects:@"new", @"~/Desktop/testapp", nil];
NSTask *task = [NSTask new];
[task setLaunchPath:path];
[task setArguments:args];
[task launch];
}
I get the following error
/Users/dylanross/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/bin/rails:7:in `require': no such file to load -- rails/cli (LoadError)
from /Users/dylanross/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/bin/rails:7