ruby-maat 1.0.0 → 1.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.
@@ -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.2.0"
5
5
  end
@@ -0,0 +1,8 @@
1
+ {
2
+ "packages": {
3
+ ".": {
4
+ "release-type": "ruby",
5
+ "version-file": "lib/ruby_maat/version.rb"
6
+ }
7
+ }
8
+ }
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.2.0
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: 2025-08-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: csv
@@ -65,17 +65,16 @@ files:
65
65
  - ".commitlintrc.json"
66
66
  - ".mailmap"
67
67
  - ".overcommit.yml"
68
- - ".release-please-config.json"
69
68
  - ".release-please-manifest.json"
70
69
  - ".rspec"
71
70
  - ".rubocop.yml"
71
+ - ".standard.yml"
72
72
  - CHANGELOG.md
73
73
  - CI_CD_SETUP.md
74
74
  - CLAUDE.md
75
75
  - Dockerfile
76
76
  - README.md
77
77
  - README_RUBY.md
78
- - RELEASE_PLEASE_SETUP.md
79
78
  - RUBY_MAAT.md
80
79
  - Rakefile
81
80
  - doc/imgs/abs_churn_sample.png
@@ -98,10 +97,14 @@ files:
98
97
  - lib/ruby_maat/analysis/logical_coupling.rb
99
98
  - lib/ruby_maat/analysis/sum_of_coupling.rb
100
99
  - lib/ruby_maat/analysis/summary.rb
100
+ - lib/ruby_maat/analysis_presets.rb
101
101
  - lib/ruby_maat/app.rb
102
102
  - lib/ruby_maat/change_record.rb
103
103
  - lib/ruby_maat/cli.rb
104
104
  - lib/ruby_maat/dataset.rb
105
+ - lib/ruby_maat/generators/base_generator.rb
106
+ - lib/ruby_maat/generators/git_generator.rb
107
+ - lib/ruby_maat/generators/svn_generator.rb
105
108
  - lib/ruby_maat/groupers/layer_grouper.rb
106
109
  - lib/ruby_maat/groupers/team_mapper.rb
107
110
  - lib/ruby_maat/groupers/time_grouper.rb
@@ -113,7 +116,9 @@ files:
113
116
  - lib/ruby_maat/parsers/perforce_parser.rb
114
117
  - lib/ruby_maat/parsers/svn_parser.rb
115
118
  - lib/ruby_maat/parsers/tfs_parser.rb
119
+ - lib/ruby_maat/vcs_detector.rb
116
120
  - lib/ruby_maat/version.rb
121
+ - release-please-config.json
117
122
  homepage: https://github.com/viamin/ruby-maat
118
123
  licenses:
119
124
  - GPL-3.0
@@ -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
- }
@@ -1,198 +0,0 @@
1
- # Release Please Setup
2
-
3
- This document explains how the automated release system works using Google's Release Please.
4
-
5
- ## Overview
6
-
7
- Release Please automates:
8
-
9
- - ✅ **Version bumping** based on conventional commits
10
- - ✅ **CHANGELOG generation** from commit messages
11
- - ✅ **Release creation** with proper Git tags
12
- - ✅ **Gem publishing** to RubyGems.org
13
- - ✅ **GitHub release** with artifacts
14
-
15
- ## How It Works
16
-
17
- ### 1. Conventional Commits
18
-
19
- Developers use conventional commit format:
20
-
21
- ```bash
22
- git commit -m "feat(parser): add SVN log support"
23
- git commit -m "fix(analysis): handle empty datasets correctly"
24
- git commit -m "docs: update CLI examples"
25
- ```
26
-
27
- ### 2. Release Please Analysis
28
-
29
- On every push to main/master:
30
-
31
- - Analyzes commits since last release
32
- - Determines if a release is needed
33
- - Calculates version bump (patch/minor/major)
34
-
35
- ### 3. Release PR Creation
36
-
37
- When releasable changes exist:
38
-
39
- - Creates/updates a "Release PR"
40
- - Updates version files
41
- - Generates/updates CHANGELOG.md
42
- - Ready for review and approval
43
-
44
- ### 4. Automated Publishing
45
-
46
- When Release PR is merged:
47
-
48
- - Creates GitHub release with tag
49
- - Publishes gem to RubyGems.org
50
- - Uploads gem artifact to release
51
-
52
- ## Configuration Files
53
-
54
- ### `.release-please-config.json`
55
-
56
- - Package configuration
57
- - Version file locations
58
- - Changelog sections
59
- - Extra files to update
60
-
61
- ### `.release-please-manifest.json`
62
-
63
- - Tracks current version
64
- - Updated automatically by Release Please
65
-
66
- ### `.commitlintrc.json`
67
-
68
- - Validates conventional commit format
69
- - Enforces consistent commit messages
70
- - Runs on pull requests
71
-
72
- ### `.gitmessage`
73
-
74
- - Commit message template
75
- - Set up with: `git config commit.template .gitmessage`
76
-
77
- ## Conventional Commit Types
78
-
79
- | Type | Description | Version Bump |
80
- |------|-------------|--------------|
81
- | `feat:` | New feature | Minor |
82
- | `fix:` | Bug fix | Patch |
83
- | `feat!:` | Breaking change | Major |
84
- | `BREAKING CHANGE:` | Breaking change | Major |
85
- | `docs:` | Documentation | None |
86
- | `style:` | Code style | None |
87
- | `refactor:` | Code refactoring | None |
88
- | `test:` | Tests | None |
89
- | `chore:` | Maintenance | None |
90
- | `ci:` | CI/CD changes | None |
91
- | `deps:` | Dependencies | None |
92
-
93
- ## Common Scopes
94
-
95
- - `analysis` - Analysis modules
96
- - `parser` - VCS parsers
97
- - `output` - Output formatters
98
- - `cli` - Command-line interface
99
- - `dataset` - Data handling
100
- - `core` - Core functionality
101
-
102
- ## Example Workflow
103
-
104
- 1. **Feature Development**:
105
-
106
- ```bash
107
- git commit -m "feat(analysis): add complexity metrics analysis"
108
- git commit -m "test(analysis): add tests for complexity metrics"
109
- git commit -m "docs(analysis): document complexity analysis options"
110
- ```
111
-
112
- 2. **Push to Main**:
113
-
114
- ```bash
115
- git push origin main
116
- ```
117
-
118
- 3. **Release Please Actions**:
119
- - Analyzes commits
120
- - Creates Release PR titled "chore(main): release 1.1.0"
121
- - Updates version from 1.0.0 → 1.1.0
122
- - Adds feature to CHANGELOG.md
123
-
124
- 4. **Review & Merge**:
125
- - Review the generated changelog
126
- - Merge the Release PR
127
- - Automatic publishing begins
128
-
129
- 5. **Published Release**:
130
- - GitHub release created with tag v1.1.0
131
- - Gem published to RubyGems.org
132
- - Gem artifact attached to release
133
-
134
- ## Benefits Over Manual Releases
135
-
136
- - ✅ **No version conflicts** - automated version management
137
- - ✅ **Consistent changelogs** - generated from commits
138
- - ✅ **Enforced conventions** - conventional commit validation
139
- - ✅ **Zero-downtime releases** - automated testing before publish
140
- - ✅ **Release approval** - review before publishing via Release PR
141
- - ✅ **Atomic releases** - all-or-nothing publishing
142
-
143
- ## Troubleshooting
144
-
145
- ### No Release PR Created
146
-
147
- - Check if commits follow conventional format
148
- - Ensure commits contain releasable changes (`feat:`, `fix:`, etc.)
149
- - Verify `.release-please-config.json` is valid
150
-
151
- ### Release PR Not Publishing
152
-
153
- - Check RubyGems API key secret is set
154
- - Verify tests pass in CI
155
- - Ensure gem version isn't already published
156
-
157
- ### Version Not Updated
158
-
159
- - Check `version-file` path in config
160
- - Verify `extra-files` configuration for gemspec
161
- - Ensure Release PR was merged, not just closed
162
-
163
- ## Manual Override
164
-
165
- To create a release manually:
166
-
167
- ```bash
168
- # Trigger release-please workflow manually
169
- gh workflow run publish.yml
170
-
171
- # Or create a conventional commit that forces a release
172
- git commit -m "chore: trigger release" --allow-empty
173
- git push origin main
174
- ```
175
-
176
- ## Getting Started
177
-
178
- 1. **Set up commit template**:
179
-
180
- ```bash
181
- git config commit.template .gitmessage
182
- ```
183
-
184
- 2. **Use conventional commits**:
185
-
186
- ```bash
187
- git commit -m "feat(cli): add new --format option"
188
- ```
189
-
190
- 3. **Push changes**:
191
-
192
- ```bash
193
- git push origin main
194
- ```
195
-
196
- 4. **Wait for Release PR** and review/merge when ready
197
-
198
- That's it! The rest is automated. 🚀