Skip to content

Convert to ES6 syntax #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions generators/app/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'
var generators = require('yeoman-generator')
var chalk = require('chalk')
var yosay = require('yosay')
var _ = require('underscore')
const generators = require('yeoman-generator')
const chalk = require('chalk')
const yosay = require('yosay')
const _ = require('underscore')

module.exports = generators.Base.extend({
constructor: function () {
Expand All @@ -19,12 +19,12 @@ module.exports = generators.Base.extend({

prompting: {
askFor: function () {
var done = this.async()
let done = this.async()

// Have Yeoman greet the user.
this.log(yosay('Welcome to the outstanding ' + chalk.red('swift.framework') + ' generator!'))

var prompts = [{
let prompts = [{
type: 'input',
name: 'projectName',
message: 'Project Name',
Expand All @@ -43,71 +43,71 @@ module.exports = generators.Base.extend({
store: true
}]

this.prompt(prompts, function (props) {
this.prompt(prompts, (props) => {
this.projectName = props.projectName
this.organizationName = props.organizationName
this.organizationId = props.organizationId

this.props = props

done()
}.bind(this))
})
},

askForCocoaPods: function () {
var done = this.async()
let done = this.async()

var prompts = [{
let prompts = [{
type: 'confirm',
name: 'cocoapods',
message: 'Would you like to distribute via CocoaPods?',
default: true
}]

this.prompt(prompts, function (props) {
this.prompt(prompts, (props) => {
this.cocoapods = props.cocoapods
done()
}.bind(this))
})
},

askForGitHub: function () {
var done = this.async()
let done = this.async()

var prompts = [{
let prompts = [{
type: 'input',
name: 'githubUser',
message: 'Would you mind telling me your username on GitHub?',
store: true
}]

this.prompt(prompts, function (props) {
this.prompt(prompts, (props) => {
this.githubUser = props.githubUser
this.props = _.extend(this.props, props)
done()
}.bind(this))
})
},

askForTravis: function () {
var done = this.async()
let done = this.async()

var prompts = [{
let prompts = [{
type: 'confirm',
name: 'travis',
message: 'Would you like to enable Travis CI?',
default: true
}]

this.prompt(prompts, function (props) {
this.prompt(prompts, (props) => {
this.travis = props.travis
done()
}.bind(this))
})
},

askForCertPath: function () {
var done = this.async()
var travis = this.travis
let done = this.async()
let travis = this.travis

var prompts = [{
let prompts = [{
type: 'confirm',
name: 'mobileprovision',
message: 'Would you like to provision Development Certificate',
Expand All @@ -118,10 +118,10 @@ module.exports = generators.Base.extend({
}
}]

this.prompt(prompts, function (props) {
this.prompt(prompts, (props) => {
this.mobileprovision = props.mobileprovision
done()
}.bind(this))
})
}
},

Expand Down
8 changes: 4 additions & 4 deletions generators/carthage/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var generators = require('yeoman-generator')
const generators = require('yeoman-generator')

module.exports = generators.Base.extend({
constructor: function () {
Expand All @@ -24,10 +24,10 @@ module.exports = generators.Base.extend({
return
}

var done = this.async()

this.log('Carthage bootstraping')
var child = this.spawnCommand('carthage', ['bootstrap'])

let done = this.async()
let child = this.spawnCommand('carthage', ['bootstrap'])
child.on('exit', done)
}
}
Expand Down
4 changes: 2 additions & 2 deletions generators/cocoapods/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var generators = require('yeoman-generator')
const generators = require('yeoman-generator')

module.exports = generators.Base.extend({
constructor: function () {
Expand All @@ -18,7 +18,7 @@ module.exports = generators.Base.extend({
},

initializing: function () {
var podspec = this.destinationPath(this.options.projectName + '.podspec')
let podspec = this.destinationPath(`${this.options.projectName}.podspec`)
this.fs.copyTpl(this.templatePath('PROJECT_NAME.podspec'), podspec, this.options)
}
})
2 changes: 1 addition & 1 deletion generators/contributing/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var generators = require('yeoman-generator')
const generators = require('yeoman-generator')

module.exports = generators.Base.extend({
constructor: function () {
Expand Down
2 changes: 1 addition & 1 deletion generators/gitignore/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var generators = require('yeoman-generator')
const generators = require('yeoman-generator')

module.exports = generators.Base.extend({
constructor: function () {
Expand Down
2 changes: 1 addition & 1 deletion generators/license/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var generators = require('yeoman-generator')
const generators = require('yeoman-generator')

module.exports = generators.Base.extend({
constructor: function () {
Expand Down
20 changes: 10 additions & 10 deletions generators/mobileprovision/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict'
var generators = require('yeoman-generator')
var path = require('path')
var fs = require('fs')
const generators = require('yeoman-generator')
const path = require('path')
const fs = require('fs')

var resolvePath = function (string) {
const resolvePath = function (string) {
if (string.substr(0, 1) === '~') {
string = process.env.HOME + string.substr(1)
}
Expand All @@ -22,9 +22,9 @@ module.exports = generators.Base.extend({
},
prompting: {
askForCertPath: function () {
var done = this.async()
let done = this.async()

var prompts = [{
let prompts = [{
type: 'input',
name: 'certPath',
message: 'Development Certificate Path',
Expand All @@ -36,10 +36,10 @@ module.exports = generators.Base.extend({
message: 'The certificate you provide does not exist, specify again?',
default: true,
when: function (answers) {
var done = this.async()
let done = this.async()

answers.certPath = resolvePath(answers.certPath)
fs.stat(answers.certPath, function (err, stats) {
fs.stat(answers.certPath, (err, stats) => {
if (err || !stats.isFile()) {
answers.certPath = null
}
Expand All @@ -48,14 +48,14 @@ module.exports = generators.Base.extend({
}
}]

this.prompt(prompts, function (props) {
this.prompt(prompts, (props) => {
if (props.askCertPathAgain) {
return this.prompting.askForCertPath.call(this)
}

this.certPath = props.certPath
done()
}.bind(this))
})
}
},

Expand Down
2 changes: 1 addition & 1 deletion generators/readme/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var generators = require('yeoman-generator')
const generators = require('yeoman-generator')

module.exports = generators.Base.extend({
constructor: function () {
Expand Down
2 changes: 1 addition & 1 deletion generators/script/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var generators = require('yeoman-generator')
const generators = require('yeoman-generator')

module.exports = generators.Base.extend({
constructor: function () {
Expand Down
2 changes: 1 addition & 1 deletion generators/travis/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
var generators = require('yeoman-generator')
const generators = require('yeoman-generator')

module.exports = generators.Base.extend({
constructor: function () {
Expand Down
14 changes: 7 additions & 7 deletions generators/xcode/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'
var generators = require('yeoman-generator')
var glob = require('glob')
const generators = require('yeoman-generator')
const glob = require('glob')

module.exports = generators.Base.extend({
constructor: function () {
Expand All @@ -25,28 +25,28 @@ module.exports = generators.Base.extend({

writing: {
xcode: function () {
var files = glob.sync('**/*', {
let files = glob.sync('**/*', {
cwd: this.templatePath('.'),
nodir: true
})

files.forEach(function (entry) {
var source = entry
files.forEach((entry) => {
let source = entry

// Handle file name
source = source.replace(/PROJECT_NAME/g, this.options.projectName)

this.fs.copyTpl(this.templatePath(entry), this.destinationPath(source), this.options)

// Handle .xcodeproj
var data = this.fs.read(this.destinationPath(source), 'utf8')
let data = this.fs.read(this.destinationPath(source), 'utf8')
data = data.replace(/ORGANIZATION-ID.PROJECT-NAME/g,
this.options.organizationId + '.' + this.options.projectName)
data = data.replace(/PROJECT_NAME/g, this.options.projectName)
data = data.replace(/ORGANIZATION_NAME/g, this.options.organizationName)
data = data.replace(/ORGANIZATION-ID/g, this.options.organizationId)
this.fs.write(this.destinationPath(source), data, 'utf8')
}.bind(this))
})
}

}
Expand Down