Sha256: 5d4505c8e35830b4e833028500bd2d4f028594f7e86c65609d889dfbf9e968c9
Contents?: true
Size: 872 Bytes
Versions: 1
Compression:
Stored size: 872 Bytes
Contents
require_relative "git-runner" module MultiRepo class Branch attr_accessor :name def initialize(repo, name) @repo = repo @name = name end def exists? lines = GitRunner.run_in_working_dir(@repo.path, "branch", Runner::Verbosity::OUTPUT_NEVER).split("\n") branch_names = lines.map { |line| line.tr("* ", "")} branch_names.include?(@name) end def create GitRunner.run_in_working_dir(@repo.path, "branch #{@name}", Runner::Verbosity::OUTPUT_ON_ERROR) end def push GitRunner.run_in_working_dir(@repo.path, "push -u origin #{@name}", Runner::Verbosity::OUTPUT_ON_ERROR) end def checkout GitRunner.run_in_working_dir(@repo.path, "checkout #{@name}", Runner::Verbosity::OUTPUT_ON_ERROR) GitRunner.last_command_succeeded end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git-multirepo-1.0.0.beta39 | lib/multirepo/git/branch.rb |