{"action":"created","comment":{"url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/comments/38484363","id":38484363,"diff_hunk":"@@ -0,0 +1,107 @@\n+#!/usr/bin/env ruby\n+require 'optparse'\n+require 'docker/registry/sync'\n+\n+include Docker::Registry::Sync\n+\n+def verify_opts(opts, command)\n+  source_defined = !opts[:source_bucket].nil?\n+  dest_defined = !opts[:target_buckets].nil?\n+  queue_defined = !opts[:sqs_queue].nil?\n+  if command == 'sync'\n+    source_defined && dest_defined\n+  elsif command == 'queue-sync'\n+    source_defined && dest_defined && queue_defined\n+  elsif command == 'run-sync'\n+    queue_defined\n+  else\n+    false\n+  end\n+end\n+\n+options = {}\n+opt_parser = OptionParser.new do |opts|\n+  opts.banner = <<EOC\n+docker-registry-sync [options] sync <image>:<tag>\n+docker-registry-sync [options] queue-sync <image>:<tag>\n+docker-registry-sync [options] run-sync\n+\n+Available commands:\n+  sync -- Sync docker image from one source registry S3 bucket to one or more S3 buckets.\n+\n+Options:\n+EOC\n+  options[:source_bucket] = nil\n+  opts.on('-s SOUCE', '--source-bucket SOURCE', 'Primary docker registry S3 bucket. Pass as <region>:<bucket> [required]') do |b|\n+    options[:source_bucket] = b\n+  end\n+\n+  options[:target_buckets] = nil\n+  opts.on('-t TARGETS', '--target-buckets TARGETS', 'S3 buckets to sync to, comma separated. Pass as <region>:<bucket>[,<region>:<bucket>]  [required]') do |t|\n+    options[:target_buckets] = t\n+  end\n+\n+  options[:sqs_queue] = nil\n+  opts.on('-q SQS_QUEUE', '--queue SQS_QUEUE', 'SQS queue url used to enqueue sync job. Pass as <region>:<uri> (do not include schema) [required if using queue-sync or run-sync]') do |b|\n+    options[:sqs_queue] = b\n+  end\n+\n+  options[:unset_proxy] = false\n+  opts.on(nil, '--unset-proxy', \"Use if 'http_proxy' is set in your environment, but you don't want to use it...\") do |u|\n+    options[:unset_proxy] = true\n+  end\n+end\n+\n+opt_parser.version = VERSION\n+opt_parser.parse!\n+\n+cmd = ARGV[0]\n+unless !cmd.nil?\n+  puts \"Command must be supplied!\\n\\n\"\n+  puts opt_parser\n+  exit 1\n+end\n+\n+image = ARGV[1]\n+if image.nil? && !['queue-sync', 'run-sync'].include?(cmd)\n+  puts \"Image and tag to sync must be supplied!\\n\\n\"\n+  puts opt_parser\n+  exit 1\n+end\n+\n+if options[:unset_proxy]\n+  ENV['http_proxy'] = nil\n+end\n+\n+unless verify_opts(options, cmd)\n+  puts \"Both '--source-bucket' and '--target-buckets' must be defined for 'sync' and 'queue-sync' commands\\n\"\n+  puts \"'--queue' must be defined for 'queue-sync' and 'run-sync' commands\\n\\n\"\n+  puts opt_parser\n+  exit 1\n+end\n+\n+CMD.configure(\n+    options[:source_bucket],","path":"bin/docker-registry-sync","position":84,"original_position":84,"commit_id":"751ed29b7a30212de4da5e4d3dd665602cf7d340","original_commit_id":"751ed29b7a30212de4da5e4d3dd665602cf7d340","user":{"login":"rantler","id":73775,"avatar_url":"https://avatars.githubusercontent.com/u/73775?v=3","gravatar_id":"","url":"https://api.github.com/users/rantler","html_url":"https://github.com/rantler","followers_url":"https://api.github.com/users/rantler/followers","following_url":"https://api.github.com/users/rantler/following{/other_user}","gists_url":"https://api.github.com/users/rantler/gists{/gist_id}","starred_url":"https://api.github.com/users/rantler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rantler/subscriptions","organizations_url":"https://api.github.com/users/rantler/orgs","repos_url":"https://api.github.com/users/rantler/repos","events_url":"https://api.github.com/users/rantler/events{/privacy}","received_events_url":"https://api.github.com/users/rantler/received_events","type":"User","site_admin":false},"body":"Lint: Indentation is off by one.","created_at":"2015-09-01T23:23:43Z","updated_at":"2015-09-01T23:23:43Z","html_url":"https://github.com/socrata-platform/docker-registry-sync/pull/2#discussion_r38484363","pull_request_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/comments/38484363"},"html":{"href":"https://github.com/socrata-platform/docker-registry-sync/pull/2#discussion_r38484363"},"pull_request":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/2","id":43936827,"html_url":"https://github.com/socrata-platform/docker-registry-sync/pull/2","diff_url":"https://github.com/socrata-platform/docker-registry-sync/pull/2.diff","patch_url":"https://github.com/socrata-platform/docker-registry-sync/pull/2.patch","issue_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues/2","number":2,"state":"open","locked":false,"title":"Initial version (0.1.0) of docker-registry-sync","user":{"login":"boldfield","id":441322,"avatar_url":"https://avatars.githubusercontent.com/u/441322?v=3","gravatar_id":"","url":"https://api.github.com/users/boldfield","html_url":"https://github.com/boldfield","followers_url":"https://api.github.com/users/boldfield/followers","following_url":"https://api.github.com/users/boldfield/following{/other_user}","gists_url":"https://api.github.com/users/boldfield/gists{/gist_id}","starred_url":"https://api.github.com/users/boldfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boldfield/subscriptions","organizations_url":"https://api.github.com/users/boldfield/orgs","repos_url":"https://api.github.com/users/boldfield/repos","events_url":"https://api.github.com/users/boldfield/events{/privacy}","received_events_url":"https://api.github.com/users/boldfield/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-01T22:58:49Z","updated_at":"2015-09-01T23:23:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e04c1836ce5e0a9cedac3f230eb38304e71339e2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/2/commits","review_comments_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/2/comments","review_comment_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/comments{/number}","comments_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues/2/comments","statuses_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/statuses/751ed29b7a30212de4da5e4d3dd665602cf7d340","head":{"label":"socrata-platform:initial-version","ref":"initial-version","sha":"751ed29b7a30212de4da5e4d3dd665602cf7d340","user":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars.githubusercontent.com/u/12076358?v=3","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":41767005,"name":"docker-registry-sync","full_name":"socrata-platform/docker-registry-sync","owner":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars.githubusercontent.com/u/12076358?v=3","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socrata-platform/docker-registry-sync","description":"Sync S3 Buckets backing Docker Registries","fork":false,"url":"https://api.github.com/repos/socrata-platform/docker-registry-sync","forks_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/forks","keys_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/teams","hooks_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/hooks","issue_events_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues/events{/number}","events_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/events","assignees_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/assignees{/user}","branches_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/branches{/branch}","tags_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/tags","blobs_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/refs{/sha}","trees_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/statuses/{sha}","languages_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/languages","stargazers_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/stargazers","contributors_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/contributors","subscribers_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/subscribers","subscription_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/subscription","commits_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/commits{/sha}","git_commits_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/commits{/sha}","comments_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/comments{/number}","issue_comment_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues/comments{/number}","contents_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/contents/{+path}","compare_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/merges","archive_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/downloads","issues_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues{/number}","pulls_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls{/number}","milestones_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/milestones{/number}","notifications_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/labels{/name}","releases_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/releases{/id}","created_at":"2015-09-01T22:36:16Z","updated_at":"2015-09-01T22:36:16Z","pushed_at":"2015-09-01T22:58:49Z","git_url":"git://github.com/socrata-platform/docker-registry-sync.git","ssh_url":"git@github.com:socrata-platform/docker-registry-sync.git","clone_url":"https://github.com/socrata-platform/docker-registry-sync.git","svn_url":"https://github.com/socrata-platform/docker-registry-sync","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"socrata-platform:master","ref":"master","sha":"6106d98bc85af32f373c062e564978e73e4eda5e","user":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars.githubusercontent.com/u/12076358?v=3","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"repo":{"id":41767005,"name":"docker-registry-sync","full_name":"socrata-platform/docker-registry-sync","owner":{"login":"socrata-platform","id":12076358,"avatar_url":"https://avatars.githubusercontent.com/u/12076358?v=3","gravatar_id":"","url":"https://api.github.com/users/socrata-platform","html_url":"https://github.com/socrata-platform","followers_url":"https://api.github.com/users/socrata-platform/followers","following_url":"https://api.github.com/users/socrata-platform/following{/other_user}","gists_url":"https://api.github.com/users/socrata-platform/gists{/gist_id}","starred_url":"https://api.github.com/users/socrata-platform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/socrata-platform/subscriptions","organizations_url":"https://api.github.com/users/socrata-platform/orgs","repos_url":"https://api.github.com/users/socrata-platform/repos","events_url":"https://api.github.com/users/socrata-platform/events{/privacy}","received_events_url":"https://api.github.com/users/socrata-platform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/socrata-platform/docker-registry-sync","description":"Sync S3 Buckets backing Docker Registries","fork":false,"url":"https://api.github.com/repos/socrata-platform/docker-registry-sync","forks_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/forks","keys_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/keys{/key_id}","collaborators_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/teams","hooks_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/hooks","issue_events_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues/events{/number}","events_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/events","assignees_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/assignees{/user}","branches_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/branches{/branch}","tags_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/tags","blobs_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/refs{/sha}","trees_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/trees{/sha}","statuses_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/statuses/{sha}","languages_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/languages","stargazers_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/stargazers","contributors_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/contributors","subscribers_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/subscribers","subscription_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/subscription","commits_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/commits{/sha}","git_commits_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/git/commits{/sha}","comments_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/comments{/number}","issue_comment_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues/comments{/number}","contents_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/contents/{+path}","compare_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/compare/{base}...{head}","merges_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/merges","archive_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/downloads","issues_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues{/number}","pulls_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls{/number}","milestones_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/milestones{/number}","notifications_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/labels{/name}","releases_url":"https://api.github.com/repos/socrata-platform/docker-registry-sync/releases{/id}","created_at":"2015-09-01T22:36:16Z","updated_at":"2015-09-01T22:36:16Z","pushed_at":"2015-09-01T22:58:49Z","git_url":"git://github.com/socrata-platform/docker-registry-sync.git","ssh_url":"git@github.com:socrata-platform/docker-registry-sync.git","clone_url":"https://github.com/socrata-platform/docker-registry-sync.git","svn_url":"https://github.com/socrata-platform/docker-registry-sync","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/2"},"html":{"href":"https://github.com/socrata-platform/docker-registry-sync/pull/2"},"issue":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues/2"},"comments":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/socrata-platform/docker-registry-sync/statuses/751ed29b7a30212de4da5e4d3dd665602cf7d340"}}}}