{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/vanagon/pulls/comments/52812653","id":52812653,"diff_hunk":"@@ -221,6 +222,73 @@ def output_dir(target_repo = \"\")\n         File.join(\"windows\", target_repo, @architecture)\n       end\n \n+      # Generate correctly formatted wix elements that match the\n+      # structure of the directory input\n+      #\n+      # @param directories, Array of hashes including at least :path\n+      # and optionally:\n+      # @return [string] correctly formatted wix element string\n+      def generate_wix_dirs(project)\n+        if project.get_directories.empty?\n+          raise Vanagon::Error, 'ERROR No directories specified!'\n+        else\n+          directories = []\n+          project.get_directories.map { |dir| directories.push({ :path => dir.path, :id => dir.wix_id }) }\n+\n+          root = { :children => [] }\n+\n+          # iterate over all paths specified and break each one\n+          # in to its specific directories. This will generate_wix_dirs\n+          # an n-ary tree structure matching the specs from the input\n+          directories.each do |dir|\n+            curr = root\n+            names = dir[:path].sub(/\\//, '').split(/\\//)\n+            names.each do |name|\n+              new_obj = { :name => name, :id => nil, :children => [] }\n+              if (child_index = includes_child(new_obj, curr[:children]))\n+                curr = curr[:children][child_index]\n+              else\n+                curr[:children].push(new_obj)\n+                curr = new_obj\n+              end\n+            end\n+            #at this point, curr will be the top dir\n+            curr[:id] = dir[:id]\n+          end\n+          return generate_wix_from_graph(root)\n+        end\n+      end\n+\n+      # Find if child element is the same as one of\n+      # the old_children elements, return that child\n+      def includes_child(new_child, old_children)\n+        old_children.each_with_index do |curr_old_child, index|\n+          return index if curr_old_child[:name] == new_child[:name]\n+        end unless old_children.empty?\n+        return nil\n+      end\n+\n+      # Recursively generate wix element structure\n+      #\n+      # @param root, the (empty) root of an n-ary tree containing the\n+      # structure of directories\n+      def generate_wix_from_graph(root)\n+        string = ''\n+        unless root[:children].empty?\n+          root[:children].each do |child|\n+            if child[:id]\n+              string += (\"<Directory Name=\\\"#{child[:name]}\\\" Id=\\\"#{child[:id]}\\\">\\n\")\n+            else\n+              string += (\"<Directory Name=\\\"#{child[:name]}\\\">\\n\")","path":"lib/vanagon/platform/windows.rb","position":88,"original_position":69,"commit_id":"b9e7b626c3468b2e54a54ebe22040f7bfa547710","original_commit_id":"ba11fb20531e5ecc3524c8a07d3560b334d1ea0c","user":{"login":"melissa","id":4473089,"avatar_url":"https://avatars.githubusercontent.com/u/4473089?v=3","gravatar_id":"","url":"https://api.github.com/users/melissa","html_url":"https://github.com/melissa","followers_url":"https://api.github.com/users/melissa/followers","following_url":"https://api.github.com/users/melissa/following{/other_user}","gists_url":"https://api.github.com/users/melissa/gists{/gist_id}","starred_url":"https://api.github.com/users/melissa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melissa/subscriptions","organizations_url":"https://api.github.com/users/melissa/orgs","repos_url":"https://api.github.com/users/melissa/repos","events_url":"https://api.github.com/users/melissa/events{/privacy}","received_events_url":"https://api.github.com/users/melissa/received_events","type":"User","site_admin":false},"body":"should this be a fail case instead?","created_at":"2016-02-12T23:28:24Z","updated_at":"2016-02-12T23:28:24Z","html_url":"https://github.com/puppetlabs/vanagon/pull/283#discussion_r52812653","pull_request_url":"https://api.github.com/repos/puppetlabs/vanagon/pulls/283","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/vanagon/pulls/comments/52812653"},"html":{"href":"https://github.com/puppetlabs/vanagon/pull/283#discussion_r52812653"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/vanagon/pulls/283"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/vanagon/pulls/283","id":58693897,"html_url":"https://github.com/puppetlabs/vanagon/pull/283","diff_url":"https://github.com/puppetlabs/vanagon/pull/283.diff","patch_url":"https://github.com/puppetlabs/vanagon/pull/283.patch","issue_url":"https://api.github.com/repos/puppetlabs/vanagon/issues/283","number":283,"state":"open","locked":false,"title":"(RE-6455) Create directorylist.wxs","user":{"login":"McdonaldSeanp","id":6415932,"avatar_url":"https://avatars.githubusercontent.com/u/6415932?v=3","gravatar_id":"","url":"https://api.github.com/users/McdonaldSeanp","html_url":"https://github.com/McdonaldSeanp","followers_url":"https://api.github.com/users/McdonaldSeanp/followers","following_url":"https://api.github.com/users/McdonaldSeanp/following{/other_user}","gists_url":"https://api.github.com/users/McdonaldSeanp/gists{/gist_id}","starred_url":"https://api.github.com/users/McdonaldSeanp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/McdonaldSeanp/subscriptions","organizations_url":"https://api.github.com/users/McdonaldSeanp/orgs","repos_url":"https://api.github.com/users/McdonaldSeanp/repos","events_url":"https://api.github.com/users/McdonaldSeanp/events{/privacy}","received_events_url":"https://api.github.com/users/McdonaldSeanp/received_events","type":"User","site_admin":false},"body":"This commit will add functionality to use the existing\r\nget_directories functionality for a project to generate\r\na directorylist.wxs file that contains the wix structure\r\nof directories for the project.\r\n\r\nAs part of this feature this commit also extends the current\r\nVANAGON::COMMON::PATHNAME structure to include \"id\" for\r\nuse in the wix structure. it does not specifically extend\r\nthe actual COMMON::PATHNAME class but instead creates a\r\nnew class to extend pathname under the namespace\r\nVANAGON::WINDOWS:PATHNAME\r\n\r\nfinally this commit adds rspec tests for the new functionality\r\nand updates any old rspec that would break with the new\r\nfunctionality","created_at":"2016-02-09T01:26:47Z","updated_at":"2016-02-12T23:28:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8558cf261fd09c4b07307148ada2de031a3f8f8a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/vanagon/pulls/283/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/vanagon/pulls/283/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/vanagon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/vanagon/issues/283/comments","statuses_url":"https://api.github.com/repos/puppetlabs/vanagon/statuses/b9e7b626c3468b2e54a54ebe22040f7bfa547710","head":{"label":"McdonaldSeanp:feature/RE6455_add_wix_dirlist_feature","ref":"feature/RE6455_add_wix_dirlist_feature","sha":"b9e7b626c3468b2e54a54ebe22040f7bfa547710","user":{"login":"McdonaldSeanp","id":6415932,"avatar_url":"https://avatars.githubusercontent.com/u/6415932?v=3","gravatar_id":"","url":"https://api.github.com/users/McdonaldSeanp","html_url":"https://github.com/McdonaldSeanp","followers_url":"https://api.github.com/users/McdonaldSeanp/followers","following_url":"https://api.github.com/users/McdonaldSeanp/following{/other_user}","gists_url":"https://api.github.com/users/McdonaldSeanp/gists{/gist_id}","starred_url":"https://api.github.com/users/McdonaldSeanp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/McdonaldSeanp/subscriptions","organizations_url":"https://api.github.com/users/McdonaldSeanp/orgs","repos_url":"https://api.github.com/users/McdonaldSeanp/repos","events_url":"https://api.github.com/users/McdonaldSeanp/events{/privacy}","received_events_url":"https://api.github.com/users/McdonaldSeanp/received_events","type":"User","site_admin":false},"repo":{"id":46823262,"name":"vanagon","full_name":"McdonaldSeanp/vanagon","owner":{"login":"McdonaldSeanp","id":6415932,"avatar_url":"https://avatars.githubusercontent.com/u/6415932?v=3","gravatar_id":"","url":"https://api.github.com/users/McdonaldSeanp","html_url":"https://github.com/McdonaldSeanp","followers_url":"https://api.github.com/users/McdonaldSeanp/followers","following_url":"https://api.github.com/users/McdonaldSeanp/following{/other_user}","gists_url":"https://api.github.com/users/McdonaldSeanp/gists{/gist_id}","starred_url":"https://api.github.com/users/McdonaldSeanp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/McdonaldSeanp/subscriptions","organizations_url":"https://api.github.com/users/McdonaldSeanp/orgs","repos_url":"https://api.github.com/users/McdonaldSeanp/repos","events_url":"https://api.github.com/users/McdonaldSeanp/events{/privacy}","received_events_url":"https://api.github.com/users/McdonaldSeanp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/McdonaldSeanp/vanagon","description":"All of your packages will fit into this van with this one simple trick.","fork":true,"url":"https://api.github.com/repos/McdonaldSeanp/vanagon","forks_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/forks","keys_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/teams","hooks_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/hooks","issue_events_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/issues/events{/number}","events_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/events","assignees_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/assignees{/user}","branches_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/branches{/branch}","tags_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/tags","blobs_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/git/refs{/sha}","trees_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/statuses/{sha}","languages_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/languages","stargazers_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/stargazers","contributors_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/contributors","subscribers_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/subscribers","subscription_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/subscription","commits_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/commits{/sha}","git_commits_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/git/commits{/sha}","comments_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/comments{/number}","issue_comment_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/issues/comments{/number}","contents_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/contents/{+path}","compare_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/merges","archive_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/downloads","issues_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/issues{/number}","pulls_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/pulls{/number}","milestones_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/milestones{/number}","notifications_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/labels{/name}","releases_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/releases{/id}","deployments_url":"https://api.github.com/repos/McdonaldSeanp/vanagon/deployments","created_at":"2015-11-24T22:41:48Z","updated_at":"2016-02-05T03:45:37Z","pushed_at":"2016-02-12T23:24:22Z","git_url":"git://github.com/McdonaldSeanp/vanagon.git","ssh_url":"git@github.com:McdonaldSeanp/vanagon.git","clone_url":"https://github.com/McdonaldSeanp/vanagon.git","svn_url":"https://github.com/McdonaldSeanp/vanagon","homepage":null,"size":802,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"puppetlabs:master","ref":"master","sha":"d30fe4186e9ec8f05f5c2d26b9a0ccf401ec1bed","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":26653553,"name":"vanagon","full_name":"puppetlabs/vanagon","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/vanagon","description":"All of your packages will fit into this van with this one simple trick.","fork":false,"url":"https://api.github.com/repos/puppetlabs/vanagon","forks_url":"https://api.github.com/repos/puppetlabs/vanagon/forks","keys_url":"https://api.github.com/repos/puppetlabs/vanagon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/vanagon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/vanagon/teams","hooks_url":"https://api.github.com/repos/puppetlabs/vanagon/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/vanagon/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/vanagon/events","assignees_url":"https://api.github.com/repos/puppetlabs/vanagon/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/vanagon/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/vanagon/tags","blobs_url":"https://api.github.com/repos/puppetlabs/vanagon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/vanagon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/vanagon/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/vanagon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/vanagon/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/vanagon/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/vanagon/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/vanagon/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/vanagon/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/vanagon/subscription","commits_url":"https://api.github.com/repos/puppetlabs/vanagon/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/vanagon/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/vanagon/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/vanagon/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/vanagon/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/vanagon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/vanagon/merges","archive_url":"https://api.github.com/repos/puppetlabs/vanagon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/vanagon/downloads","issues_url":"https://api.github.com/repos/puppetlabs/vanagon/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/vanagon/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/vanagon/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/vanagon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/vanagon/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/vanagon/releases{/id}","deployments_url":"https://api.github.com/repos/puppetlabs/vanagon/deployments","created_at":"2014-11-14T19:17:18Z","updated_at":"2016-01-29T12:05:09Z","pushed_at":"2016-02-12T23:24:22Z","git_url":"git://github.com/puppetlabs/vanagon.git","ssh_url":"git@github.com:puppetlabs/vanagon.git","clone_url":"https://github.com/puppetlabs/vanagon.git","svn_url":"https://github.com/puppetlabs/vanagon","homepage":null,"size":913,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":9,"forks":18,"open_issues":9,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/vanagon/pulls/283"},"html":{"href":"https://github.com/puppetlabs/vanagon/pull/283"},"issue":{"href":"https://api.github.com/repos/puppetlabs/vanagon/issues/283"},"comments":{"href":"https://api.github.com/repos/puppetlabs/vanagon/issues/283/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/vanagon/pulls/283/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/vanagon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/vanagon/pulls/283/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/vanagon/statuses/b9e7b626c3468b2e54a54ebe22040f7bfa547710"}}}}