Sha256: e6da27e6eb4cd613e1c0d9d3747dc4193b10f85454f60104534f867a3ff44010

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'colorize'
require_relative '../util/submodule'
require_relative '../util/stash'

module GGSM
  module Finish
    include Submodule
    include Stash

    def start_flow(branch, action)
      unless check_submodule
        return
      end

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

      arry_conflict = []

      need_stash = try_stash
      result = system "git checkout -b #{branch} #{action}"
      if need_stash
        stash_pop(arry_conflict, '主工程')
      end

      unless result
        return
      end

      `git submodule update --init --recursive`

      subs = get_submodule
      subs.each do |sub|
        Dir.chdir sub
        puts "==> 进入#{sub}:".yellow
        need_stash = try_stash
        system "git checkout -b #{branch}"
        if need_stash
          stash_pop(arry_conflict, sub)
        end
        Dir.chdir '..'
      end

      if arry_conflict.size > 0
        tip = '==> 冲突待解决:'
        arry_conflict.each do |sub|
          tip = "#{tip}  #{sub}"
        end
        puts tip.red
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ggsm-1.0.1 lib/ggsm/flow/finish.rb