{"action":"created","issue":{"url":"https://api.github.com/repos/Icenium/icenium-cli/issues/652","labels_url":"https://api.github.com/repos/Icenium/icenium-cli/issues/652/labels{/name}","comments_url":"https://api.github.com/repos/Icenium/icenium-cli/issues/652/comments","events_url":"https://api.github.com/repos/Icenium/icenium-cli/issues/652/events","html_url":"https://github.com/Icenium/icenium-cli/pull/652","id":53751612,"number":652,"title":"Init command to determine project type","user":{"login":"rosen-vladimirov","id":8351653,"avatar_url":"https://avatars.githubusercontent.com/u/8351653?v=3","gravatar_id":"","url":"https://api.github.com/users/rosen-vladimirov","html_url":"https://github.com/rosen-vladimirov","followers_url":"https://api.github.com/users/rosen-vladimirov/followers","following_url":"https://api.github.com/users/rosen-vladimirov/following{/other_user}","gists_url":"https://api.github.com/users/rosen-vladimirov/gists{/gist_id}","starred_url":"https://api.github.com/users/rosen-vladimirov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rosen-vladimirov/subscriptions","organizations_url":"https://api.github.com/users/rosen-vladimirov/orgs","repos_url":"https://api.github.com/users/rosen-vladimirov/repos","events_url":"https://api.github.com/users/rosen-vladimirov/events{/privacy}","received_events_url":"https://api.github.com/users/rosen-vladimirov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-08T13:44:36Z","updated_at":"2015-01-08T14:31:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Icenium/icenium-cli/pulls/652","html_url":"https://github.com/Icenium/icenium-cli/pull/652","diff_url":"https://github.com/Icenium/icenium-cli/pull/652.diff","patch_url":"https://github.com/Icenium/icenium-cli/pull/652.patch"},"body":"Add init|*unknown command which can be used to automatically determine project type.\r\nAdd logic to determine project type when executing appbuilder init based on the files in the directory:\r\n - NativeScript project must contain tns_modules dir and app/bootstrap.js file.\r\n - Hybrid project must contain cordova.ios.js, cordova.android.js and cordova.wp8.js\r\n - Mobile Website project must contain index.html\r\n\r\nAdditional logic:\r\n - NativeScript project cannot contain index.html or cordova.*.js files or index.html.\r\n - Hybrid project and Mobile Website projects cannot contain tns_modules dir and app\\bootstrap.js file.\r\n\r\nIf we are unable to determine project type, error message is shown and command's help is printed.\r\nAdd logic to check if the directory contains files from other project types when calling appbuilder init <command>. For example if you are in NativeScript project folder and you execute appbuilder init hybrid, we create .abproject, which is incorrect.\r\nImprove init help - add init|website help.\r\n\r\nhttp://teampulse.telerik.com/view#item/269498"},"comment":{"url":"https://api.github.com/repos/Icenium/icenium-cli/issues/comments/69186057","html_url":"https://github.com/Icenium/icenium-cli/pull/652#issuecomment-69186057","issue_url":"https://api.github.com/repos/Icenium/icenium-cli/issues/652","id":69186057,"user":{"login":"Fatme","id":760518,"avatar_url":"https://avatars.githubusercontent.com/u/760518?v=3","gravatar_id":"","url":"https://api.github.com/users/Fatme","html_url":"https://github.com/Fatme","followers_url":"https://api.github.com/users/Fatme/followers","following_url":"https://api.github.com/users/Fatme/following{/other_user}","gists_url":"https://api.github.com/users/Fatme/gists{/gist_id}","starred_url":"https://api.github.com/users/Fatme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fatme/subscriptions","organizations_url":"https://api.github.com/users/Fatme/orgs","repos_url":"https://api.github.com/users/Fatme/repos","events_url":"https://api.github.com/users/Fatme/events{/privacy}","received_events_url":"https://api.github.com/users/Fatme/received_events","type":"User","site_admin":false},"created_at":"2015-01-08T14:31:27Z","updated_at":"2015-01-08T14:31:27Z","body":"I suggest you to extract a hash object like {\r\n  hybrid: {\r\n\tprojectSpecificFiles: [{name: index.html, type: file}, ...] \r\n        nonProjectSpecificFiles: [{name: tnsModules, type: dir}, ...]\r\n  }, \r\n  native: {\r\n  }\r\n}, then you can create a base function `isProjectType(projectType: string) {\r\n   var projectData = hash[projectType];\r\n   _.each(projectData.nonProjectSpecificFiles, (file) => {\r\n\tthis.$logger.trace(\"Found %s %s, so this is not a %s project.\", file.name, file.type projectType);\r\n   });\r\n  _.each(projectData.projectSpecificFiles, (file) => {\r\n      this.$logger.trace(\"Missing %s %s, so this is not a %s project.\", file.name, file.type, projectType);\r\n  });\r\n  ....\r\n}` "}}