0
我試圖下載幾個示例rails項目中列出的ruby gems,我通過bundle install
下載了最新版本的ruby,通過RVM安裝,按照指示here正確下載捆綁器文件中列出的寶石。我想我會加快這個perl腳本的過程:(不太使用bash舒適又不失):perl:File :: Copy:在閱讀現有文件時沒有這樣的文件或目錄錯誤
#!/usr/bin/perl
use File::Copy qq(copy);
use strict;
use warnings;
my @files = `ls`;
foreach my $dir (@files)
{
chomp $dir;
if(-d $dir)
{
print "\n\n\tabout to enter $dir\n\n\n";
print `cd "$dir"`;
system("echo \"2.2.0\" > .ruby-version");
system("echo \"$dir\" > .ruby-gemset");
copy("Gemfile", "tmp.save") or die "copy: $!\n";
open(RD,"<tmp.save") or die "$dir: tmp.save: $!\n";
open(WR,">Gemfile") or die "$dir: Gemfile: $!\n";
print WR <RD>;
print WR "\n";
print WR "ruby \'2.2.0\'";
print WR "\n\n";
while(<RD>) { print WR $_; print WR "\n"; }
close(RD); close(WR);
print `cd ..`;
print `cd "$dir"`;
print `bundle install`;
print `cd ..`;
}
}
錯誤是:
copy: No such file or directory
文件明顯存在這些項目大概有創建rails <name>
命令。爲什麼會發生這種情況,我該如何解決?