Sha256: 58e0ce5811b003b3dd6f4423b47266724addc976cd45eea8eab4b814e90346cd

Contents?: true

Size: 943 Bytes

Versions: 5

Compression:

Stored size: 943 Bytes

Contents

require_relative '../util/submodule'
require_relative '../util/stash'

module GGSM
  module Delete
    include Submodule
    include Stash

    def delete_flow(branch, remote, all)
      check_submodule

      puts '==> 进入主工程:'.yellow

      delete_branch(all, branch, remote)

      subs = get_submodule
      subs.each do |sub|
        Dir.chdir sub
        puts "==> 进入#{sub}:".yellow
        delete_branch(all, branch, remote)
        Dir.chdir '..'
      end
    end

    def delete_branch(all, branch, remote)
      if all
        system "git branch -D #{branch}"
        result = system "git push origin -d #{branch}"
        unless result
          system 'git fetch -p origin'
        end
      elsif remote
        result = system "git push origin -d #{branch}"
        unless result
          system 'git fetch -p origin'
        end
      else
        system "git branch -D #{branch}"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ggsm-1.3.0 lib/ggsm/flow/delete.rb
ggsm-1.2.0 lib/ggsm/flow/delete.rb
ggsm-1.1.2 lib/ggsm/flow/delete.rb
ggsm-1.1.1 lib/ggsm/flow/delete.rb
ggsm-1.1.0 lib/ggsm/flow/delete.rb