mirror of
https://github.com/kingomarnajjar/codespaces-rails.git
synced 2026-07-26 06:37:17 +10:00
Merge pull request #7 from github/joshaber/add-live-reload
Add live reload
This commit is contained in:
commit
deb18f698f
18 changed files with 94 additions and 7 deletions
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"codespaces": {
|
"codespaces": {
|
||||||
"openFiles": ["config/routes.rb", "README.md"]
|
"openFiles": ["app/views/hello/index.html.erb", "README.md"]
|
||||||
},
|
},
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"extensions": [
|
"extensions": [
|
||||||
|
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -33,3 +33,5 @@
|
||||||
|
|
||||||
# Ignore master key for decrypting credentials and more.
|
# Ignore master key for decrypting credentials and more.
|
||||||
/config/master.key
|
/config/master.key
|
||||||
|
|
||||||
|
dump.rdb
|
||||||
|
|
|
||||||
2
Gemfile
2
Gemfile
|
|
@ -66,6 +66,8 @@ group :development do
|
||||||
|
|
||||||
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
||||||
# gem "spring"
|
# gem "spring"
|
||||||
|
|
||||||
|
gem "hotwire-livereload", "~> 1.2"
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
|
|
|
||||||
11
Gemfile.lock
11
Gemfile.lock
|
|
@ -108,8 +108,12 @@ GEM
|
||||||
rubocop
|
rubocop
|
||||||
smart_properties
|
smart_properties
|
||||||
erubi (1.11.0)
|
erubi (1.11.0)
|
||||||
|
ffi (1.15.5)
|
||||||
globalid (1.0.0)
|
globalid (1.0.0)
|
||||||
activesupport (>= 5.0)
|
activesupport (>= 5.0)
|
||||||
|
hotwire-livereload (1.2.2)
|
||||||
|
listen (>= 3.0.0)
|
||||||
|
rails (>= 6.0.0)
|
||||||
i18n (1.12.0)
|
i18n (1.12.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
importmap-rails (1.1.5)
|
importmap-rails (1.1.5)
|
||||||
|
|
@ -127,6 +131,9 @@ GEM
|
||||||
rexml
|
rexml
|
||||||
kramdown-parser-gfm (1.1.0)
|
kramdown-parser-gfm (1.1.0)
|
||||||
kramdown (~> 2.0)
|
kramdown (~> 2.0)
|
||||||
|
listen (3.7.1)
|
||||||
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
loofah (2.18.0)
|
loofah (2.18.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
|
|
@ -193,6 +200,9 @@ GEM
|
||||||
zeitwerk (~> 2.5)
|
zeitwerk (~> 2.5)
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
rake (13.0.6)
|
rake (13.0.6)
|
||||||
|
rb-fsevent (0.11.2)
|
||||||
|
rb-inotify (0.10.1)
|
||||||
|
ffi (~> 1.0)
|
||||||
regexp_parser (2.5.0)
|
regexp_parser (2.5.0)
|
||||||
reline (0.3.1)
|
reline (0.3.1)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
|
|
@ -283,6 +293,7 @@ DEPENDENCIES
|
||||||
capybara
|
capybara
|
||||||
debug
|
debug
|
||||||
erb_lint
|
erb_lint
|
||||||
|
hotwire-livereload (~> 1.2)
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
puma (~> 5.0)
|
puma (~> 5.0)
|
||||||
|
|
|
||||||
45
app/assets/stylesheets/hello.css
Normal file
45
app/assets/stylesheets/hello.css
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||||
|
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||||
|
sans-serif;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||||
|
monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-logo {
|
||||||
|
height: 40vmin;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-header {
|
||||||
|
background-color: #282c34;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: calc(10px + 2vmin);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.App-link {
|
||||||
|
color: #61dafb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.heart {
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
}
|
||||||
4
app/controllers/hello_controller.rb
Normal file
4
app/controllers/hello_controller.rb
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
class HelloController < ApplicationController
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
end
|
||||||
2
app/helpers/hello_codespaces_helper.rb
Normal file
2
app/helpers/hello_codespaces_helper.rb
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
module HelloCodespacesHelper
|
||||||
|
end
|
||||||
11
app/views/hello/index.html.erb
Normal file
11
app/views/hello/index.html.erb
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<div class="App">
|
||||||
|
<header class="App-header">
|
||||||
|
<img src="Octocat.png" class="App-logo" alt="logo" />
|
||||||
|
<p>
|
||||||
|
GitHub Codespaces <span class="heart">♥️</span> Rails
|
||||||
|
</p>
|
||||||
|
<p class="small">
|
||||||
|
Edit <code>app/views/hello/index.html.erb</code> and see changes live!
|
||||||
|
</p>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
||||||
<%= javascript_importmap_tags %>
|
<%= javascript_importmap_tags %>
|
||||||
|
<%= hotwire_livereload_tags if Rails.env.development? %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,9 @@ Rails.application.configure do
|
||||||
# Suppress logger output for asset requests.
|
# Suppress logger output for asset requests.
|
||||||
config.assets.quiet = true
|
config.assets.quiet = true
|
||||||
|
|
||||||
|
pf_domain = ENV['GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN']
|
||||||
config.action_dispatch.default_headers = {
|
config.action_dispatch.default_headers = {
|
||||||
'X-Frame-Options' => 'ALLOW-FROM preview.app.github.dev'
|
'X-Frame-Options' => "ALLOW-FROM #{pf_domain}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Raises error for missing translations.
|
# Raises error for missing translations.
|
||||||
|
|
@ -73,5 +74,8 @@ Rails.application.configure do
|
||||||
# config.action_cable.disable_request_forgery_protection = true
|
# config.action_cable.disable_request_forgery_protection = true
|
||||||
|
|
||||||
# Allow requests from our preview domain.
|
# Allow requests from our preview domain.
|
||||||
config.hosts << "#{ENV['CODESPACE_NAME']}-3000.preview.app.github.dev"
|
pf_host = "#{ENV['CODESPACE_NAME']}-3000.#{pf_domain}"
|
||||||
|
config.hosts << pf_host
|
||||||
|
|
||||||
|
config.action_cable.allowed_request_origins = ["https://#{pf_host}"]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
root "hello#index"
|
||||||
|
|
||||||
# Defines the root path route ("/")
|
|
||||||
# root "articles#index"
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
BIN
public/Octocat.png
Normal file
BIN
public/Octocat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2 MiB |
8
test/controllers/hello_codespaces_controller_test.rb
Normal file
8
test/controllers/hello_codespaces_controller_test.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class HelloCodespacesControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
test "should get index" do
|
||||||
|
get "/"
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
end
|
||||||
BIN
vendor/cache/ffi-1.15.5.gem
vendored
Normal file
BIN
vendor/cache/ffi-1.15.5.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/hotwire-livereload-1.2.2.gem
vendored
Normal file
BIN
vendor/cache/hotwire-livereload-1.2.2.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/listen-3.7.1.gem
vendored
Normal file
BIN
vendor/cache/listen-3.7.1.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rb-fsevent-0.11.2.gem
vendored
Normal file
BIN
vendor/cache/rb-fsevent-0.11.2.gem
vendored
Normal file
Binary file not shown.
BIN
vendor/cache/rb-inotify-0.10.1.gem
vendored
Normal file
BIN
vendor/cache/rb-inotify-0.10.1.gem
vendored
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue