Skip to content

Commit 3ed5090

Browse files
committed
feat: Bumped library version. Updated homebrew to only returned user specified
1 parent 0948279 commit 3ed5090

File tree

7 files changed

+24
-12
lines changed

7 files changed

+24
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"ajv": "^8.12.0",
2424
"ajv-formats": "^2.1.1",
2525
"semver": "^7.6.0",
26-
"codify-plugin-lib": "1.0.136",
26+
"codify-plugin-lib": "1.0.137",
2727
"codify-schemas": "1.0.63",
2828
"chalk": "^5.3.0",
2929
"debug": "^4.3.4",

src/resources/aws-cli/profile/aws-profile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class AwsProfileResource extends Resource<AwsProfileConfig> {
3737
parameterSettings: {
3838
awsAccessKeyId: { canModify: true },
3939
awsSecretAccessKey: { canModify: true },
40-
csvCredentials: { type: 'setting' }, // Type setting means it won't be included in the plan calculation
40+
csvCredentials: { type: 'directory', setting: true }, // Type setting means it won't be included in the plan calculation
4141
output: { default: 'json', canModify: true },
4242
profile: { default: 'default', canModify: true },
4343
metadataServiceNumAttempts: { canModify: true },

src/resources/git/clone/git-clone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class GitCloneResource extends Resource<GitCloneConfig> {
2323
parameterSettings: {
2424
parentDirectory: { type: 'directory' },
2525
directory: { type: 'directory' },
26-
autoVerifySSH: { type: 'setting', default: true },
26+
autoVerifySSH: { type: 'boolean', default: true, setting: true },
2727
},
2828
importAndDestroy:{
2929
requiredParameters: ['directory']

src/resources/homebrew/formulae-parameter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ export class FormulaeParameter extends StatefulParameter<HomebrewConfig, string[
2121
}
2222
}
2323

24-
override async refresh(): Promise<null | string[]> {
24+
override async refresh(desired: unknown, config: Partial<HomebrewConfig>): Promise<null | string[]> {
2525
const $ = getPty();
26-
const formulaeQuery = await $.spawnSafe('brew list --formula -1')
26+
const formulaeQuery = await $.spawnSafe(`brew list --formula -1 ${config.onlyPlanUserInstalled ? '--installed-on-request' : ''}`)
2727

2828
if (formulaeQuery.status === SpawnStatus.SUCCESS && formulaeQuery.data !== null && formulaeQuery.data !== undefined) {
2929
return formulaeQuery.data

src/resources/homebrew/homebrew-schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
"skipAlreadyInstalledCasks": {
2929
"type": "boolean",
3030
"description": "Skips installing an casks which has already been installed externally. This prevents homebrew from conflicting with the existing install. Defaults to true."
31+
},
32+
"onlyPlanUserInstalled": {
33+
"type": "boolean",
34+
"description": "Only consider packages that the user has explicitly specified in the plan and ignore any dependent packages"
3135
}
3236
},
3337
"additionalProperties": false

src/resources/homebrew/homebrew.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ import { TapsParameter } from './tap-parameter.js';
1616
const SUDO_ASKPASS_PATH = '~/Library/Caches/codify/homebrew/sudo_prompt.sh'
1717

1818
export interface HomebrewConfig extends ResourceConfig {
19-
casks?: string[],
20-
directory?: string,
21-
formulae?: string[],
22-
taps?: string[],
23-
skipAlreadyInstalledCasks: boolean
19+
casks?: string[];
20+
directory?: string;
21+
formulae?: string[];
22+
taps?: string[];
23+
skipAlreadyInstalledCasks: boolean;
24+
onlyPlanUserInstalled: boolean
2425
}
2526

2627
export class HomebrewResource extends Resource<HomebrewConfig> {
@@ -34,7 +35,8 @@ export class HomebrewResource extends Resource<HomebrewConfig> {
3435
formulae: { type: 'stateful', definition: new FormulaeParameter(), order: 2 },
3536
casks: { type: 'stateful', definition: new CasksParameter(), order: 3 },
3637
directory: { type: 'directory' },
37-
skipAlreadyInstalledCasks: { type: 'setting', default: true }
38+
skipAlreadyInstalledCasks: { type: 'boolean', default: true, setting: true },
39+
onlyPlanUserInstalled: { type: 'boolean', default: true, setting: true },
3840
},
3941
};
4042
}

test/homebrew/default.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,13 @@ describe('Homebrew main resource integration tests', () => {
9191
"previousValue": null,
9292
"newValue": true,
9393
"operation": "noop"
94-
}
94+
},
95+
{
96+
"name": "onlyPlanUserInstalled",
97+
"newValue": true,
98+
"operation": "noop",
99+
"previousValue": null,
100+
},
95101
]
96102
})
97103

0 commit comments

Comments
 (0)