ocean_kit 0.1.5 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84dcf8fe7afd5f888192ce09e6ec3c7153052a812142ae4726d7cbf15b7a43dd
4
- data.tar.gz: 930fa733a585ea61efe68c924b66596bf05b80f63282e535f4435f5e1e8adb2c
3
+ metadata.gz: 843ee49bda763bbd5ef60e57c9f40c7ba2dfa5186fc0c5f57e891875ef2eb0e1
4
+ data.tar.gz: 3666e52746bd88aacf07e72829f892c192f60ff108f9f75c261ba7857da89545
5
5
  SHA512:
6
- metadata.gz: 1189f7a21bd24d3bddbf4d0b2144a3b67e1f16df14c02b6b38189cbf921ef2c4bbf5bec976640860ce3a4a7dd9acbefbb23a94ed6f9b52fd38d3db48cff844f1
7
- data.tar.gz: 073dc845350bea427160ec66556ffcb06bde23b95cacac2b28b0065f5f58e2cb9543edf372cdfe640bbef32661c49095e3544644bfab1d2f78f8493b8348c9f6
6
+ metadata.gz: '029c039ec47eea5b4046feeaa1514b26fa2ce297161322fe201727cd41b47ff6d252f20cf3ae22023e836b150f1a431955ae153f7917044f70487c05851668b1'
7
+ data.tar.gz: 29cb66f45db09e32b19ba78a7eb30a42a3f6a787a14f232b27a7ab840a8af7503683d389247c88d2e9c796bb29a76a54503bd89f5c6674aea1134ac3f2f5ab9c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ocean_kit (0.1.4)
4
+ ocean_kit (0.1.8)
5
5
  droplet_kit (~> 3.16, >= 3.16.1)
6
6
  pastel
7
7
  thor (~> 1.2)
data/README.md CHANGED
@@ -24,11 +24,17 @@ Or install it yourself as:
24
24
 
25
25
  - The file should have the following format:
26
26
 
27
- ```yml
28
- digital_ocean_token: your_digital_ocean_personal_access_token
29
- ```
27
+ ```yml
28
+ digital_ocean_token: your_digital_ocean_personal_access_token
29
+ ```
30
30
 
31
- For a list of available commands run
31
+ - You can also generate the file and folder by running:
32
+
33
+ ```bash
34
+ $ ocean_kit config setup
35
+ ```
36
+
37
+ For a full list of available commands run
32
38
 
33
39
  ```
34
40
  $ ocean_kit
@@ -66,7 +72,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
66
72
 
67
73
  ## Contributing
68
74
 
69
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ocean_kit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ocean_kit/blob/main/CODE_OF_CONDUCT.md).
75
+ Bug reports and pull requests are welcome on GitHub at https://github.com/leopolicastro/ocean_kit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/leopolicastro/ocean_kit/blob/main/CODE_OF_CONDUCT.md).
70
76
 
71
77
  - Currently only has very basic functionality to list firewalls, and enable or disable ssh on them.
72
78
 
@@ -14,7 +14,7 @@ end
14
14
 
15
15
  def check_credentials_file
16
16
  if credentials_file.nil?
17
- puts pastel.red.bold("Error: credentials file not found. Please run `ocean_kit setup` first.")
17
+ puts pastel.red.bold("Error: credentials file not found. Please run `ocean_kit config setup` first.")
18
18
  exit 1
19
19
  end
20
20
  end
@@ -34,3 +34,11 @@ end
34
34
  def add_ssh_rule(rules_array)
35
35
  rules_array << {protocol: "tcp", ports: "22", sources: {addresses: ["0.0.0.0/0", "::/0"]}}
36
36
  end
37
+
38
+ def add_http_rule(rules_array)
39
+ rules_array << {protocol: "tcp", ports: "80", sources: {addresses: ["0.0.0.0/0", "::/0"]}}
40
+ end
41
+
42
+ def remove_http_rule(rules_array)
43
+ rules_array.delete_if { |r| r[:ports] == "80" }
44
+ end
@@ -15,7 +15,7 @@ module OceanKit
15
15
  YAML
16
16
  end
17
17
  puts pastel.green.bold("Successfully setup OceanKit environment.")
18
- puts pastel.white.bold("Please add your Digital Ocean personal access token your credentials in ~/.ocean_kit/credentials.yml")
18
+ puts pastel.white.bold("Please add your Digital Ocean personal access token your credentials in ~/.ocean_kit/credentials.yml") if access_token.nil?
19
19
  end
20
20
  end
21
21
  end
@@ -68,5 +68,31 @@ module OceanKit
68
68
  puts pastel.red.bold("Error: #{e.message}")
69
69
  end
70
70
  end
71
+
72
+ desc "enable_http", "Enable HTTP on given firewall"
73
+ def enable_http(number)
74
+ firewall = fetch_firewall(number)
75
+ inbound_rules = firewall_inbound_rules(firewall)
76
+ firewall.inbound_rules = add_http_rule(inbound_rules)
77
+ begin
78
+ update_firewall(firewall)
79
+ puts pastel.green.bold("HTTP enabled on firewall #{firewall.name}")
80
+ rescue DropletKit::Error => e
81
+ puts pastel.red.bold("Error: #{e.message}")
82
+ end
83
+ end
84
+
85
+ desc "disable_http [firewall_number]", "Disable HTTP on given firewall"
86
+ def disable_http(number)
87
+ firewall = fetch_firewall(number)
88
+ inbound_rules = firewall_inbound_rules(firewall)
89
+ firewall.inbound_rules = remove_http_rule(inbound_rules)
90
+ begin
91
+ update_firewall(firewall)
92
+ puts pastel.green.bold("HTTP disabled on firewall #{firewall.name}")
93
+ rescue DropletKit::Error => e
94
+ puts pastel.red.bold("Error: #{e.message}")
95
+ end
96
+ end
71
97
  end
72
98
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OceanKit
4
- VERSION = "0.1.5"
4
+ VERSION = "0.1.8"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo Policastro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-27 00:00:00.000000000 Z
11
+ date: 2022-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.3.7
114
+ rubygems_version: 3.3.10
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Digital Ocean CLI Kit