Skip to content

Commit 0372779

Browse files
committed
feat: enhance Homebrew formula generation with asset data and Dart compilation
1 parent ca8035e commit 0372779

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

tool/flutter_bunny.template.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class FlutterBunny < Formula
1616
end
1717

1818
def install
19+
system "dart", "pub", "get"
20+
system "dart", "compile", "exe", "bin/flutter_bunny.dart", "-o", "flutter_bunny"
1921
bin.install "flutter_bunny"
2022
end
2123

tool/homebrew.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,18 @@ Future<void> runHomebrewFormula() async {
9797
orElse: () => '',
9898
);
9999

100+
// Generate the formula with real asset data
101+
final macosX64 = assetData[macosX64Key];
102+
final macosArm64 = assetData[macosArm64Key];
103+
100104
if (macosX64Key.isEmpty || macosArm64Key.isEmpty) {
101105
log('Missing required macOS assets, using fallback...');
102106

103107
final sourceTarballUrl =
104108
'https://github.com/$owner/$repo/archive/refs/tags/$versionArg.tar.gz';
105109

106110
final templateFile = File('tool/flutter_bunny.template.rb');
111+
107112
if (!await templateFile.exists()) {
108113
throw Exception('Template file not found: ${templateFile.path}');
109114
}
@@ -112,20 +117,16 @@ Future<void> runHomebrewFormula() async {
112117
final formula = template
113118
.replaceAll('{{VERSION}}', versionNoPrefix)
114119
.replaceAll('{{MACOS_X64_URL}}', sourceTarballUrl)
115-
.replaceAll('{{MACOS_X64_SHA256}}', 'UPDATE_WITH_ACTUAL_HASH')
120+
.replaceAll('{{MACOS_X64_SHA256}}', macosX64['sha256'])
116121
.replaceAll('{{MACOS_ARM64_URL}}', sourceTarballUrl)
117-
.replaceAll('{{MACOS_ARM64_SHA256}}', 'UPDATE_WITH_ACTUAL_HASH');
122+
.replaceAll('{{MACOS_ARM64_SHA256}}', macosArm64['sha256']);
118123

119124
final outputFile = File('flutter_bunny.rb');
120125
await outputFile.writeAsString(formula);
121126
log('Formula generated with placeholder values at: ${outputFile.absolute.path}');
122127
return;
123128
}
124129

125-
// Generate the formula with real asset data
126-
final macosX64 = assetData[macosX64Key];
127-
final macosArm64 = assetData[macosArm64Key];
128-
129130
log('Generating formula with:\n Version: $versionNoPrefix\n x64 URL: ${macosX64['url']}\n arm64 URL: ${macosArm64['url']}');
130131

131132
final templateFile = File('tool/flutter_bunny.template.rb');

0 commit comments

Comments
 (0)