Class: Usmu::Github::Pages::Configuration
- Inherits:
-
Object
- Object
- Usmu::Github::Pages::Configuration
- Includes:
- Helpers::Indexer
- Defined in:
- lib/usmu/github/pages/configuration.rb
Instance Method Summary collapse
-
#default_branch(remote) ⇒ void
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.
-
#initialize(config) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(config) ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 |
# File 'lib/usmu/github/pages/configuration.rb', line 8 def initialize(config) @config = config end |
Instance Method Details
#default_branch(remote) ⇒ void
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.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# 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 |