giturl 1.2.1 → 1.3.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/.rubocop.yml +6 -0
- data/CHANGELOG.md +16 -1
- data/README.md +1 -0
- data/giturl.gemspec +2 -0
- data/lib/command_giturl.rb +43 -30
- data/lib/giturl/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 762f0ef988f2cf602f43e4e5abc74e1124d9fb8156e63a5d0fd3f4584647883c
|
4
|
+
data.tar.gz: 051e0cba7445080f5dde7fd7c4dcb70e78575d72f4e5f91313e25456e182c003
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c29c6eac2c5590e8415bed676d277720a43458b1c8f64ee58d1260b53ca499a417fa1aa5eec1cea4fa7d1c6ec9629b4a2328c70d56ae3a80d6eca9cf7a00622
|
7
|
+
data.tar.gz: a8894f14c0bf6421b9fb1841f6971101772339acdcbba4261fd63d285267ddd45e1ab1af8da5c723b17c7686917a8dbaa7a3cd73cca64dd75de13d132c277517
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.3.0](https://github.com/shinyaohtani/giturl/tree/v1.3.0) (2020-04-08)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/shinyaohtani/giturl/compare/v1.2.1...v1.3.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Support for Windows and Linux! [\#2](https://github.com/shinyaohtani/giturl/issues/2)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Feature/\#2 support windows linux [\#17](https://github.com/shinyaohtani/giturl/pull/17) ([shinyaohtani](https://github.com/shinyaohtani))
|
14
|
+
- fixed an Abc warning from rubocop [\#16](https://github.com/shinyaohtani/giturl/pull/16) ([shinyaohtani](https://github.com/shinyaohtani))
|
15
|
+
|
16
|
+
# Changelog
|
17
|
+
|
3
18
|
## [v1.2.1](https://github.com/shinyaohtani/giturl/tree/v1.2.1) (2020-03-27)
|
4
19
|
|
5
20
|
[Full Changelog](https://github.com/shinyaohtani/giturl/compare/v1.2.0...v1.2.1)
|
6
21
|
|
7
|
-
**
|
22
|
+
**Implemented enhancements:**
|
8
23
|
|
9
24
|
- Open application even if --app alone without --open [\#13](https://github.com/shinyaohtani/giturl/issues/13)
|
10
25
|
|
data/README.md
CHANGED
data/giturl.gemspec
CHANGED
@@ -33,6 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.executables = ['giturl']
|
34
34
|
spec.require_paths = ['lib']
|
35
35
|
|
36
|
+
spec.add_runtime_dependency 'launchy', '>= 2.5.0'
|
37
|
+
|
36
38
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
37
39
|
spec.add_development_dependency 'github_changelog_generator', '>= 1.15.0'
|
38
40
|
spec.add_development_dependency 'pry', '>= 0.12.2'
|
data/lib/command_giturl.rb
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
module Giturl
|
6
6
|
require 'optparse'
|
7
7
|
require 'giturl'
|
8
|
+
require 'launchy'
|
8
9
|
|
9
10
|
# command line wrapper
|
10
11
|
class CommandGiturl
|
@@ -13,31 +14,7 @@ module Giturl
|
|
13
14
|
def parse_options
|
14
15
|
@params = {}
|
15
16
|
OptionParser.new do |opts|
|
16
|
-
opts
|
17
|
-
opts.on('-o', '--open', 'Open the URL in your browser. default: no') { |v| v }
|
18
|
-
opts.on('-a [APPNAME]', '--app [APPNAME]', 'Specify a browser. i.e. "Safari.app"') { |v| v }
|
19
|
-
opts.on('-v', '--verbose', 'Verbose mode. default: no') { |v| v }
|
20
|
-
opts.on_tail('-h', '--help', 'Show this message') do
|
21
|
-
puts opts
|
22
|
-
exit
|
23
|
-
end
|
24
|
-
opts.on_tail('-V', '--version', 'Show version') do
|
25
|
-
puts opts.ver
|
26
|
-
exit
|
27
|
-
end
|
28
|
-
opts.banner = <<~BANNER
|
29
|
-
|
30
|
-
#{opts.ver}
|
31
|
-
A tiny utility that displays and opens GitHub URLs for your local directory.
|
32
|
-
visit: https://github.com/shinyaohtani/giturl
|
33
|
-
|
34
|
-
Usage: #{opts.program_name} [options] [dirs]
|
35
|
-
[dirs]:
|
36
|
-
Target directories. Omit this when you only specify "."
|
37
|
-
|
38
|
-
[options]:
|
39
|
-
BANNER
|
40
|
-
|
17
|
+
opts = define_options(opts)
|
41
18
|
opts.parse!(ARGV, into: @params)
|
42
19
|
@params[:open] = true if @params.keys.include?(:app)
|
43
20
|
end
|
@@ -49,15 +26,51 @@ module Giturl
|
|
49
26
|
if Giturl.git_managed?(arg)
|
50
27
|
url = Giturl.convert(arg)
|
51
28
|
print "#{url}\n"
|
52
|
-
if @params[:open]
|
53
|
-
comm = +"open #{url}"
|
54
|
-
comm << " -a #{@params[:app]}" if @params[:app]
|
55
|
-
system(comm)
|
56
|
-
end
|
29
|
+
browser_open(url) if @params[:open]
|
57
30
|
elsif @params[:verbose]
|
58
31
|
print "Not git-managed-dir: #{arg}\n"
|
59
32
|
end
|
60
33
|
end
|
61
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def define_options(opts)
|
39
|
+
opts.version = VERSION
|
40
|
+
opts.on('-o', '--open', 'Open the URL in your browser. default: no') { |v| v }
|
41
|
+
opts.on('-a [APPNAME]', '--app [APPNAME]', 'Specify a browser. i.e. "Safari.app"') { |v| v }
|
42
|
+
opts.on('-v', '--verbose', 'Verbose mode. default: no') { |v| v }
|
43
|
+
opts.on_tail('-h', '--help', 'Show this message') do
|
44
|
+
puts opts
|
45
|
+
exit
|
46
|
+
end
|
47
|
+
opts.on_tail('-V', '--version', 'Show version') do
|
48
|
+
puts opts.ver
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
opts.banner = <<~BANNER
|
52
|
+
|
53
|
+
#{opts.ver}
|
54
|
+
A tiny utility that displays and opens GitHub URLs for your local directory.
|
55
|
+
visit: https://github.com/shinyaohtani/giturl
|
56
|
+
|
57
|
+
Usage: #{opts.program_name} [options] [dirs]
|
58
|
+
[dirs]:
|
59
|
+
Target directories. Omit this when you only specify "."
|
60
|
+
|
61
|
+
[options]:
|
62
|
+
BANNER
|
63
|
+
opts
|
64
|
+
end
|
65
|
+
|
66
|
+
def browser_open(url)
|
67
|
+
if @params[:app] && Launchy::Detect::HostOsFamily.detect.darwin?
|
68
|
+
comm = +"open #{url}"
|
69
|
+
comm << " -a #{@params[:app]}" if @params[:app]
|
70
|
+
system(comm)
|
71
|
+
else
|
72
|
+
Launchy.open(url)
|
73
|
+
end
|
74
|
+
end
|
62
75
|
end
|
63
76
|
end
|
data/lib/giturl/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: giturl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shinya Ohtani (shinyaohtani@github)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: launchy
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.5.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.5.0
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: bundler
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|