Skip to content

Commit

Permalink
feat: remove writeNameForAndroidStudio not needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
ath0mas committed Apr 17, 2021
1 parent 380bdcc commit 09cef1d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 36 deletions.
15 changes: 0 additions & 15 deletions bin/lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ exports.copyScripts = copyScripts;
exports.copyBuildRules = copyBuildRules;
exports.writeProjectProperties = writeProjectProperties;
exports.prepBuildFiles = prepBuildFiles;
exports.writeNameForAndroidStudio = writeNameForAndroidStudio;

function getFrameworkDir (projectPath, shared) {
return shared ? path.join(ROOT, 'framework') : path.join(projectPath, 'CordovaLib');
Expand Down Expand Up @@ -201,19 +200,6 @@ function validateProjectName (project_name) {
return Promise.resolve();
}

/**
* Write the name of the app in "platforms/android/.idea/.name" so that Android Studio can show that name in the
* project listing. This is helpful to quickly look in the Android Studio listing if there are so many projects in
* Android Studio.
*
* https://github.com/apache/cordova-android/issues/1172
*/
function writeNameForAndroidStudio (project_path, project_name) {
const ideaPath = path.join(project_path, '.idea');
fs.ensureDirSync(ideaPath);
fs.writeFileSync(path.join(ideaPath, '.name'), project_name);
}

/**
* Creates an android application with the given options.
*
Expand Down Expand Up @@ -311,7 +297,6 @@ exports.create = function (project_path, config, options, events) {
// Link it to local android install.
exports.writeProjectProperties(project_path, target_api);
exports.prepBuildFiles(project_path, project_name);
exports.writeNameForAndroidStudio(project_path, project_name);
events.emit('log', generateDoneMessage('create', options.link));
}).then(() => project_path);
};
Expand Down
21 changes: 0 additions & 21 deletions spec/unit/create.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ describe('create', function () {
spyOn(create, 'copyBuildRules');
spyOn(create, 'writeProjectProperties');
spyOn(create, 'prepBuildFiles');
spyOn(create, 'writeNameForAndroidStudio');
revert_manifest_mock = create.__set__('AndroidManifest', Manifest_mock);
spyOn(fs, 'existsSync').and.returnValue(false);
spyOn(fs, 'copySync');
Expand Down Expand Up @@ -302,24 +301,4 @@ describe('create', function () {
});
});
});

describe('writeNameForAndroidStudio', () => {
const project_path = path.join('some', 'path');
const appName = 'Test Cordova';

beforeEach(function () {
spyOn(fs, 'ensureDirSync');
spyOn(fs, 'writeFileSync');
});

it('should call ensureDirSync with path', () => {
create.writeNameForAndroidStudio(project_path, appName);
expect(fs.ensureDirSync).toHaveBeenCalledWith(path.join(project_path, '.idea'));
});

it('should call writeFileSync with content', () => {
create.writeNameForAndroidStudio(project_path, appName);
expect(fs.writeFileSync).toHaveBeenCalledWith(path.join(project_path, '.idea', '.name'), appName);
});
});
});

0 comments on commit 09cef1d

Please sign in to comment.