frontman-ssg 0.0.4 → 0.1.0

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 +3 -0
  3. data/CHANGELOG.md +13 -2
  4. data/Rakefile +5 -2
  5. data/frontman-ssg.gemspec +1 -0
  6. data/lib/frontman.rb +0 -5
  7. data/lib/frontman/app.rb +1 -3
  8. data/lib/frontman/builder/file.rb +1 -3
  9. data/lib/frontman/commands/init.rb +2 -3
  10. data/lib/frontman/commands/serve.rb +29 -28
  11. data/lib/frontman/concerns/forward_calls_to_app.rb +1 -1
  12. data/lib/frontman/context.rb +68 -57
  13. data/lib/frontman/data_store.rb +1 -3
  14. data/lib/frontman/iterator.rb +1 -3
  15. data/lib/frontman/renderers/erb_renderer.rb +19 -1
  16. data/lib/frontman/renderers/haml_renderer.rb +29 -1
  17. data/lib/frontman/renderers/renderer_resolver.rb +18 -5
  18. data/lib/frontman/renderers/slim_renderer.rb +30 -0
  19. data/lib/frontman/resource.rb +9 -13
  20. data/lib/frontman/sitemap_tree.rb +1 -3
  21. data/lib/frontman/version.rb +1 -1
  22. data/project-templates/webpack/helpers/assets_helper.rb +1 -3
  23. data/sorbet/rbi/gems/ast.rbi +48 -0
  24. data/sorbet/rbi/gems/better_errors.rbi +180 -0
  25. data/sorbet/rbi/gems/binding_of_caller.rbi +23 -0
  26. data/sorbet/rbi/gems/coderay.rbi +24 -0
  27. data/sorbet/rbi/gems/debug_inspector.rbi +19 -0
  28. data/sorbet/rbi/gems/docile.rbi +32 -0
  29. data/sorbet/rbi/gems/dotenv.rbi +68 -0
  30. data/sorbet/rbi/gems/erubi.rbi +27 -0
  31. data/sorbet/rbi/gems/erubis.rbi +280 -0
  32. data/sorbet/rbi/gems/haml.rbi +521 -0
  33. data/sorbet/rbi/gems/htmlentities.rbi +46 -0
  34. data/sorbet/rbi/gems/jaro_winkler.rbi +15 -0
  35. data/sorbet/rbi/gems/kramdown-parser-gfm.rbi +29 -0
  36. data/sorbet/rbi/gems/kramdown.rbi +338 -0
  37. data/sorbet/rbi/gems/listen.rbi +301 -0
  38. data/sorbet/rbi/gems/mustermann.rbi +481 -0
  39. data/sorbet/rbi/gems/nokogiri.rbi +1011 -0
  40. data/sorbet/rbi/gems/parallel.rbi +82 -0
  41. data/sorbet/rbi/gems/parser.rbi +1405 -0
  42. data/sorbet/rbi/gems/rack-protection.rbi +16 -0
  43. data/sorbet/rbi/gems/rack.rbi +507 -0
  44. data/sorbet/rbi/gems/rainbow.rbi +118 -0
  45. data/sorbet/rbi/gems/rake.rbi +641 -0
  46. data/sorbet/rbi/gems/rexml.rbi +93 -0
  47. data/sorbet/rbi/gems/rouge.rbi +1551 -0
  48. data/sorbet/rbi/gems/rspec-core.rbi +1893 -0
  49. data/sorbet/rbi/gems/rspec-expectations.rbi +1125 -0
  50. data/sorbet/rbi/gems/rspec-mocks.rbi +1099 -0
  51. data/sorbet/rbi/gems/rspec-support.rbi +280 -0
  52. data/sorbet/rbi/gems/rspec.rbi +15 -0
  53. data/sorbet/rbi/gems/rubocop-performance.rbi +274 -0
  54. data/sorbet/rbi/gems/rubocop.rbi +7403 -0
  55. data/sorbet/rbi/gems/ruby-progressbar.rbi +305 -0
  56. data/sorbet/rbi/gems/ruby2_keywords.rbi +17 -0
  57. data/sorbet/rbi/gems/simplecov-html.rbi +35 -0
  58. data/sorbet/rbi/gems/simplecov.rbi +405 -0
  59. data/sorbet/rbi/gems/sinatra.rbi +488 -0
  60. data/sorbet/rbi/gems/slim.rbi +144 -0
  61. data/sorbet/rbi/gems/temple.rbi +281 -0
  62. data/sorbet/rbi/gems/thor.rbi +522 -0
  63. data/sorbet/rbi/gems/tilt.rbi +82 -0
  64. data/sorbet/rbi/gems/unicode-display_width.rbi +17 -0
  65. data/sorbet/rbi/gems/yaml-front-matter.rbi +16 -0
  66. data/sorbet/rbi/hidden-definitions/errors.txt +2859 -24228
  67. data/sorbet/rbi/hidden-definitions/hidden.rbi +7111 -40830
  68. data/sorbet/rbi/sorbet-typed/lib/nokogiri/1.10.10/nokogiri.rbi +1615 -0
  69. data/sorbet/rbi/sorbet-typed/lib/thor/all/thor.rbi +905 -0
  70. data/sorbet/rbi/todo.rbi +6 -0
  71. data/spec/frontman/bootstrapper_spec.rb +1 -1
  72. data/spec/frontman/context_spec.rb +45 -6
  73. data/spec/frontman/mocks/context.haml +18 -0
  74. data/spec/frontman/renderers/slim_renderer_spec.rb +12 -0
  75. metadata +66 -4
@@ -2,5 +2,11 @@
2
2
  # srb rbi todo
3
3
 
4
4
  # typed: strong
5
+ module ::Anonymous_Delegator_1; end
6
+ module ::Anonymous_Delegator_8; end
7
+ module ::Anonymous_Delegator_9; end
8
+ module Kramdown::Converter::Kramdown::Utils::Configurable; end
9
+ module T::CompatibilityPatches::RSpecCompatibility::MethodDoubleExtensions; end
10
+ module T::CompatibilityPatches::RSpecCompatibility::RecorderExtensions; end
5
11
  module T::Private::Methods::MethodHooks; end
6
12
  module T::Private::Methods::SingletonMethodHooks; end
@@ -20,7 +20,7 @@ describe Frontman::Bootstrapper do
20
20
  it 'should find all resources in a given folder' do
21
21
  resources = Frontman::Bootstrapper.resources_from_dir('spec/frontman/mocks')
22
22
 
23
- expect(resources.size).to eq 15 # Number of non-YAML files in this folder
23
+ expect(resources.size).to eq 16 # Number of non-YAML files in this folder
24
24
  end
25
25
  end
26
26
  end
@@ -25,19 +25,58 @@ describe Frontman::Context do
25
25
  end
26
26
 
27
27
  it 'should return not react to unknown content' do
28
- expect(subject.content_for?('unknown content')).to eq false
28
+ key = 'unknown content'
29
+
30
+ expect(subject.content_for?(key)).to eq false
31
+ end
32
+
33
+ it 'should react to known content' do
34
+ Frontman::App.instance.current_page = resource
35
+ key = 'my-key'
36
+ subject.content_for(key, 'myvalue')
37
+ expect(subject.content_for?(key)).to eq true
29
38
  end
30
39
 
31
40
  it 'should return content when it\'s set' do
32
41
  Frontman::App.instance.current_page = resource
33
- subject.content_for('my-key', 'myvalue')
34
- expect(subject.yield_content('my-key')).to eq 'myvalue'
42
+ key = 'my-key'
43
+
44
+ subject.content_for(key, 'myvalue')
45
+ expect(subject.yield_content(key)).to eq 'myvalue'
46
+
47
+ subject.append_content(key, ',othervalue')
48
+ expect(subject.yield_content(key)).to eq 'myvalue,othervalue'
49
+
50
+ key = 'new-key'
51
+ subject.append_content(key, 'test')
52
+ expect(subject.yield_content(key)).to eq 'test'
35
53
  end
36
54
 
37
- it 'should react to known content' do
55
+ it 'should accept a block' do
38
56
  Frontman::App.instance.current_page = resource
39
- subject.content_for('my-key', 'myvalue')
40
- expect(subject.content_for?('my-key')).to eq true
57
+ key = 'my-key'
58
+
59
+ subject.content_for(key) do
60
+ 'myvalue'
61
+ end
62
+
63
+ subject.append_content(key) do
64
+ ',othervalue'
65
+ end
66
+
67
+ subject.content_for(key, '')
68
+
69
+ subject.content_for(key, 'foobar') do
70
+ 'myvalue'
71
+ end
72
+
73
+ subject.append_content(key, ',foobar') do
74
+ ',othervalue'
75
+ end
76
+ end
77
+
78
+ it 'should render correctly' do
79
+ expect(Frontman::Resource.from_path('spec/frontman/mocks/context.haml').render).to eq "<h1>123\n</h1>\n<p>456\n</p>\n"
41
80
  end
42
81
 
43
82
  it 'should wrap the layout properly' do
@@ -0,0 +1,18 @@
1
+ - content_for :foo, "1"
2
+
3
+ - content_for :bar do
4
+ 456
5
+
6
+ - append_content :foo, "2"
7
+
8
+ - append_content :foo do
9
+ 3
10
+
11
+ - if content_for?(:invalid)
12
+ %h1= yield_content(:invalid)
13
+
14
+ - if content_for?(:foo)
15
+ %h1= yield_content(:foo)
16
+
17
+ - if content_for?(:bar)
18
+ %p= yield_content(:bar)
@@ -0,0 +1,12 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require './spec/spec_setup'
5
+ require 'lib/frontman/renderers/slim_renderer'
6
+
7
+ describe Frontman::SlimRenderer do
8
+ it 'should render Slim correctly' do
9
+ compiled = Frontman::SlimRenderer.instance.compile('h1#hello Hello!')
10
+ expect(Frontman::SlimRenderer.instance.render_content(compiled, nil, Frontman::Context.new, {})).to eq "<h1 id=\"hello\">\n Hello!\n</h1>"
11
+ end
12
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frontman-ssg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Devin Beeuwkes
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-06-06 00:00:00.000000000 Z
@@ -290,6 +290,20 @@ dependencies:
290
290
  - - "~>"
291
291
  - !ruby/object:Gem::Version
292
292
  version: '2.0'
293
+ - !ruby/object:Gem::Dependency
294
+ name: slim
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - "~>"
298
+ - !ruby/object:Gem::Version
299
+ version: '4.1'
300
+ type: :runtime
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - "~>"
305
+ - !ruby/object:Gem::Version
306
+ version: '4.1'
293
307
  - !ruby/object:Gem::Dependency
294
308
  name: sorbet-runtime
295
309
  requirement: !ruby/object:Gem::Requirement
@@ -389,6 +403,7 @@ files:
389
403
  - lib/frontman/renderers/markdown_renderer.rb
390
404
  - lib/frontman/renderers/renderer.rb
391
405
  - lib/frontman/renderers/renderer_resolver.rb
406
+ - lib/frontman/renderers/slim_renderer.rb
392
407
  - lib/frontman/resource.rb
393
408
  - lib/frontman/sitemap_tree.rb
394
409
  - lib/frontman/toolbox/timer.rb
@@ -432,9 +447,54 @@ files:
432
447
  - project-templates/webpack/webpack/prod.config.js
433
448
  - readme.md
434
449
  - sorbet/config
450
+ - sorbet/rbi/gems/ast.rbi
451
+ - sorbet/rbi/gems/better_errors.rbi
452
+ - sorbet/rbi/gems/binding_of_caller.rbi
453
+ - sorbet/rbi/gems/coderay.rbi
454
+ - sorbet/rbi/gems/debug_inspector.rbi
455
+ - sorbet/rbi/gems/docile.rbi
456
+ - sorbet/rbi/gems/dotenv.rbi
457
+ - sorbet/rbi/gems/erubi.rbi
458
+ - sorbet/rbi/gems/erubis.rbi
459
+ - sorbet/rbi/gems/haml.rbi
460
+ - sorbet/rbi/gems/htmlentities.rbi
461
+ - sorbet/rbi/gems/jaro_winkler.rbi
462
+ - sorbet/rbi/gems/kramdown-parser-gfm.rbi
463
+ - sorbet/rbi/gems/kramdown.rbi
464
+ - sorbet/rbi/gems/listen.rbi
465
+ - sorbet/rbi/gems/mustermann.rbi
466
+ - sorbet/rbi/gems/nokogiri.rbi
467
+ - sorbet/rbi/gems/parallel.rbi
468
+ - sorbet/rbi/gems/parser.rbi
469
+ - sorbet/rbi/gems/rack-protection.rbi
470
+ - sorbet/rbi/gems/rack.rbi
471
+ - sorbet/rbi/gems/rainbow.rbi
472
+ - sorbet/rbi/gems/rake.rbi
473
+ - sorbet/rbi/gems/rexml.rbi
474
+ - sorbet/rbi/gems/rouge.rbi
475
+ - sorbet/rbi/gems/rspec-core.rbi
476
+ - sorbet/rbi/gems/rspec-expectations.rbi
477
+ - sorbet/rbi/gems/rspec-mocks.rbi
478
+ - sorbet/rbi/gems/rspec-support.rbi
479
+ - sorbet/rbi/gems/rspec.rbi
480
+ - sorbet/rbi/gems/rubocop-performance.rbi
481
+ - sorbet/rbi/gems/rubocop.rbi
482
+ - sorbet/rbi/gems/ruby-progressbar.rbi
483
+ - sorbet/rbi/gems/ruby2_keywords.rbi
484
+ - sorbet/rbi/gems/simplecov-html.rbi
485
+ - sorbet/rbi/gems/simplecov.rbi
486
+ - sorbet/rbi/gems/sinatra.rbi
487
+ - sorbet/rbi/gems/slim.rbi
488
+ - sorbet/rbi/gems/temple.rbi
489
+ - sorbet/rbi/gems/thor.rbi
490
+ - sorbet/rbi/gems/tilt.rbi
491
+ - sorbet/rbi/gems/unicode-display_width.rbi
492
+ - sorbet/rbi/gems/yaml-front-matter.rbi
435
493
  - sorbet/rbi/hidden-definitions/errors.txt
436
494
  - sorbet/rbi/hidden-definitions/hidden.rbi
495
+ - sorbet/rbi/sorbet-typed/lib/nokogiri/1.10.10/nokogiri.rbi
437
496
  - sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi
497
+ - sorbet/rbi/sorbet-typed/lib/thor/all/thor.rbi
438
498
  - sorbet/rbi/todo.rbi
439
499
  - spec/frontman/app_spec.rb
440
500
  - spec/frontman/bootstrapper_spec.rb
@@ -456,6 +516,7 @@ files:
456
516
  - spec/frontman/iterator_spec.rb
457
517
  - spec/frontman/mocks/asset.css
458
518
  - spec/frontman/mocks/config.rb
519
+ - spec/frontman/mocks/context.haml
459
520
  - spec/frontman/mocks/helpers/formatting_helper.rb
460
521
  - spec/frontman/mocks/helpers/language_helper.rb
461
522
  - spec/frontman/mocks/helpers/link_helper.rb
@@ -478,6 +539,7 @@ files:
478
539
  - spec/frontman/renderers/haml_renderer_spec.rb
479
540
  - spec/frontman/renderers/markdown_renderer_spec.rb
480
541
  - spec/frontman/renderers/renderer_spec.rb
542
+ - spec/frontman/renderers/slim_renderer_spec.rb
481
543
  - spec/frontman/resource_spec.rb
482
544
  - spec/frontman/sitemap_tree_spec.rb
483
545
  - spec/frontman/toolbox/timer_spec.rb
@@ -486,7 +548,7 @@ homepage: https://github.com/algolia/frontman/wiki
486
548
  licenses:
487
549
  - MIT
488
550
  metadata: {}
489
- post_install_message:
551
+ post_install_message:
490
552
  rdoc_options: []
491
553
  require_paths:
492
554
  - lib
@@ -505,7 +567,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
505
567
  version: '0'
506
568
  requirements: []
507
569
  rubygems_version: 3.0.6
508
- signing_key:
570
+ signing_key:
509
571
  specification_version: 4
510
572
  summary: A Middleman-inspired static site generator built for speed.
511
573
  test_files: []