8
0
Pārlūkot izejas kodu

Removed dev-plugin-install tasks. Now using dev-install --plugin.

Szymon Kupś 10 gadi atpakaļ
vecāks
revīzija
c5061dc3b1
3 mainītis faili ar 0 papildinājumiem un 110 dzēšanām
  1. 0 8
      dev/tasks/dev.js
  2. 0 70
      dev/tasks/utils/dev-plugin-install.js
  3. 0 32
      dev/tests/dev-tasks.js

+ 0 - 8
dev/tasks/dev.js

@@ -7,7 +7,6 @@
 
 
 const initTask = require( './utils/dev-init' );
 const initTask = require( './utils/dev-init' );
 const pluginCreateTask = require( './utils/dev-plugin-create' );
 const pluginCreateTask = require( './utils/dev-plugin-create' );
-const pluginInstallTask = require( './utils/dev-plugin-install' );
 const pluginUpdateTask = require( './utils/dev-update' );
 const pluginUpdateTask = require( './utils/dev-update' );
 const pluginStatusTask = require( './utils/dev-status' );
 const pluginStatusTask = require( './utils/dev-status' );
 const installTask = require( './utils/dev-install' );
 const installTask = require( './utils/dev-install' );
@@ -30,13 +29,6 @@ module.exports = ( grunt ) => {
 			.catch( ( error )  => done( error ) );
 			.catch( ( error )  => done( error ) );
 	} );
 	} );
 
 
-	grunt.registerTask( 'dev-plugin-install', function() {
-		const done = this.async();
-		pluginInstallTask( ckeditor5Path, workspaceRoot, grunt.log.writeln )
-			.then( done )
-			.catch( ( error )  => done( error ) );
-	} );
-
 	grunt.registerTask( 'dev-update', function() {
 	grunt.registerTask( 'dev-update', function() {
 		pluginUpdateTask( ckeditor5Path, packageJSON, workspaceRoot, grunt.log.writeln, grunt.log.error );
 		pluginUpdateTask( ckeditor5Path, packageJSON, workspaceRoot, grunt.log.writeln, grunt.log.error );
 	} );
 	} );

+ 0 - 70
dev/tasks/utils/dev-plugin-install.js

@@ -1,70 +0,0 @@
-/**
- * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
-
-'use strict';
-
-const inquiries = require( './inquiries' );
-const git = require( './git' );
-const tools = require( './tools' );
-const path = require( 'path' );
-
-/**
- * 1. Ask for plugin name.
- * 2. Ask for GitHub URL.
- * 3. Clone repository from provided GitHub URL.
- * 4. Checkout repository to provided branch (or master if no branch is provided).
- * 5. Update package.json file in CKEditor5 repository.
- * 6. Link new plugin.
- * 7. Call `npm install` in plugin repository.
- * 8. Install Git hooks in plugin repository.
- *
- * @param {String} ckeditor5Path Path to main CKEditor5 repository.
- * @param {String} workspaceRoot Relative path to workspace root.
- * @param {Function} writeln Function for log output.
- * @returns {Promise} Returns promise fulfilled after task is done.
- */
-module.exports = ( ckeditor5Path, workspaceRoot, writeln ) => {
-	const workspaceAbsolutePath = path.join( ckeditor5Path, workspaceRoot );
-	let pluginName;
-	let repositoryPath;
-	let gitHubUrl;
-
-	return inquiries.getPluginName()
-		.then( result => {
-			pluginName = result;
-			repositoryPath = path.join( workspaceAbsolutePath, pluginName );
-
-			return inquiries.getPluginGitHubUrl( pluginName );
-		} )
-		.then( result => {
-			gitHubUrl = result;
-			let urlInfo = git.parseRepositoryUrl( gitHubUrl );
-
-			writeln( `Clonning ${ gitHubUrl }...` );
-			git.cloneRepository( urlInfo, workspaceAbsolutePath );
-
-			writeln( `Checking out ${ gitHubUrl } to ${ urlInfo.branch }...` );
-			git.checkout( repositoryPath, urlInfo.branch );
-
-			writeln( `Updating package.json files...` );
-			tools.updateJSONFile( path.join( ckeditor5Path, 'package.json' ), ( json ) => {
-				if ( !json.dependencies ) {
-					json.dependencies = {};
-				}
-				json.dependencies[ pluginName ] = gitHubUrl;
-
-				return json;
-			} );
-
-			writeln( `Linking ${ pluginName } to node_modules...` );
-			tools.linkDirectories( repositoryPath, path.join( ckeditor5Path, 'node_modules', pluginName ) );
-
-			writeln( `Running npm install in ${ pluginName }.` );
-			tools.npmInstall( repositoryPath );
-
-			writeln( `Installing GIT hooks in ${ pluginName }.` );
-			tools.installGitHooks( repositoryPath );
-		} );
-};

+ 0 - 32
dev/tests/dev-tasks.js

@@ -22,7 +22,6 @@ describe( 'dev-tasks', () => {
 	const workspaceRoot = '..';
 	const workspaceRoot = '..';
 	const workspacePath = path.join( mainRepositoryPath, workspaceRoot );
 	const workspacePath = path.join( mainRepositoryPath, workspaceRoot );
 	const pluginName = 'plugin-name';
 	const pluginName = 'plugin-name';
-	const repositoryPath = path.join( workspacePath, pluginName );
 	const pluginVersion = '0.0.1';
 	const pluginVersion = '0.0.1';
 	const gitHubUrl = 'ckeditor5/plugin-name';
 	const gitHubUrl = 'ckeditor5/plugin-name';
 
 
@@ -90,37 +89,6 @@ describe( 'dev-tasks', () => {
 		} );
 		} );
 	} );
 	} );
 
 
-	describe( 'dev-plugin-install', () => {
-		const pluginInstallTask = require( '../tasks/utils/dev-plugin-install' );
-
-		it( 'should exist', () => expect( pluginInstallTask ).to.be.a( 'function' ) );
-
-		it( 'should install a plugin', () => {
-			return pluginInstallTask( mainRepositoryPath, workspaceRoot, emptyFn ).then( () => {
-				expect( spies.getPluginName.calledOnce ).to.equal( true );
-				expect( spies.getPluginGitHubUrl.calledOnce ).to.equal( true );
-				expect( spies.parseRepositoryUrl.calledOnce ).to.equal( true );
-				const urlInfo = spies.parseRepositoryUrl.firstCall.returnValue;
-				expect( spies.parseRepositoryUrl.firstCall.args[ 0 ] ).to.equal( gitHubUrl );
-				expect( spies.cloneRepository.calledOnce ).to.equal( true );
-				expect( spies.cloneRepository.firstCall.args[ 0 ] ).to.equal( urlInfo );
-				expect( spies.cloneRepository.firstCall.args[ 1 ] ).to.equal( workspacePath );
-				expect( spies.checkout.calledOnce ).to.equal( true );
-				expect( spies.checkout.firstCall.args[ 0 ] ).to.equal( repositoryPath );
-				expect( spies.checkout.firstCall.args[ 1 ] ).to.equal( urlInfo.branch );
-				expect( spies.updateJSONFile.calledOnce ).to.equal( true );
-				expect( spies.updateJSONFile.firstCall.args[ 0 ] ).to.equal( path.join( mainRepositoryPath, 'package.json' ) );
-				expect( spies.linkDirectories.calledOnce ).to.equal( true );
-				expect( spies.linkDirectories.firstCall.args[ 0 ] ).to.equal( repositoryPath );
-				expect( spies.linkDirectories.firstCall.args[ 1 ] ).to.equal( path.join( mainRepositoryPath, 'node_modules', pluginName ) );
-				expect( spies.npmInstall.calledOnce ).to.equal( true );
-				expect( spies.npmInstall.firstCall.args[ 0 ] ).to.equal( repositoryPath );
-				expect( spies.installGitHooks.calledOnce ).to.equal( true );
-				expect( spies.installGitHooks.firstCall.args[ 0 ] ).to.equal( repositoryPath );
-			} );
-		} );
-	} );
-
 	describe( 'dev-relink', () => {
 	describe( 'dev-relink', () => {
 		const devRelinkTask = require( '../tasks/utils/dev-relink' );
 		const devRelinkTask = require( '../tasks/utils/dev-relink' );