deathnote 0.1.1 → 0.1.2
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/deathnote.rb +21 -15
- data/lib/deathnote/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff1992993b2ffb3d3bff206c922aed61df172b72
|
4
|
+
data.tar.gz: 229c58189b2ff5c339edfccbeafd9abb392975e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14035c3ca967ca2689159c1d59dd73b698bd9521c172727bb95959c6163336403dd4c319ca97c342e5ffcb3530723d6a96e6fadeb28c9d2c8e694c169ee1d6d
|
7
|
+
data.tar.gz: 101d59c1a2bd001a5f12c894ec25a397d7ee3d1103d4558037f521ae478cc0372cac06e1ed1ab15f90fcf2daba70c2bbff5267bfd93a91c21815935c96f38a8a
|
data/lib/deathnote.rb
CHANGED
@@ -9,19 +9,27 @@ module Deathnote
|
|
9
9
|
class << self
|
10
10
|
def run(argv)
|
11
11
|
options = parse_options(argv)
|
12
|
-
|
12
|
+
backup_commit = cmd('git rev-parse --abbrev-ref HEAD')
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
Open3.popen3("git checkout #{old_branch}")
|
14
|
+
cmd("git checkout #{options[:past_commit]}")
|
15
|
+
past_missing = DeadCodes.new(options.deep_clone).run
|
17
16
|
|
18
|
-
|
19
|
-
|
17
|
+
cmd("git checkout #{options[:newer_commit]}")
|
18
|
+
newer_missing = DeadCodes.new(options.deep_clone).run
|
19
|
+
|
20
|
+
newer_missing.
|
21
|
+
reject { |unused, _location| past_missing.has_key?(unused) }.
|
20
22
|
each { |unused, location| puts "#{unused} #{location}" }
|
23
|
+
ensure
|
24
|
+
cmd("git checkout #{backup_commit}")
|
21
25
|
end
|
22
26
|
|
23
27
|
private
|
24
28
|
|
29
|
+
def cmd(command)
|
30
|
+
Open3.popen3(command) { |_i, o, _e, _t| o.read.chomp }
|
31
|
+
end
|
32
|
+
|
25
33
|
def parse_options(argv)
|
26
34
|
options = {}
|
27
35
|
OptionParser.new do |opts|
|
@@ -31,11 +39,12 @@ module Deathnote
|
|
31
39
|
puts opts
|
32
40
|
exit
|
33
41
|
end
|
34
|
-
opts.on('-
|
35
|
-
|
42
|
+
opts.on('-p[commit hash]', '--past-commit=[commit hash]', 'Specify past commit hash.') do |past_commit|
|
43
|
+
p past_commit
|
44
|
+
options[:past_commit] = past_commit
|
36
45
|
end
|
37
|
-
opts.on('-
|
38
|
-
options[:
|
46
|
+
opts.on('-n[commit hash]', '--newer-commit=[commit hash]', 'Specify newer commit hash.') do |newer_commit|
|
47
|
+
options[:newer_commit] = newer_commit
|
39
48
|
end
|
40
49
|
opts.on('-r', '--rails', 'Filter some rails call conversions.') do
|
41
50
|
options[:rails] = true
|
@@ -48,21 +57,18 @@ module Deathnote
|
|
48
57
|
|
49
58
|
options
|
50
59
|
rescue OptionParser::InvalidOption => e
|
51
|
-
warn
|
52
|
-
warn ""
|
60
|
+
warn "Fail to parse options."
|
53
61
|
warn e.message
|
54
62
|
exit 1
|
55
63
|
end
|
56
64
|
end
|
57
65
|
|
58
66
|
class DeadCodes
|
59
|
-
def initialize(
|
60
|
-
@branch = branch
|
67
|
+
def initialize(options)
|
61
68
|
@options = options
|
62
69
|
end
|
63
70
|
|
64
71
|
def run
|
65
|
-
Open3.popen3("git checkout #{@branch}")
|
66
72
|
to_list(run_debride)
|
67
73
|
end
|
68
74
|
|
data/lib/deathnote/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deathnote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shia
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|