-
Notifications
You must be signed in to change notification settings - Fork 5
Proposal for hyper-rails gem #3
Description
The goal is to provide a standard and best practice way of installing and configuring all Hyperloop gems with Rails - this will include the use of Yarn (and/or NPM) and Webpack.
HyperRails gem proposed documentation:
Installation
This generator will install and configure all Hyperloop Gems with Rails 4.x or 5.x.
In your Gemfile
gem "hyper-rails"then
bundle install
Once the HyperRails gem is installed, you can use it to install each of the family of Hyperloop gems:
Using the Installation generators
There are generators to to install and configure each of the Hyperloop gems:
Install Everything
rails g hyperloop:all
bundle updateThis will install all of the gems listed below with the default configuration.
HyperReact
HyperReact is the master gem. You will always need this as a base. HyperReact provides a Ruby DSL to Facebook’s React. Much of the documentation on this site covers usage of this Gem.
rails g hyperloop:install_hyper_react
bundle updateOptions:
--include-react-source(default) latest React and ReactDOM will be included--exclude-react-sourceto not include React which you will need to include yourself--use-npm-webpackadd React via NPM and include via Webpack--use-yarn-webpackadd React via Yarn and include via Webpack
HyperMesh
HyperMesh is a policy based CRUD system which wraps ActiveRecord models on the server and extends them to the client. Furthermore it implements push notifications (via a number of possible technologies) so changes to records in use by clients are pushed to those clients if authorised. Isomorphic Ruby in action.
rails g hyperloop:install_hyper_mesh
bundle updateOptions:
--exclude-client-syncbasic CRUD functionality with no method of synchronising connected clients--include-client-sync(default) client sync is included and you will need to use one of the push notification technologies below--use-pusher-fake(default) the easiest way to setup client push is to use the Pusher-Fake gem--use-pusheryou will need an account with pusher.com--use-actioncablefor Rails 5
HyperRouter
HyperRouter provides a Ruby DSL to Facebook’s React Router which is a React component that loads other components depending on the current URL.
rails g hyperloop:install_hyper_router
bundle updateOptions:
--include-router-source(default) latest React Router will be included--exclude-router-sourceto not include React Router which you will need to include yourself--use-npm-webpackadd React via NPM and include via Webpack--use-yarn-webpackadd React via Yarn and include via Webpack
HyperTrace
Method tracing and conditional breakpoints for Opal Ruby.
rails g hyperloop:install_hyper_trace
bundle updateOpal Hot Reloader
For pure programmer joy, no more page refreshes.
rails g hyperloop:install_opal_hot_reloader
bundle updateAdditional useful generators
Creating HyperReact Components
rails g hyperloop:component Home::ClockWhich will make the component Home::Clock in app/views/components/home/clock.rb
You can render a component directly from a controller:
class HomeController < ApplicationController
def clock
render_component
end
endOr from a view:
<%= react_component('Home::Clock') %>See Ruby-Hyperllop.io for further examples.
Creating Router Components
rails g hyperloop:router Home::ShowWill make the router component app/views/components/home/show.rb
See Ruby-Hyperllop.io for further examples.
How it works
(details of each gem install showing which files are added and how Rails is configured)