git-open 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +13 -0
- data/CHANGELOG.md +5 -0
- data/CONTRIBUTING.md +30 -0
- data/Gemfile +9 -0
- data/LICENSE +21 -0
- data/README.md +27 -0
- data/Rakefile +4 -0
- data/exe/git-open +12 -0
- data/git-open.gemspec +25 -0
- data/lib/git/open.rb +45 -0
- data/lib/git/open/version.rb +5 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 055ddaeed765b6b1041218b67b9942f09ce8a59c
|
4
|
+
data.tar.gz: 8bd968916c6c00302877e69c534cdb93877bd170
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f645915e11c119003f6ccb1f87efb3196c2ad1a8b1dea0b0f12ca13eae0a61be4503ff4ce77ca1c41e6dd2eb7d04bc159baf37c3adffcc1c8cab2163de3a1335
|
7
|
+
data.tar.gz: b60402f728f2f5e324db2a24420a66f504a19c305936bb30827d4602a0e5b93ad476ac02a063d8261deeb05e2db3ea9006b57573c0fc514b437906425eb1617f
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
First, thank you for contributing!
|
4
|
+
|
5
|
+
Here are a few technical guidelines to follow:
|
6
|
+
|
7
|
+
0. Open an [issue][] to discuss a new feature
|
8
|
+
0. Write tests
|
9
|
+
0. Make sure the entire test suite passes locally and on CI
|
10
|
+
0. Open a Pull Request
|
11
|
+
0. [Squash your commits][squash] after receiving feedback
|
12
|
+
0. Party!
|
13
|
+
|
14
|
+
[issue]: https://github.com/juanitofatas/git-open/issues
|
15
|
+
[squash]: https://github.com/thoughtbot/guides/tree/master/protocol/git#write-a-feature
|
16
|
+
|
17
|
+
## Development
|
18
|
+
|
19
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
20
|
+
Run `bin/hack` for an interactive prompt that will allow you to experiment.
|
21
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
22
|
+
|
23
|
+
## Testing
|
24
|
+
|
25
|
+
0. Set up your `development` environment as per above.
|
26
|
+
0. Run `rake` to execute the full test suite.
|
27
|
+
|
28
|
+
## Release
|
29
|
+
|
30
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 JuanitoFatas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Git::Open
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/JuanitoFatas/git-open.svg?branch=master)][travis]
|
4
|
+
|
5
|
+
[travis]: https://travis-ci.org/JuanitoFatas/git-open
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
```
|
10
|
+
$ git open
|
11
|
+
```
|
12
|
+
|
13
|
+
Open the repository in your browser, yay!
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
```
|
18
|
+
$ gem install git-open
|
19
|
+
```
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
Please see [CONTRIBUTING.md](/CONTRIBUTING.md).
|
24
|
+
|
25
|
+
## License
|
26
|
+
|
27
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/exe/git-open
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
Signal.trap("INT") { abort }
|
4
|
+
|
5
|
+
require "rubygems"
|
6
|
+
|
7
|
+
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))
|
8
|
+
$LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
|
9
|
+
|
10
|
+
require "git/open"
|
11
|
+
|
12
|
+
Git::Open::CLI.execute
|
data/git-open.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "git/open/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "git-open"
|
8
|
+
spec.version = Git::Open::VERSION
|
9
|
+
spec.authors = ["JuanitoFatas"]
|
10
|
+
spec.email = ["katehuang0320@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Type `git open` to open the repository in your browser.}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/JuanitoFatas/git-open"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|bin)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = ["git-open"]
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "slop", "~> 4.0"
|
23
|
+
spec.add_dependency "git-remote-parser"
|
24
|
+
spec.add_dependency "launchy"
|
25
|
+
end
|
data/lib/git/open.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require "git/open/version"
|
2
|
+
|
3
|
+
module Git
|
4
|
+
module Open
|
5
|
+
class CLI
|
6
|
+
def self.execute
|
7
|
+
require "slop"
|
8
|
+
options = Slop.parse do |option|
|
9
|
+
option.on "-h".freeze, "--help".freeze, "Show this help".freeze
|
10
|
+
option.on "-v".freeze, "--version".freeze, "print the version".freeze do
|
11
|
+
puts_and_exit "git-open version #{Git::Open::VERSION}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
show_help(options) if options[:h] || options[:help] || ARGV.include?("help".freeze)
|
16
|
+
|
17
|
+
abort("Not a git repo".freeze) if `git rev-parse --is-inside-work-tree`.chomp! != "true".freeze
|
18
|
+
|
19
|
+
remotes = `git remote`.split("\n".freeze)
|
20
|
+
|
21
|
+
abort("No remote found".freeze) if remotes.empty?
|
22
|
+
|
23
|
+
url = if remotes.find { |remote| remote == "origin".freeze }
|
24
|
+
`git config --get remote.origin.url`.chomp!
|
25
|
+
else
|
26
|
+
`git config --get remote.#{remotes.first}.url`.chomp!
|
27
|
+
end
|
28
|
+
|
29
|
+
require "git/remote/parser"; require "launchy"
|
30
|
+
Launchy.open(open_url = Git::Remote::Parser.new.parse(url).html_url) do |exception|
|
31
|
+
puts "Attempted to open `#{open_url.to_s}' and failed because #{exception}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.show_help(options)
|
36
|
+
puts_and_exit(options)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.puts_and_exit(message)
|
40
|
+
puts(message)
|
41
|
+
exit
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-open
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- JuanitoFatas
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: slop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: git-remote-parser
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: launchy
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Type `git open` to open the repository in your browser.
|
56
|
+
email:
|
57
|
+
- katehuang0320@gmail.com
|
58
|
+
executables:
|
59
|
+
- git-open
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- CHANGELOG.md
|
67
|
+
- CONTRIBUTING.md
|
68
|
+
- Gemfile
|
69
|
+
- LICENSE
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- exe/git-open
|
73
|
+
- git-open.gemspec
|
74
|
+
- lib/git/open.rb
|
75
|
+
- lib/git/open/version.rb
|
76
|
+
homepage: https://github.com/JuanitoFatas/git-open
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.6.4
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Type `git open` to open the repository in your browser.
|
100
|
+
test_files: []
|
101
|
+
has_rdoc:
|