lib/pione/location/git-repository-location.rb in pione-0.2.2 vs lib/pione/location/git-repository-location.rb in pione-0.3.0

- old
+ new

@@ -19,11 +19,11 @@ self.class.new({git: @address, tag: @tag, branch: @branch, hash_id: @hash_id}.merge(option)) end # Return the local location of repository. def local - Global.git_repository_directory + @address_digest + return Global.git_repository_directory + @address_digest end # Return true if the local location exists. def has_local? local.exist? @@ -73,12 +73,10 @@ return short_hash_id(id) end # Export git repository by hash id. def export(location) - clone_to_local unless has_local? - hash_id = compact_hash_id # git archive path = Temppath.mkdir + "archive.zip" ChildProcess.build("git", "archive", "-o", path.to_s, hash_id).tap do |process| @@ -89,20 +87,11 @@ raise GitError.new(@location, message: "'git archive' failed") end end # unzip - local = Location[Temppath.mkdir] - Util::Zip.uncompress(Location[path], local) - - # update package.yml - info = YAML.load((local + "package.yml").read) - info["HashID"] = hash_id - (local + "package.yml").update(YAML.dump(info)) - - # upload - local.entries.each {|entry| entry.move(location)} + Util::Zip.uncompress(Location[path], location) end private # Call "git clone" from the repository into local location. @@ -116,17 +105,17 @@ process = ChildProcess.build("git", "clone", @address, local.path.to_s) process.io.stdout = out process.start process.wait - # show debug message - out.rewind - ErrorReport.debug("git clone: %s" % out.read, self, __FILE__, __LINE__) - # check the process result if process.crashed? raise GitError.new(self, message: "'git clone' failed") end + + # show debug message + out.rewind + Log::Debug.system("git clone: %s" % out.read) end # Return short hash id. def short_hash_id(hash_id) out = Temppath.create.open("w+")