lib/spaarti/repo.rb in spaarti-0.1.0 vs lib/spaarti/repo.rb in spaarti-1.0.0
- old
+ new
@@ -33,11 +33,11 @@
def err(msg)
STDERR.puts msg
end
def run(cmd, error_msg)
- res = system "#{cmd} &>/dev/null"
+ res = system "#{cmd} 1>/dev/null 2>/dev/null"
err(error_msg) unless res
end
def url
@url ||= @data["#{@options[:url_type]}_url".to_sym]
@@ -45,11 +45,11 @@
def clone
return log("#{@data[:full_name]} already cloned") if Dir.exist? @path
log "Cloning #{url} to #{@path}"
run(
- "git clone '#{url}' '#{@path}' &>/dev/null",
+ "git clone '#{url}' '#{@path}'",
"Failed to clone #{url}"
)
end
def config
@@ -67,12 +67,14 @@
"Failed to add upstrema for #{@path}"
)
end
def update_submodules
- run(
- 'git submodule update --init',
- "Failed to update submodules in #{@path}"
- )
+ ['foreach git fetch --all --tags', 'update --init'].each do |cmd|
+ run(
+ "git submodule #{cmd}",
+ "Failed to update submodules in #{@path}"
+ )
+ end
end
end
end