Update based on second round of feedback

This commit is contained in:
Brian Cain 2018-09-10 16:28:24 -07:00
parent d8ec19faa8
commit e8115a4389
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
30 changed files with 71 additions and 75 deletions

View File

@ -34,7 +34,6 @@ module Vagrant
redirect_notify = false
logger.info("download redirected to #{location}")
source_uri = URI.parse(source)
# TODO: shouldn't this be....`.first`?
source_host = source_uri.host.to_s.split(".", 2).last
location_host = location_uri.host.to_s.split(".", 2).last
if !redirect_notify && location_host != source_host && !SILENCED_HOSTS.include?(location_host)

View File

@ -13,15 +13,15 @@ module VagrantPlugins
o.separator ""
o.separator "Options:"
o.separator ""
o.on("-c", "--check", "Only checks if you're logged in") do |c|
o.on("-c", "--check", "Checks if currently logged in") do |c|
options[:check] = c
end
o.on("-d", "--description DESCRIPTION", String, "Description for the Vagrant Cloud token") do |d|
o.on("-d", "--description DESCRIPTION", String, "Set description for the Vagrant Cloud token") do |d|
options[:description] = d
end
o.on("-k", "--logout", "Logs you out if you're logged in") do |k|
o.on("-k", "--logout", "Logout from Vagrant Cloud") do |k|
options[:logout] = k
end
@ -29,7 +29,7 @@ module VagrantPlugins
options[:token] = t
end
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |l|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |l|
options[:login] = l
end
end

View File

@ -11,11 +11,11 @@ module VagrantPlugins
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant cloud auth logout [options]"
o.separator ""
o.separator "Logs you out if you're logged in locally."
o.separator "Log out of Vagrant Cloud"
o.separator ""
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |l|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |l|
options[:login] = l
end
end

View File

@ -4,7 +4,7 @@ module VagrantPlugins
module Command
class Root < Vagrant.plugin("2", :command)
def self.synopsis
"Manages everything authorization related to Vagrant Cloud"
"Manages Vagrant Cloud authorization related to Vagrant Cloud"
end
def initialize(argv, env)
@ -47,7 +47,7 @@ module VagrantPlugins
opts = OptionParser.new do |opts|
opts.banner = "Usage: vagrant cloud auth <subcommand> [<args>]"
opts.separator ""
opts.separator "Helper commands for authorization with Vagrant Cloud"
opts.separator "Authorization with Vagrant Cloud"
opts.separator ""
opts.separator "Available subcommands:"

View File

@ -11,11 +11,11 @@ module VagrantPlugins
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant cloud auth whoami [options] [token]"
o.separator ""
o.separator "Determine who you are logged in as"
o.separator "Display currently logged in user"
o.separator ""
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |l|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |l|
options[:login] = l
end
end
@ -28,7 +28,7 @@ module VagrantPlugins
help: opts.help.chomp
end
@client = VagrantPlugins::CloudCommand::Util.client_login(@env, options[:username])
@client = VagrantPlugins::CloudCommand::Util.client_login(@env, options[:login])
if argv.first
token = argv.first
@ -41,7 +41,7 @@ module VagrantPlugins
def whoami(access_token, username)
server_url = VagrantPlugins::CloudCommand::Util.api_server_url
account = VagrantPlugins::CloudCommand::Util.account?(username, access_token, server_url)
account = VagrantPlugins::CloudCommand::Util.account(username, access_token, server_url)
begin
success = account.validate_token

View File

@ -16,10 +16,10 @@ module VagrantPlugins
o.separator "Options:"
o.separator ""
o.on("-d", "--description DESCRIPTION", String, "Longer description of the box") do |d|
o.on("-d", "--description DESCRIPTION", String, "Full description of the box") do |d|
options[:description] = d
end
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
o.on("-s", "--short-description DESCRIPTION", String, "Short description of the box") do |s|

View File

@ -16,7 +16,7 @@ module VagrantPlugins
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -6,7 +6,7 @@ module VagrantPlugins
class Plugin < Vagrant.plugin("2")
name "vagrant cloud box"
description <<-DESC
Box CRUD commands for Vagrant Cloud
Box life cycle commands for Vagrant Cloud
DESC
command(:box) do

View File

@ -16,7 +16,7 @@ module VagrantPlugins
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |u|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |u|
options[:username] = u
end
o.on("--versions VERSION", String, "Display box information for a specific version") do |v|

View File

@ -16,7 +16,7 @@ module VagrantPlugins
o.separator "Options:"
o.separator ""
o.on("-d", "--description DESCRIPTION", "Longer description of the box") do |d|
o.on("-d", "--description DESCRIPTION", "Full description of the box") do |d|
options[:description] = d
end
o.on("-u", "--username", "The username of the organization that will own the box") do |u|

View File

@ -10,7 +10,7 @@ module VagrantPlugins
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant cloud list [options] organization"
o.separator ""
o.separator "Search for boxes managed by a specific user"
o.separator "Search for boxes managed by a specific user/organization"
o.separator ""
o.separator "Options:"
o.separator ""
@ -21,13 +21,13 @@ module VagrantPlugins
o.on("-l", "--limit", Integer, "Max number of search results (default is 25)") do |l|
options[:check] = l
end
o.on("-p", "--provider", "Comma separated list of providers to filter search on. Defaults to all.") do |p|
o.on("-p", "--provider", "Comma separated list of providers to filter search. Defaults to all.") do |p|
options[:check] = p
end
o.on("-s", "--sort-by", "Column to sort list (created, downloads, updated)") do |s|
options[:check] = s
end
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -54,7 +54,7 @@ en:
You will need to run the `vagrant cloud provider upload` command to provide a box
provider:
upload: |-
Uploading box file for '%{org}/%{box_name}' v(%{version}) for provider: '%{provider}'
Uploading box file for '%{org}/%{box_name}' (v%{version}) for provider: '%{provider}'
upload_success: |-
Uploaded provider %{provider} on %{org}/%{box_name} for version %{version}
delete_warn: |-

View File

@ -16,7 +16,7 @@ module VagrantPlugins
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -16,7 +16,7 @@ module VagrantPlugins
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -6,7 +6,7 @@ module VagrantPlugins
class Plugin < Vagrant.plugin("2")
name "vagrant cloud box"
description <<-DESC
Provider CRUD commands for Vagrant Cloud
Provider life cycle commands for Vagrant Cloud
DESC
command(:provider) do

View File

@ -16,7 +16,7 @@ module VagrantPlugins
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -17,7 +17,7 @@ module VagrantPlugins
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -11,7 +11,7 @@ module VagrantPlugins
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant cloud publish [options] organization/box-name version provider-name [provider-file]"
o.separator ""
o.separator "A Start-To-Finish command for creating and releasing a new Vagrant Box on Vagrant Cloud"
o.separator "Create and release a new Vagrant Box on Vagrant Cloud"
o.separator ""
o.separator "Options:"
o.separator ""
@ -19,10 +19,10 @@ module VagrantPlugins
o.on("--box-version VERSION", String, "Version of box to create") do |v|
options[:box_version] = v
end
o.on("--url URL", String, "Valid remote URL to download this provider") do |u|
o.on("--url URL", String, "Remote URL to download this provider") do |u|
options[:url] = u
end
o.on("-d", "--description DESCRIPTION", String, "Longer description of box") do |d|
o.on("-d", "--description DESCRIPTION", String, "Full description of box") do |d|
options[:description] = d
end
o.on("--version-description DESCRIPTION", String, "Description of the version to create") do |v|
@ -40,7 +40,7 @@ module VagrantPlugins
o.on("-s", "--short-description DESCRIPTION", String, "Short description of the box") do |s|
options[:short_description] = s
end
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -48,7 +48,7 @@ module VagrantPlugins
require File.expand_path("../publish", __FILE__)
Publish
end
@subcommand_helptext[:publish] = "A start-to-finish solution for creating or updating a new box on Vagrant Cloud"
@subcommand_helptext[:publish] = "A complete solution for creating or updating a new box on Vagrant Cloud"
@subcommands.register(:version) do
require File.expand_path("../version/root", __FILE__)

View File

@ -10,7 +10,8 @@ module VagrantPlugins
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant cloud search [options] query"
o.separator ""
o.separator "Search for a box on Vagrant Cloud"
o.separator "Search for boxes managed by a specific"
o.separator "user/organization on Vagrant Cloud"
o.separator ""
o.separator "Options:"
o.separator ""
@ -36,7 +37,7 @@ module VagrantPlugins
o.on("--sort-by SORT", "Field to sort results on (created, downloads, updated) Default: downloads") do |s|
options[:sort] = s
end
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -38,25 +38,23 @@ module VagrantPlugins
end
# Ask for the username
if @_client.username_or_email
if options[:login]
@_client.username_or_email = options[:login]
env.ui.output("Vagrant Cloud username or email: #{@_client.username_or_email}")
end
until @_client.username_or_email
else
@_client.username_or_email = env.ui.ask("Vagrant Cloud username or email: ")
end
until @_client.password
@_client.password = env.ui.ask("Password (will be hidden): ", echo: false)
@_client.password = env.ui.ask("Password (will be hidden): ", echo: false)
description_default = "Vagrant login from #{Socket.gethostname}"
if !options[:description]
description = env.ui.ask("Token description (Defaults to #{description_default.inspect}): ")
else
description = options[:description]
env.ui.output("Token description: #{description}")
end
if options
description = options[:description]
end
description_default = "Vagrant login from #{Socket.gethostname}"
until description
description =
env.ui.ask("Token description (Defaults to #{description_default.inspect}): ")
end
description = description_default if description.empty?
code = nil

View File

@ -19,7 +19,7 @@ module VagrantPlugins
o.on("-d", "--description DESCRIPTION", String, "A description for this version") do |d|
options[:description] = d
end
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -15,7 +15,7 @@ module VagrantPlugins
o.separator ""
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -6,7 +6,7 @@ module VagrantPlugins
class Plugin < Vagrant.plugin("2")
name "vagrant cloud version"
description <<-DESC
Version CRUD commands for Vagrant Cloud
Version life cycle commands for Vagrant Cloud
DESC
command(:version) do

View File

@ -15,7 +15,7 @@ module VagrantPlugins
o.separator ""
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -15,7 +15,7 @@ module VagrantPlugins
o.separator ""
o.separator "Options:"
o.separator ""
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -55,7 +55,7 @@ module VagrantPlugins
opts = OptionParser.new do |opts|
opts.banner = "Usage: vagrant cloud version <subcommand> [<args>]"
opts.separator ""
opts.separator "For taking various actions against a Vagrant boxes version attribute on Vagrant Cloud"
opts.separator "For taking various actions against a Vagrant box's version attribute on Vagrant Cloud"
opts.separator ""
opts.separator "Available subcommands:"

View File

@ -19,7 +19,7 @@ module VagrantPlugins
o.on("-d", "--description DESCRIPTION", "A description for this version") do |d|
options[:description] = d
end
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Specify your Vagrant Cloud username or email address") do |t|
o.on("-u", "--username USERNAME_OR_EMAIL", String, "Vagrant Cloud username or email address") do |t|
options[:username] = u
end
end

View File

@ -24,7 +24,7 @@ describe VagrantPlugins::CloudCommand::AuthCommand::Command::Whoami do
allow(iso_env).to receive(:action_runner).and_return(action_runner)
allow(VagrantPlugins::CloudCommand::Util).to receive(:client_login).
and_return(client)
allow(VagrantPlugins::CloudCommand::Util).to receive(:account?).
allow(VagrantPlugins::CloudCommand::Util).to receive(:account).
and_return(account)
end

View File

@ -13,7 +13,7 @@ description: |-
This is the command used to manage anything related to [Vagrant Cloud](https://vagrantcloud.com)
The main functionality of this command is exposed via even more subcommands:
The main functionality of this command is exposed via subcommands:
* [`auth`](#cloud-auth)
* [`box`](#cloud-box)
@ -34,14 +34,12 @@ The main functionality of this command is exposed via even more subcommands:
**Command: `vagrant cloud auth login`**
The login command is used to authenticate with the
[HashiCorp's Vagrant Cloud](/docs/vagrant-cloud) server. Logging is only
necessary if you are accessing protected boxes or using
[Vagrant Share](/docs/share/).
The login command is used to authenticate with [HashiCorp's Vagrant Cloud](/docs/vagrant-cloud)
server. Logging in is only necessary if you are accessing protected boxes.
**Logging in is not a requirement to use Vagrant.** The vast majority
of Vagrant does _not_ require a login. Only certain features such as protected
boxes or [Vagrant Share](/docs/share/) require a login.
boxes.
The reference of available command-line flags to this command
is available below.
@ -49,8 +47,8 @@ is available below.
### Options
* `--check` - This will check if you are logged in. In addition to outputting
whether you are logged in or not, the command will have exit status 0 if you are
logged in, and exit status 1 if you are not.
whether you are logged in or not, the command exit status will be 0 if you are
logged in, or 1 if you are not.
* `--logout` - This will log you out if you are logged in. If you are already
logged out, this command will do nothing. It is not an error to call this
@ -104,8 +102,8 @@ of the token stored stored on disk.
**Command: `vagrant cloud box`**
The `cloud box` command is used to manage CRUD operations for all `box` entities on
Vagrant Cloud.
The `cloud box` command is used to manage life cycle operations for all `box`
entities on Vagrant Cloud.
* [`create`](#cloud-box-create)
* [`delete`](#cloud-box-delete)
@ -120,7 +118,7 @@ The box create command is used to create a new box entry on Vagrant Cloud.
### Options
* `--description DESCRIPTION` - A longer description of the box. Can be
* `--description DESCRIPTION` - A full description of the box. Can be
formatted with Markdown.
* `--short-description DESCRIPTION` - A short summary of the box.
* `--private` - Will make the new box private (Public by default)
@ -146,7 +144,7 @@ The box update command will update an already created box on Vagrant Cloud with
### Options
* `--description DESCRIPTION` - A longer description of the box. Can be
* `--description DESCRIPTION` - A full description of the box. Can be
formatted with Markdown.
* `--short-description DESCRIPTION` - A short summary of the box.
* `--private` - Will make the new box private (Public by default)
@ -155,8 +153,8 @@ The box update command will update an already created box on Vagrant Cloud with
**Command: `vagrant cloud provider`**
The `cloud provider` command is used to manage CRUD operations for all `provider` entities on
Vagrant Cloud.
The `cloud provider` command is used to manage the life cycle operations for all
`provider` entities on Vagrant Cloud.
* [`create`](#cloud-provider-create)
* [`delete`](#cloud-provider-delete)
@ -169,7 +167,7 @@ Vagrant Cloud.
The provider create command is used to create a new provider entry on Vagrant Cloud.
The `url` argument is expected to be a valid remote URL that Vagrant Cloud can use
The `url` argument is expected to be a remote URL that Vagrant Cloud can use
to download the provider. If no `url` is specified, the provider entry can be updated
later with a url or the [upload](#cloud-provider-upload) command can be used to
upload a Vagrant [box file](/docs/boxes.html).
@ -199,15 +197,15 @@ the specified version and provider.
**Command: `vagrant cloud publish ORGANIZATION/BOX-NAME VERSION PROVIDER-NAME [PROVIDER-FILE]`**
The publish command is a start-to-finish solution for creating and updating a
The publish command is a complete solution for creating and updating a
Vagrant box on Vagrant Cloud. Instead of having to create each attribute of a Vagrant
box with separate commands, the publish command instead askes you to provide all
the information you need up front to create or update a new box.
box with separate commands, the publish command instead asks you to provide all
the information required before creating or updating a new box.
## Options
* `--box-version VERSION` - Version to create for the box
* `--description DESCRIPTION` - A longer description of the box. Can be
* `--description DESCRIPTION` - A full description of the box. Can be
formatted with Markdown.
* `--force` - Disables confirmation when creating or updating a box.
* `--short-description DESCRIPTION` - A short summary of the box.