ish_models 3.0.0.1 → 3.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +15 -0
  5. data/app/assets/config/ish_models_manifest.js +1 -0
  6. data/app/assets/stylesheets/ish_models/application.css +15 -0
  7. data/app/controllers/ish_models/application_controller.rb +4 -0
  8. data/app/helpers/ish_models/application_helper.rb +4 -0
  9. data/app/jobs/ish_models/application_job.rb +4 -0
  10. data/app/mailers/ish_models/application_mailer.rb +6 -0
  11. data/app/models/ish_models/application_record.rb +5 -0
  12. data/app/views/layouts/ish_models/application.html.erb +15 -0
  13. data/config/routes.rb +2 -0
  14. data/lib/ish_models/engine.rb +5 -0
  15. data/lib/ish_models/version.rb +3 -0
  16. data/lib/ish_models.rb +5 -93
  17. data/lib/tasks/ish_models_tasks.rake +4 -0
  18. data/lib/{office/admin_message.rb → wco/profile.rb} +2 -5
  19. metadata +42 -165
  20. data/lib/address.rb +0 -20
  21. data/lib/feature.rb +0 -32
  22. data/lib/gallery.rb +0 -66
  23. data/lib/gameui/asset3d.rb +0 -33
  24. data/lib/gameui/map.rb +0 -260
  25. data/lib/gameui/map_bookmark.rb +0 -9
  26. data/lib/gameui/marker.rb +0 -128
  27. data/lib/iro/option_watch.rb +0 -72
  28. data/lib/ish/cache_key.rb +0 -14
  29. data/lib/ish/configuration.rb +0 -11
  30. data/lib/ish/crawler.rb +0 -26
  31. data/lib/ish/email_campaign.rb +0 -55
  32. data/lib/ish/email_context.rb +0 -113
  33. data/lib/ish/email_template.rb +0 -115
  34. data/lib/ish/email_unsubscribe.rb +0 -19
  35. data/lib/ish/event.rb +0 -20
  36. data/lib/ish/image_asset.rb +0 -38
  37. data/lib/ish/invoice.rb +0 -130
  38. data/lib/ish/lorem_ipsum.rb +0 -30
  39. data/lib/ish/meeting.rb +0 -31
  40. data/lib/ish/payment.rb +0 -29
  41. data/lib/ish/premium_item.rb +0 -13
  42. data/lib/ish/railtie.rb +0 -8
  43. data/lib/ish/user_profile.rb +0 -149
  44. data/lib/ish/utils.rb +0 -45
  45. data/lib/mongoid/votable.rb +0 -247
  46. data/lib/mongoid/voter.rb +0 -96
  47. data/lib/newsitem.rb +0 -94
  48. data/lib/office/action.rb +0 -32
  49. data/lib/office/action_tie.rb +0 -16
  50. data/lib/office/directmail_envelope.rb +0 -51
  51. data/lib/office/email_action.rb +0 -34
  52. data/lib/office/email_action_tie.rb +0 -18
  53. data/lib/office/email_attachment.rb +0 -12
  54. data/lib/office/email_conversation.rb +0 -102
  55. data/lib/office/email_conversation_lead.rb +0 -11
  56. data/lib/office/email_conversation_tag.rb +0 -14
  57. data/lib/office/email_filter.rb +0 -45
  58. data/lib/office/email_message.rb +0 -192
  59. data/lib/office/email_message_stub.rb +0 -22
  60. data/lib/office/emailtag.rb +0 -27
  61. data/lib/office/emailtag_email_conversation.rb +0 -10
  62. data/lib/office/lead_action.rb +0 -24
  63. data/lib/office/lead_action_template.rb +0 -47
  64. data/lib/office/obfuscated_redirect.rb +0 -12
  65. data/lib/office/scheduled_email_action.rb +0 -62
  66. data/lib/photo.rb +0 -87
  67. data/lib/report.rb +0 -65
  68. data/lib/video.rb +0 -91
  69. data/lib/wco/appliance.rb +0 -52
  70. data/lib/wco/appliance_tmpl.rb +0 -56
  71. data/lib/wco/dns_domain.rb +0 -23
  72. data/lib/wco/email_conversation_lead.rb +0 -10
  73. data/lib/wco/leadset.rb +0 -26
  74. data/lib/wco/price.rb +0 -30
  75. data/lib/wco/product.rb +0 -35
  76. data/lib/wco/serverhost.rb +0 -140
  77. data/lib/wco/subscription.rb +0 -25
data/lib/photo.rb DELETED
@@ -1,87 +0,0 @@
1
-
2
- # require 'aws-sdk'
3
- require 'mongoid_paperclip'
4
-
5
- class Photo
6
- include Mongoid::Document
7
- include Mongoid::Timestamps
8
- include Mongoid::Paperclip
9
- include Ish::Utils
10
-
11
- belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile'
12
- belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile', :inverse_of => :profile_photo
13
- belongs_to :email_message, :optional => true, :class_name => 'Office::EmailMessage'
14
- belongs_to :report, :optional => true
15
- belongs_to :gallery, :optional => true
16
- belongs_to :newsitem, :optional => true
17
-
18
- # photo.photo.to_s.split('/').last.split('?').first
19
- field :name, :type => String
20
- def name
21
- return self[:name] if self[:name]
22
- update_attribute(:name, self.photo.to_s.split('/').last.split('?').first)
23
- name
24
- end
25
-
26
- field :ordering, type: :integer
27
- index({ ordering: -1 })
28
-
29
- field :descr, :type => String
30
- field :subhead
31
- field :weight, :type => Integer, :default => 10
32
-
33
- field :is_public, :type => Boolean, :default => true
34
- field :is_trash, :type => Boolean, :default => false # @TODO: nuke this boolean _vp_ 20170515
35
- default_scope ->{ where({ :is_trash => false }) }
36
-
37
- has_mongoid_attached_file :photo,
38
- :styles => {
39
- :mini => '20x20#',
40
- :thumb => "100x100#",
41
- :thumb2 => "200x200#",
42
- :s169 => "640x360#",
43
- :small => "400x400>",
44
- :large => '950x650>',
45
- },
46
- :storage => :s3,
47
- :s3_credentials => ::S3_CREDENTIALS,
48
- :path => "photos/:style/:id/:filename",
49
- :s3_protocol => 'https',
50
- :validate_media_type => false,
51
- s3_region: ::S3_CREDENTIALS[:region]
52
- validates_attachment_content_type :photo, :content_type => ["image/webp", "image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
53
-
54
- def self.n_per_manager_gallery
55
- 25
56
- end
57
-
58
- def export_fields
59
- %w|
60
- gallery_id
61
- name descr weight is_public is_trash
62
-
63
- photo_file_name photo_content_type photo_file_size photo_updated_at photo_fingerprint
64
- |
65
- end
66
-
67
- ## From: https://gist.github.com/WizardOfOgz/1012107?permalink_comment_id=1442486
68
- attr_accessor :content_type, :image_data, :original_filename
69
- def decode_base64_image
70
- if image_data && content_type && original_filename
71
- decoded_data = Base64.decode64(image_data)
72
-
73
- data = StringIO.new(decoded_data)
74
- data.class_eval do
75
- attr_accessor :content_type, :original_filename
76
- end
77
-
78
- data.content_type = content_type
79
- data.original_filename = File.basename(original_filename)
80
-
81
- self.photo = data
82
- end
83
- end
84
-
85
- end
86
-
87
-
data/lib/report.rb DELETED
@@ -1,65 +0,0 @@
1
- class Report
2
- include ::Mongoid::Document
3
- include ::Mongoid::Timestamps
4
- include Ish::PremiumItem
5
- include Ish::Utils
6
-
7
- field :name, :type => String
8
- validates :name, :presence => true
9
- index({ :name => 1, :is_trash => 1 })
10
-
11
- field :slug
12
- validates :slug, :uniqueness => true, :presence => true
13
- index({ :slug => 1 }, { :unique => true })
14
- before_validation :set_slug, :on => :create
15
-
16
- field :subhead
17
-
18
- ## Can be one of: default (nil), longscroll,
19
- ## wordpress e.g. https://piousbox.com/wp-json/wp/v2/posts?slug=intro
20
- # ITEM_TYPES = %w| longscroll wordpress |
21
- field :item_type, type: String
22
-
23
- field :descr, :type => String
24
- field :raw_json
25
-
26
- field :is_trash, :type => Boolean, :default => false
27
- index({ :is_trash => 1, :is_public => 1 })
28
-
29
- field :is_public, :type => Boolean, :default => true
30
- index({ :is_public => 1 })
31
- scope :public, ->{ where({ is_public: true }) }
32
-
33
- field :x, :type => Float
34
- field :y, :type => Float
35
- field :z, :type => Float
36
-
37
- belongs_to :user_profile, :optional => true, :class_name => 'Ish::UserProfile'
38
- has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_reports
39
-
40
- has_one :photo
41
-
42
- has_many :newsitems
43
-
44
- ## @TODO: trash, remove
45
- def self.list conditions = { :is_trash => false }
46
- out = self.where( conditions ).order_by( :name => :asc ).limit( 100 )
47
- [['', nil]] + out.map { |item| [ item.name, item.id ] }
48
- end
49
-
50
- PER_PAGE = 10
51
- def self.paginates_per
52
- self::PER_PAGE
53
- end
54
-
55
- def self.clear
56
- if Rails.env.test?
57
- self.unscoped.each { |r| r.remove }
58
- end
59
- end
60
-
61
- def export_fields
62
- %w| name descr |
63
- end
64
-
65
- end
data/lib/video.rb DELETED
@@ -1,91 +0,0 @@
1
- require 'mongoid/paranoia'
2
- require 'mongoid_paperclip'
3
- require_relative './mongoid/votable.rb'
4
-
5
- class Video
6
- include Mongoid::Document
7
- include Mongoid::Timestamps
8
- include Mongoid::Paperclip
9
- include Mongoid::Paranoia
10
- include Ish::PremiumItem
11
- include Ish::Utils
12
-
13
- include Mongoid::Votable
14
- vote_point self, :up => +1, :down => -1
15
-
16
- PER_PAGE = 6
17
-
18
- field :name, :type => String
19
- field :descr, :type => String, :as => :description
20
- field :subhead ## still need it... 2023-03-24
21
-
22
- field :is_trash, :type => Boolean, :default => false
23
- def is_trash
24
- if deleted_at
25
- true
26
- else
27
- self[:is_trash]
28
- end
29
- end
30
-
31
- field :is_public, :type => Boolean, :default => false
32
-
33
- def published
34
- where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc })
35
- end
36
-
37
- field :lead_id, type: :integer
38
-
39
- field :x, type: Float
40
- field :y, type: Float
41
- field :z, type: Float
42
-
43
- field :youtube_id
44
- validates_uniqueness_of :youtube_id, allow_blank: true, case_sensitive: false
45
- before_save { youtube_id.present? || youtube_id = nil }
46
-
47
- belongs_to :user_profile, :class_name => 'Ish::UserProfile', :inverse_of => :videos
48
- has_and_belongs_to_many :shared_profiles, :class_name => 'Ish::UserProfile', :inverse_of => :shared_videos
49
-
50
-
51
- index({ is_trash: 1, user_profile_id: 1, created_at: 1 }, { name: 'idx1' })
52
-
53
- def self.list
54
- [['', nil]] + Video.unscoped.order_by( :created_at => :desc ).map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
55
- end
56
-
57
- has_mongoid_attached_file :video,
58
- # styles: { :thumb => { geometry: '192x108', format: 'jpeg' }, },
59
- # processors: [ :transcoder ],
60
- :storage => :s3,
61
- :s3_credentials => ::S3_CREDENTIALS,
62
- :path => "videos/:style/:id/:filename",
63
- :s3_protocol => 'https',
64
- :s3_permissions => 'public-read',
65
- :validate_media_type => false,
66
- s3_region: ::S3_CREDENTIALS[:region]
67
- validates_attachment_content_type :video, content_type: /\Avideo\/.*\Z/
68
-
69
- has_mongoid_attached_file :thumb,
70
- :styles => {
71
- :mini => '20x20#',
72
- :thumb => "100x100#",
73
- :thumb2 => "200x200#",
74
- :s169 => "640x360#",
75
- # :s43 => "640x480#",
76
- :small => "400x400>",
77
- :large => '950x650>',
78
- },
79
- :storage => :s3,
80
- :s3_credentials => ::S3_CREDENTIALS,
81
- :path => "videos/:style/:id/thumb_:filename",
82
- :s3_protocol => 'https',
83
- :validate_media_type => false,
84
- s3_region: ::S3_CREDENTIALS[:region]
85
- validates_attachment_content_type :thumb, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif", 'application/octet-stream' ]
86
-
87
- def export_fields
88
- %w| name descr |
89
- end
90
-
91
- end
data/lib/wco/appliance.rb DELETED
@@ -1,52 +0,0 @@
1
-
2
- class Wco::Appliance
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- field :kind
7
- validates :kind, presence: true
8
-
9
- field :environment
10
-
11
- field :name
12
- validates :name, uniqueness: { scope: :leadset_id }, presence: true
13
-
14
- # field :service_name
15
- def service_name
16
- # "#{@appliance[:kind]}_#{@appliance[:environment]}_#{@appliance[:name]}"
17
- "#{kind}_#{environment}_#{name}"
18
- end
19
-
20
-
21
- field :subdomain
22
- field :domain
23
- def origin
24
- "#{subdomain}.#{domain}"
25
- end
26
-
27
- field :leadset_id # old sql
28
- belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :appliances
29
-
30
- belongs_to :appliance_tmpl, class_name: 'Wco::ApplianceTmpl'
31
- def tmpl
32
- appliance_tmpl
33
- end
34
-
35
- belongs_to :serverhost, class_name: 'Wco::Serverhost'
36
-
37
-
38
- field :port
39
-
40
- STATE_PENDING = 'state-pending'
41
- STATE_LIVE = 'state-live'
42
- STATE_TERM = 'state-term'
43
- STATES = %w| state-pending state-live state-term |
44
- field :state, default: STATE_PENDING
45
-
46
- def route53_zone
47
- Wco::DnsDomain.find_by({ name: domain })[0].route53_zone
48
- end
49
-
50
- end
51
-
52
-
@@ -1,56 +0,0 @@
1
-
2
- class Wco::ApplianceTmpl
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- field :kind
7
- validates :kind, uniqueness: { scope: :version }, presence: true
8
-
9
- field :version, type: :string, default: '0.0.0'
10
- validates :version, uniqueness: { scope: :kind }, presence: true
11
- index({ kind: -1, version: -1 }, { name: :kind_version })
12
-
13
- field :descr, type: :string
14
-
15
- field :image
16
- validates :image, presence: true
17
-
18
- field :volume_zip
19
- validates :volume_zip, presence: true
20
-
21
- ## Only underscores! These become variable names.
22
- # KIND_CRM = 'kind_crm'
23
- # KIND_DRUPAL = 'kind_drupal'
24
- # KIND_HELLOWORLD = 'kind_helloworld'
25
- # KIND_IROWOR = 'kind_irowor'
26
- # KIND_JENKINS = 'kind_jenkins'
27
- # KIND_MATOMO = 'kind_matomo'
28
- # KIND_MOODLE = 'kind_moodle'
29
- # KIND_PRESTASHOP = 'kind_prestashop'
30
- # KIND_SMT = 'kind_smt'
31
- # KIND_WORDPRESS = 'kind_wordpress'
32
-
33
- ## 2023-12-08 :: These names are impossible to change already.
34
- KIND_CRM = 'crm'
35
- KIND_DRUPAL = 'drupal'
36
- KIND_HELLOWORLD = 'helloworld'
37
- KIND_IROWOR = 'irowor'
38
- KIND_JENKINS = 'jenkins'
39
- KIND_MATOMO = 'matomo'
40
- KIND_MOODLE = 'moodle'
41
- KIND_PRESTASHOP = 'prestashop'
42
- KIND_SMT = 'smt'
43
- KIND_WORDPRESS = 'wordpress'
44
-
45
- KINDS = [ KIND_CRM, KIND_DRUPAL, KIND_HELLOWORLD, KIND_IROWOR,
46
- KIND_JENKINS, KIND_MATOMO, KIND_MOODLE, KIND_PRESTASHOP, KIND_SMT,
47
- KIND_WORDPRESS ]
48
-
49
- has_many :appliances, class_name: 'Wco::Appliance'
50
-
51
- def self.latest_of kind
52
- where({ kind: kind }).order_by({ version: :desc }).first
53
- end
54
-
55
- end
56
- AppTmpl = Wco::ApplianceTmpl
@@ -1,23 +0,0 @@
1
-
2
- class Wco::DnsDomain
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- field :name
7
- validates :name, uniqueness: true
8
-
9
- ## orbital.city : Z0145070C3DD1OJWHTXJ
10
- ## oquaney-splicing.com : Z060228025Y0JHUA35GN5
11
- field :route53_zone
12
- validates :route53_zone, presence: true
13
-
14
- STATE_ACTIVE = 'active'
15
- STATE_INACTIVE = 'inactive'
16
- STATES = [ 'active', 'inactive' ]
17
- field :state, default: STATE_ACTIVE
18
-
19
- def self.list
20
- [[nil,nil]] + all.where({ state: STATE_ACTIVE }).map { |i| [i.name, i.name ] }
21
- end
22
-
23
- end
@@ -1,10 +0,0 @@
1
-
2
- class Wco::EmailConversationLead
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- belongs_to :email_conversation, class_name: 'Office::EmailConversation'
7
- belongs_to :wco_lead, class_name: 'Ish::UserProfile'
8
-
9
-
10
- end
data/lib/wco/leadset.rb DELETED
@@ -1,26 +0,0 @@
1
-
2
- ##
3
- ## 2023-11-30 _vp_ For use in hosting!
4
- ## 2023-11-30 _vp_ For future use in email!
5
- ##
6
- class Wco::Leadset
7
- include Mongoid::Document
8
- include Mongoid::Timestamps
9
-
10
- field :name
11
-
12
- field :company_url
13
- validates :company_url, presence: true, uniqueness: true
14
-
15
- has_many :wco_leads, class_name: 'Ish::UserProfile'
16
-
17
- # field :domains, type: :string, default: 'orbital.city'
18
-
19
- has_many :serverhosts, class_name: 'Wco::Serverhost', inverse_of: :wco_leadset
20
- def next_serverhost
21
- serverhosts.first
22
- end
23
-
24
- has_many :appliances, class_name: 'Wco::Appliance', inverse_of: :wco_leadset
25
-
26
- end
data/lib/wco/price.rb DELETED
@@ -1,30 +0,0 @@
1
-
2
- ##
3
- ## Not used. _vp_ 2023-09-07
4
- ## Just replicating the Stripe structure.
5
- ##
6
- class Wco::Price
7
- include Mongoid::Document
8
- include Mongoid::Timestamps
9
-
10
- belongs_to :product, class_name: '::Wco::Product', inverse_of: :prices
11
-
12
- has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :price, foreign_key: :wco_price_id
13
-
14
- field :amount_cents, type: Integer
15
-
16
- INTERVALS = [ nil, 'day', 'week', 'month', 'year' ]
17
- field :interval, type: String
18
-
19
- field :price_id # stripe
20
-
21
- def name
22
- "$#{ amount_cents.to_f/100 } / #{interval}"
23
- end
24
- def name_simple
25
- "$#{ amount_cents.to_f/100 }"
26
- end
27
-
28
- end
29
-
30
-
data/lib/wco/product.rb DELETED
@@ -1,35 +0,0 @@
1
-
2
- class Wco::Product
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- field :name
7
-
8
- field :product_id # stripe
9
-
10
- ## @TODO: remove, interval makes no sense on product! replace with Wco::Price . _vp_ 2023-09-07
11
- # has_many :subscriptions, class_name: '::Wco::Subscription', inverse_of: :subscription
12
-
13
- has_many :prices, class_name: '::Wco::Price', inverse_of: :product
14
-
15
- def self.list
16
- [ [nil,nil] ] + self.all.order_by({ name: :asc }).map { |i| [i.name, i.id] }
17
- end
18
-
19
- end
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
- ## @TODO: remove, interval makes no sense on product! replace with Wco::Price . _vp_ 2023-09-07
30
- # INTERVALS = [ nil, 'day', 'week', 'month', 'year' ]
31
- # field :interval, type: String
32
- ## @TODO: remove, interval makes no sense on product! replace with Wco::Price . _vp_ 2023-09-07
33
- # field :price_id # stripe
34
- ## @TODO: remove, interval makes no sense on product! replace with Wco::Price . _vp_ 2023-09-07
35
- # field :price_cents, type: Integer
@@ -1,140 +0,0 @@
1
-
2
- require 'net/scp'
3
-
4
- class Wco::Serverhost
5
- include Mongoid::Document
6
- include Mongoid::Timestamps
7
- # include Mongoid::Autoinc
8
-
9
- field :name, type: :string
10
- # validates :name, uniqueness: { scope: :leadset_id }, presence: true
11
- validates :name, uniqueness: { scope: :wco_leadset }, presence: true
12
-
13
- # field :leadset_id, type: :integer
14
- # has_and_belongs_to_many :leadsets, class_name: 'Wco::Leadset', inverse_of: :serverhosts
15
- belongs_to :wco_leadset, class_name: 'Wco::Leadset'
16
-
17
- field :next_port, type: :integer, default: 8000
18
-
19
- field :nginx_root, default: '/opt/nginx'
20
- field :public_ip
21
-
22
- ## net-ssh, sshkit
23
- field :ssh_host
24
- # field :ssh_username
25
- # field :ssh_key
26
-
27
- has_many :appliances, class_name: 'Wco::Appliance'
28
-
29
- def add_nginx_site app
30
- ac = ActionController::Base.new
31
- ac.instance_variable_set( :@app, app )
32
- rendered_str = ac.render_to_string("scripts/nginx_site.conf")
33
- puts '+++ add_nginx_site rendered_str:'
34
- print rendered_str
35
-
36
- file = Tempfile.new('prefix')
37
- file.write rendered_str
38
- file.close
39
-
40
- cmd = "scp #{file.path} #{ssh_host}:/etc/nginx/sites-available/#{app.service_name}.conf "
41
- puts! cmd, 'cmd'
42
- `#{cmd}`
43
-
44
- cmd = "ssh #{ssh_host} 'ln -s /etc/nginx/sites-available/#{app.service_name}.conf /etc/nginx/sites-enabled/#{app.service_name}.conf ' "
45
- puts! cmd, 'cmd'
46
- `#{cmd}`
47
-
48
- cmd = "ssh #{ssh_host} 'nginx -s reload ' "
49
- puts! cmd, 'cmd'
50
- `#{cmd}`
51
-
52
- cmd = "ssh #{ssh_host} 'certbot run -d #{app.origin} --nginx -n ' "
53
- puts! cmd, 'cmd'
54
- `#{cmd}`
55
-
56
- end
57
-
58
- WORKDIR = "/opt/projects/docker"
59
-
60
- def add_docker_service app
61
- puts! app, '#add_docker_service'
62
-
63
- ac = ActionController::Base.new
64
- ac.instance_variable_set( :@app, app )
65
- ac.instance_variable_set( :@workdir, WORKDIR )
66
- rendered_str = ac.render_to_string("docker-compose/dc-#{app.kind}")
67
- puts '+++ add_docker_service rendered_str:'
68
- print rendered_str
69
-
70
- file = Tempfile.new('prefix')
71
- file.write rendered_str
72
- file.close
73
- puts! file.path, 'file.path'
74
-
75
- cmd = "scp #{file.path} #{ssh_host}:#{WORKDIR}/dc-#{app.service_name}.yml "
76
- puts! cmd, 'cmd'
77
- `#{cmd}`
78
-
79
- cmd = "ssh #{ssh_host} 'cd #{WORKDIR} ; \
80
- docker compose -f dc-#{app.service_name}.yml up -d #{app.service_name} ; \
81
- echo ok #add_docker_service ' "
82
- puts! cmd, 'cmd'
83
- `#{cmd}`
84
-
85
- puts "ok '#add_docker_service'"
86
- end
87
-
88
- def create_wordpress_volume app
89
- ac = ActionController::Base.new
90
- ac.instance_variable_set( :@app, app )
91
- ac.instance_variable_set( :@workdir, WORKDIR )
92
- rendered_str = ac.render_to_string("scripts/create_volume")
93
- # puts '+++ create_volume rendered_str:'
94
- # print rendered_str
95
-
96
- file = Tempfile.new('prefix')
97
- file.write rendered_str
98
- file.close
99
- # puts! file.path, 'file.path'
100
-
101
- cmd = "scp #{file.path} #{ssh_host}:#{WORKDIR}/scripts/create_volume"
102
- puts! cmd, 'cmd'
103
- `#{cmd}`
104
-
105
- cmd = "ssh #{ssh_host} 'chmod a+x #{WORKDIR}/scripts/create_volume ; \
106
- #{WORKDIR}/scripts/create_volume ' "
107
- puts! cmd, 'cmd'
108
- `#{cmd}`
109
-
110
- puts 'ok #create_volume'
111
- end
112
-
113
- def create_volume app
114
- ac = ActionController::Base.new
115
- ac.instance_variable_set( :@app, app )
116
- ac.instance_variable_set( :@workdir, WORKDIR )
117
- rendered_str = ac.render_to_string("scripts/create_volume")
118
- # puts '+++ create_volume rendered_str:'
119
- # print rendered_str
120
-
121
- file = Tempfile.new('prefix')
122
- file.write rendered_str
123
- file.close
124
- # puts! file.path, 'file.path'
125
-
126
- cmd = "scp #{file.path} #{ssh_host}:#{WORKDIR}/scripts/create_volume"
127
- puts! cmd, 'cmd'
128
- `#{cmd}`
129
-
130
- cmd = "ssh #{ssh_host} 'chmod a+x #{WORKDIR}/scripts/create_volume ; \
131
- #{WORKDIR}/scripts/create_volume ' "
132
- puts! cmd, 'cmd'
133
- `#{cmd}`
134
-
135
- puts 'ok #create_volume'
136
- end
137
-
138
-
139
- end
140
-
@@ -1,25 +0,0 @@
1
-
2
- class Wco::Subscription
3
- include Mongoid::Document
4
- include Mongoid::Timestamps
5
-
6
- field :customer_id, type: :string # stripe
7
- field :price_id, type: :string # stripe
8
-
9
- field :leadset_id
10
- def leadset
11
- Leadset.find leadset_id
12
- end
13
-
14
- field :quantity, type: :integer
15
-
16
- belongs_to :product, class_name: '::Wco::Product', inverse_of: :subscriptions
17
- belongs_to :price, class_name: '::Wco::Price', inverse_of: :subscriptions, foreign_key: :wco_price_id
18
-
19
- ## This was for ACL on wco dashboard? Should that be the same class?
20
- ## @TODO: optional ?!
21
- belongs_to :profile, class_name: '::Ish::UserProfile', inverse_of: :subscriptions, optional: true
22
-
23
- end
24
-
25
-