Domain_Handler 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/domain_handler.rb +42 -34
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5388e6098b20e3a270abbc2ddb57ae34a6019181dbc745b07f10c05a33b10ac
|
4
|
+
data.tar.gz: 3d22f4700b849b794924aef5b0f79b233bba14c64b573aefce6b0911981ebc78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bd847d76fe25afec4304c8b9fc7a0f63b595bd33f76b328381d8b09936d284d2a4becedccdf3d2bf3f884aade2b0f4a22f8b2ac39e871c52246a2555741247e
|
7
|
+
data.tar.gz: 640c1e604aead80ec89f06a8536ee71d62b8d30f9db5c3b85655387a5845981ccc8752c0ce31f4a00031571f03ab1e75c309123acac5900b12649dec01e78759
|
data/lib/domain_handler.rb
CHANGED
@@ -68,40 +68,48 @@ class DomainHandler
|
|
68
68
|
)
|
69
69
|
end
|
70
70
|
|
71
|
-
def self.
|
72
|
-
|
73
|
-
|
74
|
-
#
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
71
|
+
def self.create_migration
|
72
|
+
migration_name = 'create_domains'
|
73
|
+
|
74
|
+
# Generate a timestamp to use as the migration version
|
75
|
+
timestamp = Time.now.strftime('%Y%m%d%H%M%S')
|
76
|
+
|
77
|
+
# Generate the migration file name
|
78
|
+
migration_file_name = "#{timestamp}_#{migration_name}.rb"
|
79
|
+
|
80
|
+
# Specify the migration class name
|
81
|
+
migration_class_name = migration_name.camelize
|
82
|
+
|
83
|
+
# Specify the migration file path
|
84
|
+
migration_file_path = Rails.root.join('db', 'migrate', migration_file_name)
|
85
|
+
# Create the migration file
|
86
|
+
File.open(migration_file_path, 'w') do |file|
|
87
|
+
file.write("class #{migration_class_name} < ActiveRecord::Migration[6.1]\n")
|
88
|
+
file.write(" def change\n")
|
89
|
+
file.write(" create_table :domains, id: false, primary_key: :domain_id do |t|\n")
|
90
|
+
file.write(" # Define your table columns here\n")
|
91
|
+
file.write(" t.references :shop, foreign_key: true\n")
|
92
|
+
file.write(" t.string :host, null: false, default: ''\n")
|
93
|
+
file.write(" t.string :localization\n")
|
94
|
+
file.write(" t.string :market_web_presence\n")
|
95
|
+
file.write(" t.boolean :ssl_enabled, null: false\n")
|
96
|
+
file.write(" t.string :url\n")
|
97
|
+
file.write(" t.string :domain_id\n")
|
98
|
+
file.write(" t.index :domain_id, unique: true\n")
|
99
|
+
file.write(" t.timestamps\n")
|
100
|
+
file.write(" end\n")
|
101
|
+
file.write(" end\n")
|
102
|
+
file.write("end\n")
|
103
|
+
end
|
92
104
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
t.string :url
|
102
|
-
t.string :domain_id
|
103
|
-
t.index :domain_id, unique: true
|
104
|
-
t.timestamps
|
105
|
+
model_name = 'domain.rb'
|
106
|
+
model_file_path = Rails.root.join('app', 'models', model_name)
|
107
|
+
File.open(model_file_path, 'w') do |file|
|
108
|
+
file.write("class Domain < ApplicationRecord \n")
|
109
|
+
file.write(" self.primary_key = :domain_id \n")
|
110
|
+
file.write(" belongs_to :shop \n")
|
111
|
+
file.write(" belongs_to :shop \n")
|
112
|
+
file.write("end \n")
|
105
113
|
end
|
106
114
|
end
|
107
|
-
end
|
115
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Domain_Handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arun Sahu
|
@@ -31,7 +31,7 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- lib/domain_handler.rb
|
34
|
-
homepage: https://rubygems.org
|
34
|
+
homepage: https://rubygems.org
|
35
35
|
licenses:
|
36
36
|
- MIT
|
37
37
|
metadata: {}
|