From b936758f078fd0c94f70653307e7f098945d5a9a Mon Sep 17 00:00:00 2001 From: "Kian-Meng, Ang" Date: Mon, 11 Oct 2021 23:40:15 +0800 Subject: [PATCH] Misc doc changes Besides other documentation changes, this commit ensures the generated HTML doc for HexDocs.pm will become the source of truth for this Elixir library and leverage on latest features of ExDoc. --- .formatter.exs | 5 +- .gitignore | 19 +- README.md | 20 +- lib/doex.ex | 306 +------------------------- lib/doex/cli/config.ex | 2 +- lib/doex/cli/post.ex | 2 +- lib/doex/cli/scp.ex | 2 +- lib/doex/cli/ssh.ex | 2 +- lib/doex/cli/ssh.hostkey.ex | 2 +- lib/mix/tasks/block.ex | 18 +- lib/mix/tasks/config.ex | 4 +- lib/mix/tasks/delete.ex | 8 +- lib/mix/tasks/doex.ex | 6 +- lib/mix/tasks/droplets.create.ex | 11 +- lib/mix/tasks/droplets.id.ex | 17 +- lib/mix/tasks/droplets.tag.ex | 9 +- lib/mix/tasks/floating_ip.id.ex | 15 +- lib/mix/tasks/floating_ip.reassign.ex | 15 +- lib/mix/tasks/get.ex | 8 +- lib/mix/tasks/id.ex | 14 +- lib/mix/tasks/imagelets.create.ex | 17 +- lib/mix/tasks/init.ex | 6 +- lib/mix/tasks/ip.ex | 13 +- lib/mix/tasks/ls.ex | 14 +- lib/mix/tasks/post.ex | 15 +- lib/mix/tasks/put.ex | 10 +- lib/mix/tasks/scp.ex | 14 +- lib/mix/tasks/snapshots.create.ex | 18 +- lib/mix/tasks/ssh.ex | 14 +- lib/mix/tasks/ssh.hostkey.ex | 19 +- mix.exs | 13 +- 31 files changed, 199 insertions(+), 439 deletions(-) diff --git a/.formatter.exs b/.formatter.exs index 55d3bcc..d2cda26 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,3 +1,4 @@ +# Used by "mix format" [ - inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"] -] \ No newline at end of file + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.gitignore b/.gitignore index db3c0d0..57edb3b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,14 @@ # The directory Mix will write compiled artifacts to. -/_build +/_build/ # If you run "mix test --cover", coverage assets end up here. -/cover +/cover/ # The directory Mix downloads your dependencies sources to. -/deps +/deps/ -# Where 3rd-party dependencies like ExDoc output generated docs. -/doc +# Where third-party dependencies like ExDoc output generated docs. +/doc/ # Ignore .fetch files in case you like to edit your project deps locally. /.fetch @@ -19,8 +19,15 @@ erl_crash.dump # Also ignore archive artifacts (built via "mix archive.build"). *.ez -# For local testing, otherwise should be set by the calling application +# Ignore package tarball (built via "mix hex.build"). +doex-*.tar + +# Temporary files, for example, from tests. +/tmp/ + +# For local testing, otherwise should be set by the calling application. config/dev.exs +# Misc. .doex doex diff --git a/README.md b/README.md index 56f1ad9..e44daaf 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,15 @@ # Doex [![Build Status](https://api.travis-ci.org/aforward/doex.svg?branch=main)](https://travis-ci.org/aforward/doex) +[![Module Version](https://img.shields.io/hexpm/v/doex.svg)](https://hex.pm/packages/doex) +[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/doex/) +[![Total Download](https://img.shields.io/hexpm/dt/doex.svg)](https://hex.pm/packages/doex) +[![License](https://img.shields.io/hexpm/l/doex.svg)](https://github.com/aforward/doex/blob/master/LICENSE.md) +[![Last Updated](https://img.shields.io/github/last-commit/aforward/doex.svg)](https://github.com/aforward/doex/commits/master) -An elixir implementation of the [DigitalOcean API v2](https://developers.digitalocean.com/documentation/v2/). + + +An Elixir implementation of the [DigitalOcean API v2](https://developers.digitalocean.com/documentation/v2/). From their documentation: @@ -219,7 +226,7 @@ tasks), or escript (if you want to use escript). ## Elixir API These features are also available from within Elixir through `Doex` modules, -this gives you better programatic access to return data (presented as a map), +this gives you better programmatic access to return data (presented as a map), but in most cases probably is not required to automate your infrastructure. If we start an iEX session in your project that includes the doex dependency, @@ -300,6 +307,11 @@ they will be located in iex> h Doex.Client -## License + + +## Copyright and License + +Copyright (c) 2017 Andrew Forward -MIT License +This work is free. You can redistribute it and/or modify it under the +terms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details. diff --git a/lib/doex.ex b/lib/doex.ex index 018db12..46e8ca3 100644 --- a/lib/doex.ex +++ b/lib/doex.ex @@ -1,305 +1,9 @@ defmodule Doex do - @moduledoc """ - - An elixir implementation of the - [DigitalOcean API v2](https://developers.digitalocean.com/documentation/v2/). From - their documentation: - - The DigitalOcean API allows you to manage Droplets and resources within - the DigitalOcean cloud in a simple, programmatic way using conventional - HTTP requests. The endpoints are intuitive and powerful, allowing you to - easily make calls to retrieve information or to execute actions. - - All of the functionality that you are familiar with in the DigitalOcean - control panel is also available through the API, allowing you to script - the complex actions that your situation requires. - - The API documentation will start with a general overview about the design - and technology that has been implemented, followed by reference information - about specific endpoints. - - This Elixir DigitalOcean (DO) API gives you access to the API through three means: - - * A command line escript tool called `doex` - * A set of mix tasks `mix doex.*`, or - * Directly from Elixir code using `Doex` module - - Each one of the mechanism above allow you to automate your infrastructure needs, - it more comes down to preference and environment. - - The library name is somewhat of an acryonym for Digital Ocean (do) and Elixir (ex). - It is pronounced "Doakes" after the excellent character in Dexter, - no other symbolism to the character, just liked it and it followed with the - Elixir convention of putting 'ex' somewhere in the library name. - - ## Installation - - ### Command Line (Latest Version) - - To install the `doex` command line tool (whose only dependency is Erlang), then - you can [install it using escript](https://hexdocs.pm/mix/master/Mix.Tasks.Escript.Install.html). - - - ```bash - # Install from GitHub - mix escript.install github aforward/doex - - # Install form HEX.pm - mix escript.install hex doex - ``` - - If you see a warning like - - ```bash - warning: you must append "~/.mix/escripts" to your PATH - if you want to invoke escripts by name - ``` - - Then, make sure to update your PATH variable. Here's how on a Mac OS X, but each - [environment is slightly different](https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path). - - ```bash - vi ~/.bash_profile - - # Add a line like the following - PATH="$HOME/.mix/escripts:$PATH" - export PATH - ``` - - Start a new terminal session. You will know it's working when you can *find* it using *where* - - ``` - where doex - ``` - - ### Command Line (Other Versions) - - To install a specific version, branch, tag or commit, adjust any one of the following - - ```bash - # Install from a specific version - mix escript.install hex doex 0.11.0 - - # Install from the latest of a specific branch - mix escript.install github aforward/doex branch git_branch - - # Install from a specific tag - mix escript.install github aforward/doex tag git_tag - - # Install from a specific commit - mix escript.install github aforward/doex ref git_ref - ``` - - Again, checkout [mix escript.install](https://hexdocs.pm/mix/Mix.Tasks.Escript.Install.html) for - more information about installing global tasks. - - ### Mix Tasks - - If you have an Elixir project that you want to interact with the - DigitalOcean API, then you install the app by adding a dependency - to your `mix.exs` file. - - ```elixir - @deps [ - {:doex, "~> 0.6.1"} - ] - ``` - - This will give you access to `mix doex.*` tasks (instead of globally installing - the `doex` escript). You will also have programtic access from your `Doex` module - as well; so you could expose feature directly within your application as well. - - ## Configure DO Token - - Before you can use the DO API, you will need to configure access to your DigitalOcean - account. For this, you will need your [API TOKEN](https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-api-v2#how-to-generate-a-personal-access-token) - - Let's say your token is ABC123, then configure it as follows: - - # using escript - doex init - doex config token ABC123 - - # using mix tasks - mix doex.init - mix doex.config token ABC123 - - And to confirm it's set, run - - doex config - - And the output should look similar to: - - ssh_keys: [] - token: "ABC123" - url: "https://api.digitalocean.com/v2" - - Notice the empty `ssh_keys`. Please look at [DO documentation on SSH Keys](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets) - and configure them right away. With the SSH Keys set, you will have secure - and passwordless access to your new droplet, enabling more convient scripting. To - retrieve your SSH Key IDs, run the following command - - # using escript - doex get /account/keys - - # using mix tasks - mix doex.get /account/keys - - The output will be similar to the following, and it's the IDs you want. - - {:ok, - %{"links" => %{}, "meta" => %{"total" => 2}, - "ssh_keys" => [%{"fingerprint" => "18:19:20:21:22:23:24:25:26:27:28:29:30:31:32:33", - "id" => 555213, "name" => "mbp", - "public_key" => "ssh-dss ABC123"}, - %{"fingerprint" => "19:20:21:22:23:24:25:26:27:28:29:30:31:32:33:34", - "id" => 555214, "name" => "andrew13mbp", - "public_key" => "ssh-rsa DEF456"}]}} - - From the example above (please adjust for your output), the IDs are `555213`, and `555214`. - These can be set by running - - mix doex.config ssh_keys 555213 555214 - - Now, every droplet you create will, by default (and can be overwritten), be accessible - by all computers that have those public/private keys. - - ## Available Commands / Tasks - - To get help on the available commands, run - - # using escript - doex - - # using mix tasks - mix doex - - The output will look similar to the following - - doex v0.6.1 - doex is a API client for Digital Ocean's API v2. - - Available tasks: - - doex block # Block the command line until a condition is met - doex config # Reads, updates or deletes Doex config - doex delete # Execute a Digital Ocean API DELETE request - doex droplets.create # Create a droplet on Digital Ocean - doex droplets.id # Locate a droplet ID, by name or tag (--tag) - doex droplets.tag # Tag a droplet. - doex get # Execute a Digital Ocean API GET request - doex id # Locate a ID of a resource, by name or tag (--tag) - doex imagelets.create # Create a DitigalOcean snapshot based on available templates - doex init # Initialize your doex config - doex ip # Get the IP of a droplet - doex ls # List your resources. - doex post # Execute a Digital Ocean API POST request - doex put # Execute a Digital Ocean API PUT request - doex scp # Secure copy a file from to your droplet's - doex snapshots.create # Creates a snapshot of an existing Digital Ocean droplet - doex ssh # Execute a command on your droplet - doex ssh.hostkey # Add the droplet hostkey to the executing server - - Further information can be found here: - -- https://hex.pm/packages/doex - -- https://github.com/aforward/doex - - Please note that the mix tasks and doex scripts provide identical functionality, - they are just structured slightly differently. - - In general, - - * `mix doex. ` for mix tasks - * `doex ` for escript - - Make sure that have installed doex correctly for mix tasks (if you want to use mix - tasks), or escript (if you want to use escript). - - ## Elixir API - - These features are also available from within Elixir through `Doex` modules, - this gives you better programatic access to return data (presented as a map), - but in most cases probably is not required to automate your infrastructure. - - If we start an iEX session in your project that includes the doex dependency, - you can access the same information in Elixir. - - iex> Doex.config - %{ssh_keys: [], token: "ABC123", url: "https://api.digitalocean.com/v2"} - - The underlying API calls are made through - - iex> h Doex.Api - - The `source` is the DO API endpoint *after* the `url` provided above, so to - access your account information, you would run - - iex> Doex.Api.get("/account") - - OR, you can go through the more generic `call`, providing the arguments in a map. - - iex> Doex.Api.call(:get, %{source: "/account"}) - - If your configurations are messed up (or other errors occur), it will look - similar to - - {:error, - "Expected a 200, received 401", - %{"id" => "unauthorized", "message" => "Unable to authenticate you."}} - - If things are working as expected, a success message looks like - - {:ok, - %{"account" => %{"droplet_limit" => 99, "email" => "me@example.com", - "email_verified" => true, "floating_ip_limit" => 5, "status" => "active", - "status_message" => "", - "uuid" => "abcdefghabcdefghabcdefghabcdefghabcdefgh"}}} - - To send a POST command, for example creating a new droplet, you can run - - iex> Doex.Api.post( - "/droplets", - %{name: "dplet001", - region: "tor1", - size: "s-1vcpu-1gb", - image: "ubuntu-18-04-x64", - ssh_keys: [12345], - backups: false, - ipv6: true, - user_data: nil, - private_networking: nil, - volumes: nil, - tags: ["dplet001"]}) - - OR, you can go through the more generic `call` - - iex> Doex.Api.call( - :post, - %{source: "/droplets", - body: %{name: "dplet001", - region: "tor1", - size: "s-1vcpu-1gb", - image: "ubuntu-18-04-x64", - ssh_keys: [12345], - backups: false, - ipv6: true, - user_data: nil, - private_networking: nil, - volumes: nil, - tags: ["dplet001"]}}) - - The underlying configs are stored in `Doex.Worker` ([OTP GenServer](https://elixir-lang.org/getting-started/mix-otp/genserver.html)). - If you change your configurations and need them reloaded, then call - and can be reloaded using - - iex> Doex.reload - - At present, there are no client specific convenience methods, but when there are - they will be located in - - iex> Doex.Client - - """ + @external_resource "README.md" + @moduledoc "README.md" + |> File.read!() + |> String.split("") + |> Enum.fetch!(1) def version(), do: unquote(Mix.Project.config()[:version]) def elixir_version(), do: unquote(System.version()) diff --git a/lib/doex/cli/config.ex b/lib/doex/cli/config.ex index 90e3fcc..c3c7cc0 100644 --- a/lib/doex/cli/config.ex +++ b/lib/doex/cli/config.ex @@ -12,7 +12,7 @@ defmodule Doex.Cli.Config do ## Config keys - * `token` - Digitial Ocean Token () + * `token` - Digital Ocean Token () * `ssh_keys` - The SSH Key "IDs" stored in Digital Ocean to grant to new droplets ## Command line options diff --git a/lib/doex/cli/post.ex b/lib/doex/cli/post.ex index 7a21780..1d662b6 100644 --- a/lib/doex/cli/post.ex +++ b/lib/doex/cli/post.ex @@ -42,7 +42,7 @@ defmodule Doex.Cli.Post do "id" => 5431515, "rel" => "create"}]}}} Note that `private_networking` DO parameter is changed to dash case `private-networking` - and it's a boolean paramater, so it defaults to true if set) + and it's a boolean parameter, so it defaults to true if set) """ def run(raw_args) do diff --git a/lib/doex/cli/scp.ex b/lib/doex/cli/scp.ex index 63f0665..900a50f 100644 --- a/lib/doex/cli/scp.ex +++ b/lib/doex/cli/scp.ex @@ -8,7 +8,7 @@ defmodule Doex.Cli.Scp do doex scp - You can provide the droplet ID, referenece it by name, or by tag (if you add the --tag option) + You can provide the droplet ID, reference it by name, or by tag (if you add the --tag option) For example diff --git a/lib/doex/cli/ssh.ex b/lib/doex/cli/ssh.ex index 1ffc9e1..57a6301 100644 --- a/lib/doex/cli/ssh.ex +++ b/lib/doex/cli/ssh.ex @@ -8,7 +8,7 @@ defmodule Doex.Cli.Ssh do doex ssh - You can provide the droplet ID, referenece it by name, or by tag (if you add the --tag option) + You can provide the droplet ID, reference it by name, or by tag (if you add the --tag option) For example diff --git a/lib/doex/cli/ssh.hostkey.ex b/lib/doex/cli/ssh.hostkey.ex index 8bbdc4b..6ceddd0 100644 --- a/lib/doex/cli/ssh.hostkey.ex +++ b/lib/doex/cli/ssh.hostkey.ex @@ -8,7 +8,7 @@ defmodule Doex.Cli.Ssh.Hostkey do doex ssh.hostkey - You can provide the droplet ID, referenece it by name, or by tag (if you add the --tag option) + You can provide the droplet ID, reference it by name, or by tag (if you add the --tag option) For example diff --git a/lib/mix/tasks/block.ex b/lib/mix/tasks/block.ex index b598c20..3d6de2a 100644 --- a/lib/mix/tasks/block.ex +++ b/lib/mix/tasks/block.ex @@ -1,23 +1,23 @@ defmodule Mix.Tasks.Doex.Block do use Mix.Task - @shortdoc "Block the command line until a condition is met" + @shortdoc "Block the command line until a condition is met." @moduledoc """ - Block the command line until a condition is met, + Block the command line until a condition is met. - Currently, we support blocking on action statuses, + Currently, we support blocking on action statuses: - doex block actions + doex block actions - And, droplet statuses + And, droplet statuses: - doex block droplets + doex block droplets - For example, + For example: - doex block actions 12345 completed - doex block droplets 5672313 active + doex block actions 12345 completed + doex block droplets 5672313 active The process is silent, so if you put in an invalid status, the script will run until manually stopped. diff --git a/lib/mix/tasks/config.ex b/lib/mix/tasks/config.ex index 50de0a2..34afabf 100644 --- a/lib/mix/tasks/config.ex +++ b/lib/mix/tasks/config.ex @@ -1,7 +1,7 @@ defmodule Mix.Tasks.Doex.Config do use Mix.Task - @shortdoc "Reads, updates or deletes Doex config" + @shortdoc "Reads, updates or deletes Doex config." @moduledoc """ Reads, updates or deletes Doex configuration keys. @@ -13,7 +13,7 @@ defmodule Mix.Tasks.Doex.Config do ## Config keys - * `token` - Digitial Ocean Token () + * `token` - Digital Ocean Token () * `ssh_keys` - The SSH Key "IDs" stored in Digital Ocean to grant to new droplets ## Command line options diff --git a/lib/mix/tasks/delete.ex b/lib/mix/tasks/delete.ex index 8e395b7..af3bd2a 100644 --- a/lib/mix/tasks/delete.ex +++ b/lib/mix/tasks/delete.ex @@ -1,18 +1,18 @@ defmodule Mix.Tasks.Doex.Delete do use Mix.Task - @shortdoc "Execute a Digital Ocean API DELETE request" + @shortdoc "Execute a Digital Ocean API DELETE request." @moduledoc """ - Execute a Digital Ocean API DELETE request + Execute a Digital Ocean API DELETE request: mix doex.delete - For example + For example: mix doex.delete /droplets/123456 - The output will be similar to the following, and it's the IDs you want. + The output will be similar to the following, and it's the IDs you want: {:ok, nil} diff --git a/lib/mix/tasks/doex.ex b/lib/mix/tasks/doex.ex index 4605afc..e1ed0b1 100644 --- a/lib/mix/tasks/doex.ex +++ b/lib/mix/tasks/doex.ex @@ -1,12 +1,12 @@ defmodule Mix.Tasks.Doex do use Mix.Task - @shortdoc "Prints Digital Ocean API v2 mix client help information" + @shortdoc "Prints Digital Ocean API v2 mix client help information." @moduledoc """ - Prints (doex) Digital Ocean API v2 mix client help information + Prints (doex) Digital Ocean API v2 mix client help information: - mix doex + mix doex See `mix help doex.config` to see all available configuration options. """ diff --git a/lib/mix/tasks/droplets.create.ex b/lib/mix/tasks/droplets.create.ex index 53cc228..e667cef 100644 --- a/lib/mix/tasks/droplets.create.ex +++ b/lib/mix/tasks/droplets.create.ex @@ -2,12 +2,12 @@ defmodule Mix.Tasks.Doex.Droplets.Create do use Mix.Task use FnExpr - @shortdoc "Create a droplet on Digital Ocean" + @shortdoc "Create a droplet on Digital Ocean." @moduledoc """ - Create a new digital ocean droplet + Create a new digital ocean droplet: - mix doex.droplets.create + mix doex.droplets.create The following options with examples are shown below: @@ -22,7 +22,7 @@ defmodule Mix.Tasks.Doex.Droplets.Create do --volumes # TODO figure out what this should be --tags web,uat,temp - For example + For example: mix doex.droplets.create mydroplet \\ --region tor1 \\ @@ -30,7 +30,8 @@ defmodule Mix.Tasks.Doex.Droplets.Create do --image ubuntu-18-04-x64 \\ --size s-1vcpu-1gb - If you have a specific config file, `mix help doex.config` then add it as an environment variable + If you have a specific config file, `mix help doex.config` then add it as an + environment variable: DOEX_CONFIG=/tmp/my.doex mix doex.droplets.create mydroplet \ --region tor1 \\ diff --git a/lib/mix/tasks/droplets.id.ex b/lib/mix/tasks/droplets.id.ex index 284bdbd..58e3944 100644 --- a/lib/mix/tasks/droplets.id.ex +++ b/lib/mix/tasks/droplets.id.ex @@ -2,24 +2,27 @@ defmodule Mix.Tasks.Doex.Droplets.Id do use Mix.Task use FnExpr - @shortdoc "Locate a droplet ID, by name or tag (--tag)" + @shortdoc "Locate a droplet ID, by name or tag (--tag)." @moduledoc """ - Locate a droplet ID. This can be done by name + Locate a droplet ID. - doex droplets.id + This can be done by name: - Or, by tag + doex droplets.id + + Or, by tag: doex droplets.id --tag - If by tag, it will grab the `latest` + If by tag, it will grab the `latest`. - For example + For example: doex droplets.id my_app - If you have a specific config file, `mix help doex.config` then add it as an environment variable + If you have a specific config file, `mix help doex.config` then add it as an + environment variable: DOEX_CONFIG=/tmp/my.doex doex droplets.id my_app diff --git a/lib/mix/tasks/droplets.tag.ex b/lib/mix/tasks/droplets.tag.ex index 50e42b5..86fd59f 100644 --- a/lib/mix/tasks/droplets.tag.ex +++ b/lib/mix/tasks/droplets.tag.ex @@ -5,15 +5,16 @@ defmodule Mix.Tasks.Doex.Droplets.Tag do @shortdoc "Tag a droplet." @moduledoc """ - Tag a droplet. + Tag a droplet: - doex droplets.tag + doex droplets.tag - For example + For example: doex droplets.tag my_app production - If you have a specific config file, `mix help doex.config` then add it as an environment variable + If you have a specific config file, `mix help doex.config` then add it as an + environment variable: DOEX_CONFIG=/tmp/my.doex doex droplets.tag my_app production diff --git a/lib/mix/tasks/floating_ip.id.ex b/lib/mix/tasks/floating_ip.id.ex index 00ed64d..7ce0d08 100644 --- a/lib/mix/tasks/floating_ip.id.ex +++ b/lib/mix/tasks/floating_ip.id.ex @@ -2,24 +2,27 @@ defmodule Mix.Tasks.Doex.FloatingIp.Id do use Mix.Task use FnExpr - @shortdoc "Locate a floating ip ID, by droplet name (or --tag) that it's assigned to" + @shortdoc "Locate a floating ip ID, by droplet name (or --tag) that it's assigned to." @moduledoc """ - Locate a floating ip ID. This can be done by name + Locate a floating ip ID. - doex floating_ip.id + This can be done by name: - Or, by tag + doex floating_ip.id + + Or, by tag: doex floating_ip.id --tag If by tag, it will grab the `latest` - For example + For example: doex floating_ip.id my_app - If you have a specific config file, `mix help doex.config` then add it as an environment variable + If you have a specific config file, `mix help doex.config` then add it as an + environment variable: DOEX_CONFIG=/tmp/my.doex doex floating_ip.id my_app diff --git a/lib/mix/tasks/floating_ip.reassign.ex b/lib/mix/tasks/floating_ip.reassign.ex index 718e650..1c045b5 100644 --- a/lib/mix/tasks/floating_ip.reassign.ex +++ b/lib/mix/tasks/floating_ip.reassign.ex @@ -2,24 +2,25 @@ defmodule Mix.Tasks.Doex.FloatingIp.Reassign do use Mix.Task use FnExpr - @shortdoc "Reassign a floating IP from one droplet to another" + @shortdoc "Reassign a floating IP from one droplet to another." @moduledoc """ - Reassign a floating IP from one droplet to another + Reassign a floating IP from one droplet to another: - doex floating_ip.reassign + doex floating_ip.reassign - Or, by tag + Or, by tag: doex floating_ip.id --tag - If by tag, it will grab the `latest` + If by tag, it will grab the `latest`. - For example + For example: doex floating_ip.reassign myapp01 myapp02 - If you have a specific config file, `mix help doex.config` then add it as an environment variable + If you have a specific config file, `mix help doex.config` then add it as an + environment variable: DOEX_CONFIG=/tmp/my.doex doex floating_ip.reassign myapp01 myapp02 diff --git a/lib/mix/tasks/get.ex b/lib/mix/tasks/get.ex index 6841b3a..b5ddaa0 100644 --- a/lib/mix/tasks/get.ex +++ b/lib/mix/tasks/get.ex @@ -1,14 +1,14 @@ defmodule Mix.Tasks.Doex.Get do use Mix.Task - @shortdoc "Execute a Digital Ocean API GET request" + @shortdoc "Execute a Digital Ocean API GET request." @moduledoc """ - Execute a Digital Ocean API GET request + Execute a Digital Ocean API GET request: - mix doex.get + mix doex.get - For example + For example: mix doex.get /account/keys diff --git a/lib/mix/tasks/id.ex b/lib/mix/tasks/id.ex index 0728e1f..1343a55 100644 --- a/lib/mix/tasks/id.ex +++ b/lib/mix/tasks/id.ex @@ -7,25 +7,27 @@ defmodule Mix.Tasks.Doex.Id do @moduledoc """ Locate a ID of a resource. This can be done by name or tag. - doex id <--resource_type> + doex id <--resource_type> - Or, by tag + Or, by tag: doex droplets.id <--resource_type> --tag If by tag, it will grab the `latest`. - Currently, the only supported resource type is a `--droplets`, but more are coming. + Currently, the only supported resource type is a `--droplets`, but more are + coming. - For example + For example: doex id my_app --droplets - Droplets are also the default, so the `--droplets` can be omitted. + Droplets are also the default, so the `--droplets` can be omitted: doex id my_app - If you have a specific config file, `mix help doex.config` then add it as an environment variable + If you have a specific config file, `mix help doex.config` then add it as an + environment variable: DOEX_CONFIG=/tmp/my.doex doex id my_app diff --git a/lib/mix/tasks/imagelets.create.ex b/lib/mix/tasks/imagelets.create.ex index 87e3c00..4655075 100644 --- a/lib/mix/tasks/imagelets.create.ex +++ b/lib/mix/tasks/imagelets.create.ex @@ -2,7 +2,7 @@ defmodule Mix.Tasks.Doex.Imagelets.Create do use Mix.Task use FnExpr - @shortdoc "Create a DitigalOcean snapshot based on available templates" + @shortdoc "Create a DitigalOcean snapshot based on available templates." @default_erlang "19.3-1" @default_elixir "1.5.1" @@ -10,9 +10,9 @@ defmodule Mix.Tasks.Doex.Imagelets.Create do @default_postgres "9.6" @moduledoc """ - Create a DitigalOcean snapshot based on a select (opinionated) templates + Create a DitigalOcean snapshot based on a select (opinionated) templates: - mix doex.imagelets.create