class Pully
Constants
- VERSION
Attributes
branch[R]
git[R]
remote[R]
Public Class Methods
new()
click to toggle source
# File lib/pully.rb, line 12 def initialize dir = '.' dir += '/..' until File.directory?("#{dir}/.git") @git = Git.open(dir) @branch = Git::Lib.new.send(:command, 'rev-parse --abbrev-ref HEAD') @remote = process_remote(@git.config['remote.origin.url']) end
open()
click to toggle source
# File lib/pully.rb, line 8 def self.open new.open end
Public Instance Methods
open()
click to toggle source
# File lib/pully.rb, line 20 def open link = "#{remote.gsub('.git', '')}/compare/#{branch}?expand=1" if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ system "start #{link}" elsif RbConfig::CONFIG['host_os'] =~ /darwin/ system "open #{link}" elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/ system "xdg-open #{link}" end end
Private Instance Methods
process_remote(remote)
click to toggle source
# File lib/pully.rb, line 33 def process_remote(remote) URI.parse(remote) return remote rescue URI::InvalidURIError uri = URI::SshGit.parse(remote) return "https://#{uri.host}/#{uri.path.sub(%r{^\/}, '')}" end