lib/hem/util.rb in hem-1.0.1.beta6 vs lib/hem/util.rb in hem-1.1.0
- old
+ new
@@ -32,11 +32,14 @@
@progress_bar_cache[file] ||= ProgressBar.create(opts)
case type
when :update
- @progress_bar_cache[file].progress += increment
+ @progress_bar_cache[file].progress = [
+ @progress_bar_cache[file].progress + increment,
+ total
+ ].min
when :finished
@progress_bar_cache[file].finish
end
return @progress_bar_cache[file]
@@ -57,24 +60,11 @@
def system_ruby?
require 'rbconfig'
File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"]).match(/\/rvm\/|\/\.rvm\/|\/\.rbenv/) != nil
end
- def chefdk_compat
- return if maybe(Hem.user_config.hem.disable_chefdk_compat) || ENV['HEM_DISABLE_CHEFDK_COMPAT']
- return if Hem.windows?
- which_ruby = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"])
- if which_ruby =~ /rbenv/
- split_path = ENV['PATH'].split ':'
- paths = split_path.reject do |p|
- p =~ /chefdk/
- end
- chef_paths = split_path - paths
- ENV['PATH'] = (chef_paths + paths).join ':'
- end
- end
-
def vagrant_plugin plugin, constraint = nil
- return [plugin, constraint]
+ return [plugin, nil] if constraint.nil?
+ return [plugin, Gem::Dependency.new(plugin, constraint)]
end
end
end