From e007fb5d5a6e07a890e7a4034cad8f6299491095 Mon Sep 17 00:00:00 2001 From: Kevin Pratt Date: Wed, 13 Mar 2024 11:56:57 -0600 Subject: [PATCH] Now the rake task comes from the gem! --- lib/dato_cms_graphql/rails/cache_task.rake | 4 ++++ lib/dato_cms_graphql/rails/railtie.rb | 3 +++ lib/dato_cms_graphql/version.rb | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 lib/dato_cms_graphql/rails/cache_task.rake diff --git a/lib/dato_cms_graphql/rails/cache_task.rake b/lib/dato_cms_graphql/rails/cache_task.rake new file mode 100644 index 0000000..cda30db --- /dev/null +++ b/lib/dato_cms_graphql/rails/cache_task.rake @@ -0,0 +1,4 @@ +desc "A rake task to persist the DatoCMS data locally" +task cache_dato: :environment do + DatoCmsGraphql::Rails::Persistence.cache_data +end diff --git a/lib/dato_cms_graphql/rails/railtie.rb b/lib/dato_cms_graphql/rails/railtie.rb index 24bd496..1cbccc9 100644 --- a/lib/dato_cms_graphql/rails/railtie.rb +++ b/lib/dato_cms_graphql/rails/railtie.rb @@ -1,6 +1,9 @@ module DatoCmsGraphql module Rails class Railtie < ::Rails::Railtie + rake_tasks do + load File.join(__dir__, "cache_task.rake") + end initializer "dato_cms_graphql_railtie.configure_rails_initialization" do |app| DatoCmsGraphql.path_to_queries = app.root.join("app", "queries") puts DatoCmsGraphql.path_to_queries diff --git a/lib/dato_cms_graphql/version.rb b/lib/dato_cms_graphql/version.rb index 95c9285..0e727f5 100644 --- a/lib/dato_cms_graphql/version.rb +++ b/lib/dato_cms_graphql/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module DatoCmsGraphql - VERSION = "0.2.3" + VERSION = "0.2.4" end