Class: Eien::CLI::Routes
Class Method Summary collapse
Instance Method Summary collapse
- #create(name) ⇒ Object
- #delete(name) ⇒ Object
- #disable(route) ⇒ Object
- #enable(route) ⇒ Object
- #list ⇒ Object
- #update(name) ⇒ Object
Methods inherited from CLI
Class Method Details
.route_options ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/eien/cli/routes.rb', line 9 def self. option(:enabled, type: :boolean) option(:domains, type: :array) option(:path) option(:process) option(:port) end |
Instance Method Details
#create(name) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/eien/cli/routes.rb', line 77 def create(name) rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) attributes = (::Eien::Routes::UpdateTask::ALLOWED_ATTRIBUTES, { enabled: true, }) ::Eien::Routes::CreateTask.new( context, app, name, **attributes, ).run! end end |
#delete(name) ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/eien/cli/routes.rb', line 123 def delete(name) rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) ::Eien::Routes::DeleteTask.new( context, app, name, ).run! end end |
#disable(route) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/eien/cli/routes.rb', line 56 def disable(route) rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) ::Eien::Routes::UpdateTask.new( context, app, route, enabled: false, ).run! end end |
#enable(route) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/eien/cli/routes.rb', line 37 def enable(route) rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) ::Eien::Routes::UpdateTask.new( context, app, route, enabled: true, ).run! end end |
#list ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/eien/cli/routes.rb', line 20 def list rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) ::Eien::Routes::ListTask.new( context, app, ).run! end end |
#update(name) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/eien/cli/routes.rb', line 102 def update(name) rescue_and_exit do context = ::Eien.context_or_default([:context]) app = ::Eien.app_or_default([:app]) require_context!(context) require_app!(app) attributes = (::Eien::Routes::UpdateTask::ALLOWED_ATTRIBUTES) ::Eien::Routes::UpdateTask.new( context, app, name, **attributes, ).run! end end |