Skip to content

Commit 34aceac

Browse files
committed
Fixes for issues #110 and #111
1 parent 6e88c4c commit 34aceac

3 files changed

Lines changed: 31 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,5 @@ See [Developing plug-ins](https://github.com/adaptlearning/adapt_framework/wiki/
258258
<div float align=right><a href="#top">Back to Top</a></div>
259259

260260
----------------------------
261-
**Version number:** 2.1.4 <a href="https://community.adaptlearning.org/" target="_blank"><img src="https://github.com/adaptlearning/documentation/blob/master/04_wiki_assets/plug-ins/images/adapt-logo-mrgn-lft.jpg" alt="adapt learning logo" align="right"></a>
261+
**Version number:** 2.1.7 <a href="https://community.adaptlearning.org/" target="_blank"><img src="https://github.com/adaptlearning/documentation/blob/master/04_wiki_assets/plug-ins/images/adapt-logo-mrgn-lft.jpg" alt="adapt learning logo" align="right"></a>
262262
**Author / maintainer:** Adapt Core Team with [contributors](https://github.com/adaptlearning/adapt-contrib-hotgraphic/graphs/contributors)

lib/commands/register.js

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ var bower = require('bower'),
99
JsonWriter = require('../JsonWriter'),
1010
Project = require('../Project'),
1111
Plugin = require('../Plugin');
12+
semver = require('semver');
1213

1314
module.exports = {
1415
register: function (renderer) {
1516
var done = arguments[arguments.length-1] || function () {};
1617

1718
renderer.log(chalk.yellow('This will publish this plugin to', Constants.Registry));
1819

20+
var c = semver.coerce('>=2.2')
21+
console.log(c);
22+
console.log(semver.valid(c));
23+
1924
loadPluginProperties('./bower.json', {
2025
name: undefined,
2126
repository: undefined,
@@ -110,16 +115,29 @@ function confirm(properties) {
110115
default: plugin.toString() || 'not specified',
111116
required: true
112117
},
113-
repository: {
114-
description: chalk.cyan('repository'),
115-
pattern: /([A-Za-z0-9]+@|http(|s)|git\:\/\/)([A-Za-z0-9.]+)(:|\/)([A-Za-z0-9\-\.\/]+)(\.git)?/,
118+
repositoryType: {
119+
description: chalk.cyan('repository type (e.g. git)'),
120+
message: 'Please provide a repository type',
121+
pattern: /.+/,
122+
type: 'string',
123+
default: properties.repository ? properties.repository.type : undefined,
124+
required: true
125+
},
126+
repositoryUrl: {
127+
description: chalk.cyan('repository URL'),
128+
message: 'Please provide a repository URL of the form [git@][<protocol>]<domain><path>.git',
129+
pattern: /((git|ssh|http(s)?)|(git@[\w\.]+))(:(\/\/)?)([\w\.@\:/\-~]+)(\.git)(\/)?/,
116130
type: 'string',
117-
default: properties.repository || 'not specified',
131+
default: properties.repository ? properties.repository.url : undefined,
118132
required: true
119133
},
120134
framework: {
121135
description: chalk.cyan('framework'),
122-
pattern: /\bv?(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?\b/ig,
136+
message: 'Please provide a valid semver (see https://semver.org/)',
137+
conform:function(v) {
138+
return semver.valid(semver.coerce(v));
139+
},
140+
errors:['fooble'],
123141
type: 'string',
124142
default: properties.framework || '~2.0.0',
125143
required: false
@@ -143,8 +161,13 @@ function confirm(properties) {
143161
if(!confirmation.ready) deferred.reject(new Error('Aborted. Nothing has been registered.'));
144162

145163
properties.name = confirmation.name;
146-
properties.repository = confirmation.repository;
164+
165+
if (confirmation.repositoryType && confirmation.repositoryUrl) {
166+
properties.repository = {type:confirmation.repositoryType, url:confirmation.repositoryUrl};
167+
}
168+
147169
properties.framework = confirmation.framework;
170+
148171
deferred.resolve(properties);
149172
});
150173
return deferred.promise;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "adapt-cli",
3-
"version": "2.1.6",
3+
"version": "2.1.7",
44
"description": "Command line tools for Adapt",
55
"main": "./lib/cli.js",
66
"directories": {

0 commit comments

Comments
 (0)