{"action":"created","comment":{"url":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/comments/188225266","pull_request_review_id":120156619,"id":188225266,"diff_hunk":"@@ -1,32 +1,148 @@\n #!/usr/bin/env node\n \n const chalk = require('chalk');\n-const spawn = require('child_process').spawn;\n+const spawnSync = require('child_process').spawnSync;\n+const os = require('os');\n+const fs = require('fs');\n+const path = require('path');\n \n-let args = process.argv.slice(2);\n+const initURL = 'https://github.com/IBM-Swift/generator-swiftserver-projects'\n+const initBranch = 'init'\n \n-let options = ['-p', 'yo@1', '-p', 'generator-swiftserver', '--', 'yo', 'swiftserver'];\n+let args = process.argv.slice(2);\n \n if (args.length > 0) {\n     if (args.indexOf('--help') > -1) {\n         printHelp();\n         process.exit(0);\n     }\n+}\n+\n+let currentDirPath = path.resolve(\"./\");\n+let currentDir = path.basename(currentDirPath);\n+// Replace spaces with hyphens so Xcode project will build.\n+let projName = currentDir.replace(/ /g,\"-\");\n \n-    // Add on the arguments\n-    options.push(args);\n+if (projName.charAt(0) === '.') {\n+    console.error(chalk.red('Application name cannot start with .: %s'));","path":"kitura-init.js","position":32,"original_position":32,"commit_id":"f61ff29f82f12d2108a715bbb5027025283b3473","original_commit_id":"f61ff29f82f12d2108a715bbb5027025283b3473","user":{"login":"ianpartridge","id":1423497,"avatar_url":"https://avatars3.githubusercontent.com/u/1423497?v=4","gravatar_id":"","url":"https://api.github.com/users/ianpartridge","html_url":"https://github.com/ianpartridge","followers_url":"https://api.github.com/users/ianpartridge/followers","following_url":"https://api.github.com/users/ianpartridge/following{/other_user}","gists_url":"https://api.github.com/users/ianpartridge/gists{/gist_id}","starred_url":"https://api.github.com/users/ianpartridge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianpartridge/subscriptions","organizations_url":"https://api.github.com/users/ianpartridge/orgs","repos_url":"https://api.github.com/users/ianpartridge/repos","events_url":"https://api.github.com/users/ianpartridge/events{/privacy}","received_events_url":"https://api.github.com/users/ianpartridge/received_events","type":"User","site_admin":false},"body":"Shouldn't we exit in this case?","created_at":"2018-05-15T09:40:28Z","updated_at":"2018-05-15T09:47:26Z","html_url":"https://github.com/IBM-Swift/kitura-cli/pull/28#discussion_r188225266","pull_request_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/28","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/comments/188225266"},"html":{"href":"https://github.com/IBM-Swift/kitura-cli/pull/28#discussion_r188225266"},"pull_request":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/28","id":185400305,"html_url":"https://github.com/IBM-Swift/kitura-cli/pull/28","diff_url":"https://github.com/IBM-Swift/kitura-cli/pull/28.diff","patch_url":"https://github.com/IBM-Swift/kitura-cli/pull/28.patch","issue_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues/28","number":28,"state":"open","locked":false,"title":"Update kitura init to clone instead of running generator","user":{"login":"alexwishart","id":15833622,"avatar_url":"https://avatars2.githubusercontent.com/u/15833622?v=4","gravatar_id":"","url":"https://api.github.com/users/alexwishart","html_url":"https://github.com/alexwishart","followers_url":"https://api.github.com/users/alexwishart/followers","following_url":"https://api.github.com/users/alexwishart/following{/other_user}","gists_url":"https://api.github.com/users/alexwishart/gists{/gist_id}","starred_url":"https://api.github.com/users/alexwishart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexwishart/subscriptions","organizations_url":"https://api.github.com/users/alexwishart/orgs","repos_url":"https://api.github.com/users/alexwishart/repos","events_url":"https://api.github.com/users/alexwishart/events{/privacy}","received_events_url":"https://api.github.com/users/alexwishart/received_events","type":"User","site_admin":false},"body":"Will now clone from repo instead of running generator, which should hopefully speed up creating a project. \r\nFunction stays the same, but output from running command will change and will look like the following (with success messages highlighted in green):\r\n``` bash\r\nawishart$ kitura init\r\nCreating project...\r\nProject created successfully.\r\nRunning `swift build -Xlinker -lc++` to build project...\r\nProject built successfully.\r\nNext steps:\r\n\r\nGenerate your Xcode project:\r\n   $ swift package generate-xcodeproj\r\n\r\nOr, run your app from the terminal:\r\n   $ .build/debug/init-init-init\r\n```","created_at":"2018-05-02T10:44:44Z","updated_at":"2018-05-15T09:47:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0b9c572e2175d07daeb9c6eb43d8291bfbdc4c59","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/28/commits","review_comments_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/28/comments","review_comment_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues/28/comments","statuses_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/statuses/f61ff29f82f12d2108a715bbb5027025283b3473","head":{"label":"IBM-Swift:update-init","ref":"update-init","sha":"f61ff29f82f12d2108a715bbb5027025283b3473","user":{"login":"IBM-Swift","id":16882981,"avatar_url":"https://avatars3.githubusercontent.com/u/16882981?v=4","gravatar_id":"","url":"https://api.github.com/users/IBM-Swift","html_url":"https://github.com/IBM-Swift","followers_url":"https://api.github.com/users/IBM-Swift/followers","following_url":"https://api.github.com/users/IBM-Swift/following{/other_user}","gists_url":"https://api.github.com/users/IBM-Swift/gists{/gist_id}","starred_url":"https://api.github.com/users/IBM-Swift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IBM-Swift/subscriptions","organizations_url":"https://api.github.com/users/IBM-Swift/orgs","repos_url":"https://api.github.com/users/IBM-Swift/repos","events_url":"https://api.github.com/users/IBM-Swift/events{/privacy}","received_events_url":"https://api.github.com/users/IBM-Swift/received_events","type":"Organization","site_admin":false},"repo":{"id":107526939,"name":"kitura-cli","full_name":"IBM-Swift/kitura-cli","owner":{"login":"IBM-Swift","id":16882981,"avatar_url":"https://avatars3.githubusercontent.com/u/16882981?v=4","gravatar_id":"","url":"https://api.github.com/users/IBM-Swift","html_url":"https://github.com/IBM-Swift","followers_url":"https://api.github.com/users/IBM-Swift/followers","following_url":"https://api.github.com/users/IBM-Swift/following{/other_user}","gists_url":"https://api.github.com/users/IBM-Swift/gists{/gist_id}","starred_url":"https://api.github.com/users/IBM-Swift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IBM-Swift/subscriptions","organizations_url":"https://api.github.com/users/IBM-Swift/orgs","repos_url":"https://api.github.com/users/IBM-Swift/repos","events_url":"https://api.github.com/users/IBM-Swift/events{/privacy}","received_events_url":"https://api.github.com/users/IBM-Swift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IBM-Swift/kitura-cli","description":"⌨️ Kitura command-line interface","fork":false,"url":"https://api.github.com/repos/IBM-Swift/kitura-cli","forks_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/forks","keys_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/teams","hooks_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/hooks","issue_events_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues/events{/number}","events_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/events","assignees_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/assignees{/user}","branches_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/branches{/branch}","tags_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/tags","blobs_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/languages","stargazers_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/stargazers","contributors_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/contributors","subscribers_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/subscribers","subscription_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/subscription","commits_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/contents/{+path}","compare_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/merges","archive_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/downloads","issues_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues{/number}","pulls_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/labels{/name}","releases_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/releases{/id}","deployments_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/deployments","created_at":"2017-10-19T09:35:31Z","updated_at":"2018-05-10T13:07:09Z","pushed_at":"2018-05-14T15:40:42Z","git_url":"git://github.com/IBM-Swift/kitura-cli.git","ssh_url":"git@github.com:IBM-Swift/kitura-cli.git","clone_url":"https://github.com/IBM-Swift/kitura-cli.git","svn_url":"https://github.com/IBM-Swift/kitura-cli","homepage":"http://www.kitura.io/","size":37,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2,"open_issues":2,"watchers":3,"default_branch":"master"}},"base":{"label":"IBM-Swift:master","ref":"master","sha":"ce6338ef660395a90c5cabb36e7ac5c40363d4ed","user":{"login":"IBM-Swift","id":16882981,"avatar_url":"https://avatars3.githubusercontent.com/u/16882981?v=4","gravatar_id":"","url":"https://api.github.com/users/IBM-Swift","html_url":"https://github.com/IBM-Swift","followers_url":"https://api.github.com/users/IBM-Swift/followers","following_url":"https://api.github.com/users/IBM-Swift/following{/other_user}","gists_url":"https://api.github.com/users/IBM-Swift/gists{/gist_id}","starred_url":"https://api.github.com/users/IBM-Swift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IBM-Swift/subscriptions","organizations_url":"https://api.github.com/users/IBM-Swift/orgs","repos_url":"https://api.github.com/users/IBM-Swift/repos","events_url":"https://api.github.com/users/IBM-Swift/events{/privacy}","received_events_url":"https://api.github.com/users/IBM-Swift/received_events","type":"Organization","site_admin":false},"repo":{"id":107526939,"name":"kitura-cli","full_name":"IBM-Swift/kitura-cli","owner":{"login":"IBM-Swift","id":16882981,"avatar_url":"https://avatars3.githubusercontent.com/u/16882981?v=4","gravatar_id":"","url":"https://api.github.com/users/IBM-Swift","html_url":"https://github.com/IBM-Swift","followers_url":"https://api.github.com/users/IBM-Swift/followers","following_url":"https://api.github.com/users/IBM-Swift/following{/other_user}","gists_url":"https://api.github.com/users/IBM-Swift/gists{/gist_id}","starred_url":"https://api.github.com/users/IBM-Swift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IBM-Swift/subscriptions","organizations_url":"https://api.github.com/users/IBM-Swift/orgs","repos_url":"https://api.github.com/users/IBM-Swift/repos","events_url":"https://api.github.com/users/IBM-Swift/events{/privacy}","received_events_url":"https://api.github.com/users/IBM-Swift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IBM-Swift/kitura-cli","description":"⌨️ Kitura command-line interface","fork":false,"url":"https://api.github.com/repos/IBM-Swift/kitura-cli","forks_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/forks","keys_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/teams","hooks_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/hooks","issue_events_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues/events{/number}","events_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/events","assignees_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/assignees{/user}","branches_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/branches{/branch}","tags_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/tags","blobs_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/refs{/sha}","trees_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/statuses/{sha}","languages_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/languages","stargazers_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/stargazers","contributors_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/contributors","subscribers_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/subscribers","subscription_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/subscription","commits_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/commits{/sha}","git_commits_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/git/commits{/sha}","comments_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/comments{/number}","issue_comment_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues/comments{/number}","contents_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/contents/{+path}","compare_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/merges","archive_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/downloads","issues_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues{/number}","pulls_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls{/number}","milestones_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/milestones{/number}","notifications_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/labels{/name}","releases_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/releases{/id}","deployments_url":"https://api.github.com/repos/IBM-Swift/kitura-cli/deployments","created_at":"2017-10-19T09:35:31Z","updated_at":"2018-05-10T13:07:09Z","pushed_at":"2018-05-14T15:40:42Z","git_url":"git://github.com/IBM-Swift/kitura-cli.git","ssh_url":"git@github.com:IBM-Swift/kitura-cli.git","clone_url":"https://github.com/IBM-Swift/kitura-cli.git","svn_url":"https://github.com/IBM-Swift/kitura-cli","homepage":"http://www.kitura.io/","size":37,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/28"},"html":{"href":"https://github.com/IBM-Swift/kitura-cli/pull/28"},"issue":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues/28"},"comments":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/IBM-Swift/kitura-cli/statuses/f61ff29f82f12d2108a715bbb5027025283b3473"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ianpartridge"}}