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.
- checksums.yaml +4 -4
- data/.commitlintrc.json +2 -1
- data/.release-please-manifest.json +1 -1
- data/.rubocop.yml +23 -1
- data/.standard.yml +3 -0
- data/CHANGELOG.md +100 -0
- data/CLAUDE.md +100 -50
- data/README.md +99 -8
- data/lib/ruby_maat/analysis/churn.rb +2 -2
- data/lib/ruby_maat/analysis/effort.rb +5 -5
- data/lib/ruby_maat/analysis_presets.rb +313 -0
- data/lib/ruby_maat/cli.rb +253 -5
- data/lib/ruby_maat/generators/base_generator.rb +267 -0
- data/lib/ruby_maat/generators/git_generator.rb +176 -0
- data/lib/ruby_maat/generators/svn_generator.rb +201 -0
- data/lib/ruby_maat/parsers/git2_parser.rb +2 -2
- data/lib/ruby_maat/parsers/git_parser.rb +2 -2
- data/lib/ruby_maat/parsers/mercurial_parser.rb +1 -1
- data/lib/ruby_maat/parsers/perforce_parser.rb +2 -2
- data/lib/ruby_maat/parsers/tfs_parser.rb +3 -3
- data/lib/ruby_maat/vcs_detector.rb +75 -0
- data/lib/ruby_maat/version.rb +1 -1
- data/release-please-config.json +8 -0
- metadata +9 -4
- data/.release-please-config.json +0 -33
- data/RELEASE_PLEASE_SETUP.md +0 -198
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6015693182fa71b7676389768560ffe75b15b8cc789878a8de2897a4c1e35535
|
4
|
+
data.tar.gz: 7074ca652d6e29ef33502c92769c2ed55f74453c4478a40a401ddd36c3718492
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e398056d4b83287eb1e926603986243a33005856fb1755d22fadbd1ac14cbb41b9ed1238edbf47033c2164f9a526a74f47b313587abd634063dded3639918330
|
7
|
+
data.tar.gz: fcc96417f9165035d40b7f584a3a9da06234b6e579a505b82678f7da0ce50cb8b74c99da151fdd52d43257f1a82395b109e9ff99fae3f937f8a91f553a313e17
|
data/.commitlintrc.json
CHANGED
data/.rubocop.yml
CHANGED
@@ -3,12 +3,17 @@ inherit_gem:
|
|
3
3
|
standard: config/base.yml
|
4
4
|
|
5
5
|
plugins:
|
6
|
+
- rubocop-performance
|
6
7
|
- rubocop-rake
|
7
8
|
- rubocop-rspec
|
8
9
|
|
9
10
|
AllCops:
|
10
11
|
TargetRubyVersion: 3.2
|
11
12
|
NewCops: enable
|
13
|
+
Exclude:
|
14
|
+
- 'codeql-repo/**/*'
|
15
|
+
- 'ruby-maat-codeql-db*/**/*'
|
16
|
+
- 'vendor/**/*'
|
12
17
|
|
13
18
|
# Project-specific overrides
|
14
19
|
Metrics/MethodLength:
|
@@ -45,4 +50,21 @@ RSpec/MultipleExpectations:
|
|
45
50
|
Max: 25
|
46
51
|
|
47
52
|
RSpec/NestedGroups:
|
48
|
-
Max: 5
|
53
|
+
Max: 5
|
54
|
+
|
55
|
+
# Allow integration tests to use descriptive names instead of method names
|
56
|
+
RSpec/DescribeMethod:
|
57
|
+
Exclude:
|
58
|
+
- "spec/integration/**/*"
|
59
|
+
- "spec/ruby_maat/generators/analysis_integration_spec.rb"
|
60
|
+
|
61
|
+
# Allow integration tests to use custom file naming patterns
|
62
|
+
RSpec/SpecFilePathFormat:
|
63
|
+
Exclude:
|
64
|
+
- "spec/integration/**/*"
|
65
|
+
- "spec/ruby_maat/generators/analysis_integration_spec.rb"
|
66
|
+
|
67
|
+
# Allow instance variables in complex integration tests that need directory management
|
68
|
+
RSpec/InstanceVariable:
|
69
|
+
Exclude:
|
70
|
+
- "spec/integration/**/*"
|
data/.standard.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,106 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [1.2.0](https://github.com/viamin/ruby-maat/compare/ruby-maat-v1.1.3...ruby-maat/v1.2.0) (2025-08-17)
|
9
|
+
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
* add CodeQL security analysis script and update configuration to exclude CodeQL artifacts ([d020fea](https://github.com/viamin/ruby-maat/commit/d020fea2485b456747f3546a6c6f59a8b31b63c4))
|
14
|
+
* add interactive log generation mode and enhance log generation options ([2375f04](https://github.com/viamin/ruby-maat/commit/2375f04625f2d101cb48b477728da45249e1f972))
|
15
|
+
* add rubocop-performance gem and improve shell command security with validation and escaping ([66f9791](https://github.com/viamin/ruby-maat/commit/66f97917bd4d57da7ce89e6eebbac28dd0326175))
|
16
|
+
|
17
|
+
|
18
|
+
### Bug Fixes
|
19
|
+
|
20
|
+
* 71 by documenting the format of the mapping files used for architectural analyses ([587f9d0](https://github.com/viamin/ruby-maat/commit/587f9d06e0cad5b9cb14c06aafdfe649870c9d5a))
|
21
|
+
* add missing ruby version file to extra-files in release config ([d565352](https://github.com/viamin/ruby-maat/commit/d56535266542396b9a124516ae3c5de1fb3926f5))
|
22
|
+
* add release-commit-message-scope configuration for CI ([59f1af1](https://github.com/viamin/ruby-maat/commit/59f1af1837cec33bed85f7a11bf0d56c9edb0a29))
|
23
|
+
* add release-commit-message-scope configuration for CI ([e580a05](https://github.com/viamin/ruby-maat/commit/e580a05c489d8a393c75d199ed01191591d84574))
|
24
|
+
* improve shell command execution and regex pattern for change detection ([0566796](https://github.com/viamin/ruby-maat/commit/05667963965cc137a3343ca492ffc1bf81791c37))
|
25
|
+
* update CHANGE_PATTERN regex for improved line matching in Git2Parser ([3ffc27c](https://github.com/viamin/ruby-maat/commit/3ffc27c4abde42494daff8f701aa38c1dffbb1eb))
|
26
|
+
* update permissions in CI workflows for better access control ([9c30839](https://github.com/viamin/ruby-maat/commit/9c30839ea3c8f6c7fee56d911231ebc27faa35df))
|
27
|
+
* update permissions in CI workflows for better access control ([be49302](https://github.com/viamin/ruby-maat/commit/be49302c98a16b528ebf56137667998382ce56c4))
|
28
|
+
* update regex patterns in parsers for improved matching ([d56ef8f](https://github.com/viamin/ruby-maat/commit/d56ef8fb93a433ffbafd74374966271bd6419ebc))
|
29
|
+
* version info for automations ([6d1dc43](https://github.com/viamin/ruby-maat/commit/6d1dc43f1b3bf666ca54b7d3c5999d63a7964cab))
|
30
|
+
|
31
|
+
|
32
|
+
### CI/CD
|
33
|
+
|
34
|
+
* **deps:** bump actions/checkout from 4 to 5 ([ab5ceac](https://github.com/viamin/ruby-maat/commit/ab5ceac8a3d6c633efa309bd58d355b3489afb4f))
|
35
|
+
* **deps:** bump codecov/codecov-action from 4 to 5 ([9b3c1dd](https://github.com/viamin/ruby-maat/commit/9b3c1dd4bb93fd024bd6a9c22160f602f4811391))
|
36
|
+
|
37
|
+
|
38
|
+
### Documentation
|
39
|
+
|
40
|
+
* Update README.md for on-prem pricing page ([e745abe](https://github.com/viamin/ruby-maat/commit/e745abece16b47adbb18d63fdaba39eb31c69204))
|
41
|
+
|
42
|
+
|
43
|
+
### Refactoring
|
44
|
+
|
45
|
+
* put a new on the complex behavior for organizing commits into sliding windows ([4829229](https://github.com/viamin/ruby-maat/commit/48292293652912af17835e1f31190ff720882dc2))
|
46
|
+
* Ruby Maat for Enhanced Log Generation and CLI Features ([de6123e](https://github.com/viamin/ruby-maat/commit/de6123ee827376d18ac8cd62a25da50debd755d7))
|
47
|
+
* Ruby Maat for Enhanced Log Generation and CLI Features ([e5a6410](https://github.com/viamin/ruby-maat/commit/e5a64105b45e88c89ccdb074befa9ece453666ea))
|
48
|
+
* update RSpec configuration and improve integration test handling ([b6895cb](https://github.com/viamin/ruby-maat/commit/b6895cb7e6ad9e1d53f836e1f7472a719372bd86))
|
49
|
+
* update RSpec tests to use `described_class` and improve mock handling ([033dbe3](https://github.com/viamin/ruby-maat/commit/033dbe3c483041f249f12f500fb7483447902fe0))
|
50
|
+
|
51
|
+
|
52
|
+
### Miscellaneous
|
53
|
+
|
54
|
+
* add extra-files configuration for version file in release-please ([2a1ae29](https://github.com/viamin/ruby-maat/commit/2a1ae29f1c898b78e426cc6c9c23340ea573e87e))
|
55
|
+
* **main:** release 1.1.0 ([befebb9](https://github.com/viamin/ruby-maat/commit/befebb9d2522d01b8cc6962b2ed43a3ba7507e4c))
|
56
|
+
* **main:** release 1.1.0 ([8160a68](https://github.com/viamin/ruby-maat/commit/8160a6836b063603b05bb0a81297ecb1d4cb29f5))
|
57
|
+
* **main:** release 1.1.1 ([a435b9c](https://github.com/viamin/ruby-maat/commit/a435b9ca99ffe79e89d5c5f378cf638930104a77))
|
58
|
+
* **main:** release 1.1.1 ([eb74e48](https://github.com/viamin/ruby-maat/commit/eb74e486ca7e750c72bb88edec4354c3f2239cc6))
|
59
|
+
* **main:** release 1.1.2 ([f3d6842](https://github.com/viamin/ruby-maat/commit/f3d6842d4a76fcaafdd7adc628c968174f616d6c))
|
60
|
+
* **main:** release 1.1.2 ([4535251](https://github.com/viamin/ruby-maat/commit/45352512ed80c992f9a9ecdab10513055e38a1d4))
|
61
|
+
* **main:** release 1.1.3 ([8bad82f](https://github.com/viamin/ruby-maat/commit/8bad82f5822aa1ef5f40f7a249dd30d449b69f4f))
|
62
|
+
* **main:** release 1.1.3 ([5a6552f](https://github.com/viamin/ruby-maat/commit/5a6552fd4e3a64b74dab6b075196573b3599fdf6))
|
63
|
+
* update CI workflows to include concurrency settings and adjust version to 1.1.2 ([a21698e](https://github.com/viamin/ruby-maat/commit/a21698e7bf49a2b4ee7a47e2311379ce60e5271a))
|
64
|
+
* update commitlint configuration and add Overcommit setup; implement commit message validation script ([890f3f5](https://github.com/viamin/ruby-maat/commit/890f3f519c564d0dd60990a22d844f203980959b))
|
65
|
+
* update GitHub Actions workflow for release process; add permissions and release type configuration ([e5dca27](https://github.com/viamin/ruby-maat/commit/e5dca27e32efa43f0ab677cd96e7cc2b56ce6fb0))
|
66
|
+
* update release configuration by removing inline settings and adding dedicated config file ([240ba2a](https://github.com/viamin/ruby-maat/commit/240ba2a7962d1bb286a79d4b3c63199053037b95))
|
67
|
+
* update ruby-maat version to 1.1.2 in Gemfile.lock ([bf5bfa7](https://github.com/viamin/ruby-maat/commit/bf5bfa7e996a82af23c40acd70236774026b7cde))
|
68
|
+
|
69
|
+
## [1.1.3](https://github.com/viamin/ruby-maat/compare/v1.1.2...v1.1.3) (2025-08-17)
|
70
|
+
|
71
|
+
|
72
|
+
### Bug Fixes
|
73
|
+
|
74
|
+
* add missing ruby version file to extra-files in release config ([d565352](https://github.com/viamin/ruby-maat/commit/d56535266542396b9a124516ae3c5de1fb3926f5))
|
75
|
+
|
76
|
+
## [1.1.2](https://github.com/viamin/ruby-maat/compare/v1.1.1...v1.1.2) (2025-08-17)
|
77
|
+
|
78
|
+
|
79
|
+
### Bug Fixes
|
80
|
+
|
81
|
+
* update permissions in CI workflows for better access control ([9c30839](https://github.com/viamin/ruby-maat/commit/9c30839ea3c8f6c7fee56d911231ebc27faa35df))
|
82
|
+
* update permissions in CI workflows for better access control ([be49302](https://github.com/viamin/ruby-maat/commit/be49302c98a16b528ebf56137667998382ce56c4))
|
83
|
+
|
84
|
+
## [1.1.1](https://github.com/viamin/ruby-maat/compare/v1.1.0...v1.1.1) (2025-08-16)
|
85
|
+
|
86
|
+
|
87
|
+
### Bug Fixes
|
88
|
+
|
89
|
+
* add release-commit-message-scope configuration for CI ([59f1af1](https://github.com/viamin/ruby-maat/commit/59f1af1837cec33bed85f7a11bf0d56c9edb0a29))
|
90
|
+
* add release-commit-message-scope configuration for CI ([e580a05](https://github.com/viamin/ruby-maat/commit/e580a05c489d8a393c75d199ed01191591d84574))
|
91
|
+
|
92
|
+
## [1.1.0](https://github.com/viamin/ruby-maat/compare/v1.0.0...v1.1.0) (2025-08-16)
|
93
|
+
|
94
|
+
|
95
|
+
### Features
|
96
|
+
|
97
|
+
* add CodeQL security analysis script and update configuration to exclude CodeQL artifacts ([d020fea](https://github.com/viamin/ruby-maat/commit/d020fea2485b456747f3546a6c6f59a8b31b63c4))
|
98
|
+
* add interactive log generation mode and enhance log generation options ([2375f04](https://github.com/viamin/ruby-maat/commit/2375f04625f2d101cb48b477728da45249e1f972))
|
99
|
+
* add rubocop-performance gem and improve shell command security with validation and escaping ([66f9791](https://github.com/viamin/ruby-maat/commit/66f97917bd4d57da7ce89e6eebbac28dd0326175))
|
100
|
+
|
101
|
+
|
102
|
+
### Bug Fixes
|
103
|
+
|
104
|
+
* improve shell command execution and regex pattern for change detection ([0566796](https://github.com/viamin/ruby-maat/commit/05667963965cc137a3343ca492ffc1bf81791c37))
|
105
|
+
* update CHANGE_PATTERN regex for improved line matching in Git2Parser ([3ffc27c](https://github.com/viamin/ruby-maat/commit/3ffc27c4abde42494daff8f701aa38c1dffbb1eb))
|
106
|
+
* update regex patterns in parsers for improved matching ([d56ef8f](https://github.com/viamin/ruby-maat/commit/d56ef8fb93a433ffbafd74374966271bd6419ebc))
|
107
|
+
|
8
108
|
## [1.0.0] - 2024-08-15
|
9
109
|
|
10
110
|
### Added
|
data/CLAUDE.md
CHANGED
@@ -4,84 +4,112 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|
4
4
|
|
5
5
|
## Project Overview
|
6
6
|
|
7
|
-
|
7
|
+
Ruby Maat is a Ruby port of Code Maat - a command-line tool for mining and analyzing data from version control systems (VCS). It extracts insights about code evolution, developer patterns, logical coupling, and code quality metrics from Git, SVN, Mercurial, Perforce, and TFS repositories.
|
8
|
+
|
9
|
+
**Key Feature**: Ruby Maat includes built-in log generation capabilities, allowing users to generate VCS logs directly without requiring external shell commands.
|
8
10
|
|
9
11
|
## Build and Development Commands
|
10
12
|
|
11
13
|
### Building the Project
|
12
14
|
|
13
15
|
```bash
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
# Run directly via Leiningen (for development)
|
18
|
-
lein run -l logfile.log -c <vcs>
|
16
|
+
# Install dependencies
|
17
|
+
bundle install
|
19
18
|
|
20
|
-
# Build
|
21
|
-
|
19
|
+
# Build gem
|
20
|
+
gem build ruby-maat.gemspec
|
22
21
|
|
23
22
|
# Run tests
|
24
|
-
|
23
|
+
bundle exec rspec
|
25
24
|
```
|
26
25
|
|
27
|
-
### Running
|
26
|
+
### Running Ruby Maat
|
28
27
|
|
29
28
|
```bash
|
30
|
-
#
|
31
|
-
|
29
|
+
# Run analysis on existing log file
|
30
|
+
ruby-maat -l logfile.log -c git -a authors
|
31
|
+
|
32
|
+
# Generate log file and save for future use
|
33
|
+
ruby-maat --generate-log --save-log my_log.log -c git
|
34
|
+
|
35
|
+
# Generate log and run analysis immediately
|
36
|
+
ruby-maat --generate-log -c git -a coupling
|
32
37
|
|
33
|
-
#
|
34
|
-
|
38
|
+
# Interactive log generation
|
39
|
+
ruby-maat --generate-log --interactive -c git
|
40
|
+
|
41
|
+
# Use preset configurations
|
42
|
+
ruby-maat --generate-log --preset git2-format -c git
|
35
43
|
|
36
44
|
# Show help and all available analyses
|
37
|
-
|
45
|
+
ruby-maat -h
|
38
46
|
```
|
39
47
|
|
40
|
-
###
|
48
|
+
### Log Generation
|
49
|
+
|
50
|
+
Ruby Maat can generate VCS logs directly, eliminating the need for manual log extraction:
|
41
51
|
|
42
|
-
|
52
|
+
**Available Presets:**
|
53
|
+
- `git2-format` - Standard format for git2 parser (recommended)
|
54
|
+
- `git-legacy` - Legacy format for git parser
|
55
|
+
- `recent-activity` - Last 3 months of activity
|
56
|
+
- `last-year` - Last 12 months of activity
|
57
|
+
- `full-history` - Complete repository history
|
43
58
|
|
44
|
-
|
45
|
-
-
|
46
|
-
-
|
59
|
+
**Supported VCS for Log Generation:**
|
60
|
+
- Git (both git and git2 formats)
|
61
|
+
- SVN (XML format)
|
62
|
+
|
63
|
+
**Interactive Mode Features:**
|
64
|
+
- Preset selection
|
65
|
+
- Custom date filtering
|
66
|
+
- Author filtering
|
67
|
+
- Path filtering
|
68
|
+
- Save or temporary log options
|
47
69
|
|
48
70
|
## Architecture Overview
|
49
71
|
|
50
72
|
### Core Components
|
51
73
|
|
52
|
-
1. **Command Line Interface** (`
|
74
|
+
1. **Command Line Interface** (`lib/ruby_maat/cli.rb`)
|
53
75
|
- Entry point and argument parsing
|
54
|
-
- Uses
|
76
|
+
- Uses OptionParser for option handling
|
77
|
+
- Handles both analysis and log generation modes
|
55
78
|
|
56
|
-
2. **Application Core** (`
|
79
|
+
2. **Application Core** (`lib/ruby_maat/app.rb`)
|
57
80
|
- Main orchestration logic following pipeline pattern:
|
58
|
-
- Input → Parsers → Layer Mapping →
|
81
|
+
- Input → Parsers → Layer Mapping → Datasets → Analysis → Output
|
59
82
|
- Contains registry of all supported analyses
|
60
83
|
- Handles VCS parser selection and error recovery
|
61
84
|
|
62
|
-
3. **VCS Parsers** (`
|
85
|
+
3. **VCS Parsers** (`lib/ruby_maat/parsers/`)
|
63
86
|
- Modular parsers for different VCS systems
|
64
|
-
- `
|
65
|
-
- `
|
66
|
-
- `
|
87
|
+
- `git2_parser.rb` - preferred Git parser (faster, more tolerant)
|
88
|
+
- `git_parser.rb` - legacy Git parser (maintained for backward compatibility)
|
89
|
+
- `svn_parser.rb`, `mercurial_parser.rb`, `perforce_parser.rb`, `tfs_parser.rb` - other VCS support
|
90
|
+
|
91
|
+
4. **Log Generators** (`lib/ruby_maat/generators/`) - **NEW FEATURE**
|
92
|
+
- `base_generator.rb` - common functionality for all generators
|
93
|
+
- `git_generator.rb` - Git log generation with presets and interactive mode
|
94
|
+
- `svn_generator.rb` - SVN log generation with XML output
|
95
|
+
- Support for preset configurations and custom options
|
67
96
|
|
68
|
-
|
97
|
+
5. **Analysis Modules** (`lib/ruby_maat/analysis/`)
|
69
98
|
- Independent analysis implementations
|
70
|
-
- Each returns Incanter datasets
|
71
99
|
- Key analyses: authors, coupling, churn, code-age, communication, effort
|
72
100
|
|
73
|
-
|
74
|
-
- `
|
75
|
-
- `
|
76
|
-
- `team_mapper.
|
101
|
+
6. **Data Processing** (`lib/ruby_maat/groupers/`)
|
102
|
+
- `layer_grouper.rb` - maps files to architectural layers
|
103
|
+
- `time_grouper.rb` - temporal aggregation
|
104
|
+
- `team_mapper.rb` - maps authors to teams
|
77
105
|
|
78
|
-
|
106
|
+
7. **Output** (`lib/ruby_maat/output/`)
|
79
107
|
- CSV output formatting
|
80
108
|
- Filtering and row limiting
|
81
109
|
|
82
110
|
### Supported Analyses
|
83
111
|
|
84
|
-
Available via the `-a` parameter (see `
|
112
|
+
Available via the `-a` parameter (see `SUPPORTED_ANALYSES` in `app.rb`):
|
85
113
|
|
86
114
|
- `authors` - developer count per module
|
87
115
|
- `coupling` - logical coupling between modules
|
@@ -94,37 +122,59 @@ Available via the `-a` parameter (see `supported-analysis` map in `app.clj:55`):
|
|
94
122
|
|
95
123
|
### Data Flow
|
96
124
|
|
125
|
+
**Traditional Mode (with existing logs):**
|
97
126
|
1. Parse VCS log files into modification records
|
98
127
|
2. Optional aggregation by architectural boundaries (grouping files)
|
99
128
|
3. Optional temporal aggregation (group commits by time period)
|
100
129
|
4. Optional team mapping (map individual authors to teams)
|
101
|
-
5. Convert to
|
130
|
+
5. Convert to dataset
|
102
131
|
6. Run analysis
|
103
132
|
7. Output results as CSV
|
104
133
|
|
134
|
+
**Log Generation Mode (NEW):**
|
135
|
+
1. Generate VCS log using appropriate generator
|
136
|
+
2. Either save log to file for future use, or pipe directly to analysis
|
137
|
+
3. Follow traditional data flow for analysis
|
138
|
+
|
105
139
|
### Key Dependencies
|
106
140
|
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
110
|
-
- clj-time (date/time handling)
|
111
|
-
- instaparse (parsing DSL)
|
141
|
+
- Ruby 2.7+
|
142
|
+
- Standard Ruby libraries (optparse, date, fileutils, etc.)
|
143
|
+
- RSpec (for testing)
|
112
144
|
|
113
145
|
## Testing
|
114
146
|
|
115
|
-
Tests are located in `
|
147
|
+
Tests are located in `spec/` and follow the source structure. Key test categories:
|
116
148
|
|
117
149
|
- Unit tests for individual analysis modules
|
118
|
-
- End-to-end scenario tests with sample VCS data
|
119
150
|
- Parser tests for different VCS formats
|
151
|
+
- Log generator tests with mocked VCS repositories
|
152
|
+
- CLI integration tests
|
120
153
|
|
121
|
-
Run all tests with `
|
154
|
+
Run all tests with `bundle exec rspec`.
|
122
155
|
|
123
156
|
## Development Notes
|
124
157
|
|
125
|
-
- The codebase follows
|
158
|
+
- The codebase follows object-oriented Ruby principles with functional influences
|
126
159
|
- All analysis modules are independent and composable
|
127
|
-
- Parsers return
|
128
|
-
-
|
129
|
-
-
|
130
|
-
- Memory usage can be high for large repositories -
|
160
|
+
- Parsers return arrays of ChangeRecord objects representing modifications
|
161
|
+
- Log generators use command execution with proper error handling
|
162
|
+
- Interactive mode provides user-friendly prompts and validation
|
163
|
+
- Memory usage can be high for large repositories - use date filtering presets
|
164
|
+
- Log generation supports both persistent and temporary modes for different workflows
|
165
|
+
|
166
|
+
## Log Generation Examples
|
167
|
+
|
168
|
+
```bash
|
169
|
+
# Quick analysis of recent Git activity
|
170
|
+
ruby-maat --generate-log --preset recent-activity -c git -a authors
|
171
|
+
|
172
|
+
# Interactive SVN log generation with custom options
|
173
|
+
ruby-maat --generate-log --interactive -c svn
|
174
|
+
|
175
|
+
# Generate and save Git log for later analysis
|
176
|
+
ruby-maat --generate-log --save-log project_history.log --preset full-history -c git
|
177
|
+
|
178
|
+
# Generate log and immediately run coupling analysis
|
179
|
+
ruby-maat --generate-log -c git -a coupling --min-revs 10
|
180
|
+
```
|
data/README.md
CHANGED
@@ -4,18 +4,21 @@ Ruby Maat is a command line tool used to mine and analyze data from version-cont
|
|
4
4
|
|
5
5
|
**Note:** The analyses have evolved into [CodeScene](https://codescene.io/), which automates all the analyses found in Ruby Maat and several new ones.
|
6
6
|
|
7
|
-
## Drop-in Replacement for Code Maat
|
7
|
+
## Drop-in Replacement for Code Maat + Log Generation
|
8
8
|
|
9
|
-
Ruby Maat is designed as a **drop-in replacement** for the original Code Maat
|
9
|
+
Ruby Maat is designed as a **drop-in replacement** for the original Code Maat with enhanced capabilities:
|
10
10
|
|
11
11
|
- ✅ Identical command-line arguments
|
12
12
|
- ✅ Same VCS log file formats*
|
13
13
|
- ✅ Compatible CSV output format
|
14
14
|
- ✅ All original analysis types
|
15
|
+
- 🆕 **Built-in log generation** - No need for manual VCS commands
|
16
|
+
- 🆕 **Interactive mode** with guided log creation
|
17
|
+
- 🆕 **Preset configurations** for common scenarios
|
15
18
|
|
16
19
|
`*` In theory. I've only tested with git.
|
17
20
|
|
18
|
-
Simply replace `java -jar code-maat.jar` with `ruby-maat` in your existing scripts.
|
21
|
+
Simply replace `java -jar code-maat.jar` with `ruby-maat` in your existing scripts, or use the new log generation features for a streamlined workflow.
|
19
22
|
|
20
23
|
## Installation
|
21
24
|
|
@@ -29,7 +32,12 @@ gem install ruby-maat
|
|
29
32
|
|
30
33
|
```bash
|
31
34
|
docker build -t ruby-maat .
|
35
|
+
|
36
|
+
# Traditional mode with existing logs
|
32
37
|
docker run -v /path/to/your/logs:/data ruby-maat -l /data/logfile.log -c git2 -a summary
|
38
|
+
|
39
|
+
# NEW: Log generation mode (mount your repository)
|
40
|
+
docker run -v /path/to/your/repo:/repo ruby-maat --generate-log --preset recent-activity -c git -a coupling
|
33
41
|
```
|
34
42
|
|
35
43
|
### From Source
|
@@ -54,6 +62,7 @@ Distributed under the [GNU General Public License v3.0](http://www.gnu.org/licen
|
|
54
62
|
|
55
63
|
### Basic Usage
|
56
64
|
|
65
|
+
#### Traditional Mode (with existing logs)
|
57
66
|
```bash
|
58
67
|
# Analyze Git repository
|
59
68
|
ruby-maat -l logfile.log -c git2 -a summary
|
@@ -65,16 +74,42 @@ ruby-maat -l logfile.log -c git2 -a coupling
|
|
65
74
|
ruby-maat -l logfile.log -c git2 -a authors -o results.csv
|
66
75
|
```
|
67
76
|
|
77
|
+
#### New: Log Generation Mode
|
78
|
+
```bash
|
79
|
+
# Generate log and analyze immediately
|
80
|
+
ruby-maat --generate-log -c git -a authors
|
81
|
+
|
82
|
+
# Generate log with preset and save for later
|
83
|
+
ruby-maat --generate-log --preset recent-activity --save-log my_log.log -c git
|
84
|
+
|
85
|
+
# Interactive mode with guided setup
|
86
|
+
ruby-maat --generate-log --interactive -c git
|
87
|
+
|
88
|
+
# Generate log and run specific analysis
|
89
|
+
ruby-maat --generate-log --preset git2-format -c git -a coupling --min-revs 10
|
90
|
+
```
|
91
|
+
|
68
92
|
### Command Line Options
|
69
93
|
|
70
94
|
When invoked with `-h`, Ruby Maat prints its usage:
|
71
95
|
|
72
96
|
```
|
73
|
-
Usage:
|
97
|
+
Usage:
|
98
|
+
ruby-maat -l log-file -c vcs-type [options] # Run analysis on existing log
|
99
|
+
ruby-maat --generate-log -c vcs-type [options] # Generate log file
|
100
|
+
ruby-maat --generate-log --interactive -c vcs-type # Interactive log generation
|
74
101
|
|
75
102
|
Required:
|
76
|
-
-l, --log LOG Log file with input data
|
77
103
|
-c, --version-control VCS Input vcs module type: supports svn, git, git2, hg, p4, or tfs
|
104
|
+
-l, --log LOG Log file with input data (not required with --generate-log)
|
105
|
+
|
106
|
+
Log Generation (NEW):
|
107
|
+
--generate-log Generate log file instead of running analysis
|
108
|
+
--save-log FILENAME Save generated log to file
|
109
|
+
--interactive Use interactive mode for log generation
|
110
|
+
--preset PRESET Use a preset configuration for log generation
|
111
|
+
Git presets: git2-format, git-legacy, recent-activity, last-year, full-history
|
112
|
+
SVN presets: standard, recent-activity, last-year, date-range, revision-range
|
78
113
|
|
79
114
|
Analysis:
|
80
115
|
-a, --analysis ANALYSIS The analysis to run (default: authors)
|
@@ -102,7 +137,53 @@ Other:
|
|
102
137
|
|
103
138
|
### Generating input data
|
104
139
|
|
105
|
-
Ruby Maat operates on log files from version-control systems.
|
140
|
+
Ruby Maat operates on log files from version-control systems. You have **two options**:
|
141
|
+
|
142
|
+
1. **🆕 NEW: Automatic log generation** - Ruby Maat can generate logs for you
|
143
|
+
2. **Traditional: Manual log generation** - Use VCS commands directly (same as original Code Maat)
|
144
|
+
|
145
|
+
#### Option 1: Automatic Log Generation (Recommended)
|
146
|
+
|
147
|
+
Ruby Maat can generate VCS logs automatically with built-in presets and interactive guidance:
|
148
|
+
|
149
|
+
```bash
|
150
|
+
# Quick start - analyze recent Git activity
|
151
|
+
ruby-maat --generate-log --preset recent-activity -c git -a summary
|
152
|
+
|
153
|
+
# Interactive mode with guided setup
|
154
|
+
ruby-maat --generate-log --interactive -c git
|
155
|
+
|
156
|
+
# Generate and save SVN log for later use
|
157
|
+
ruby-maat --generate-log --preset standard --save-log svn_history.log -c svn
|
158
|
+
```
|
159
|
+
|
160
|
+
**Available Presets:**
|
161
|
+
|
162
|
+
**Git Presets:**
|
163
|
+
- `git2-format` - Standard format for git2 parser (recommended)
|
164
|
+
- `git-legacy` - Legacy format for git parser
|
165
|
+
- `recent-activity` - Last 3 months of activity
|
166
|
+
- `last-year` - Last 12 months of activity
|
167
|
+
- `full-history` - Complete repository history
|
168
|
+
|
169
|
+
**SVN Presets:**
|
170
|
+
- `standard` - Standard SVN XML log format
|
171
|
+
- `recent-activity` - Last 3 months of activity
|
172
|
+
- `last-year` - Last 12 months of activity
|
173
|
+
- `date-range` - Custom date range (interactive)
|
174
|
+
- `revision-range` - Specific revision range (interactive)
|
175
|
+
|
176
|
+
**Interactive Mode Features:**
|
177
|
+
- Preset selection with descriptions
|
178
|
+
- Custom date filtering (YYYY-MM-DD format)
|
179
|
+
- Author filtering
|
180
|
+
- Path filtering
|
181
|
+
- Branch selection (Git)
|
182
|
+
- Save or temporary log options
|
183
|
+
|
184
|
+
#### Option 2: Manual Log Generation (Traditional)
|
185
|
+
|
186
|
+
For compatibility with existing workflows, you can still generate logs manually. **Use the exact same commands as the original Code Maat.** The supported version-control systems are `git`, Mercurial (`hg`), `svn`, Perforce (`p4`), and Team Foundation Server (`tfs`).
|
106
187
|
|
107
188
|
#### Preparations
|
108
189
|
|
@@ -159,15 +240,25 @@ To exclude multiple folders, you just append more pathspecs:
|
|
159
240
|
|
160
241
|
### Running Ruby Maat
|
161
242
|
|
243
|
+
#### Traditional Mode (with existing logs)
|
244
|
+
|
162
245
|
If you've installed the gem:
|
163
246
|
|
164
247
|
ruby-maat -l logfile.log -c <vcs>
|
165
248
|
|
166
|
-
If you've built a docker container
|
249
|
+
If you've built a docker container:
|
167
250
|
|
168
251
|
docker run -v /home/xx/src/logs:/data -it ruby-maat -l /data/logfile.log -c <vcs>
|
169
252
|
|
170
|
-
|
253
|
+
#### NEW: Log Generation Mode
|
254
|
+
|
255
|
+
Generate logs automatically:
|
256
|
+
|
257
|
+
ruby-maat --generate-log -c <vcs> -a <analysis>
|
258
|
+
|
259
|
+
With Docker (mount your repository):
|
260
|
+
|
261
|
+
docker run -v /path/to/repo:/repo -it ruby-maat --generate-log -c <vcs> -a <analysis>
|
171
262
|
|
172
263
|
When invoked with `-h`, Ruby Maat prints its usage. (See the [Command Line Options](#command-line-options) section above for details.)
|
173
264
|
|
@@ -105,7 +105,7 @@ module RubyMaat
|
|
105
105
|
end
|
106
106
|
|
107
107
|
# Filter by minimum revisions and format results
|
108
|
-
filtered_results = results.values.
|
108
|
+
filtered_results = results.values.filter_map do |result|
|
109
109
|
next if result[:revisions].size < min_revs
|
110
110
|
|
111
111
|
{
|
@@ -114,7 +114,7 @@ module RubyMaat
|
|
114
114
|
deleted: result[:deleted],
|
115
115
|
commits: result[:revisions].size
|
116
116
|
}
|
117
|
-
end
|
117
|
+
end
|
118
118
|
|
119
119
|
# Sort by total churn descending
|
120
120
|
filtered_results.sort_by! { |r| -(r[:added] + r[:deleted]) }
|
@@ -76,13 +76,13 @@ module RubyMaat
|
|
76
76
|
results = []
|
77
77
|
|
78
78
|
entity_authors.each do |entity, authors|
|
79
|
-
total_revisions = authors.values.
|
79
|
+
total_revisions = authors.values.sum(&:size)
|
80
80
|
next if total_revisions < min_revs
|
81
81
|
|
82
82
|
# Find author with most revisions
|
83
83
|
main_author, revisions = authors.max_by { |_author, revs| revs.size }
|
84
84
|
|
85
|
-
total_revisions = authors.values.
|
85
|
+
total_revisions = authors.values.sum(&:size)
|
86
86
|
|
87
87
|
results << {
|
88
88
|
entity: entity,
|
@@ -122,14 +122,14 @@ module RubyMaat
|
|
122
122
|
results = []
|
123
123
|
|
124
124
|
entity_contributions.each do |entity, authors|
|
125
|
-
total_revisions = authors.values.
|
125
|
+
total_revisions = authors.values.sum(&:size)
|
126
126
|
next if total_revisions < min_revs
|
127
127
|
|
128
128
|
# Calculate fractal value: 1 - sum(p_i^2) where p_i is proportion of each author
|
129
|
-
sum_of_squares = authors.values.
|
129
|
+
sum_of_squares = authors.values.sum do |revisions|
|
130
130
|
proportion = revisions.size.to_f / total_revisions
|
131
131
|
proportion**2
|
132
|
-
end
|
132
|
+
end
|
133
133
|
|
134
134
|
fractal_value = 1.0 - sum_of_squares
|
135
135
|
|