kaal-rails 0.3.0 → 0.4.0

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: 800bd823b767eafa640969d895f5c1b408f6cfdbce1ea386ca98950eadd2ccc1
4
- data.tar.gz: 8f611cf0bd2b4f9002184cbf5f5743444aeb8ebcd0b2faa8482f761a5c48ddfb
3
+ metadata.gz: eb9975de587d0049dc6d0c600a8d1ae9b475d10ada23dcca56250008f4662915
4
+ data.tar.gz: 72cb9b8d049685add808d81a11a7bf5682580857e8973cd5f46b351d67d4c4af
5
5
  SHA512:
6
- metadata.gz: ea626952cb9cf77da562331ebb7ba727fdae05ff434d99a652e5c9d19c1549a12754d546d63ea69188962dab96391802ce04052f9e2014f46119a20437e9c913
7
- data.tar.gz: 6cbb6b3d94a29f3b3217fd19052c74feaad8f009ec2b69e6ebfaae41687f51f73ddf17e7a1c4e07d9d32541b115f33563d9d4a3926b841cb5706f9bf0e7e4959
6
+ metadata.gz: 6b4d4ac608ba05a69c26ab53cb062026166fd98dbf2c10a35fed393e2e78f56e24018b834fe4c13ecc59e1f0576d03beefc1056cff6010713c6f4e75ee224014
7
+ data.tar.gz: a3ef5c9890a13dac180b51a74d11f8e4c35d53a436085fba627677649e3ad541dc2c9a882cd9375baf2d4dd80a40d686a6e1b41a7cdb94bc564eee0b52d2c64d
data/README.md CHANGED
@@ -5,7 +5,6 @@ Rails plugin gem for Kaal.
5
5
  `kaal-rails` depends on:
6
6
 
7
7
  - `kaal`
8
- - `kaal-activerecord`
9
8
 
10
9
  It owns the Rails integration surface:
11
10
 
@@ -45,7 +44,7 @@ bundle exec rails db:migrate
45
44
  ## What It Provides
46
45
 
47
46
  - Rails-native setup on top of the Kaal engine
48
- - Active Record-backed persistence through `kaal-activerecord`
47
+ - Active Record-backed persistence through the core `kaal` gem
49
48
  - migration templates for the Kaal tables required by the selected backend
50
49
  - automatic backend selection from the Rails database adapter unless the app sets `Kaal.configuration.backend` itself
51
50
 
@@ -61,9 +60,9 @@ end
61
60
 
62
61
  If you do nothing, `kaal-rails` will auto-wire:
63
62
 
64
- - SQLite to `Kaal::ActiveRecord::DatabaseAdapter`
65
- - PostgreSQL to `Kaal::ActiveRecord::PostgresAdapter`
66
- - MySQL to `Kaal::ActiveRecord::MySQLAdapter`
63
+ - SQLite to `Kaal::Backend::SQLite`
64
+ - PostgreSQL to `Kaal::Backend::Postgres`
65
+ - MySQL to `Kaal::Backend::MySQL`
67
66
 
68
67
  Available Rails surfaces:
69
68
 
@@ -6,6 +6,7 @@
6
6
  # LICENSE file in the root directory of this source tree.
7
7
  require 'fileutils'
8
8
  require 'pathname'
9
+ require 'kaal/internal/active_record/migration_templates'
9
10
 
10
11
  module Kaal
11
12
  module Rails
@@ -40,15 +41,14 @@ module Kaal
40
41
 
41
42
  def install_migrations
42
43
  migrations_dir = root.join('db', 'migrate')
43
- base_time = time_source.call
44
44
  FileUtils.mkdir_p(migrations_dir)
45
45
 
46
- Kaal::ActiveRecord::MigrationTemplates.for_backend(backend).map.with_index do |(name, contents), index|
46
+ Kaal::Internal::ActiveRecord::MigrationTemplates.for_backend(backend).map.with_index do |(name, contents), index|
47
47
  slug = name.sub(/^\d+_/, '')
48
48
  existing = Dir[migrations_dir.join("*_#{slug}").to_s].first
49
49
  next({ status: :exists, path: existing.to_s }) if existing
50
50
 
51
- timestamp = (base_time + index).strftime('%Y%m%d%H%M%S')
51
+ timestamp = (time_source.call + index).strftime('%Y%m%d%H%M%S')
52
52
  target = migrations_dir.join("#{timestamp}_#{slug}")
53
53
  File.write(target, contents)
54
54
  { status: :create, path: target.to_s }
@@ -6,6 +6,6 @@
6
6
  # LICENSE file in the root directory of this source tree.
7
7
  module Kaal
8
8
  module Rails
9
- VERSION = '0.3.0'
9
+ VERSION = '0.4.0'
10
10
  end
11
11
  end
data/lib/kaal/rails.rb CHANGED
@@ -6,7 +6,6 @@
6
6
  # LICENSE file in the root directory of this source tree.
7
7
  require 'pathname'
8
8
  require 'kaal'
9
- require 'kaal/active_record'
10
9
  require 'kaal/rails/version'
11
10
  require 'kaal/rails/installer'
12
11
  require 'kaal/rails/railtie'
@@ -33,11 +32,11 @@ module Kaal
33
32
  def build_backend(backend_name = detect_backend_name)
34
33
  case backend_name.to_s
35
34
  when 'sqlite'
36
- Kaal::ActiveRecord::DatabaseAdapter.new
35
+ Kaal::Backend::SQLite.new
37
36
  when 'postgres'
38
- Kaal::ActiveRecord::PostgresAdapter.new
37
+ Kaal::Backend::Postgres.new
39
38
  when 'mysql'
40
- Kaal::ActiveRecord::MySQLAdapter.new
39
+ Kaal::Backend::MySQL.new
41
40
  end
42
41
  end
43
42
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaal-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nitesh Purohit
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.0
19
+ version: 0.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.0
27
- - !ruby/object:Gem::Dependency
28
- name: kaal-activerecord
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - '='
32
- - !ruby/object:Gem::Version
33
- version: 0.3.0
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - '='
39
- - !ruby/object:Gem::Version
40
- version: 0.3.0
26
+ version: 0.4.0
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rails
43
29
  requirement: !ruby/object:Gem::Requirement