fix about Gemfile.lock.(Make the folder name be about revision(commit id) if gem package has an revision number)
This commit is contained in:
parent
6e56a10e98
commit
b890c6ec3b
|
@ -187,7 +187,6 @@ module Bundler
|
|||
rescue PathError => e
|
||||
Bundler.ui.trace e
|
||||
raise GitError, "#{to_s} is not yet checked out. Run `bundle install` first."
|
||||
git_proxy.checkout
|
||||
end
|
||||
|
||||
# This is the path which is going to contain a cache
|
||||
|
|
|
@ -75,7 +75,9 @@ module Bundler
|
|||
Bundler.ui.confirm "Updating #{uri}"
|
||||
FileUtils.cd(path)
|
||||
git_retry %|fetch --force --quiet --tags #{uri_escaped} "refs/heads/*:refs/heads/*"|
|
||||
@commit_num = `git log -1 --pretty=format:"%H"`[0..11]
|
||||
if path.to_s.include?("cache")
|
||||
@commit_num = `git log -1 --pretty=format:"%H"`[0..11] if revision.nil?
|
||||
@commit_num = revision[0..11] if !revision.nil?
|
||||
@new_path = path.dirname
|
||||
@old_folder_name = path.basename.to_s + '/'
|
||||
@fold_name =''
|
||||
|
@ -85,6 +87,7 @@ module Bundler
|
|||
path = @new_path
|
||||
FileUtils.cd('..')
|
||||
FileUtils.mv( @old_folder_name , path.basename.to_s+'/') if ( Dir.exist?(path.basename.to_s+'/')) == false
|
||||
FileUtils.rmdir @old_folder_name.to_s if ( Dir.exist?(@old_folder_name.to_s+'/') && (@old_folder_name.to_s != path.basename.to_s))
|
||||
FileUtils.cd(@new_path.to_s)
|
||||
@path_destination = Pathname.new(path.dirname)
|
||||
@path_destination= @path_destination.parent.parent.parent + Pathname.new("bundler/gems/#{path.basename}")
|
||||
|
@ -104,7 +107,17 @@ module Bundler
|
|||
@gemspec_name = ''
|
||||
FileUtils.cd(@path_destination.to_s)
|
||||
`ls`.split.each{|name| (@gemspec_name = name.to_s and break) if (name.include? '.gemspec') == true}
|
||||
Dir.chdir(Bundler.root.to_s) do
|
||||
Bundler::load_gemspec("#{@path_destination}/#{@gemspec_name}") rescue puts "you don't have .gemspec file at #{@path_destination}"
|
||||
end
|
||||
else
|
||||
@gemspec_name = ''
|
||||
FileUtils.cd(path.to_s)
|
||||
`ls`.split.each{|name| (@gemspec_name = name.to_s and break) if (name.include? '.gemspec') == true}
|
||||
Dir.chdir(Bundler.root.to_s) do
|
||||
Bundler::load_gemspec("#{path}/#{@gemspec_name}") rescue puts "you don't have .gemspec file at #{path}"
|
||||
end
|
||||
end
|
||||
FileUtils.cd(@old_pwd)
|
||||
end
|
||||
else
|
||||
|
@ -112,9 +125,11 @@ module Bundler
|
|||
if path != nil
|
||||
FileUtils.mkdir_p(path.dirname)
|
||||
git_retry %|clone #{uri_escaped} "#{path}" --bare --no-hardlinks --quiet|
|
||||
if path.to_s.include?("cache")
|
||||
FileUtils.cd(path)
|
||||
git_retry %|fetch --all|
|
||||
@commit_num = `git log -1 --pretty=format:"%H"`[0..11]
|
||||
@commit_num = `git log -1 --pretty=format:"%H"`[0..11] if revision.nil?
|
||||
@commit_num = revision[0..11] if !revision.nil?
|
||||
@new_path = path.dirname
|
||||
@old_folder_name = path.basename.to_s + '/'
|
||||
@fold_name =''
|
||||
|
@ -124,6 +139,7 @@ module Bundler
|
|||
path = @new_path
|
||||
FileUtils.cd('..')
|
||||
FileUtils.mv( @old_folder_name , path.basename.to_s+'/') if (Dir.exist? (path.basename.to_s+'/')) == false
|
||||
FileUtils.rmdir @old_folder_name.to_s if ( Dir.exist?(@old_folder_name.to_s+'/') && (@old_folder_name.to_s != path.basename.to_s))
|
||||
FileUtils.cd(@new_path.to_s)
|
||||
@path_destination = Pathname.new(path.dirname)
|
||||
@path_destination= @path_destination.parent.parent.parent + Pathname.new("bundler/gems/#{path.basename}")
|
||||
|
@ -143,9 +159,23 @@ module Bundler
|
|||
@gemspec_name = ''
|
||||
FileUtils.cd(@path_destination.to_s)
|
||||
`ls`.split.each{|name| (@gemspec_name = name.to_s and break) if (name.include? '.gemspec') == true}
|
||||
@EXT_LOCK.synchronize do
|
||||
Dir.chdir(Bundler.root.to_s) do
|
||||
Bundler::load_gemspec("#{@path_destination}/#{@gemspec_name}") rescue puts "you don't have .gemspec file at #{@path_destination}"
|
||||
end
|
||||
end
|
||||
else
|
||||
@gemspec_name = ''
|
||||
FileUtils.cd(path.to_s)
|
||||
`ls`.split.each{|name| (@gemspec_name = name.to_s and break) if (name.include? '.gemspec') == true}
|
||||
@EXT_LOCK.synchronize do
|
||||
Dir.chdir(Bundler.root.to_s) do
|
||||
Bundler::load_gemspec("#{path}/#{@gemspec_name}") rescue puts "you don't have .gemspec file at #{path}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
FileUtils.cd(@org_pwd)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue