next_rails_scaffold 0.1.9 → 0.1.11

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: b9e43c5ca53fb69e1b2ad36d222316f092d83adcf22771de34838c9b176c5aa1
4
- data.tar.gz: 383a69fa52d27c05645ae3db30a9e36a8b628ea7fab6f7c29dfc7c9c40162824
3
+ metadata.gz: f03d199ec6a029410c9c0626e7eaa604e8e454c772b161a5ef884e5503d4e284
4
+ data.tar.gz: c0c56ac0d95b65e3979c0120f59db0f494a980fdcd8f4138c037b74ce43aff5c
5
5
  SHA512:
6
- metadata.gz: 0fc1ab34055af28a30ba72b57d9e1c9e59aec332dc6e1e8c4a141537193d2fe11a8ba7f554e79f75e760eca6ffc2765ba055453c250218da22de0f653fddb546
7
- data.tar.gz: beddbe982618623580da842ee049380f033739eb6dc5b1039ee6c342be06ecf37c890da19c938cf09053bde8049c9e40fb0fad556791707a157eb29deb5ada96
6
+ metadata.gz: 8b3369a429e58f2739888d89ef20fa368124b27e5cfcd302eaedc9d09173391ef42a46ce3d99be58320a3fb22782e92545182b3ff19e160c162f3aed34d3750c
7
+ data.tar.gz: 87dcb6bc580cc1a9aa8afd0aa0314ff037ae0d7f31cad7a35a653862f46ea3f4c472f84a6faabc8c2780d95e7bf7905e8cbe03811345f414492eef05b514bd1e
data/README.md CHANGED
@@ -1,10 +1,21 @@
1
- # NextRails
1
+ # NextRailsScaffold
2
2
 
3
3
  The `next_rails_scaffold` gem is a powerful extension to the standard Ruby on Rails scaffold generator. It streamlines the development workflow by not only creating the backend structure with Rails but also automating the setup of a frontend directory using Next.js. Upon running the scaffold generator, this gem intelligently generates a Next.js application within the specified frontend directory.
4
4
 
5
5
  The generated Next.js app follows best practices, including a structured page routing system, ensuring that each resource created by the scaffold has its corresponding page and components. This integration enables developers to seamlessly transition between Rails backend and Next.js frontend development, fostering a cohesive and efficient development environment.
6
6
 
7
- Key Features:
7
+ Currently, https://www.hygen.io/ is used to create Next.js code, and the https://github.com/raphox/next-rails-scaffold repository contains template files.
8
+
9
+ <div align="center">
10
+ <a href="https://www.youtube.com/watch?v=eMM3AChZ5LY" target="_blank">
11
+ <img
12
+ src="https://img.youtube.com/vi/eMM3AChZ5LY/0.jpg"
13
+ alt="NextRailsScaffold (next_rails_scaffold)"
14
+ style="width:60%">
15
+ </a>
16
+ </div>
17
+
18
+ ## Key Features:
8
19
 
9
20
  - **Automatic Frontend Setup:** The gem automates the creation of a frontend directory within the Rails project, ready for Next.js development.
10
21
  - **Page Routing Integration:** All scaffolded resources come with their own pages and components, organized using Next.js' page routing system.
@@ -30,6 +41,10 @@ The `next_rails_scaffold` gem enhances the default Ruby on Rails scaffold genera
30
41
  Example:
31
42
 
32
43
  ```
44
+ # Appending the `next_rails_scaffold` generator steps to the to the Rails' scaffold generator.
45
+ bin/rails generate next_rails_scaffold:install
46
+
47
+ # Generate the RESfull API endpoints and Next.js app with respective components and pages.
33
48
  bin/rails generate scaffold Post tile:string body:text
34
49
  ```
35
50
 
@@ -57,6 +72,8 @@ frontend/
57
72
  services.js
58
73
  ```
59
74
 
75
+ Sample app https://github.com/raphox/next-rails-app.
76
+
60
77
  ## Development
61
78
 
62
79
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -65,7 +82,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
65
82
 
66
83
  ## Contributing
67
84
 
68
- Bug reports and pull requests are welcome on GitHub at https://github.com/raphox/next_rails.
85
+ Bug reports and pull requests are welcome on GitHub at https://github.com/raphox/next_rails_scaffold.
69
86
 
70
87
  ## License
71
88
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module NextRails
3
+ module NextRailsScaffold
4
4
  class StaticPagesController < ApplicationController
5
5
  STATIC_FILES_PATH = Rails.root.join("public").to_s
6
6
 
data/config/routes.rb CHANGED
@@ -11,6 +11,6 @@ Rails.application.routes.draw do
11
11
  route = path[%r{#{Regexp.escape(static_files_path)}(.*)/index.html}, 1]
12
12
  route = route.gsub(parameter_regex, ':\1')
13
13
 
14
- get route, to: "next_rails/static_pages#index", file_path: path
14
+ get route, to: "next_rails_scaffold/static_pages#index", file_path: path
15
15
  end
16
16
  end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module NextRails
3
+ module NextRailsScaffold
4
4
  module Generators
5
5
  class InstallGenerator < Rails::Generators::Base
6
- desc "Copy NextRails default files"
6
+ desc "Copy NextRailsScaffold default files"
7
7
  source_root File.expand_path("templates", __dir__)
8
8
 
9
9
  def copy_config
10
- template "config/initializers/next_rails.rb"
10
+ template "config/initializers/next_rails_scaffold.rb"
11
11
  end
12
12
  end
13
13
  end
@@ -1,11 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "next_rails"
4
-
5
- NextRails.setup do |config|
3
+ NextRailsScaffold.setup do |config|
6
4
  config.generators do |g|
7
5
  g.api_only = true
8
6
  g.resource_route false
9
- g.helper :next_rails
7
+ g.helper :next_rails_scaffold
10
8
  end
11
9
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rails
4
- class NextRailsGenerator < Rails::Generators::NamedBase
5
- include ::NextRails::Actions
4
+ class NextRailsScaffoldGenerator < Rails::Generators::NamedBase
5
+ include ::NextRailsScaffold::Actions
6
6
 
7
7
  source_root File.expand_path("templates", __dir__)
8
8
 
@@ -50,7 +50,7 @@ module Rails
50
50
  create_next_app!
51
51
  install_hygen!
52
52
 
53
- run("npx hygen generator scaffold #{name} #{mapped_attributes.join(" ")}")
53
+ run("npx hygen scaffold javascript #{name} #{mapped_attributes.join(" ")}")
54
54
  run("yarn build")
55
55
  end
56
56
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module NextRails
3
+ module NextRailsScaffold
4
4
  module Actions
5
5
  # Make an entry in Rails routing file <tt>config/routes.rb</tt>
6
6
  #
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NextRailsScaffold
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace NextRailsScaffold
6
+ config.eager_load_namespaces << NextRailsScaffold
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NextRailsScaffold
4
+ VERSION = "0.1.11"
5
+ end
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "next_rails/actions"
4
- require_relative "next_rails/engine"
5
- require_relative "next_rails/version"
3
+ require_relative "next_rails_scaffold/actions"
4
+ require_relative "next_rails_scaffold/engine"
5
+ require_relative "next_rails_scaffold/version"
6
6
 
7
- module NextRails
7
+ module NextRailsScaffold
8
8
  class Error < StandardError; end
9
9
 
10
10
  @@configured = false
@@ -13,7 +13,7 @@ module NextRails
13
13
  @@configured
14
14
  end
15
15
 
16
- # Default way to setup Next Rails. Run rails generate next_rails:install
16
+ # Default way to setup Next Rails. Run rails generate next_rails_scaffold:install
17
17
  # to create a fresh initializer with all configuration values.
18
18
  def self.setup
19
19
  @@configured = true
@@ -1,4 +1,4 @@
1
- module NextRails
1
+ module NextRailsScaffold
2
2
  VERSION: String
3
3
  # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: next_rails_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Araújo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-24 00:00:00.000000000 Z
11
+ date: 2023-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -50,17 +50,17 @@ files:
50
50
  - LICENSE.txt
51
51
  - README.md
52
52
  - Rakefile
53
- - app/controllers/next_rails/static_pages_controller.rb
53
+ - app/controllers/next_rails_scaffold/static_pages_controller.rb
54
54
  - config/routes.rb
55
- - lib/generators/next_rails/USAGE
56
- - lib/generators/next_rails/install_generator.rb
57
- - lib/generators/next_rails/templates/config/initializers/next_rails.rb
58
- - lib/generators/rails/next_rails/next_rails_generator.rb
59
- - lib/next_rails.rb
60
- - lib/next_rails/actions.rb
61
- - lib/next_rails/engine.rb
62
- - lib/next_rails/version.rb
63
- - sig/next_rails.rbs
55
+ - lib/generators/next_rails_scaffold/USAGE
56
+ - lib/generators/next_rails_scaffold/install_generator.rb
57
+ - lib/generators/next_rails_scaffold/templates/config/initializers/next_rails_scaffold.rb
58
+ - lib/generators/rails/next_rails_scaffold/next_rails_scaffold_generator.rb
59
+ - lib/next_rails_scaffold.rb
60
+ - lib/next_rails_scaffold/actions.rb
61
+ - lib/next_rails_scaffold/engine.rb
62
+ - lib/next_rails_scaffold/version.rb
63
+ - sig/next_rails_scaffold.rbs
64
64
  homepage: https://github.com/raphox/next-rails#readme
65
65
  licenses:
66
66
  - MIT
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NextRails
4
- class Engine < ::Rails::Engine
5
- isolate_namespace NextRails
6
- config.eager_load_namespaces << NextRails
7
- end
8
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NextRails
4
- VERSION = "0.1.9"
5
- end