{"action":"created","comment":{"url":"https://api.github.com/repos/acquia/moonshot/pulls/comments/83223417","pull_request_review_id":4078794,"id":83223417,"diff_hunk":"@@ -0,0 +1,82 @@\n+module Moonshot\n+  module Commands\n+    class New < Moonshot::Command\n+      self.usage = 'new [options]'\n+      self.description = 'Creates a new Moonshot project.'\n+\n+      DEFAULT_DIRECTORY = File.join(__dir__, '..', '..', 'default').freeze\n+\n+      def execute\n+        warn 'Looks like your project is already set up!'\n+      end\n+\n+      class << self\n+        def run!(application_name)\n+          @application_name = application_name\n+\n+          create_project_dir\n+          copy_defaults\n+          create_file(parameter_path)\n+          create_file(template_path)\n+          fill_moonfile\n+        end\n+\n+        private\n+\n+        def cwd\n+          Dir.pwd\n+        end\n+\n+        def create_project_dir\n+          raise \"Directory '#{@application_name}' already exists!\" \\\n+            if Dir.exist?(project_path)\n+          Dir.mkdir(project_path)\n+        end\n+\n+        def project_path\n+          @project_path ||= File.join(cwd, @application_name)\n+        end\n+\n+        def copy_defaults\n+          target_path = File.join(DEFAULT_DIRECTORY.dup, '.')\n+          FileUtils.cp_r(target_path, project_path)\n+        end\n+\n+        def create_file(path)\n+          FileUtils.touch(path)\n+        end\n+\n+        def moonfile_path\n+          File.join(project_path, 'Moonfile.rb')\n+        end\n+\n+        def parameter_path\n+          File.join(cf_dir, 'parameters', \"#{@application_name}.yml\")\n+        end\n+\n+        def template_path\n+          File.join(cf_dir, \"#{@application_name}.json\")\n+        end\n+\n+        def cf_dir\n+          File.join(project_path, 'cloud_formation')\n+        end\n+\n+        def fill_moonfile\n+          File.open(moonfile_path, 'w') { |f| f.write generate_moonfile }\n+        end\n+\n+        def generate_moonfile\n+          <<-EOF\n+Moonshot.config do |m|\n+  m.app_name = '#{@application_name}'\n+  m.artifact_repository = S3Bucket.new('<your_bucket>')\n+  m.build_mechanism = Script.new('bin/build.sh')\n+  m.deployment_mechanism = CodeDeploy.new(asg: 'AutoScalingGroup')\n+end\n+        \tEOF","path":"lib/moonshot/commands/new.rb","position":77,"original_position":77,"commit_id":"0a7110c607ca33523ede7ca3dbfafd2f6e7fd65d","original_commit_id":"0a7110c607ca33523ede7ca3dbfafd2f6e7fd65d","user":{"login":"askreet","id":662824,"avatar_url":"https://avatars.githubusercontent.com/u/662824?v=3","gravatar_id":"","url":"https://api.github.com/users/askreet","html_url":"https://github.com/askreet","followers_url":"https://api.github.com/users/askreet/followers","following_url":"https://api.github.com/users/askreet/following{/other_user}","gists_url":"https://api.github.com/users/askreet/gists{/gist_id}","starred_url":"https://api.github.com/users/askreet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/askreet/subscriptions","organizations_url":"https://api.github.com/users/askreet/orgs","repos_url":"https://api.github.com/users/askreet/repos","events_url":"https://api.github.com/users/askreet/events{/privacy}","received_events_url":"https://api.github.com/users/askreet/received_events","type":"User","site_admin":false},"body":"Odd spacing here.","created_at":"2016-10-13T14:04:52Z","updated_at":"2016-10-13T14:04:52Z","html_url":"https://github.com/acquia/moonshot/pull/150#discussion_r83223417","pull_request_url":"https://api.github.com/repos/acquia/moonshot/pulls/150","_links":{"self":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/comments/83223417"},"html":{"href":"https://github.com/acquia/moonshot/pull/150#discussion_r83223417"},"pull_request":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/150"}}},"pull_request":{"url":"https://api.github.com/repos/acquia/moonshot/pulls/150","id":89111115,"html_url":"https://github.com/acquia/moonshot/pull/150","diff_url":"https://github.com/acquia/moonshot/pull/150.diff","patch_url":"https://github.com/acquia/moonshot/pull/150.patch","issue_url":"https://api.github.com/repos/acquia/moonshot/issues/150","number":150,"state":"open","locked":false,"title":"Introduced 'new' command.","user":{"login":"borsothy","id":1119941,"avatar_url":"https://avatars.githubusercontent.com/u/1119941?v=3","gravatar_id":"","url":"https://api.github.com/users/borsothy","html_url":"https://github.com/borsothy","followers_url":"https://api.github.com/users/borsothy/followers","following_url":"https://api.github.com/users/borsothy/following{/other_user}","gists_url":"https://api.github.com/users/borsothy/gists{/gist_id}","starred_url":"https://api.github.com/users/borsothy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/borsothy/subscriptions","organizations_url":"https://api.github.com/users/borsothy/orgs","repos_url":"https://api.github.com/users/borsothy/repos","events_url":"https://api.github.com/users/borsothy/events{/privacy}","received_events_url":"https://api.github.com/users/borsothy/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-12T23:13:53Z","updated_at":"2016-10-13T14:36:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e11f816c93cec80f370e0d2dc3d1fe80cfccb671","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/acquia/moonshot/pulls/150/commits","review_comments_url":"https://api.github.com/repos/acquia/moonshot/pulls/150/comments","review_comment_url":"https://api.github.com/repos/acquia/moonshot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/acquia/moonshot/issues/150/comments","statuses_url":"https://api.github.com/repos/acquia/moonshot/statuses/0a7110c607ca33523ede7ca3dbfafd2f6e7fd65d","head":{"label":"borsothy:NewCommand","ref":"NewCommand","sha":"0a7110c607ca33523ede7ca3dbfafd2f6e7fd65d","user":{"login":"borsothy","id":1119941,"avatar_url":"https://avatars.githubusercontent.com/u/1119941?v=3","gravatar_id":"","url":"https://api.github.com/users/borsothy","html_url":"https://github.com/borsothy","followers_url":"https://api.github.com/users/borsothy/followers","following_url":"https://api.github.com/users/borsothy/following{/other_user}","gists_url":"https://api.github.com/users/borsothy/gists{/gist_id}","starred_url":"https://api.github.com/users/borsothy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/borsothy/subscriptions","organizations_url":"https://api.github.com/users/borsothy/orgs","repos_url":"https://api.github.com/users/borsothy/repos","events_url":"https://api.github.com/users/borsothy/events{/privacy}","received_events_url":"https://api.github.com/users/borsothy/received_events","type":"User","site_admin":false},"repo":{"id":59117799,"name":"moonshot","full_name":"borsothy/moonshot","owner":{"login":"borsothy","id":1119941,"avatar_url":"https://avatars.githubusercontent.com/u/1119941?v=3","gravatar_id":"","url":"https://api.github.com/users/borsothy","html_url":"https://github.com/borsothy","followers_url":"https://api.github.com/users/borsothy/followers","following_url":"https://api.github.com/users/borsothy/following{/other_user}","gists_url":"https://api.github.com/users/borsothy/gists{/gist_id}","starred_url":"https://api.github.com/users/borsothy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/borsothy/subscriptions","organizations_url":"https://api.github.com/users/borsothy/orgs","repos_url":"https://api.github.com/users/borsothy/repos","events_url":"https://api.github.com/users/borsothy/events{/privacy}","received_events_url":"https://api.github.com/users/borsothy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/borsothy/moonshot","description":"Moonshot: Because releasing services shouldn't be a moonshot!","fork":true,"url":"https://api.github.com/repos/borsothy/moonshot","forks_url":"https://api.github.com/repos/borsothy/moonshot/forks","keys_url":"https://api.github.com/repos/borsothy/moonshot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/borsothy/moonshot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/borsothy/moonshot/teams","hooks_url":"https://api.github.com/repos/borsothy/moonshot/hooks","issue_events_url":"https://api.github.com/repos/borsothy/moonshot/issues/events{/number}","events_url":"https://api.github.com/repos/borsothy/moonshot/events","assignees_url":"https://api.github.com/repos/borsothy/moonshot/assignees{/user}","branches_url":"https://api.github.com/repos/borsothy/moonshot/branches{/branch}","tags_url":"https://api.github.com/repos/borsothy/moonshot/tags","blobs_url":"https://api.github.com/repos/borsothy/moonshot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/borsothy/moonshot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/borsothy/moonshot/git/refs{/sha}","trees_url":"https://api.github.com/repos/borsothy/moonshot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/borsothy/moonshot/statuses/{sha}","languages_url":"https://api.github.com/repos/borsothy/moonshot/languages","stargazers_url":"https://api.github.com/repos/borsothy/moonshot/stargazers","contributors_url":"https://api.github.com/repos/borsothy/moonshot/contributors","subscribers_url":"https://api.github.com/repos/borsothy/moonshot/subscribers","subscription_url":"https://api.github.com/repos/borsothy/moonshot/subscription","commits_url":"https://api.github.com/repos/borsothy/moonshot/commits{/sha}","git_commits_url":"https://api.github.com/repos/borsothy/moonshot/git/commits{/sha}","comments_url":"https://api.github.com/repos/borsothy/moonshot/comments{/number}","issue_comment_url":"https://api.github.com/repos/borsothy/moonshot/issues/comments{/number}","contents_url":"https://api.github.com/repos/borsothy/moonshot/contents/{+path}","compare_url":"https://api.github.com/repos/borsothy/moonshot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/borsothy/moonshot/merges","archive_url":"https://api.github.com/repos/borsothy/moonshot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/borsothy/moonshot/downloads","issues_url":"https://api.github.com/repos/borsothy/moonshot/issues{/number}","pulls_url":"https://api.github.com/repos/borsothy/moonshot/pulls{/number}","milestones_url":"https://api.github.com/repos/borsothy/moonshot/milestones{/number}","notifications_url":"https://api.github.com/repos/borsothy/moonshot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/borsothy/moonshot/labels{/name}","releases_url":"https://api.github.com/repos/borsothy/moonshot/releases{/id}","deployments_url":"https://api.github.com/repos/borsothy/moonshot/deployments","created_at":"2016-05-18T13:25:25Z","updated_at":"2016-05-18T13:25:26Z","pushed_at":"2016-10-13T11:54:37Z","git_url":"git://github.com/borsothy/moonshot.git","ssh_url":"git@github.com:borsothy/moonshot.git","clone_url":"https://github.com/borsothy/moonshot.git","svn_url":"https://github.com/borsothy/moonshot","homepage":null,"size":306,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"acquia:master","ref":"master","sha":"1dcc75fdbd8be7e9d5b07c9b7513a3df45d2bd1b","user":{"login":"acquia","id":514789,"avatar_url":"https://avatars.githubusercontent.com/u/514789?v=3","gravatar_id":"","url":"https://api.github.com/users/acquia","html_url":"https://github.com/acquia","followers_url":"https://api.github.com/users/acquia/followers","following_url":"https://api.github.com/users/acquia/following{/other_user}","gists_url":"https://api.github.com/users/acquia/gists{/gist_id}","starred_url":"https://api.github.com/users/acquia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquia/subscriptions","organizations_url":"https://api.github.com/users/acquia/orgs","repos_url":"https://api.github.com/users/acquia/repos","events_url":"https://api.github.com/users/acquia/events{/privacy}","received_events_url":"https://api.github.com/users/acquia/received_events","type":"Organization","site_admin":false},"repo":{"id":53524088,"name":"moonshot","full_name":"acquia/moonshot","owner":{"login":"acquia","id":514789,"avatar_url":"https://avatars.githubusercontent.com/u/514789?v=3","gravatar_id":"","url":"https://api.github.com/users/acquia","html_url":"https://github.com/acquia","followers_url":"https://api.github.com/users/acquia/followers","following_url":"https://api.github.com/users/acquia/following{/other_user}","gists_url":"https://api.github.com/users/acquia/gists{/gist_id}","starred_url":"https://api.github.com/users/acquia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acquia/subscriptions","organizations_url":"https://api.github.com/users/acquia/orgs","repos_url":"https://api.github.com/users/acquia/repos","events_url":"https://api.github.com/users/acquia/events{/privacy}","received_events_url":"https://api.github.com/users/acquia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/acquia/moonshot","description":"Moonshot: Because releasing services shouldn't be a moonshot!","fork":false,"url":"https://api.github.com/repos/acquia/moonshot","forks_url":"https://api.github.com/repos/acquia/moonshot/forks","keys_url":"https://api.github.com/repos/acquia/moonshot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/acquia/moonshot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/acquia/moonshot/teams","hooks_url":"https://api.github.com/repos/acquia/moonshot/hooks","issue_events_url":"https://api.github.com/repos/acquia/moonshot/issues/events{/number}","events_url":"https://api.github.com/repos/acquia/moonshot/events","assignees_url":"https://api.github.com/repos/acquia/moonshot/assignees{/user}","branches_url":"https://api.github.com/repos/acquia/moonshot/branches{/branch}","tags_url":"https://api.github.com/repos/acquia/moonshot/tags","blobs_url":"https://api.github.com/repos/acquia/moonshot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/acquia/moonshot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/acquia/moonshot/git/refs{/sha}","trees_url":"https://api.github.com/repos/acquia/moonshot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/acquia/moonshot/statuses/{sha}","languages_url":"https://api.github.com/repos/acquia/moonshot/languages","stargazers_url":"https://api.github.com/repos/acquia/moonshot/stargazers","contributors_url":"https://api.github.com/repos/acquia/moonshot/contributors","subscribers_url":"https://api.github.com/repos/acquia/moonshot/subscribers","subscription_url":"https://api.github.com/repos/acquia/moonshot/subscription","commits_url":"https://api.github.com/repos/acquia/moonshot/commits{/sha}","git_commits_url":"https://api.github.com/repos/acquia/moonshot/git/commits{/sha}","comments_url":"https://api.github.com/repos/acquia/moonshot/comments{/number}","issue_comment_url":"https://api.github.com/repos/acquia/moonshot/issues/comments{/number}","contents_url":"https://api.github.com/repos/acquia/moonshot/contents/{+path}","compare_url":"https://api.github.com/repos/acquia/moonshot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/acquia/moonshot/merges","archive_url":"https://api.github.com/repos/acquia/moonshot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/acquia/moonshot/downloads","issues_url":"https://api.github.com/repos/acquia/moonshot/issues{/number}","pulls_url":"https://api.github.com/repos/acquia/moonshot/pulls{/number}","milestones_url":"https://api.github.com/repos/acquia/moonshot/milestones{/number}","notifications_url":"https://api.github.com/repos/acquia/moonshot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/acquia/moonshot/labels{/name}","releases_url":"https://api.github.com/repos/acquia/moonshot/releases{/id}","deployments_url":"https://api.github.com/repos/acquia/moonshot/deployments","created_at":"2016-03-09T19:06:23Z","updated_at":"2016-10-05T16:53:08Z","pushed_at":"2016-10-13T11:54:38Z","git_url":"git://github.com/acquia/moonshot.git","ssh_url":"git@github.com:acquia/moonshot.git","clone_url":"https://github.com/acquia/moonshot.git","svn_url":"https://github.com/acquia/moonshot","homepage":null,"size":336,"stargazers_count":42,"watchers_count":42,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":48,"forks":18,"open_issues":48,"watchers":42,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/150"},"html":{"href":"https://github.com/acquia/moonshot/pull/150"},"issue":{"href":"https://api.github.com/repos/acquia/moonshot/issues/150"},"comments":{"href":"https://api.github.com/repos/acquia/moonshot/issues/150/comments"},"review_comments":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/150/comments"},"review_comment":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/150/commits"},"statuses":{"href":"https://api.github.com/repos/acquia/moonshot/statuses/0a7110c607ca33523ede7ca3dbfafd2f6e7fd65d"}}}}
{"actor":{"display_login":"askreet"}}