From be13d19d756224ff36f2f27e746066aa3adedd39 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 11 Sep 2024 15:54:08 -0700 Subject: [PATCH 1/3] Add a helper task for the installer So it matches the rest of the Solid lineup --- lib/tasks/solid_cable_tasks.rake | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 lib/tasks/solid_cable_tasks.rake diff --git a/lib/tasks/solid_cable_tasks.rake b/lib/tasks/solid_cable_tasks.rake new file mode 100644 index 0000000..7b17abf --- /dev/null +++ b/lib/tasks/solid_cable_tasks.rake @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +desc "Copy over the schema and set cache for Solid Cable" +namespace :solid_cable do + task :install do + Rails::Command.invoke :generate, [ "solid_cable:install" ] + end +end From 4356db13a6246f7e14eed1987860e0197235a002 Mon Sep 17 00:00:00 2001 From: Nick Pezza Date: Wed, 11 Sep 2024 19:03:16 -0400 Subject: [PATCH 2/3] Fix cop --- lib/tasks/solid_cable_tasks.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/solid_cable_tasks.rake b/lib/tasks/solid_cable_tasks.rake index 7b17abf..5eaaef5 100644 --- a/lib/tasks/solid_cable_tasks.rake +++ b/lib/tasks/solid_cable_tasks.rake @@ -3,6 +3,6 @@ desc "Copy over the schema and set cache for Solid Cable" namespace :solid_cable do task :install do - Rails::Command.invoke :generate, [ "solid_cable:install" ] + Rails::Command.invoke :generate, ["solid_cable:install"] end end From 44158590538a481d70dcb1ccf097973ec629006f Mon Sep 17 00:00:00 2001 From: Nick Pezza Date: Wed, 11 Sep 2024 19:04:09 -0400 Subject: [PATCH 3/3] Remove generate from readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b61cee..3ebeceb 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ $ gem install solid_cable Now, you need to run the installer: ```bash -$ bin/rails generate solid_cable:install +$ bin/rails solid_cable:install ``` This will create the `db/cable_schema.rb` file. @@ -57,7 +57,7 @@ production: ``` > [!NOTE] -> Calling `bin/rails generate solid_cable:install` will automatically setup `config/cable.yml`, so no additional configuration is needed there (although you must make sure that you use the `cable` name in `database.yml` for this to match!). But if you want to use Solid Cable in a different environment (like staging or even development), you'll have to manually add that `connects_to` block to the respective environment in the `config/cable.yml` file. And, as always, make sure that the name you're using for the database in `config/cable.yml` matches the name you define in `config/database.yml`. +> Calling `bin/rails solid_cable:install` will automatically setup `config/cable.yml`, so no additional configuration is needed there (although you must make sure that you use the `cable` name in `database.yml` for this to match!). But if you want to use Solid Cable in a different environment (like staging or even development), you'll have to manually add that `connects_to` block to the respective environment in the `config/cable.yml` file. And, as always, make sure that the name you're using for the database in `config/cable.yml` matches the name you define in `config/database.yml`. Then run `db:prepare` in production to ensure the database is created and the schema is loaded.