ru.Bee 2.2.5 → 2.2.6
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/rubee/models/database_objectable.rb +1 -1
- data/lib/rubee.rb +1 -1
- data/lib/tests/models/db_objectable_test.rb +1 -1
- data/lib/tests/test.db +0 -0
- data/readme.md +52 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 46b99eba5153b96dfd184262a0c0c14c3b2ae535069dc4e4eefda5b10524e374
|
|
4
|
+
data.tar.gz: d0d758ca04a0b75f9cd418eb7edc6cc8e5881778f4ecc010d12c8e9fef804544
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e29f55fd3d8fa8231915e301a5b58c5720970b03d8f8a2c752d4582a1de28f1682a5dbf1ac03df43163711be174bb3d4445fc01f45ba7ae5a1718cb28b81829
|
|
7
|
+
data.tar.gz: 2c9cb860f5daa2d1eba26bbc419733e412e14096c07f58e1ef819ea84a6fb1ca0adb28daf86ea80ad6b23b0bb145228055eed6d1d935580f04436def7e0c5c7e
|
data/lib/rubee.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Rubee
|
|
|
17
17
|
CSS_DIR = File.join(APP_ROOT, LIB, 'css') unless defined?(CSS_DIR)
|
|
18
18
|
ROOT_PATH = File.expand_path(File.join(__dir__, '..')) unless defined?(ROOT_PATH)
|
|
19
19
|
|
|
20
|
-
VERSION = '2.2.
|
|
20
|
+
VERSION = '2.2.6'
|
|
21
21
|
|
|
22
22
|
require_relative 'rubee/router'
|
|
23
23
|
require_relative 'rubee/logger'
|
|
@@ -8,7 +8,7 @@ end
|
|
|
8
8
|
describe 'Database Objectable' do
|
|
9
9
|
describe 'class methods' do
|
|
10
10
|
it 'pluralizes class names' do
|
|
11
|
-
_(MergBerg.pluralize_class_name).must_equal('
|
|
11
|
+
_(MergBerg.pluralize_class_name).must_equal('merg_bergs')
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it 'retrieves accessor names' do
|
data/lib/tests/test.db
CHANGED
|
Binary file
|
data/readme.md
CHANGED
|
@@ -404,6 +404,58 @@ So it may safe some resources.
|
|
|
404
404
|
|
|
405
405
|
[Back to content](#content)
|
|
406
406
|
|
|
407
|
+
## Database
|
|
408
|
+
|
|
409
|
+
ru.Bee supports Postgres and Mysqlite databases fully and can potentially be used with any
|
|
410
|
+
database supported by Sequel gem.
|
|
411
|
+
|
|
412
|
+
When it comes to sqlite make sure you have sqlite3 included in your Gemfile.
|
|
413
|
+
```ruby
|
|
414
|
+
gem 'sqlite3'
|
|
415
|
+
```
|
|
416
|
+
And define your database urls for each environment in config/base_configuration.rb file:
|
|
417
|
+
```ruby
|
|
418
|
+
Rubee::Configuration.setup(env = :development) do |config|
|
|
419
|
+
config.database_url = { url: 'sqlite://db/development.db', env: }
|
|
420
|
+
...
|
|
421
|
+
end
|
|
422
|
+
Rubee::Configuration.setup(env = :test) do |config|
|
|
423
|
+
config.database_url = { url: 'sqlite://db/test.db', env: }
|
|
424
|
+
...
|
|
425
|
+
end
|
|
426
|
+
Rubee::Configuration.setup(env = :production) do |config|
|
|
427
|
+
config.database_url = { url: 'sqlite://db/production.db', env: }
|
|
428
|
+
...
|
|
429
|
+
end
|
|
430
|
+
```
|
|
431
|
+
For the PostgreSQL you need to include pg gem in your Gemfile
|
|
432
|
+
```ruby
|
|
433
|
+
gem 'pg'
|
|
434
|
+
```
|
|
435
|
+
And define your database urls for each environment in config/base_configuration.rb file:
|
|
436
|
+
```ruby
|
|
437
|
+
Rubee::Configuration.setup(env = :development) do |config|
|
|
438
|
+
config.database_url = { url: "postgres://postgres@localhost:5432/development", env: }
|
|
439
|
+
...
|
|
440
|
+
end
|
|
441
|
+
Rubee::Configuration.setup(env = :test) do |config|
|
|
442
|
+
config.database_url = { url: "postgres://postgres@localhost:5432/test", env: }
|
|
443
|
+
...
|
|
444
|
+
end
|
|
445
|
+
Rubee::Configuration.setup(env = :production) do |config|
|
|
446
|
+
config.database_url = { url: "postgres://postgres:#{ENV['DB_PASSWORD']}@localhost:5432/production", env: }
|
|
447
|
+
...
|
|
448
|
+
end
|
|
449
|
+
```
|
|
450
|
+
Before you start the server or runninng test suite you need to ensure your database is initated.
|
|
451
|
+
```bash
|
|
452
|
+
rubee db init # this will ensure your database is created for each environment
|
|
453
|
+
RACK_ENV=test rubee db run:all # this will run all migrations for test environment
|
|
454
|
+
RACK_ENV=development rubee db run:all # this will run all migrations for development environment
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
[Back to content](#content)
|
|
458
|
+
|
|
407
459
|
## Mysqlite production ready
|
|
408
460
|
Starting from verison 1.9.0 main issue for using sqlite - write db lock is resolved!
|
|
409
461
|
If you feel comfortable you can play with retry configuration parameters:
|