gh_compare 0.1.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -11
- data/bin/gh_compare +19 -4
- data/gh_compare.gemspec +1 -1
- data/lib/gh_compare/version.rb +1 -1
- data/lib/gh_compare.rb +12 -0
- metadata +3 -4
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86877317391ee3415a229a9375e59a9e123a071920856f3ea5154d28fa3c86ba
|
4
|
+
data.tar.gz: 75f5e9d408a90459b5a67f03e436112d5871c60faef29dca712016786252c196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0493f939e0ce4ed7083e35238932d483eeb04c152c9c96b2c6c59a2ccbb2816d200c7496328ab58d22b40fa06f83d203d411f0530a39839b35193485723365bf'
|
7
|
+
data.tar.gz: ca56c90e1bd6523674b4a8e268478670258521ada18164a8e00437347b77878e85d80ebf8b67a061dcf75043b5a98c7987544d2f9a8997976fda9ae4e9e3c2a7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,22 +6,18 @@ Generate GitHub compare url like [this](https://github.com/kenzo-tanaka/gh_compa
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
```
|
10
|
-
gem
|
9
|
+
```shell
|
10
|
+
gem install gh_compare
|
11
11
|
```
|
12
12
|
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install gh_compare
|
20
|
-
|
21
13
|
## Usage
|
22
14
|
|
23
15
|
```shell
|
24
|
-
gh_compare
|
16
|
+
gh_compare -n [number]
|
17
|
+
```
|
18
|
+
|
19
|
+
```shell
|
20
|
+
gh_compare -d [from-hash] [to-hash]
|
25
21
|
```
|
26
22
|
|
27
23
|
## Development
|
data/bin/gh_compare
CHANGED
@@ -1,7 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
raise ArgumentError, "wrong number of arguments (given #{ARGV.length}, expected 2)" if ARGV.length != 2
|
4
|
-
|
5
3
|
require_relative '../lib/gh_compare'
|
6
|
-
|
7
|
-
|
4
|
+
require 'optparse'
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
OptionParser.new do |opt|
|
8
|
+
opt.on('--n=NUM', Integer) { |v| options[:num] = v }
|
9
|
+
opt.on('--d==V,V', Array) { |v| options[:commits] = v }
|
10
|
+
|
11
|
+
opt.parse!(ARGV)
|
12
|
+
end
|
13
|
+
|
14
|
+
if options[:num]
|
15
|
+
compare = GhCompare::CommitCompare.new
|
16
|
+
puts compare.compare_before(options[:num])
|
17
|
+
end
|
18
|
+
|
19
|
+
if options[:commits]
|
20
|
+
compare = GhCompare::CommitCompare.new
|
21
|
+
puts compare.compare_url(options[:commits][0], options[:commits][1])
|
22
|
+
end
|
data/gh_compare.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
32
32
|
end
|
33
33
|
spec.bindir = 'bin'
|
34
|
-
spec.executables = spec.files.grep(%r{
|
34
|
+
spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
|
35
35
|
spec.require_paths = ['lib']
|
36
36
|
|
37
37
|
spec.add_development_dependency 'bundler', '~> 1.17'
|
data/lib/gh_compare/version.rb
CHANGED
data/lib/gh_compare.rb
CHANGED
@@ -18,6 +18,10 @@ module GhCompare
|
|
18
18
|
remote_url + "/compare/#{from}...#{to}"
|
19
19
|
end
|
20
20
|
|
21
|
+
def compare_before(num)
|
22
|
+
compare_url(head_before(num), head)
|
23
|
+
end
|
24
|
+
|
21
25
|
private
|
22
26
|
|
23
27
|
def get_remote_origin
|
@@ -31,5 +35,13 @@ module GhCompare
|
|
31
35
|
def ssh_to_url
|
32
36
|
"https://github.com/#{remote_origin.gsub(/git@github.com:/, '').gsub(/\.git$/, '')}"
|
33
37
|
end
|
38
|
+
|
39
|
+
def head
|
40
|
+
`git rev-parse HEAD`.strip
|
41
|
+
end
|
42
|
+
|
43
|
+
def head_before(num)
|
44
|
+
`git rev-parse HEAD~#{num}`.strip
|
45
|
+
end
|
34
46
|
end
|
35
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gh_compare
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kenzo-tanaka
|
@@ -55,7 +55,8 @@ dependencies:
|
|
55
55
|
description: Generate GitHub compare url
|
56
56
|
email:
|
57
57
|
- kenzou.kenzou104809@gmail.com
|
58
|
-
executables:
|
58
|
+
executables:
|
59
|
+
- gh_compare
|
59
60
|
extensions: []
|
60
61
|
extra_rdoc_files: []
|
61
62
|
files:
|
@@ -68,9 +69,7 @@ files:
|
|
68
69
|
- LICENSE.txt
|
69
70
|
- README.md
|
70
71
|
- Rakefile
|
71
|
-
- bin/console
|
72
72
|
- bin/gh_compare
|
73
|
-
- bin/setup
|
74
73
|
- gh_compare.gemspec
|
75
74
|
- lib/gh_compare.rb
|
76
75
|
- lib/gh_compare/version.rb
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "gh_compare"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|