Sha256: 6d2f6eb3c3868e687a0cc6dc61da4ffb93b9cb595dceec60957879cb6c46aa13
Contents?: true
Size: 792 Bytes
Versions: 2
Compression:
Stored size: 792 Bytes
Contents
require_relative "reporter" require_relative "command" module GitFonky class RepoDir attr_reader :command, :dirname, :reporter def initialize(dirname) @dirname = dirname @reporter = Reporter.new(self) @command = Command.new(repo_dir: self, reporter: reporter) end def branch @branch ||= command.current_branch end def sync Dir.chdir dirname do reporter.announce_update return reporter.invalid_branch_msg if on_invalid_branch? command.fetch_upstream command.pull_upstream return reporter.failed_pull_msg unless $?.success? command.push_to_origin reporter.announce_success end end def on_invalid_branch? !branch.match?(/(main|master)/) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git_fonky-0.5.0 | lib/git_fonky/repo_dir.rb |
git_fonky-0.4.0 | lib/git_fonky/repo_dir.rb |