Skip to content

Commit 6322376

Browse files
committed
fix(start): ensure that folders can be created even if they are numeric.
1 parent 3f87bfb commit 6322376

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/ionic/start.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ function run(ionic, argv) {
6666
return log.error('Please name your Ionic project something meaningful other than \'.\''.red);
6767
}
6868

69+
// Ensure that the folder name provided is a String
70+
// ie 5 becomes '5' AND '5' stays as '5'
71+
argv._[1] = argv._[1].toString();
72+
6973
var promptPromise;
7074
var options = appLibUtils.preprocessCliOptions(argv);
7175
var startingApp = true;

spec/tasks/start.spec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,24 @@ describe('start command', function() {
157157
});
158158

159159

160+
it('should treat all numerically named folders and strings not integers', function(done) {
161+
var processArguments = ['node', 'ionic', 'start', '5887'];
162+
var rawCliArguments = processArguments.slice(2);
163+
var argv = optimist(rawCliArguments).argv;
164+
165+
spyOn(fs, 'existsSync').andReturn(false);
166+
spyOn(appLibUtils, 'preprocessCliOptions').andCallThrough();
167+
spyOn(Start, 'promptForOverwrite');
168+
spyOn(Start, 'startApp').andReturn(Q(true));
169+
spyOn(Start, 'printQuickHelp').andReturn(Q(true));
170+
spyOn(Start, 'promptLogin').andReturn(Q(true));
171+
172+
start.run({}, argv).then(function() {
173+
expect(appLibUtils.preprocessCliOptions.calls[0].args[0]._[1]).toEqual('5887');
174+
done();
175+
});
176+
});
177+
160178
it('should print a getting started message with v2 projects', function(done) {
161179
var processArguments = ['node', 'ionic', 'start', 'newDir', '--v2'];
162180
var rawCliArguments = processArguments.slice(2);

0 commit comments

Comments
 (0)