-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Using rails_stats v1.0.2
Given I have added gem "rails_stats"
to my Gemfile
and I have the following app's file structure (typical when using packs-rails):
my_rails_app/
├── app
│ ├── controllers
│ └── models
├── lib
└── packs
├── pack1
│ ├── app
│ │ ├── controllers
│ │ └── models
│ └── lib
└── pack2
├── app
│ ├── controllers
│ └── models
└── lib
If I run rake stats
from inside my_rails_app
, it correctly shows stats including files from the main app as well as each of my packwerk packs living in packs/*:
$rake stats
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
|...real output removed but it's correctly including all files |
| from . and from packs/* |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | xxxx | xxxx | xxxx | xxxx | xx | xx |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: xxx Test LOC: xxx Code to Test Ratio: 1:x.x
Trying to get stats about a specific pack's files, from inside the app's root directory (my_rails_app
), doesn't work as expected. The stats are still calculated for the whole app, but it includes the header stating the directory too:
$rake stats[packs/pack1]
Directory: /home/oboxodo/Code/my_rails_app
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| ...real output removed but it's the same output |
| as running it for the whole app |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | xxxx | xxxx | xxxx | xxxx | xx | xx |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: xxx Test LOC: xxx Code to Test Ratio: 1:x.x
Now, if I move outside the app's directory, to the parent, and I create a Rakefile with require "rails_stats"
, then this works as expected:
$for pack in my_rails_app/packs/*; do rake stats[$pack]; done
Directory: /home/oboxodo/Code/my_rails_app/packs/pack1
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
|...real output removed... |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | xxxx | xxxx | xxxx | xxxx | xx | xx |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: xxx Test LOC: xxx Code to Test Ratio: 1:x.x
Directory: /home/oboxodo/Code/my_rails_app/packs/pack2
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
|...real output removed... |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | xxxx | xxxx | xxxx | xxxx | xx | xx |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: xxx Test LOC: xxx Code to Test Ratio: 1:x.x
I hope I was able to express the problem 😅
Metadata
Metadata
Assignees
Labels
No labels