ruby-maat 1.0.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.
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyMaat
4
+ module VcsDetector
5
+ def self.detect_vcs(path = ".")
6
+ expanded_path = File.expand_path(path)
7
+
8
+ # Check for Git
9
+ git_dir = File.join(expanded_path, ".git")
10
+ if Dir.exist?(git_dir) || File.exist?(git_dir)
11
+ return "git"
12
+ end
13
+
14
+ # Check for SVN
15
+ svn_dir = File.join(expanded_path, ".svn")
16
+ if Dir.exist?(svn_dir)
17
+ return "svn"
18
+ end
19
+
20
+ # Check for Mercurial
21
+ hg_dir = File.join(expanded_path, ".hg")
22
+ if Dir.exist?(hg_dir)
23
+ return "hg"
24
+ end
25
+
26
+ # Check for Perforce (look for .p4config or ask p4)
27
+ p4config = File.join(expanded_path, ".p4config")
28
+ if File.exist?(p4config)
29
+ return "p4"
30
+ end
31
+
32
+ # Try to detect by running commands (if they exist)
33
+ begin
34
+ Dir.chdir(expanded_path) do
35
+ # Check git status
36
+ `git status 2>/dev/null`
37
+ return "git" if $?.exitstatus == 0
38
+
39
+ # Check svn info
40
+ `svn info 2>/dev/null`
41
+ return "svn" if $?.exitstatus == 0
42
+
43
+ # Check hg status
44
+ `hg status 2>/dev/null`
45
+ return "hg" if $?.exitstatus == 0
46
+
47
+ # Check p4 info
48
+ `p4 info 2>/dev/null`
49
+ return "p4" if $?.exitstatus == 0
50
+ end
51
+ rescue
52
+ # If we can't change directory or run commands, continue
53
+ end
54
+
55
+ nil # No VCS detected
56
+ end
57
+
58
+ def self.vcs_description(vcs)
59
+ case vcs
60
+ when "git"
61
+ "Git repository"
62
+ when "svn"
63
+ "Subversion repository"
64
+ when "hg"
65
+ "Mercurial repository"
66
+ when "p4"
67
+ "Perforce repository"
68
+ when "tfs"
69
+ "Team Foundation Server"
70
+ else
71
+ "Unknown VCS"
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyMaat
4
- VERSION = "1.0.0"
4
+ VERSION = "1.3.4"
5
5
  end
data/lib/ruby_maat.rb CHANGED
@@ -17,6 +17,7 @@ require_relative "ruby_maat/parsers/tfs_parser"
17
17
  require_relative "ruby_maat/groupers/layer_grouper"
18
18
  require_relative "ruby_maat/groupers/time_grouper"
19
19
  require_relative "ruby_maat/groupers/team_mapper"
20
+ require_relative "ruby_maat/groupers/merge_commit_grouper"
20
21
 
21
22
  # Analysis modules (load before app.rb since app references them)
22
23
  require_relative "ruby_maat/analysis/base_analysis"
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3
+ "packages": {
4
+ ".": {
5
+ "release-type": "ruby",
6
+ "package-name": "ruby-maat",
7
+ "version-file": "lib/ruby_maat/version.rb",
8
+ "changelog-sections": [
9
+ {
10
+ "type": "feat",
11
+ "section": "Features",
12
+ "hidden": false
13
+ },
14
+ {
15
+ "type": "fix",
16
+ "section": "Bug Fixes",
17
+ "hidden": false
18
+ },
19
+ {
20
+ "type": "refactor",
21
+ "section": "Improvements",
22
+ "hidden": false
23
+ },
24
+ {
25
+ "type": "chore",
26
+ "section": "Maintenance",
27
+ "hidden": true
28
+ },
29
+ {
30
+ "type": "docs",
31
+ "section": "Documentation",
32
+ "hidden": false
33
+ },
34
+ {
35
+ "type": "test",
36
+ "section": "Testing",
37
+ "hidden": true
38
+ },
39
+ {
40
+ "type": "ci",
41
+ "section": "CI/CD",
42
+ "hidden": true
43
+ },
44
+ {
45
+ "type": "deps",
46
+ "section": "Dependencies",
47
+ "hidden": false
48
+ },
49
+ {
50
+ "type": "BREAKING CHANGE",
51
+ "section": "Breaking Changes",
52
+ "hidden": false
53
+ }
54
+ ]
55
+ }
56
+ }
57
+ }
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.0.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-16 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,20 +69,15 @@ extensions: []
63
69
  extra_rdoc_files: []
64
70
  files:
65
71
  - ".commitlintrc.json"
66
- - ".mailmap"
67
72
  - ".overcommit.yml"
68
- - ".release-please-config.json"
69
73
  - ".release-please-manifest.json"
70
74
  - ".rspec"
71
75
  - ".rubocop.yml"
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
- - RELEASE_PLEASE_SETUP.md
79
- - RUBY_MAAT.md
80
81
  - Rakefile
81
82
  - doc/imgs/abs_churn_sample.png
82
83
  - doc/imgs/code_age_sample.png
@@ -98,11 +99,16 @@ files:
98
99
  - lib/ruby_maat/analysis/logical_coupling.rb
99
100
  - lib/ruby_maat/analysis/sum_of_coupling.rb
100
101
  - lib/ruby_maat/analysis/summary.rb
102
+ - lib/ruby_maat/analysis_presets.rb
101
103
  - lib/ruby_maat/app.rb
102
104
  - lib/ruby_maat/change_record.rb
103
105
  - lib/ruby_maat/cli.rb
104
106
  - lib/ruby_maat/dataset.rb
107
+ - lib/ruby_maat/generators/base_generator.rb
108
+ - lib/ruby_maat/generators/git_generator.rb
109
+ - lib/ruby_maat/generators/svn_generator.rb
105
110
  - lib/ruby_maat/groupers/layer_grouper.rb
111
+ - lib/ruby_maat/groupers/merge_commit_grouper.rb
106
112
  - lib/ruby_maat/groupers/team_mapper.rb
107
113
  - lib/ruby_maat/groupers/time_grouper.rb
108
114
  - lib/ruby_maat/output/csv_output.rb
@@ -113,7 +119,9 @@ files:
113
119
  - lib/ruby_maat/parsers/perforce_parser.rb
114
120
  - lib/ruby_maat/parsers/svn_parser.rb
115
121
  - lib/ruby_maat/parsers/tfs_parser.rb
122
+ - lib/ruby_maat/vcs_detector.rb
116
123
  - lib/ruby_maat/version.rb
124
+ - release-please-config.json
117
125
  homepage: https://github.com/viamin/ruby-maat
118
126
  licenses:
119
127
  - GPL-3.0
@@ -137,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
145
  - !ruby/object:Gem::Version
138
146
  version: '0'
139
147
  requirements: []
140
- rubygems_version: 3.6.2
148
+ rubygems_version: 3.6.9
141
149
  specification_version: 4
142
150
  summary: A command line tool used to mine and analyze data from version-control systems
143
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>
@@ -1,33 +0,0 @@
1
- {
2
- "packages": {
3
- ".": {
4
- "release-type": "ruby",
5
- "package-name": "ruby-maat",
6
- "bump-minor-pre-major": true,
7
- "bump-patch-for-minor-pre-major": true,
8
- "draft": false,
9
- "prerelease": false,
10
- "version-file": "lib/ruby_maat/version.rb",
11
- "changelog-sections": [
12
- {"type": "feat", "section": "Features"},
13
- {"type": "feature", "section": "Features"},
14
- {"type": "fix", "section": "Bug Fixes"},
15
- {"type": "perf", "section": "Performance Improvements"},
16
- {"type": "deps", "section": "Dependencies"},
17
- {"type": "ci", "section": "CI/CD"},
18
- {"type": "docs", "section": "Documentation"},
19
- {"type": "refactor", "section": "Refactoring", "hidden": false},
20
- {"type": "test", "section": "Tests", "hidden": false},
21
- {"type": "chore", "section": "Miscellaneous", "hidden": false},
22
- {"type": "style", "section": "Code Style", "hidden": false}
23
- ],
24
- "extra-files": [
25
- {
26
- "type": "generic",
27
- "path": "ruby-maat.gemspec",
28
- "glob": "spec.version = \"*\""
29
- }
30
- ]
31
- }
32
- }
33
- }
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
- ```