Skip to content

Commit efe5658

Browse files
committed
Rename "RushGlobalFolders" to "RushGlobalFolder"
1 parent 8b479e5 commit efe5658

12 files changed

Lines changed: 42 additions & 42 deletions

File tree

apps/rush-lib/src/api/RushGlobalFolders.ts renamed to apps/rush-lib/src/api/RushGlobalFolder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ import { Utilities } from '../utilities/Utilities';
99
*
1010
* @internal
1111
*/
12-
export class RushGlobalFolders {
12+
export class RushGlobalFolder {
1313
private _rushUserFolder: string;
1414
private _rushNodeSpecificUserFolder: string;
1515

1616
/**
1717
* The absolute path to Rush's storage in the home directory for the current user, independent of node version.
1818
* On Windows, it would be something like `C:\Users\YourName\.rush\`.
1919
*/
20-
public get rushGlobalFolder(): string {
20+
public get path(): string {
2121
return this._rushUserFolder;
2222
}
2323

2424
/**
2525
* The absolute path to Rush's storage in the home directory for the current user and node version.
2626
* On Windows, it would be something like `C:\Users\YourName\.rush\node-v3.4.5`.
2727
*/
28-
public get rushNodeSpecificGlobalFolder(): string {
28+
public get nodeSpecificPath(): string {
2929
return this._rushNodeSpecificUserFolder;
3030
}
3131

apps/rush-lib/src/cli/RushCommandLineParser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ import { GlobalScriptAction } from './scriptActions/GlobalScriptAction';
3131

3232
import { Telemetry } from '../logic/Telemetry';
3333
import { AlreadyReportedError } from '../utilities/AlreadyReportedError';
34-
import { RushGlobalFolders } from '../api/RushGlobalFolders';
34+
import { RushGlobalFolder } from '../api/RushGlobalFolder';
3535

3636
export class RushCommandLineParser extends CommandLineParser {
3737
public telemetry: Telemetry | undefined;
3838
public rushConfiguration: RushConfiguration;
39-
public rushGlobalFolders: RushGlobalFolders;
39+
public rushGlobalFolder: RushGlobalFolder;
4040

4141
private _debugParameter: CommandLineFlagParameter;
4242

@@ -111,7 +111,7 @@ export class RushCommandLineParser extends CommandLineParser {
111111
this.rushConfiguration = RushConfiguration.loadFromConfigurationFile(rushJsonFilename);
112112
}
113113

114-
this.rushGlobalFolders = new RushGlobalFolders();
114+
this.rushGlobalFolder = new RushGlobalFolder();
115115

116116
this.addAction(new AddAction(this));
117117
this.addAction(new ChangeAction(this));

apps/rush-lib/src/cli/actions/AddAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class AddAction extends BaseRushAction {
115115
return Promise.reject(new Error(`The SemVer specifier "${version}" is not valid.`));
116116
}
117117

118-
return new PackageJsonUpdater(this.rushConfiguration, this.rushGlobalFolders).doRushAdd({
118+
return new PackageJsonUpdater(this.rushConfiguration, this.rushGlobalFolder).doRushAdd({
119119
currentProject: project,
120120
packageName: packageName,
121121
initialVersion: version,

apps/rush-lib/src/cli/actions/BaseInstallAction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export abstract class BaseInstallAction extends BaseRushAction {
8181

8282
this.eventHooksManager.handle(Event.preRushInstall, this.parser.isDebug);
8383

84-
const purgeManager: PurgeManager = new PurgeManager(this.rushConfiguration, this.rushGlobalFolders);
84+
const purgeManager: PurgeManager = new PurgeManager(this.rushConfiguration, this.rushGlobalFolder);
8585

8686
if (this._purgeParameter.value!) {
8787
console.log('The --purge flag was specified, so performing "rush purge"');
@@ -100,7 +100,7 @@ export abstract class BaseInstallAction extends BaseRushAction {
100100

101101
const installManager: InstallManager = new InstallManager(
102102
this.rushConfiguration,
103-
this.rushGlobalFolders,
103+
this.rushGlobalFolder,
104104
purgeManager,
105105
installManagerOptions
106106
);

apps/rush-lib/src/cli/actions/BaseRushAction.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { RushConfiguration } from '../../api/RushConfiguration';
1616
import { EventHooksManager } from '../../logic/EventHooksManager';
1717
import { RushCommandLineParser } from './../RushCommandLineParser';
1818
import { Utilities } from '../../utilities/Utilities';
19-
import { RushGlobalFolders } from '../../api/RushGlobalFolders';
19+
import { RushGlobalFolder } from '../../api/RushGlobalFolder';
2020

2121
export interface IBaseRushActionOptions extends ICommandLineActionOptions {
2222
/**
@@ -46,8 +46,8 @@ export abstract class BaseConfiglessRushAction extends CommandLineAction {
4646
return this._parser.rushConfiguration;
4747
}
4848

49-
protected get rushGlobalFolders(): RushGlobalFolders {
50-
return this._parser.rushGlobalFolders;
49+
protected get rushGlobalFolder(): RushGlobalFolder {
50+
return this._parser.rushGlobalFolder;
5151
}
5252

5353
protected get parser(): RushCommandLineParser {

apps/rush-lib/src/cli/actions/PurgeAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class PurgeAction extends BaseRushAction {
3939
const stopwatch: Stopwatch = Stopwatch.start();
4040

4141
const unlinkManager: UnlinkManager = new UnlinkManager(this.rushConfiguration);
42-
const purgeManager: PurgeManager = new PurgeManager(this.rushConfiguration, this.rushGlobalFolders);
42+
const purgeManager: PurgeManager = new PurgeManager(this.rushConfiguration, this.rushGlobalFolder);
4343

4444
unlinkManager.unlink();
4545

apps/rush-lib/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export {
2525
} from './api/RushConfigurationProject';
2626

2727
export {
28-
RushGlobalFolders as _RushGlobalFolders
29-
} from './api/RushGlobalFolders';
28+
RushGlobalFolder as _RushGlobalFolder
29+
} from './api/RushGlobalFolder';
3030

3131
export {
3232
ApprovedPackagesItem,

apps/rush-lib/src/logic/InstallManager.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const MAX_INSTALL_ATTEMPTS: number = 2;
4949
* As a temporary workaround, augment the type.
5050
*/
5151
import { CreateOptions } from 'tar';
52-
import { RushGlobalFolders } from '../api/RushGlobalFolders';
52+
import { RushGlobalFolder } from '../api/RushGlobalFolder';
5353

5454
export interface CreateOptions { // tslint:disable-line:interface-name
5555
/**
@@ -114,7 +114,7 @@ export interface IInstallManagerOptions {
114114
*/
115115
export class InstallManager {
116116
private _rushConfiguration: RushConfiguration;
117-
private _rushGlobalFolders: RushGlobalFolders;
117+
private _rushGlobalFolder: RushGlobalFolder;
118118
private _commonNodeModulesMarker: LastInstallFlag;
119119
private _commonTempFolderRecycler: AsyncRecycler;
120120

@@ -239,12 +239,12 @@ export class InstallManager {
239239

240240
constructor(
241241
rushConfiguration: RushConfiguration,
242-
rushGlobalFolders: RushGlobalFolders,
242+
rushGlobalFolder: RushGlobalFolder,
243243
purgeManager: PurgeManager,
244244
options: IInstallManagerOptions
245245
) {
246246
this._rushConfiguration = rushConfiguration;
247-
this._rushGlobalFolders = rushGlobalFolders;
247+
this._rushGlobalFolder = rushGlobalFolder;
248248
this._commonTempFolderRecycler = purgeManager.commonTempFolderRecycler;
249249
this._options = options;
250250

@@ -349,7 +349,7 @@ export class InstallManager {
349349
*/
350350
public ensureLocalPackageManager(): Promise<void> {
351351
// Example: "C:\Users\YourName\.rush"
352-
const rushUserFolder: string = this._rushGlobalFolders.rushNodeSpecificGlobalFolder;
352+
const rushUserFolder: string = this._rushGlobalFolder.nodeSpecificPath;
353353

354354
if (!FileSystem.exists(rushUserFolder)) {
355355
console.log('Creating ' + rushUserFolder);
@@ -933,7 +933,7 @@ export class InstallManager {
933933

934934
private _checkIfReleaseIsPublished(): Promise<boolean> {
935935
return Promise.resolve().then(() => {
936-
const lastCheckFile: string = path.join(this._rushGlobalFolders.rushNodeSpecificGlobalFolder,
936+
const lastCheckFile: string = path.join(this._rushGlobalFolder.nodeSpecificPath,
937937
'rush-' + Rush.version, 'last-check.flag');
938938

939939
if (FileSystem.exists(lastCheckFile)) {

apps/rush-lib/src/logic/PackageJsonUpdater.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { VersionMismatchFinder } from '../api/VersionMismatchFinder';
1111
import { PurgeManager } from './PurgeManager';
1212
import { Utilities } from '../utilities/Utilities';
1313
import { DependencyType, PackageJsonEditor, PackageJsonDependency } from '../api/PackageJsonEditor';
14-
import { RushGlobalFolders } from '../api/RushGlobalFolders';
14+
import { RushGlobalFolder } from '../api/RushGlobalFolder';
1515

1616
/**
1717
* The type of SemVer range specifier that is prepended to the version
@@ -95,11 +95,11 @@ export interface IUpdateProjectOptions {
9595
*/
9696
export class PackageJsonUpdater {
9797
private _rushConfiguration: RushConfiguration;
98-
private _rushGlobalFolders: RushGlobalFolders;
98+
private _rushGlobalFolder: RushGlobalFolder;
9999

100-
public constructor(rushConfiguration: RushConfiguration, rushGlobalFolders: RushGlobalFolders) {
100+
public constructor(rushConfiguration: RushConfiguration, rushGlobalFolder: RushGlobalFolder) {
101101
this._rushConfiguration = rushConfiguration;
102-
this._rushGlobalFolders = rushGlobalFolders;
102+
this._rushGlobalFolder = rushGlobalFolder;
103103
}
104104

105105
/**
@@ -185,7 +185,7 @@ export class PackageJsonUpdater {
185185
return Promise.resolve();
186186
}
187187

188-
const purgeManager: PurgeManager = new PurgeManager(this._rushConfiguration, this._rushGlobalFolders);
188+
const purgeManager: PurgeManager = new PurgeManager(this._rushConfiguration, this._rushGlobalFolder);
189189
const installManagerOptions: IInstallManagerOptions = {
190190
debug: debugInstall,
191191
allowShrinkwrapUpdates: true,
@@ -199,7 +199,7 @@ export class PackageJsonUpdater {
199199
};
200200
const installManager: InstallManager = new InstallManager(
201201
this._rushConfiguration,
202-
this._rushGlobalFolders,
202+
this._rushGlobalFolder,
203203
purgeManager,
204204
installManagerOptions
205205
);

apps/rush-lib/src/logic/PurgeManager.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ import * as path from 'path';
77
import { AsyncRecycler } from '../utilities/AsyncRecycler';
88
import { RushConfiguration } from '../api/RushConfiguration';
99
import { RushConstants } from '../logic/RushConstants';
10-
import { RushGlobalFolders } from '../api/RushGlobalFolders';
10+
import { RushGlobalFolder } from '../api/RushGlobalFolder';
1111

1212
/**
1313
* This class implements the logic for "rush purge"
1414
*/
1515
export class PurgeManager {
1616
private _rushConfiguration: RushConfiguration;
17-
private _rushGlobalFolders: RushGlobalFolders;
17+
private _rushGlobalFolder: RushGlobalFolder;
1818
private _commonTempFolderRecycler: AsyncRecycler;
1919
private _rushUserFolderRecycler: AsyncRecycler;
2020

21-
public constructor(rushConfiguration: RushConfiguration, rushGlobalFolders: RushGlobalFolders) {
21+
public constructor(rushConfiguration: RushConfiguration, rushGlobalFolder: RushGlobalFolder) {
2222
this._rushConfiguration = rushConfiguration;
23-
this._rushGlobalFolders = rushGlobalFolders;
23+
this._rushGlobalFolder = rushGlobalFolder;
2424

2525
const commonAsyncRecyclerPath: string = path.join(
2626
this._rushConfiguration.commonTempFolder,
@@ -29,7 +29,7 @@ export class PurgeManager {
2929
this._commonTempFolderRecycler = new AsyncRecycler(commonAsyncRecyclerPath);
3030

3131
const rushUserAsyncRecyclerPath: string = path.join(
32-
this._rushGlobalFolders.rushGlobalFolder,
32+
this._rushGlobalFolder.path,
3333
RushConstants.rushRecyclerFolderName
3434
);
3535
this._rushUserFolderRecycler = new AsyncRecycler(rushUserAsyncRecyclerPath);
@@ -67,9 +67,9 @@ export class PurgeManager {
6767
this.purgeNormal();
6868

6969
// Also delete everything under ~/.rush/node-v4.5.6/ except for the recycler folder itself
70-
console.log('Purging ' + this._rushGlobalFolders.rushNodeSpecificGlobalFolder);
71-
this._rushUserFolderRecycler.moveAllItemsInFolder(this._rushGlobalFolders.rushNodeSpecificGlobalFolder,
72-
this._getMembersToExclude(this._rushGlobalFolders.rushNodeSpecificGlobalFolder));
70+
console.log('Purging ' + this._rushGlobalFolder.nodeSpecificPath);
71+
this._rushUserFolderRecycler.moveAllItemsInFolder(this._rushGlobalFolder.nodeSpecificPath,
72+
this._getMembersToExclude(this._rushGlobalFolder.nodeSpecificPath));
7373
}
7474

7575
private _getMembersToExclude(folderToRecycle: string): string[] {

0 commit comments

Comments
 (0)