Class: WcoHosting::ApplianceTmpl
- Inherits:
-
Object
- Object
- WcoHosting::ApplianceTmpl
- Includes:
- Mongoid::Document, Mongoid::Paranoia, Mongoid::Timestamps, Wco::Utils
- Defined in:
- app/models/wco_hosting/appliance_tmpl.rb
Overview
require_relative ‘../wco/subscription’
Constant Summary collapse
- KIND_CRM =
- 2023-12-08
-
These names are impossible to change already.
'crm'- KIND_DRUPAL =
trash
'drupal'- KIND_HELLOWORLD =
drupal
'helloworld'- KIND_IROWOR =
static
'irowor'- KIND_JENKINS =
ror
'jenkins'- KIND_MATOMO =
jenkins
'matomo'- KIND_MOODLE =
docker
'moodle'- KIND_PRESTASHOP =
docker
'prestashop'- KIND_REACT =
docker
'react'- KIND_SMT =
static
'smt'- KIND_WORDPRESS =
ror
'wordpress'- KIND_TRASH =
docker
'trash'- KIND_TMP =
trash
'tmp'- KINDS =
static
[ nil, KIND_CRM, KIND_DRUPAL, KIND_HELLOWORLD, KIND_IROWOR, KIND_JENKINS, KIND_MATOMO, KIND_MOODLE, KIND_PRESTASHOP, KIND_REACT, KIND_SMT, KIND_WORDPRESS, KIND_TRASH, KIND_TMP ]
Class Method Summary collapse
Instance Method Summary collapse
- #name ⇒ Object
- #playbook_name ⇒ Object
- #set_stripe_product_price ⇒ Object
- #to_s ⇒ Object
- #volume_zip ⇒ Object
Methods included from Wco::Utils
Class Method Details
.latest_of(kind) ⇒ Object
89 90 91 |
# File 'app/models/wco_hosting/appliance_tmpl.rb', line 89 def self.latest_of kind where({ kind: kind }).order_by({ version: :desc }).first end |
Instance Method Details
#name ⇒ Object
38 39 40 |
# File 'app/models/wco_hosting/appliance_tmpl.rb', line 38 def name "#{kind} #{version}" end |
#playbook_name ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/models/wco_hosting/appliance_tmpl.rb', line 42 def playbook_name case kind when KIND_SMT return 'hosted-packagedapp' when KIND_DRUPAL return 'hosted-drupal' when KIND_HELLOWORLD return 'hosted-static' else throw '0ip - not implemented' end end |
#set_stripe_product_price ⇒ Object
106 107 108 109 |
# File 'app/models/wco_hosting/appliance_tmpl.rb', line 106 def set_stripe_product_price stripe_product = Stripe::Product.create({ name: "Appliance #{self}" }) self.product_id = stripe_product.id end |
#to_s ⇒ Object
111 112 113 |
# File 'app/models/wco_hosting/appliance_tmpl.rb', line 111 def to_s "#{kind}-#{version}" end |
#volume_zip ⇒ Object
78 79 80 81 82 83 84 |
# File 'app/models/wco_hosting/appliance_tmpl.rb', line 78 def volume_zip if volume_zip_exe eval( volume_zip_exe ) else volume_zip_url end end |