inch 0.3.4.rc1 → 0.4.0.rc1
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/inch/api.rb +2 -0
- data/lib/inch/api/compare.rb +2 -0
- data/lib/inch/api/compare/code_objects.rb +57 -0
- data/lib/inch/api/compare/codebases.rb +49 -0
- data/lib/inch/api/diff.rb +71 -0
- data/lib/inch/cli/command.rb +1 -0
- data/lib/inch/cli/command/diff.rb +54 -0
- data/lib/inch/cli/command/options/base_list.rb +0 -3
- data/lib/inch/cli/command/options/diff.rb +90 -0
- data/lib/inch/cli/command/output/diff.rb +96 -0
- data/lib/inch/code_object/proxy/base.rb +11 -1
- data/lib/inch/codebase.rb +2 -0
- data/lib/inch/codebase/serializer.rb +25 -0
- data/lib/inch/utils/shell_helper.rb +17 -0
- data/lib/inch/version.rb +1 -1
- data/test/fixtures/diff1/lib/diff1.rb +17 -0
- data/test/fixtures/diff2/lib/diff2.rb +25 -0
- data/test/integration/api/compare/codebases.rb +34 -0
- data/test/unit/code_object/provider/yard_test.rb +14 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe163966450ed56ad958a140312d1ead4e620f2d
|
4
|
+
data.tar.gz: 146138dacb4710aa3a44311c78fd1f8d797cecd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b58ec383478a3441018594906615bcf63423593239c877b02106b6eb6200b7d5243bfbe105a629fbc2c6f47534d73527a3d6e9d67e46d826fbcef56a7d84f285
|
7
|
+
data.tar.gz: 654bbd9012cefe46b37d51ffc1651003e7947c98328d67239227af875ebb5b41d75a2c533cad0fa168399567e867bf6c52df4257bce68047ef84f46d0d2807b2
|
data/lib/inch/api.rb
CHANGED
@@ -27,8 +27,10 @@ require_relative 'api/options/base'
|
|
27
27
|
require_relative 'api/options/filter'
|
28
28
|
require_relative 'api/options/suggest'
|
29
29
|
|
30
|
+
require_relative 'api/compare'
|
30
31
|
require_relative 'api/filter'
|
31
32
|
require_relative 'api/get'
|
32
33
|
require_relative 'api/list'
|
33
34
|
require_relative 'api/suggest'
|
34
35
|
require_relative 'api/stats'
|
36
|
+
require_relative 'api/diff'
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Inch
|
2
|
+
module API
|
3
|
+
module Compare
|
4
|
+
class CodeObjects
|
5
|
+
attr_reader :before, :after
|
6
|
+
|
7
|
+
def initialize(object1, object2)
|
8
|
+
@before, @after = object1, object2
|
9
|
+
if @before.object_id == @after.object_id
|
10
|
+
raise "@before and @after are identical ruby objects. this is bad."
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def changed?
|
15
|
+
present? && !unchanged?
|
16
|
+
end
|
17
|
+
|
18
|
+
def fullname
|
19
|
+
(@before || @after).fullname
|
20
|
+
end
|
21
|
+
|
22
|
+
def grade
|
23
|
+
@after.grade
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
def added?
|
28
|
+
@before.nil? && !@after.nil?
|
29
|
+
end
|
30
|
+
|
31
|
+
def degraded?
|
32
|
+
changed? && @before.score.to_i > @after.score.to_i
|
33
|
+
end
|
34
|
+
|
35
|
+
def improved?
|
36
|
+
changed? && @before.score.to_i < @after.score.to_i
|
37
|
+
end
|
38
|
+
|
39
|
+
def present?
|
40
|
+
@before && @after
|
41
|
+
end
|
42
|
+
|
43
|
+
def removed?
|
44
|
+
!@before.nil? && @after.nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
def unchanged?
|
48
|
+
present? && @before.score.to_i == @after.score.to_i
|
49
|
+
end
|
50
|
+
|
51
|
+
def scores
|
52
|
+
[@before.score.to_i, @after.score.to_i]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Inch
|
2
|
+
module API
|
3
|
+
module Compare
|
4
|
+
class Codebases
|
5
|
+
def initialize(codebase1, codebase2)
|
6
|
+
@a, @b = codebase1, codebase2
|
7
|
+
end
|
8
|
+
|
9
|
+
def added_objects
|
10
|
+
comparisons.select(&:added?)
|
11
|
+
end
|
12
|
+
|
13
|
+
def improved_objects
|
14
|
+
comparisons.select(&:improved?)
|
15
|
+
end
|
16
|
+
|
17
|
+
def degraded_objects
|
18
|
+
comparisons.select(&:degraded?)
|
19
|
+
end
|
20
|
+
|
21
|
+
def removed_objects
|
22
|
+
comparisons.select(&:removed?)
|
23
|
+
end
|
24
|
+
|
25
|
+
def comparisons
|
26
|
+
__objects_names.map do |fullname|
|
27
|
+
object1 = @a.objects.find(fullname)
|
28
|
+
object2 = @b.objects.find(fullname)
|
29
|
+
Compare::CodeObjects.new(object1, object2)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def find(fullname)
|
34
|
+
comparisons.detect do |comparison|
|
35
|
+
comparison.fullname == fullname
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def __objects_names
|
42
|
+
fullnames = @a.objects.all.map(&:fullname) +
|
43
|
+
@b.objects.all.map(&:fullname)
|
44
|
+
fullnames.uniq
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'inch/utils/shell_helper'
|
2
|
+
|
3
|
+
module Inch
|
4
|
+
module API
|
5
|
+
# Returns a Compare::Codebases object for two revisions of the same
|
6
|
+
# codebase
|
7
|
+
class Diff
|
8
|
+
include Utils::ShellHelper
|
9
|
+
|
10
|
+
attr_reader :codebase_old
|
11
|
+
attr_reader :codebase_new
|
12
|
+
attr_reader :comparer
|
13
|
+
attr_reader :work_dir
|
14
|
+
|
15
|
+
# @param dir [String] the working directory of the codebase
|
16
|
+
# @param before_rev [String] the 'before' revision
|
17
|
+
# @param after_rev [String,nil] the 'after' revision that the 'before'
|
18
|
+
# one is compared against
|
19
|
+
def initialize(dir, before_rev, after_rev = nil)
|
20
|
+
@work_dir = dir
|
21
|
+
@codebase_old = codebase_for(before_rev)
|
22
|
+
@codebase_new = if after_rev.nil?
|
23
|
+
Codebase.parse(work_dir)
|
24
|
+
else
|
25
|
+
codebase_for(after_rev)
|
26
|
+
end
|
27
|
+
@comparer = API::Compare::Codebases.new(@codebase_old, @codebase_new)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def codebase_for(revision)
|
33
|
+
if cached = codebase_from_cache(revision)
|
34
|
+
cached
|
35
|
+
else
|
36
|
+
codebase = codebase_from_copy(work_dir, revision)
|
37
|
+
filename = Codebase::Serializer.filename(revision)
|
38
|
+
Codebase::Serializer.save(codebase, filename)
|
39
|
+
codebase
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def codebase_from_cache(revision)
|
44
|
+
filename = Codebase::Serializer.filename(revision)
|
45
|
+
if File.exist?(filename)
|
46
|
+
Codebase::Serializer.load(filename)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def codebase_from_copy(original_dir, revision)
|
51
|
+
codebase = nil
|
52
|
+
Dir.mktmpdir do |tmp_dir|
|
53
|
+
new_dir = copy_work_dir(original_dir, tmp_dir)
|
54
|
+
git_reset(new_dir, revision)
|
55
|
+
codebase = Codebase.parse(new_dir)
|
56
|
+
end
|
57
|
+
codebase
|
58
|
+
end
|
59
|
+
|
60
|
+
def copy_work_dir(original_dir, tmp_dir)
|
61
|
+
git tmp_dir, "clone #{original_dir} --quiet"
|
62
|
+
File.join(tmp_dir, File.basename(original_dir))
|
63
|
+
end
|
64
|
+
|
65
|
+
def git_reset(dir, revision = nil)
|
66
|
+
git dir, "reset --hard #{revision}"
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/inch/cli/command.rb
CHANGED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require_relative 'options/diff'
|
3
|
+
require_relative 'output/diff'
|
4
|
+
|
5
|
+
module Inch
|
6
|
+
module CLI
|
7
|
+
module Command
|
8
|
+
class Diff < Base
|
9
|
+
register_command_as :diff
|
10
|
+
|
11
|
+
def description
|
12
|
+
'Shows a diff'
|
13
|
+
end
|
14
|
+
|
15
|
+
def usage
|
16
|
+
'Usage: inch diff [REV..[REV]] [options]'
|
17
|
+
end
|
18
|
+
|
19
|
+
def run(*args)
|
20
|
+
@options.parse(args)
|
21
|
+
@options.verify
|
22
|
+
|
23
|
+
before_rev, after_rev = revisions[0], revisions[1]
|
24
|
+
diff = API::Diff.new(work_dir, before_rev, after_rev)
|
25
|
+
|
26
|
+
Output::Diff.new(@options, diff.comparer)
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def git(dir, command)
|
32
|
+
old_pwd = Dir.pwd
|
33
|
+
Dir.chdir dir
|
34
|
+
out = `git #{command}`
|
35
|
+
Dir.chdir old_pwd
|
36
|
+
out
|
37
|
+
end
|
38
|
+
|
39
|
+
# @return [Array<String>] the revisions passed in the command_line
|
40
|
+
def revisions
|
41
|
+
@revisions ||= @options.revisions.map do |rev|
|
42
|
+
if rev
|
43
|
+
git(work_dir, "rev-parse #{rev}").strip
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def work_dir
|
49
|
+
Dir.pwd
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'inch/utils/shell_helper'
|
2
|
+
|
3
|
+
module Inch
|
4
|
+
module CLI
|
5
|
+
module Command
|
6
|
+
module Options
|
7
|
+
class Diff < BaseObject
|
8
|
+
include Utils::ShellHelper
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@before_rev = "HEAD"
|
12
|
+
@after_rev = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def descriptions
|
16
|
+
[
|
17
|
+
"",
|
18
|
+
"Shows changes in documentation between two revisions " \
|
19
|
+
"(defaults to last commit against current)",
|
20
|
+
"",
|
21
|
+
"Example: " + "$ inch diff HEAD^..HEAD".cyan,
|
22
|
+
"",
|
23
|
+
description_hint_grades,
|
24
|
+
description_hint_arrows
|
25
|
+
]
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_options(opts)
|
29
|
+
diff_options(opts)
|
30
|
+
common_options(opts)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Array<String>] the revisions to be diffed
|
34
|
+
# nil meaning the current working dir, including untracked files
|
35
|
+
# since these are later parsed via `git rev-parse`, we can support
|
36
|
+
# notations like "HEAD" or "HEAD^^"
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# revisions # => ["HEAD", nil]
|
40
|
+
def revisions
|
41
|
+
if object_names.empty?
|
42
|
+
[@before_rev, @after_rev]
|
43
|
+
else
|
44
|
+
object_names.first.split("..")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def since_last_commit?
|
49
|
+
revisions == ["HEAD", nil]
|
50
|
+
end
|
51
|
+
|
52
|
+
def since_last_push?
|
53
|
+
@since_last_push == true
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def diff_options(opts)
|
59
|
+
opts.separator ""
|
60
|
+
opts.separator "Diff options:"
|
61
|
+
|
62
|
+
opts.on("--since-last-commit", "Run diff against last commit (default)") do |count|
|
63
|
+
@before_rev = "HEAD"
|
64
|
+
end
|
65
|
+
opts.on("-p", "--since-last-push", "Run diff against last pushed commit") do |count|
|
66
|
+
@before_rev = get_pushed_rev
|
67
|
+
@since_last_push = true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [String] the reference for the pushed revision
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# get_pushed_rev # => "origin/master"
|
75
|
+
def get_pushed_rev
|
76
|
+
"#{remote}/#{current_branch}"
|
77
|
+
end
|
78
|
+
|
79
|
+
def current_branch
|
80
|
+
git Dir.pwd, "rev-parse --abbrev-ref HEAD"
|
81
|
+
end
|
82
|
+
|
83
|
+
def remote
|
84
|
+
"origin"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Inch
|
2
|
+
module CLI
|
3
|
+
module Command
|
4
|
+
module Output
|
5
|
+
class Diff < Base
|
6
|
+
extend Forwardable
|
7
|
+
|
8
|
+
attr_reader :comparer
|
9
|
+
|
10
|
+
# @param options [Options::Diff]
|
11
|
+
# @param comparer [API::Compare::Codebases]
|
12
|
+
def initialize(options, comparer)
|
13
|
+
@options = options
|
14
|
+
@comparer = comparer
|
15
|
+
|
16
|
+
added = @comparer.added_objects
|
17
|
+
improved = @comparer.improved_objects
|
18
|
+
degraded = @comparer.degraded_objects
|
19
|
+
|
20
|
+
if added.empty? && improved.empty? && degraded.empty?
|
21
|
+
ui.trace "No changes."
|
22
|
+
else
|
23
|
+
show(added, improved, degraded)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def show(added, improved, degraded)
|
30
|
+
if !(added.empty? && improved.empty?)
|
31
|
+
ui.trace
|
32
|
+
ui.header("Added or improved:", :green)
|
33
|
+
added.each do |compare|
|
34
|
+
puts_added compare.after
|
35
|
+
end
|
36
|
+
improved.each do |compare|
|
37
|
+
puts_improved compare.before, compare.after
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
if !degraded.empty?
|
42
|
+
ui.trace
|
43
|
+
ui.header("Degraded:", :red)
|
44
|
+
degraded.each do |compare|
|
45
|
+
puts_degraded compare.before, compare.after
|
46
|
+
end
|
47
|
+
end
|
48
|
+
ui.trace
|
49
|
+
ui.trace rev_hint
|
50
|
+
ui.trace
|
51
|
+
ui.trace "Format: grade (before -> after), priority, and name. " \
|
52
|
+
"Try `--help' for options.".dark
|
53
|
+
end
|
54
|
+
|
55
|
+
def puts_added(o)
|
56
|
+
grade = colored_grade(o)
|
57
|
+
priority = o.priority
|
58
|
+
change = " + ".dark + grade + " " + priority_arrow(o.priority)
|
59
|
+
ui.sub(" #{change} #{o.fullname}")
|
60
|
+
end
|
61
|
+
|
62
|
+
def puts_improved(before, o)
|
63
|
+
before_grade = colored_grade(before)
|
64
|
+
grade = colored_grade(o)
|
65
|
+
change = before_grade + " -> ".dark + grade + " " + priority_arrow(o.priority)
|
66
|
+
ui.sub(" #{change} #{o.fullname}")
|
67
|
+
end
|
68
|
+
alias :puts_degraded :puts_improved
|
69
|
+
|
70
|
+
def colored_grade(o)
|
71
|
+
r = grade_list(o.grade.to_sym)
|
72
|
+
o.grade.to_s.color(r.color)
|
73
|
+
end
|
74
|
+
|
75
|
+
def grade_list(grade_symbol)
|
76
|
+
@grade_lists ||= Evaluation.new_grade_lists
|
77
|
+
@grade_lists.detect { |r| r.grade.to_sym == grade_symbol }
|
78
|
+
end
|
79
|
+
|
80
|
+
def rev_hint
|
81
|
+
if @options.since_last_commit?
|
82
|
+
"Showing changes since your last commit."
|
83
|
+
elsif @options.since_last_push?
|
84
|
+
"Showing changes since you last pushed."
|
85
|
+
else
|
86
|
+
revisions = @options.revisions
|
87
|
+
before_rev = revisions[0]
|
88
|
+
after_rev = revisions[1] || "now"
|
89
|
+
"Showing changes between #{before_rev} and #{after_rev}."
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -24,7 +24,7 @@ module Inch
|
|
24
24
|
# convenient shortcuts to evalution object
|
25
25
|
def_delegators :evaluation, :score, :roles, :priority
|
26
26
|
|
27
|
-
def initialize(attributes)
|
27
|
+
def initialize(attributes = {})
|
28
28
|
@attributes = attributes
|
29
29
|
end
|
30
30
|
|
@@ -214,6 +214,16 @@ module Inch
|
|
214
214
|
self[:visibility]
|
215
215
|
end
|
216
216
|
|
217
|
+
# Used to persist the code object
|
218
|
+
def marshal_dump
|
219
|
+
@attributes
|
220
|
+
end
|
221
|
+
|
222
|
+
# Used to load a persisted code object
|
223
|
+
def marshal_load(attributes)
|
224
|
+
@attributes = attributes
|
225
|
+
end
|
226
|
+
|
217
227
|
def inspect
|
218
228
|
"#<#{self.class.to_s}: #{fullname}>"
|
219
229
|
end
|
data/lib/inch/codebase.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Inch
|
2
|
+
module Codebase
|
3
|
+
class Serializer
|
4
|
+
INCH_DB_DIR = File.join(".inch", "db")
|
5
|
+
|
6
|
+
def self.filename(revision)
|
7
|
+
File.join(INCH_DB_DIR, revision)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.save(codebase, filename)
|
11
|
+
content = Marshal.dump(codebase)
|
12
|
+
FileUtils.mkdir_p( File.dirname(filename) )
|
13
|
+
File.open(filename, 'wb') { |file| file.write(content) }
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.load(filename)
|
17
|
+
codebase = Marshal.load( File.binread(filename) )
|
18
|
+
codebase.objects.each do |object|
|
19
|
+
object.object_lookup = codebase.objects
|
20
|
+
end
|
21
|
+
codebase
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/inch/version.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
class Foo
|
2
|
+
# A complicated method
|
3
|
+
def b(o, i, *args, &block)
|
4
|
+
# ... snip ...
|
5
|
+
end
|
6
|
+
|
7
|
+
# An example of a method that takes a parameter (+param1+)
|
8
|
+
# and does nothing.
|
9
|
+
#
|
10
|
+
# Returns nil
|
11
|
+
def c(param1)
|
12
|
+
end
|
13
|
+
|
14
|
+
def d
|
15
|
+
"#{self.class}_#{id}.foo"
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class Foo
|
2
|
+
# New method
|
3
|
+
#
|
4
|
+
# Returns a string.
|
5
|
+
def a
|
6
|
+
end
|
7
|
+
|
8
|
+
# A complicated method
|
9
|
+
#
|
10
|
+
# @param o [String]
|
11
|
+
# @param i [String]
|
12
|
+
# @param args [Array]
|
13
|
+
# @param block [Proc]
|
14
|
+
# @return [void]
|
15
|
+
def b(o, i, *args, &block)
|
16
|
+
# ... snip ...
|
17
|
+
end
|
18
|
+
|
19
|
+
# An example of a method that takes a parameter (+param1+)
|
20
|
+
# and does nothing.
|
21
|
+
#
|
22
|
+
# Returns nil
|
23
|
+
def c(param1)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
2
|
+
|
3
|
+
describe ::Inch::API::Compare::Codebases do
|
4
|
+
let(:described_class) { ::Inch::API::Compare::Codebases }
|
5
|
+
|
6
|
+
it "should run" do
|
7
|
+
codebase1 = Inch::Codebase.parse fixture_path(:diff1)
|
8
|
+
codebase2 = Inch::Codebase.parse fixture_path(:diff2)
|
9
|
+
|
10
|
+
compare = described_class.new(codebase1, codebase2)
|
11
|
+
refute compare.comparisons.empty?
|
12
|
+
|
13
|
+
# Foo#a is added in diff2
|
14
|
+
comparison = compare.find("Foo#a")
|
15
|
+
assert comparison.added?
|
16
|
+
|
17
|
+
# Foo#b is improved in diff2
|
18
|
+
comparison = compare.find("Foo#b")
|
19
|
+
assert comparison.present?
|
20
|
+
assert comparison.changed?
|
21
|
+
assert comparison.improved?
|
22
|
+
|
23
|
+
# Foo#c stayed the same
|
24
|
+
comparison = compare.find("Foo#c")
|
25
|
+
assert comparison.present?
|
26
|
+
assert comparison.unchanged?
|
27
|
+
refute comparison.changed?
|
28
|
+
|
29
|
+
# Foo#d is removed in diff2
|
30
|
+
comparison = compare.find("Foo#d")
|
31
|
+
refute comparison.present?
|
32
|
+
assert comparison.removed?
|
33
|
+
end
|
34
|
+
end
|
@@ -8,4 +8,18 @@ describe ::Inch::CodeObject::Provider::YARD do
|
|
8
8
|
assert !provider.objects.empty?
|
9
9
|
end
|
10
10
|
|
11
|
+
it "should parse too different codebases" do
|
12
|
+
fullname = "Foo#b"
|
13
|
+
|
14
|
+
provider1 = described_class.parse(fixture_path(:diff1))
|
15
|
+
object1 = provider1.objects.detect { |o| o.fullname == fullname }
|
16
|
+
|
17
|
+
provider2 = described_class.parse(fixture_path(:diff2))
|
18
|
+
object2 = provider2.objects.detect { |o| o.fullname == fullname }
|
19
|
+
|
20
|
+
refute object1.nil?
|
21
|
+
refute object2.nil?
|
22
|
+
assert object1.object_id != object2.object_id
|
23
|
+
end
|
24
|
+
|
11
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- René Föhring
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,6 +133,10 @@ files:
|
|
133
133
|
- inch.gemspec
|
134
134
|
- lib/inch.rb
|
135
135
|
- lib/inch/api.rb
|
136
|
+
- lib/inch/api/compare.rb
|
137
|
+
- lib/inch/api/compare/code_objects.rb
|
138
|
+
- lib/inch/api/compare/codebases.rb
|
139
|
+
- lib/inch/api/diff.rb
|
136
140
|
- lib/inch/api/filter.rb
|
137
141
|
- lib/inch/api/get.rb
|
138
142
|
- lib/inch/api/list.rb
|
@@ -148,12 +152,14 @@ files:
|
|
148
152
|
- lib/inch/cli/command/base_list.rb
|
149
153
|
- lib/inch/cli/command/base_object.rb
|
150
154
|
- lib/inch/cli/command/console.rb
|
155
|
+
- lib/inch/cli/command/diff.rb
|
151
156
|
- lib/inch/cli/command/inspect.rb
|
152
157
|
- lib/inch/cli/command/list.rb
|
153
158
|
- lib/inch/cli/command/options/base.rb
|
154
159
|
- lib/inch/cli/command/options/base_list.rb
|
155
160
|
- lib/inch/cli/command/options/base_object.rb
|
156
161
|
- lib/inch/cli/command/options/console.rb
|
162
|
+
- lib/inch/cli/command/options/diff.rb
|
157
163
|
- lib/inch/cli/command/options/inspect.rb
|
158
164
|
- lib/inch/cli/command/options/list.rb
|
159
165
|
- lib/inch/cli/command/options/show.rb
|
@@ -161,6 +167,7 @@ files:
|
|
161
167
|
- lib/inch/cli/command/options/suggest.rb
|
162
168
|
- lib/inch/cli/command/output/base.rb
|
163
169
|
- lib/inch/cli/command/output/console.rb
|
170
|
+
- lib/inch/cli/command/output/diff.rb
|
164
171
|
- lib/inch/cli/command/output/inspect.rb
|
165
172
|
- lib/inch/cli/command/output/list.rb
|
166
173
|
- lib/inch/cli/command/output/show.rb
|
@@ -201,6 +208,7 @@ files:
|
|
201
208
|
- lib/inch/codebase/objects.rb
|
202
209
|
- lib/inch/codebase/objects_filter.rb
|
203
210
|
- lib/inch/codebase/proxy.rb
|
211
|
+
- lib/inch/codebase/serializer.rb
|
204
212
|
- lib/inch/config.rb
|
205
213
|
- lib/inch/config/base.rb
|
206
214
|
- lib/inch/config/codebase.rb
|
@@ -229,10 +237,13 @@ files:
|
|
229
237
|
- lib/inch/rake.rb
|
230
238
|
- lib/inch/rake/suggest.rb
|
231
239
|
- lib/inch/utils/read_write_methods.rb
|
240
|
+
- lib/inch/utils/shell_helper.rb
|
232
241
|
- lib/inch/utils/ui.rb
|
233
242
|
- lib/inch/utils/weighted_list.rb
|
234
243
|
- lib/inch/version.rb
|
235
244
|
- test/fixtures/code_examples/lib/foo.rb
|
245
|
+
- test/fixtures/diff1/lib/diff1.rb
|
246
|
+
- test/fixtures/diff2/lib/diff2.rb
|
236
247
|
- test/fixtures/inch-yml/.inch.yml
|
237
248
|
- test/fixtures/inch-yml/foo/bar.rb
|
238
249
|
- test/fixtures/inch-yml/foo/vendor/base.rb
|
@@ -249,6 +260,7 @@ files:
|
|
249
260
|
- test/fixtures/visibility/lib/foo.rb
|
250
261
|
- test/fixtures/yardopts/.yardopts
|
251
262
|
- test/fixtures/yardopts/foo/bar.rb
|
263
|
+
- test/integration/api/compare/codebases.rb
|
252
264
|
- test/integration/cli/command/console_test.rb
|
253
265
|
- test/integration/cli/command/inspect_test.rb
|
254
266
|
- test/integration/cli/command/list_test.rb
|
@@ -312,6 +324,8 @@ specification_version: 4
|
|
312
324
|
summary: Documentation measurement tool for Ruby
|
313
325
|
test_files:
|
314
326
|
- test/fixtures/code_examples/lib/foo.rb
|
327
|
+
- test/fixtures/diff1/lib/diff1.rb
|
328
|
+
- test/fixtures/diff2/lib/diff2.rb
|
315
329
|
- test/fixtures/inch-yml/.inch.yml
|
316
330
|
- test/fixtures/inch-yml/foo/bar.rb
|
317
331
|
- test/fixtures/inch-yml/foo/vendor/base.rb
|
@@ -328,6 +342,7 @@ test_files:
|
|
328
342
|
- test/fixtures/visibility/lib/foo.rb
|
329
343
|
- test/fixtures/yardopts/.yardopts
|
330
344
|
- test/fixtures/yardopts/foo/bar.rb
|
345
|
+
- test/integration/api/compare/codebases.rb
|
331
346
|
- test/integration/cli/command/console_test.rb
|
332
347
|
- test/integration/cli/command/inspect_test.rb
|
333
348
|
- test/integration/cli/command/list_test.rb
|