Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .new-demo-versions
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RAILS_VERSION="8.0.3"
# SHAKAPACKER_VERSION="github:shakacode/shakapacker" # GitHub main branch (default)
# SHAKAPACKER_VERSION="github:shakacode/shakapacker#fix-hmr" # GitHub branch (use #)
# SHAKAPACKER_VERSION="github:shakacode/[email protected]" # GitHub tag (use @)
SHAKAPACKER_VERSION="github:shakacode/shakapacker"
SHAKAPACKER_VERSION="~> 9.0.0.beta.5"

# React on Rails version (use ~> for compatibility range, or specific version)
# Examples:
Expand Down
32 changes: 16 additions & 16 deletions demos/basic-v16-webpack/Gemfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
# frozen_string_literal: true

source "https://rubygems.org"
source 'https://rubygems.org'

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 8.0.3"
gem 'rails', '~> 8.0.3'
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
gem "propshaft"
gem 'propshaft'
# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"
gem 'pg', '~> 1.1'
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
gem 'puma', '>= 5.0'
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"
gem 'jbuilder'

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[windows jruby]
gem 'tzinfo-data', platforms: %i[windows jruby]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false
gem 'bootsnap', require: false

# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
gem "thruster", require: false
gem 'thruster', require: false

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[mri windows], require: "debug/prelude"
gem 'debug', platforms: %i[mri windows], require: 'debug/prelude'

# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
gem "brakeman", require: false
gem 'brakeman', require: false

# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false
gem 'rubocop-rails-omakase', require: false
end

group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
gem 'web-console'
end

gem "shakapacker", "~> 9.3.beta.5", github: "shakacode/shakapacker"
gem 'shakapacker', '~> 9.0.0.beta.5'

gem "react_on_rails", "~> 16.1"
gem 'react_on_rails', '~> 16.1'

# Shared demo configuration and utilities
gem "shakacode_demo_common", path: "../../packages/shakacode_demo_common"
gem 'shakacode_demo_common', path: '../../packages/shakacode_demo_common'
19 changes: 7 additions & 12 deletions demos/basic-v16-webpack/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
GIT
remote: https://github.com/shakacode/shakapacker.git
revision: 926be1d6a0dae1d64817f641268085032dbce3af
specs:
shakapacker (9.3.0.beta.5)
activesupport (>= 5.2)
package_json
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)

PATH
remote: ../../packages/shakacode_demo_common
specs:
Expand Down Expand Up @@ -286,6 +275,12 @@ GEM
ruby-progressbar (1.13.0)
securerandom (0.4.1)
semantic_range (3.1.0)
shakapacker (9.0.0)
activesupport (>= 5.2)
package_json
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
stringio (3.1.7)
thor (1.4.0)
thruster (0.1.15)
Expand Down Expand Up @@ -337,7 +332,7 @@ DEPENDENCIES
react_on_rails (~> 16.1)
rubocop-rails-omakase
shakacode_demo_common!
shakapacker (~> 9.3.beta.5)!
shakapacker (~> 9.0.0.beta.5)
thruster
tzinfo-data
web-console
Expand Down
2 changes: 1 addition & 1 deletion demos/basic-v16-webpack/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative "config/application"
require_relative 'config/application'

Rails.application.load_tasks
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

class HelloWorldController < ApplicationController
layout "hello_world"
layout 'hello_world'

def index
@hello_world_props = { name: "Stranger" }
@hello_world_props = { name: 'Stranger' }
end
end
4 changes: 2 additions & 2 deletions demos/basic-v16-webpack/app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class ApplicationMailer < ActionMailer::Base
default from: "[email protected]"
layout "mailer"
default from: '[email protected]'
layout 'mailer'
end
8 changes: 4 additions & 4 deletions demos/basic-v16-webpack/bin/brakeman
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'

ARGV.unshift("--ensure-latest")
ARGV.unshift('--ensure-latest')

load Gem.bin_path("brakeman", "brakeman")
load Gem.bin_path('brakeman', 'brakeman')
22 changes: 10 additions & 12 deletions demos/basic-v16-webpack/bin/bundle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# this file is here to facilitate running it.
#

require "rubygems"
require 'rubygems'

m = Module.new do
module_function
Expand All @@ -18,13 +18,12 @@ m = Module.new do
end

def env_var_version
ENV.fetch("BUNDLER_VERSION", nil)
ENV.fetch('BUNDLER_VERSION', nil)
end

# rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def cli_arg_version
return unless invoked_as_script? # don't want to hijack other binstubs
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update`

bundler_version = nil
update_index = nil
Expand All @@ -37,19 +36,18 @@ m = Module.new do
end
bundler_version
end
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity

def gemfile
gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
gemfile = ENV.fetch('BUNDLE_GEMFILE', nil)
return gemfile if gemfile && !gemfile.empty?

File.expand_path("../Gemfile", __dir__)
File.expand_path('../Gemfile', __dir__)
end

def lockfile
lockfile =
case File.basename(gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
when 'gems.rb' then gemfile.sub(/\.rb$/, '.locked')
else "#{gemfile}.lock"
end
File.expand_path(lockfile)
Expand Down Expand Up @@ -80,19 +78,19 @@ m = Module.new do
end

def load_bundler!
ENV["BUNDLE_GEMFILE"] ||= gemfile
ENV['BUNDLE_GEMFILE'] ||= gemfile

activate_bundler
end

def activate_bundler
gem_error = activation_error_handling do
gem "bundler", bundler_requirement
gem 'bundler', bundler_requirement
end
return if gem_error.nil?

require_error = activation_error_handling do
require "bundler/version"
require 'bundler/version'
end
if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
return
Expand All @@ -114,4 +112,4 @@ end

m.load_bundler!

load Gem.bin_path("bundler", "bundle") if m.invoked_as_script?
load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?
8 changes: 4 additions & 4 deletions demos/basic-v16-webpack/bin/dev
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
# 3. Extend ReactOnRails::Dev classes in your Rails app for advanced customization
# 4. Use classes directly: ReactOnRails::Dev::ServerManager.start(:development, "Custom.procfile")

require "bundler/setup"
require "react_on_rails/dev"
require 'bundler/setup'
require 'react_on_rails/dev'

# Default route configuration
# This is set by the ReactOnRails installer to point to your generated component.
# Change this to your preferred default route, or pass --route=<route> to override.
DEFAULT_ROUTE = "hello_world"
DEFAULT_ROUTE = 'hello_world'

# Main execution
# Add the default route to ARGV if no --route option is provided
argv_with_defaults = ARGV.dup
argv_with_defaults.push("--route", DEFAULT_ROUTE) unless argv_with_defaults.any? { |arg| arg.start_with?("--route") }
argv_with_defaults.push('--route', DEFAULT_ROUTE) unless argv_with_defaults.any? { |arg| arg.start_with?('--route') }

ReactOnRails::Dev::ServerManager.run_from_command_line(argv_with_defaults)
6 changes: 3 additions & 3 deletions demos/basic-v16-webpack/bin/rails
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot"
require "rails/commands"
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
4 changes: 2 additions & 2 deletions demos/basic-v16-webpack/bin/rake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative "../config/boot"
require "rake"
require_relative '../config/boot'
require 'rake'
Rake.application.run
8 changes: 4 additions & 4 deletions demos/basic-v16-webpack/bin/rubocop
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'

# explicit rubocop config increases performance slightly while avoiding config confusion.
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
ARGV.unshift('--config', File.expand_path('../.rubocop.yml', __dir__))

load Gem.bin_path("rubocop", "rubocop")
load Gem.bin_path('rubocop', 'rubocop')
18 changes: 9 additions & 9 deletions demos/basic-v16-webpack/bin/setup
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "fileutils"
require 'fileutils'

APP_ROOT = File.expand_path("..", __dir__)
APP_ROOT = File.expand_path('..', __dir__)

def system!(*args)
system(*args, exception: true)
Expand All @@ -14,26 +14,26 @@ FileUtils.chdir APP_ROOT do
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.

puts "== Installing dependencies =="
system("bundle check") || system!("bundle install")
puts '== Installing dependencies =='
system('bundle check') || system!('bundle install')

# Install JavaScript dependencies
system!("npm install")
system!('npm install')

# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end

puts "\n== Preparing database =="
system! "bin/rails db:prepare"
system! 'bin/rails db:prepare'

puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
system! 'bin/rails log:clear tmp:clear'

unless ARGV.include?("--skip-server")
unless ARGV.include?('--skip-server')
puts "\n== Starting development server =="
$stdout.flush # flush the output before exec(2) so that it displays
exec "bin/dev"
exec 'bin/dev'
end
end
12 changes: 6 additions & 6 deletions demos/basic-v16-webpack/bin/shakapacker
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

ENV["RAILS_ENV"] ||= "development"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
ENV["APP_ROOT"] ||= File.expand_path("..", __dir__)
ENV['RAILS_ENV'] ||= 'development'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
ENV['APP_ROOT'] ||= File.expand_path('..', __dir__)

require "bundler/setup"
require "shakapacker"
require "shakapacker/runner"
require 'bundler/setup'
require 'shakapacker'
require 'shakapacker/runner'

Shakapacker::Runner.run(ARGV)
12 changes: 6 additions & 6 deletions demos/basic-v16-webpack/bin/shakapacker-dev-server
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

ENV["RAILS_ENV"] ||= "development"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
ENV['RAILS_ENV'] ||= 'development'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require "bundler/setup"
require "shakapacker"
require "shakapacker/dev_server_runner"
require 'bundler/setup'
require 'shakapacker'
require 'shakapacker/dev_server_runner'

APP_ROOT = File.expand_path("..", __dir__)
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
Shakapacker::DevServerRunner.run(ARGV)
end
6 changes: 3 additions & 3 deletions demos/basic-v16-webpack/bin/thrust
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "rubygems"
require "bundler/setup"
require 'rubygems'
require 'bundler/setup'

load Gem.bin_path("thruster", "thrust")
load Gem.bin_path('thruster', 'thrust')
2 changes: 1 addition & 1 deletion demos/basic-v16-webpack/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This file is used by Rack-based servers to start the application.

require_relative "config/environment"
require_relative 'config/environment'

run Rails.application
Rails.application.load_server
Loading