open-remote 0.5.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/open-remote.rb +29 -29
- data/lib/or-browser.rb +21 -21
- data/lib/or-version.rb +1 -2
- data/readme.md +1 -3
- metadata +21 -36
- data/man/open-remote.1 +0 -110
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 43f049e484e0f243e849bd45b8bc2dcec75046d27ca4f13f1846bd6949fab010
|
|
4
|
+
data.tar.gz: dd14382f4d6c9ce831b167826488a573fc9e816c7494ef6a512022077e87efe8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ae225ecea7f7b6b4c5d43787b5affe5d91e4c2ae4e47a46c29d45617d313e9ffe66a7b9fadaa4c2fb74f31bb868d928fd5077b0196a627f46741cf531f03e854
|
|
7
|
+
data.tar.gz: 6f7fd580a62cd9765a83050f1701ad05463e642a4962018ea2b4a76affe805ff5005e69713b04257b37ec503d0749691c47bc19688d5edecd4f0f7e027fa7dce
|
data/lib/open-remote.rb
CHANGED
|
@@ -15,10 +15,10 @@ class OpenRemote
|
|
|
15
15
|
Browser.browse remote
|
|
16
16
|
|
|
17
17
|
when "--help", "-h"
|
|
18
|
-
puts OpenRemote::
|
|
18
|
+
puts OpenRemote::HELP
|
|
19
19
|
|
|
20
20
|
when "--version", "-v"
|
|
21
|
-
puts OpenRemote::
|
|
21
|
+
puts OpenRemote::VERSION
|
|
22
22
|
|
|
23
23
|
when "--alias"
|
|
24
24
|
system "git config --global alias.open '!open-remote'"
|
|
@@ -57,36 +57,36 @@ class OpenRemote
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def remotes
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
`git remote -v`.split("\n").map { |r|
|
|
61
|
+
{
|
|
62
|
+
remote: r.split[0],
|
|
63
|
+
url: r.split[1]
|
|
64
|
+
}
|
|
65
|
+
}.uniq
|
|
64
66
|
end
|
|
65
67
|
end
|
|
66
68
|
|
|
67
|
-
|
|
68
69
|
# large constant strings
|
|
69
70
|
|
|
70
|
-
OpenRemote::
|
|
71
|
-
A tool for git remote opening tool. Open the remote url:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Options:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
To open a particular remote, specify the host:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
These all open bitbucket's remote url in the browser.
|
|
90
|
-
Tested against github, bitbucket, and
|
|
71
|
+
OpenRemote::HELP = <<~HELP
|
|
72
|
+
A tool for git remote opening tool. Open the remote url:
|
|
73
|
+
|
|
74
|
+
git open
|
|
75
|
+
|
|
76
|
+
Options:
|
|
77
|
+
|
|
78
|
+
-h, --help show help
|
|
79
|
+
-v, --version show open-remote version
|
|
80
|
+
-o, --output show output without opening
|
|
81
|
+
--alias add open-remote to git alias
|
|
82
|
+
--unalias remove open-remote from git
|
|
83
|
+
|
|
84
|
+
To open a particular remote, specify the host:
|
|
85
|
+
|
|
86
|
+
git open bit
|
|
87
|
+
git open bucket
|
|
88
|
+
git open bitbucket
|
|
89
|
+
|
|
90
|
+
These all open bitbucket's remote url in the browser.
|
|
91
|
+
Tested against github, bitbucket, and gitea repos.
|
|
91
92
|
HELP
|
|
92
|
-
|
data/lib/or-browser.rb
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
#
|
|
3
3
|
module OpenRemote::OS
|
|
4
4
|
def os_name
|
|
5
|
-
if
|
|
5
|
+
if /darwin/.match?(RUBY_PLATFORM)
|
|
6
6
|
"mac"
|
|
7
|
-
elsif
|
|
7
|
+
elsif /cygwin|mswin|mingw|bccwin|wince|emx/.match?(RUBY_PLATFORM)
|
|
8
8
|
"dos"
|
|
9
9
|
else
|
|
10
10
|
"nix"
|
|
@@ -12,7 +12,6 @@ module OpenRemote::OS
|
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
# Web browser opening commands
|
|
17
16
|
#
|
|
18
17
|
module OpenRemote::Browser end
|
|
@@ -22,7 +21,7 @@ class << OpenRemote::Browser
|
|
|
22
21
|
# Generate and open approprate website from ssh/git link
|
|
23
22
|
#
|
|
24
23
|
def browse(remote)
|
|
25
|
-
|
|
24
|
+
open_url prepare remote
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
# Return the right command for opening a website from the terminal
|
|
@@ -40,28 +39,37 @@ class << OpenRemote::Browser
|
|
|
40
39
|
|
|
41
40
|
# Make the system call to open up a website
|
|
42
41
|
#
|
|
43
|
-
def
|
|
42
|
+
def open_url(url)
|
|
44
43
|
puts "Opening: ".green + url
|
|
45
|
-
|
|
44
|
+
|
|
45
|
+
# Use spawn for better control - detach browser process and suppress its output
|
|
46
|
+
# This allows the script to exit cleanly while hiding verbose GTK warnings
|
|
47
|
+
begin
|
|
48
|
+
pid = spawn("#{browser}#{url}", out: "/dev/null", err: "/dev/null")
|
|
49
|
+
Process.detach(pid)
|
|
50
|
+
rescue Errno::ENOENT
|
|
51
|
+
puts "Error: Could not find browser command '#{browser.strip}'".red
|
|
52
|
+
exit 1
|
|
53
|
+
rescue => e
|
|
54
|
+
puts "Error opening browser: #{e.message}".red
|
|
55
|
+
exit 1
|
|
56
|
+
end
|
|
46
57
|
end
|
|
47
58
|
|
|
48
59
|
# Parse remote to determine whether it is https/ssh, give link
|
|
49
60
|
#
|
|
50
61
|
def prepare(url)
|
|
51
62
|
hb = "https://" # https base url
|
|
52
|
-
if /^https
|
|
53
|
-
https_to_app hb + "dashboard.heroku.com/apps/", url
|
|
54
|
-
|
|
55
|
-
elsif /^https/.match(url) # is website, return w/o .git ending
|
|
63
|
+
if /^https/.match?(url) # is website, return w/o .git ending
|
|
56
64
|
url.sub(/\.git$/, "")
|
|
57
65
|
|
|
58
|
-
elsif /^git@/.match(url) # git remote w/ @
|
|
66
|
+
elsif /^git@/.match?(url) # git remote w/ @
|
|
59
67
|
git_at_to_https hb, url
|
|
60
68
|
|
|
61
|
-
elsif /^git:/.match(url) # git remote w/ :
|
|
69
|
+
elsif /^git:/.match?(url) # git remote w/ :
|
|
62
70
|
git_colon_to_https hb, url
|
|
63
71
|
|
|
64
|
-
elsif /^ssh/.match(url) # is ssh link, change to website
|
|
72
|
+
elsif /^ssh/.match?(url) # is ssh link, change to website
|
|
65
73
|
ssh_to_https hb, url
|
|
66
74
|
|
|
67
75
|
else # unknown, return a generic link
|
|
@@ -69,7 +77,6 @@ class << OpenRemote::Browser
|
|
|
69
77
|
end
|
|
70
78
|
end
|
|
71
79
|
|
|
72
|
-
|
|
73
80
|
# Helper transformations
|
|
74
81
|
#
|
|
75
82
|
def git_at_to_https(base, url)
|
|
@@ -91,11 +98,4 @@ class << OpenRemote::Browser
|
|
|
91
98
|
info.sub!(/\.git$/, "")
|
|
92
99
|
base << info
|
|
93
100
|
end
|
|
94
|
-
|
|
95
|
-
def https_to_app(base, url)
|
|
96
|
-
app = url.partition(".com/").last
|
|
97
|
-
app.sub!(/\.git$/, "")
|
|
98
|
-
base << app
|
|
99
|
-
end
|
|
100
101
|
end
|
|
101
|
-
|
data/lib/or-version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -3,8 +3,6 @@ open-remote
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/rb/open-remote)
|
|
6
|
-
[](https://travis-ci.org/jeremywrnr/open-remote)
|
|
7
|
-
[](https://codeclimate.com/github/jeremywrnr/open-remote)
|
|
8
6
|
[](http://jeremywrnr.com/mit-license)
|
|
9
7
|
|
|
10
8
|
|
|
@@ -14,7 +12,7 @@ tested and works well for:
|
|
|
14
12
|
|
|
15
13
|
- github
|
|
16
14
|
- bitbucket
|
|
17
|
-
-
|
|
15
|
+
- gitea
|
|
18
16
|
|
|
19
17
|
if there are other git hosting websites that you would like to use this with,
|
|
20
18
|
either let me know or make a pull request with the augmentation for that host.
|
metadata
CHANGED
|
@@ -1,85 +1,71 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: open-remote
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremy Warner
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-02-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: colored
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '1.2'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.2'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: ronn
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: rake
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
44
30
|
requirements:
|
|
45
|
-
- - "
|
|
31
|
+
- - "~>"
|
|
46
32
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '0'
|
|
33
|
+
version: '13.0'
|
|
48
34
|
type: :development
|
|
49
35
|
prerelease: false
|
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
37
|
requirements:
|
|
52
|
-
- - "
|
|
38
|
+
- - "~>"
|
|
53
39
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '0'
|
|
40
|
+
version: '13.0'
|
|
55
41
|
- !ruby/object:Gem::Dependency
|
|
56
42
|
name: rspec
|
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
|
58
44
|
requirements:
|
|
59
|
-
- - "
|
|
45
|
+
- - "~>"
|
|
60
46
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
47
|
+
version: '3.0'
|
|
62
48
|
type: :development
|
|
63
49
|
prerelease: false
|
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
51
|
requirements:
|
|
66
|
-
- - "
|
|
52
|
+
- - "~>"
|
|
67
53
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
54
|
+
version: '3.0'
|
|
69
55
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name:
|
|
56
|
+
name: standard
|
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
|
72
58
|
requirements:
|
|
73
|
-
- - "
|
|
59
|
+
- - "~>"
|
|
74
60
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
61
|
+
version: '1.0'
|
|
76
62
|
type: :development
|
|
77
63
|
prerelease: false
|
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
65
|
requirements:
|
|
80
|
-
- - "
|
|
66
|
+
- - "~>"
|
|
81
67
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
68
|
+
version: '1.0'
|
|
83
69
|
description: open a git repo's web remote from your terminal, with 'git open'.
|
|
84
70
|
email: jwrnr@berkeley.edu
|
|
85
71
|
executables:
|
|
@@ -91,13 +77,12 @@ files:
|
|
|
91
77
|
- lib/open-remote.rb
|
|
92
78
|
- lib/or-browser.rb
|
|
93
79
|
- lib/or-version.rb
|
|
94
|
-
- man/open-remote.1
|
|
95
80
|
- readme.md
|
|
96
81
|
homepage: http://github.com/jeremywrnr/open-remote
|
|
97
82
|
licenses:
|
|
98
83
|
- MIT
|
|
99
84
|
metadata: {}
|
|
100
|
-
post_install_message:
|
|
85
|
+
post_install_message:
|
|
101
86
|
rdoc_options: []
|
|
102
87
|
require_paths:
|
|
103
88
|
- lib
|
|
@@ -112,8 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
97
|
- !ruby/object:Gem::Version
|
|
113
98
|
version: '0'
|
|
114
99
|
requirements: []
|
|
115
|
-
rubygems_version: 3.
|
|
116
|
-
signing_key:
|
|
100
|
+
rubygems_version: 3.4.20
|
|
101
|
+
signing_key:
|
|
117
102
|
specification_version: 4
|
|
118
103
|
summary: open a git repo's remote from your terminal (git open).
|
|
119
104
|
test_files: []
|
data/man/open-remote.1
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
.\" generated with Ronn/v0.7.3
|
|
2
|
-
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
|
3
|
-
.
|
|
4
|
-
.TH "README20160122\-77355\-5W7R7V" "" "January 2016" "" ""
|
|
5
|
-
\fIhttps://badge\.fury\.io/rb/open\-remote\fR \fIhttps://travis\-ci\.org/jeremywrnr/open\-remote\fR \fIhttp://jeremywrnr\.com/mit\-license\fR
|
|
6
|
-
.
|
|
7
|
-
.P
|
|
8
|
-
open\-remote \- a simple git remote opening tool\.
|
|
9
|
-
.
|
|
10
|
-
.P
|
|
11
|
-
tested and works well for:
|
|
12
|
-
.
|
|
13
|
-
.IP "" 4
|
|
14
|
-
.
|
|
15
|
-
.nf
|
|
16
|
-
|
|
17
|
-
\- github
|
|
18
|
-
\- bitbucket
|
|
19
|
-
\- heroku
|
|
20
|
-
.
|
|
21
|
-
.fi
|
|
22
|
-
.
|
|
23
|
-
.IP "" 0
|
|
24
|
-
.
|
|
25
|
-
.P
|
|
26
|
-
if there are other git hosting websites that you would like to use this with, either let me know or make a pull request with the augmentation for that host\.
|
|
27
|
-
.
|
|
28
|
-
.SH "setup"
|
|
29
|
-
.
|
|
30
|
-
.nf
|
|
31
|
-
|
|
32
|
-
[sudo] gem install open\-remote
|
|
33
|
-
.
|
|
34
|
-
.fi
|
|
35
|
-
.
|
|
36
|
-
.P
|
|
37
|
-
making a git alias for \'git open\' in your \fB\.gitconfig\fR:
|
|
38
|
-
.
|
|
39
|
-
.IP "" 4
|
|
40
|
-
.
|
|
41
|
-
.nf
|
|
42
|
-
|
|
43
|
-
open\-remote \-\-alias
|
|
44
|
-
.
|
|
45
|
-
.fi
|
|
46
|
-
.
|
|
47
|
-
.IP "" 0
|
|
48
|
-
.
|
|
49
|
-
.P
|
|
50
|
-
removing the alias, if you don\'t want it anymore:
|
|
51
|
-
.
|
|
52
|
-
.IP "" 4
|
|
53
|
-
.
|
|
54
|
-
.nf
|
|
55
|
-
|
|
56
|
-
open\-remote \-\-unalias
|
|
57
|
-
.
|
|
58
|
-
.fi
|
|
59
|
-
.
|
|
60
|
-
.IP "" 0
|
|
61
|
-
.
|
|
62
|
-
.SH "usage"
|
|
63
|
-
.
|
|
64
|
-
.nf
|
|
65
|
-
|
|
66
|
-
git open
|
|
67
|
-
.
|
|
68
|
-
.fi
|
|
69
|
-
.
|
|
70
|
-
.P
|
|
71
|
-
opens the first git remote\. to open a specific remote, specify some part (or all) of the host name\. for example:
|
|
72
|
-
.
|
|
73
|
-
.IP "" 4
|
|
74
|
-
.
|
|
75
|
-
.nf
|
|
76
|
-
|
|
77
|
-
git open bit
|
|
78
|
-
git open bucket
|
|
79
|
-
git open bitbucket
|
|
80
|
-
.
|
|
81
|
-
.fi
|
|
82
|
-
.
|
|
83
|
-
.IP "" 0
|
|
84
|
-
.
|
|
85
|
-
.P
|
|
86
|
-
will all open the current repository\'s bitbucket remote in the browser\.
|
|
87
|
-
.
|
|
88
|
-
.SH "about"
|
|
89
|
-
the original idea for this came from my friend charlie \fIhttps://github\.com/clehner\fR who initially provided me with a simple git alias that would do the same, but it only worked for repos that were https and was not platform independent\. I was also inspired by the git\-up \fIhttps://github\.com/aanand/git\-up\fR ruby gem in how seamlessly it integrated with git\. Here is the original git alias (made to work on osx), which charlie wrote (plop it in your \.gitconfig, if you don\'t want to install a ruby gem to open your git remotes):
|
|
90
|
-
.
|
|
91
|
-
.IP "" 4
|
|
92
|
-
.
|
|
93
|
-
.nf
|
|
94
|
-
|
|
95
|
-
[alias]
|
|
96
|
-
open\-remote = "!open $(git remote \-v $@ | grep \-o \'http\e\eS*\' | head \-1); :"
|
|
97
|
-
.
|
|
98
|
-
.fi
|
|
99
|
-
.
|
|
100
|
-
.IP "" 0
|
|
101
|
-
.
|
|
102
|
-
.SH "testing"
|
|
103
|
-
.
|
|
104
|
-
.nf
|
|
105
|
-
|
|
106
|
-
bundle || gem install bundler
|
|
107
|
-
rake
|
|
108
|
-
.
|
|
109
|
-
.fi
|
|
110
|
-
|