ru.Bee 2.2.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30f14be70030e4b247ee3ff3557ce1a2fc4f376581308ea87e650ca983ed5e7a
4
- data.tar.gz: 26d7aaa32737fdb7f1adfd0a7997d3e19e2a0a92020a47d7e421da9b30afa813
3
+ metadata.gz: 46b99eba5153b96dfd184262a0c0c14c3b2ae535069dc4e4eefda5b10524e374
4
+ data.tar.gz: d0d758ca04a0b75f9cd418eb7edc6cc8e5881778f4ecc010d12c8e9fef804544
5
5
  SHA512:
6
- metadata.gz: 87f0732e5180dfbc05cd844d2744830e2837f47e744463f1b863d84c23408686e5f15ed6ce1299abf245d28de5467668a9078a0431e0ba091fc51cbccc0578b3
7
- data.tar.gz: 54d5164817758f5cac8d5a4aaf0029b26345da43c8a4d667ee33cf4f6317eaacbe0bdc49fc687ac0eccacf16423659495a0c50ab1fd630a038198a781baa6c79
6
+ metadata.gz: 8e29f55fd3d8fa8231915e301a5b58c5720970b03d8f8a2c752d4582a1de28f1682a5dbf1ac03df43163711be174bb3d4445fc01f45ba7ae5a1718cb28b81829
7
+ data.tar.gz: 2c9cb860f5daa2d1eba26bbc419733e412e14096c07f58e1ef819ea84a6fb1ca0adb28daf86ea80ad6b23b0bb145228055eed6d1d935580f04436def7e0c5c7e
@@ -6,7 +6,7 @@ module Rubee
6
6
  def initialize(model_name, model_attributes, controller_name, action_name, **options)
7
7
  @model_name = model_name&.downcase
8
8
  @model_attributes = model_attributes || []
9
- @filtered_attributes = @model_attributes.select { |attribute| !attribute[:name].include?('index') }
9
+ @filtered_attributes = @model_attributes.select { |attribute| !attribute[:type].to_s.include?('index') }
10
10
  @base_name = controller_name.to_s.gsub('Controller', '').downcase.to_s
11
11
  color_puts("base_name: #{@base_name}", color: :gray)
12
12
  @plural_name = @base_name.plural? ? @base_name : @base_name.pluralize
@@ -13,7 +13,7 @@ module Rubee
13
13
 
14
14
  module ClassMethods
15
15
  def pluralize_class_name
16
- name.pluralize.downcase.snakeize
16
+ name.pluralize.snakeize
17
17
  end
18
18
 
19
19
  def accessor_names
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.4'
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('mergbergs')
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:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ru.Bee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.4
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Saltykov