Compare commits

...

3 Commits

Author SHA1 Message Date
github-actions[bot]
e0eb0d32a8 chore(master): release 0.6.44 (#94)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-19 23:32:14 +00:00
85041112ef chore(bootstrap): simplify bootstrap make target
The CI bootstrap steps weren't really "CI" related, nor were they
actually used. So they have been removed.
2023-11-19 20:27:30 +00:00
af0b2b83ab fix(builder/cask): ensure release info helpers return correct asset 2023-11-19 14:12:58 +00:00
6 changed files with 91 additions and 10 deletions

View File

@@ -1,3 +1,3 @@
{
".": "0.6.43"
".": "0.6.44"
}

View File

@@ -1,3 +0,0 @@
# frozen_string_literal: true
brew 'python'

View File

@@ -1,5 +1,12 @@
# Changelog
## [0.6.44](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.43...v0.6.44) (2023-11-19)
### Bug Fixes
* **builder/cask:** ensure release info helpers return correct asset ([af0b2b8](https://github.com/jimeh/build-emacs-for-macos/commit/af0b2b83abd5af0e61a085da386cc0da389f6588))
## [0.6.43](https://github.com/jimeh/build-emacs-for-macos/compare/v0.6.42...v0.6.43) (2023-11-16)

View File

@@ -46,16 +46,12 @@ SHELL := env \
#
bootstrap: bootstrap-brew bootstrap-ruby
bootstrap-ci: bootstrap-brew bootstrap-brew-ci bootstrap-ruby bootstrap-pip
bootstrap-ruby:
bundle install
bootstrap-brew:
brew bundle
bootstrap-brew-ci:
brew bundle --file Brewfile.ci
brew bundle --verbose --no-upgrade
bootstrap-pip:
$(PIP) install -r requirements-ci.txt

View File

@@ -28,10 +28,11 @@ func (s *ReleaseInfo) Asset(needles ...string) *ReleaseAsset {
return assets[i].Filename < assets[j].Filename
})
assetsLoop:
for _, a := range assets {
for _, needle := range needles {
if !strings.Contains(a.Filename, needle) {
continue
continue assetsLoop
}
}

View File

@@ -0,0 +1,80 @@
package cask
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestAsset(t *testing.T) {
// Define test cases
tests := []struct {
name string
release ReleaseInfo
needles []string
want *ReleaseAsset
}{
{
name: "single needle, exact match",
release: ReleaseInfo{
Assets: map[string]*ReleaseAsset{
"asset1": {Filename: "asset1.zip"},
"asset2": {Filename: "asset2.zip"},
},
},
needles: []string{"asset1"},
want: &ReleaseAsset{Filename: "asset1.zip"},
},
{
name: "multiple needles, all",
release: ReleaseInfo{
Assets: map[string]*ReleaseAsset{
"asset1": {Filename: "asset1.zip"},
"asset2": {Filename: "asset2.zip"},
},
},
needles: []string{"zip", "asset1"},
want: &ReleaseAsset{Filename: "asset1.zip"},
},
{
name: "multiple needles, one match",
release: ReleaseInfo{
Assets: map[string]*ReleaseAsset{
"asset1": {Filename: "asset1.zip"},
"asset2": {Filename: "asset2.zip"},
},
},
needles: []string{"rar", "asset2"},
want: nil,
},
{
name: "multiple needles, no match",
release: ReleaseInfo{
Assets: map[string]*ReleaseAsset{
"asset1": {Filename: "asset1.zip"},
"asset2": {Filename: "asset2.zip"},
},
},
needles: []string{"rar", "asset3"},
want: nil,
},
{
name: "no needles",
release: ReleaseInfo{
Assets: map[string]*ReleaseAsset{
"asset1": {Filename: "asset1.zip"},
"asset2": {Filename: "asset2.zip"},
},
},
needles: nil,
want: &ReleaseAsset{Filename: "asset1.zip"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := tt.release.Asset(tt.needles...)
assert.Equal(t, tt.want, got)
})
}
}