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