Sha256: abf64dbec43bfff86087948c2db1c00074cc84fb59770bc35cd60ef102658a22

Contents?: true

Size: 1.3 KB

Versions: 16

Compression:

Stored size: 1.3 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 = []
      current_branch = get_current_branch

      need_stash = try_stash
      if action.start_with?('origin/')
        need_fetch = `git fetch`
        if need_fetch != ''
          `git submodule foreach git fetch | grep 'ignored'`
        end
      end
      result = system "git checkout -b #{branch} #{action}"
      if need_stash
        stash_pop(arry_conflict, '主工程')
      end

      unless result
        return
      end

      result = system 'git submodule update --init --recursive'
      unless result
        tip_contact_author
        `git checkout #{current_branch};git branch -D #{branch}`
        return
      end

      foreach_module {|sub|
        need_stash = try_stash
        system "git checkout -b #{branch}"
        if need_stash
          stash_pop(arry_conflict, sub)
        end
      }

      if arry_conflict.size > 0
        tip = "==> #{arry_conflict.size}个模块冲突:"
        arry_conflict.each do |sub|
          tip = "#{tip}  #{sub}"
        end
        puts tip.red
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ggsm-1.9.6 lib/ggsm/command/start.rb
ggsm-1.9.5 lib/ggsm/command/start.rb
ggsm-1.9.4 lib/ggsm/command/start.rb
ggsm-1.9.3 lib/ggsm/command/start.rb
ggsm-1.9.2 lib/ggsm/command/start.rb
ggsm-1.9.1 lib/ggsm/command/start.rb
ggsm-1.9.0 lib/ggsm/command/start.rb
ggsm-1.8.6 lib/ggsm/command/start.rb
ggsm-1.8.5 lib/ggsm/command/start.rb
ggsm-1.8.4 lib/ggsm/command/start.rb
ggsm-1.8.3 lib/ggsm/command/start.rb
ggsm-1.8.2 lib/ggsm/command/start.rb
ggsm-1.8.1 lib/ggsm/command/start.rb
ggsm-1.8.0 lib/ggsm/command/start.rb
ggsm-1.7.6 lib/ggsm/command/start.rb
ggsm-1.7.5 lib/ggsm/command/start.rb