From 2ccfc3f6c2095c115c6ed3b5b1d6f575b9bc3ce7 Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 29 May 2016 11:33:07 -0400 Subject: [PATCH] Tweak docs:generate warning --- lib/tasks/docs.thor | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/tasks/docs.thor b/lib/tasks/docs.thor index 86882a86..6f13a347 100644 --- a/lib/tasks/docs.thor +++ b/lib/tasks/docs.thor @@ -62,23 +62,25 @@ class DocsCLI < Thor Docs.install_report :scraper if options[:debug] Docs.install_report :progress_bar, :doc if $stdout.tty? - unless options[:force] + require 'unix_utils' if options[:package] + + doc = Docs.find(name, options[:version]) + + if doc < Docs::UrlScraper && !options[:force] puts <<-TEXT.strip_heredoc - Note: this command will scrape the documentation from the source. - Some scrapers require a local setup. Others will send thousands of - HTTP requests, potentially slowing down the source site. - Please don't use it unless you are modifying the code. + /!\\ WARNING /!\\ + + Some scrapers send thousands of HTTP requests in a short period of time, + which can slow down the source site and trouble its maintainers. - To download the latest tested version of a documentation, use: - thor docs:download #{name}\n + Please scrape responsibly. Don't do it unless you're modifying the code. + + To download the latest tested version of this documentation, run: + thor docs:download #{name}\n TEXT return unless yes? 'Proceed? (y/n)' end - require 'unix_utils' if options[:package] - - doc = Docs.find(name, options[:version]) - result = if doc.version && options[:all] doc.superclass.versions.all? do |_doc| puts "==> #{_doc.version}"