Method: Boxen::Config#reponame
- Defined in:
- lib/boxen/config.rb
#reponame ⇒ Object
The repo on GitHub to use for error reports and automatic updates, in owner/repo format. Default is the origin of a Git repo in repodir, if it exists and points at GitHub. Respects the BOXEN_REPO_NAME environment variable.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/boxen/config.rb', line 222 def reponame override = @reponame || ENV["BOXEN_REPO_NAME"] return override unless override.nil? if File.directory? repodir ghuri = URI(ghurl) url = Dir.chdir(repodir) { `git config remote.origin.url`.strip } # find the path and strip off the .git suffix repo_exp = Regexp.new Regexp.escape(ghuri.host) + "[/:]([^/]+/[^/]+)" if $?.success? && repo_exp.match(url) @reponame = $1.sub /\.git$/, "" end end end |