Module: MGit

Includes:
Foundation
Defined in:
lib/m-git.rb,
lib/m-git.rb,
lib/m-git/argv.rb,
lib/m-git/repo.rb,
lib/m-git/error.rb,
lib/m-git/version.rb,
lib/m-git/argv/opt.rb,
lib/m-git/manifest.rb,
lib/m-git/open_api.rb,
lib/m-git/workspace.rb,
lib/m-git/foundation.rb,
lib/m-git/argv/parser.rb,
lib/m-git/command/add.rb,
lib/m-git/command/log.rb,
lib/m-git/command/tag.rb,
lib/m-git/repo/status.rb,
lib/m-git/base_command.rb,
lib/m-git/command/info.rb,
lib/m-git/command/init.rb,
lib/m-git/command/pull.rb,
lib/m-git/command/push.rb,
lib/m-git/command/self.rb,
lib/m-git/command/sync.rb,
lib/m-git/argv/opt_list.rb,
lib/m-git/command/clean.rb,
lib/m-git/command/fetch.rb,
lib/m-git/command/merge.rb,
lib/m-git/command/reset.rb,
lib/m-git/command/stash.rb,
lib/m-git/hooks_manager.rb,
lib/m-git/output/output.rb,
lib/m-git/command/branch.rb,
lib/m-git/command/commit.rb,
lib/m-git/command/config.rb,
lib/m-git/command/delete.rb,
lib/m-git/command/forall.rb,
lib/m-git/command/rebase.rb,
lib/m-git/command/status.rb,
lib/m-git/plugin_manager.rb,
lib/m-git/command_manager.rb,
lib/m-git/foundation/lock.rb,
lib/m-git/manifest/linter.rb,
lib/m-git/command/checkout.rb,
lib/m-git/foundation/loger.rb,
lib/m-git/foundation/timer.rb,
lib/m-git/foundation/utils.rb,
lib/m-git/repo/sync_helper.rb,
lib/m-git/manifest/internal.rb,
lib/m-git/template/pre_hook.rb,
lib/m-git/template/post_hook.rb,
lib/m-git/manifest/light_repo.rb,
lib/m-git/foundation/constants.rb,
lib/m-git/workspace/path_helper.rb,
lib/m-git/foundation/mgit_config.rb,
lib/m-git/manifest/cache_manager.rb,
lib/m-git/template/manifest_hook.rb,
lib/m-git/template/pre_exec_hook.rb,
lib/m-git/template/pre_push_hook.rb,
lib/m-git/template/local_manifest.rb,
lib/m-git/workspace/workspace_helper.rb,
lib/m-git/template/post_download_hook.rb,
lib/m-git/foundation/duration_recorder.rb,
lib/m-git/foundation/git_message_parser.rb,
lib/m-git/manifest/light_repo_generator.rb,
lib/m-git/open_api/script_download_info.rb,
lib/m-git/foundation/operation_progress_manager.rb

Defined Under Namespace

Modules: Constants, Foundation, HooksManager, Output, Template, Utils Classes: ARGV, Add, BaseCommand, Branch, Checkout, Clean, CommandManager, Commit, Config, Delete, DurationRecorder, Error, Fetch, Forall, GitMessageParser, Info, Init, Lock, Log, Loger, MGitConfig, Manifest, Merge, OpenApi, OperationProgressContext, OperationProgressManager, PluginManager, Pull, Push, Rebase, Repo, Reset, Self, Stash, Status, Sync, Tag, Timer, Workspace

Constant Summary collapse

MGIT_ERROR_TYPE =
{
  :config_name_error => 'config_name_error',
  :config_generate_error => 'config_generate_error'
}.freeze
VERSION =
"2.5.8".freeze
RepoConfig =
Manifest

Class Method Summary collapse

Methods included from Foundation

help!

Class Method Details

.run(raw_argv) ⇒ Object

input



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/m-git.rb', line 47

def run(raw_argv)
  # 处理不带子命令或带全局参数的输入,如果带全局参数,目前版本对后续附加的子命令不处理。
  raw_argv.unshift('self') if (raw_argv.first.nil? || (raw_argv.first =~ /-/) == 0)
  need_verbose = raw_argv.delete('--verbose') || $__VERBOSE__ || false
  argv = ARGV::Parser.parse(raw_argv)

  begin
    # 特殊处理'base'
    cmd_class = CommandManager[argv.cmd]
    Foundation.help!("调用非法指令\"#{argv.cmd}\"") if cmd_class.nil?
    cmd_class.new(argv).run
  rescue => e
    Output.puts_fail_message("执行该指令时发生异常:#{argv.cmd}")
    Output.puts_fail_message("异常信息:#{e.message}")
    Output.puts_fail_message("异常位置:#{e.backtrace.join("\n")}") if need_verbose
    exit
  end
end