kadim 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb10d2b3091f4e7bdc49e88058db5b838c97482b6d6ad58fb5c4a422c96a6fe3
4
- data.tar.gz: e3004720b218b5096cab2d9e32cd494d4d1107675138a13083f1cef78c22b99e
3
+ metadata.gz: 342513d50a550f796aac7141643367bb7c1af74a6220e389035e1bc632f3ebc8
4
+ data.tar.gz: 75f898d15c78b273e6c7c3935af4070cf638e6da3fe665595e60ddb87560cd94
5
5
  SHA512:
6
- metadata.gz: 74e7820f0b0c11f246fa9e836da1e80d32e3ab910c5ae3ca963895fe07ea83e6c5672eba885fa809ac8ac83a9800dc3ab450aad54a4088bb159b2e011890531c
7
- data.tar.gz: e94ae1be0be89d4a255190ce010d0c6c99c203433d52bd967d70ca242cd6468b1d9e069f75fb0729348c29f85abc3dc80f8f42ff1f520462d9e8ce5e68a893a1
6
+ metadata.gz: e225bfef348b53e94eebcaf93337c7ad5ab08e0b5ef51ecfa23b1b7805b25465288fee316574fdcfda29f99e38166189320cff24627d4d386422751c60db0a74
7
+ data.tar.gz: fd2b37bff6edab8c130c4b99c1bc87f42e863d0d00c0a6bd8e2d9ca79c0556a9d349609b3729c4e24ba671eac8fa8f4b17f97529be51b4d75a547e7b8eaceaae
data/README.md CHANGED
@@ -1,6 +1,4 @@
1
- # kadim
2
- Yet another Rails admin? No, only a kadim!*
3
-
1
+ # kadim*
4
2
  Admin is all about CRUD, right?
5
3
 
6
4
  My biggest experience with admins is with RailsAdmin. I currently work with an application that makes extensive use of
data/lib/kadim/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kadim
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.3"
5
5
  end
data/lib/kadim.rb CHANGED
@@ -5,6 +5,8 @@ require "kadim/template/memory_resolver"
5
5
 
6
6
  module Kadim
7
7
  def self.app_model_paths
8
+ return [] unless db_connection?
9
+
8
10
  Dir[Rails.root.join("app", "models", "**", "*.rb")]
9
11
  .reject { |model_path| model_path.include?("/concerns/") || model_path.include?("application_record") }
10
12
  .map { |model_path| model_path.remove(%r{.*/app/models/}, ".rb") }
@@ -13,6 +15,8 @@ module Kadim
13
15
  end
14
16
 
15
17
  def self.bootstrap_controllers
18
+ return unless db_connection?
19
+
16
20
  cleanup
17
21
  load_app_kadim_consts
18
22
  scaffold_controllers
@@ -99,5 +103,13 @@ module Kadim
99
103
  Kadim::MemoryResolver.instance.add(IO.read(file_path), view_path)
100
104
  end
101
105
  end
106
+
107
+ def db_connection?
108
+ ActiveRecord::Base.establish_connection # Establishes connection
109
+ ActiveRecord::Base.connection # Calls connection object
110
+ ActiveRecord::Base.connected?
111
+ rescue ActiveRecord::AdapterNotFound, ActiveRecord::AdapterNotSpecified, ActiveRecord::NoDatabaseError
112
+ false
113
+ end
102
114
  end
103
115
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kadim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kadu Diógenes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-07 00:00:00.000000000 Z
11
+ date: 2019-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage-resumable