From 1f9ef63e9cf64324ca0760c967e8ef716173185a Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 24 Jan 2016 11:14:30 -0500 Subject: [PATCH] Add 'docs:upload' command --- lib/tasks/docs.thor | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/tasks/docs.thor b/lib/tasks/docs.thor index e304b5f7..46118bed 100644 --- a/lib/tasks/docs.thor +++ b/lib/tasks/docs.thor @@ -134,6 +134,19 @@ class DocsCLI < Thor puts 'Done' end + desc 'upload', '[private]' + option :dryrun, type: :boolean + def upload(*names) + docs = find_docs(names) + assert_docs(docs) + docs.each do |doc| + puts "Syncing #{doc.path}..." + cmd = "aws s3 sync #{File.join(Docs.store_path, doc.path)} s3://docs.devdocs.io/#{doc.path} --delete" + cmd << ' --dryrun' if options[:dryrun] + system(cmd) + end + end + private def find_docs(names)