Modular Rails
Buy the book
Previous
-
Next
Table of Contents
Chapter 1. Introduction
Chapter 2. The Modular Way
Chapter 3. What is Modularity: Rails & Modularity Basics
Chapter 4. The Core Module: Set Up
Chapter 5. The Core Module: Authentication
Chapter 6. The Core Module: Automated Tests with RSpec
Chapter 7. The Core Module: Admin Panel
Chapter 8. The Core Module: Authorization with Pundit
Chapter 9. The Contacts Module: Set Up
Chapter 10. The Contacts Module: Adding a Controller
Chapter 11. The Contacts Module: Extending Views
Chapter 12. The Contacts Module: Extending Models & Controllers
Chapter 13. Contacts Exercise: Extending the Admin Panel
Chapter 14. The Tasks Module: Set Up
Chapter 15. The Tasks Module: Controllers & Views
Chapter 16. The Tasks Module: Listing Tasks in Contacts
Chapter 17. The Tasks Module: Extending the Dashboard
Chapter 18. Tasks Exercise: Extending the Admin Panel
Chapter 19. Deployment: Packaging Engines
Chapter 20. Deployment: Managing Engines
Chapter 21. Deployment: Publishing Engines
Chapter 22. Deploy your application online
Chapter 23. The End
Table of Contents
1. Introduction
1.1. Introduction
1.2. Who is this book for?
1.3. How is this book organized?
1.4. How to read this book?
1.5. Some things to note
1.5.1. Terminology: Module & Engine
1.5.2. About the code in this book
1.5.3. Errors, bugs, problems?
1.5.4. Requirements
2. The Modular Way
2.1. What is modularity
2.2. Modularity in programming
2.3. Advantages and Drawbacks
2.3.1. Advantages
2.3.2. Drawbacks
2.4. To Modular, or not to Modular
2.5. There’s no need to go All-In
3. What is Modularity: Rails & Modularity Basics
3.1. Ruby on Rails Magic
3.1.1. Interpreted Language
3.1.2. Bundler
3.1.3. Deface
3.1.4. Rails engines
3.2. Rails Engines
3.2.1. Quick overview of Rails engines
3.2.2. Creating an engine
3.2.3. Mounting an engine
3.2.4. Namespacing
3.2.5. Extending an engine
3.2.6. Engines in the wild!
3.3. Modular Architectures
3.3.1. What is a monolithic application?
3.3.2. What is a modular application?
3.3.3. Core engines vs Feature engines
3.3.4. Approach 1 – Three Tier Modules
3.3.5. Approach 2 – Hybrid Component-Based
3.3.6. Approach 3 – Full Component-Based
3.4. Build a modular CRM
3.4.1. The Idea
3.4.2. BlastCRM
4. The Core Module: Set Up
4.1. Version requirements
4.2. What is the core module?
4.3. Setting up the parent Rails application
4.4. Generating a mountable engine
4.4.1. The engines folder
4.4.2. Add one more namespace level
4.4.3. blast_core.rb and core.rb
4.4.4. Define a version
4.4.5. The Engine file
4.4.6. Gemspec
4.4.7. bin/rails
4.4.8. The Core routes
4.4.9. Adding the module to the parent Gemfile
4.10 Get the dependencies
4.11 Mount the engine
4.12 Am I alive? Can you see me?
4.5. Creating the first controller
4.5.1. Reorganize the controllers folder
4.5.2. Create the Dashboard controller
4.5.3. Add the corresponding route
4.5.4. Fix the layout and add the index view for the dashboard
4.6. Styling our application
4.6.1. Add the gems
4.6.2. Fix the assets folder
4.6.3. Load the Bootstrap CSS
4.6.4. Load the Bootstrap JavaScript files
4.6.5. Update the layout file
4.6.6. Add content to the layout file
4.6.7. Add a title to the dashboard
4.7. Versioning our project with Git
4.7.1. Installing Git
4.7.2. The Initial Commit
4.8. Wrap Up
4.8.1. What did we learn?
4.8.2. Next Step
5. The Core Module: Authentication
5.1. Users & Authentication
5.1.1. Adding Devise as a dependency
5.1.2. Run the Devise generator
5.1.3. Configuring Devise
5.1.4. Adding Flash messages
5.1.5. Generate the User model
5.1.6. Add migrations to parent app paths
5.1.7. Fix the Devise Routes
5.1.8. Add the admin column
5.1.9. Migrate
1.10 Copy views from Devise
1.11 Add authenticate_user!
1.12 Update Devise new session view
1.13 Update Devise new registration view
1.14 Register & Sign In
1.15 Update the navbar
1.16 Update the “My Account” view
1.17 Add active link to the navbar
1.18 Test it
5.2. Pushing Our Changes
5.3. Wrap Up
5.3.1. What did we learn?
5.3.2. Next Step
6. The Core Module: Automated Tests with RSpec
6.1. Setting up a testing environment
6.2. Generating the test database
6.3. Generating RSpec files
6.4. Updating the rails_helper.rb file
6.5. Adding some options to the .rspec file
6.6. Running the tests
6.7. Creating the User factory
6.8. Adding tests for the User model
6.9. Adding Dashboard Tests
10 Pushing Our Changes
11 Wrap Up
11.1 What did we learn?
11.2 Next Step
7. The Core Module: Admin Panel
7.1. Changing an existing user to admin
7.2. Creating the admin controller
7.3. Setting the admin routes
7.4. Adding an admin link to the dashboard
7.5. Creating the index view for the admin controller
7.6. Creating the admin users controller
7.7. Adding the users resources to our routes
7.8. Adding a link to /admin/users
7.9. Listing users
10 Adding a summary to the dashboard
11 A small bug
12 Pushing Our Changes
13 Wrap Up
13.1 What did we learn?
13.2 Next Step
8. The Core Module: Authorization with Pundit
8.1. Adding the Pundit gem
8.2. Setting up Pundit
8.3. Update the application controller
8.4. Protecting the dashboard controller
8.5. Protecting the users controller
8.6. Protecting the admin controller
8.7. Updating the navigation partial
8.8. Handling unauthorized exceptions
8.9. Pushing Our Changes
10 Wrap Up
10.1 What did we learn?
10.2 Next Step
9. The Contacts Module: Set Up
9.1. What is the Contacts module?
9.2. Generating the Contacts engine
9.2.1. Adding the deface and modular_engine gems
9.2.2. Generating the engine
9.2.3. Fixing the newly generated engine gemspec
9.2.4. Adding the Core gem to the Contacts engine Gemfile
9.2.5. Updating the routes file
9.2.6. Adding the new engine to the Parent Gemfile
9.3. Contact Model
9.4. Pushing Our Changes
9.5. Wrap Up
9.5.1. What did we learn?
9.5.2. Next Step
10. The Contacts Module: Adding a Controller
10.1. Generating a Controller
10.2. Pushing Our Changes
10.3. Wrap Up
10.3.1. What did we learn?
10.3.2. Next Step
11. The Contacts Module: Extending Views
11.1. Extending the Core view
11.2. Pushing Our Changes
11.3. Wrap Up
11.3.1. What did we learn?
11.3.2. Next Step
12. The Contacts Module: Extending Models & Controllers
12.1. Extending Contacts
12.2. Extending the Dashboard
12.2.1. Part 7: Extending the Core controllers
12.3. Pushing Our Changes
12.4. Wrap Up
12.4.1. What did we learn?
12.4.2. Next Step
13. Contacts Exercise: Extending the Admin Panel
13.1. Pushing Our Changes
13.2. Wrap Up
13.2.1. What did we learn?
13.2.2. Main points to remember
13.2.3. Next Step
14. The Tasks Module: Set Up
14.1. What is the Tasks module
14.2. Generating the Tasks engine
14.2.1. Create a new branch
14.2.2. Generate the engine
14.2.3. Fix the engine gemspec
14.2.4. Remove the test/ folder
14.2.5. Add the Core gem to the Tasks engine gemfile
14.2.6. Update the routes file
14.2.7. Add the new engine to the Parent Gemfile
14.2.8. Run bundle install
14.3. Task Model
14.4. Pushing Our Changes
14.5. Wrap Up
14.5.1. Next Step
15. The Tasks Module: Controllers & Views
15.1. Adding our Tasks Controllers & Views
15.1.1. Generate the Tasks controllers in the Tasks engine
15.1.2. Update the ApplicationController
15.1.3. Update the TasksController
15.1.4. Update the Views
15.1.5. Remove the layouts/ folder
15.1.6. Add the routes
15.1.7. Add “Tasks” link to the navigation menu
15.1.8. Fruits of our labour
15.2. Pushing Our Changes
15.3. Wrap Up
15.3.1. Next Step
16. The Tasks Module: Listing Tasks in Contacts
16.1. Is a module present?
16.1.1. Add the available? method
16.2. Link the modules
16.2.1. Update the Task Views
16.2.2. Add relations to our models
16.2.3. See how it looks
16.3. Show Tasks under Contact
16.3.1. Create a hook in the Contacts show view
16.3.2. Create the tasks override
16.3.3. Add the override view
16.3.4. Take a look
16.4. Remove engines
16.4.1. Remove the Tasks engine
16.4.2. Remove the Contacts engine
16.4.3. Put back everything and relax.
16.5. Pushing Our Changes
16.6. Wrap Up
16.6.1. What did we learn?
16.6.2. Next Step
17. The Tasks Module: Extending the Dashboard
17.1. Tasks in the Dashboard
17.1.1. Add the override
17.1.2. Add the override view
17.1.3. And for some pretty pictures
17.2. Pushing Our Changes
17.3. Wrap Up
17.3.1. Next Step
18. Tasks Exercise: Extending the Admin Panel
18.1. Pushing Our Changes
18.2. Wrap Up
18.2.1. Next Step
19. Deployment: Packaging Engines
19.1. What is an engine?
19.1.1. Why package your engines as gems
19.1.2. Make your first gem
19.1.3. Adding the source
19.2. Wrap Up
19.2.1. What did we learn?
19.2.2. Next Step
20. Deployment: Managing Engines
20.1. Development vs Production
20.2. Working with Git
20.2.1. Where should you push your source code
20.2.2. How to use branches
20.2.3. Versioning your modules
20.3. Eating your own dog food
20.4. Wrap Up
20.4.1. What did we learn?
20.4.2. Next Step
21. Deployment: Publishing Engines
21.1. Public vs Private
21.1.1. Public? RubyGems!
21.1.2. Private? Pick one
21.2. A private home for your engines
21.2.1. Setting up Geminabox
21.2.2. Pushing gems to your private gem server
21.2.3. Bundle install your gems
21.2.4. Pushing all our modules
21.3. Wrap Up
21.3.1. Next Step
22. Deploy your application online
22.1. Create an account on Heroku
22.2. Create a new application on Heroku
22.2.1. Preparations to do on BlastCRM
22.2.2. Add Heroku specific gems
22.2.3. Bundle
22.2.4. Commit your changes
22.2.5. Push your application
22.2.6. Enjoy!
22.3. Wrap Up
22.3.1. Next Step
23. The End