ru.Bee 1.3.2 → 1.3.3
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/bin/rubee +80 -86
- data/lib/config/base_configuration.rb +6 -6
- data/lib/config/routes.rb +1 -1
- data/lib/db/create_accounts.rb +8 -8
- data/lib/db/create_comments.rb +7 -7
- data/lib/db/create_posts.rb +8 -8
- data/lib/db/create_users.rb +8 -8
- data/lib/db/structure.rb +42 -42
- data/lib/inits/print_colors.rb +1 -1
- data/lib/rubee/async/asyncable.rb +2 -2
- data/lib/rubee/async/sidekiq_async.rb +11 -11
- data/lib/rubee/async/thread_async.rb +1 -1
- data/lib/rubee/async/thread_pool.rb +2 -2
- data/lib/rubee/controllers/base_controller.rb +30 -21
- data/lib/rubee/controllers/extensions/auth_tokenable.rb +10 -8
- data/lib/rubee/controllers/extensions/middlewarable.rb +1 -1
- data/lib/rubee/controllers/middlewares/auth_token_middleware.rb +12 -8
- data/lib/rubee/extensions/hookable.rb +3 -6
- data/lib/rubee/extensions/serializable.rb +3 -3
- data/lib/rubee/models/database_objectable.rb +11 -12
- data/lib/rubee/models/sequel_object.rb +23 -24
- data/lib/rubee.rb +54 -42
- data/lib/tests/account_model_test.rb +4 -4
- data/lib/tests/auth_tokenable_test.rb +6 -6
- data/lib/tests/comment_model_test.rb +7 -7
- data/lib/tests/example_models/account.rb +1 -0
- data/lib/tests/example_models/comment.rb +1 -0
- data/lib/tests/example_models/post.rb +1 -0
- data/lib/tests/example_models/user.rb +1 -0
- data/lib/tests/rubeeapp_test.rb +5 -7
- data/lib/tests/test.db +0 -0
- data/lib/tests/test_helper.rb +3 -5
- data/lib/tests/user_model_test.rb +70 -54
- 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: 0c9143f1fb0adabb978d0e9d8c718e5ccfa21c89830c227b64ee50f5931cb1c3
|
4
|
+
data.tar.gz: c64568ec8bab9baef9a9b7600174c3d730aacdda28567704290008cdcb8406d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2af204207bb589f143e1aca1d659fea3910760e02e871dcca7423e98a5d1176cd64eeea4762ba1fcd893cd06d27b08bbe90d4bbc21035328139fbff782762cb
|
7
|
+
data.tar.gz: cbad5d5d54c97d93341b1d95eb1f37ba2fe695c9b89591ab0b3b227cbd754169dbfc11c0ab787d8da3e4d8c43a46f26f7da9a57b915a70f3ca3ee77d976dd1c6
|
data/bin/rubee
CHANGED
@@ -1,14 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'fileutils'
|
4
|
-
require 'date'
|
5
|
-
require 'irb'
|
6
|
-
require 'sequel'
|
7
|
-
require 'sqlite3'
|
8
|
-
require 'json'
|
9
|
-
require 'rack'
|
10
|
-
require 'rackup'
|
11
|
-
|
12
3
|
require_relative '../lib/inits/print_colors'
|
13
4
|
require_relative '../lib/rubee'
|
14
5
|
|
@@ -29,42 +20,42 @@ LOGO
|
|
29
20
|
command = ARGV.first
|
30
21
|
|
31
22
|
def print_logo
|
32
|
-
puts "\e[36m
|
23
|
+
puts "\e[36m#{LOGO % Rubee::VERSION}\e[0m" # Cyan color
|
33
24
|
end
|
34
25
|
|
35
26
|
if command =~ /^(start)$|^(start:(\d+))$/
|
36
|
-
|
27
|
+
_, port = ARGV.first&.split(':')
|
37
28
|
|
38
|
-
port ||=
|
29
|
+
port ||= '7000'
|
39
30
|
print_logo
|
40
31
|
color_puts "Starting takeoff of ruBee server on port #{port}...", color: :yellow
|
41
32
|
exec("rackup #{ENV['RACKUP_FILE']} -p #{port}")
|
42
33
|
elsif command =~ /^(start_dev)$|^(start_dev:(\d+))$/
|
43
|
-
|
34
|
+
_, port = ARGV.first&.split(':')
|
44
35
|
|
45
|
-
port ||=
|
36
|
+
port ||= '7000'
|
46
37
|
print_logo
|
47
38
|
|
48
39
|
color_puts "Starting takeoff of ruBee server on port #{port} in dev mode...", color: :yellow
|
49
40
|
|
50
41
|
exec("rerun -- rackup --port #{port} #{ENV['RACKUP_FILE']}")
|
51
|
-
elsif command ==
|
52
|
-
exec(
|
53
|
-
elsif command ==
|
54
|
-
exec(
|
55
|
-
elsif command ==
|
42
|
+
elsif command == 'stop'
|
43
|
+
exec('pkill -f rubee')
|
44
|
+
elsif command == 'status'
|
45
|
+
exec('ps aux | grep rubee')
|
46
|
+
elsif command == 'project'
|
56
47
|
project_name = ARGV[1]
|
57
48
|
if project_name.nil?
|
58
|
-
color_puts
|
49
|
+
color_puts 'Please indicate project name.', color: :red
|
59
50
|
exit 1
|
60
51
|
end
|
61
52
|
|
62
|
-
if project_name ==
|
53
|
+
if project_name == 'rubee'
|
63
54
|
color_puts "Error: Project 'rubee' is reserved", color: :red
|
64
55
|
exit 1
|
65
56
|
end
|
66
57
|
|
67
|
-
source_dir = File.expand_path(
|
58
|
+
source_dir = File.expand_path('../lib', __dir__)
|
68
59
|
target_dir = File.expand_path("./#{project_name}", Dir.pwd)
|
69
60
|
|
70
61
|
if Dir.exist?(target_dir)
|
@@ -76,12 +67,13 @@ elsif command == "project"
|
|
76
67
|
FileUtils.mkdir_p(target_dir)
|
77
68
|
|
78
69
|
# Define blacklist
|
79
|
-
blacklist_files = %w[rubee.rb print_colors.rb version.rb config.ru test_helper.rb Gemfile.lock test.yml test.db
|
70
|
+
blacklist_files = %w[rubee.rb print_colors.rb version.rb config.ru test_helper.rb Gemfile.lock test.yml test.db
|
71
|
+
development.db production.db]
|
80
72
|
blacklist_dirs = %w[rubee tests .git .github .idea]
|
81
73
|
|
82
74
|
# Copy files, excluding blacklisted ones
|
83
75
|
Dir.glob("#{source_dir}/**/*", File::FNM_DOTMATCH).each do |file|
|
84
|
-
relative_path = file.sub("#{source_dir}/",
|
76
|
+
relative_path = file.sub("#{source_dir}/", '')
|
85
77
|
|
86
78
|
# Skip blacklisted directories
|
87
79
|
next if blacklist_dirs.any? { |dir| relative_path.split('/').include?(dir) }
|
@@ -104,24 +96,24 @@ elsif command == "project"
|
|
104
96
|
|
105
97
|
# create a gemfile context
|
106
98
|
gemfile = <<~GEMFILE
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
99
|
+
source 'https://rubygems.org'
|
100
|
+
|
101
|
+
gem 'ru.Bee'
|
102
|
+
gem 'sequel'
|
103
|
+
gem 'sqlite3'
|
104
|
+
gem 'rake'
|
105
|
+
gem 'rack'
|
106
|
+
gem 'rackup'
|
107
|
+
gem 'pry'
|
108
|
+
gem 'pry-byebug'
|
109
|
+
gem 'puma'
|
110
|
+
gem 'json'
|
111
|
+
|
112
|
+
group :development do
|
113
|
+
gem 'rerun'
|
114
|
+
gem 'minitest'
|
115
|
+
gem 'rack-test'
|
116
|
+
end
|
125
117
|
GEMFILE
|
126
118
|
# create a gemfile
|
127
119
|
File.open("#{target_dir}/Gemfile", 'w') do |file|
|
@@ -130,14 +122,14 @@ elsif command == "project"
|
|
130
122
|
|
131
123
|
# create test_helper.rb file
|
132
124
|
test_helper = <<~TESTHELPER
|
133
|
-
|
134
|
-
|
125
|
+
require "bundler/setup"
|
126
|
+
Bundler.require(:test)
|
135
127
|
|
136
|
-
|
137
|
-
|
138
|
-
|
128
|
+
require 'minitest/autorun'
|
129
|
+
require 'rack/test'
|
130
|
+
require 'rubee'
|
139
131
|
|
140
|
-
|
132
|
+
Rubee::Autoload.call
|
141
133
|
TESTHELPER
|
142
134
|
|
143
135
|
File.open("#{target_dir}/tests/test_helper.rb", 'w') do |file|
|
@@ -146,9 +138,9 @@ elsif command == "project"
|
|
146
138
|
|
147
139
|
color_puts "Project #{project_name} created successfully at #{target_dir}", color: :green
|
148
140
|
|
149
|
-
elsif command ==
|
141
|
+
elsif command == 'version'
|
150
142
|
color_puts "ru.Bee v#{Rubee::VERSION}", color: :yellow
|
151
|
-
elsif command ==
|
143
|
+
elsif command == 'test'
|
152
144
|
|
153
145
|
ENV['RACK_ENV'] = 'test'
|
154
146
|
file_name = ARGV[1] # Get the first argument
|
@@ -157,10 +149,10 @@ elsif command == "test"
|
|
157
149
|
color_puts "Running #{file_name} test ...", color: :yellow
|
158
150
|
exec("ruby -Itest -e \"require '.#{lib}/tests/#{file_name}'\"")
|
159
151
|
else
|
160
|
-
color_puts
|
152
|
+
color_puts 'Running all tests ...', color: :yellow
|
161
153
|
exec("ruby -Itest -e \"Dir.glob('.#{lib}/tests/**/*_test.rb').each { |file| require file }\"")
|
162
154
|
end
|
163
|
-
elsif [
|
155
|
+
elsif %w[generate gen].include?(command)
|
164
156
|
method, path = ARGV[1..2]
|
165
157
|
ENV['RACK_ENV'] ||= 'development'
|
166
158
|
|
@@ -174,14 +166,14 @@ elsif ['generate', 'gen'].include? command
|
|
174
166
|
"#{route[:controller]&.capitalize}Controller",
|
175
167
|
route[:action]
|
176
168
|
).call
|
177
|
-
elsif command ==
|
169
|
+
elsif command == 'db'
|
178
170
|
Rubee::Autoload.call
|
179
171
|
ENV['RACK_ENV'] ||= 'development'
|
180
172
|
|
181
173
|
command, file_name = ARGV[1]&.split(':')
|
182
174
|
if Rubee::PROJECT_NAME == 'rubee'
|
183
|
-
Rubee::Configuration.setup(env
|
184
|
-
config.database_url = { url:
|
175
|
+
Rubee::Configuration.setup(env = :test) do |config|
|
176
|
+
config.database_url = { url: 'sqlite://lib/tests/test.db', env: }
|
185
177
|
end
|
186
178
|
Rubee::SequelObject.reconnect! unless command == 'init'
|
187
179
|
end
|
@@ -189,29 +181,29 @@ elsif command == "db"
|
|
189
181
|
def ensure_database_exists(db_url)
|
190
182
|
uri = URI.parse(db_url)
|
191
183
|
case uri.scheme
|
192
|
-
when
|
184
|
+
when 'sqlite'
|
193
185
|
begin
|
194
186
|
Sequel.connect(db_url)
|
195
|
-
color_puts
|
196
|
-
rescue Exception
|
197
|
-
if File.exist?(db_path = db_url.sub(
|
198
|
-
color_puts
|
187
|
+
color_puts("Database #{ENV['RACK_ENV']} exists", color: :cyan)
|
188
|
+
rescue Exception
|
189
|
+
if File.exist?(db_path = db_url.sub(%r{^sqlite://}, ''))
|
190
|
+
color_puts("Database #{ENV['RACK_ENV']} exists", color: :cyan)
|
199
191
|
else
|
200
192
|
Sequel.sqlite(db_path)
|
201
|
-
color_puts
|
193
|
+
color_puts("Database #{ENV['RACK_ENV']} created", color: :green)
|
202
194
|
end
|
203
195
|
end
|
204
|
-
when
|
196
|
+
when 'postgres'
|
205
197
|
begin
|
206
198
|
Sequel.connect(db_url)
|
207
|
-
color_puts
|
208
|
-
rescue =>
|
209
|
-
con = Sequel.connect(Rubee::Configuration.get_database_url.gsub(/
|
199
|
+
color_puts("Database #{ENV['RACK_ENV']} exists", color: :cyan)
|
200
|
+
rescue StandardError => _e
|
201
|
+
con = Sequel.connect(Rubee::Configuration.get_database_url.gsub(%r{(/test|/development|/production)}, ''))
|
210
202
|
con.run("CREATE DATABASE #{ENV['RACK_ENV']}")
|
211
|
-
color_puts
|
203
|
+
color_puts("Database #{ENV['RACK_ENV']} created", color: :green)
|
212
204
|
end
|
213
205
|
else
|
214
|
-
color_puts
|
206
|
+
color_puts("Unsupported database type: #{db_url}", color: :red)
|
215
207
|
end
|
216
208
|
end
|
217
209
|
|
@@ -226,52 +218,54 @@ elsif command == "db"
|
|
226
218
|
end
|
227
219
|
end
|
228
220
|
formatted_hash = JSON.pretty_generate(schema_hash)
|
229
|
-
|
230
|
-
|
221
|
+
.gsub(/"(\w+)":/, '\1:') # Convert keys to symbols
|
222
|
+
.gsub(': null', ': nil') # Convert `null` to `nil`
|
231
223
|
|
232
|
-
File.open(
|
224
|
+
File.open('db/structure.rb', 'w') do |file|
|
233
225
|
file.puts "STRUCTURE = #{formatted_hash}"
|
234
226
|
end
|
235
227
|
|
236
|
-
color_puts
|
228
|
+
color_puts('db/structure.rb updated', color: :green)
|
237
229
|
end
|
238
230
|
|
239
|
-
|
240
|
-
|
231
|
+
case command
|
232
|
+
when 'run'
|
241
233
|
Rubee::Autoload.call
|
242
234
|
file_names = if file_name == 'all'
|
243
235
|
lib = Rubee::PROJECT_NAME == 'rubee' ? '/lib' : ''
|
244
|
-
Dir.glob(".#{lib}/db/*.rb").map
|
236
|
+
Dir.glob(".#{lib}/db/*.rb").map do |file|
|
237
|
+
File.basename(file, '.rb')
|
238
|
+
end.reject { |file| file == 'structure' }
|
245
239
|
else
|
246
240
|
[file_name]
|
247
241
|
end
|
248
242
|
Rubee::Configuration.envs.each do |env|
|
249
243
|
ENV['RACK_ENV'] = env.to_s
|
250
244
|
file_names.each do |file_name|
|
251
|
-
color_puts
|
245
|
+
color_puts("Run #{file_name} file for #{env} env", color: :cyan)
|
252
246
|
Object.const_get(file_name.split('_').map(&:capitalize).join).new.call
|
253
247
|
end
|
254
248
|
end
|
255
|
-
color_puts
|
249
|
+
color_puts("Migration for #{file_name} completed", color: :green)
|
256
250
|
unless Rubee::PROJECT_NAME == 'rubee'
|
257
|
-
color_puts
|
251
|
+
color_puts('Regenerate schema file', color: :cyan)
|
258
252
|
generate_structure
|
259
253
|
end
|
260
|
-
|
254
|
+
when 'init'
|
261
255
|
ensure_database_exists(Rubee::Configuration.get_database_url)
|
262
|
-
|
256
|
+
when 'structure'
|
263
257
|
generate_structure
|
264
258
|
else
|
265
|
-
color_puts
|
259
|
+
color_puts("Unknown command: #{command}", color: :red)
|
266
260
|
end
|
267
|
-
elsif ['console'].include?
|
261
|
+
elsif ['console'].include?(command)
|
268
262
|
ARGV.clear
|
269
263
|
ENV['RACK_ENV'] ||= 'development'
|
270
264
|
|
271
265
|
Rubee::Autoload.call
|
272
266
|
if Rubee::PROJECT_NAME == 'rubee'
|
273
|
-
Rubee::Configuration.setup(env
|
274
|
-
config.database_url = { url:
|
267
|
+
Rubee::Configuration.setup(env = :test) do |config|
|
268
|
+
config.database_url = { url: 'sqlite://lib/tests/test.db', env: }
|
275
269
|
end
|
276
270
|
Rubee::Autoload.call
|
277
271
|
Rubee::SequelObject.reconnect!
|
@@ -279,13 +273,13 @@ elsif ['console'].include? command
|
|
279
273
|
|
280
274
|
def reload
|
281
275
|
app_files = Dir["./#{Rubee::APP_ROOT}/**/*.rb"]
|
282
|
-
app_files.each { |file| load
|
283
|
-
color_puts
|
276
|
+
app_files.each { |file| load(file) }
|
277
|
+
color_puts('Reloaded ..', color: :green)
|
284
278
|
end
|
285
279
|
begin
|
286
280
|
# Start IRB
|
287
281
|
IRB.start
|
288
|
-
rescue Exception
|
282
|
+
rescue Exception
|
289
283
|
IRB.start
|
290
284
|
end
|
291
285
|
else
|
@@ -1,11 +1,11 @@
|
|
1
|
-
Rubee::Configuration.setup(env
|
2
|
-
config.database_url = { url:
|
1
|
+
Rubee::Configuration.setup(env = :development) do |config|
|
2
|
+
config.database_url = { url: 'sqlite://db/development.db', env: }
|
3
3
|
end
|
4
4
|
|
5
|
-
Rubee::Configuration.setup(env
|
6
|
-
config.database_url = { url:
|
5
|
+
Rubee::Configuration.setup(env = :test) do |config|
|
6
|
+
config.database_url = { url: 'sqlite://db/test.db', env: }
|
7
7
|
end
|
8
8
|
|
9
|
-
Rubee::Configuration.setup(env
|
10
|
-
config.database_url = { url:
|
9
|
+
Rubee::Configuration.setup(env = :production) do |config|
|
10
|
+
config.database_url = { url: 'sqlite://db/production.db', env: }
|
11
11
|
end
|
data/lib/config/routes.rb
CHANGED
data/lib/db/create_accounts.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
class CreateAccounts
|
2
2
|
def call
|
3
|
-
|
4
|
-
Rubee::SequelObject::DB.create_table :accounts do
|
5
|
-
primary_key :id
|
6
|
-
String :addres
|
7
|
-
foreign_key :user_id, :users
|
8
|
-
end
|
3
|
+
return if Rubee::SequelObject::DB.tables.include?(:accounts)
|
9
4
|
|
10
|
-
|
11
|
-
|
5
|
+
Rubee::SequelObject::DB.create_table(:accounts) do
|
6
|
+
primary_key(:id)
|
7
|
+
String(:addres)
|
8
|
+
foreign_key(:user_id, :users)
|
12
9
|
end
|
10
|
+
|
11
|
+
Account.create(addres: '13th Ave, NY', user_id: User.all.first.id)
|
12
|
+
Account.create(addres: '14th Ave, NY', user_id: User.all.last.id)
|
13
13
|
end
|
14
14
|
end
|
data/lib/db/create_comments.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
class CreateComments
|
2
2
|
def call
|
3
|
-
|
4
|
-
Rubee::SequelObject::DB.create_table :comments do
|
5
|
-
primary_key :id
|
6
|
-
String :text
|
7
|
-
Integer :user_id
|
8
|
-
end
|
3
|
+
return if Rubee::SequelObject::DB.tables.include?(:comments)
|
9
4
|
|
10
|
-
|
5
|
+
Rubee::SequelObject::DB.create_table(:comments) do
|
6
|
+
primary_key(:id)
|
7
|
+
String(:text)
|
8
|
+
Integer(:user_id)
|
11
9
|
end
|
10
|
+
|
11
|
+
User.create(email: 'ok@ok.com', password: 'password')
|
12
12
|
end
|
13
13
|
end
|
data/lib/db/create_posts.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
class CreatePosts
|
2
2
|
def call
|
3
|
-
|
4
|
-
Rubee::SequelObject::DB.create_table :posts do
|
5
|
-
primary_key :id
|
6
|
-
foreign_key :user_id, :users
|
7
|
-
foreign_key :comment_id, :comments
|
8
|
-
end
|
3
|
+
return if Rubee::SequelObject::DB.tables.include?(:posts)
|
9
4
|
|
10
|
-
|
11
|
-
|
5
|
+
Rubee::SequelObject::DB.create_table(:posts) do
|
6
|
+
primary_key(:id)
|
7
|
+
foreign_key(:user_id, :users)
|
8
|
+
foreign_key(:comment_id, :comments)
|
12
9
|
end
|
10
|
+
|
11
|
+
Post.create(user_id: User.all.first.id, comment_id: Comment.all.first.id)
|
12
|
+
Post.create(user_id: User.all.last.id, comment_id: Comment.all.last.id)
|
13
13
|
end
|
14
14
|
end
|
data/lib/db/create_users.rb
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
# Please make sure you executed it before using AuthTokenable module
|
3
3
|
class CreateUsers
|
4
4
|
def call
|
5
|
-
|
6
|
-
Rubee::SequelObject::DB.create_table :users do
|
7
|
-
primary_key :id
|
8
|
-
String :email
|
9
|
-
String :password
|
10
|
-
index :email
|
11
|
-
end
|
5
|
+
return if Rubee::SequelObject::DB.tables.include?(:users)
|
12
6
|
|
13
|
-
|
7
|
+
Rubee::SequelObject::DB.create_table(:users) do
|
8
|
+
primary_key(:id)
|
9
|
+
String(:email)
|
10
|
+
String(:password)
|
11
|
+
index(:email)
|
14
12
|
end
|
13
|
+
|
14
|
+
User.create(email: 'ok@ok.com', password: 'password')
|
15
15
|
end
|
16
16
|
end
|
data/lib/db/structure.rb
CHANGED
@@ -4,123 +4,123 @@ STRUCTURE = {
|
|
4
4
|
generated: false,
|
5
5
|
allow_null: false,
|
6
6
|
default: nil,
|
7
|
-
db_type:
|
7
|
+
db_type: 'INTEGER',
|
8
8
|
primary_key: true,
|
9
9
|
auto_increment: true,
|
10
|
-
type:
|
11
|
-
ruby_default: nil
|
10
|
+
type: 'integer',
|
11
|
+
ruby_default: nil,
|
12
12
|
},
|
13
13
|
email: {
|
14
14
|
generated: false,
|
15
15
|
allow_null: true,
|
16
16
|
default: nil,
|
17
|
-
db_type:
|
17
|
+
db_type: 'varchar(255)',
|
18
18
|
primary_key: false,
|
19
|
-
type:
|
19
|
+
type: 'string',
|
20
20
|
ruby_default: nil,
|
21
|
-
max_length: 255
|
21
|
+
max_length: 255,
|
22
22
|
},
|
23
23
|
password: {
|
24
24
|
generated: false,
|
25
25
|
allow_null: true,
|
26
26
|
default: nil,
|
27
|
-
db_type:
|
27
|
+
db_type: 'varchar(255)',
|
28
28
|
primary_key: false,
|
29
|
-
type:
|
29
|
+
type: 'string',
|
30
30
|
ruby_default: nil,
|
31
|
-
max_length: 255
|
32
|
-
}
|
31
|
+
max_length: 255,
|
32
|
+
},
|
33
33
|
},
|
34
34
|
accounts: {
|
35
35
|
id: {
|
36
36
|
generated: false,
|
37
37
|
allow_null: false,
|
38
38
|
default: nil,
|
39
|
-
db_type:
|
39
|
+
db_type: 'INTEGER',
|
40
40
|
primary_key: true,
|
41
41
|
auto_increment: true,
|
42
|
-
type:
|
43
|
-
ruby_default: nil
|
42
|
+
type: 'integer',
|
43
|
+
ruby_default: nil,
|
44
44
|
},
|
45
45
|
addres: {
|
46
46
|
generated: false,
|
47
47
|
allow_null: true,
|
48
48
|
default: nil,
|
49
|
-
db_type:
|
49
|
+
db_type: 'varchar(255)',
|
50
50
|
primary_key: false,
|
51
|
-
type:
|
51
|
+
type: 'string',
|
52
52
|
ruby_default: nil,
|
53
|
-
max_length: 255
|
53
|
+
max_length: 255,
|
54
54
|
},
|
55
55
|
user_id: {
|
56
56
|
generated: false,
|
57
57
|
allow_null: true,
|
58
58
|
default: nil,
|
59
|
-
db_type:
|
59
|
+
db_type: 'INTEGER',
|
60
60
|
primary_key: false,
|
61
|
-
type:
|
62
|
-
ruby_default: nil
|
63
|
-
}
|
61
|
+
type: 'integer',
|
62
|
+
ruby_default: nil,
|
63
|
+
},
|
64
64
|
},
|
65
65
|
posts: {
|
66
66
|
id: {
|
67
67
|
generated: false,
|
68
68
|
allow_null: false,
|
69
69
|
default: nil,
|
70
|
-
db_type:
|
70
|
+
db_type: 'INTEGER',
|
71
71
|
primary_key: true,
|
72
72
|
auto_increment: true,
|
73
|
-
type:
|
74
|
-
ruby_default: nil
|
73
|
+
type: 'integer',
|
74
|
+
ruby_default: nil,
|
75
75
|
},
|
76
76
|
user_id: {
|
77
77
|
generated: false,
|
78
78
|
allow_null: true,
|
79
79
|
default: nil,
|
80
|
-
db_type:
|
80
|
+
db_type: 'INTEGER',
|
81
81
|
primary_key: false,
|
82
|
-
type:
|
83
|
-
ruby_default: nil
|
82
|
+
type: 'integer',
|
83
|
+
ruby_default: nil,
|
84
84
|
},
|
85
85
|
comment_id: {
|
86
86
|
generated: false,
|
87
87
|
allow_null: true,
|
88
88
|
default: nil,
|
89
|
-
db_type:
|
89
|
+
db_type: 'INTEGER',
|
90
90
|
primary_key: false,
|
91
|
-
type:
|
92
|
-
ruby_default: nil
|
93
|
-
}
|
91
|
+
type: 'integer',
|
92
|
+
ruby_default: nil,
|
93
|
+
},
|
94
94
|
},
|
95
95
|
comments: {
|
96
96
|
id: {
|
97
97
|
generated: false,
|
98
98
|
allow_null: false,
|
99
99
|
default: nil,
|
100
|
-
db_type:
|
100
|
+
db_type: 'INTEGER',
|
101
101
|
primary_key: true,
|
102
102
|
auto_increment: true,
|
103
|
-
type:
|
104
|
-
ruby_default: nil
|
103
|
+
type: 'integer',
|
104
|
+
ruby_default: nil,
|
105
105
|
},
|
106
106
|
text: {
|
107
107
|
generated: false,
|
108
108
|
allow_null: true,
|
109
109
|
default: nil,
|
110
|
-
db_type:
|
110
|
+
db_type: 'varchar(255)',
|
111
111
|
primary_key: false,
|
112
|
-
type:
|
112
|
+
type: 'string',
|
113
113
|
ruby_default: nil,
|
114
|
-
max_length: 255
|
114
|
+
max_length: 255,
|
115
115
|
},
|
116
116
|
user_id: {
|
117
117
|
generated: false,
|
118
118
|
allow_null: true,
|
119
119
|
default: nil,
|
120
|
-
db_type:
|
120
|
+
db_type: 'INTEGER',
|
121
121
|
primary_key: false,
|
122
|
-
type:
|
123
|
-
ruby_default: nil
|
124
|
-
}
|
125
|
-
}
|
126
|
-
}
|
122
|
+
type: 'integer',
|
123
|
+
ruby_default: nil,
|
124
|
+
},
|
125
|
+
},
|
126
|
+
}.freeze
|
data/lib/inits/print_colors.rb
CHANGED
@@ -19,6 +19,6 @@ def color_puts(text, color: :nil, background: :nil, style: :normal)
|
|
19
19
|
color_code = colors[color]
|
20
20
|
bg_code = backgrounds[background]
|
21
21
|
style_code = styles[style]
|
22
|
-
options = [style_code, color_code, bg_code].compact.join(
|
22
|
+
options = [style_code, color_code, bg_code].compact.join(';')
|
23
23
|
puts "\e[#{options}m#{text}\e[0m"
|
24
24
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
unless defined?(Rubee)
|
2
|
-
require_relative '../../../../rubee
|
2
|
+
require_relative '../../../../rubee'
|
3
3
|
Rubee::Autoload.call
|
4
4
|
end
|
5
5
|
|
@@ -11,7 +11,7 @@ module Rubee
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def adapter
|
14
|
-
@adapter ||=
|
14
|
+
@adapter ||= Rubee::Configuration.get_async_adapter || ThreadAsync
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|