我已经坚持了一段时间了。我正在尝试从我的可可应用程序运行 rails shell 命令来创建一个新闻 rails 应用程序。当我跑
~/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.3/bin/rails new projectname
我能够创建一个新项目。但是如果我运行这样的东西
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]);
或这个
- (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];
}
我收到以下错误
/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