{"action":"created","comment":{"url":"https://api.github.com/repos/acquia/moonshot/pulls/comments/81880833","pull_request_review_id":2828642,"id":81880833,"diff_hunk":"@@ -0,0 +1,108 @@\n+require 'thor'\n+\n+module Moonshot\n+  # This class implements the command-line `moonshot` tool.\n+  class CommandLine\n+    # TODO: No reason this is class-level, make this a for-real class that needs to be initialized.\n+    def self.run!\n+      # Find the Moonfile in this project.\n+      orig_dir = Dir.pwd\n+\n+      loop do\n+        break if File.exist?('Moonfile')\n+\n+        if Dir.pwd == '/'\n+          warn 'Could not find Moonfile!'\n+          exit 1\n+        else\n+          Dir.chdir('..')\n+        end\n+      end\n+\n+      moonfile_dir = Dir.pwd\n+      Dir.chdir(orig_dir)\n+\n+      # Load any plugins and CLI extensions relative to the Moonfile\n+      if File.directory?(File.join(moonfile_dir, 'moonshot'))\n+        load_cli_extensions(moonfile_dir)\n+        load_plugins(moonfile_dir)\n+      end\n+\n+      Object.include(Moonshot::ArtifactRepository)\n+      Object.include(Moonshot::BuildMechanism)\n+      Object.include(Moonshot::DeploymentMechanism)\n+      load(File.join(moonfile_dir, 'Moonfile'))\n+\n+      load_commands\n+\n+      # Determine what command is being run, which should be the first argument.\n+      command = ARGV.shift\n+      usage if %w[--help -h help].include?(command) or command.nil?\n+\n+      # Dispatch to that command, by executing it's parser, then\n+      # comparing ARGV to the execute methods arity.\n+      unless @commands.key?(command)\n+        warn \"Command not found: #{command}\"\n+        warn \"\\n\"\n+        usage\n+      end\n+\n+      handler = @commands[command].new\n+      handler.parser.parse!\n+\n+      unless ARGV.size == handler.method(:execute).arity\n+        warn handler.parser.help\n+        exit 1\n+      end\n+\n+      handler.execute(*ARGV)\n+    end\n+\n+    def self.register(klass)\n+      @classes ||= []\n+      @classes << klass\n+    end\n+\n+    def self.registered_commands\n+      @classes || []\n+    end\n+\n+    def self.load_plugins(moonfile_dir)\n+      plugins_path = File.join(moonfile_dir, 'moonshot', 'plugins', '**', '*.rb')\n+      Dir.glob(plugins_path).each do |file|\n+        load(file)\n+      end\n+    end\n+\n+    def self.load_cli_extensions(moonfile_dir)\n+      cli_extensions_path = File.join(moonfile_dir, 'moonshot', 'cli_extensions', '**', '*.rb')\n+      Dir.glob(cli_extensions_path).each do |file|\n+        load(file)\n+      end\n+    end\n+\n+    def self.usage\n+      warn \"Usage: moonshot [command]\"\n+      warn\n+      warn \"Valid commands include:\"\n+      @commands.each do |c, k|\n+        warn \"#{c} #{k.description}\"\n+      end\n+      exit 1\n+    end\n+\n+    def self.load_commands\n+      @commands = {}\n+\n+      # Include all Moonshot::Command and Moonshot::SSHCommand\n+      # derived classes as subcommands, with the description of their\n+      # default task.\n+      registered_commands.each do |klass|\n+        next unless klass.instance_methods.include?(:execute)\n+\n+        command_name = klass.to_s.split('::').last.scan(/[A-Z][a-z]+/).map(&:downcase).join('-')","path":"lib/moonshot/command_line.rb","position":null,"original_position":103,"commit_id":"2ebff0e2d4669551e0a50ce195854502e6823272","original_commit_id":"d8c79385bc0f9afa3839b0ad559b04dd2524d78e","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":"Addressed in the last patch. `S3BucketSSLUploader` now works as expected. :-)","created_at":"2016-10-05T00:16:17Z","updated_at":"2016-10-05T00:16:17Z","html_url":"https://github.com/acquia/moonshot/pull/139#discussion_r81880833","pull_request_url":"https://api.github.com/repos/acquia/moonshot/pulls/139","_links":{"self":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/comments/81880833"},"html":{"href":"https://github.com/acquia/moonshot/pull/139#discussion_r81880833"},"pull_request":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/139"}}},"pull_request":{"url":"https://api.github.com/repos/acquia/moonshot/pulls/139","id":87814916,"html_url":"https://github.com/acquia/moonshot/pull/139","diff_url":"https://github.com/acquia/moonshot/pull/139.diff","patch_url":"https://github.com/acquia/moonshot/pull/139.patch","issue_url":"https://api.github.com/repos/acquia/moonshot/issues/139","number":139,"state":"open","locked":false,"title":"[WIP] Moonshot 1.0.0 - multiple features.","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":"This is the starting point for a number of discussions and issues. I'm starting to wonder how much value we're getting out of Thor and if stdlib's OptionParser is a better use of our time.\r\n\r\nLooking for some early feedback on these changes.","created_at":"2016-10-04T00:14:26Z","updated_at":"2016-10-05T00:16:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"29925a6a2407b652bd737b938dee0e28a816a50b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/acquia/moonshot/pulls/139/commits","review_comments_url":"https://api.github.com/repos/acquia/moonshot/pulls/139/comments","review_comment_url":"https://api.github.com/repos/acquia/moonshot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/acquia/moonshot/issues/139/comments","statuses_url":"https://api.github.com/repos/acquia/moonshot/statuses/2ebff0e2d4669551e0a50ce195854502e6823272","head":{"label":"acquia:MoonshotCLI","ref":"MoonshotCLI","sha":"2ebff0e2d4669551e0a50ce195854502e6823272","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-09-23T07:34:27Z","pushed_at":"2016-10-05T00:15:58Z","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":326,"stargazers_count":41,"watchers_count":41,"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":41,"default_branch":"master"}},"base":{"label":"acquia:master","ref":"master","sha":"96a05e7402338370fcb6763b354984c40aeb6eb8","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-09-23T07:34:27Z","pushed_at":"2016-10-05T00:15:58Z","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":326,"stargazers_count":41,"watchers_count":41,"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":41,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/139"},"html":{"href":"https://github.com/acquia/moonshot/pull/139"},"issue":{"href":"https://api.github.com/repos/acquia/moonshot/issues/139"},"comments":{"href":"https://api.github.com/repos/acquia/moonshot/issues/139/comments"},"review_comments":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/139/comments"},"review_comment":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/acquia/moonshot/pulls/139/commits"},"statuses":{"href":"https://api.github.com/repos/acquia/moonshot/statuses/2ebff0e2d4669551e0a50ce195854502e6823272"}}}}
{"actor":{"display_login":"askreet"}}