ish_models 0.0.33.263 → 0.0.33.265

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: 3f2df50e8844bd9d616c1d84109defdba8e03303891d9a5d683aa9f54ea320fb
4
- data.tar.gz: 53b870fb6162e9976769c3ec552b01cf0b730dabdf811fe47a97f840e7ead17a
3
+ metadata.gz: 1feaa866f501a91b64f3099038f17839932e6fa8f64aa47480da8f619f72382b
4
+ data.tar.gz: c23788810130831b83b44bb41b293bfe822f7775585e0496def49976af3c2366
5
5
  SHA512:
6
- metadata.gz: fe6500a906340a946f2a4797e80682c6721f7d42f18ac9226cdfcfd4e9609e1a327762130f26828d8cde85fbaf2ef6968a6ae0d38d3bbe279533ae7ac548787f
7
- data.tar.gz: 9d2687e047eb3dd943b03b4981b34cae53200eee950599ad74a6e1acec578d9ca5c05bccef106bb55e5d280526c3e282ddd19a2673abe87fba9fd027821292df
6
+ metadata.gz: a325995f72c871c6a31db6c59862cbc96ff6f5d42faea3dac3f06179469224de2b4258de05c8b9de9b3256a313d7cffe33b6c0313c9cec2a610417e6967bb0cc
7
+ data.tar.gz: 16c7fa681f9af5ea0c88a017bcd8c8f7003cd42854b155046cb7ca6de7642edcb1bf52efb7cac96770e34b12cbcb3d3df0094f9cd618c409cba55dff048f0357
@@ -12,9 +12,10 @@ class Iro::OptionWatch
12
12
 
13
13
  field :symbol # like NVDA_021822C230
14
14
 
15
- KIND_OPTION = 'option'
16
- KIND_STOCK = 'stock'
17
- KINDS = [ KIND_OPTION, KIND_STOCK ]
15
+ KIND_OPTION = 'option'
16
+ KIND_STOCK = 'stock'
17
+ KIND_GET_CHAINS = 'get-chains'
18
+ KINDS = [ KIND_OPTION, KIND_STOCK, KIND_GET_CHAINS ]
18
19
  field :kind, type: String
19
20
  validates :kind, presence: true
20
21
  def self.kinds_list
@@ -15,9 +15,12 @@ class Ish::EmailCampaign
15
15
 
16
16
  field :from_email
17
17
  validates_presence_of :from_email
18
- FROM_EMAILS = %w| hello@infiniteshelter.com no-reply@infiniteshelter.com
19
- piousbox@gmail.com hello@piousbox.com no-reply@piousbox.com victor@piousbox.com
20
- admin@wasya.co hello@wasya.co no-reply@wasya.co victor@wasya.co |
18
+ FROM_EMAILS = %w| hello@infiniteshelter.com no-reply@infiniteshelter.com
19
+ piousbox@gmail.com
20
+ hello@piousbox.com no-reply@piousbox.com victor@piousbox.com
21
+ admin@wasya.co hello@wasya.co no-reply@wasya.co victor@wasya.co
22
+ admin@mail.wasyaco.com hello@mail.wasyaco.com no-reply@mail.wasyaco.com victor@mail.wasyaco.com
23
+ |;
21
24
  def self.from_email_list
22
25
  [ [nil, nil] ] + FROM_EMAILS.map { |i| [i, i] }
23
26
  end
@@ -12,6 +12,7 @@ class ::Ish::EmailTemplate
12
12
  field :layout, type: :string, default: 'plain'
13
13
  LAYOUTS = %w| plain
14
14
  m20221201react m20221222merryxmas
15
+ marketing_node_1
15
16
  marketing_react_1 marketing_react_2 marketing_react_3
16
17
  marketing_ror_1 marketing_ror_2
17
18
  marketing_wordpres_1 marketing_wordpress_2
data/lib/ish/invoice.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  require 'autoinc'
2
+ # require "prawn"
2
3
 
3
- #
4
- # Invoice - for wasya.co
5
- # _vp_ 20171031
6
- #
4
+ ##
5
+ ## Invoice - for wasya.co
6
+ ## 2017-10-31 _vp_ Start
7
+ ## 2023-08-18 _vp_ Continue
8
+ ##
7
9
  class Ish::Invoice
8
10
  include Mongoid::Document
9
11
  include Mongoid::Timestamps
@@ -23,13 +25,24 @@ class Ish::Invoice
23
25
  field :number, type: Integer
24
26
  increments :number
25
27
 
26
- field :amount, type: Integer
28
+ field :amount_cents, type: Integer
27
29
 
28
30
  has_many :payments, :class_name => 'Ish::Payment'
29
- field :paid_amount, type: Integer, :default => 0
31
+ field :paid_amount_cents, type: Integer, :default => 0 ## @TODO: unused? _vp_ 2023-08-18
30
32
 
31
33
  field :description, type: String
32
34
 
33
35
  field :items, type: Array
34
36
 
37
+ # def generate_pdf pdf=nil
38
+ # pdf ||= Prawn::Document.new
39
+ # pdf.text "Job Summary."
40
+ # filename = "a-summary.pdf"
41
+ # path = Rails.root.join 'tmp', filename
42
+ # pdf.render_file path
43
+ # data = File.read path
44
+ # File.delete(path) if File.exist?(path)
45
+ # return data
46
+ # end
47
+
35
48
  end
@@ -36,7 +36,14 @@ class Ish::UserProfile
36
36
  field :leadset_id, type: Integer
37
37
  def organization_name
38
38
  'Some Org'
39
- # ::Leadset.find( leadset_id )&.name
39
+ # ::Leadset.find( leadset_id )&.name || 'Some Org'
40
+ end
41
+ # def leadset
42
+ # ::Leadset.find( leadset_id )
43
+ # end
44
+ # @TODO: change _vp_ 2023-08-21
45
+ def next_serverhost
46
+ Wco::Serverhost.where({ leadset_id: leadset_id }).first
40
47
  end
41
48
 
42
49
  ROLE_GUY = :guy
data/lib/ish_models.rb CHANGED
@@ -75,7 +75,9 @@ require 'office/email_message_stub'
75
75
  require 'office/scheduled_email_action'
76
76
 
77
77
  require 'wco/appliance'
78
+ require 'wco/appliance_tmpl'
78
79
  require 'wco/product'
80
+ require 'wco/serverhost'
79
81
  require 'wco/subscription'
80
82
 
81
83
 
data/lib/wco/appliance.rb CHANGED
@@ -4,12 +4,23 @@ class Wco::Appliance
4
4
  include Mongoid::Timestamps
5
5
 
6
6
  field :name
7
+ validates :name, uniqueness: { scope: :leadset_id }, presence: true
7
8
  field :kind
8
9
  field :environment
10
+
9
11
  field :subdomain
10
12
  field :domain
13
+ def host
14
+ "#{subdomain}.#{domain}"
15
+ end
11
16
 
12
17
  field :leadset_id
13
- belongs_to :profile, class_name: 'Ish::UserProfile', optional: true
18
+ def leadset
19
+ Leadset.find leadset_id
20
+ end
21
+
22
+ belongs_to :serverhost, class_name: 'Wco::Serverhost'
14
23
 
15
24
  end
25
+
26
+
@@ -0,0 +1,15 @@
1
+
2
+ class Wco::ApplianceTmpl
3
+ include Mongoid::Document
4
+ include Mongoid::Timestamps
5
+
6
+ field :kind
7
+ validates :kind, uniqueness: true, presence: true
8
+
9
+ field :image
10
+ validates :image, presence: true
11
+
12
+ KIND_CORPHOME1 = 'corphome1'
13
+ KIND_HELLOWORLD = 'helloworld'
14
+ KINDS = [ 'SMT', 'EmailCRM', KIND_CORPHOME1, KIND_HELLOWORLD, 'Drupal', 'Odoo', 'Mautic', 'IroWor', 'eCommStore1' ]
15
+ end
@@ -0,0 +1,98 @@
1
+
2
+ require 'net/scp'
3
+ # require 'autoinc'
4
+
5
+ class Wco::Serverhost
6
+ include Mongoid::Document
7
+ include Mongoid::Timestamps
8
+ # include Mongoid::Autoinc
9
+
10
+ field :name, type: :string
11
+ validates :name, uniqueness: { scope: :leadset_id }, presence: true
12
+
13
+ field :next_port, type: :integer, default: 8000
14
+ # increments :next_port
15
+
16
+ field :leadset_id, type: :integer
17
+
18
+ ## net-ssh, sshkit
19
+ field :ssh_host
20
+ field :ssh_username
21
+ field :ssh_key
22
+ field :nginx_root, default: '/opt/nginx'
23
+
24
+ has_many :appliances, class_name: 'Wco::Appliance'
25
+
26
+ # def nginx_add_site rendered_str=nil, config={}
27
+ # # puts! config, '#nginx_add_site'
28
+ # File.write( "/usr/local/etc/nginx/sites-available/#{config[:service_name]}", rendered_str )
29
+ # out = `sudo nginx enable-site #{config[:service_name]} ; \
30
+ # nginx -s reload ; \
31
+ # echo ok
32
+ # `;
33
+ # puts! out, 'out'
34
+ # end
35
+
36
+ def nginx_add_site rendered_str=nil, config={}
37
+ puts! rendered_str, '#nginx_add_site // rendered_str'
38
+ puts! config, '#nginx_add_site // config'
39
+
40
+ File.write( "tmp/#{config[:service_name]}", rendered_str )
41
+ Net::SSH.start( ssh_host, ssh_username, keys: ssh_key ) do |ssh|
42
+
43
+ out = ssh.scp.upload! "tmp/#{config[:service_name]}", "#{nginx_root}/conf/sites-available/"
44
+ puts! out, 'out'
45
+
46
+ out = ssh.exec! "#{nginx_root}/nginx enable-site #{config[:service_name]} ; #{nginx_root}/nginx -s reload"
47
+ puts! out, 'out'
48
+
49
+ end
50
+
51
+ end
52
+
53
+ def docker_add_service rendered_str=nil, config={}
54
+ # puts! config, '#docker_add_service'
55
+ File.write( "/Users/piousbox/projects/docker_demo/dc-#{config[:service_name]}.yml", rendered_str )
56
+ out = ` mkdir /Users/piousbox/projects/docker_demo/#{config[:service_name]}_data `
57
+ puts! out, 'out'
58
+ out = ` cd /Users/piousbox/projects/docker_demo/ ; \
59
+ docker compose -f dc-#{config[:service_name]}.yml up -d #{config[:service_name]} ; \
60
+ echo ok
61
+ `;
62
+ puts! out, 'out'
63
+ end
64
+
65
+ def load_data rendered_str=nil, config={}
66
+ File.write( "/Users/piousbox/projects/docker_demo/#{config[:service_name]}_data/index.html", rendered_str )
67
+ end
68
+
69
+
70
+ end
71
+
72
+ # class Instance
73
+ # def chmod
74
+ # start do |ssh|
75
+ # ssh.exec "sudo chmod +x /tmp/provision.sh"
76
+ # # other operations on ssh
77
+ # end
78
+ # end
79
+ # private
80
+ # def start
81
+ # Net::SSH.start(ip, 'ubuntu', keys: "mykey.pem" ) do |ssh|
82
+ # yield ssh
83
+ # end
84
+ # end
85
+ # end
86
+
87
+
88
+ ## works:
89
+ # nginx_root = '/opt/nginx'
90
+ # config = { service_name: 'abba', }
91
+ # Net::SSH.start( "18.209.12.11", "ubuntu", keys: "access/mac_id_rsa_3.pem" ) do |ssh|
92
+ # out = ssh.scp.upload! "tmp/#{config[:service_name]}", "/opt/tmp/two.txt" do |ch, name, sent, total|
93
+ # puts "#{name}: #{sent}/#{total}"
94
+ # end
95
+ # puts! out, 'out'
96
+ # end
97
+
98
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33.263
4
+ version: 0.0.33.265
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 6.1.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: net-ssh
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 7.1.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 7.1.0
125
139
  description: models of ish
126
140
  email: victor@wasya.co
127
141
  executables: []
@@ -172,7 +186,9 @@ files:
172
186
  - lib/report.rb
173
187
  - lib/video.rb
174
188
  - lib/wco/appliance.rb
189
+ - lib/wco/appliance_tmpl.rb
175
190
  - lib/wco/product.rb
191
+ - lib/wco/serverhost.rb
176
192
  - lib/wco/subscription.rb
177
193
  homepage: https://wasya.co
178
194
  licenses: