lib/git/multi.rb in git-multi-1.0.5 vs lib/git/multi.rb in git-multi-1.0.6

- old
+ new

@@ -6,18 +6,19 @@ require 'octokit' require 'sawyer' require 'ext/dir' -require 'ext/utils' require 'ext/string' require 'ext/notify' +require 'ext/kernel' require 'ext/commify' require 'ext/sawyer/resource' require 'git/hub' +require 'git/multi/utils' require 'git/multi/version' require 'git/multi/settings' require 'git/multi/commands' module Git @@ -84,22 +85,19 @@ # the main `Git::Multi` capabilities # module Nike - def just_do_it interactive, pipeline, options = {} - working_dir = case options[:in_dir] - when :parent_dir then self.parent_dir - when :local_path then self.local_path - else Dir.pwd - end + def just_do_it(interactive, pipeline, options = {}) + working_dir = case (options[:in] || '').to_sym + when :parent_dir then parent_dir + when :local_path then local_path + else Dir.pwd + end Dir.chdir(working_dir) do - if $INTERACTIVE - puts "%s (%s)" % [ - self.full_name.invert, - self.fractional_index - ] + if interactive? + puts "#{full_name.invert} (#{fractional_index})" interactive.call(self) else pipeline.call(self) end end @@ -107,28 +105,31 @@ end def repositories if File.size?(REPOSITORIES) + # rubocop:disable Security/MarshalLoad @repositories ||= Marshal.load(File.read(REPOSITORIES)).tap do |projects| notify "Finished loading #{REPOSITORIES}" projects.each_with_index do |project, index| # ensure 'project' has handle on an Octokit client project.client = Git::Hub.send(:client) # adorn 'project', which is a Sawyer::Resource project.parent_dir = Pathname.new(File.join(WORKAREA, project.owner.login)) project.local_path = Pathname.new(File.join(WORKAREA, project.full_name)) project.fractional_index = "#{index + 1}/#{projects.count}" # fix 'project' => https://github.com/octokit/octokit.rb/issues/727 - project.compliant_ssh_url = 'ssh://%s/%s' % project.ssh_url.split(':', 2) + project.compliant_ssh_url = 'ssh://' + project.ssh_url.split(':', 2).join('/') # remove optional '.git' suffix from 'git@github.com:pvdb/git-multi.git' project.abbreviated_ssh_url = project.ssh_url.chomp('.git') # extend 'project' with 'just do it' capabilities project.extend Nike end end + # rubocop:enable Security/MarshalLoad else - refresh_repositories and repositories + refresh_repositories + repositories # retry end end # # lists of repositories with a given state