Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to AI agents when working with code in this reposito

## Overview

Release Toolkit is a fastlane plugin implemented as a Ruby gem (`fastlane-plugin-wpmreleasetoolkit`) providing actions and helper utilities for release automation of Automattic's mobile apps. It standardizes the release process across multiple products (WordPress, Jetpack, WooCommerce, DayOne, PocketCats, Tumblr, Studio, …), repositories, and platforms (iOS, Android, macOS).
Release Toolkit is a _fastlane_ plugin implemented as a Ruby gem (`fastlane-plugin-wpmreleasetoolkit`) providing actions and helper utilities for release automation of Automattic's mobile apps. It standardizes the release process across multiple products (WordPress, Jetpack, WooCommerce, Day One, Pocket Casts, Tumblr, Studio, …), repositories, and platforms (iOS, Android, macOS).

- **Language**: Ruby (version in `.ruby-version`, minimum in `fastlane-plugin-wpmreleasetoolkit.gemspec`)
- **Framework**: Fastlane plugin
Expand All @@ -22,6 +22,7 @@ bundle exec rubocop # Run linter
bundle exec rubocop -a # Auto-fix lint issues
bundle exec yard doc # Generate docs, open in browser
bundle exec yard stats --list-undoc # Show undocumented methods
gem build # Build the gem (no arguments — auto-picks the gemspec)
rake new_release # Start a new release (interactive)
```

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PATH
remote: .
specs:
fastlane-plugin-wpmreleasetoolkit (14.0.0)
activesupport (>= 6.1.7.1)
activesupport (>= 6.1.7.1, < 8)
buildkit (~> 1.5)
chroma (= 0.2.0)
diffy (~> 3.3)
Expand Down
2 changes: 1 addition & 1 deletion fastlane-plugin-wpmreleasetoolkit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
# since this would cause a circular dependency

# spec.add_dependency 'your-dependency', '~> 1.0.0'
spec.add_dependency 'activesupport', '>= 6.1.7.1' # Required for fastlane to not crash when importing this plugin
spec.add_dependency 'activesupport', '>= 6.1.7.1', '< 8' # Required for fastlane to not crash when importing this plugin
spec.add_dependency 'buildkit', '~> 1.5'
spec.add_dependency 'chroma', '0.2.0'
spec.add_dependency 'diffy', '~> 3.3'
Expand Down
8 changes: 8 additions & 0 deletions lib/fastlane/plugin/wpmreleasetoolkit/models/app_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ def initialize(major, minor, patch = 0, build_number = 0)
@build_number = build_number
end

# Returns whether this version is a patch (hotfix) release.
#
# @return [Boolean] true if the patch component is greater than zero.
#
def patch?
@patch.positive?
end

# Converts the AppVersion object to a string representation.
# This should only be used for internal debugging/testing purposes, not to write versions in version files
# In order to format an `AppVersion` into a `String`, you should use the appropriate `VersionFormatter` for your project instead.
Expand Down
5 changes: 5 additions & 0 deletions lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ def add_file_to_copy(source, destination, encrypt: false)
files_to_copy << file
end

def valid?
!project_name.nil? && !project_name.empty? &&
!branch.nil? && !branch.empty?
end

def to_hash
{
project_name: project_name,
Expand Down
12 changes: 12 additions & 0 deletions spec/app_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
end
end

describe '#patch?' do
it 'returns true when patch is greater than zero' do
app_version = described_class.new(1, 2, 3)
expect(app_version.patch?).to be true
end

it 'returns false when patch is zero' do
app_version = described_class.new(1, 2, 0)
expect(app_version.patch?).to be false
end
end

describe '#to_s' do
it 'returns the version as a formatted string' do
app_version = described_class.new(2, 3, 4, 5)
Expand Down
29 changes: 29 additions & 0 deletions spec/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,35 @@
end
end

describe '#valid?' do
it 'returns true when project_name and branch are present' do
config = described_class.new(project_name: 'MyProject', branch: 'trunk')
expect(config.valid?).to be true
end

it 'returns false when project_name is empty' do
config = described_class.new(project_name: '', branch: 'trunk')
expect(config.valid?).to be false
end

it 'returns false when project_name is nil' do
config = described_class.new(branch: 'trunk')
config.project_name = nil
expect(config.valid?).to be false
end

it 'returns false when branch is empty' do
config = described_class.new(project_name: 'MyProject', branch: '')
expect(config.valid?).to be false
end

it 'returns false when branch is nil' do
config = described_class.new(project_name: 'MyProject')
config.branch = nil
expect(config.valid?).to be false
end
end

describe '#add_file_to_copy' do
it 'adds files to copy' do
expect(subject.files_to_copy).to eq([])
Expand Down