hotwire_crud 0.1.1 → 0.1.2

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: 49da02d8cbd94b6c6e701d153f7e941839274d0930092febb5be18c19bcaf0f0
4
- data.tar.gz: 141f1ab90e9992ab9baf83fd434d5bffdb27244248b70bd674f38f1e0911d2bf
3
+ metadata.gz: e25f04e72ad847d12f99121934f13baaf8da963481b04628f6a76357d42f9820
4
+ data.tar.gz: 287751890a2a0621252beea80b0e49e124ad5ada68b5fa2a25daffa2d63eed66
5
5
  SHA512:
6
- metadata.gz: 48b180a9647856cfa0f02ee6e8ac1249cf3f12a1c8661bc91a11db844643c5b38576fb3a4035aefbb8e90bb2031875a77ce64755187b469d9502e50778e5288e
7
- data.tar.gz: b5cd29ca40b435a876a3b671cb331308ec19bca596ac3e0d20522cd026dbe51fc3c0326e038ea70004266e72d5bf3ca41446c930e41a5d367cfe61a3db346189
6
+ metadata.gz: 6b1edd548ae2dc3a89abc980a787af39e50bc9e96782703c70d3c95f8e2c119f1bc3017b9d19904bdc9584998c94df81a13bf03c13e478a9b53a1f5c83815ca6
7
+ data.tar.gz: 823d42026f4c4aa9607379e4a966c3f8696c627cca2fb34d577879446070eecd221b81c4406a766d0b8c438971533b297f6e53f214d15628478f8d55f1cc5038
data/hotwire_crud.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'hotwire_crud'
3
- spec.version = '0.1.1'
3
+ spec.version = '0.1.2'
4
4
  spec.summary = 'crud generator with hotwire approach and static routes'
5
5
  spec.description = 'Crud generator with static routes which lazy loads content using content routes'
6
6
  spec.authors = ['Umair Azam']
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Explain the generator
3
+
4
+ Example:
5
+ bin/rails generate hotwire_crud Thing
6
+
7
+ This will create:
8
+ what/will/it/create
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ class HotwireCrudGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path("templates", __dir__)
5
+
6
+ argument :actions, type: :array, default: %w[index edit new show]
7
+
8
+ def create_static_controller_file
9
+ template "static_controller.erb", File.join("app/controllers/static", "#{file_name}_controller.rb")
10
+ end
11
+
12
+ def create_static_controller_test
13
+ template "static_controller_spec.erb", File.join("spec/controllers/static", "#{file_name}_controller_spec.rb")
14
+ end
15
+
16
+ def create_controller_file
17
+ template "controller.erb", File.join("app/controllers", "#{file_name}_controller.rb")
18
+ end
19
+
20
+ def create_controller_test
21
+ template "controller_spec.erb", File.join("spec/controllers", "#{file_name}_controller_spec.rb")
22
+ end
23
+
24
+ def create_views
25
+ actions.each do |action|
26
+ template "views/static_#{action}.html.erb", File.join("app/views/static", file_name, "#{action}.html.haml")
27
+ template "views/#{action}.html.erb", File.join("app/views", file_name, "#{action}.html.haml")
28
+ end
29
+ end
30
+
31
+ def insert_routes
32
+ route "resources :#{file_name}, only: #{actions.map(&:to_sym).inspect}"
33
+
34
+ route_namespace = 'static'
35
+ route "namespace :#{route_namespace} do\n resources :#{file_name}, only: #{actions.map(&:to_sym).inspect}\nend"
36
+ end
37
+ end
@@ -0,0 +1,10 @@
1
+
2
+ class <%= class_name %>Controller < ApplicationController
3
+ <% actions.each do |action|%>
4
+ def <%= action %>
5
+ # Your <%= action %> action code goes here
6
+ end
7
+ <% end %>
8
+
9
+ # Define other actions here if needed
10
+ end
@@ -0,0 +1,15 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe <%= "#{class_name}Controller" %>, type: :controller do
4
+
5
+ <% actions.each do |action|%>
6
+ describe 'GET #<%= action %>' do
7
+ it 'returns http success' do
8
+ get :<%= action %>
9
+ expect(response).to have_http_status(:success)
10
+ end
11
+ end
12
+ <% end %>
13
+
14
+ # Define other tests here if needed
15
+ end
@@ -0,0 +1,8 @@
1
+
2
+ class Static::<%= class_name %>Controller < ApplicationController
3
+ <% actions.each do |action|%>
4
+ def <%= action %>
5
+ # Your <%= action %> action code goes here
6
+ end
7
+ <% end %>
8
+ end
@@ -0,0 +1,15 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe <%= "Static::#{class_name}Controller" %>, type: :controller do
4
+
5
+ <% actions.each do |action|%>
6
+ describe 'GET #<%= action %>' do
7
+ it 'returns http success' do
8
+ get :<%= action %>
9
+ expect(response).to have_http_status(:success)
10
+ end
11
+ end
12
+ <% end %>
13
+
14
+ # Define other tests here if needed
15
+ end
@@ -0,0 +1 @@
1
+ %h hello index listing
@@ -0,0 +1 @@
1
+ %h hello static index listing
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hotwire_crud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umair Azam
@@ -47,6 +47,20 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - hotwire_crud.gemspec
50
+ - lib/generators/hotwire_crud/USAGE
51
+ - lib/generators/hotwire_crud/hotwire_crud_generator.rb
52
+ - lib/generators/hotwire_crud/templates/controller.erb
53
+ - lib/generators/hotwire_crud/templates/controller_spec.erb
54
+ - lib/generators/hotwire_crud/templates/static_controller.erb
55
+ - lib/generators/hotwire_crud/templates/static_controller_spec.erb
56
+ - lib/generators/hotwire_crud/templates/views/edit.html.erb
57
+ - lib/generators/hotwire_crud/templates/views/index.html.erb
58
+ - lib/generators/hotwire_crud/templates/views/new.html.erb
59
+ - lib/generators/hotwire_crud/templates/views/show.html.erb
60
+ - lib/generators/hotwire_crud/templates/views/static_edit.html.erb
61
+ - lib/generators/hotwire_crud/templates/views/static_index.html.erb
62
+ - lib/generators/hotwire_crud/templates/views/static_new.html.erb
63
+ - lib/generators/hotwire_crud/templates/views/static_show.html.erb
50
64
  homepage: https://github.com/omairrazam/hotwire_crud.git
51
65
  licenses:
52
66
  - MIT