ocean_kit 0.1.3 ā 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/exe/ocean_kit +2 -0
- data/lib/ocean_kit/helpers/client.rb +11 -1
- data/lib/ocean_kit/helpers/console.rb +12 -0
- data/lib/ocean_kit/resources/base.rb +2 -0
- data/lib/ocean_kit/resources/config.rb +20 -0
- data/lib/ocean_kit/resources/droplets.rb +20 -0
- data/lib/ocean_kit/resources/firewalls.rb +1 -1
- data/lib/ocean_kit/version.rb +1 -1
- data/lib/ocean_kit.rb +7 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f64bff4db9951b545ab33726c4cb0ad20ccaa0d55006737759d023352ccb0f9f
|
4
|
+
data.tar.gz: e1bf61b1b1ec8d36ed813ec00681f5a8ae8b06de9046eee2e7f4785edabc4a27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68d98b0f3681e5cab5ebb2f6e5635cd06993382406a7f3ce0d881820416ecf35ee6b98196e426553752e9a6724fdcfcae3605e87af8a3f0613c3541c5d2f8c37
|
7
|
+
data.tar.gz: 27d79bfe3f6241dc8a07a26476b2148bdb705c88c25aee38cb5f7361dca878337c5a94570229c53f2399d6d66f99e578526e410fdaa0a6fb131d329527a54b00
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -55,7 +55,7 @@ Commands:
|
|
55
55
|
ocean_kit firewalls enable_all_ssh # Enables SSH on all firewalls
|
56
56
|
ocean_kit firewalls enable_ssh [firewall_number] # Enable SSH on given firewall
|
57
57
|
ocean_kit firewalls help [COMMAND] # Describe subcommands or one specific subcommand
|
58
|
-
ocean_kit firewalls list # Lists all firewalls
|
58
|
+
ocean_kit firewalls list # Lists all firewalls.
|
59
59
|
```
|
60
60
|
|
61
61
|
## Development
|
data/exe/ocean_kit
CHANGED
@@ -5,8 +5,18 @@ def do_client
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def access_token
|
8
|
-
credentials_file = YAML.load(File.read(File.expand_path("~/.ocean_kit/credentials.yml")))
|
9
8
|
credentials_file["digital_ocean_token"]
|
10
9
|
rescue => e
|
11
10
|
puts pastel.red.bold("Error: #{e.message}")
|
12
11
|
end
|
12
|
+
|
13
|
+
def credentials_file
|
14
|
+
YAML.load(File.read(File.expand_path("~/.ocean_kit/credentials.yml")))
|
15
|
+
end
|
16
|
+
|
17
|
+
def check_credentials_file
|
18
|
+
if credentials_file.nil?
|
19
|
+
puts pastel.red.bold("Error: credentials file not found. Please run `ocean_kit setup` first.")
|
20
|
+
exit 1
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OceanKit
|
4
|
+
class Config < Thor
|
5
|
+
desc "setup", "Setup OceanKit environment"
|
6
|
+
def setup
|
7
|
+
# First create the ~/.ocean_kit directory if it doesn't exist
|
8
|
+
Dir.mkdir(File.expand_path("~/.ocean_kit")) unless File.directory?(File.expand_path("~/.ocean_kit"))
|
9
|
+
# Next create the credentials.yml file if it doesn't exist
|
10
|
+
unless File.file?(File.expand_path("~/.ocean_kit/credentials.yml"))
|
11
|
+
File.write(File.expand_path("~/.ocean_kit/credentials.yml"), <<~YAML)
|
12
|
+
---
|
13
|
+
digital_ocean_token: <YOUR_DIGITAL_OCEAN_TOKEN>
|
14
|
+
|
15
|
+
YAML
|
16
|
+
end
|
17
|
+
puts pastel.green.bold("Successfully setup OceanKit environment.")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module OceanKit
|
4
|
+
class Droplets < Thor
|
5
|
+
desc "list", "Lists all droplers."
|
6
|
+
def list
|
7
|
+
puts underline_text("Droplets:")
|
8
|
+
puts pastel.blue.bold "š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³\n"
|
9
|
+
do_client.droplets.all.each_with_index do |droplet, index|
|
10
|
+
puts pastel.white.bold "Name: ", pastel.clear.white(droplet.name)
|
11
|
+
puts pastel.white.bold "ID: ", pastel.clear.white(droplet.id)
|
12
|
+
puts pastel.white.bold "Public IP: ", pastel.clear.white(droplet.networks.v4.first.ip_address)
|
13
|
+
puts pastel.white.bold "Region: ", pastel.clear.white(droplet.region.slug)
|
14
|
+
puts pastel.white.bold "Status: ", pastel.clear.white(droplet.status)
|
15
|
+
puts pastel.white.bold "Created: ", pastel.clear.white(droplet.created_at)
|
16
|
+
puts pastel.blue.bold "\nš³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³š³\n"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/ocean_kit/version.rb
CHANGED
data/lib/ocean_kit.rb
CHANGED
@@ -11,7 +11,13 @@ require_relative "./ocean_kit/helpers/base"
|
|
11
11
|
|
12
12
|
module OceanKit
|
13
13
|
class Client < Thor
|
14
|
-
desc "
|
14
|
+
desc "config SUBCOMMAND ...ARGS", "Create OceanKit folder and credentials.yml file"
|
15
|
+
subcommand "config", Config
|
16
|
+
|
17
|
+
desc "droplets SUBCOMMAND ...ARGS", "manage your Digital Ocean droplets"
|
18
|
+
subcommand "droplets", Droplets
|
19
|
+
|
20
|
+
desc "firewalls SUBCOMMAND ...ARGS", "manage your Digital Ocean firewalls"
|
15
21
|
subcommand "firewalls", Firewalls
|
16
22
|
end
|
17
23
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocean_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leo Policastro
|
@@ -83,6 +83,8 @@ files:
|
|
83
83
|
- lib/ocean_kit/helpers/console.rb
|
84
84
|
- lib/ocean_kit/helpers/firewalls.rb
|
85
85
|
- lib/ocean_kit/resources/base.rb
|
86
|
+
- lib/ocean_kit/resources/config.rb
|
87
|
+
- lib/ocean_kit/resources/droplets.rb
|
86
88
|
- lib/ocean_kit/resources/firewalls.rb
|
87
89
|
- lib/ocean_kit/version.rb
|
88
90
|
- ocean_kit.gemspec
|