4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/safe-bundle-update.rb', line 4
def self.start(*commands)
excludes = []
gems = fetch_gems
puts "#{gems.size} gems to be updated"
while gem = gems.detect { |name| !excludes.include?(name) }
puts "Updating #{gem}..."
next excludes << gem unless try_system("bundle update #{gem}", gem)
if `git status | grep "nothing to commit, working tree clean" | wc -l`.strip.to_i == 1
excludes << gem
puts "Nothing changed".red
next
end
next excludes << gem unless commands.all? { |cmd| try_system(cmd, gem, color: :yellow, null: false) }
try_system("git add .", gem)
try_system("git commit -m 'Updating #{gem}'", gem, color: :green)
gems = fetch_gems
end
end
|