ruby-maat 1.2.0 → 1.3.4

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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-maat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Tornhill
@@ -9,7 +9,7 @@ authors:
9
9
  - Bart Agapinan
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2025-08-17 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: csv
@@ -43,16 +43,22 @@ dependencies:
43
43
  name: rover-df
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0.3'
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '2.0'
49
52
  type: :runtime
50
53
  prerelease: false
51
54
  version_requirements: !ruby/object:Gem::Requirement
52
55
  requirements:
53
- - - "~>"
56
+ - - ">="
54
57
  - !ruby/object:Gem::Version
55
58
  version: '0.3'
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
56
62
  description: Ruby Maat is a command line tool used to mine and analyze data from version-control
57
63
  systems (VCS). This is a Ruby port of the original Clojure Code Maat.
58
64
  email:
@@ -63,19 +69,15 @@ extensions: []
63
69
  extra_rdoc_files: []
64
70
  files:
65
71
  - ".commitlintrc.json"
66
- - ".mailmap"
67
72
  - ".overcommit.yml"
68
73
  - ".release-please-manifest.json"
69
74
  - ".rspec"
70
75
  - ".rubocop.yml"
71
76
  - ".standard.yml"
72
77
  - CHANGELOG.md
73
- - CI_CD_SETUP.md
74
78
  - CLAUDE.md
75
79
  - Dockerfile
76
80
  - README.md
77
- - README_RUBY.md
78
- - RUBY_MAAT.md
79
81
  - Rakefile
80
82
  - doc/imgs/abs_churn_sample.png
81
83
  - doc/imgs/code_age_sample.png
@@ -106,6 +108,7 @@ files:
106
108
  - lib/ruby_maat/generators/git_generator.rb
107
109
  - lib/ruby_maat/generators/svn_generator.rb
108
110
  - lib/ruby_maat/groupers/layer_grouper.rb
111
+ - lib/ruby_maat/groupers/merge_commit_grouper.rb
109
112
  - lib/ruby_maat/groupers/team_mapper.rb
110
113
  - lib/ruby_maat/groupers/time_grouper.rb
111
114
  - lib/ruby_maat/output/csv_output.rb
@@ -142,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
145
  - !ruby/object:Gem::Version
143
146
  version: '0'
144
147
  requirements: []
145
- rubygems_version: 3.6.2
148
+ rubygems_version: 3.6.9
146
149
  specification_version: 4
147
150
  summary: A command line tool used to mine and analyze data from version-control systems
148
151
  test_files: []
data/.mailmap DELETED
@@ -1,3 +0,0 @@
1
- Adam Tornhill <adam@adamtornhill.com> Adam Petersen <adam@adampetersen.se>
2
- robertc <robert@logicalchaos.org> LogicalChaos <robert@logicalchaos.org>
3
- Adam Tornhill <adam@adamtornhill.com> Adam Petersen Tornhill <adam@adampetersen.se>
data/CI_CD_SETUP.md DELETED
@@ -1,180 +0,0 @@
1
- # CI/CD Setup Documentation
2
-
3
- This document describes the GitHub Actions CI/CD pipeline for the Ruby Maat project.
4
-
5
- ## Workflows
6
-
7
- ### 1. CI Workflow (`.github/workflows/ci.yml`)
8
-
9
- Runs on every push and pull request to main/master branches.
10
-
11
- #### Jobs
12
-
13
- - **Test**: Runs RSpec tests across multiple Ruby versions (3.2, 3.3, 3.4) and operating systems (Ubuntu, macOS, Windows)
14
- - **Lint**: Runs RuboCop and StandardRB linting
15
- - **Security**: Runs Bundler Audit for security vulnerabilities
16
- - **Integration**: Tests CLI functionality with sample data
17
- - **Build**: Builds the gem and uploads it as an artifact
18
-
19
- #### Matrix Testing
20
-
21
- - Ruby versions: 3.2, 3.3, 3.4
22
- - Operating systems: Ubuntu (all versions), macOS (all versions), Windows (Ruby 3.3 only)
23
-
24
- ### 2. Release Please Workflow (`.github/workflows/publish.yml`)
25
-
26
- Runs on every push to main/master branches and uses conventional commits to automate releases.
27
-
28
- #### How it works
29
-
30
- 1. **Release Please** analyzes conventional commits since the last release
31
- 2. **Creates Release PRs** when releasable changes are detected
32
- 3. **Merging a Release PR** triggers the actual release:
33
- - Updates version in `lib/ruby_maat/version.rb` and `ruby-maat.gemspec`
34
- - Generates/updates `CHANGELOG.md` automatically
35
- - Creates a GitHub release with the changelog
36
- - Runs full test suite and linting
37
- - Publishes gem to RubyGems.org
38
- - Uploads gem artifact to the release
39
-
40
- ## Required Secrets
41
-
42
- To enable automatic publishing to RubyGems, add these secrets to your GitHub repository:
43
-
44
- ### RubyGems API Key
45
-
46
- 1. Get your API key from [RubyGems.org](https://rubygems.org/profile/edit)
47
- 2. Add it as a repository secret named `RUBYGEMS_API_KEY`
48
-
49
- ### GitHub Token
50
-
51
- - `GITHUB_TOKEN` is automatically provided by GitHub Actions
52
-
53
- ## Environment Setup
54
-
55
- The publish workflow uses a GitHub Environment named `rubygems` for additional security. To set this up:
56
-
57
- 1. Go to your repository Settings → Environments
58
- 2. Create an environment named `rubygems`
59
- 3. Add protection rules (recommended):
60
- - Required reviewers
61
- - Deployment branches (limit to main/master)
62
-
63
- ## Dependabot
64
-
65
- Dependabot is configured to:
66
-
67
- - Check for Ruby gem updates weekly (Sundays at 09:00)
68
- - Check for GitHub Actions updates weekly
69
- - Create PRs with appropriate labels and assignees
70
-
71
- ## Coverage Reporting
72
-
73
- SimpleCov is configured to:
74
-
75
- - Generate coverage reports for all test runs
76
- - Group coverage by component (Analyses, Parsers, Output)
77
- - Require minimum 50% coverage (adjustable in `spec/spec_helper.rb`)
78
- - Upload coverage to Codecov (when CODECOV_TOKEN is set)
79
-
80
- ## Security Scanning
81
-
82
- The CI pipeline includes:
83
-
84
- - Bundler Audit for dependency vulnerabilities
85
- - RuboCop security cops
86
- - Dependabot security updates
87
-
88
- ## Local Development
89
-
90
- To run the same checks locally:
91
-
92
- ```bash
93
- # Install dependencies
94
- bundle install
95
-
96
- # Run tests with coverage
97
- bundle exec rspec
98
-
99
- # Run linting
100
- bundle exec rubocop
101
- bundle exec standardrb
102
-
103
- # Run security audit
104
- bundle exec bundler-audit
105
-
106
- # Build gem
107
- gem build ruby-maat.gemspec
108
- ```
109
-
110
- ## Triggering a Release
111
-
112
- Release Please uses **conventional commits** to automatically determine version bumps and generate changelogs:
113
-
114
- ### Conventional Commit Format
115
-
116
- ```
117
- <type>(<scope>): <description>
118
-
119
- [optional body]
120
-
121
- [optional footer(s)]
122
- ```
123
-
124
- ### Commit Types
125
-
126
- - `feat:` - New features (triggers minor version bump)
127
- - `fix:` - Bug fixes (triggers patch version bump)
128
- - `feat!:` or `BREAKING CHANGE:` - Breaking changes (triggers major version bump)
129
- - `docs:`, `style:`, `refactor:`, `test:`, `chore:`, `ci:`, `deps:` - No version bump
130
-
131
- ### Release Process
132
-
133
- 1. **Make commits** using conventional commit format
134
- 2. **Push to main/master** - Release Please analyzes commits
135
- 3. **Review Release PR** - Automatically created when releasable changes exist
136
- 4. **Merge Release PR** - Triggers automatic release and publication
137
-
138
- ### Example Commits
139
-
140
- ```bash
141
- git commit -m "feat(analysis): add new coupling algorithm"
142
- git commit -m "fix(parser): handle empty git logs correctly"
143
- git commit -m "docs: update CLI usage examples"
144
- git commit -m "feat!: change CLI argument format" # breaking change
145
- ```
146
-
147
- ### Set up commit message template
148
-
149
- ```bash
150
- git config commit.template .gitmessage
151
- ```
152
-
153
- ## Troubleshooting
154
-
155
- ### Gem Push Fails
156
-
157
- - Verify `RUBYGEMS_API_KEY` secret is set correctly
158
- - Ensure you have push permissions to the gem on RubyGems.org
159
- - Check that the gem version hasn't been published already
160
-
161
- ### Test Failures
162
-
163
- - Check the CI logs for specific failure reasons
164
- - Ensure all dependencies are properly specified
165
- - Test matrix may reveal OS or Ruby version specific issues
166
-
167
- ### Coverage Too Low
168
-
169
- - Add tests for uncovered code
170
- - Adjust minimum coverage threshold in `spec/spec_helper.rb` if needed
171
- - Check coverage report in the `coverage/` directory after running tests
172
-
173
- ## Badge Status
174
-
175
- Add these badges to your README to show CI status:
176
-
177
- ```markdown
178
- ![CI](https://github.com/viamin/ruby-maat/workflows/CI/badge.svg)
179
- ![Gem Version](https://badge.fury.io/rb/ruby-maat.svg)
180
- ```
data/README_RUBY.md DELETED
@@ -1,300 +0,0 @@
1
- # Ruby Maat
2
-
3
- [![Gem Version](https://badge.fury.io/rb/ruby-maat.svg)](https://badge.fury.io/rb/ruby-maat)
4
- [![Build Status](https://github.com/viamin/ruby-maat/workflows/CI/badge.svg)](https://github.com/viamin/ruby-maat/actions)
5
-
6
- Ruby Maat is a command line tool used to mine and analyze data from version-control systems (VCS). It's a Ruby port of the original [Code Maat](https://github.com/adamtornhill/code-maat) by Adam Tornhill.
7
-
8
- Ruby Maat was developed to accompany the discussions in the books [Your Code as a Crime Scene](https://pragprog.com/titles/atcrime/your-code-as-a-crime-scene) and [Software Design X-Rays](https://pragprog.com/titles/atevol/software-design-x-rays).
9
-
10
- **Note:** The analyses have evolved into [CodeScene](https://codescene.io/), which automates all the analyses found in Ruby Maat and several new ones.
11
-
12
- ## Drop-in Replacement
13
-
14
- Ruby Maat is designed as a **drop-in replacement** for Code Maat. It supports:
15
-
16
- - ✅ Identical command-line arguments
17
- - ✅ Same VCS log file formats
18
- - ✅ Compatible CSV output format
19
- - ✅ All original analysis types
20
-
21
- Simply replace `java -jar code-maat.jar` with `ruby-maat` in your existing scripts!
22
-
23
- ## Installation
24
-
25
- ### Via RubyGems (Recommended)
26
-
27
- ```bash
28
- gem install ruby-maat
29
- ```
30
-
31
- ### From Source
32
-
33
- ```bash
34
- git clone https://github.com/viamin/ruby-maat.git
35
- cd ruby-maat
36
- bundle install
37
- rake install
38
- ```
39
-
40
- ### Requirements
41
-
42
- - Ruby 3.2 or later
43
- - No external dependencies beyond the gem requirements
44
-
45
- ## Usage
46
-
47
- ### Basic Usage
48
-
49
- ```bash
50
- # Analyze Git repository
51
- ruby-maat -l logfile.log -c git2 -a summary
52
-
53
- # With specific analysis
54
- ruby-maat -l logfile.log -c git2 -a coupling
55
-
56
- # Write to file
57
- ruby-maat -l logfile.log -c git2 -a authors -o results.csv
58
- ```
59
-
60
- ### Command Line Options
61
-
62
- ```
63
- Usage: ruby-maat -l log-file -c vcs-type [options]
64
-
65
- Required:
66
- -l, --log LOG Log file with input data
67
- -c, --version-control VCS Input vcs module type: supports svn, git, git2, hg, p4, or tfs
68
-
69
- Analysis:
70
- -a, --analysis ANALYSIS The analysis to run (default: authors)
71
- Available: abs-churn, age, author-churn, authors, communication,
72
- coupling, entity-churn, entity-effort, entity-ownership,
73
- fragmentation, identity, main-dev, main-dev-by-revs, messages,
74
- refactoring-main-dev, revisions, soc, summary
75
-
76
- Output:
77
- -r, --rows ROWS Max rows in output
78
- -o, --outfile OUTFILE Write the result to the given file name
79
- --input-encoding ENCODING Specify an encoding other than UTF-8 for the log file
80
-
81
- Grouping:
82
- -g, --group GROUP A file with a pre-defined set of layers
83
- -p, --team-map-file TEAM_MAP A CSV file with author,team mappings
84
- -t, --temporal-period PERIOD Group commits by temporal period
85
-
86
- Filtering:
87
- -n, --min-revs MIN_REVS Minimum number of revisions (default: 5)
88
- -m, --min-shared-revs MIN_SHARED Minimum shared revisions (default: 5)
89
- -i, --min-coupling MIN_COUPLING Minimum coupling percentage (default: 30)
90
- -x, --max-coupling MAX_COUPLING Maximum coupling percentage (default: 100)
91
- -s, --max-changeset-size SIZE Maximum changeset size (default: 30)
92
-
93
- Analysis-specific:
94
- -e, --expression-to-match REGEX Regex for commit message analysis
95
- -d, --age-time-now DATE Reference date for age analysis (YYYY-MM-dd)
96
- --verbose-results Include additional analysis details
97
-
98
- Other:
99
- -h, --help Show this help message
100
- --version Show version information
101
- ```
102
-
103
- ## Generating Input Data
104
-
105
- Ruby Maat operates on log files from version-control systems. **Use the exact same commands as Code Maat:**
106
-
107
- ### Git (Recommended: git2 format)
108
-
109
- ```bash
110
- git log --all --numstat --date=short --pretty=format:'--%h--%ad--%aN' --no-renames --after=YYYY-MM-DD > logfile.log
111
- ```
112
-
113
- Then use `-c git2` when running Ruby Maat.
114
-
115
- ### Git (Legacy format)
116
-
117
- ```bash
118
- git log --pretty=format:'[%h] %aN %ad %s' --date=short --numstat --after=YYYY-MM-DD > logfile.log
119
- ```
120
-
121
- Then use `-c git` when running Ruby Maat.
122
-
123
- ### Subversion
124
-
125
- ```bash
126
- svn log -v --xml > logfile.log -r {YYYYmmDD}:HEAD
127
- ```
128
-
129
- ### Other VCS Systems
130
-
131
- Ruby Maat supports the same log formats as Code Maat for:
132
-
133
- - Mercurial (`hg`)
134
- - Perforce (`p4`)
135
- - Team Foundation Server (`tfs`)
136
-
137
- See the [original documentation](https://github.com/adamtornhill/code-maat#generating-input-data) for specific commands.
138
-
139
- ## Available Analyses
140
-
141
- | Analysis | Description |
142
- |----------|-------------|
143
- | `authors` | Number of authors per module (default) |
144
- | `revisions` | Number of revisions per entity |
145
- | `coupling` | Logical coupling between modules |
146
- | `soc` | Sum of coupling per entity |
147
- | `summary` | High-level project statistics |
148
- | `abs-churn` | Absolute code churn over time |
149
- | `author-churn` | Code churn per author |
150
- | `entity-churn` | Code churn per entity |
151
- | `entity-ownership` | Code ownership per author per entity |
152
- | `main-dev` | Main developer per entity (by lines) |
153
- | `main-dev-by-revs` | Main developer per entity (by commits) |
154
- | `entity-effort` | Development effort per author per entity |
155
- | `fragmentation` | Ownership fragmentation (fractal value) |
156
- | `communication` | Developer communication patterns |
157
- | `age` | Code age analysis |
158
- | `messages` | Commit message word frequency |
159
- | `identity` | Raw data dump (debugging) |
160
-
161
- ## Examples
162
-
163
- ### Authors Analysis
164
-
165
- ```bash
166
- ruby-maat -l git.log -c git2 -a authors
167
- ```
168
-
169
- Output:
170
-
171
- ```csv
172
- entity,n-authors,n-revs
173
- InfoUtils.java,12,60
174
- BarChart.java,7,30
175
- Page.java,4,27
176
- ```
177
-
178
- ### Logical Coupling
179
-
180
- ```bash
181
- ruby-maat -l git.log -c git2 -a coupling
182
- ```
183
-
184
- Output:
185
-
186
- ```csv
187
- entity,coupled,degree,average-revs
188
- InfoUtils.java,Page.java,78,44
189
- InfoUtils.java,BarChart.java,62,45
190
- ```
191
-
192
- ### Summary Statistics
193
-
194
- ```bash
195
- ruby-maat -l git.log -c git2 -a summary
196
- ```
197
-
198
- Output:
199
-
200
- ```csv
201
- statistic,value
202
- number-of-commits,919
203
- number-of-entities,730
204
- number-of-entities-changed,3397
205
- number-of-authors,79
206
- ```
207
-
208
- ## Advanced Features
209
-
210
- ### Architectural Grouping
211
-
212
- Group files into architectural layers:
213
-
214
- ```
215
- # layers.txt
216
- src/Features/Core => Core
217
- ^src\/.*\/.*Tests\.cs$ => CS Tests
218
- ```
219
-
220
- ```bash
221
- ruby-maat -l git.log -c git2 -a coupling -g layers.txt
222
- ```
223
-
224
- ### Team Analysis
225
-
226
- Map individual authors to teams:
227
-
228
- ```csv
229
- # teams.csv
230
- author,team
231
- john.doe,Backend Team
232
- jane.smith,Frontend Team
233
- ```
234
-
235
- ```bash
236
- ruby-maat -l git.log -c git2 -a authors -p teams.csv
237
- ```
238
-
239
- ### Temporal Analysis
240
-
241
- Group commits by time period:
242
-
243
- ```bash
244
- ruby-maat -l git.log -c git2 -a coupling -t day
245
- ```
246
-
247
- ## Differences from Code Maat
248
-
249
- While Ruby Maat is a drop-in replacement, there are some minor differences:
250
-
251
- ### Advantages
252
-
253
- - **Faster startup**: No JVM startup time
254
- - **Better memory efficiency**: Ruby's garbage collection
255
- - **Easier installation**: No Java dependencies
256
- - **Native Ruby integration**: Use as a library in Ruby projects
257
-
258
- ### Performance
259
-
260
- - Ruby Maat may be slightly slower on very large datasets
261
- - For most repositories, performance is comparable
262
- - Memory usage is typically lower than the JVM version
263
-
264
- ## Development
265
-
266
- ### Running Tests
267
-
268
- ```bash
269
- bundle install
270
- bundle exec rspec
271
- ```
272
-
273
- ### Code Quality
274
-
275
- ```bash
276
- bundle exec rubocop
277
- ```
278
-
279
- ### Building the Gem
280
-
281
- ```bash
282
- bundle exec rake build
283
- ```
284
-
285
- ## Contributing
286
-
287
- Bug reports and pull requests are welcome on GitHub at <https://github.com/viamin/ruby-maat>.
288
-
289
- ## License
290
-
291
- Ruby Maat is distributed under the [GNU General Public License v3.0](http://www.gnu.org/licenses/gpl.html), the same license as the original Code Maat.
292
-
293
- ## Acknowledgments
294
-
295
- - **Adam Tornhill** - Original Code Maat author and creator of the analysis algorithms
296
- - **Code Maat contributors** - For the foundational work this port is based on
297
-
298
- ## About the Name
299
-
300
- Like the original Code Maat, this tool is named after Maat, the ancient Egyptian goddess of truth, justice, and order. Ruby Maat continues Maat's work of bringing order to chaotic codebases, now in Ruby.