Sha256: 78f09cd2c8a12faff4598002ea261fbcab55c7d2d82b49111b42cd0ad11035c1

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

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

module GGSM
  module Foreach
    include Submodule
    include Stash

    def foreach_flow(*commands)
      unless check_submodule
        return
      end

      cmd = ''
      if commands.size == 0
        puts '请输入正确git命令 foreach [<commands>...]'.red
        return
      elsif commands.fetch(0) == 'git'
        commands.delete_at(0)
      end

      commands.each do |arg|
        cmd = "#{cmd} #{arg}"
      end

      subs = get_submodule
      subs.each do |sub|
        Dir.chdir sub
        puts "==> *进入#{sub}:".yellow
        system "git #{cmd}"
        Dir.chdir '..'
      end

      puts '==> *进入主工程:'.yellow
      system "git #{cmd}"

      puts "Modules执行:git#{cmd}".blue
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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