{"action":"created","comment":{"url":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/comments/65088110","id":65088110,"diff_hunk":"@@ -46,34 +46,111 @@ module.exports = {\n     }\n   },\n \n+  flattenIcons: function (iconNames, subDir, srcDir) {\n+    fs.readdirSync(srcDir).forEach((fileName) => {\n+      var filePath = path.join(srcDir, fileName)\n+      if (fs.lstatSync(filePath).isDirectory()) {\n+        this.flattenIcons(iconNames, `${subDir}${subDir === '' ? '' : '/'}${fileName}`, filePath)\n+      } else if (fileName.endsWith('.svg')) {\n+        iconNames.push(`${subDir}/${fileName.substr(0, fileName.length - 4)}`)\n+      }\n+    })\n+\n+    return iconNames\n+  },\n+\n+  // Present purely to allow programmatic access to the icon packs and icon names (for demo purposes)\n   treeForAddon: function (tree) {\n     var addonTree = this._super.treeForAddon.call(this, tree)\n \n-    var svgPaths = [\n-      path.join(this.root, 'public', 'svgs'),\n-      path.join(this.project.root, 'public', 'svgs'),\n-      path.join(this.project.root, 'tests', 'dummy', 'public', 'svgs')\n-    ]\n-      .filter((svgPath) => fs.existsSync(svgPath))\n-\n-    if (svgPaths.length === 0) {\n-      return addonTree\n+    var iconNames = {}\n+\n+    _.chain(this.project.addonPackages)\n+      .pickBy((addonPackage) => {\n+        if (_.has(addonPackage.pkg, 'ember-frost-icon-pack')) {\n+          return true\n+        }\n+      })\n+      .map((addonPackage) => {\n+        const iconPack = addonPackage.pkg['ember-frost-icon-pack']\n+        const iconPackName = iconPack.name\n+        const iconPackPath = iconPack.path || 'svgs'\n+        const addonIconPackPath = path.join(addonPackage.path, iconPackPath)\n+        iconNames[iconPackName] = this.flattenIcons([], '', addonIconPackPath)\n+      })\n+      .value()\n+\n+    const isAddon = this.project.isEmberCLIAddon()\n+\n+    const localIconPackName = _.get(this, 'app.options.iconPackOptions.name', isAddon ? 'dummy' : 'app')\n+    const localIconPackPath = path.join(this.project.root,\n+      _.get(this, 'app.options.iconPackOptions.path', isAddon ? 'tests/dummy/svgs' : 'svgs')\n+    )\n+\n+    // No icon pack path defined and an app = legacy case where the app icons must be merged into the 'frost' icon pack\n+    const isLegacy = !_.has(this, 'app.options.iconPackOptions.path') && !isAddon\n+\n+    if (isLegacy && fs.existsSync(path.join(this.project.root, 'public/svgs'))) {\n+      iconNames['frost'] = _.concat(iconNames['frost'], this.flattenIcons([], '', path.join(this.project.root, 'public/svgs')))\n+    } else if (fs.existsSync(localIconPackPath)) {\n+      iconNames[localIconPackName] = this.flattenIcons([], '', localIconPackPath)\n     }\n \n-    var svgFunnel = new Funnel(mergeTrees(svgPaths, {overwrite: true}), {\n-      include: [new RegExp(/\\.svg$/)]\n-    })\n-\n-    var flattenedSvgs = flatiron(svgFunnel, {\n-      outputFile: 'modules/ember-frost-core/svgs.js',\n-      trimExtensions: true\n-    })\n+    const iconNameTree = writeFile('modules/ember-frost-core/icon-packs.js', 'export default ' + JSON.stringify(iconNames, null, 2))\n \n-    return mergeTrees([addonTree, flattenedSvgs], {overwrite: true})\n+    return mergeTrees([addonTree, iconNameTree], {overwrite: true})\n   },\n \n-  treeForPublic: function () {\n-    var svgRoot = path.join(this.root, 'public', 'svgs')\n-    return svgstore(new Funnel(svgRoot), {outputFile: '/assets/frost-core-icons.svg'})\n+  treeForPublic: function (tree) {\n+    const isAddon = this.project.isEmberCLIAddon()\n+\n+    // No icon pack path defined and an app = legacy case where the app icons must be merged into the 'frost' icon pack\n+    const isLegacy = !_.has(this, 'app.options.iconPackOptions.path') && !isAddon\n+\n+    const iconPacks = _.chain(this.project.addonPackages)\n+      .pickBy((addonPackage) => {\n+        if (_.has(addonPackage.pkg, 'ember-frost-icon-pack')) {\n+          return true\n+        }\n+      })\n+      .map((addonPackage) => {\n+        const iconPack = addonPackage.pkg['ember-frost-icon-pack']\n+        const iconPackPath = iconPack.path || 'svgs'\n+        const addonIconPackPath = path.join(addonPackage.path, iconPackPath)\n+\n+        var svgFunnel\n+        if (iconPack.name === 'frost' && isLegacy) {\n+          console.log('hi')","path":"index.js","position":120,"original_position":120,"commit_id":"db1bbcdc8e93987ede47593700735bf552b18ab7","original_commit_id":"db1bbcdc8e93987ede47593700735bf552b18ab7","user":{"login":"sglanzer","id":9026198,"avatar_url":"https://avatars.githubusercontent.com/u/9026198?v=3","gravatar_id":"","url":"https://api.github.com/users/sglanzer","html_url":"https://github.com/sglanzer","followers_url":"https://api.github.com/users/sglanzer/followers","following_url":"https://api.github.com/users/sglanzer/following{/other_user}","gists_url":"https://api.github.com/users/sglanzer/gists{/gist_id}","starred_url":"https://api.github.com/users/sglanzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sglanzer/subscriptions","organizations_url":"https://api.github.com/users/sglanzer/orgs","repos_url":"https://api.github.com/users/sglanzer/repos","events_url":"https://api.github.com/users/sglanzer/events{/privacy}","received_events_url":"https://api.github.com/users/sglanzer/received_events","type":"User","site_admin":false},"body":"Just being friendly :)","created_at":"2016-05-30T15:54:56Z","updated_at":"2016-05-30T15:54:56Z","html_url":"https://github.com/ciena-frost/ember-frost-core/pull/96#discussion_r65088110","pull_request_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/96","_links":{"self":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/comments/65088110"},"html":{"href":"https://github.com/ciena-frost/ember-frost-core/pull/96#discussion_r65088110"},"pull_request":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/96"}}},"pull_request":{"url":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/96","id":71844603,"html_url":"https://github.com/ciena-frost/ember-frost-core/pull/96","diff_url":"https://github.com/ciena-frost/ember-frost-core/pull/96.diff","patch_url":"https://github.com/ciena-frost/ember-frost-core/pull/96.patch","issue_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/issues/96","number":96,"state":"open","locked":false,"title":"Icon packs","user":{"login":"sglanzer","id":9026198,"avatar_url":"https://avatars.githubusercontent.com/u/9026198?v=3","gravatar_id":"","url":"https://api.github.com/users/sglanzer","html_url":"https://github.com/sglanzer","followers_url":"https://api.github.com/users/sglanzer/followers","following_url":"https://api.github.com/users/sglanzer/following{/other_user}","gists_url":"https://api.github.com/users/sglanzer/gists{/gist_id}","starred_url":"https://api.github.com/users/sglanzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sglanzer/subscriptions","organizations_url":"https://api.github.com/users/sglanzer/orgs","repos_url":"https://api.github.com/users/sglanzer/repos","events_url":"https://api.github.com/users/sglanzer/events{/privacy}","received_events_url":"https://api.github.com/users/sglanzer/received_events","type":"User","site_admin":false},"body":"Adds the icon pack #feature# to the build process and the `frost-icon` component.  Apologies for the messy duplication in `index.js`, I didn't have time to clean up all of the code.\r\n\r\n# CHANGELOG\r\n\r\nAdded the icon pack feature to `frost-icon`, see the documentation at http://ciena-frost.github.io/ember-frost-core/#/icons for details","created_at":"2016-05-30T01:45:43Z","updated_at":"2016-05-30T15:54:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dec0117d0006ac3d1154d39382df84734ef64fad","assignee":{"login":"cstolli","id":29387,"avatar_url":"https://avatars.githubusercontent.com/u/29387?v=3","gravatar_id":"","url":"https://api.github.com/users/cstolli","html_url":"https://github.com/cstolli","followers_url":"https://api.github.com/users/cstolli/followers","following_url":"https://api.github.com/users/cstolli/following{/other_user}","gists_url":"https://api.github.com/users/cstolli/gists{/gist_id}","starred_url":"https://api.github.com/users/cstolli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cstolli/subscriptions","organizations_url":"https://api.github.com/users/cstolli/orgs","repos_url":"https://api.github.com/users/cstolli/repos","events_url":"https://api.github.com/users/cstolli/events{/privacy}","received_events_url":"https://api.github.com/users/cstolli/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/96/commits","review_comments_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/96/comments","review_comment_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/issues/96/comments","statuses_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/statuses/db1bbcdc8e93987ede47593700735bf552b18ab7","head":{"label":"sglanzer:master","ref":"master","sha":"db1bbcdc8e93987ede47593700735bf552b18ab7","user":{"login":"sglanzer","id":9026198,"avatar_url":"https://avatars.githubusercontent.com/u/9026198?v=3","gravatar_id":"","url":"https://api.github.com/users/sglanzer","html_url":"https://github.com/sglanzer","followers_url":"https://api.github.com/users/sglanzer/followers","following_url":"https://api.github.com/users/sglanzer/following{/other_user}","gists_url":"https://api.github.com/users/sglanzer/gists{/gist_id}","starred_url":"https://api.github.com/users/sglanzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sglanzer/subscriptions","organizations_url":"https://api.github.com/users/sglanzer/orgs","repos_url":"https://api.github.com/users/sglanzer/repos","events_url":"https://api.github.com/users/sglanzer/events{/privacy}","received_events_url":"https://api.github.com/users/sglanzer/received_events","type":"User","site_admin":false},"repo":{"id":54562068,"name":"ember-frost-core","full_name":"sglanzer/ember-frost-core","owner":{"login":"sglanzer","id":9026198,"avatar_url":"https://avatars.githubusercontent.com/u/9026198?v=3","gravatar_id":"","url":"https://api.github.com/users/sglanzer","html_url":"https://github.com/sglanzer","followers_url":"https://api.github.com/users/sglanzer/followers","following_url":"https://api.github.com/users/sglanzer/following{/other_user}","gists_url":"https://api.github.com/users/sglanzer/gists{/gist_id}","starred_url":"https://api.github.com/users/sglanzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sglanzer/subscriptions","organizations_url":"https://api.github.com/users/sglanzer/orgs","repos_url":"https://api.github.com/users/sglanzer/repos","events_url":"https://api.github.com/users/sglanzer/events{/privacy}","received_events_url":"https://api.github.com/users/sglanzer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sglanzer/ember-frost-core","description":null,"fork":true,"url":"https://api.github.com/repos/sglanzer/ember-frost-core","forks_url":"https://api.github.com/repos/sglanzer/ember-frost-core/forks","keys_url":"https://api.github.com/repos/sglanzer/ember-frost-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sglanzer/ember-frost-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sglanzer/ember-frost-core/teams","hooks_url":"https://api.github.com/repos/sglanzer/ember-frost-core/hooks","issue_events_url":"https://api.github.com/repos/sglanzer/ember-frost-core/issues/events{/number}","events_url":"https://api.github.com/repos/sglanzer/ember-frost-core/events","assignees_url":"https://api.github.com/repos/sglanzer/ember-frost-core/assignees{/user}","branches_url":"https://api.github.com/repos/sglanzer/ember-frost-core/branches{/branch}","tags_url":"https://api.github.com/repos/sglanzer/ember-frost-core/tags","blobs_url":"https://api.github.com/repos/sglanzer/ember-frost-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sglanzer/ember-frost-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sglanzer/ember-frost-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/sglanzer/ember-frost-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sglanzer/ember-frost-core/statuses/{sha}","languages_url":"https://api.github.com/repos/sglanzer/ember-frost-core/languages","stargazers_url":"https://api.github.com/repos/sglanzer/ember-frost-core/stargazers","contributors_url":"https://api.github.com/repos/sglanzer/ember-frost-core/contributors","subscribers_url":"https://api.github.com/repos/sglanzer/ember-frost-core/subscribers","subscription_url":"https://api.github.com/repos/sglanzer/ember-frost-core/subscription","commits_url":"https://api.github.com/repos/sglanzer/ember-frost-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/sglanzer/ember-frost-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/sglanzer/ember-frost-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/sglanzer/ember-frost-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/sglanzer/ember-frost-core/contents/{+path}","compare_url":"https://api.github.com/repos/sglanzer/ember-frost-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sglanzer/ember-frost-core/merges","archive_url":"https://api.github.com/repos/sglanzer/ember-frost-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sglanzer/ember-frost-core/downloads","issues_url":"https://api.github.com/repos/sglanzer/ember-frost-core/issues{/number}","pulls_url":"https://api.github.com/repos/sglanzer/ember-frost-core/pulls{/number}","milestones_url":"https://api.github.com/repos/sglanzer/ember-frost-core/milestones{/number}","notifications_url":"https://api.github.com/repos/sglanzer/ember-frost-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sglanzer/ember-frost-core/labels{/name}","releases_url":"https://api.github.com/repos/sglanzer/ember-frost-core/releases{/id}","deployments_url":"https://api.github.com/repos/sglanzer/ember-frost-core/deployments","created_at":"2016-03-23T13:31:30Z","updated_at":"2016-03-23T13:31:31Z","pushed_at":"2016-05-30T01:55:07Z","git_url":"git://github.com/sglanzer/ember-frost-core.git","ssh_url":"git@github.com:sglanzer/ember-frost-core.git","clone_url":"https://github.com/sglanzer/ember-frost-core.git","svn_url":"https://github.com/sglanzer/ember-frost-core","homepage":null,"size":413,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"ciena-frost:master","ref":"master","sha":"edebf423891c57c231f0ef547b5289f423c975f6","user":{"login":"ciena-frost","id":16601148,"avatar_url":"https://avatars.githubusercontent.com/u/16601148?v=3","gravatar_id":"","url":"https://api.github.com/users/ciena-frost","html_url":"https://github.com/ciena-frost","followers_url":"https://api.github.com/users/ciena-frost/followers","following_url":"https://api.github.com/users/ciena-frost/following{/other_user}","gists_url":"https://api.github.com/users/ciena-frost/gists{/gist_id}","starred_url":"https://api.github.com/users/ciena-frost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ciena-frost/subscriptions","organizations_url":"https://api.github.com/users/ciena-frost/orgs","repos_url":"https://api.github.com/users/ciena-frost/repos","events_url":"https://api.github.com/users/ciena-frost/events{/privacy}","received_events_url":"https://api.github.com/users/ciena-frost/received_events","type":"Organization","site_admin":false},"repo":{"id":54404273,"name":"ember-frost-core","full_name":"ciena-frost/ember-frost-core","owner":{"login":"ciena-frost","id":16601148,"avatar_url":"https://avatars.githubusercontent.com/u/16601148?v=3","gravatar_id":"","url":"https://api.github.com/users/ciena-frost","html_url":"https://github.com/ciena-frost","followers_url":"https://api.github.com/users/ciena-frost/followers","following_url":"https://api.github.com/users/ciena-frost/following{/other_user}","gists_url":"https://api.github.com/users/ciena-frost/gists{/gist_id}","starred_url":"https://api.github.com/users/ciena-frost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ciena-frost/subscriptions","organizations_url":"https://api.github.com/users/ciena-frost/orgs","repos_url":"https://api.github.com/users/ciena-frost/repos","events_url":"https://api.github.com/users/ciena-frost/events{/privacy}","received_events_url":"https://api.github.com/users/ciena-frost/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ciena-frost/ember-frost-core","description":"","fork":false,"url":"https://api.github.com/repos/ciena-frost/ember-frost-core","forks_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/forks","keys_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/teams","hooks_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/hooks","issue_events_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/issues/events{/number}","events_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/events","assignees_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/assignees{/user}","branches_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/branches{/branch}","tags_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/tags","blobs_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/statuses/{sha}","languages_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/languages","stargazers_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/stargazers","contributors_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/contributors","subscribers_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/subscribers","subscription_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/subscription","commits_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/contents/{+path}","compare_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/merges","archive_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/downloads","issues_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/issues{/number}","pulls_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls{/number}","milestones_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/milestones{/number}","notifications_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/labels{/name}","releases_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/releases{/id}","deployments_url":"https://api.github.com/repos/ciena-frost/ember-frost-core/deployments","created_at":"2016-03-21T16:15:34Z","updated_at":"2016-05-27T02:30:53Z","pushed_at":"2016-05-30T01:55:07Z","git_url":"git://github.com/ciena-frost/ember-frost-core.git","ssh_url":"git@github.com:ciena-frost/ember-frost-core.git","clone_url":"https://github.com/ciena-frost/ember-frost-core.git","svn_url":"https://github.com/ciena-frost/ember-frost-core","homepage":"http://ciena-frost.github.io/ember-frost-core/","size":4255,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15,"mirror_url":null,"open_issues_count":16,"forks":15,"open_issues":16,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/96"},"html":{"href":"https://github.com/ciena-frost/ember-frost-core/pull/96"},"issue":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/issues/96"},"comments":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/issues/96/comments"},"review_comments":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/96/comments"},"review_comment":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/pulls/96/commits"},"statuses":{"href":"https://api.github.com/repos/ciena-frost/ember-frost-core/statuses/db1bbcdc8e93987ede47593700735bf552b18ab7"}}}}
{"actor":{"display_login":"sglanzer"}}