Background: I wrote a short script in MRI 1.9.2p320 for updating all my projects – http://git.io/eez8Kg . Tool which i utilize for the updating/pulling itself (git-up) is also able to automatically bundle project after it discover changed Gemfile. The problem is, that when i change directory in the Ruby script, it does not respect rvmrc/gemset of projects (each project has it's own gemset).
Question: How can i achieve to make cd
in Ruby script behave same as in my terminal
I've tried:
- replace
Dir.chdir
with cd command in the `s - replace
Dir.chdir
with cd command in the `s prepended withzsh -ci
Code:
Find.find('../..') do |f|
if f =~ /\.git$/
repository = f.gsub /\.git$/, ''
Logger.new(STDOUT).info('Checking '){repository}
Dir.chdir(repository){
puts `git up`
}
end
end