2015-10-20 16:53:54 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-08-04 11:50:22 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var chalk = require('chalk');
|
|
|
|
var path = require('path');
|
|
|
|
var yeoman = require('yeoman-generator');
|
|
|
|
|
|
|
|
module.exports = yeoman.generators.NamedBase.extend({
|
|
|
|
writing: function() {
|
|
|
|
var templateVars = {name: this.name};
|
|
|
|
// SomeApp/ios/SomeApp
|
|
|
|
this.fs.copyTpl(
|
|
|
|
this.templatePath(path.join('app', '**')),
|
|
|
|
this.destinationPath(path.join('ios', this.name)),
|
|
|
|
templateVars
|
|
|
|
);
|
|
|
|
|
|
|
|
// SomeApp/ios/SomeAppTests
|
|
|
|
this.fs.copyTpl(
|
|
|
|
this.templatePath(path.join('tests', 'Tests.m')),
|
|
|
|
this.destinationPath(path.join('ios', this.name + 'Tests', this.name + 'Tests.m')),
|
|
|
|
templateVars
|
|
|
|
);
|
|
|
|
this.fs.copy(
|
|
|
|
this.templatePath(path.join('tests', 'Info.plist')),
|
|
|
|
this.destinationPath(path.join('ios', this.name + 'Tests', 'Info.plist'))
|
|
|
|
);
|
|
|
|
|
|
|
|
// SomeApp/ios/SomeApp.xcodeproj
|
|
|
|
this.fs.copyTpl(
|
|
|
|
this.templatePath(path.join('xcodeproj', 'project.pbxproj')),
|
|
|
|
this.destinationPath(path.join('ios', this.name + '.xcodeproj', 'project.pbxproj')),
|
|
|
|
templateVars
|
|
|
|
);
|
|
|
|
this.fs.copyTpl(
|
|
|
|
this.templatePath(path.join('xcodeproj', 'xcshareddata', 'xcschemes', '_xcscheme')),
|
|
|
|
this.destinationPath(path.join('ios', this.name + '.xcodeproj', 'xcshareddata', 'xcschemes', this.name + '.xcscheme')),
|
|
|
|
templateVars
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
end: function() {
|
|
|
|
var projectPath = path.resolve(this.destinationRoot(), 'ios', this.name);
|
2015-09-14 14:35:58 +00:00
|
|
|
this.log(chalk.white.bold('To run your app on iOS:'));
|
2015-08-04 11:50:22 +00:00
|
|
|
this.log(chalk.white(' Open ' + projectPath + '.xcodeproj in Xcode'));
|
2015-11-03 12:02:49 +00:00
|
|
|
this.log(chalk.white(' Hit the Run button'));
|
2015-08-04 11:50:22 +00:00
|
|
|
}
|
|
|
|
});
|