Sha256: 3259ac813a30dada65978e3e1c11ee4ab5549ebb391c22ab99e0850864999672

Contents?: true

Size: 552 Bytes

Versions: 6

Compression:

Stored size: 552 Bytes

Contents

require "rugged"
require_relative "base"

module Rfix
  class Branch::Main < Branch::Base
    KEY = "rfix.main.branch".freeze

    def resolve(with:)
      unless name = with.config[KEY]
        raise Error, "Please run {{command:rfix setup}} first"
      end

      Branch::Name.new(name).resolve(with: with)
    end

    def self.set(branch, at: Dir.pwd)
      Branch.repo(at: at).config[KEY] = branch
    end

    def self.get(at: Dir.pwd)
      Branch.repo(at: at).config[KEY]
    end

    def to_s
      "configured main branch"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rfix-1.4.1 lib/rfix/branches/main.rb
rfix-1.4.0.pre.201 lib/rfix/branches/main.rb
rfix-1.4.0 lib/rfix/branches/main.rb
rfix-1.3.0.pre.199 lib/rfix/branches/main.rb
rfix-1.2.6.pre.198 lib/rfix/branches/main.rb
rfix-1.2.6 lib/rfix/branches/main.rb