open-remote 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9c6d91ffe2013b860e16139487b2da212516de5
4
- data.tar.gz: 9e2cf896cbbdb1862d199de389f02ef20154dcff
3
+ metadata.gz: e831a82b43d2f559841cb7ec389ea1b12c2e556f
4
+ data.tar.gz: fd21a826b10abbba0d1ab2575900c7cec5bd421c
5
5
  SHA512:
6
- metadata.gz: c586857a67c1ce81215130c8c0a02208b2ca202da37b1607804b2b67437c4090e92951f7a4bf7f23b6a43f9c4a40f8785e228aa2a4e946eb5dcd92ae4ba86320
7
- data.tar.gz: b51869d4aa9ce4d94dd6a36f33a57c892fe491cb30aa2f3024e7cd31bd06fd9abbee3428392fd821ad0b0be6aeef94e48f7e461a44ca65b8e34d8df34a9264f8
6
+ metadata.gz: 34e810915e7665916f3ef2d8fbc8f4f3f5bcec3c975382c8c535dcd8f8c635962f47c899528f13d9299f4bafbb484430e4bcf63bfd3bbfe52c86146e116f3e95
7
+ data.tar.gz: fc5a5a4d9f9789668963061d43e8ad74066066c6d46d38401175537ba2b1ed2b33be3e1d459f38a02bba625455d46c450ff880ed2c9dd22ecbcbc6964a21030a
data/bin/open-remote CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  require "open-remote"
4
4
 
5
- # modname by jeremy warner
6
- # easily rename groups of file with ruby regex.
5
+ # open-remote by jeremy warner
6
+ # easily open git repo remotes
7
7
 
8
8
  OpenRemote.new.run(ARGV)
9
9
 
data/lib/open-remote.rb CHANGED
@@ -9,6 +9,7 @@ class OpenRemote
9
9
 
10
10
  def run(args)
11
11
  arg = args.shift
12
+
12
13
  case arg
13
14
  when nil # open first remote
14
15
  Browser.browse remote
@@ -33,14 +34,17 @@ class OpenRemote
33
34
  def remote(search = /.*/)
34
35
  remote = remotes.find { |remote| remote.match search }
35
36
 
36
- raise "No remotes found that match #{search}. All remotes:\n".green +
37
- remotes.join("\n") if remote.nil?
38
-
39
- remote
37
+ if remote.nil?
38
+ puts "No remotes found that match #{search.to_s}. All remotes:\n".green +
39
+ remotes.join("\n")
40
+ exit 1
41
+ else
42
+ remote
43
+ end
40
44
  end
41
45
 
42
46
  def remotes
43
- %x{git remote -v}.split("\n").map { |r| r.split[1] }
47
+ %x{git remote -v}.split("\n").map { |r| r.split[1] }.uniq
44
48
  end
45
49
  end
46
50
 
@@ -50,13 +54,13 @@ end
50
54
  OpenRemote::Help = <<-HELP
51
55
  open-remote - git remote opening tool.
52
56
 
53
- `git open-remote` opens the first remote.
57
+ `git open` opens the first listed remote.
54
58
 
55
- to open a specific remote, specify the host:
59
+ to open a particular remote, specify the host:
56
60
 
57
- `git open-remote bit`,
58
- `git open-remote bucket`,
59
- `git open-remote bitbucket`,
61
+ `git open bit`,
62
+ `git open bucket`,
63
+ `git open bitbucket`,
60
64
  will all open bitbucket remote in the browser.
61
65
 
62
66
  Tested against github, bitbucket, and heroku repos.
data/lib/or-version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # universal version tracking
2
2
 
3
3
  class OpenRemote
4
- Version = "0.1"
4
+ Version = "0.2"
5
5
  end
6
6
 
data/man/open-remote.1 ADDED
@@ -0,0 +1,110 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "README20160107\-38683\-NWSN8Z" "" "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
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open-remote
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Warner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-07 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -77,7 +77,7 @@ files:
77
77
  - lib/open-remote.rb
78
78
  - lib/or-browser.rb
79
79
  - lib/or-version.rb
80
- - man/git-open-remote.1
80
+ - man/open-remote.1
81
81
  - readme.md
82
82
  homepage: http://github.com/jeremywrnr/open-remote
83
83
  licenses:
@@ -1,91 +0,0 @@
1
- .\" generated with Ronn/v0.7.3
2
- .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
- .
4
- .TH "README20160107\-33310\-1YIAS53" "" "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\. works for:
9
- .
10
- .IP "" 4
11
- .
12
- .nf
13
-
14
- \- github
15
- \- bitbucket
16
- \- heroku
17
- .
18
- .fi
19
- .
20
- .IP "" 0
21
- .
22
- .P
23
- if there are other git hosting websites that you would like to add, either let me know or make a pull request with the augmentation for that host\.
24
- .
25
- .SH "setup"
26
- .
27
- .nf
28
-
29
- [sudo] gem install open\-remote
30
- .
31
- .fi
32
- .
33
- .SH "usage"
34
- .
35
- .nf
36
-
37
- git open\-remote
38
- .
39
- .fi
40
- .
41
- .P
42
- opens the first git remote\. to open a specific remote, specify some part (or all) of the host name\. for example:
43
- .
44
- .IP "" 4
45
- .
46
- .nf
47
-
48
- git open\-remote bit
49
- git open\-remote bucket
50
- git open\-remote bitbucket
51
- .
52
- .fi
53
- .
54
- .IP "" 0
55
- .
56
- .P
57
- will all open the current repository\'s bitbucket remote in the browser\.
58
- .
59
- .SH "about"
60
- the original idea for this came from my friend charlie \fI\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 \fI\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):
61
- .
62
- .IP "" 4
63
- .
64
- .nf
65
-
66
- [alias]
67
- open\-remote = "!open $(git remote \-v $@ | grep \-o \'http\e\eS*\' | head \-1); :"
68
- .
69
- .fi
70
- .
71
- .IP "" 0
72
- .
73
- .SH "testing"
74
- .
75
- .nf
76
-
77
- bundle || gem install bundler
78
- rake
79
- .
80
- .fi
81
- .
82
- .SH "todos"
83
- .
84
- .IP "\(bu" 4
85
- adding ronn docgen, with rake
86
- .
87
- .IP "\(bu" 4
88
- activitaing travisci tracking
89
- .
90
- .IP "" 0
91
-