kadim 0.1.0 → 0.1.1

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: 3272545bc64e3a1c4568f3203620fb693c7c9296ae29be131f6ff29bf7cdf647
4
- data.tar.gz: abe7c623093b1e6c8da72df5a25d12c281a62f6b8af66e8c8562cc06525c5edb
3
+ metadata.gz: '0609e21a1cde13e365c213353302e153cd080dcb4d694550394e179a388f8473'
4
+ data.tar.gz: 53e8961b9ac7de492f843f6755177324dc2e53e66ca97cf4083f50e6c7745003
5
5
  SHA512:
6
- metadata.gz: 6b8a8534aa0071b3bf94e4374d644795438a0fd2d81974f8a62db750ad43d041d00d4beac5262136bd5a9208b8802ede6c7e62f073980f6b389948b68127dfdb
7
- data.tar.gz: e8b2b2b9eb52fa33604e32bcb2c3c8f95c034dea4a0fedf525c54381d5b4182ec979bf62e65bbfee742ef67630180eb1cdbab24f2bb73c4ef9532a682d98056d
6
+ metadata.gz: 1f4530436577de2e6a8fab5fc17735339cb566c5731c3149d8b4917cac1548a6dea94f90e259b6c72d9709e17c0cccdebf4fc0cff6c4e5aadb750b1cce5e8804
7
+ data.tar.gz: bee6b4545a6115496e7cdcd45f7a38061b68d0eff14eb0d14a09632c5e9756530a35009a91bcacc1f12b419c2248ea08ac472f65313de2863a415a087990f037
data/README.md CHANGED
@@ -25,6 +25,11 @@ ActiveRecord methods added by gems are ignored.
25
25
  Files are generated in `tmp/kadim` and loaded into memory, including views. This also has the advantage of allowing the
26
26
  gem to work in environments with ephemeral file systems.
27
27
 
28
+ If you want to customize `Kadim::ApplicationController`, the basic controller for all generated controllers, you can
29
+ copy the file [app/controllers/kadim/application_controller.rb](https://github.com/fnix/kadim/blob/master/app/controllers/kadim/application_controller.rb)
30
+ to your application. You can do the same for [app/views/layouts/kadim/application.html.erb](https://github.com/fnix/kadim/blob/master/app/views/layouts/kadim/application.html.erb).
31
+ If you want to customize the generated controller/views just copy them from `tmp/kadim` to your application.
32
+
28
33
  ## Installation
29
34
  Add this line to your application's Gemfile:
30
35
 
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Hosts the base kadim files inside your application by copying assets, controllers, helpers and views.
3
+
4
+ Example:
5
+ rails generate kadim:host
6
+
7
+ This will copy files for the following folders:
8
+ <%= Kadim::HostGenerator::BASE_DIRS.join("\n ") %>
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kadim
4
+ class HostGenerator < Rails::Generators::Base
5
+ source_root File.expand_path("templates", __dir__)
6
+
7
+ BASE_DIRS = [
8
+ "app/assets/javascripts/kadim",
9
+ "app/assets/stylesheets/kadim",
10
+ "app/controllers/kadim",
11
+ "app/helpers/kadim",
12
+ "app/views/kadim",
13
+ "app/views/layouts/kadim"
14
+ ]
15
+
16
+ def copy_base_files
17
+ self.class.source_root File.expand_path("../../../..", __dir__)
18
+ BASE_DIRS.each { |dirname| directory dirname }
19
+ end
20
+ end
21
+ end
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.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/kadim.rb CHANGED
@@ -11,7 +11,7 @@ module Kadim
11
11
  Dir[Rails.root.join("app", "models", "**", "*.rb")]
12
12
  .reject { |model_path| model_path.include?("/concerns/") || model_path.include?("application_record") }
13
13
  .map { |model_path| model_path.remove(%r{.*/app/models/}, ".rb") }
14
- .select { |model_name| model_name.camelize.constantize.table_exists? }
14
+ .select { |model_name| model_name.camelize.constantize.try(:table_exists?) }
15
15
  .sort
16
16
  end
17
17
 
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.1.0
4
+ version: 0.1.1
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-11-17 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activestorage-resumable
@@ -212,6 +212,8 @@ files:
212
212
  - app/views/kadim/application/index.html.erb
213
213
  - app/views/layouts/kadim/application.html.erb
214
214
  - config/routes.rb
215
+ - lib/generators/kadim/host/USAGE
216
+ - lib/generators/kadim/host/host_generator.rb
215
217
  - lib/kadim.rb
216
218
  - lib/kadim/engine.rb
217
219
  - lib/kadim/template/memory_resolver.rb