source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
swistak35/orbacle
https://github.com/swistak35/orbacle
lib/orbacle/define_builtins.rb
Ruby
mit
186
master
7,451
# frozen_string_literal: true module Orbacle class DefineBuiltins def initialize(graph, tree, id_generator) @graph = graph @tree = tree @id_generator = id_generator end def call add_object_klass add_dir_klass add_file_klass add_integer_klass add_array_klas...
github
swistak35/orbacle
https://github.com/swistak35/orbacle
lib/orbacle/nesting.rb
Ruby
mit
186
master
1,379
# frozen_string_literal: true module Orbacle class Nesting class ConstLevel < Struct.new(:const_ref) def full_name const_ref.full_name end def absolute? const_ref.absolute? end def eigenclass? false end end class ClassConstLevel < Struct.new(...
github
swistak35/orbacle
https://github.com/swistak35/orbacle
lib/orbacle/builder/operator_assignment_processors.rb
Ruby
mit
186
master
2,803
# frozen_string_literal: true module Orbacle class Builder module OperatorAssignmentProcessors def handle_op_asgn(ast, context) partial_assignment_ast, operator_name, argument_ast = ast.children return process( complete_assignment( partial_assignment_ast, ...
github
swistak35/orbacle
https://github.com/swistak35/orbacle
lib/orbacle/builder/context.rb
Ruby
mit
186
master
2,146
# frozen_string_literal: true module Orbacle class Builder class Context AnalyzedKlass = Struct.new(:klass_id, :method_visibility) def initialize(filepath, selfie, nesting, analyzed_klass, analyzed_method, lenv) @filepath = filepath.freeze @selfie = selfie.freeze @nesting = n...
github
baidu/m-git
https://github.com/baidu/m-git
m-git.gemspec
Ruby
mit
186
master
2,090
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "m-git/version" Gem::Specification.new do |spec| spec.name = "m-git" spec.version = MGit::VERSION spec.authors = ["zhangyu81"] spec.summary = %q{A multi-repository management to...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git.rb
Ruby
mit
186
master
1,583
$:.unshift __dir__ require 'open3' require 'fileutils' require 'json' require 'digest' require 'pathname' require 'uri' require 'yaml' require 'securerandom' require 'colored2' require 'peach' require 'tty-pager' require 'm-git/foundation' require 'm-git/output/output' module MGit include MGit::Foundation end req...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/error.rb
Ruby
mit
186
master
326
#coding=utf-8 module MGit MGIT_ERROR_TYPE = { :config_name_error => 'config_name_error', :config_generate_error => 'config_generate_error' }.freeze class Error < StandardError attr_reader :msg attr_reader :type def initialize(msg, type:nil) @msg = msg @type = type end end...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/manifest.rb
Ruby
mit
186
master
6,059
#coding=utf-8 require 'm-git/manifest/light_repo' require 'm-git/manifest/linter' require 'm-git/manifest/internal' module MGit # Sample: 'm-git/manifest/manifest.sample' # class Manifest include Linter include Internal # [Hash] 配置内容 attr_reader :config # [String] 配置表内容哈希 # attr_reade...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/plugin_manager.rb
Ruby
mit
186
master
3,905
module MGit class PluginManager # @!scope 加载插件 # 1. 先加载本地源码插件 # 2. 搜索加载gem插件 # 3. 处理加载注入的插件 # def self.setup lib_dir = File.dirname(__FILE__) plugins_dir = File.join(File.dirname(File.dirname(lib_dir)), 'plugins') load_local_plugin_dir('mgit', plugins_dir) load_local_p...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation.rb
Ruby
mit
186
master
599
#coding=utf-8 require 'm-git/foundation/constants' require 'm-git/foundation/dir' require 'm-git/foundation/git_message_parser' require 'm-git/foundation/lock' require 'm-git/foundation/loger' require 'm-git/foundation/duration_recorder' require 'm-git/foundation/mgit_config' require 'm-git/foundation/operation_progre...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command_manager.rb
Ruby
mit
186
master
359
module MGit class CommandManager class << self # cmd generate # def commands @commands ||= {} end def register_command(cmd, cls) commands[cmd] = cls end def [](cmd) class_with_command(cmd) end def class_with_command(cmd) comm...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/argv.rb
Ruby
mit
186
master
4,995
#coding=utf-8 module MGit # 参数处理类 class ARGV require 'm-git/argv/opt' require 'm-git/argv/opt_list' require 'm-git/argv/parser' # 指令名,如:"mgit checkout -b branch_name"的"checkout" attr_reader :cmd # 所有参数,如:"mgit checkout -b branch_name"的"checkout -b branch_name" attr_reader :pure_opts...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/repo.rb
Ruby
mit
186
master
3,978
#coding=utf-8 require 'm-git/repo/status' require 'm-git/repo/sync_helper' module MGit class Repo # 仓库名 attr_reader :name # 仓库实体完整路径 attr_reader :path # 仓库状态检查器 attr_reader :status_checker # 配置文件中的设置:Manifest::LightRepo attr_reader :config def initialize(name, path, config:...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/open_api.rb
Ruby
mit
186
master
16,425
#coding=utf-8 require 'm-git/open_api/script_download_info' module MGit # --- Ruby环境调用 --- class OpenApi class << self # 根据配置表下载仓库,并同步工作区 # # @param config_content [String/Hash] 配置表json字符串或字典(key值需为String),不可为nil。 # # @param download_root [String] 仓库下载的根目录,不可为nil。 # ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/base_command.rb
Ruby
mit
186
master
8,734
#coding=utf-8 # require 'm-git/command_manager' module MGit class BaseCommand def self.inherited(sub_klass) CommandManager.register_command(sub_klass.cmd, sub_klass) end # 当前命令行的命令比如checkout / status /.. def self.cmd name.split('::').last.downcase end # 引入所有自定义指令 Dir[File....
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/hooks_manager.rb
Ruby
mit
186
master
3,441
module MGit module HooksManager # --- 执行hook --- class << self # 获取配置表前执行的hook # # @param strict_mode [Boolean] default: true 严格模式下出错直接终止,非严格模式下出错抛出异常 # # @return [Type] description_of_returned_object # def execute_manifest_hook(strict_mode:true) __execute_hook_...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/template.rb
Ruby
mit
186
master
284
#coding=utf-8 require 'm-git/template/local_manifest' require 'm-git/template/manifest_hook' require 'm-git/template/post_download_hook' require 'm-git/template/post_hook' require 'm-git/template/pre_exec_hook' require 'm-git/template/pre_hook' require 'm-git/template/pre_push_hook'
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/workspace.rb
Ruby
mit
186
master
22,455
require 'm-git/workspace/workspace_helper' require 'm-git/workspace/path_helper' module MGit class Workspace # @!attribute 仓库过滤器,过滤执行的仓库 # RepoFilterConfig = Struct.new(:auto_exec, :include_lock, :select_repos, :exclude_repos) class << self include WorkspaceHelper include PathHelper ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/workspace/path_helper.rb
Ruby
mit
186
master
1,271
module MGit class Workspace # .mgit 目录下的文件路径 # module PathHelper # .mgit/config.yml # def config_file File.join(root, Constants::MGIT_CONFIG_PATH) end # .mgit/hooks # def hooks_dir File.join(root, Constants::PROJECT_DIR[:hooks]) end ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/workspace/workspace_helper.rb
Ruby
mit
186
master
5,611
#coding=utf-8 module MGit class Workspace module WorkspaceHelper # 弹出托管的.git实体 # # @param root [String] mgit工程根目录 # # @param light_repo [Manifest::LightRepo] 操作仓库的配置repo # def pop_git_entity(root, light_repo) # 仓库工作区目录 repo_dir = light_repo.abs_dest(root)...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/template/pre_push_hook.rb
Ruby
mit
186
master
554
#coding=utf-8 module MGit module Template PRE_CUSTOMIZED_PUSH_HOOK_TEMPLATE = ' #coding=utf-8 module MGitTemplate class PrePushHook # hook接口,用于接受push指令执行后的数据 # # @param cmd [String] 本次执行指令 # # @param opts [String] 本次执行指令参数 # # @param mgit_root [String] mgit根目录 # # @param...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/template/post_hook.rb
Ruby
mit
186
master
548
#coding=utf-8 module MGit module Template POST_CUSTOMIZED_HOOK_TEMPLATE = ' #coding=utf-8 module MGitTemplate class PostHook # hook接口,用于接受本次指令执行后的数据 # # @param cmd [String] 本次执行指令 # # @param opts [String] 本次执行指令参数 # # @param mgit_root [String] mgit根目录 # # @param exec_repo...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/template/pre_exec_hook.rb
Ruby
mit
186
master
555
#coding=utf-8 module MGit module Template PRE_CUSTOMIZED_EXEC_HOOK_TEMPLATE = ' #coding=utf-8 module MGitTemplate class PreExecHook # hook接口,用于接受本次指令执行前的数据 # # @param cmd [String] 本次执行指令 # # @param opts [String] 本次执行指令参数 # # @param mgit_root [String] mgit根目录 # # @param ex...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/template/pre_hook.rb
Ruby
mit
186
master
438
#coding=utf-8 module MGit module Template PRE_CUSTOMIZED_HOOK_TEMPLATE = ' #coding=utf-8 module MGitTemplate class PreHook # hook接口,用于接受本次指令执行前的数据 # # @param cmd [String] 本次执行指令 # # @param opts [String] 本次执行指令参数 # # @param mgit_root [String] mgit根目录 # def self.run(cmd, op...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/template/local_manifest.rb
Ruby
mit
186
master
466
#coding=utf-8 module MGit module Template module_function def default_template return "{ \"#{Constants::CONFIG_KEY[:repositories]}\": { } } " end def local_config_template(config_repo_name) return "{ \"#{Constants::CONFIG_KEY[:mgit_excluded]}\": true, \"#{Constants::CONFIG_KEY[:...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/template/post_download_hook.rb
Ruby
mit
186
master
435
#coding=utf-8 module MGit module Template POST_DOWNLOAD_HOOK_TEMPLATE = ' #coding=utf-8 module MGitTemplate class PostDownloadHook # hook接口,单个仓库下载完成后调用 # # @param name [String] 下载仓库名 # # @param path [String] 下载仓库的本地绝对路径 # # @return [Boolean] 是否改动仓库HEAD # def self.run(name...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/template/manifest_hook.rb
Ruby
mit
186
master
519
#coding=utf-8 module MGit module Template MANIFEST_HOOK_TEMPLATE = ' #coding=utf-8 module MGitTemplate class ManifestHook # hook接口,用于生成manifest.json文件。文件本地地址必须设置为<PROJ_ROOT>/.mgit/source-config/manifest.json # # 若解析失败,可抛出异常: # # raise MGit::Error.new("失败原因...", type: MGit::MGIT_ERROR...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/dir.rb
Ruby
mit
186
master
506
class Dir # 检查传入路径是不是git仓库 # # @param path [String] 仓库路径 # def self.is_git_repo?(path) return false unless File.directory?(path) git_dir = File.join(path, '.git') File.directory?(git_dir) end def self.is_in_git_repo?(path) check_path = path result = is_git_repo?(check_path) while...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/constants.rb
Ruby
mit
186
master
3,841
#coding=utf-8 module MGit module Constants PROJECT_DIR = { :hooks => '.mgit/hooks', :source_config => '.mgit/source-config', :source_git => '.mgit/source-git', :snapshot => '.mgit/snapshot', :log_dir => '.mgit/logs' }.freeze HOOK_NAME = ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/utils.rb
Ruby
mit
186
master
11,900
#coding=utf-8 module MGit module Utils class << self def logical_cpu_num if @logical_cpu_num.nil? begin num = `sysctl -n hw.logicalcpu` num = `cat /proc/cpuinfo | grep "processor" | wc -l` unless $?.success? @logical_cpu_num = num rescue Exce...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/duration_recorder.rb
Ruby
mit
186
master
2,170
#coding=utf-8 module MGit # 计时器 # class DurationRecorder DEFAULT_DURATION_KEY = 'default_duration_key' module Status # 停止态 IDLE = 0 # 暂停态 PAUSE = 1 # 计时中 RUNNING = 2 end include Status @@status = {} @@duration = {} @@time_stamp = {} @@lock ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/mgit_config.rb
Ruby
mit
186
master
6,297
#coding=utf-8 require_relative 'utils' module MGit class MGitConfig CONFIG_KEY = { :managegit => { :info => '是否将.git实体托管给MGit,托管后仓库内的.git目录是软链 (true/false)', :type => 'Boolean', :default => true }, :maxconcurrentcount => { :info ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/operation_progress_manager.rb
Ruby
mit
186
master
3,860
#coding=utf-8 module MGit # 本类用于缓存/加载操作中间态 class OperationProgressContext # 现场信息关键字段 CONTEXT_CMD = 'cmd' CONTEXT_OPTS = 'opts' CONTEXT_BRANCH = 'branch' CONTEXT_REPOS = 'repos' CONTEXT_OTHER = 'other' attr_accessor :type # String: 本次进入中间态的操作类型,可自定义,如'merge_in_progress','rebase_in_...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/lock.rb
Ruby
mit
186
master
575
module MGit class Lock class << self # @!scope 互斥执行锁 # @example # mutex_exec do # exec.. # end def mutex_exec @mutex = Mutex.new if @mutex.nil? @mutex.lock yield if block_given? @mutex.unlock end # @!scope 互斥显示锁 # @example ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/loger.rb
Ruby
mit
186
master
2,884
#coding=utf-8 require 'logger' require 'fileutils' module MGit # 日志模块配置 class Loger MGIT_LOG_FILE_NAME = 'mgit.log' # # 配置Log模块 # # @param root [String] 工程根目录 # def self.config(root) # 是否开启log begin log_enable = MGit::MGitConfig.query_with_key(root, :logenable) ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/timer.rb
Ruby
mit
186
master
2,046
#coding=utf-8 module MGit # 计时器,用于统计指令执行耗时 class Timer @@time_stamp = {} @@duration = {} @@lock = Mutex.new class << self # 开始计时 # # @param repo_name [String] 仓库名 # # @param use_lock [Boolean] default: false 是否加锁 # def start(repo_name, use_lock:false) ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/foundation/git_message_parser.rb
Ruby
mit
186
master
982
module MGit # Git interact message parse with git-server # class GitMessageParser def initialize(url) @url = url end # @return [String] error message # @return [nil] none error # def parse_fetch_msg(input) parse_pull_msg(input) end # @return [String] error message ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/output/output.rb
Ruby
mit
186
master
16,798
#coding=utf-8 require 'm-git/foundation' module MGit module Output class << self # --- 简单输出 --- def puts_cancel_message puts_fail_message("执行取消!") end def puts_succeed_cmd(cmd) puts_success_message("指令[ mgit #{cmd} ]执行成功!") end def puts_start_cmd puts_pr...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/manifest/internal.rb
Ruby
mit
186
master
6,039
require 'm-git/manifest/cache_manager' module MGit class Manifest module Internal # 配置对象 # # @param config_path [String] 配置文件路径或目录 # # @param strict_mode [Boolean] 是否使用严格模式。在严格模式下,出错将终止执行。在非严格模式下,出错将抛出异常,程序有机会继续执行。 # def __setup(config_path, strict_mode) @stric...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/manifest/light_repo_generator.rb
Ruby
mit
186
master
3,049
module MGit class Manifest # @!scope lightrepo生成器 # class LightRepoGenerator # 简单初始化,有写字段缺失,仅包含名字,相对路径,url # # @param name [String] 仓库名 # # @param path [String] 仓库相对路径 # # @param url [String] 仓库url # # @return [LightRepo] 配置对象 # def self.s...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/manifest/light_repo.rb
Ruby
mit
186
master
3,225
#coding=utf-8 require_relative 'light_repo_generator' module MGit class Manifest # @!scope manifest.json 配置的reponsitories 对象 # 该类用于配置解析后的初步处理,其字段与配置文件一致,但不保证与本地仓库状态一致。 # 而Repo类则会校验本地仓库,其状态与本地仓库状态一致,主要用于执行多仓库操作。 # LightRepo = Struct.new( # [String] 仓库名 :name, # [String] 仓...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/manifest/cache_manager.rb
Ruby
mit
186
master
1,218
module MGit class Manifest class CacheManager attr_reader :path attr_reader :hash_sha1 attr_reader :hash_data def load_path(cache_path) return unless File.exist?(cache_path) begin cache = JSON.parse(File.read(cache_path)) rescue => _ Output.put...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/manifest/linter.rb
Ruby
mit
186
master
7,020
module MGit class Manifest module Linter # 校验配置文件路径 # # @param path [Stirng] 配置文件路径或包含配置文件的目录 # # @return [String] 配置文件合法路径 # def lint_manifest_path(path) manifest_name = Constants::CONFIG_FILE_NAME[:manifest] if !File.exists?(path) if File.sym...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/add.rb
Ruby
mit
186
master
750
#coding=utf-8 module MGit # @!scope [command] add # follow git add # eg: mgit add . # class Add < BaseCommand # @overload # def execute(argv) Workspace.check_branch_consistency Output.puts_start_cmd _, error_repos = Workspace.execute_git_cmd_with_repos(argv.cmd, argv.git_opts,...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/pull.rb
Ruby
mit
186
master
15,083
#coding=utf-8 module MGit # @!scope 类似 git pull # class Pull < BaseCommand OPT_LIST = { :no_check => '--no-check', }.freeze def options [ ARGV::Opt.new(OPT_LIST[:no_check], info:'指定该参数意味着执行前跳过仓库的状态检查,直接对指定或所有仓库执行pull操作,有一定风险,请慎重执行。', type: :boolean), ].concat(super) ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/info.rb
Ruby
mit
186
master
2,580
#coding=utf-8 module MGit # @!scope 指定仓库的信息 # class Info < BaseCommand def execute(argv) Output.puts_start_cmd query_repo_names = parse_repo_name(argv) quere_repos = (all_repos + locked_repos).select { |e| query_repo_names.include?(e.name.downcase) } if quere_repos.length > 0 ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/clean.rb
Ruby
mit
186
master
1,941
#coding=utf-8 module MGit # @!scope [command] clean 清除所有仓库中工作区的变更 # follow git combinatorial command # eg: git add . && git reset --hard # class Clean < BaseCommand def execute(argv) Output.puts_start_cmd # 清除中间态 OperationProgressManager::PROGRESS_TYPE.each { |type, type_value| ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/forall.rb
Ruby
mit
186
master
2,472
#coding=utf-8 module MGit # @!scope [command] forall 对管理的仓库依次执行shell命令 # # eg: mgit forall -c 'git status' # class Forall < BaseCommand OPT_LIST = { :command => '--command', :command_s => '-c', :concurrent => '--concurrent', :concurrent_s => '-n', }.freeze def...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/sync.rb
Ruby
mit
186
master
12,342
#coding=utf-8 module MGit # @!scope 同步所有管理的仓库到工作区,可能从远端拉取,可能从本地dump,所以sync后的工作区不一定是分支的最新节点 # 可通过 mgit sync --pull 进行同步后pull到最新节点 # class Sync < BaseCommand OPT_LIST = { :new_repo => '--new-repo', :new_repo_s => '-n', :all => '--all', :all_s => '-a', :cl...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/merge.rb
Ruby
mit
186
master
14,720
#coding=utf-8 module MGit # @!scope 类似 git merge # class Merge < BaseCommand PROGRESS_STAGE = { :new_start => 0, :did_pull_config => 1, :did_refresh_config => 2, :did_pull_sub => 3 }.freeze PROGRESS_STAGE_KEY = 'progress_stage' PROGRESS_AUTO = 'auto_ex...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/config.rb
Ruby
mit
186
master
7,909
#coding=utf-8 module MGit # @!scope [command] config 配置 .mgit/config.yml 文件信息 # # eg: mgit config -s key 'value' # class Config < BaseCommand OPT_LIST = { :create_local => '--create-local', :create_local_s => '-c', :update_manifest => '--update-manifest', ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/reset.rb
Ruby
mit
186
master
620
#coding=utf-8 module MGit # @!scope 类似 git reset # class Reset < BaseCommand def execute(argv) Workspace.check_branch_consistency Output.puts_start_cmd _, error_repos = Workspace.execute_git_cmd_with_repos(argv.cmd, argv.git_opts, all_repos) Output.puts_succeed_cmd(argv.absolute_cm...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/rebase.rb
Ruby
mit
186
master
13,599
#coding=utf-8 module MGit # @!scope 类似 git rebase # class Rebase < BaseCommand PROGRESS_STAGE = { :new_start => 0, :did_pull_config => 1, :did_refresh_config => 2, :did_pull_sub => 3 }.freeze PROGRESS_STAGE_KEY = 'progress_stage' PROGRESS_AUTO = 'auto_...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/status.rb
Ruby
mit
186
master
4,158
#coding=utf-8 module MGit # @!scope 类似 git status # class Status < BaseCommand def execute(argv) Output.puts_processing_message("正在检查各仓库状态...") status_info = {} mutex = Mutex.new mutex_branch = Mutex.new mutex_modification = Mutex.new mutex_other = Mutex.new branc...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/push.rb
Ruby
mit
186
master
11,860
#coding=utf-8 module MGit # @!scope 类似 git push # 可自动生成 git gerrit 评审分支 # mgit push --gerrit # class Push < BaseCommand # 默认是否开启gerrit相关功能 # MGIT_PUSH_GERRIT_ENABLED = false # 默认是否开启topic相关功能,开启后强制开启gerrit MGIT_PUSH_TOPIC_ENABLED = false OPT_LIST = { :gerrit => '--gerri...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/fetch.rb
Ruby
mit
186
master
681
#coding=utf-8 module MGit # @!scope [command] fetch # follow git fetch # eg: mgit fetch # class Fetch < BaseCommand def execute(argv) Output.puts_start_cmd _, error_repos = Workspace.execute_git_cmd_with_repos(argv.cmd, argv.git_opts, all_repos) if error_repos.length == 0 Outpu...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/branch.rb
Ruby
mit
186
master
2,277
#coding=utf-8 module MGit # @!scope [command] branch # follow git branch # eg: mgit branch --compact # class Branch < BaseCommand OPT_LIST = { :compact => '--compact', }.freeze def options [ ARGV::Opt.new(OPT_LIST[:compact], info:"以归类的方式显示所有仓库的当前分支。", type: :boolean) ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/tag.rb
Ruby
mit
186
master
1,571
#coding=utf-8 module MGit # @!scope 类似 git tag # class Tag < BaseCommand def execute(argv) Workspace.check_branch_consistency Output.puts_start_cmd exec_repos = all_repos + locked_repos if argv.git_opts.empty? _, error_repos = Workspace.execute_git_cmd_with_repos(argv.cmd...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/stash.rb
Ruby
mit
186
master
6,489
#coding=utf-8 module MGit # @!scope 类似 git stash,但是强制标记名称 # class Stash < BaseCommand OPT_LIST = { :push => '--push', :pop => '--pop', :apply => '--apply', :list => '--list', :clear => '--clear', }.freeze def options return [ ARGV::O...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/log.rb
Ruby
mit
186
master
2,208
#coding=utf-8 module MGit # @!scope 查询多仓库的日志 # class Log < BaseCommand OPT_LIST = { :number => '--number', :number_s => '-n' }.freeze def options return [ ARGV::Opt.new(OPT_LIST[:number], short_key:OPT_LIST[:number_s], default:500, info:"指定需要显示的提交log个数,默认500。", ty...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/commit.rb
Ruby
mit
186
master
2,836
#coding=utf-8 module MGit # @!scope [command] commit # follow git commit # eg: mgit commit -m 'Just for fun' # class Commit < BaseCommand private def validate(argv) super # 禁用--amend if argv.git_opts.include?('--amend') Output.puts_fail_message("MGit不支持\"--amend\"操作,请重试。") ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/self.rb
Ruby
mit
186
master
7,780
#coding=utf-8 module MGit # 该指令用于不带指令的输入:mgit --help,用于执行mgit的一级参数(如"mgit --help"的"--help") # class Self < BaseCommand HELP_INTRODUCTION = <<INTRO #{Output.info_title("Description:")} mgit是多仓库管理工具,通过将git指令作用到多个仓库,实现批量的版本管理功能 更多介绍:https://github.com/baidu/mgit INTRO OPT_LIST = { :all...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/delete.rb
Ruby
mit
186
master
3,353
#coding=utf-8 module MGit # @!scope [command] delete 删除某个仓库的`所有`文件,包括工作区、暂存区和版本库 # # eg: mgit delete subA # class Delete < BaseCommand # --- 覆写前后hook,不需要预设操作 --- def pre_exec MGit::DurationRecorder.start Workspace.setup_multi_repo_root # 配置log MGit::Loger.config(Workspace.ro...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/init.rb
Ruby
mit
186
master
13,020
#coding=utf-8 module MGit # @!scope 初始化多仓库命令 # class Init < BaseCommand OPT_LIST = { :git_source => '--git-source', :git_source_s => '-g', :config_source => '--config-source', :config_source_s => '-f', :branch => '--branch', :branch_s ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/command/checkout.rb
Ruby
mit
186
master
3,307
#coding=utf-8 module MGit # @!scope [command] checkout # follow git checkout # eg: mgit checkout master # class Checkout < BaseCommand def execute(argv) Output.puts_start_cmd # 优先checkout配置仓库 config_repo = generate_config_repo checkout_config_repo(argv.cmd, argv.git_opts, confi...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/repo/sync_helper.rb
Ruby
mit
186
master
9,499
#coding=utf-8 module MGit class Repo class SyncHelper class << self # 同步新仓库 # # @param repo [MGigClass::Repo] Repo对象 # # @param light_repo [Manifest::LightRepo] LightRepo对象 # # @param link_git [Boolean] 下载新仓库的时候是否托管.git实体并在工作区创建其软链接 # ...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/repo/status.rb
Ruby
mit
186
master
17,520
#coding=utf-8 module MGit class Repo class Status # https://git-scm.com/docs/git-status # status格式:XY PATH, X表示暂存区状态,Y表示工作区状态,在merge冲突的情况下,XY为冲突两边状态,未跟踪文件为??,忽略文件为!!。 # 如: # MM some_file # M some_file # M some_file # # 其中: # ' ' = unmodified # M = mo...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/open_api/script_download_info.rb
Ruby
mit
186
master
909
#coding=utf-8 module MGit class OpenApi module DownloadResult SUCCESS = 0 FAIL = 1 EXIST = 2 end class ScriptDownloadInfo # [String] 下载仓库名 attr_reader :repo_name # [String] 下载仓库本地地址 attr_reader :repo_path # [OpenApi::DOWNLOAD_RESULT] 下载结果 attr_rea...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/argv/opt.rb
Ruby
mit
186
master
1,108
#coding=utf-8 module MGit class ARGV # 单个选项, 如‘--k1=v1 --k2 v2 v3 --flag’ # '--k1=v1' key: '--k1', value: 'v1' # '--k2 v2 v3' key: '--k2', value: ['v2', 'v3'] # '--flag' key: '--flag', value: true class Opt attr_reader :key attr_accessor :value attr_accessor :short_...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/argv/parser.rb
Ruby
mit
186
master
2,378
module MGit class ARGV module Parser # @param [Array] argv # # @return [String, Array, Array] # 返回cmd 和 参数列表 # # 将参数初步分解,便于后续处理 # 如:argv = [command zzzz -u sdfsd sdf --mmmm yoo ssss qqq --test asdfa asd ad f --xxx asd as dfa --yoo="ajsdaf" --ppp -abc] # 分解为:command, [zzz...
github
baidu/m-git
https://github.com/baidu/m-git
lib/m-git/argv/opt_list.rb
Ruby
mit
186
master
1,634
#coding=utf-8 module MGit class ARGV # 参数对象列表 class OptList # [Array<ARGV::Opt>] 参数对象数组 attr_accessor :opts # attr_reader :valid_opts def initialize(opts) @opts = opts end def valid_opts @opts.select { |e| !e.empty? } end # 获取某个参数对象 #...
github
baidu/m-git
https://github.com/baidu/m-git
test/test_helper.rb
Ruby
mit
186
master
686
require 'minitest/autorun' require 'minitest/reporters' MiniTest::Reporters.use! Minitest::Reporters::SpecReporter.new # # syntax: http://www.mattsears.com/articles/2011/12/10/minitest-quick-reference/ # Dir.glob(File.join(File.dirname(__FILE__), %w(.. lib *.rb ))).each do |file| require file end module MGitTest ...
github
baidu/m-git
https://github.com/baidu/m-git
test/test_argv.rb
Ruby
mit
186
master
2,742
require_relative 'test_helper' describe MGit::ARGV do let(:input_argv) { cmd = "checkout -b branch_name --mrepo boxapp BBAAccount --command test".split(" ") argv = MGit::ARGV::Parser.parse(cmd) opts = [] opts << MGit::ARGV::Opt.new('--mrepo', info: 'first one') opts << MGit::ARGV::Opt.new('--co...
github
baidu/m-git
https://github.com/baidu/m-git
test/foundation/test_utils.rb
Ruby
mit
186
master
2,398
require_relative '../test_helper' describe MGit::Utils do it "#change_dir(dir)" do check_dir = File.expand_path('~') cur = Dir.pwd MGit::Utils.change_dir(check_dir) _(Dir.pwd).must_equal check_dir MGit::Utils.change_dir(cur) _(Dir.pwd).must_equal cur MGit::Utils.change_dir(cur) _(D...
github
baidu/m-git
https://github.com/baidu/m-git
test/foundation/test_mgit_config.rb
Ruby
mit
186
master
1,932
require_relative '../test_helper' describe MGit::MGitConfig do STUB_CONFIG = { 'managegit' => true, 'maxconcurrentcount' => 4, 'savecache' => true } def __stub_config_env MGit::MGitConfig.stub :__load_file, [STUB_CONFIG, nil] do yield if block_given? end end def __stub_wri...
github
baidu/m-git
https://github.com/baidu/m-git
test/foundation/test_dir.rb
Ruby
mit
186
master
832
require_relative '../test_helper' describe Dir do # before do # @git_dir = MiniTest::Mock.new # end it "#is_git_repo?(path)" do mock_git_path = '/stub/.git' stub_block = lambda do |path| return true if path == '/stub' mock_git_path == path end File.stub :directory?, stub_bloc...
github
baidu/m-git
https://github.com/baidu/m-git
test/argv/test_parser.rb
Ruby
mit
186
master
1,785
require_relative '../test_helper' describe MGit::ARGV::Parser do let(:input_argv) { cmd = "checkout -b branch_name --mrepo boxapp BBAAccount --command test".split(" ") MGit::ARGV::Parser.parse(cmd) } # # 指令名,如:"mgit checkout -b branch_name"的"checkout" # attr_reader :cmd # # # 所有参数,如:"mgit check...
github
baidu/m-git
https://github.com/baidu/m-git
test/argv/test_opt_list.rb
Ruby
mit
186
master
1,291
require_relative '../test_helper' describe MGit::ARGV::OptList do let(:list) { arr = [] opt = MGit::ARGV::Opt.new('--aa', short_key: '-a', info: "first", priority: 1) opt.value = true arr << opt opt = MGit::ARGV::Opt.new('--cc', short_key: '-c', info: "third", priority: 3) arr << opt ...
github
baidu/m-git
https://github.com/baidu/m-git
test/argv/test_opt.rb
Ruby
mit
186
master
623
require_relative '../test_helper' describe MGit::ARGV::Opt do it "opt key cant be nil" do _{MGit::ARGV::Opt.new(nil)}.must_raise RuntimeError end describe "Check Empty" do let(:entity) { MGit::ARGV::Opt.new('key') } it "is empty" do _(entity.empty?).must_equal true end it ...
github
fphilipe/i18n-debug
https://github.com/fphilipe/i18n-debug
i18n-debug.gemspec
Ruby
mit
186
master
814
require File.expand_path('../lib/i18n/debug/version', __FILE__) Gem::Specification.new do |spec| spec.name = 'i18n-debug' spec.version = I18n::Debug::VERSION spec.author = 'Philipe Fatio' spec.email = 'me@phili.pe' spec.homepage = 'https://github.com/fphilipe/i18n-debug' spec.licen...
github
fphilipe/i18n-debug
https://github.com/fphilipe/i18n-debug
lib/i18n/debug.rb
Ruby
mit
186
master
1,014
require 'i18n' require 'i18n/debug/version' module I18n module Debug @on_lookup = lambda do |key, result| logger.debug("[i18n-debug] #{key} => #{result.inspect}") end class << self attr_accessor :logger attr_writer :on_lookup def logger @logger ||= if defined?(...
github
fphilipe/i18n-debug
https://github.com/fphilipe/i18n-debug
test/test_i18n_debug.rb
Ruby
mit
186
master
1,147
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'i18n/debug' require 'minitest/autorun' class TestI18nDebug < Minitest::Test alias_method :silence_io, :capture_io def setup I18n.backend.store_translations(:en, foo: { bar: 'baz' }) # Avoid I18n deprecation warning: I18n.enforce_avail...
github
nakajima/rack-flash
https://github.com/nakajima/rack-flash
rack-flash3.gemspec
Ruby
mit
186
master
1,529
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "rack-flash3" s.version = "1.0.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_ruby...
github
nakajima/rack-flash
https://github.com/nakajima/rack-flash
Rakefile
Ruby
mit
186
master
772
require 'rubygems' require 'rake' begin require 'jeweler2' Jeweler::Tasks.new do |gem| gem.name = "rack-flash3" gem.summary = "Flash hash implementation for Rack apps." gem.description = "Flash hash implementation for Rack apps." gem.email = "treeder@gmail.com" gem.homepage = "http://www.iron.i...
github
nakajima/rack-flash
https://github.com/nakajima/rack-flash
example/base_app.ru
Ruby
mit
186
master
490
require 'rack/request' require 'rack/response' require 'rack/showexceptions' require 'rack/session/cookie' require File.dirname(__FILE__) + '/../lib/rack-flash' class Base attr_accessor :env def call(env) @env = env flash['err'] = "IT'S ALIVE" res = Rack::Response.new res.write "<title>Flashy</t...
github
nakajima/rack-flash
https://github.com/nakajima/rack-flash
example/sinatra_app.rb
Ruby
mit
186
master
649
require 'rubygems' require 'sinatra/base' require File.dirname(__FILE__) + '/../lib/rack-flash' class MyApp < Sinatra::Base use Rack::Flash set :root, File.dirname(__FILE__) set :layout, true set :logging, true set :sessions, true get '/' do erb :index end # View the value of any given flash g...
github
nakajima/rack-flash
https://github.com/nakajima/rack-flash
lib/rack/flash.rb
Ruby
mit
186
master
3,992
module Rack class Flash # Raised when the session passed to FlashHash initialize is nil. This # is usually an indicator that session middleware is not in use. class SessionUnavailable < StandardError; end # Implements bracket accessors for storing and retrieving flash entries. class FlashHash ...
github
nakajima/rack-flash
https://github.com/nakajima/rack-flash
lib/rack/flash/test.rb
Ruby
mit
186
master
274
module Rack class Flash def self.fake_session @fake_session ||= {} end alias_method :old_call, :call def new_call(env) env['rack.session'] ||= Rack::Flash.fake_session old_call(env) end alias_method :call, :new_call end end
github
nakajima/rack-flash
https://github.com/nakajima/rack-flash
test/test_flash.rb
Ruby
mit
186
master
3,602
require File.dirname(__FILE__) + '/helper' describe 'Rack::Flash' do include Rack::Test::Methods def app(&block) return Sinatra.new &block end before do @fake_session = {} end def new_flash(entries={}) flash = Rack::Flash::FlashHash.new(@fake_session) entries.each { |key,val| flash[key] ...
github
nakajima/rack-flash
https://github.com/nakajima/rack-flash
test/helper.rb
Ruby
mit
186
master
827
require 'rubygems' gem 'sinatra', '<=1.3.2' require 'sinatra/base' require 'bacon' require 'rack/test' require File.join(File.dirname(__FILE__), *%w[.. lib rack-flash]) class String [:green, :yellow, :red].each { |c| define_method(c) { self } } end if ENV['TM_RUBY'] # bacon swallows errors alive def err_explain b...
github
eagletmt/faml
https://github.com/eagletmt/faml
Rakefile
Ruby
mit
185
master
2,081
# frozen_string_literal: true require 'bundler/gem_tasks' task :default => [:compile, :spec, :rubocop] require 'rake/extensiontask' Rake::ExtensionTask.new('attribute_builder') do |ext| ext.lib_dir = 'lib/faml' end require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) require 'rubocop/rake_task' RuboCop...
github
eagletmt/faml
https://github.com/eagletmt/faml
faml.gemspec
Ruby
mit
185
master
2,055
# coding: utf-8 # frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'faml/version' Gem::Specification.new do |spec| spec.name = 'faml' spec.version = Faml::VERSION spec.authors = ['Kohei Suzuki'] spec.emai...
github
eagletmt/faml
https://github.com/eagletmt/faml
haml_spec_test.rb
Ruby
mit
185
master
835
# frozen_string_literal: true require 'minitest/autorun' require 'json' require 'faml' class HamlTest < Minitest::Test contexts = JSON.parse(File.read(File.join(__dir__, 'haml-spec', 'tests.json'))) contexts.each do |context| context[1].each do |name, test| define_method("test_spec: #{name} (#{context[0]...
github
eagletmt/faml
https://github.com/eagletmt/faml
Appraisals
Ruby
mit
185
master
1,111
appraise 'rails-4.0' do gem 'rails', '~> 4.0' gem 'rspec-rails', '>= 3.2.0' gem 'sqlite3' gem 'nokogiri' end appraise 'rails-4.1' do gem 'rails', '~> 4.1' gem 'rspec-rails', '>= 3.2.0' gem 'sqlite3' gem 'nokogiri' end appraise 'rails-4.2' do gem 'rails', '~> 4.2' gem 'rspec-rails', '>= 3.2.0' ge...
github
eagletmt/faml
https://github.com/eagletmt/faml
lib/faml.rb
Ruby
mit
185
master
207
# frozen_string_literal: true require_relative 'faml/engine' require_relative 'faml/tilt' require_relative 'faml/version' begin require 'rails' rescue LoadError else require_relative 'faml/railtie' end
github
eagletmt/faml
https://github.com/eagletmt/faml
lib/faml/newline.rb
Ruby
mit
185
master
524
# frozen_string_literal: true require 'temple' module Faml class Newline < Temple::Filter def on_multi(*exprs) i = exprs.size - 1 marker = false while i >= 0 case exprs[i] when [:rmnl] marker = true exprs.delete_at(i) when [:mknl] if marker ...
github
eagletmt/faml
https://github.com/eagletmt/faml
lib/faml/script_end.rb
Ruby
mit
185
master
546
# frozen_string_literal: true require 'temple' module Faml class ScriptEnd < Temple::Filter def on_multi(*exprs) i = exprs.size - 1 depth = 0 while i >= 0 case exprs[i] when [:mkend] if depth > 0 # Cancel :mkend depth -= 1 exprs.dele...
github
eagletmt/faml
https://github.com/eagletmt/faml
lib/faml/helpers.rb
Ruby
mit
185
master
306
# frozen_string_literal: true module Faml # Don't use these methods! module Helpers def self.preserve(input) # Taken from the original haml code input.to_s.chomp("\n").gsub(/\n/, '&#x000A;').delete("\r") end def preserve(input) Helpers.preserve(input) end end end
github
eagletmt/faml
https://github.com/eagletmt/faml
lib/faml/compiler.rb
Ruby
mit
185
master
7,201
# frozen_string_literal: true require 'ripper' require 'temple' require 'haml_parser/ast' require_relative 'attribute_compiler' require_relative 'error' require_relative 'filter_compilers' require_relative 'helpers' require_relative 'rails_helpers' require_relative 'text_compiler' module Faml class Compiler < Temple...
github
eagletmt/faml
https://github.com/eagletmt/faml
lib/faml/static_hash_parser.rb
Ruby
mit
185
master
3,559
# frozen_string_literal: true require 'parser/current' module Faml class StaticHashParser FAILURE_TAG = :failure SPECIAL_ATTRIBUTES = %w[id class data].freeze attr_reader :static_attributes, :dynamic_attributes def initialize @static_attributes = {} @dynamic_attributes = {} end ...