Sha256: 8011f6ca99d26d222116c846ba1d3b8ba4244af74de3911263a60c1b99dd3ae1

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

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

module GGSM
  module Start
    include Submodule
    include Stash

    def start_flow(branch, action)
      check_submodule

      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

4 entries across 4 versions & 1 rubygems

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