Sha256: ecb76d597f82730e437690425a4c2b7a554318916fbf0004b29f8d5f3756c939

Contents?: true

Size: 975 Bytes

Versions: 1

Compression:

Stored size: 975 Bytes

Contents

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

module GGSM
  module Delete
    include Submodule
    include Stash

    def delete_flow(branch, remote, all)
      unless check_submodule
        return
      end

      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

1 entries across 1 versions & 1 rubygems

Version Path
ggsm-1.0.2 lib/ggsm/flow/delete.rb