rubylens 0.1.0 → 0.2.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/README.md +67 -39
- data/assets/runtime/report.js +1607 -251
- data/assets/shells/report.html +9 -7
- data/assets/shells/showcase.html +1 -0
- data/assets/styles/report.css +51 -25
- data/assets/styles/showcase.css +3 -0
- data/lib/rubylens/art_model_builder.rb +62 -10
- data/lib/rubylens/artifact_marker.rb +17 -0
- data/lib/rubylens/atomic_output.rb +27 -0
- data/lib/rubylens/cli.rb +53 -36
- data/lib/rubylens/clip/chrome_page.rb +183 -0
- data/lib/rubylens/clip/deadline_io.rb +28 -0
- data/lib/rubylens/clip/renderer.rb +113 -0
- data/lib/rubylens/clip/toolchain.rb +82 -0
- data/lib/rubylens/clip/web_socket_channel.rb +116 -0
- data/lib/rubylens/clip_generator.rb +102 -0
- data/lib/rubylens/default_output.rb +24 -0
- data/lib/rubylens/generator.rb +9 -10
- data/lib/rubylens/git_repository.rb +13 -7
- data/lib/rubylens/index/manifest.rb +8 -7
- data/lib/rubylens/index/rspec_extractor.rb +12 -10
- data/lib/rubylens/index/rubydex_adapter.rb +290 -140
- data/lib/rubylens/index/source_path.rb +12 -11
- data/lib/rubylens/model/dependency_aggregation.rb +9 -7
- data/lib/rubylens/morphology_classifier.rb +52 -12
- data/lib/rubylens/report_writer.rb +5 -20
- data/lib/rubylens/showcase_generator.rb +5 -9
- data/lib/rubylens/showcase_model.rb +12 -14
- data/lib/rubylens/showcase_writer.rb +0 -6
- data/lib/rubylens/version.rb +1 -1
- data/lib/rubylens.rb +7 -0
- metadata +10 -1
|
@@ -22,19 +22,25 @@ module RubyLens
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def selected_files
|
|
25
|
-
|
|
25
|
+
arguments = ["ls-files", "-z", "--cached", "--others", "--exclude-standard"]
|
|
26
|
+
unless @target_root == @git_root
|
|
27
|
+
relative_target = @target_root.relative_path_from(@git_root)
|
|
28
|
+
arguments.concat(["--", ":(literal)#{relative_target}"])
|
|
29
|
+
end
|
|
30
|
+
output, status = capture(*arguments)
|
|
26
31
|
raise GitError, "failed to enumerate tracked and unignored files" unless status.success?
|
|
27
32
|
|
|
33
|
+
git_root = @git_root.to_s
|
|
34
|
+
target_root = @target_root.to_s
|
|
28
35
|
output.split("\0").filter_map do |relative_to_git|
|
|
29
36
|
next unless INDEXABLE_EXTENSIONS.include?(File.extname(relative_to_git))
|
|
30
37
|
|
|
31
|
-
absolute =
|
|
32
|
-
next unless
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
next unless Paths.inside?(resolved, @target_root.realpath)
|
|
38
|
+
absolute = File.join(git_root, relative_to_git)
|
|
39
|
+
next unless File.file?(absolute)
|
|
40
|
+
resolved = File.realpath(absolute)
|
|
41
|
+
next unless Paths.inside?(resolved, target_root)
|
|
36
42
|
|
|
37
|
-
resolved
|
|
43
|
+
resolved
|
|
38
44
|
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
|
|
39
45
|
nil
|
|
40
46
|
end.sort
|
|
@@ -70,10 +70,11 @@ module RubyLens
|
|
|
70
70
|
|
|
71
71
|
def package_index_for(path)
|
|
72
72
|
path = path.to_s
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
@package_index_by_file.fetch(path) do
|
|
74
|
+
@package_index_cache.fetch(path) do
|
|
75
|
+
@package_index_cache[path] = uncached_package_index_for(path)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
77
78
|
rescue Errno::ENOENT, Errno::EACCES, Errno::ELOOP
|
|
78
79
|
nil
|
|
79
80
|
end
|
|
@@ -84,9 +85,9 @@ module RubyLens
|
|
|
84
85
|
|
|
85
86
|
def relative_workspace_path(path)
|
|
86
87
|
path = path.to_s
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
@relative_workspace_path_cache.fetch(path) do
|
|
89
|
+
@relative_workspace_path_cache[path] = uncached_relative_workspace_path(path)
|
|
90
|
+
end
|
|
90
91
|
end
|
|
91
92
|
|
|
92
93
|
private
|
|
@@ -11,28 +11,24 @@ module RubyLens
|
|
|
11
11
|
SPEC_SEGMENTS = Set.new(%w[spec specs]).freeze
|
|
12
12
|
PROXY_NAME_PREFIX = "RSpec example group #"
|
|
13
13
|
|
|
14
|
-
Group = Data.define(:name, :component)
|
|
15
14
|
Result = Data.define(:groups, :method_count)
|
|
16
15
|
|
|
17
|
-
def initialize(graph:, manifest:, package_document_paths: Set.new)
|
|
16
|
+
def initialize(graph:, manifest:, package_document_paths: Set.new, documents_with_paths: nil)
|
|
18
17
|
@graph = graph
|
|
19
18
|
@manifest = manifest
|
|
20
19
|
@package_document_paths = package_document_paths
|
|
20
|
+
@documents_with_paths = documents_with_paths
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def call
|
|
24
24
|
groups = []
|
|
25
25
|
method_count = 0
|
|
26
26
|
|
|
27
|
-
spec_documents.each do |document,
|
|
27
|
+
spec_documents.each do |document, _relative|
|
|
28
28
|
group_count, example_count = reference_counts(document.method_references)
|
|
29
29
|
method_count += example_count
|
|
30
|
-
component = SourcePath.component_for(relative)
|
|
31
30
|
group_count.times do
|
|
32
|
-
groups <<
|
|
33
|
-
format("%s%06d", PROXY_NAME_PREFIX, groups.length + 1),
|
|
34
|
-
component,
|
|
35
|
-
)
|
|
31
|
+
groups << format("%s%06d", PROXY_NAME_PREFIX, groups.length + 1)
|
|
36
32
|
end
|
|
37
33
|
end
|
|
38
34
|
|
|
@@ -41,10 +37,16 @@ module RubyLens
|
|
|
41
37
|
|
|
42
38
|
private
|
|
43
39
|
|
|
40
|
+
# The adapter passes its already-resolved [document, path] pairs so the
|
|
41
|
+
# documents are not re-enumerated and their URIs not re-parsed here;
|
|
42
|
+
# standalone construction still resolves them from the graph.
|
|
44
43
|
def spec_documents
|
|
45
|
-
@graph.documents.filter_map do |document|
|
|
44
|
+
pairs = @documents_with_paths || @graph.documents.filter_map do |document|
|
|
46
45
|
path = SourcePath.from_file_uri(document.uri)
|
|
47
|
-
|
|
46
|
+
[document, path] if path
|
|
47
|
+
end
|
|
48
|
+
pairs.filter_map do |document, path|
|
|
49
|
+
next unless @manifest.workspace_path?(path)
|
|
48
50
|
next if @package_document_paths.include?(path)
|
|
49
51
|
|
|
50
52
|
relative = @manifest.relative_workspace_path(path)
|