Skip to content

Commit

Permalink
bundle add hotwire-rails & rails hotwire:install
Browse files Browse the repository at this point in the history
  • Loading branch information
hungmi committed Sep 22, 2021
1 parent 981d485 commit c6767db
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Gemfile
Expand Up @@ -14,7 +14,7 @@ gem 'sass-rails', '>= 6'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'

Expand Down Expand Up @@ -51,4 +51,5 @@ end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'jsbundling-rails'
gem 'jsbundling-rails'
gem "hotwire-rails", "~> 0.1.3"
11 changes: 11 additions & 0 deletions Gemfile.lock
Expand Up @@ -82,6 +82,10 @@ GEM
ffi (1.15.4)
globalid (0.5.2)
activesupport (>= 5.0)
hotwire-rails (0.1.3)
rails (>= 6.0.0)
stimulus-rails
turbo-rails
i18n (1.8.10)
concurrent-ruby (~> 1.0)
jbuilder (2.11.2)
Expand Down Expand Up @@ -144,6 +148,7 @@ GEM
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.3.1)
regexp_parser (2.1.1)
rubyzip (2.3.2)
sass-rails (6.0.0)
Expand All @@ -167,8 +172,12 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
stimulus-rails (0.5.4)
rails (>= 6.0.0)
thor (1.1.0)
tilt (2.0.10)
turbo-rails (0.7.14)
rails (>= 6.0.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
web-console (4.1.0)
Expand All @@ -194,13 +203,15 @@ DEPENDENCIES
bootsnap (>= 1.4.4)
byebug
capybara (>= 3.26)
hotwire-rails (~> 0.1.3)
jbuilder (~> 2.7)
jsbundling-rails
listen (~> 3.3)
pg (~> 1.1)
puma (~> 5.0)
rack-mini-profiler (~> 2.0)
rails (~> 6.1.4)
redis (~> 4.0)
sass-rails (>= 6)
selenium-webdriver
spring
Expand Down
2 changes: 2 additions & 0 deletions app/javascript/application.js
Expand Up @@ -2,4 +2,6 @@

window.addEventListener("load", function(event) {
console.log('hello! from new application.js')
import "./controllers"
import "@hotwired/turbo-rails"
})
10 changes: 10 additions & 0 deletions app/javascript/controllers/application.js
@@ -0,0 +1,10 @@
import { Application } from "@hotwired/stimulus"

const application = Application.start()

// Configure Stimulus development experience
application.warnings = true
application.debug = false
window.Stimulus = application

export { application }
7 changes: 7 additions & 0 deletions app/javascript/controllers/hello_controller.js
@@ -0,0 +1,7 @@
import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
connect() {
this.element.textContent = "Hello World!"
}
}
7 changes: 7 additions & 0 deletions app/javascript/controllers/index.js
@@ -0,0 +1,7 @@
// This file is auto-generated by ./bin/rails stimulus:manifest:update
// Run that command whenever you add a new controller

import { application } from "./application"

import HelloController from "./hello_controller"
application.register("hello", HelloController)
3 changes: 2 additions & 1 deletion config/cable.yml
@@ -1,5 +1,6 @@
development:
adapter: async
adapter: redis
url: redis://localhost:6379/1

test:
adapter: test
Expand Down
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -2,6 +2,8 @@
"name": "app",
"private": "true",
"dependencies": {
"@hotwired/stimulus": "^3.0.0-beta.2",
"@hotwired/turbo-rails": "^7.0.0-rc.4",
"esbuild": "^0.12.29"
},
"scripts": {
Expand Down
23 changes: 23 additions & 0 deletions yarn.lock
Expand Up @@ -2,6 +2,29 @@
# yarn lockfile v1


"@hotwired/stimulus@^3.0.0-beta.2":
version "3.0.0-beta.2"
resolved "https://registry.yarnpkg.com/@hotwired/stimulus/-/stimulus-3.0.0-beta.2.tgz#64ca67af9cc473ca97bb99d98fee5bc08e4c3914"
integrity sha512-rp2XojlugD0mvqi3qbqM660PbjqS7hnq/8FYa7SK/DL2rvWDu0/Ka3KW8cyXtcB1RiVG4nX5Oh4oq3nmuDjENQ==

"@hotwired/turbo-rails@^7.0.0-rc.4":
version "7.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@hotwired/turbo-rails/-/turbo-rails-7.0.0-rc.4.tgz#647e7f976b1bb645a2902c131c235d7440c28e29"
integrity sha512-ibCoMPnJRz/1CTsMywYLotq0zz2G4VZUeMiYSupzjmGFesGSJiCRiC42+iXPK/P1qwqp0WdWxSBRhfXI/wbH0A==
dependencies:
"@hotwired/turbo" "^7.0.0-rc.4"
"@rails/actioncable" "^6.0.0"

"@hotwired/turbo@^7.0.0-rc.4":
version "7.0.0-rc.4"
resolved "https://registry.yarnpkg.com/@hotwired/turbo/-/turbo-7.0.0-rc.4.tgz#d3ab9555544534f5ec649613553e72ff6c7d7122"
integrity sha512-4qx+6O6mUN+cSN+ZLGCOGc+2MxNrs7cFbmnWD6LIfiHAQyuNiIuB87Y5IAtOo8xj16fOBd2CdU1WRJya4Wkw0A==

"@rails/actioncable@^6.0.0":
version "6.1.4"
resolved "https://registry.yarnpkg.com/@rails/actioncable/-/actioncable-6.1.4.tgz#c3c5a9f8302c429af9722b6c50ab48049016d2a3"
integrity sha512-0LmSKJTuo2dL6BQ+9xxLnS9lbkyfz2mBGeBnQ2J7o9Bn0l0q+ZC6VuoZMZZXPvABI4QT7Nfknv5WhfKYL+boew==

esbuild@^0.12.29:
version "0.12.29"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.29.tgz#be602db7c4dc78944a9dbde0d1ea19d36c1f882d"
Expand Down

0 comments on commit c6767db

Please sign in to comment.