gem_hadar 2.12.0 → 2.13.1
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/README.md +100 -12
- data/gem_hadar.gemspec +3 -3
- data/lib/gem_hadar/changelog_generator.rb +47 -1
- data/lib/gem_hadar/version.rb +1 -1
- data/lib/gem_hadar/warn.rb +18 -1
- data/lib/gem_hadar.rb +97 -30
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46cb64331f3aa5f93bb51121b1134547c847f07130349af38d25bdf2db16582c
|
|
4
|
+
data.tar.gz: 6cfa451785cfafda768a2aebd0594fb5059dbfcccadf29c4ba7c4d9769fab18d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 83fae17af6f0b76d6df9e50ee55ab506e3ce05947d2927dd117bf5f58a6ce1b78ae1e35458e7e87bcca09388693bbdcd7282207962e9098e9e56fe30251907a7
|
|
7
|
+
data.tar.gz: 81ccf75c79c92ed844a6e673813ae09272d9add1585fb5464733f55ff87da0447db1c82cb1c35efd7ef93222e3b3fd8f9fda46b52a14d625a729b3166eb5eebe
|
data/README.md
CHANGED
|
@@ -107,7 +107,6 @@ The following environment variables can be used to configure `gem_hadar`:
|
|
|
107
107
|
| `XDG_CONFIG_HOME` | XDG configuration directory override | System default |
|
|
108
108
|
| `MAKE` | Make program to use for building extensions | `gmake` or `make` |
|
|
109
109
|
| `VERSION` | Override the version string for some tasks | Not set |
|
|
110
|
-
| `FORCE` | Force certain operations (1 to enable) | 0 |
|
|
111
110
|
| `GIT_REMOTE` | Git remote name(s) for operations, space separated | `origin` |
|
|
112
111
|
| `GITHUB_RELEASE_ENABLED` | Enable GitHub releases (yes/no) | Auto-detected |
|
|
113
112
|
| `EDITOR` | Editor to use for interactive tasks | `vi` |
|
|
@@ -230,7 +229,7 @@ This task displays all current configuration values including:
|
|
|
230
229
|
- Repository information (gem name, version)
|
|
231
230
|
- Build parameters (MAKE, EDITOR)
|
|
232
231
|
- Git configuration (remote)
|
|
233
|
-
- Other flags (
|
|
232
|
+
- Other flags (VERSION, GITHUB_RELEASE_ENABLED)
|
|
234
233
|
- XDG/HOME directories
|
|
235
234
|
- AI prompt defaults
|
|
236
235
|
|
|
@@ -359,6 +358,17 @@ rvm do
|
|
|
359
358
|
end
|
|
360
359
|
```
|
|
361
360
|
|
|
361
|
+
#### GitHub Workflows Configuration
|
|
362
|
+
|
|
363
|
+
```ruby
|
|
364
|
+
github_workflows do
|
|
365
|
+
'ci.yml' => {
|
|
366
|
+
name: 'Continuous Integration',
|
|
367
|
+
ruby_versions: ['3.0', '3.1', '3.2']
|
|
368
|
+
}
|
|
369
|
+
end
|
|
370
|
+
```
|
|
371
|
+
|
|
362
372
|
#### Task Dependencies
|
|
363
373
|
|
|
364
374
|
- **`default_task_dependencies`** - Default: `[:gemspec, :test]`
|
|
@@ -418,7 +428,7 @@ based on your specific requirements. They are automatically derived from other
|
|
|
418
428
|
DSL accessors and provide powerful convenience features that enable `GemHadar`
|
|
419
429
|
to generate consistent, well-structured Ruby code automatically.
|
|
420
430
|
|
|
421
|
-
|
|
431
|
+
## Available Tasks
|
|
422
432
|
|
|
423
433
|
You can list all available tasks with:
|
|
424
434
|
|
|
@@ -426,12 +436,12 @@ You can list all available tasks with:
|
|
|
426
436
|
$ rake -T
|
|
427
437
|
```
|
|
428
438
|
|
|
429
|
-
|
|
439
|
+
### Core Tasks
|
|
430
440
|
|
|
431
441
|
- `rake build` - Build task (builds all packages for a release)
|
|
432
442
|
- `rake release` - Release the new version 1.2.3 for the gem foo
|
|
433
443
|
|
|
434
|
-
|
|
444
|
+
### Build Tasks
|
|
435
445
|
|
|
436
446
|
- `rake gemspec` - Create a gemspec file
|
|
437
447
|
- `rake package` - Build all the packages
|
|
@@ -440,7 +450,7 @@ $ rake -T
|
|
|
440
450
|
- `rake clobber_package` - Remove package products
|
|
441
451
|
- `rake repackage` - Force a rebuild of the package files
|
|
442
452
|
|
|
443
|
-
|
|
453
|
+
### Version Management
|
|
444
454
|
|
|
445
455
|
- `rake version` - Writing version information for foo
|
|
446
456
|
- `rake version:show` - Displaying the current version
|
|
@@ -454,7 +464,16 @@ $ rake -T
|
|
|
454
464
|
- `rake version:push` - Push version 1.2.3 to all git remotes: origin
|
|
455
465
|
- `rake version:origin:push` - Push version 1.2.3 to git remote origin
|
|
456
466
|
|
|
457
|
-
|
|
467
|
+
### Changelog Generation
|
|
468
|
+
|
|
469
|
+
- `rake changes:pending` - Show changes since last version tag
|
|
470
|
+
- `rake changes:current` - Show changes between two latest version tags
|
|
471
|
+
- `rake changes:range` - Show changes for a specific Git range (e.g., v1.0.0..v1.2.0)
|
|
472
|
+
- `rake changes:full` - Generate complete changelog from first tag
|
|
473
|
+
- `rake changes:add` - Append to existing changelog file
|
|
474
|
+
- `rake changes:added` - Check if current version was added to changelog
|
|
475
|
+
|
|
476
|
+
### Documentation
|
|
458
477
|
|
|
459
478
|
- `rake doc` - Create yard documentation (including private)
|
|
460
479
|
- `rake yard_doc` - Generate YARD Documentation
|
|
@@ -465,7 +484,7 @@ $ rake -T
|
|
|
465
484
|
- `rake yard:view` - View the yard documentation
|
|
466
485
|
- `rake yard:list-undoc` - List all undocumented classes/modules/methods
|
|
467
486
|
|
|
468
|
-
|
|
487
|
+
### Testing & Development
|
|
469
488
|
|
|
470
489
|
- `rake run_specs` - Run RSpec code examples
|
|
471
490
|
- `rake clean` - Remove any temporary products
|
|
@@ -475,12 +494,12 @@ $ rake -T
|
|
|
475
494
|
- `rake default` - Default task
|
|
476
495
|
- `rake compile` - Compile project extensions (if configured)
|
|
477
496
|
|
|
478
|
-
|
|
497
|
+
### Publishing Tasks
|
|
479
498
|
- `rake push` - Push all changes for version 1.2.3 into the internets
|
|
480
499
|
- `rake github:release` - Create a new GitHub release for the current version
|
|
481
500
|
with AI-generated changelog
|
|
482
501
|
|
|
483
|
-
|
|
502
|
+
## Code Coverage with SimpleCov
|
|
484
503
|
|
|
485
504
|
To enable detailed code coverage reporting in your project using `GemHadar`,
|
|
486
505
|
follow these steps:
|
|
@@ -524,7 +543,7 @@ follow these steps:
|
|
|
524
543
|
> branch coverage statistics per file, making it ideal for integration with CI
|
|
525
544
|
> tools or custom dashboards.
|
|
526
545
|
|
|
527
|
-
|
|
546
|
+
## Update Gem Version
|
|
528
547
|
|
|
529
548
|
Use one of the following rake tasks to bump the version:
|
|
530
549
|
|
|
@@ -535,7 +554,7 @@ Use one of the following rake tasks to bump the version:
|
|
|
535
554
|
|
|
536
555
|
Or bump your [VERSION](./VERSION) file by hand.
|
|
537
556
|
|
|
538
|
-
|
|
557
|
+
## Release
|
|
539
558
|
|
|
540
559
|
```bash
|
|
541
560
|
$ rake build
|
|
@@ -556,6 +575,75 @@ The `rake release` command performs the final publishing steps: pushing the
|
|
|
556
575
|
master branch and version tag to all git remotes, pushing the gem package to
|
|
557
576
|
RubyGems.org, and creating a GitHub release with AI-generated changelog.
|
|
558
577
|
|
|
578
|
+
## Template System
|
|
579
|
+
|
|
580
|
+
GemHadar includes a template compilation system for generating project files:
|
|
581
|
+
|
|
582
|
+
```ruby
|
|
583
|
+
# In your Rakefile
|
|
584
|
+
template 'templates/Dockerfile.erb', 'Dockerfile' do |t|
|
|
585
|
+
t.version = version
|
|
586
|
+
t.name = name
|
|
587
|
+
end
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
This system uses ERB templates and provides a clean way to generate files
|
|
591
|
+
during your build process.
|
|
592
|
+
|
|
593
|
+
## GitHub Workflows
|
|
594
|
+
|
|
595
|
+
Configure automated workflows with ERB templates:
|
|
596
|
+
|
|
597
|
+
```ruby
|
|
598
|
+
GemHadar do
|
|
599
|
+
github_workflows do
|
|
600
|
+
'ci.yml' => {
|
|
601
|
+
name: 'Continuous Integration',
|
|
602
|
+
ruby_versions: ['3.0', '3.1', '3.2']
|
|
603
|
+
}
|
|
604
|
+
end
|
|
605
|
+
end
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
This creates workflow files in `.github/workflows/` using templates from the
|
|
609
|
+
gem's internal templates directory.
|
|
610
|
+
|
|
611
|
+
## Advanced Usage Patterns
|
|
612
|
+
|
|
613
|
+
### Custom Prompt Templates
|
|
614
|
+
|
|
615
|
+
Override AI behavior by creating custom prompt files in your XDG config:
|
|
616
|
+
|
|
617
|
+
```bash
|
|
618
|
+
# Create custom prompt files
|
|
619
|
+
mkdir -p ~/.config/gem_hadar
|
|
620
|
+
cp /path/to/gem_hadar/lib/gem_hadar/default_changelog_prompt.txt ~/.config/gem_hadar/changelog_prompt.txt
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### CI/CD Integration
|
|
624
|
+
|
|
625
|
+
Use the following workflow for automated releases:
|
|
626
|
+
|
|
627
|
+
```bash
|
|
628
|
+
# Build and test
|
|
629
|
+
$ rake build
|
|
630
|
+
$ rake test
|
|
631
|
+
|
|
632
|
+
# Bump version and create release
|
|
633
|
+
$ rake version:bump
|
|
634
|
+
$ rake build
|
|
635
|
+
$ rake release
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### Troubleshooting
|
|
639
|
+
|
|
640
|
+
If you encounter issues with AI prompts:
|
|
641
|
+
|
|
642
|
+
1. Check that Ollama is running
|
|
643
|
+
2. Verify your model is pulled: `ollama list`
|
|
644
|
+
3. Check configuration with: `rake gem_hadar:config`
|
|
645
|
+
4. Review error messages in the console output
|
|
646
|
+
|
|
559
647
|
## Author
|
|
560
648
|
|
|
561
649
|
**GemHadar** was written by [Florian Frank](mailto:flori@ping.de).
|
data/gem_hadar.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: gem_hadar 2.
|
|
2
|
+
# stub: gem_hadar 2.13.1 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "gem_hadar".freeze
|
|
6
|
-
s.version = "2.
|
|
6
|
+
s.version = "2.13.1".freeze
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
|
|
24
24
|
s.specification_version = 4
|
|
25
25
|
|
|
26
|
-
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.
|
|
26
|
+
s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 2.13".freeze])
|
|
27
27
|
s.add_development_dependency(%q<all_images>.freeze, [">= 0".freeze])
|
|
28
28
|
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.13".freeze])
|
|
29
29
|
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
|
@@ -134,7 +134,7 @@ class GemHadar
|
|
|
134
134
|
|
|
135
135
|
changelog = generate_changelog(versions, changelog:)
|
|
136
136
|
|
|
137
|
-
changelog
|
|
137
|
+
changelog.unshift "# Changes\n"
|
|
138
138
|
|
|
139
139
|
output << changelog.join("")
|
|
140
140
|
end
|
|
@@ -167,8 +167,54 @@ class GemHadar
|
|
|
167
167
|
inject_into_filename(filename, changelog)
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
+
# The changelog_exist? method checks whether a changelog file exists in the
|
|
171
|
+
# project.
|
|
172
|
+
#
|
|
173
|
+
# This method verifies the presence of a changelog file by checking if the
|
|
174
|
+
# file path determined by changelog_filename exists in the filesystem.
|
|
175
|
+
#
|
|
176
|
+
# @return [ TrueClass, FalseClass ] true if the changelog file exists,
|
|
177
|
+
# false otherwise
|
|
178
|
+
def changelog_exist?
|
|
179
|
+
changelog_filename.exist?
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# The changelog_version_added? method checks whether a specific version has
|
|
183
|
+
# already been added to the changelog file.
|
|
184
|
+
#
|
|
185
|
+
# This method verifies if a given version is present in the changelog file
|
|
186
|
+
# by examining each line for a match with the version tag.
|
|
187
|
+
#
|
|
188
|
+
# @param version [ String ] the version to check for in the changelog
|
|
189
|
+
#
|
|
190
|
+
# @return [ TrueClass, FalseClass ] true if the version is found in the
|
|
191
|
+
# changelog, false otherwise
|
|
192
|
+
#
|
|
193
|
+
# @raise [ ArgumentError ] if the changelog file does not exist
|
|
194
|
+
def changelog_version_added?(version)
|
|
195
|
+
version = GemHadar::VersionSpec[version]
|
|
196
|
+
changelog_exist? or
|
|
197
|
+
raise ArgumentError, "Changelog #{changelog_filename.to_s} doesn't exist!"
|
|
198
|
+
File.new(changelog_filename).any? do |line|
|
|
199
|
+
line =~ /#{version.tag}/ and return true
|
|
200
|
+
end
|
|
201
|
+
false
|
|
202
|
+
end
|
|
203
|
+
|
|
170
204
|
private
|
|
171
205
|
|
|
206
|
+
# The changelog_filename method returns the Pathname object for the
|
|
207
|
+
# changelog file path.
|
|
208
|
+
#
|
|
209
|
+
# This method accesses the changelog_filename attribute from the associated
|
|
210
|
+
# GemHadar instance and wraps it in a Pathname object for convenient file
|
|
211
|
+
# path manipulation.
|
|
212
|
+
#
|
|
213
|
+
# @return [ Pathname ] the Pathname object representing the changelog file path
|
|
214
|
+
def changelog_filename
|
|
215
|
+
Pathname.new(@gem_hadar.changelog_filename)
|
|
216
|
+
end
|
|
217
|
+
|
|
172
218
|
# The ollama_generate method delegates AI generation requests to the
|
|
173
219
|
# associated GemHadar instance.
|
|
174
220
|
#
|
data/lib/gem_hadar/version.rb
CHANGED
data/lib/gem_hadar/warn.rb
CHANGED
|
@@ -29,7 +29,7 @@ class GemHadar
|
|
|
29
29
|
# @param msgs [ Array<String> ] the array of message strings to display as warnings
|
|
30
30
|
def warn(*msgs)
|
|
31
31
|
msgs.map! do |a|
|
|
32
|
-
a.respond_to?(:to_str) ? color(
|
|
32
|
+
a.respond_to?(:to_str) ? color(220) { a.to_str } : a
|
|
33
33
|
end
|
|
34
34
|
super(*msgs, uplevel: 1)
|
|
35
35
|
end
|
|
@@ -49,5 +49,22 @@ class GemHadar
|
|
|
49
49
|
end
|
|
50
50
|
super(*msgs)
|
|
51
51
|
end
|
|
52
|
+
|
|
53
|
+
# The abort method formats and displays failure messages using red colored
|
|
54
|
+
# output.
|
|
55
|
+
#
|
|
56
|
+
# This method takes an array of message objects, applies red color formatting
|
|
57
|
+
# to string representations of the messages, and then passes them to the
|
|
58
|
+
# superclass's abort method for display. The uplevel: 1 option ensures that
|
|
59
|
+
# the failure message originates from the caller's context rather than from
|
|
60
|
+
# within this method itself.
|
|
61
|
+
#
|
|
62
|
+
# @param msgs [ Array<Object> ] the array of message objects to display as failures
|
|
63
|
+
def abort(*msgs)
|
|
64
|
+
msgs.map! do |a|
|
|
65
|
+
a.respond_to?(:to_str) ? color(208) { a.to_str } : a
|
|
66
|
+
end
|
|
67
|
+
super(*msgs)
|
|
68
|
+
end
|
|
52
69
|
end
|
|
53
70
|
end
|
data/lib/gem_hadar.rb
CHANGED
|
@@ -598,6 +598,17 @@ class GemHadar
|
|
|
598
598
|
@rvm
|
|
599
599
|
end
|
|
600
600
|
|
|
601
|
+
# The changelog_filename attribute accessor for configuring the gem's
|
|
602
|
+
# changelog file name.
|
|
603
|
+
#
|
|
604
|
+
# This method sets up a DSL accessor for the changelog_filename attribute,
|
|
605
|
+
# which specifies the name of the changelog file to be used in the project.
|
|
606
|
+
# It provides a way to define a custom changelog filename that will be used
|
|
607
|
+
# during documentation generation and version management tasks.
|
|
608
|
+
#
|
|
609
|
+
# @return [ String, nil ] the name of the changelog file or nil if disabled.
|
|
610
|
+
dsl_accessor :changelog_filename
|
|
611
|
+
|
|
601
612
|
# The default_task_dependencies method manages the list of dependencies for
|
|
602
613
|
# the default Rake task.
|
|
603
614
|
#
|
|
@@ -913,8 +924,7 @@ class GemHadar
|
|
|
913
924
|
task :update do
|
|
914
925
|
answer = ask?("Which gem_hadar version? ", /^((?:\d+.){2}(?:\d+))$/)
|
|
915
926
|
unless answer
|
|
916
|
-
|
|
917
|
-
exit 1
|
|
927
|
+
abort "Invalid version specification!"
|
|
918
928
|
end
|
|
919
929
|
gem_hadar_version = answer[0]
|
|
920
930
|
filename = "#{name}.gemspec"
|
|
@@ -1099,6 +1109,37 @@ class GemHadar
|
|
|
1099
1109
|
end
|
|
1100
1110
|
end
|
|
1101
1111
|
|
|
1112
|
+
# The version_tag_local method retrieves the Git revision hash for the current version tag
|
|
1113
|
+
#
|
|
1114
|
+
# This method executes a Git command to obtain the full revision hash (commit SHA) associated
|
|
1115
|
+
# with the current gem version tag. It constructs the tag name using the GemHadar::VersionSpec
|
|
1116
|
+
# class and then uses Git's rev-parse command to resolve the tag to its corresponding commit.
|
|
1117
|
+
#
|
|
1118
|
+
# @return [ String ] the Git revision hash for the current version tag
|
|
1119
|
+
# @return [ String ] an empty string if the Git command fails
|
|
1120
|
+
# @return [ String ] the output of the Git rev-parse command as a string
|
|
1121
|
+
def version_tag_local
|
|
1122
|
+
`git show-ref #{GemHadar::VersionSpec[version].tag.inspect}`.
|
|
1123
|
+
chomp.sub(/\s.*/, '').full?
|
|
1124
|
+
end
|
|
1125
|
+
memoize method: :version_tag_local
|
|
1126
|
+
|
|
1127
|
+
# The version_tag_remote method retrieves the Git revision hash for the remote version tag
|
|
1128
|
+
#
|
|
1129
|
+
# This method executes a Git command to obtain the full revision hash (commit SHA) associated
|
|
1130
|
+
# with the current gem version tag on the remote repository. It constructs the tag name using
|
|
1131
|
+
# the GemHadar::VersionSpec class and then uses Git's ls-remote command to resolve the tag
|
|
1132
|
+
# to its corresponding commit on the specified remote.
|
|
1133
|
+
#
|
|
1134
|
+
# @return [ String ] the Git revision hash for the remote version tag
|
|
1135
|
+
# @return [ String ] an empty string if the Git command fails or no remote tag is found
|
|
1136
|
+
# @return [ String ] the output of the Git ls-remote command as a string
|
|
1137
|
+
def version_tag_remote
|
|
1138
|
+
`git ls-remote --tags #{git_remote} #{GemHadar::VersionSpec[version].tag.inspect}`.
|
|
1139
|
+
chomp.sub(/\s.*/, '').full?
|
|
1140
|
+
end
|
|
1141
|
+
memoize method: :version_tag_remote
|
|
1142
|
+
|
|
1102
1143
|
# The version_tag_task method defines a Rake task that creates a Git tag for
|
|
1103
1144
|
# the current version.
|
|
1104
1145
|
#
|
|
@@ -1110,24 +1151,29 @@ class GemHadar
|
|
|
1110
1151
|
# overwrite it forcefully.
|
|
1111
1152
|
def version_tag_task
|
|
1112
1153
|
namespace :version do
|
|
1154
|
+
namespace :tag do
|
|
1155
|
+
desc "show local tag revision"
|
|
1156
|
+
task :local do
|
|
1157
|
+
system 'git fetch --tags'
|
|
1158
|
+
puts version_tag_local
|
|
1159
|
+
end
|
|
1160
|
+
|
|
1161
|
+
desc "show remote tag revision"
|
|
1162
|
+
task :remote do
|
|
1163
|
+
puts version_tag_remote
|
|
1164
|
+
end
|
|
1165
|
+
end
|
|
1166
|
+
|
|
1113
1167
|
desc "Tag this commit as version #{version}"
|
|
1114
|
-
task :tag do
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
else
|
|
1122
|
-
if ask?("Different version tag #{version} already exists. Overwrite with "\
|
|
1123
|
-
"force? (yes/NO) ", /\Ayes\z/i)
|
|
1124
|
-
force = true
|
|
1125
|
-
retry
|
|
1126
|
-
else
|
|
1127
|
-
exit 1
|
|
1128
|
-
end
|
|
1129
|
-
end
|
|
1168
|
+
task :tag => :modified do
|
|
1169
|
+
version_spec = GemHadar::VersionSpec[version]
|
|
1170
|
+
if sha = version_tag_remote
|
|
1171
|
+
abort <<~EOT.chomp
|
|
1172
|
+
Remote version tag #{version_spec.tag.inspect} already exists and points to #{sha.inspect}!"
|
|
1173
|
+
Call version:bump first to create a new version before release.
|
|
1174
|
+
EOT
|
|
1130
1175
|
end
|
|
1176
|
+
sh "git tag -a -m 'Version #{version_spec.untag}' -f #{version_spec.tag.inspect}"
|
|
1131
1177
|
end
|
|
1132
1178
|
end
|
|
1133
1179
|
end
|
|
@@ -1258,8 +1304,7 @@ class GemHadar
|
|
|
1258
1304
|
exit 1
|
|
1259
1305
|
end
|
|
1260
1306
|
else
|
|
1261
|
-
|
|
1262
|
-
exit 1
|
|
1307
|
+
abort "Cannot push gem to rubygems: #{path.inspect} doesn't exist."
|
|
1263
1308
|
end
|
|
1264
1309
|
end
|
|
1265
1310
|
end
|
|
@@ -1346,6 +1391,23 @@ class GemHadar
|
|
|
1346
1391
|
end
|
|
1347
1392
|
end
|
|
1348
1393
|
|
|
1394
|
+
# The modified_task method defines a Rake task that checks for uncommitted
|
|
1395
|
+
# changes in the Git repository
|
|
1396
|
+
#
|
|
1397
|
+
# This method creates a Rake task named :modified that runs a Git status
|
|
1398
|
+
# command to identify any modified files that are not yet committed. If any
|
|
1399
|
+
# changed files are found, it aborts the task execution and displays a
|
|
1400
|
+
# message
|
|
1401
|
+
# listing all the uncommitted files
|
|
1402
|
+
def modified_task
|
|
1403
|
+
task :modified do
|
|
1404
|
+
changed_files = `git status --porcelain`.gsub(/^\s*\S\s+/, '').lines
|
|
1405
|
+
unless changed_files.empty?
|
|
1406
|
+
abort "There are still modified files:\n#{changed_files * ''}"
|
|
1407
|
+
end
|
|
1408
|
+
end
|
|
1409
|
+
end
|
|
1410
|
+
|
|
1349
1411
|
# The push_task_dependencies method manages the list of dependencies for the push task.
|
|
1350
1412
|
#
|
|
1351
1413
|
# This method sets up a DSL accessor for the push_task_dependencies attribute,
|
|
@@ -1373,13 +1435,7 @@ class GemHadar
|
|
|
1373
1435
|
gem_push_task
|
|
1374
1436
|
git_remotes_task
|
|
1375
1437
|
github_release_task
|
|
1376
|
-
|
|
1377
|
-
changed_files = `git status --porcelain`.gsub(/^\s*\S\s+/, '').lines
|
|
1378
|
-
unless changed_files.empty?
|
|
1379
|
-
warn "There are still modified files:\n#{changed_files * ''}"
|
|
1380
|
-
exit 1
|
|
1381
|
-
end
|
|
1382
|
-
end
|
|
1438
|
+
modified_task
|
|
1383
1439
|
desc "Push all changes for version #{version} into the internets."
|
|
1384
1440
|
task :push => push_task_dependencies
|
|
1385
1441
|
end
|
|
@@ -1393,7 +1449,7 @@ class GemHadar
|
|
|
1393
1449
|
# with a single command.
|
|
1394
1450
|
def release_task
|
|
1395
1451
|
desc "Release the new version #{version} for the gem #{name}."
|
|
1396
|
-
task :release => :push
|
|
1452
|
+
task :release => [ :'changes:added', :push ]
|
|
1397
1453
|
end
|
|
1398
1454
|
|
|
1399
1455
|
# The compile_task method sets up a Rake task to compile project extensions.
|
|
@@ -1579,7 +1635,6 @@ class GemHadar
|
|
|
1579
1635
|
puts "Git Remote(s): #{ENV['GIT_REMOTE'] || 'origin'}"
|
|
1580
1636
|
|
|
1581
1637
|
# Other
|
|
1582
|
-
puts "Force Operations: #{ENV['FORCE'] || '0'}"
|
|
1583
1638
|
puts "Version Override: #{ENV['VERSION'] || 'Not set'}"
|
|
1584
1639
|
puts "GitHub Release Enabled: #{ENV['GITHUB_RELEASE_ENABLED'] || 'Not set'}"
|
|
1585
1640
|
|
|
@@ -1606,6 +1661,7 @@ class GemHadar
|
|
|
1606
1661
|
# - :changes:range - Show changes for a specific Git range
|
|
1607
1662
|
# - :changes:full - Generate complete changelog from first tag
|
|
1608
1663
|
# - :changes:add - Append to existing changelog file
|
|
1664
|
+
# - :changes:added - Check if the current version was added to changelog file
|
|
1609
1665
|
def changes_task
|
|
1610
1666
|
namespace :changes do
|
|
1611
1667
|
desc 'Show changes since last version tag'
|
|
@@ -1670,9 +1726,18 @@ class GemHadar
|
|
|
1670
1726
|
|
|
1671
1727
|
desc 'Append new entries to existing changelog file'
|
|
1672
1728
|
task :add do
|
|
1673
|
-
filename = ARGV[1]
|
|
1729
|
+
filename = ARGV[1] || changelog_filename
|
|
1730
|
+
filename or raise 'Need file to add to'
|
|
1674
1731
|
GemHadar::ChangelogGenerator.new(self).add_to_file(filename)
|
|
1675
1732
|
end
|
|
1733
|
+
|
|
1734
|
+
desc 'Check if current version was added to the changelog'
|
|
1735
|
+
task :added do
|
|
1736
|
+
changelog_filename or next
|
|
1737
|
+
GemHadar::ChangelogGenerator.new(self).changelog_version_added?(version) and next
|
|
1738
|
+
abort "Version #{GemHadar::VersionSpec[version].untag} has not been "\
|
|
1739
|
+
"documented in changelog #{changelog_filename.inspect} file."
|
|
1740
|
+
end
|
|
1676
1741
|
end
|
|
1677
1742
|
|
|
1678
1743
|
# Main changes task that shows help when called directly
|
|
@@ -1685,6 +1750,7 @@ class GemHadar
|
|
|
1685
1750
|
rake changes:range <range> Show changes for a specific Git range (e.g., v1.0.0..v1.2.0)
|
|
1686
1751
|
rake changes:full [file] Generate complete changelog from first tag
|
|
1687
1752
|
rake changes:add <file> Append new entries to existing changelog file
|
|
1753
|
+
rake changes:added Check if current version was added to changelog
|
|
1688
1754
|
|
|
1689
1755
|
Examples:
|
|
1690
1756
|
rake changes:pending
|
|
@@ -1693,6 +1759,7 @@ class GemHadar
|
|
|
1693
1759
|
rake changes:full
|
|
1694
1760
|
rake changes:full CHANGES.md
|
|
1695
1761
|
rake changes:add CHANGES.md
|
|
1762
|
+
rake changes:added
|
|
1696
1763
|
EOT
|
|
1697
1764
|
end
|
|
1698
1765
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gem_hadar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.13.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '2.
|
|
18
|
+
version: '2.13'
|
|
19
19
|
type: :development
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '2.
|
|
25
|
+
version: '2.13'
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: all_images
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|