scribo 1.0.39 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock ADDED
@@ -0,0 +1,397 @@
1
+ GIT
2
+ remote: git@github.com:entdec/keypath-ruby.git
3
+ revision: c2ce9a5038c48504a113e26defecaf80f6c82bf2
4
+ branch: master
5
+ specs:
6
+ key_path (1.2.0)
7
+ activesupport (>= 4.0)
8
+
9
+ PATH
10
+ remote: .
11
+ specs:
12
+ scribo (1.0.38)
13
+ ancestry
14
+ babel-transpiler (~> 0.7)
15
+ down (~> 5.2)
16
+ importmap-rails
17
+ kaminari
18
+ key_path
19
+ liquidum (~> 1)
20
+ mime-types
21
+ mimemagic
22
+ pg
23
+ rails (> 7)
24
+ rouge (~> 3)
25
+ rubyzip (> 1.1)
26
+ slim-rails (~> 3)
27
+ stimulus-rails
28
+ tailwindcss-rails
29
+ turbo-rails
30
+
31
+ GEM
32
+ remote: https://rubygems.org/
33
+ specs:
34
+ actioncable (7.1.3.2)
35
+ actionpack (= 7.1.3.2)
36
+ activesupport (= 7.1.3.2)
37
+ nio4r (~> 2.0)
38
+ websocket-driver (>= 0.6.1)
39
+ zeitwerk (~> 2.6)
40
+ actionmailbox (7.1.3.2)
41
+ actionpack (= 7.1.3.2)
42
+ activejob (= 7.1.3.2)
43
+ activerecord (= 7.1.3.2)
44
+ activestorage (= 7.1.3.2)
45
+ activesupport (= 7.1.3.2)
46
+ mail (>= 2.7.1)
47
+ net-imap
48
+ net-pop
49
+ net-smtp
50
+ actionmailer (7.1.3.2)
51
+ actionpack (= 7.1.3.2)
52
+ actionview (= 7.1.3.2)
53
+ activejob (= 7.1.3.2)
54
+ activesupport (= 7.1.3.2)
55
+ mail (~> 2.5, >= 2.5.4)
56
+ net-imap
57
+ net-pop
58
+ net-smtp
59
+ rails-dom-testing (~> 2.2)
60
+ actionpack (7.1.3.2)
61
+ actionview (= 7.1.3.2)
62
+ activesupport (= 7.1.3.2)
63
+ nokogiri (>= 1.8.5)
64
+ racc
65
+ rack (>= 2.2.4)
66
+ rack-session (>= 1.0.1)
67
+ rack-test (>= 0.6.3)
68
+ rails-dom-testing (~> 2.2)
69
+ rails-html-sanitizer (~> 1.6)
70
+ actiontext (7.1.3.2)
71
+ actionpack (= 7.1.3.2)
72
+ activerecord (= 7.1.3.2)
73
+ activestorage (= 7.1.3.2)
74
+ activesupport (= 7.1.3.2)
75
+ globalid (>= 0.6.0)
76
+ nokogiri (>= 1.8.5)
77
+ actionview (7.1.3.2)
78
+ activesupport (= 7.1.3.2)
79
+ builder (~> 3.1)
80
+ erubi (~> 1.11)
81
+ rails-dom-testing (~> 2.2)
82
+ rails-html-sanitizer (~> 1.6)
83
+ activejob (7.1.3.2)
84
+ activesupport (= 7.1.3.2)
85
+ globalid (>= 0.3.6)
86
+ activemodel (7.1.3.2)
87
+ activesupport (= 7.1.3.2)
88
+ activerecord (7.1.3.2)
89
+ activemodel (= 7.1.3.2)
90
+ activesupport (= 7.1.3.2)
91
+ timeout (>= 0.4.0)
92
+ activestorage (7.1.3.2)
93
+ actionpack (= 7.1.3.2)
94
+ activejob (= 7.1.3.2)
95
+ activerecord (= 7.1.3.2)
96
+ activesupport (= 7.1.3.2)
97
+ marcel (~> 1.0)
98
+ activesupport (7.1.3.2)
99
+ base64
100
+ bigdecimal
101
+ concurrent-ruby (~> 1.0, >= 1.0.2)
102
+ connection_pool (>= 2.2.5)
103
+ drb
104
+ i18n (>= 1.6, < 2)
105
+ minitest (>= 5.1)
106
+ mutex_m
107
+ tzinfo (~> 2.0)
108
+ addressable (2.8.6)
109
+ public_suffix (>= 2.0.2, < 6.0)
110
+ ancestry (4.3.3)
111
+ activerecord (>= 5.2.6)
112
+ ansi (1.5.0)
113
+ ast (2.4.2)
114
+ auxilium (3.0.24)
115
+ actionpack (> 5.1)
116
+ activemodel (> 5.1)
117
+ activesupport (> 5.1)
118
+ pundit (> 2)
119
+ responders (> 3)
120
+ rolify (> 5)
121
+ babel-source (5.8.35)
122
+ babel-transpiler (0.7.0)
123
+ babel-source (>= 4.0, < 6)
124
+ execjs (~> 2.0)
125
+ base64 (0.2.0)
126
+ bigdecimal (3.1.6)
127
+ builder (3.2.4)
128
+ byebug (11.1.3)
129
+ capybara (3.40.0)
130
+ addressable
131
+ matrix
132
+ mini_mime (>= 0.1.3)
133
+ nokogiri (~> 1.11)
134
+ rack (>= 1.6.0)
135
+ rack-test (>= 0.6.3)
136
+ regexp_parser (>= 1.5, < 3.0)
137
+ xpath (~> 3.2)
138
+ coderay (1.1.3)
139
+ concurrent-ruby (1.2.3)
140
+ connection_pool (2.4.1)
141
+ crass (1.0.6)
142
+ cuprite (0.15)
143
+ capybara (~> 3.0)
144
+ ferrum (~> 0.14.0)
145
+ date (3.3.4)
146
+ down (5.4.1)
147
+ addressable (~> 2.8)
148
+ drb (2.2.1)
149
+ erubi (1.12.0)
150
+ execjs (2.9.1)
151
+ ferrum (0.14)
152
+ addressable (~> 2.5)
153
+ concurrent-ruby (~> 1.1)
154
+ webrick (~> 1.7)
155
+ websocket-driver (>= 0.6, < 0.8)
156
+ ffi (1.16.3)
157
+ globalid (1.2.1)
158
+ activesupport (>= 6.1)
159
+ i18n (1.14.1)
160
+ concurrent-ruby (~> 1.0)
161
+ importmap-rails (2.0.1)
162
+ actionpack (>= 6.0.0)
163
+ activesupport (>= 6.0.0)
164
+ railties (>= 6.0.0)
165
+ io-console (0.7.2)
166
+ irb (1.11.2)
167
+ rdoc
168
+ reline (>= 0.4.2)
169
+ jbuilder (2.11.5)
170
+ actionview (>= 5.0.0)
171
+ activesupport (>= 5.0.0)
172
+ json (2.7.1)
173
+ kaminari (1.2.2)
174
+ activesupport (>= 4.1.0)
175
+ kaminari-actionview (= 1.2.2)
176
+ kaminari-activerecord (= 1.2.2)
177
+ kaminari-core (= 1.2.2)
178
+ kaminari-actionview (1.2.2)
179
+ actionview
180
+ kaminari-core (= 1.2.2)
181
+ kaminari-activerecord (1.2.2)
182
+ activerecord
183
+ kaminari-core (= 1.2.2)
184
+ kaminari-core (1.2.2)
185
+ kramdown (2.4.0)
186
+ rexml
187
+ kramdown-parser-gfm (1.1.0)
188
+ kramdown (~> 2.0)
189
+ language_server-protocol (3.17.0.3)
190
+ liquid (5.1.0)
191
+ liquidum (1.0.17)
192
+ addressable (~> 2)
193
+ babel-transpiler (~> 0.7)
194
+ i18n (~> 1.8)
195
+ kramdown (~> 2.1)
196
+ kramdown-parser-gfm (~> 1.0)
197
+ liquid (= 5.1.0)
198
+ parslet
199
+ pg
200
+ rails (>= 5.2)
201
+ sassc (~> 2.2)
202
+ slim-rails (~> 3.2.0)
203
+ loofah (2.22.0)
204
+ crass (~> 1.0.2)
205
+ nokogiri (>= 1.12.0)
206
+ mail (2.8.1)
207
+ mini_mime (>= 0.1.1)
208
+ net-imap
209
+ net-pop
210
+ net-smtp
211
+ marcel (1.0.4)
212
+ matrix (0.4.2)
213
+ method_source (1.0.0)
214
+ mime-types (3.5.2)
215
+ mime-types-data (~> 3.2015)
216
+ mime-types-data (3.2024.0206)
217
+ mimemagic (0.4.3)
218
+ nokogiri (~> 1)
219
+ rake
220
+ mini_mime (1.1.5)
221
+ mini_portile2 (2.8.5)
222
+ minitest (5.22.2)
223
+ minitest-reporters (1.6.1)
224
+ ansi
225
+ builder
226
+ minitest (>= 5.0)
227
+ ruby-progressbar
228
+ mutex_m (0.2.0)
229
+ net-imap (0.4.10)
230
+ date
231
+ net-protocol
232
+ net-pop (0.1.2)
233
+ net-protocol
234
+ net-protocol (0.2.2)
235
+ timeout
236
+ net-smtp (0.4.0.1)
237
+ net-protocol
238
+ nio4r (2.7.0)
239
+ nokogiri (1.16.2)
240
+ mini_portile2 (~> 2.8.2)
241
+ racc (~> 1.4)
242
+ parallel (1.24.0)
243
+ parser (3.3.0.5)
244
+ ast (~> 2.4.1)
245
+ racc
246
+ parslet (2.0.0)
247
+ pg (1.5.6)
248
+ pry (0.14.2)
249
+ coderay (~> 1.1)
250
+ method_source (~> 1.0)
251
+ pry-byebug (3.10.1)
252
+ byebug (~> 11.0)
253
+ pry (>= 0.13, < 0.15)
254
+ pry-rails (0.3.9)
255
+ pry (>= 0.10.4)
256
+ psych (5.1.2)
257
+ stringio
258
+ public_suffix (5.0.4)
259
+ puma (6.4.2)
260
+ nio4r (~> 2.0)
261
+ pundit (2.3.1)
262
+ activesupport (>= 3.0.0)
263
+ racc (1.7.3)
264
+ rack (3.0.9.1)
265
+ rack-session (2.0.0)
266
+ rack (>= 3.0.0)
267
+ rack-test (2.1.0)
268
+ rack (>= 1.3)
269
+ rackup (2.1.0)
270
+ rack (>= 3)
271
+ webrick (~> 1.8)
272
+ rails (7.1.3.2)
273
+ actioncable (= 7.1.3.2)
274
+ actionmailbox (= 7.1.3.2)
275
+ actionmailer (= 7.1.3.2)
276
+ actionpack (= 7.1.3.2)
277
+ actiontext (= 7.1.3.2)
278
+ actionview (= 7.1.3.2)
279
+ activejob (= 7.1.3.2)
280
+ activemodel (= 7.1.3.2)
281
+ activerecord (= 7.1.3.2)
282
+ activestorage (= 7.1.3.2)
283
+ activesupport (= 7.1.3.2)
284
+ bundler (>= 1.15.0)
285
+ railties (= 7.1.3.2)
286
+ rails-dom-testing (2.2.0)
287
+ activesupport (>= 5.0.0)
288
+ minitest
289
+ nokogiri (>= 1.6)
290
+ rails-html-sanitizer (1.6.0)
291
+ loofah (~> 2.21)
292
+ nokogiri (~> 1.14)
293
+ railties (7.1.3.2)
294
+ actionpack (= 7.1.3.2)
295
+ activesupport (= 7.1.3.2)
296
+ irb
297
+ rackup (>= 1.0.0)
298
+ rake (>= 12.2)
299
+ thor (~> 1.0, >= 1.2.2)
300
+ zeitwerk (~> 2.6)
301
+ rainbow (3.1.1)
302
+ rake (13.1.0)
303
+ rdoc (6.6.2)
304
+ psych (>= 4.0.0)
305
+ regexp_parser (2.9.0)
306
+ reline (0.4.3)
307
+ io-console (~> 0.5)
308
+ responders (3.1.1)
309
+ actionpack (>= 5.2)
310
+ railties (>= 5.2)
311
+ rexml (3.2.6)
312
+ rolify (6.0.1)
313
+ rouge (3.30.0)
314
+ rubocop (1.61.0)
315
+ json (~> 2.3)
316
+ language_server-protocol (>= 3.17.0)
317
+ parallel (~> 1.10)
318
+ parser (>= 3.3.0.2)
319
+ rainbow (>= 2.2.2, < 4.0)
320
+ regexp_parser (>= 1.8, < 3.0)
321
+ rexml (>= 3.2.5, < 4.0)
322
+ rubocop-ast (>= 1.30.0, < 2.0)
323
+ ruby-progressbar (~> 1.7)
324
+ unicode-display_width (>= 2.4.0, < 3.0)
325
+ rubocop-ast (1.31.1)
326
+ parser (>= 3.3.0.4)
327
+ ruby-progressbar (1.13.0)
328
+ rubyzip (2.3.2)
329
+ sassc (2.4.0)
330
+ ffi (~> 1.9)
331
+ selenium-webdriver (4.18.1)
332
+ base64 (~> 0.2)
333
+ rexml (~> 3.2, >= 3.2.5)
334
+ rubyzip (>= 1.2.2, < 3.0)
335
+ websocket (~> 1.0)
336
+ signum (0.3.12)
337
+ pg
338
+ rails (> 6.0)
339
+ state_machines-activemodel
340
+ slim (4.1.0)
341
+ temple (>= 0.7.6, < 0.9)
342
+ tilt (>= 2.0.6, < 2.1)
343
+ slim-rails (3.2.0)
344
+ actionpack (>= 3.1)
345
+ railties (>= 3.1)
346
+ slim (>= 3.0, < 5.0)
347
+ state_machines (0.6.0)
348
+ state_machines-activemodel (0.9.0)
349
+ activemodel (>= 6.0)
350
+ state_machines (>= 0.6.0)
351
+ stimulus-rails (1.3.3)
352
+ railties (>= 6.0.0)
353
+ stringio (3.1.0)
354
+ tailwindcss-rails (2.3.0)
355
+ railties (>= 6.0.0)
356
+ temple (0.8.2)
357
+ thor (1.3.1)
358
+ tilt (2.0.11)
359
+ timeout (0.4.1)
360
+ turbo-rails (2.0.4)
361
+ actionpack (>= 6.0.0)
362
+ activejob (>= 6.0.0)
363
+ railties (>= 6.0.0)
364
+ tzinfo (2.0.6)
365
+ concurrent-ruby (~> 1.0)
366
+ unicode-display_width (2.5.0)
367
+ webrick (1.8.1)
368
+ websocket (1.2.10)
369
+ websocket-driver (0.7.6)
370
+ websocket-extensions (>= 0.1.0)
371
+ websocket-extensions (0.1.5)
372
+ xpath (3.2.0)
373
+ nokogiri (~> 1.8)
374
+ zeitwerk (2.6.13)
375
+
376
+ PLATFORMS
377
+ ruby
378
+
379
+ DEPENDENCIES
380
+ auxilium (~> 3.0)
381
+ capybara
382
+ cuprite
383
+ jbuilder
384
+ key_path!
385
+ minitest (~> 5.11)
386
+ minitest-reporters (~> 1.1)
387
+ pry
388
+ pry-byebug (~> 3)
389
+ pry-rails
390
+ puma
391
+ rubocop
392
+ scribo!
393
+ selenium-webdriver
394
+ signum
395
+
396
+ BUNDLED WITH
397
+ 2.1.4
data/TODO.md ADDED
@@ -0,0 +1,32 @@
1
+ # TODO
2
+
3
+ ## General
4
+
5
+ - Feature: Controller, view and path overrides
6
+ Allow users to override controllers and views (like devise), describe how this should be done.
7
+ This to enable admin pages with authentication, or regular content with authentication.
8
+ Or specific admin page requirements.
9
+
10
+ ## Site/Content
11
+
12
+ - Front-matter defaults - https://jekyllrb.com/docs/configuration/front-matter-defaults/
13
+ - Versioned content
14
+
15
+ ## Liquid
16
+
17
+ - Local tags
18
+ Local tags (https://github.com/Shopify/liquid/pull/590) - a way to make tags only available for certain templates
19
+ ie include should not be available for messages.
20
+ - Mail tag
21
+
22
+ ## Jekyll compatibility
23
+
24
+ - Check filters from Jekyll: https://github.com/jekyll/jekyll/blob/c9b84e2b354067e61cf9878f27665c5c1c02481c/lib/jekyll/filters.rb
25
+
26
+ ## IDE
27
+
28
+ - Allow for multiple tabs and open editors
29
+ - Search for content
30
+ - Use localstorage for changes to prevent loss
31
+ - Allow export, preview from IDE
32
+ - Allow to go back to sites index
File without changes
@@ -5,7 +5,7 @@ require_dependency 'scribo/application_record'
5
5
  module Scribo
6
6
  # Represents any content in the system
7
7
  class Content < ApplicationRecord
8
- has_ancestry(primary_key_format: /\A[\w\-]+(\/[\w\-]+)*\z/, counter_cache: true, cache_depth: true)
8
+ has_closure_tree
9
9
  belongs_to :site, class_name: 'Site', foreign_key: 'scribo_site_id'
10
10
  has_one_attached :asset
11
11
 
@@ -293,7 +293,7 @@ module Scribo
293
293
  end
294
294
 
295
295
  def store_full_path(force = false)
296
- if force || saved_changes.include?(:path) || saved_changes.include?(:ancestry)
296
+ if force || saved_changes.include?(:path) || saved_changes.include?(:parent_id)
297
297
  if post?
298
298
  result = categories.join('/') + '/'
299
299
  result += date.strftime('%Y/%m/%d/') if date
@@ -310,10 +310,10 @@ module Scribo
310
310
  children.reload.each do |child|
311
311
  child.store_full_path(true)
312
312
  end
313
-
314
313
  end
315
314
  end
316
315
 
316
+
317
317
  def tree_path
318
318
  result = (ancestors.map(&:path) << path).join('/')
319
319
  result = '/' + result unless result.start_with?('/')
@@ -31,7 +31,7 @@ module Scribo
31
31
  site.contents.located(File.dirname(name), restricted: false).first
32
32
  end
33
33
  content = parent.children.find_by(path: File.basename(name)) if parent
34
- content = site.contents.find_by(path: File.basename(name), ancestry: nil) if parent.nil? && content.nil?
34
+ content = site.contents.find_by(path: File.basename(name), parent_id: nil) if parent.nil? && content.nil?
35
35
  content = site.contents.create!(path: File.basename(name), parent: parent) if content.nil?
36
36
  if File.directory?(name)
37
37
  content.kind = 'folder'
data/bin/importmap ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative "../test/dummy/config/application"
4
+ require "importmap/commands"
data/bin/rails ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
6
+ ENGINE_PATH = File.expand_path('../../lib/scribo/engine', __FILE__)
7
+ APP_PATH = File.expand_path('../../test/dummy/config/application', __FILE__)
8
+
9
+ # Set up gems listed in the Gemfile.
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
11
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
12
+
13
+ require 'rails/all'
14
+ require 'rails/engine/commands'
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rubocop", "rubocop")
data/cli/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ lib/
2
+ scribo
data/cli/scribo.cr ADDED
@@ -0,0 +1,103 @@
1
+ require "compress/zip"
2
+ require "admiral"
3
+ require "yaml"
4
+ require "http/client"
5
+
6
+ class Scribo
7
+ def initialize
8
+ end
9
+
10
+ def zip_and_upload
11
+ if !config["endpoint"]? || config["api_key"]?
12
+ puts "Please configure an endpoint and api_key in your _config.yml:\n\n"
13
+ puts "cli:\n endpoint: https://example.com/\n api_key: someapikey"
14
+ exit
15
+ end
16
+
17
+ zip_file_name = "#{File.basename(Dir.current)}.zip"
18
+ tempfile = File.tempfile(zip_file_name)
19
+ File.open(tempfile.path, "w") do |file|
20
+ Compress::Zip::Writer.open(file) do |zip|
21
+
22
+ Dir.glob("**/*").each do |file_name|
23
+ next if File.directory?(file_name)
24
+ zip.add file_name, File.open(file_name)
25
+ end
26
+ end
27
+ end
28
+
29
+ io = IO::Memory.new
30
+ builder = HTTP::FormData::Builder.new(io, "aA47")
31
+ builder.file("files[]", File.open(tempfile.path), HTTP::FormData::FileMetadata.new(filename: zip_file_name))
32
+ builder.finish
33
+
34
+ response = HTTP::Client.post(import_url, headers: HTTP::Headers{"User-Agent" => "Scribo"}, body: io.to_s)
35
+
36
+ tempfile.delete
37
+ end
38
+
39
+ def init_example(name)
40
+ if Dir.exists?(name)
41
+ puts "A folder #{name} already exists, move this out of the way first."
42
+ exit
43
+ end
44
+
45
+ Dir.mkdir_p("#{name}/assets/images")
46
+ Dir.mkdir_p("#{name}/assets/fonts")
47
+ Dir.mkdir_p("#{name}/assets/style")
48
+ Dir.mkdir_p("#{name}/_layouts")
49
+ File.open("#{name}/_config.yml", "w") do |file|
50
+ file.puts "# General configuration\ntitle: #{name}\nbaseurl: /#{name}\n\n# Scribo command line utility related\n\ncli:\n endpoint: https://example.com/scribo\n api_key: someapikey"
51
+ end
52
+ File.open("#{name}/index.md", "w") do |file|
53
+ file.puts "---\nlayout: default\n---\n# Welcome to #{name}\nYou can find the contents of this page in index.md"
54
+ end
55
+ File.open("#{name}/_layouts/default.html", "w") do |file|
56
+ file.puts %(<!DOCTYPE html>\n<html>\n<head>\n <title></title>\n <meta name="viewport" content="width=device-width, initial-scale=1">\n<body>\n {{content}}\n</body>\n</html>)
57
+ end
58
+ end
59
+
60
+ # private
61
+
62
+ def config
63
+ config = YAML.parse(File.read("_config.yml"))
64
+ config = config["cli"]
65
+ end
66
+
67
+ def import_url
68
+ "#{config["endpoint"]}/api/sites/import"
69
+ end
70
+ end
71
+
72
+ class ScriboCommand < Admiral::Command
73
+ define_help description: "Scribo command line utility"
74
+
75
+ class PublishCommand < Admiral::Command
76
+ def run
77
+ Scribo.new.zip_and_upload
78
+ end
79
+ end
80
+
81
+ class InitCommand < Admiral::Command
82
+ define_help description: "Initializes a new site"
83
+ define_argument name, required: true
84
+
85
+ def run
86
+ Scribo.new.init_example(arguments.name)
87
+ end
88
+ end
89
+
90
+ register_sub_command publish : PublishCommand, description: "Uploads the current site"
91
+ register_sub_command init : InitCommand, description: "Creates a new site"
92
+
93
+ def run
94
+ puts help
95
+
96
+ if !File.exists?("_config.yml")
97
+ puts "\nNo _config.yml found, are you in the correct folder?"
98
+ exit
99
+ end
100
+ end
101
+ end
102
+
103
+ ScriboCommand.run
data/cli/shard.lock ADDED
@@ -0,0 +1,6 @@
1
+ version: 2.0
2
+ shards:
3
+ admiral:
4
+ git: https://github.com/jwaldrip/admiral.cr.git
5
+ version: 1.11.2
6
+
data/cli/shard.yml ADDED
@@ -0,0 +1,18 @@
1
+ name: cli
2
+ version: 0.1.0
3
+
4
+ authors:
5
+ - Tom de Grunt <tom@degrunt.nl>
6
+
7
+ description: |
8
+ Scribo CLI utility
9
+
10
+ dependencies:
11
+ admiral:
12
+ github: jwaldrip/admiral.cr
13
+
14
+ # development_dependencies:
15
+ # webmock:
16
+ # github: manastech/webmock.cr
17
+
18
+ license: MIT
@@ -0,0 +1,5 @@
1
+ class AddParentIdToScriboContents < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_column :scribo_contents, :parent_id, :uuid
4
+ end
5
+ end