ish_models 0.0.33.262 → 0.0.33.264
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ish/email_campaign.rb +6 -3
- data/lib/ish/email_template.rb +1 -0
- data/lib/ish/invoice.rb +19 -6
- data/lib/ish/user_profile.rb +8 -1
- data/lib/ish_models.rb +3 -1
- data/lib/wco/appliance.rb +26 -0
- data/lib/wco/appliance_tmpl.rb +15 -0
- data/lib/wco/serverhost.rb +98 -0
- metadata +18 -2
- data/lib/wco/organization.rb-trash +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9aa0f5449341876a2a20d32a0039150f4ee9daade2a6a50d908739ed1f61f43
|
4
|
+
data.tar.gz: 3ceaee3e0d1b0d7781b3447ba3979e5e1bced6d5b441bb99c982346be70f8434
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4fdb5150951cb081cdbccf570dfa365a03d86a221198a3dd4fddb94b57321fd9675f90aa5debc7c0318f3a2ab5cb90106c2ae10de776091fb2eccb62af955ee
|
7
|
+
data.tar.gz: 46d0ff827a6cc868cf15e24cb021761209f5a513f31691a01cae1b90c8b56f13505ceee73bb581b863bda08c93afafdd7a5688741f190817fb7bb72b45eb533f
|
data/lib/ish/email_campaign.rb
CHANGED
@@ -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|
|
19
|
-
piousbox@gmail.com
|
20
|
-
|
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
|
data/lib/ish/email_template.rb
CHANGED
@@ -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
|
-
|
5
|
-
|
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 :
|
28
|
+
field :amount_cents, type: Integer
|
27
29
|
|
28
30
|
has_many :payments, :class_name => 'Ish::Payment'
|
29
|
-
field :
|
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
|
data/lib/ish/user_profile.rb
CHANGED
@@ -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
@@ -74,8 +74,10 @@ require 'office/email_message'
|
|
74
74
|
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
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
class Wco::Appliance
|
3
|
+
include Mongoid::Document
|
4
|
+
include Mongoid::Timestamps
|
5
|
+
|
6
|
+
field :name
|
7
|
+
validates :name, uniqueness: { scope: :leadset_id }, presence: true
|
8
|
+
field :kind
|
9
|
+
field :environment
|
10
|
+
|
11
|
+
field :subdomain
|
12
|
+
field :domain
|
13
|
+
def host
|
14
|
+
"#{subdomain}.#{domain}"
|
15
|
+
end
|
16
|
+
|
17
|
+
field :leadset_id
|
18
|
+
def leadset
|
19
|
+
Leadset.find leadset_id
|
20
|
+
end
|
21
|
+
|
22
|
+
belongs_to :serverhost, class_name: 'Wco::Serverhost'
|
23
|
+
|
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.
|
4
|
+
version: 0.0.33.264
|
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: []
|
@@ -171,8 +185,10 @@ files:
|
|
171
185
|
- lib/photo.rb
|
172
186
|
- lib/report.rb
|
173
187
|
- lib/video.rb
|
174
|
-
- lib/wco/
|
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:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
##
|
3
|
-
## @TODO: merge this into a Leadset (sql) _vp_ 2023-08-09
|
4
|
-
##
|
5
|
-
class Wco::Organization
|
6
|
-
include Mongoid::Document
|
7
|
-
include Mongoid::Timestamps
|
8
|
-
|
9
|
-
field :name
|
10
|
-
field :customer_id # stripe
|
11
|
-
|
12
|
-
has_many :profiles, class_name: '::Ish::UserProfile', inverse_of: :organization
|
13
|
-
has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :organization
|
14
|
-
|
15
|
-
end
|