Sha256: 280dc55847ed54723642734c9076798e7578c03c8a8ca7e2783a8ffbc6d891bd

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 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}"
        system "git push origin -d #{branch}"
      elsif remote
        system "git push origin -d #{branch}"
      else
        system "git branch -D #{branch}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ggsm-1.0.1 lib/ggsm/flow/delete.rb
ggsm-1.0.0 lib/ggsm/flow/delete.rb