class Usmu::Github::Pages::Configuration

Public Class Methods

new(config) click to toggle source
# File lib/usmu/github/pages/configuration.rb, line 8
def initialize(config)
  @config = config
end

Public Instance Methods

default_branch(remote) click to toggle source

If this is a *.github.io repository then there's a good chance we're dealing with a repository that must be built to the master branch. Otherwise this is a gh-pages branch repository.

# File lib/usmu/github/pages/configuration.rb, line 15
def default_branch(remote)
  remote_url = `git config remote.#{Shellwords.escape remote}.url`.chomp
  repo_name = begin
    URI.parse(remote_url).path[1..-5]
  rescue ::URI::InvalidURIError
    remote_url.split(':', 2).last[0..-5]
  end

  if File.basename(repo_name).end_with? '.github.io'
    'master'
  else
    'gh-pages'
  end
end