{"action":"created","comment":{"url":"https://api.github.com/repos/yeoman/generator-polymer/pulls/comments/40758003","id":40758003,"diff_hunk":"@@ -0,0 +1,70 @@\n+\"use strict\";\n+var yeoman = require('yeoman-generator');\n+var path = require('path');\n+var exec = require('child_process').exec;\n+var _ = require('lodash');\n+\n+module.exports = yeoman.generators.Base.extend({\n+  constructor: function () {\n+    yeoman.generators.Base.apply(this, arguments);\n+\n+    // ex: yo polymer:bo -component-name foo will\n+    // execute `bower install --save foo`\n+    this.argument('component-name', {\n+      desc: 'Component to be downloaded through bower',\n+      require: true\n+    });\n+\n+    this.option('save');\n+  },\n+  init: function () {\n+    var generator = this;\n+\n+    generator.componentName = generator['component-name'];\n+    var isSubProject = generator.componentName.indexOf('/'),\n+\n+      //Extract the resolved component name after bower install.\n+      exactName = (isSubProject !== -1) ? generator.componentName.match(/[\\/*](.*)/)[1] : generator.componentName;\n+\n+    exec('bower install --save ' + generator.componentName, function (error, stdout, stderr) {\n+      if (error) { return console.log(error.message); }\n+\n+      // Output the bower install log\n+      console.log(stdout);\n+\n+      function includeImport(imports) {\n+        var file = generator.readFileAsString('app/elements/elements.html');\n+        file += '\\n<!-- ' + exactName + ' Elements -->\\n';\n+        if (_.isArray(imports)) {\n+          _.each(imports, function (fileName) {\n+            fileName = fileName.replace('\\\\', '/');\n+            if (fileName.indexOf(\".html\") !== -1) {","path":"bo/index.js","position":41,"original_position":41,"commit_id":"40df32c15427282a0619fc0f92dc4687e958b951","original_commit_id":"40df32c15427282a0619fc0f92dc4687e958b951","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"body":"And should use `path.extname()`","created_at":"2015-09-30T04:43:21Z","updated_at":"2015-09-30T04:43:21Z","html_url":"https://github.com/yeoman/generator-polymer/pull/224#discussion_r40758003","pull_request_url":"https://api.github.com/repos/yeoman/generator-polymer/pulls/224","_links":{"self":{"href":"https://api.github.com/repos/yeoman/generator-polymer/pulls/comments/40758003"},"html":{"href":"https://github.com/yeoman/generator-polymer/pull/224#discussion_r40758003"},"pull_request":{"href":"https://api.github.com/repos/yeoman/generator-polymer/pulls/224"}}},"pull_request":{"url":"https://api.github.com/repos/yeoman/generator-polymer/pulls/224","id":46317673,"html_url":"https://github.com/yeoman/generator-polymer/pull/224","diff_url":"https://github.com/yeoman/generator-polymer/pull/224.diff","patch_url":"https://github.com/yeoman/generator-polymer/pull/224.patch","issue_url":"https://api.github.com/repos/yeoman/generator-polymer/issues/224","number":224,"state":"open","locked":false,"title":"Added polymer:bower sub generator","user":{"login":"akshayKrSingh","id":8209379,"avatar_url":"https://avatars.githubusercontent.com/u/8209379?v=3","gravatar_id":"","url":"https://api.github.com/users/akshayKrSingh","html_url":"https://github.com/akshayKrSingh","followers_url":"https://api.github.com/users/akshayKrSingh/followers","following_url":"https://api.github.com/users/akshayKrSingh/following{/other_user}","gists_url":"https://api.github.com/users/akshayKrSingh/gists{/gist_id}","starred_url":"https://api.github.com/users/akshayKrSingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshayKrSingh/subscriptions","organizations_url":"https://api.github.com/users/akshayKrSingh/orgs","repos_url":"https://api.github.com/users/akshayKrSingh/repos","events_url":"https://api.github.com/users/akshayKrSingh/events{/privacy}","received_events_url":"https://api.github.com/users/akshayKrSingh/received_events","type":"User","site_admin":false},"body":"@robdodson : I've tried adding `yo polymer:bower` sub-generator to install and append polymer-elements through **bower**\r\n\r\n### Change Log\r\n* Sub-Generator - **bower** _#alias **bo**_\r\n* **_Updated README.md_** describing the new sub-generator.\r\n* Removed trailing `,` from `app/index.js`\r\n\r\n### What's Happening under the hood\r\n1. It's similar to `yo polymer:element` with the only difference being the `element-name` entered is installed via bower.\r\n2. Post Install, the generator fetches the `main` property from **_bower.json_**.\r\n3. Loops through the `main` property, importing the elements to `app/elements/elements.html` ","created_at":"2015-09-29T19:00:31Z","updated_at":"2015-09-30T04:43:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c2ea1e1e6bb1e9090aa36315ab2291b95a7032b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yeoman/generator-polymer/pulls/224/commits","review_comments_url":"https://api.github.com/repos/yeoman/generator-polymer/pulls/224/comments","review_comment_url":"https://api.github.com/repos/yeoman/generator-polymer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yeoman/generator-polymer/issues/224/comments","statuses_url":"https://api.github.com/repos/yeoman/generator-polymer/statuses/40df32c15427282a0619fc0f92dc4687e958b951","head":{"label":"akshayKrSingh:polymer-bower","ref":"polymer-bower","sha":"40df32c15427282a0619fc0f92dc4687e958b951","user":{"login":"akshayKrSingh","id":8209379,"avatar_url":"https://avatars.githubusercontent.com/u/8209379?v=3","gravatar_id":"","url":"https://api.github.com/users/akshayKrSingh","html_url":"https://github.com/akshayKrSingh","followers_url":"https://api.github.com/users/akshayKrSingh/followers","following_url":"https://api.github.com/users/akshayKrSingh/following{/other_user}","gists_url":"https://api.github.com/users/akshayKrSingh/gists{/gist_id}","starred_url":"https://api.github.com/users/akshayKrSingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshayKrSingh/subscriptions","organizations_url":"https://api.github.com/users/akshayKrSingh/orgs","repos_url":"https://api.github.com/users/akshayKrSingh/repos","events_url":"https://api.github.com/users/akshayKrSingh/events{/privacy}","received_events_url":"https://api.github.com/users/akshayKrSingh/received_events","type":"User","site_admin":false},"repo":{"id":43228369,"name":"generator-polymer","full_name":"akshayKrSingh/generator-polymer","owner":{"login":"akshayKrSingh","id":8209379,"avatar_url":"https://avatars.githubusercontent.com/u/8209379?v=3","gravatar_id":"","url":"https://api.github.com/users/akshayKrSingh","html_url":"https://github.com/akshayKrSingh","followers_url":"https://api.github.com/users/akshayKrSingh/followers","following_url":"https://api.github.com/users/akshayKrSingh/following{/other_user}","gists_url":"https://api.github.com/users/akshayKrSingh/gists{/gist_id}","starred_url":"https://api.github.com/users/akshayKrSingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshayKrSingh/subscriptions","organizations_url":"https://api.github.com/users/akshayKrSingh/orgs","repos_url":"https://api.github.com/users/akshayKrSingh/repos","events_url":"https://api.github.com/users/akshayKrSingh/events{/privacy}","received_events_url":"https://api.github.com/users/akshayKrSingh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/akshayKrSingh/generator-polymer","description":"Scaffold out a Polymer project","fork":true,"url":"https://api.github.com/repos/akshayKrSingh/generator-polymer","forks_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/forks","keys_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/teams","hooks_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/hooks","issue_events_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/issues/events{/number}","events_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/events","assignees_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/assignees{/user}","branches_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/branches{/branch}","tags_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/tags","blobs_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/git/refs{/sha}","trees_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/statuses/{sha}","languages_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/languages","stargazers_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/stargazers","contributors_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/contributors","subscribers_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/subscribers","subscription_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/subscription","commits_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/commits{/sha}","git_commits_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/git/commits{/sha}","comments_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/comments{/number}","issue_comment_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/issues/comments{/number}","contents_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/contents/{+path}","compare_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/merges","archive_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/downloads","issues_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/issues{/number}","pulls_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/pulls{/number}","milestones_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/milestones{/number}","notifications_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/labels{/name}","releases_url":"https://api.github.com/repos/akshayKrSingh/generator-polymer/releases{/id}","created_at":"2015-09-27T00:30:45Z","updated_at":"2015-09-27T00:30:46Z","pushed_at":"2015-09-29T18:42:29Z","git_url":"git://github.com/akshayKrSingh/generator-polymer.git","ssh_url":"git@github.com:akshayKrSingh/generator-polymer.git","clone_url":"https://github.com/akshayKrSingh/generator-polymer.git","svn_url":"https://github.com/akshayKrSingh/generator-polymer","homepage":"http://polymer-project.org","size":1829,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yeoman:master","ref":"master","sha":"2545922cf79d43aa8ca83b7768f93ea13e4434c9","user":{"login":"yeoman","id":1714870,"avatar_url":"https://avatars.githubusercontent.com/u/1714870?v=3","gravatar_id":"","url":"https://api.github.com/users/yeoman","html_url":"https://github.com/yeoman","followers_url":"https://api.github.com/users/yeoman/followers","following_url":"https://api.github.com/users/yeoman/following{/other_user}","gists_url":"https://api.github.com/users/yeoman/gists{/gist_id}","starred_url":"https://api.github.com/users/yeoman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeoman/subscriptions","organizations_url":"https://api.github.com/users/yeoman/orgs","repos_url":"https://api.github.com/users/yeoman/repos","events_url":"https://api.github.com/users/yeoman/events{/privacy}","received_events_url":"https://api.github.com/users/yeoman/received_events","type":"Organization","site_admin":false},"repo":{"id":11635422,"name":"generator-polymer","full_name":"yeoman/generator-polymer","owner":{"login":"yeoman","id":1714870,"avatar_url":"https://avatars.githubusercontent.com/u/1714870?v=3","gravatar_id":"","url":"https://api.github.com/users/yeoman","html_url":"https://github.com/yeoman","followers_url":"https://api.github.com/users/yeoman/followers","following_url":"https://api.github.com/users/yeoman/following{/other_user}","gists_url":"https://api.github.com/users/yeoman/gists{/gist_id}","starred_url":"https://api.github.com/users/yeoman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yeoman/subscriptions","organizations_url":"https://api.github.com/users/yeoman/orgs","repos_url":"https://api.github.com/users/yeoman/repos","events_url":"https://api.github.com/users/yeoman/events{/privacy}","received_events_url":"https://api.github.com/users/yeoman/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yeoman/generator-polymer","description":"Scaffold out a Polymer project","fork":false,"url":"https://api.github.com/repos/yeoman/generator-polymer","forks_url":"https://api.github.com/repos/yeoman/generator-polymer/forks","keys_url":"https://api.github.com/repos/yeoman/generator-polymer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yeoman/generator-polymer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yeoman/generator-polymer/teams","hooks_url":"https://api.github.com/repos/yeoman/generator-polymer/hooks","issue_events_url":"https://api.github.com/repos/yeoman/generator-polymer/issues/events{/number}","events_url":"https://api.github.com/repos/yeoman/generator-polymer/events","assignees_url":"https://api.github.com/repos/yeoman/generator-polymer/assignees{/user}","branches_url":"https://api.github.com/repos/yeoman/generator-polymer/branches{/branch}","tags_url":"https://api.github.com/repos/yeoman/generator-polymer/tags","blobs_url":"https://api.github.com/repos/yeoman/generator-polymer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yeoman/generator-polymer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yeoman/generator-polymer/git/refs{/sha}","trees_url":"https://api.github.com/repos/yeoman/generator-polymer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yeoman/generator-polymer/statuses/{sha}","languages_url":"https://api.github.com/repos/yeoman/generator-polymer/languages","stargazers_url":"https://api.github.com/repos/yeoman/generator-polymer/stargazers","contributors_url":"https://api.github.com/repos/yeoman/generator-polymer/contributors","subscribers_url":"https://api.github.com/repos/yeoman/generator-polymer/subscribers","subscription_url":"https://api.github.com/repos/yeoman/generator-polymer/subscription","commits_url":"https://api.github.com/repos/yeoman/generator-polymer/commits{/sha}","git_commits_url":"https://api.github.com/repos/yeoman/generator-polymer/git/commits{/sha}","comments_url":"https://api.github.com/repos/yeoman/generator-polymer/comments{/number}","issue_comment_url":"https://api.github.com/repos/yeoman/generator-polymer/issues/comments{/number}","contents_url":"https://api.github.com/repos/yeoman/generator-polymer/contents/{+path}","compare_url":"https://api.github.com/repos/yeoman/generator-polymer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yeoman/generator-polymer/merges","archive_url":"https://api.github.com/repos/yeoman/generator-polymer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yeoman/generator-polymer/downloads","issues_url":"https://api.github.com/repos/yeoman/generator-polymer/issues{/number}","pulls_url":"https://api.github.com/repos/yeoman/generator-polymer/pulls{/number}","milestones_url":"https://api.github.com/repos/yeoman/generator-polymer/milestones{/number}","notifications_url":"https://api.github.com/repos/yeoman/generator-polymer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yeoman/generator-polymer/labels{/name}","releases_url":"https://api.github.com/repos/yeoman/generator-polymer/releases{/id}","created_at":"2013-07-24T13:31:14Z","updated_at":"2015-09-29T10:31:52Z","pushed_at":"2015-09-29T19:00:31Z","git_url":"git://github.com/yeoman/generator-polymer.git","ssh_url":"git@github.com:yeoman/generator-polymer.git","clone_url":"https://github.com/yeoman/generator-polymer.git","svn_url":"https://github.com/yeoman/generator-polymer","homepage":"http://polymer-project.org","size":1829,"stargazers_count":800,"watchers_count":800,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":135,"mirror_url":null,"open_issues_count":6,"forks":135,"open_issues":6,"watchers":800,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yeoman/generator-polymer/pulls/224"},"html":{"href":"https://github.com/yeoman/generator-polymer/pull/224"},"issue":{"href":"https://api.github.com/repos/yeoman/generator-polymer/issues/224"},"comments":{"href":"https://api.github.com/repos/yeoman/generator-polymer/issues/224/comments"},"review_comments":{"href":"https://api.github.com/repos/yeoman/generator-polymer/pulls/224/comments"},"review_comment":{"href":"https://api.github.com/repos/yeoman/generator-polymer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yeoman/generator-polymer/pulls/224/commits"},"statuses":{"href":"https://api.github.com/repos/yeoman/generator-polymer/statuses/40df32c15427282a0619fc0f92dc4687e958b951"}}}}