ruby_detective 0.0.2 → 0.0.3
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/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +14 -8
- data/Rakefile +37 -0
- data/ruby_detective.gemspec +1 -1
- data/views/template.html.erb +3 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c8aef4be729580d56700840749a062f8634b0c62b19fc9f744195eefa5f6a57
|
4
|
+
data.tar.gz: f265f8c31e1a7f18baa324797e3ee29b2094e1a1cbf1a46d3bbcb2982c632f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd494208b3a50457dacd219fde9821704ce5f4cb10d326ef0afa4595fa6df1f4957f825ed51c8d2ecce0f52353ed6d4cbe7bd3bf4cdeacc8f32e2b1cc69da865
|
7
|
+
data.tar.gz: f492ecd6a0945640420f8c5e0f5bcc12ca78ecdbdf795dd06b0a9ef9df5788d64a398d173b1b8a5f4008b49d8dc97440b06c1db53bd8ca8be8af7232b61eb911
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
# Ruby Detective
|
2
|
-
### Investigating your
|
2
|
+
### Investigating your code dependencies
|
3
3
|
|
4
|
-
Ruby Detective is a gem that parses your code, finds it's dependencies and outputs
|
4
|
+
Ruby Detective is a gem that parses your code, finds it's dependencies and outputs an interactive .html file that you can use to explore the dependency network of the code.
|
5
5
|
|
6
|
-
This is the UI for the Ruby Detective project by the way
|
6
|
+
This is the UI for the Ruby Detective project by the way:
|
7
7
|
|
8
|
-
|
8
|
+
### [Click here to access the live preview](https://victor-am.github.io/ruby_detective/preview.html)
|
9
|
+
|
10
|
+
[](https://victor-am.github.io/ruby_detective/preview.html)
|
9
11
|
|
10
12
|
***:** Due to Ruby metaprogramming super-powers (and by extension Rails heavy use of those) it's unfeasible to find every single dependency, so we can only guarantee that explicit constants will be pointed as dependencies.
|
11
13
|
|
@@ -13,18 +15,20 @@ This is the UI for the Ruby Detective project by the way :smile:
|
|
13
15
|
- Explorable and interactive network graph of the project dependencies
|
14
16
|
- Graph nodes colored by namespace, making it easier to spot contexts
|
15
17
|
- Useful information like lines of code, number of dependencies and dependents, etc
|
16
|
-
-
|
18
|
+
- Outputs a fully self-contained .html file that can be easily shared
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
**Make sure you have Ruby 2.5 or higher installed (lower versions are not supported)**
|
17
22
|
|
18
|
-
## Instalation
|
19
23
|
```
|
20
|
-
gem install
|
24
|
+
gem install ruby_detective
|
21
25
|
```
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
29
|
```
|
26
30
|
cd my-project-folder
|
27
|
-
|
31
|
+
ruby_detective .
|
28
32
|
```
|
29
33
|
|
30
34
|
This should output an html file at the end that is completely self-contained, and can be shared around with your peers :D
|
@@ -33,3 +37,5 @@ This should output an html file at the end that is completely self-contained, an
|
|
33
37
|
- Click on a node to bring it's card to the top of the list on the left
|
34
38
|
- Click twice on a node to add it to the graph, allowing to navigate through dependencies
|
35
39
|
- Use the filters on the right to customize the graph, toggling off the "Show second-level dependency edges" option can be specially useful
|
40
|
+
|
41
|
+
*This gem was inspired by @emad-elsaid library [rubrowser](https://github.com/emad-elsaid/rubrowser).*
|
data/Rakefile
CHANGED
@@ -7,3 +7,40 @@ begin
|
|
7
7
|
rescue LoadError
|
8
8
|
# no rspec available
|
9
9
|
end
|
10
|
+
|
11
|
+
desc "Rebuilds the template file in views/template.html.erb and commits it"
|
12
|
+
task :build_ui do
|
13
|
+
system <<~SHELL
|
14
|
+
cd ui &&
|
15
|
+
yarn build &&
|
16
|
+
cd - &&
|
17
|
+
git add . &&
|
18
|
+
git commit -m 'Build the UI template'
|
19
|
+
SHELL
|
20
|
+
end
|
21
|
+
|
22
|
+
VERSION_LINE_REGEX = /s\.version.*$/
|
23
|
+
GEMSPEC_FILE = "ruby_detective.gemspec"
|
24
|
+
|
25
|
+
desc "Bumps the gem version and commits it with an annotated tag"
|
26
|
+
task :bump_version, [:new_version] do |_t, args|
|
27
|
+
new_version = args[:new_version]
|
28
|
+
|
29
|
+
gemspec_file = File.read(GEMSPEC_FILE)
|
30
|
+
version_line = gemspec_file.scan(VERSION_LINE_REGEX).first
|
31
|
+
|
32
|
+
new_version_line = version_line.sub(/\d+\.\d+\.\d+/, new_version)
|
33
|
+
new_gemspec_file = gemspec_file.sub(VERSION_LINE_REGEX, new_version_line)
|
34
|
+
File.open(GEMSPEC_FILE, "w") {|file| file.puts new_gemspec_file }
|
35
|
+
|
36
|
+
system <<~SHELL
|
37
|
+
git add . &&
|
38
|
+
git commit -m 'Bump version to #{new_version}' &&
|
39
|
+
git tag v#{new_version}
|
40
|
+
SHELL
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Builds the gem"
|
44
|
+
task :build_gem do
|
45
|
+
system "gem build ruby_detective.gemspec"
|
46
|
+
end
|
data/ruby_detective.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "ruby_detective"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.3"
|
4
4
|
s.date = "2020-01-20"
|
5
5
|
s.summary = "Allows to investigate your ruby project dependency network"
|
6
6
|
s.description = "Ruby Detective is a gem that parses your code, finds it's dependencies and outputs a interactive .html file that you can use to explore the dependency network of the code."
|