{"action":"created","comment":{"url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/comments/52307329","id":52307329,"diff_hunk":"@@ -0,0 +1,56 @@\n+package tasks;\n+\n+import org.apache.commons.io.FileUtils;\n+import play.Logger;\n+\n+import java.io.File;\n+import java.io.IOException;\n+import java.net.URL;\n+import java.nio.file.FileAlreadyExistsException;\n+import java.nio.file.FileSystem;\n+import java.nio.file.FileSystems;\n+import java.nio.file.Path;\n+import java.util.Arrays;\n+import java.util.List;\n+\n+public class WebjarsFilesCopier {\n+    private static final Logger.ALogger LOGGER = Logger.of(WebjarsFilesCopier.class);\n+    private static final String WEBJARS_PATH = \"META-INF/resources/webjars/\";\n+    private static final FileSystem FILE_SYSTEM = FileSystems.getDefault();\n+\n+    public static void main(String[] args) {\n+        if (args.length > 1) {\n+            final String destBasePath = args[0];\n+            final List<String> filesToCopy = Arrays.asList(args).subList(1, args.length);\n+            copyTemplateFiles(destBasePath, filesToCopy);\n+        } else {\n+            throw new RuntimeException(\"Missing arguments, required at least one origin path\");\n+        }\n+    }\n+\n+    static void copyTemplateFiles(final String destBasePath, final List<String> filesToCopy) {\n+        filesToCopy.forEach(fileToCopy -> {\n+            final String origFilePath = WEBJARS_PATH + fileToCopy;\n+            final URL origResource = Thread.currentThread().getContextClassLoader().getResource(origFilePath);\n+            if (origResource != null) {\n+                final File origFile = new File(origResource.getPath());\n+                final Path destPath = FILE_SYSTEM.getPath(destBasePath, fileToCopy);\n+                copyFile(origFile, destPath.getParent());\n+            } else {\n+                LOGGER.error(\"Could not find file \\\"{}\\\" in classpath\", origFilePath);\n+            }\n+        });\n+    }\n+\n+    private static void copyFile(final File origFile, final Path destPath) {\n+        LOGGER.debug(origFile + \" => \" + destPath);\n+        try {\n+            FileUtils.copyFileToDirectory(origFile, destPath.toFile());\n+            LOGGER.info(\"Successfully created \\\"{}\\\"\", destPath);\n+        } catch (FileAlreadyExistsException e) {\n+            LOGGER.error(\"File \\\"{}\\\" already exists, please delete it first if you want to replace it\", destPath);","path":"app/tasks/WebjarsFilesCopier.java","position":51,"original_position":51,"commit_id":"2d5e62cc246bf81724c5f8567557629b8e907aeb","original_commit_id":"2d5e62cc246bf81724c5f8567557629b8e907aeb","user":{"login":"lauraluiz","id":1917621,"avatar_url":"https://avatars.githubusercontent.com/u/1917621?v=3","gravatar_id":"","url":"https://api.github.com/users/lauraluiz","html_url":"https://github.com/lauraluiz","followers_url":"https://api.github.com/users/lauraluiz/followers","following_url":"https://api.github.com/users/lauraluiz/following{/other_user}","gists_url":"https://api.github.com/users/lauraluiz/gists{/gist_id}","starred_url":"https://api.github.com/users/lauraluiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauraluiz/subscriptions","organizations_url":"https://api.github.com/users/lauraluiz/orgs","repos_url":"https://api.github.com/users/lauraluiz/repos","events_url":"https://api.github.com/users/lauraluiz/events{/privacy}","received_events_url":"https://api.github.com/users/lauraluiz/received_events","type":"User","site_admin":false},"body":"Thought about it, but the people that will use this don't care about the code details (the exception is not giving info of their interest) and it will hide the message, which I want it to be easy to spot to ready it. That's why I thought against it.","created_at":"2016-02-09T13:35:23Z","updated_at":"2016-02-09T13:35:23Z","html_url":"https://github.com/sphereio/commercetools-sunrise-java/pull/285#discussion_r52307329","pull_request_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/285","_links":{"self":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/comments/52307329"},"html":{"href":"https://github.com/sphereio/commercetools-sunrise-java/pull/285#discussion_r52307329"},"pull_request":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/285"}}},"pull_request":{"url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/285","id":58743047,"html_url":"https://github.com/sphereio/commercetools-sunrise-java/pull/285","diff_url":"https://github.com/sphereio/commercetools-sunrise-java/pull/285.diff","patch_url":"https://github.com/sphereio/commercetools-sunrise-java/pull/285.patch","issue_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues/285","number":285,"state":"open","locked":false,"title":"Fix and test copier to create also missing folders, fixes #281","user":{"login":"lauraluiz","id":1917621,"avatar_url":"https://avatars.githubusercontent.com/u/1917621?v=3","gravatar_id":"","url":"https://api.github.com/users/lauraluiz","html_url":"https://github.com/lauraluiz","followers_url":"https://api.github.com/users/lauraluiz/followers","following_url":"https://api.github.com/users/lauraluiz/following{/other_user}","gists_url":"https://api.github.com/users/lauraluiz/gists{/gist_id}","starred_url":"https://api.github.com/users/lauraluiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauraluiz/subscriptions","organizations_url":"https://api.github.com/users/lauraluiz/orgs","repos_url":"https://api.github.com/users/lauraluiz/repos","events_url":"https://api.github.com/users/lauraluiz/events{/privacy}","received_events_url":"https://api.github.com/users/lauraluiz/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-09T12:50:58Z","updated_at":"2016-02-09T13:35:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1203f09cb9afe3214c3dd92e6371de272b62747","assignee":{"login":"lauraluiz","id":1917621,"avatar_url":"https://avatars.githubusercontent.com/u/1917621?v=3","gravatar_id":"","url":"https://api.github.com/users/lauraluiz","html_url":"https://github.com/lauraluiz","followers_url":"https://api.github.com/users/lauraluiz/followers","following_url":"https://api.github.com/users/lauraluiz/following{/other_user}","gists_url":"https://api.github.com/users/lauraluiz/gists{/gist_id}","starred_url":"https://api.github.com/users/lauraluiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauraluiz/subscriptions","organizations_url":"https://api.github.com/users/lauraluiz/orgs","repos_url":"https://api.github.com/users/lauraluiz/repos","events_url":"https://api.github.com/users/lauraluiz/events{/privacy}","received_events_url":"https://api.github.com/users/lauraluiz/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/milestones/9","html_url":"https://github.com/sphereio/commercetools-sunrise-java/milestones/0.5.0","labels_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/milestones/9/labels","id":1497261,"number":9,"title":"0.5.0","description":"","creator":{"login":"lauraluiz","id":1917621,"avatar_url":"https://avatars.githubusercontent.com/u/1917621?v=3","gravatar_id":"","url":"https://api.github.com/users/lauraluiz","html_url":"https://github.com/lauraluiz","followers_url":"https://api.github.com/users/lauraluiz/followers","following_url":"https://api.github.com/users/lauraluiz/following{/other_user}","gists_url":"https://api.github.com/users/lauraluiz/gists{/gist_id}","starred_url":"https://api.github.com/users/lauraluiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lauraluiz/subscriptions","organizations_url":"https://api.github.com/users/lauraluiz/orgs","repos_url":"https://api.github.com/users/lauraluiz/repos","events_url":"https://api.github.com/users/lauraluiz/events{/privacy}","received_events_url":"https://api.github.com/users/lauraluiz/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":1,"state":"open","created_at":"2016-01-11T13:51:04Z","updated_at":"2016-02-09T12:50:58Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/285/commits","review_comments_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/285/comments","review_comment_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues/285/comments","statuses_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/statuses/2d5e62cc246bf81724c5f8567557629b8e907aeb","head":{"label":"sphereio:fix-copy-281","ref":"fix-copy-281","sha":"2d5e62cc246bf81724c5f8567557629b8e907aeb","user":{"login":"sphereio","id":4119130,"avatar_url":"https://avatars.githubusercontent.com/u/4119130?v=3","gravatar_id":"","url":"https://api.github.com/users/sphereio","html_url":"https://github.com/sphereio","followers_url":"https://api.github.com/users/sphereio/followers","following_url":"https://api.github.com/users/sphereio/following{/other_user}","gists_url":"https://api.github.com/users/sphereio/gists{/gist_id}","starred_url":"https://api.github.com/users/sphereio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphereio/subscriptions","organizations_url":"https://api.github.com/users/sphereio/orgs","repos_url":"https://api.github.com/users/sphereio/repos","events_url":"https://api.github.com/users/sphereio/events{/privacy}","received_events_url":"https://api.github.com/users/sphereio/received_events","type":"Organization","site_admin":false},"repo":{"id":20036001,"name":"commercetools-sunrise-java","full_name":"sphereio/commercetools-sunrise-java","owner":{"login":"sphereio","id":4119130,"avatar_url":"https://avatars.githubusercontent.com/u/4119130?v=3","gravatar_id":"","url":"https://api.github.com/users/sphereio","html_url":"https://github.com/sphereio","followers_url":"https://api.github.com/users/sphereio/followers","following_url":"https://api.github.com/users/sphereio/following{/other_user}","gists_url":"https://api.github.com/users/sphereio/gists{/gist_id}","starred_url":"https://api.github.com/users/sphereio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphereio/subscriptions","organizations_url":"https://api.github.com/users/sphereio/orgs","repos_url":"https://api.github.com/users/sphereio/repos","events_url":"https://api.github.com/users/sphereio/events{/privacy}","received_events_url":"https://api.github.com/users/sphereio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sphereio/commercetools-sunrise-java","description":"The next generation demo shop template by commercetools","fork":false,"url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java","forks_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/forks","keys_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/teams","hooks_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/hooks","issue_events_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues/events{/number}","events_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/events","assignees_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/assignees{/user}","branches_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/branches{/branch}","tags_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/tags","blobs_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/statuses/{sha}","languages_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/languages","stargazers_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/stargazers","contributors_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/contributors","subscribers_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/subscribers","subscription_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/subscription","commits_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/contents/{+path}","compare_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/merges","archive_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/downloads","issues_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues{/number}","pulls_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls{/number}","milestones_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/milestones{/number}","notifications_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/labels{/name}","releases_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/releases{/id}","deployments_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/deployments","created_at":"2014-05-21T20:20:52Z","updated_at":"2016-01-28T17:32:19Z","pushed_at":"2016-02-09T12:50:59Z","git_url":"git://github.com/sphereio/commercetools-sunrise-java.git","ssh_url":"git@github.com:sphereio/commercetools-sunrise-java.git","clone_url":"https://github.com/sphereio/commercetools-sunrise-java.git","svn_url":"https://github.com/sphereio/commercetools-sunrise-java","homepage":"https://sunrise.commercetools.com","size":15170,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":65,"forks":5,"open_issues":65,"watchers":7,"default_branch":"master"}},"base":{"label":"sphereio:master","ref":"master","sha":"0533631b0cf0870c32d9a0985e28584cd6644ede","user":{"login":"sphereio","id":4119130,"avatar_url":"https://avatars.githubusercontent.com/u/4119130?v=3","gravatar_id":"","url":"https://api.github.com/users/sphereio","html_url":"https://github.com/sphereio","followers_url":"https://api.github.com/users/sphereio/followers","following_url":"https://api.github.com/users/sphereio/following{/other_user}","gists_url":"https://api.github.com/users/sphereio/gists{/gist_id}","starred_url":"https://api.github.com/users/sphereio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphereio/subscriptions","organizations_url":"https://api.github.com/users/sphereio/orgs","repos_url":"https://api.github.com/users/sphereio/repos","events_url":"https://api.github.com/users/sphereio/events{/privacy}","received_events_url":"https://api.github.com/users/sphereio/received_events","type":"Organization","site_admin":false},"repo":{"id":20036001,"name":"commercetools-sunrise-java","full_name":"sphereio/commercetools-sunrise-java","owner":{"login":"sphereio","id":4119130,"avatar_url":"https://avatars.githubusercontent.com/u/4119130?v=3","gravatar_id":"","url":"https://api.github.com/users/sphereio","html_url":"https://github.com/sphereio","followers_url":"https://api.github.com/users/sphereio/followers","following_url":"https://api.github.com/users/sphereio/following{/other_user}","gists_url":"https://api.github.com/users/sphereio/gists{/gist_id}","starred_url":"https://api.github.com/users/sphereio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sphereio/subscriptions","organizations_url":"https://api.github.com/users/sphereio/orgs","repos_url":"https://api.github.com/users/sphereio/repos","events_url":"https://api.github.com/users/sphereio/events{/privacy}","received_events_url":"https://api.github.com/users/sphereio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sphereio/commercetools-sunrise-java","description":"The next generation demo shop template by commercetools","fork":false,"url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java","forks_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/forks","keys_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/teams","hooks_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/hooks","issue_events_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues/events{/number}","events_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/events","assignees_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/assignees{/user}","branches_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/branches{/branch}","tags_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/tags","blobs_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/statuses/{sha}","languages_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/languages","stargazers_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/stargazers","contributors_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/contributors","subscribers_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/subscribers","subscription_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/subscription","commits_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/contents/{+path}","compare_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/merges","archive_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/downloads","issues_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues{/number}","pulls_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls{/number}","milestones_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/milestones{/number}","notifications_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/labels{/name}","releases_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/releases{/id}","deployments_url":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/deployments","created_at":"2014-05-21T20:20:52Z","updated_at":"2016-01-28T17:32:19Z","pushed_at":"2016-02-09T12:50:59Z","git_url":"git://github.com/sphereio/commercetools-sunrise-java.git","ssh_url":"git@github.com:sphereio/commercetools-sunrise-java.git","clone_url":"https://github.com/sphereio/commercetools-sunrise-java.git","svn_url":"https://github.com/sphereio/commercetools-sunrise-java","homepage":"https://sunrise.commercetools.com","size":15170,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":65,"forks":5,"open_issues":65,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/285"},"html":{"href":"https://github.com/sphereio/commercetools-sunrise-java/pull/285"},"issue":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues/285"},"comments":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/issues/285/comments"},"review_comments":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/285/comments"},"review_comment":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/pulls/285/commits"},"statuses":{"href":"https://api.github.com/repos/sphereio/commercetools-sunrise-java/statuses/2d5e62cc246bf81724c5f8567557629b8e907aeb"}}}}