dato 0.7.18 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +42 -5
  3. data/.ruby-version +1 -1
  4. data/.travis.yml +2 -2
  5. data/Gemfile +1 -1
  6. data/Rakefile +2 -2
  7. data/TODO.md +28 -0
  8. data/bin/console +3 -3
  9. data/bin/rspec +6 -6
  10. data/dato.gemspec +1 -1
  11. data/exe/dato +3 -3
  12. data/lib/dato/account/client.rb +2 -2
  13. data/lib/dato/api_client.rb +37 -43
  14. data/lib/dato/api_error.rb +10 -13
  15. data/lib/dato/cli.rb +18 -18
  16. data/lib/dato/dump/dsl/add_to_data_file.rb +1 -1
  17. data/lib/dato/dump/dsl/create_data_file.rb +1 -1
  18. data/lib/dato/dump/dsl/create_post.rb +1 -1
  19. data/lib/dato/dump/dsl/directory.rb +4 -4
  20. data/lib/dato/dump/dsl/root.rb +7 -7
  21. data/lib/dato/dump/format/json.rb +1 -1
  22. data/lib/dato/dump/format/toml.rb +5 -6
  23. data/lib/dato/dump/format/yaml.rb +2 -3
  24. data/lib/dato/dump/format.rb +3 -3
  25. data/lib/dato/dump/operation/add_to_data_file.rb +4 -4
  26. data/lib/dato/dump/operation/create_data_file.rb +3 -3
  27. data/lib/dato/dump/operation/create_post.rb +5 -6
  28. data/lib/dato/dump/operation/directory.rb +1 -1
  29. data/lib/dato/dump/runner.rb +5 -5
  30. data/lib/dato/dump/ssg_detector.rb +18 -20
  31. data/lib/dato/json_api_deserializer.rb +15 -16
  32. data/lib/dato/json_api_serializer.rb +39 -28
  33. data/lib/dato/json_schema_relationships.rb +19 -23
  34. data/lib/dato/json_schema_type.rb +47 -0
  35. data/lib/dato/local/entities_repo.rb +3 -3
  36. data/lib/dato/local/field_type/color.rb +11 -7
  37. data/lib/dato/local/field_type/file.rb +18 -24
  38. data/lib/dato/local/field_type/gallery.rb +1 -1
  39. data/lib/dato/local/field_type/global_seo.rb +4 -7
  40. data/lib/dato/local/field_type/lat_lon.rb +1 -1
  41. data/lib/dato/local/field_type/seo.rb +1 -1
  42. data/lib/dato/local/field_type/structured_text.rb +63 -0
  43. data/lib/dato/local/field_type/theme.rb +2 -2
  44. data/lib/dato/local/field_type/upload_id.rb +5 -5
  45. data/lib/dato/local/field_type/video.rb +9 -15
  46. data/lib/dato/local/item.rb +11 -12
  47. data/lib/dato/local/items_repo.rb +11 -18
  48. data/lib/dato/local/json_api_entity.rb +4 -3
  49. data/lib/dato/local/loader.rb +30 -31
  50. data/lib/dato/local/site.rb +3 -4
  51. data/lib/dato/paginator.rb +4 -4
  52. data/lib/dato/repo.rb +23 -30
  53. data/lib/dato/site/client.rb +5 -5
  54. data/lib/dato/upload/create_upload_path.rb +7 -10
  55. data/lib/dato/upload/file.rb +3 -3
  56. data/lib/dato/upload/image.rb +1 -1
  57. data/lib/dato/utils/build_modular_block.rb +4 -4
  58. data/lib/dato/utils/favicon_tags_builder.rb +10 -10
  59. data/lib/dato/utils/locale_value.rb +1 -1
  60. data/lib/dato/utils/meta_tags/article_modified_time.rb +3 -3
  61. data/lib/dato/utils/meta_tags/article_publisher.rb +2 -2
  62. data/lib/dato/utils/meta_tags/base.rb +5 -6
  63. data/lib/dato/utils/meta_tags/description.rb +4 -4
  64. data/lib/dato/utils/meta_tags/image.rb +4 -5
  65. data/lib/dato/utils/meta_tags/og_locale.rb +2 -2
  66. data/lib/dato/utils/meta_tags/og_site_name.rb +2 -2
  67. data/lib/dato/utils/meta_tags/og_type.rb +3 -3
  68. data/lib/dato/utils/meta_tags/robots.rb +2 -2
  69. data/lib/dato/utils/meta_tags/title.rb +6 -6
  70. data/lib/dato/utils/meta_tags/twitter_card.rb +2 -2
  71. data/lib/dato/utils/meta_tags/twitter_site.rb +2 -2
  72. data/lib/dato/utils/seo_tags_builder.rb +12 -12
  73. data/lib/dato/version.rb +1 -1
  74. data/lib/dato.rb +11 -9
  75. metadata +10 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43d5a65257051385168de064d1b162bbd0bc5d0ef8523a2079d2f9051dc6b509
4
- data.tar.gz: 23a9293ed05685fd635de711d3b98084dcb9efc92735d0e379b7640798e8a959
3
+ metadata.gz: 16cab29b7b72a50af8cd817bb47385ad43abd1819c27d92ec2e8a18f34dff644
4
+ data.tar.gz: ef6271b8c0acdba7b4d808719ef401a1bd425153407156f4153e8ad03a4d80e6
5
5
  SHA512:
6
- metadata.gz: cd30a74fe816ab8d4a3683d62ddfecd1ce350f94c94a4f4bbbcaaabaf88a94677f939c8d7cfaf0c9769040d03adc7da829229d5e8762610491ca7d199244e082
7
- data.tar.gz: 47ebdc307a2c8ae71cd28f0b7ce60c4e2f14802951bbed9b90bd93ff359bd41c240dc3dc4c834febafd32ebe81b4f735f05f9d01a2f7ea245ad9df4324938501
6
+ metadata.gz: 43aaccaaedd08be49f63348e00b7f17782cda7026c572b694a586c6ea145f9f50746fe9854d3b35b88d9f21d3fa20059e32780def5e88a5a63b98860687635b8
7
+ data.tar.gz: d493d97c927fe53d3cd4b4a6708f2c921c32ab40436accfe3d46ba82d9d38da85ff559fc276897428892b1f1c6c61ec89929666172284095c3a30c9b4cd7456e
data/.rubocop.yml CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  AllCops:
3
- TargetRubyVersion: 2.3
3
+ TargetRubyVersion: 2.5
4
+ NewCops: enable
4
5
 
5
6
  Exclude:
6
7
  - "dato.gemspec"
@@ -11,9 +12,27 @@ Style/SafeNavigation:
11
12
  Style/Documentation:
12
13
  Enabled: false
13
14
 
15
+ Style/GuardClause:
16
+ Enabled: false
17
+
18
+ Naming/PredicateName:
19
+ Enabled: false
20
+
21
+ Style/MissingRespondToMissing:
22
+ Enabled: false
23
+
24
+ Style/EvalWithLocation:
25
+ Enabled: false
26
+
27
+ Metrics/BlockNesting:
28
+ Enabled: false
29
+
14
30
  Metrics/MethodLength:
15
31
  Enabled: false
16
32
 
33
+ Metrics/BlockLength:
34
+ Enabled: false
35
+
17
36
  Metrics/ClassLength:
18
37
  Enabled: false
19
38
 
@@ -21,15 +40,15 @@ Metrics/ModuleLength:
21
40
  Enabled: false
22
41
 
23
42
  Metrics/CyclomaticComplexity:
24
- Max: 8
43
+ Enabled: false
25
44
 
26
45
  Metrics/AbcSize:
27
- Max: 30
46
+ Enabled: false
28
47
 
29
48
  Metrics/PerceivedComplexity:
30
- Max: 8
49
+ Enabled: false
31
50
 
32
- Metrics/LineLength:
51
+ Layout/LineLength:
33
52
  Exclude:
34
53
  - "spec/**/*"
35
54
  - "lib/dato/site/repo/*"
@@ -40,3 +59,21 @@ Metrics/LineLength:
40
59
  Metrics/ParameterLists:
41
60
  Exclude:
42
61
  - "lib/dato/local/field_type/*"
62
+
63
+ Style/TrailingCommaInArrayLiteral:
64
+ EnforcedStyleForMultiline: comma
65
+
66
+ Style/TrailingCommaInArguments:
67
+ EnforcedStyleForMultiline: comma
68
+
69
+ Style/TrailingCommaInHashLiteral:
70
+ EnforcedStyleForMultiline: comma
71
+
72
+ Style/AndOr:
73
+ EnforcedStyle: conditionals
74
+
75
+ Style/StringLiterals:
76
+ EnforcedStyle: double_quotes
77
+
78
+ Style/StringLiteralsInInterpolation:
79
+ EnforcedStyle: double_quotes
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.1
1
+ 2.7.5
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.0
4
- - 2.5.0
5
3
  - 2.6.0
4
+ - 2.7.5
6
5
  before_install:
7
6
  - gem install bundler -v 1.13.5
8
7
  - echo 'puts "ruby \"#{RUBY_VERSION}\""' | ruby >> Gemfile
9
8
  - cat Gemfile
9
+ script: rubocop && rake
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in dato.gemspec
6
6
  gemspec
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec) do |t|
7
7
  t.rspec_opts = "-b"
data/TODO.md ADDED
@@ -0,0 +1,28 @@
1
+ ```ruby
2
+ StructuredTextRenderer.new(
3
+ foo.content,
4
+ adapter: Adapter.new(
5
+ render_text: lambda do |text|
6
+ text.gsub(/this/, "that")
7
+ end,
8
+ render_fragment: lambda do |children|
9
+ children.join("")
10
+ end,
11
+ render_node: lambda do |tagname, attrs, children|
12
+ # we could ActionView::Helpers::TagHelper
13
+ content_tag(tagname, children, attrs)
14
+ end,
15
+ )
16
+ custom_rules: {
17
+ heading: lambda do |node, children, adapter|
18
+ adapter.render_node("h#{node[:level] + 1}", {}, children)
19
+ end
20
+ },
21
+ render_link_to_record: lambda do |record, children, adapter|
22
+ end,
23
+ render_inline_record: lambda do |record, adapter|
24
+ end,
25
+ render_block: lambda do |record, adapter|
26
+ end
27
+ )
28
+ ```
data/bin/console CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'bundler/setup'
5
- require 'dato'
4
+ require "bundler/setup"
5
+ require "dato"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -11,5 +11,5 @@ require 'dato'
11
11
  # require "pry"
12
12
  # Pry.start
13
13
 
14
- require 'irb'
14
+ require "irb"
15
15
  IRB.start
data/bin/rspec CHANGED
@@ -8,11 +8,11 @@
8
8
  # this file is here to facilitate running it.
9
9
  #
10
10
 
11
- require 'pathname'
12
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
13
  Pathname.new(__FILE__).realpath)
14
14
 
15
- bundle_binstub = File.expand_path('bundle', __dir__)
15
+ bundle_binstub = File.expand_path("bundle", __dir__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
18
  if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
23
23
  end
24
24
  end
25
25
 
26
- require 'rubygems'
27
- require 'bundler/setup'
26
+ require "rubygems"
27
+ require "bundler/setup"
28
28
 
29
- load Gem.bin_path('rspec-core', 'rspec')
29
+ load Gem.bin_path("rspec-core", "rspec")
data/dato.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency 'rake'
25
25
  spec.add_development_dependency 'rspec'
26
26
  spec.add_development_dependency 'rubyzip'
27
- spec.add_development_dependency 'simplecov'
27
+ spec.add_development_dependency 'simplecov', '~> 0.17.0'
28
28
  spec.add_development_dependency 'vcr'
29
29
  spec.add_development_dependency 'webmock'
30
30
  spec.add_development_dependency 'rubocop'
data/exe/dato CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
5
5
 
6
- require 'dotenv'
6
+ require "dotenv"
7
7
  Dotenv.load
8
8
 
9
- require 'dato'
9
+ require "dato"
10
10
  Dato::Cli.start(ARGV)
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/api_client'
3
+ require "dato/api_client"
4
4
 
5
5
  module Dato
6
6
  module Account
7
7
  class Client
8
8
  include ApiClient
9
9
 
10
- json_schema 'account-api'
10
+ json_schema "account-api"
11
11
  end
12
12
  end
13
13
  end
@@ -1,18 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'faraday'
4
- require 'faraday_middleware'
5
- require 'json'
6
- require 'json_schema'
7
- require 'active_support/core_ext/hash/indifferent_access'
8
- require 'active_support/inflector'
3
+ require "faraday"
4
+ require "faraday_middleware"
5
+ require "json"
6
+ require "json_schema"
9
7
 
10
- require 'dato/version'
11
- require 'dato/repo'
8
+ require "dato/version"
9
+ require "dato/repo"
12
10
 
13
- require 'dato/api_error'
11
+ require "dato/api_error"
14
12
 
15
- require 'cacert'
13
+ require "cacert"
16
14
 
17
15
  module Dato
18
16
  module ApiClient
@@ -41,11 +39,9 @@ module Dato
41
39
 
42
40
  def respond_to_missing?(method, include_private = false)
43
41
  json_schema.definitions.each do |type, obj|
44
- is_collection = obj.links.select { |x| x.rel == 'instances' }.any?
42
+ is_collection = obj.links.select { |x| x.rel == "instances" }.any?
45
43
  namespace = is_collection ? type.pluralize : type
46
- if method.to_s === namespace
47
- return true
48
- end
44
+ return true if method.to_s == namespace
49
45
  end
50
46
 
51
47
  super
@@ -53,18 +49,18 @@ module Dato
53
49
 
54
50
  def method_missing(method, *args, &block)
55
51
  json_schema.definitions.each do |type, obj|
56
- is_collection = obj.links.select { |x| x.rel == 'instances' }.any?
52
+ is_collection = obj.links.select { |x| x.rel == "instances" }.any?
57
53
  namespace = is_collection ? type.pluralize : type
58
54
 
59
- if method.to_s === namespace
60
- instance_variable_set(
61
- "@#{namespace}",
62
- instance_variable_get("@#{namespace}") ||
63
- Dato::Repo.new(self, type, obj)
64
- )
55
+ next unless method.to_s == namespace
65
56
 
66
- return instance_variable_get("@#{namespace}")
67
- end
57
+ instance_variable_set(
58
+ "@#{namespace}",
59
+ instance_variable_get("@#{namespace}") ||
60
+ Dato::Repo.new(self, type, obj),
61
+ )
62
+
63
+ return instance_variable_get("@#{namespace}")
68
64
  end
69
65
 
70
66
  super
@@ -74,7 +70,7 @@ module Dato
74
70
  @json_schema ||= begin
75
71
  response = Faraday.get(
76
72
  # "http://#{subdomain}.lvh.me:3001/docs/#{subdomain}-hyperschema.json"
77
- "#{base_url}/docs/#{self.class.subdomain}-hyperschema.json"
73
+ "#{base_url}/docs/#{self.class.subdomain}-hyperschema.json",
78
74
  )
79
75
 
80
76
  schema = JsonSchema.parse!(JSON.parse(response.body))
@@ -109,7 +105,7 @@ module Dato
109
105
 
110
106
  response.body.with_indifferent_access if response.body.is_a?(Hash)
111
107
  rescue Faraday::SSLError => e
112
- raise e if ENV['SSL_CERT_FILE'] == Cacert.pem
108
+ raise e if ENV["SSL_CERT_FILE"] == Cacert.pem
113
109
 
114
110
  Cacert.set_in_env
115
111
  request(*args)
@@ -118,12 +114,12 @@ module Dato
118
114
  raise e
119
115
  rescue Faraday::ClientError => e
120
116
  if e.response[:status] == 429
121
- to_wait = e.response[:headers]['x-ratelimit-reset'].to_i
117
+ to_wait = e.response[:headers]["x-ratelimit-reset"].to_i
122
118
  puts "Rate limit exceeded, waiting #{to_wait} seconds..."
123
119
  sleep(to_wait + 1)
124
120
  request(*args)
125
121
  elsif e.response[:status] == 422 && batch_data_validation?(e.response)
126
- puts 'Validating items, waiting 1 second and retrying...'
122
+ puts "Validating items, waiting 1 second and retrying..."
127
123
  sleep(1)
128
124
  request(*args)
129
125
  else
@@ -140,16 +136,16 @@ module Dato
140
136
 
141
137
  def batch_data_validation?(response)
142
138
  body = begin
143
- JSON.parse(response[:body])
144
- rescue JSON::ParserError => e
145
- nil
146
- end
139
+ JSON.parse(response[:body])
140
+ rescue JSON::ParserError
141
+ nil
142
+ end
147
143
 
148
144
  return false unless body
149
- return false unless body['data']
145
+ return false unless body["data"]
150
146
 
151
- body['data'].any? do |e|
152
- e['attributes']['code'] == 'BATCH_DATA_VALIDATION_IN_PROGRESS'
147
+ body["data"].any? do |e|
148
+ e["attributes"]["code"] == "BATCH_DATA_VALIDATION_IN_PROGRESS"
153
149
  end
154
150
  rescue StandardError
155
151
  false
@@ -157,20 +153,18 @@ module Dato
157
153
 
158
154
  def connection
159
155
  default_headers = {
160
- 'Accept' => 'application/json',
161
- 'Content-Type' => 'application/json',
162
- 'Authorization' => "Bearer #{@token}",
163
- 'User-Agent' => "ruby-client v#{Dato::VERSION}",
164
- 'X-Api-Version' => '3'
156
+ "Accept" => "application/json",
157
+ "Content-Type" => "application/json",
158
+ "Authorization" => "Bearer #{@token}",
159
+ "User-Agent" => "ruby-client v#{Dato::VERSION}",
160
+ "X-Api-Version" => "3",
165
161
  }
166
162
 
167
- if environment
168
- default_headers.merge!('X-Environment' => environment)
169
- end
163
+ default_headers.merge!("X-Environment" => environment) if environment
170
164
 
171
165
  options = {
172
166
  url: base_url,
173
- headers: default_headers.merge(extra_headers)
167
+ headers: default_headers.merge(extra_headers),
174
168
  }
175
169
 
176
170
  @connection ||= Faraday.new(options) do |c|
@@ -2,25 +2,22 @@
2
2
 
3
3
  module Dato
4
4
  class ApiError < StandardError
5
- attr_reader :response
5
+ attr_reader :response, :body
6
6
 
7
7
  def initialize(response)
8
- @response = response
9
- end
8
+ body = JSON.parse(response[:body]) if response[:body]
10
9
 
11
- def message
12
- [
13
- 'DatoCMS API Error',
10
+ message = [
11
+ "DatoCMS API Error",
14
12
  "Status: #{response[:status]}",
15
- 'Response:',
16
- JSON.pretty_generate(body)
13
+ "Response:",
14
+ JSON.pretty_generate(body),
17
15
  ].join("\n")
18
- end
19
16
 
20
- def body
21
- if response[:body]
22
- JSON.parse(response[:body])
23
- end
17
+ super(message)
18
+
19
+ @response = response
20
+ @body = body
24
21
  end
25
22
  end
26
23
  end
data/lib/dato/cli.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'thor'
4
- require 'dato/dump/runner'
5
- require 'dato/dump/ssg_detector'
6
- require 'listen'
3
+ require "thor"
4
+ require "dato/dump/runner"
5
+ require "dato/dump/ssg_detector"
6
+ require "listen"
7
7
  module Dato
8
8
  class Cli < Thor
9
- package_name 'DatoCMS'
9
+ package_name "DatoCMS"
10
10
 
11
- desc 'dump', 'dumps DatoCMS content into local files'
12
- option :config, default: 'dato.config.rb'
13
- option :token, default: ENV['DATO_API_TOKEN'], required: true
11
+ desc "dump", "dumps DatoCMS content into local files"
12
+ option :config, default: "dato.config.rb"
13
+ option :token, default: ENV["DATO_API_TOKEN"], required: true
14
14
  option :environment, type: :string, required: false
15
15
  option :preview, default: false, type: :boolean
16
16
  option :watch, default: false, type: :boolean
@@ -24,12 +24,12 @@ module Dato
24
24
  options[:token],
25
25
  environment: options[:environment],
26
26
  extra_headers: {
27
- 'X-Reason' => 'dump',
28
- 'X-SSG' => Dump::SsgDetector.new(Dir.pwd).detect
29
- }
27
+ "X-Reason" => "dump",
28
+ "X-SSG" => Dump::SsgDetector.new(Dir.pwd).detect,
29
+ },
30
30
  )
31
31
  loader = Dato::Local::Loader.new(client, preview_mode)
32
- print 'Fetching content from DatoCMS... '
32
+ print "Fetching content from DatoCMS... "
33
33
  loader.load
34
34
 
35
35
  if watch_mode
@@ -51,23 +51,23 @@ module Dato
51
51
  end
52
52
  end
53
53
 
54
- desc 'check', 'checks the presence of a DatoCMS token'
54
+ desc "check", "checks the presence of a DatoCMS token"
55
55
  def check
56
- exit 0 if ENV['DATO_API_TOKEN']
56
+ exit 0 if ENV["DATO_API_TOKEN"]
57
57
 
58
- say 'Site token is not specified!'
58
+ say "Site token is not specified!"
59
59
  token = ask "Please paste your DatoCMS site read-only API token:\n>"
60
60
 
61
61
  if !token || token.empty?
62
- puts 'Missing token'
62
+ puts "Missing token"
63
63
  exit 1
64
64
  end
65
65
 
66
- File.open('.env', 'a') do |file|
66
+ File.open(".env", "a") do |file|
67
67
  file.puts "DATO_API_TOKEN=#{token}"
68
68
  end
69
69
 
70
- say 'Token added to .env file.'
70
+ say "Token added to .env file."
71
71
 
72
72
  exit 0
73
73
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/dump/operation/add_to_data_file'
3
+ require "dato/dump/operation/add_to_data_file"
4
4
 
5
5
  module Dato
6
6
  module Dump
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/dump/operation/create_data_file'
3
+ require "dato/dump/operation/create_data_file"
4
4
 
5
5
  module Dato
6
6
  module Dump
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/dump/operation/create_post'
3
+ require "dato/dump/operation/create_post"
4
4
 
5
5
  module Dato
6
6
  module Dump
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/dump/dsl/create_post'
4
- require 'dato/dump/dsl/create_data_file'
5
- require 'dato/dump/dsl/add_to_data_file'
3
+ require "dato/dump/dsl/create_post"
4
+ require "dato/dump/dsl/create_data_file"
5
+ require "dato/dump/dsl/add_to_data_file"
6
6
 
7
7
  module Dato
8
8
  module Dump
@@ -17,7 +17,7 @@ module Dato
17
17
  def initialize(dato, operations, &block)
18
18
  @dato = dato
19
19
  @operations = operations
20
- @self_before_instance_eval = eval 'self', block.binding
20
+ @self_before_instance_eval = eval "self", block.binding
21
21
 
22
22
  instance_eval(&block)
23
23
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/dump/dsl/directory'
4
- require 'dato/dump/dsl/create_post'
5
- require 'dato/dump/dsl/create_data_file'
6
- require 'dato/dump/dsl/add_to_data_file'
3
+ require "dato/dump/dsl/directory"
4
+ require "dato/dump/dsl/create_post"
5
+ require "dato/dump/dsl/create_data_file"
6
+ require "dato/dump/dsl/add_to_data_file"
7
7
 
8
- require 'dato/dump/operation/directory'
8
+ require "dato/dump/operation/directory"
9
9
 
10
10
  module Dato
11
11
  module Dump
@@ -21,9 +21,9 @@ module Dato
21
21
  @dato = dato
22
22
  @operations = operations
23
23
 
24
- # rubocop:disable Lint/Eval
24
+ # rubocop:disable Security/Eval
25
25
  eval(config_code)
26
- # rubocop:enable Lint/Eval
26
+ # rubocop:enable Security/Eval
27
27
  end
28
28
 
29
29
  def directory(path, &block)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'json'
3
+ require "json"
4
4
 
5
5
  module Dato
6
6
  module Dump
@@ -1,17 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/hash/keys'
4
- require 'toml'
3
+ require "toml"
5
4
 
6
5
  class Time
7
- def to_toml(_path = '')
8
- utc.strftime('%Y-%m-%dT%H:%M:%SZ')
6
+ def to_toml(_path = "")
7
+ utc.strftime("%Y-%m-%dT%H:%M:%SZ")
9
8
  end
10
9
  end
11
10
 
12
11
  class Date
13
- def to_toml(_path = '')
14
- strftime('%Y-%m-%d')
12
+ def to_toml(_path = "")
13
+ strftime("%Y-%m-%d")
15
14
  end
16
15
  end
17
16
 
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/hash/keys'
4
- require 'yaml'
3
+ require "yaml"
5
4
 
6
5
  class Array
7
6
  def deep_stringify_keys
@@ -22,7 +21,7 @@ module Dato
22
21
  module Format
23
22
  module Yaml
24
23
  def self.dump(value)
25
- YAML.dump(value.deep_stringify_keys).chomp.gsub(/^\-+\n/, '')
24
+ YAML.dump(value.deep_stringify_keys).chomp.gsub(/^-+\n/, "")
26
25
  end
27
26
 
28
27
  def self.frontmatter_dump(value)
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'dato/dump/format/toml'
4
- require 'dato/dump/format/yaml'
5
- require 'dato/dump/format/json'
3
+ require "dato/dump/format/toml"
4
+ require "dato/dump/format/yaml"
5
+ require "dato/dump/format/json"
6
6
 
7
7
  module Dato
8
8
  module Dump