eien 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c987ebe8da85f50608eaac6c0cfd5ee2f54e47a13f0fabdb20586c6e204925e9
4
- data.tar.gz: 96dac2d05a04ce9e1b6353ce4bb4cc33b8c0be05e4bc9dc87994546f7efde842
3
+ metadata.gz: 926298e51aca3ac937f7888adf8346aacddfca6275520c5d431709c9bf85ffe1
4
+ data.tar.gz: 98ee5e2db2148462c333597775ca0bb126769601723f28670dea14756ae5634e
5
5
  SHA512:
6
- metadata.gz: b56c833313f7d9103799d9fcb4d9e02f09903a18eb8cb312c91c26541785533d2cbc9e0db415d7a0a10c9445c74668af5d934fbe0c421a03c9176a7deb8a4e1e
7
- data.tar.gz: d4c82e2a16919fa7753774140480ed63e868e5d9e43f197c1d834d9c22adc9a070673c2ab7a8749a0a6dd377f674b2201fcaf866cad6984783ce1c041110a97a
6
+ metadata.gz: 7aa2f5ab91d442c608ca973768a9c54bc3bd738c79854cced2587e1116fe613efdd2ea052fbd73c39577f48e5efb4a14abf523b085e9cfc3b8eef2017ad43365
7
+ data.tar.gz: 9822c483275c55c7129cc54a07da2e09f54652b0936af384b08daf242ad114ef66e75f9c5dae70135006c1c3f23625c6db7cd0dbb65f4551a390a73a4d5f6aed
data/README.md CHANGED
@@ -7,8 +7,8 @@ concepts from you.
7
7
  to manage and deploy the app. `eien` tries to follow all best practices for deploying apps in Kubernetes.
8
8
 
9
9
  ⚙️ `eien` has simple commands like you are used to
10
- from [heroku CLI](https://devcenter.heroku.com/articles/heroku-cli-commands)
11
- or [dokku CLI](https://dokku.com/docs/deployment/application-management).
10
+ from [heroku](https://devcenter.heroku.com/articles/heroku-cli-commands)
11
+ or [dokku](https://dokku.com/docs/deployment/application-management) CLI.
12
12
 
13
13
  🏗 `eien` uses [Krane](https://github.com/Shopify/krane) gem to deploy Kubernetes resources. This allows you to:
14
14
 
@@ -24,11 +24,15 @@ For more information visit https://github.com/Shopify/krane.
24
24
 
25
25
  Install the gem and add to the application's Gemfile by executing:
26
26
 
27
- $ bundle add eien
27
+ ```
28
+ $ bundle add eien
29
+ ```
28
30
 
29
31
  If bundler is not being used to manage dependencies, install the gem by executing:
30
32
 
31
- $ gem install eien
33
+ ```
34
+ $ gem install eien
35
+ ```
32
36
 
33
37
  ️⭐️ *Recommendation*: Lock down the version of `eien` gem by adding the gem to `Gemfile` to ensure consistency. If you don't use `bundler` just create `Gemfile` only for `eien` gem version tracking.
34
38
 
@@ -36,8 +40,9 @@ If bundler is not being used to manage dependencies, install the gem by executin
36
40
 
37
41
  1. Initialize Kubernetes cluster for `eien`
38
42
 
39
-
43
+ ```
40
44
  $ eien init <kubernetes context>
45
+ ```
41
46
 
42
47
  This will deploy `eien` [Kubernetes Custom Resource Definitions](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources) to store app , processes and other definitions. Those are used to generate Kubernetes resources when depoying the apps.
43
48
 
@@ -51,7 +56,7 @@ This will deploy `eien` [Kubernetes Custom Resource Definitions](https://kuberne
51
56
  3. Create first process (like Procfile process type)
52
57
 
53
58
  ```
54
- $ eien ps create web --enabled --image ealen/echo-server:latest --replicas 3 --ports http:80
59
+ $ eien ps create web --image ealen/echo-server:latest --replicas 3 --ports http:80
55
60
  ```
56
61
 
57
62
  4. Create domain
@@ -64,7 +69,7 @@ This will deploy `eien` [Kubernetes Custom Resource Definitions](https://kuberne
64
69
  5. Create route to route HTTP request from domain to process port
65
70
 
66
71
  ```
67
- $ eien route create root --enabled --domains myapp.x.x.x.x.nip.io --path / --process web --port http
72
+ $ eien route create root --domains myapp.x.x.x.x.nip.io --path / --process web --port http
68
73
  ```
69
74
 
70
75
 
data/lib/eien/cli/cli.rb CHANGED
@@ -48,6 +48,14 @@ module Eien
48
48
  exit(1)
49
49
  end
50
50
 
51
+ def require_options(allowed_options, default_options = {})
52
+ symbolized_allowed_options = allowed_options.map(&:to_sym)
53
+ symbolized_default_options = default_options.symbolize_keys
54
+ symbolized_options = options.to_h.symbolize_keys
55
+
56
+ symbolized_default_options.merge(symbolized_options.slice(*symbolized_allowed_options))
57
+ end
58
+
51
59
  def colorize_error(error)
52
60
  ColorizedString.new(error).light_red
53
61
  end
@@ -80,9 +80,9 @@ module Eien
80
80
  require_context!(context)
81
81
  require_app!(app)
82
82
 
83
- default_attributes = { enabled: true }
84
- attributes = default_attributes
85
- .merge(options.slice(*::Eien::Domains::UpdateTask::ALLOWED_ATTRIBUTES.map(&:to_s)).symbolize_keys)
83
+ attributes = require_options(::Eien::Domains::UpdateTask::ALLOWED_ATTRIBUTES, {
84
+ enabled: true,
85
+ })
86
86
 
87
87
  ::Eien::Domains::CreateTask.new(
88
88
  context,
@@ -93,29 +93,6 @@ module Eien
93
93
  end
94
94
  end
95
95
 
96
- # desc "update DOMAIN", "updates domain"
97
- #
98
- # domain_options
99
- #
100
- # def update(domain)
101
- # rescue_and_exit do
102
- # context = ::Eien.context_or_default(options[:context])
103
- # app = ::Eien.app_or_default(options[:app])
104
- #
105
- # require_context!(context)
106
- # require_app!(app)
107
- #
108
- # attributes = options.slice(*::Eien::Domains::UpdateTask::ALLOWED_ATTRIBUTES.map(&:to_s)).symbolize_keys
109
- #
110
- # ::Eien::Domains::UpdateTask.new(
111
- # context,
112
- # app,
113
- # domain,
114
- # **attributes
115
- # ).run!
116
- # end
117
- # end
118
-
119
96
  desc "delete DOMAIN", "deletes domain"
120
97
 
121
98
  def delete(domain)
@@ -85,9 +85,12 @@ module Eien
85
85
  require_context!(context)
86
86
  require_app!(app)
87
87
 
88
- attributes = options.slice(*::Eien::Processes::UpdateTask::ALLOWED_ATTRIBUTES.map(&:to_s)).symbolize_keys
89
- attributes[:config] = "default" unless options[:config]
90
- attributes[:secret] = "default" unless options[:secret]
88
+ attributes = require_options(::Eien::Processes::UpdateTask::ALLOWED_ATTRIBUTES, {
89
+ enabled: true,
90
+ config: "default",
91
+ secret: "default",
92
+ ports: {},
93
+ })
91
94
 
92
95
  ::Eien::Processes::CreateTask.new(
93
96
  context,
@@ -110,10 +113,8 @@ module Eien
110
113
  require_context!(context)
111
114
  require_app!(app)
112
115
 
113
- attributes = options.slice(*::Eien::Processes::UpdateTask::ALLOWED_ATTRIBUTES.map(&:to_s)).symbolize_keys
116
+ attributes = require_options(::Eien::Processes::UpdateTask::ALLOWED_ATTRIBUTES)
114
117
  attributes[:ports] = {} if options[:"no-ports"]
115
- attributes[:config] = "default" unless options[:config]
116
- attributes[:secret] = "default" unless options[:secret]
117
118
 
118
119
  ::Eien::Processes::UpdateTask.new(
119
120
  context,
@@ -82,7 +82,9 @@ module Eien
82
82
  require_context!(context)
83
83
  require_app!(app)
84
84
 
85
- attributes = options.slice(*::Eien::Routes::UpdateTask::ALLOWED_ATTRIBUTES.map(&:to_s)).symbolize_keys
85
+ attributes = require_options(::Eien::Routes::UpdateTask::ALLOWED_ATTRIBUTES, {
86
+ enabled: true,
87
+ })
86
88
 
87
89
  ::Eien::Routes::CreateTask.new(
88
90
  context,
@@ -105,7 +107,7 @@ module Eien
105
107
  require_context!(context)
106
108
  require_app!(app)
107
109
 
108
- attributes = options.slice(*::Eien::Routes::UpdateTask::ALLOWED_ATTRIBUTES.map(&:to_s)).symbolize_keys
110
+ attributes = require_options(::Eien::Routes::UpdateTask::ALLOWED_ATTRIBUTES)
109
111
 
110
112
  ::Eien::Routes::UpdateTask.new(
111
113
  context,
data/lib/eien/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eien
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eien
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ahmed Al Hafoudh
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-05 00:00:00.000000000 Z
11
+ date: 2022-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -365,7 +365,7 @@ licenses:
365
365
  metadata:
366
366
  homepage_uri: https://github.com/alhafoudh/eien
367
367
  source_code_uri: https://github.com/alhafoudh/eien
368
- post_install_message:
368
+ post_install_message:
369
369
  rdoc_options: []
370
370
  require_paths:
371
371
  - lib
@@ -380,8 +380,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
380
  - !ruby/object:Gem::Version
381
381
  version: '0'
382
382
  requirements: []
383
- rubygems_version: 3.3.17
384
- signing_key:
383
+ rubygems_version: 3.3.7
384
+ signing_key:
385
385
  specification_version: 4
386
386
  summary: A command line tool that helps you deploy and manage apps in Kubernetes
387
387
  test_files: []