bridgetown_writebook 0.1.0.1 → 0.1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ecde4cf7c2246af31a117f402935e342064314ab25f9ce3c38c50520682a769
4
- data.tar.gz: 78fcd4f3b88571eb92f8953c627b01bb19a17145d0b94251955dfd46462213c2
3
+ metadata.gz: 706790ac167218b2e3e12b4765c83d2e3868a9b0fc0b8635af7e5937234415b1
4
+ data.tar.gz: 662a770b9c397cf80b0e69a2681d04f9214becd91ceadf01187d924c8c17e11e
5
5
  SHA512:
6
- metadata.gz: dcd86b0250d74ca12824716bac756083d46e1990b4fd86e698c35928a1250f32d955048d07bf074b2dac8176a7f91621e3797f5b60a66e86c49d7535fa9f1f58
7
- data.tar.gz: 391edeb2c0e1dc1b5502da043b23df3ea71f7db0570b3b1dddeb71cb71041b37d2493a6324768a7200a06e5556805fcdec0e48d569816c878e8e761c6461b4e4
6
+ metadata.gz: b3541f4eb36f74d64154d0135dca1db9db45ba50242d27e5a6dab171104fbea56ce855c8000f5f166276b342f90251da1b8b200e54e1322058347656baf0094d
7
+ data.tar.gz: 3d5aa8046824c16b3d4cea27298214270d65b301267d2ca755f7093379575903d729e3b75f84784723f6902615efa43886414cac7dc57defb159a184194bd53d
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
@@ -0,0 +1,111 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$" />
8
+ <orderEntry type="jdk" jdkName="asdf: 3.3.3" jdkType="RUBY_SDK" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ <orderEntry type="library" scope="PROVIDED" name="activemodel (v7.2.2.2, asdf: 3.3.3) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v7.2.2.2, asdf: 3.3.3) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.7, asdf: 3.3.3) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="amazing_print (v1.8.1, asdf: 3.3.3) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="ansi (v1.5.0, asdf: 3.3.3) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.3, asdf: 3.3.3) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="base64 (v0.3.0, asdf: 3.3.3) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="benchmark (v0.4.1, asdf: 3.3.3) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="bigdecimal (v3.2.2, asdf: 3.3.3) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="bridgetown (v1.3.4, asdf: 3.3.3) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="bridgetown-builder (v1.3.4, asdf: 3.3.3) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="bridgetown-core (v1.3.4, asdf: 3.3.3) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="bridgetown-paginate (v1.3.4, asdf: 3.3.3) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.3.0, asdf: 3.3.3) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.7.1, asdf: 3.3.3) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="colorator (v1.1.0, asdf: 3.3.3) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.3.5, asdf: 3.3.3) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="connection_pool (v2.5.3, asdf: 3.3.3) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="csv (v3.3.5, asdf: 3.3.3) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="drb (v2.2.3, asdf: 3.3.3) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="erubi (v1.13.1, asdf: 3.3.3) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="faraday (v2.13.4, asdf: 3.3.3) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="faraday-follow_redirects (v0.3.0, asdf: 3.3.3) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="faraday-net_http (v3.4.1, asdf: 3.3.3) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="ffi (v1.17.2, asdf: 3.3.3) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="hash_with_dot_access (v1.2.0, asdf: 3.3.3) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.14.7, asdf: 3.3.3) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.13.2, asdf: 3.3.3) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="kramdown (v2.5.1, asdf: 3.3.3) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="kramdown-parser-gfm (v1.1.0, asdf: 3.3.3) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.5, asdf: 3.3.3) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="lint_roller (v1.1.0, asdf: 3.3.3) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="liquid (v5.4.0, asdf: 3.3.3) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="listen (v3.9.0, asdf: 3.3.3) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="logger (v1.7.0, asdf: 3.3.3) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.25.5, asdf: 3.3.3) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="minitest-profile (v0.0.2, asdf: 3.3.3) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="minitest-reporters (v1.7.1, asdf: 3.3.3) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="net-http (v0.6.0, asdf: 3.3.3) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.27.0, asdf: 3.3.3) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.3.9.0, asdf: 3.3.3) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="prism (v1.4.0, asdf: 3.3.3) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="public_suffix (v6.0.2, asdf: 3.3.3) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, asdf: 3.3.3) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="rack (v3.2.0, asdf: 3.3.3) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, asdf: 3.3.3) [gem]" level="application" />
56
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.3.0, asdf: 3.3.3) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.11.2, asdf: 3.3.3) [gem]" level="application" />
58
+ <orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.11.1, asdf: 3.3.3) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.11.2, asdf: 3.3.3) [gem]" level="application" />
60
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.4.2, asdf: 3.3.3) [gem]" level="application" />
61
+ <orderEntry type="library" scope="PROVIDED" name="roda (v3.95.0, asdf: 3.3.3) [gem]" level="application" />
62
+ <orderEntry type="library" scope="PROVIDED" name="rouge (v4.6.0, asdf: 3.3.3) [gem]" level="application" />
63
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.80.0, asdf: 3.3.3) [gem]" level="application" />
64
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.46.0, asdf: 3.3.3) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-bridgetown (v0.6.1, asdf: 3.3.3) [gem]" level="application" />
66
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-performance (v1.25.0, asdf: 3.3.3) [gem]" level="application" />
67
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, asdf: 3.3.3) [gem]" level="application" />
68
+ <orderEntry type="library" scope="PROVIDED" name="securerandom (v0.4.1, asdf: 3.3.3) [gem]" level="application" />
69
+ <orderEntry type="library" scope="PROVIDED" name="serbea (v1.0.1, asdf: 3.3.3) [gem]" level="application" />
70
+ <orderEntry type="library" scope="PROVIDED" name="thor (v1.4.0, asdf: 3.3.3) [gem]" level="application" />
71
+ <orderEntry type="library" scope="PROVIDED" name="tilt (v2.6.1, asdf: 3.3.3) [gem]" level="application" />
72
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, asdf: 3.3.3) [gem]" level="application" />
73
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v3.1.5, asdf: 3.3.3) [gem]" level="application" />
74
+ <orderEntry type="library" scope="PROVIDED" name="unicode-emoji (v4.0.4, asdf: 3.3.3) [gem]" level="application" />
75
+ <orderEntry type="library" scope="PROVIDED" name="uri (v1.0.3, asdf: 3.3.3) [gem]" level="application" />
76
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.7.3, asdf: 3.3.3) [gem]" level="application" />
77
+ </component>
78
+ <component name="RakeTasksCache-v2">
79
+ <option name="myRootTask">
80
+ <RakeTaskImpl id="rake">
81
+ <subtasks>
82
+ <RakeTaskImpl description="Build bridgetown_writebook-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
83
+ <RakeTaskImpl id="build">
84
+ <subtasks>
85
+ <RakeTaskImpl description="Generate SHA512 checksum of bridgetown_writebook-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
86
+ </subtasks>
87
+ </RakeTaskImpl>
88
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
89
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
90
+ <RakeTaskImpl description="Build and install bridgetown_writebook-0.1.0.gem into system gems" fullCommand="install" id="install" />
91
+ <RakeTaskImpl id="install">
92
+ <subtasks>
93
+ <RakeTaskImpl description="Build and install bridgetown_writebook-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
94
+ </subtasks>
95
+ </RakeTaskImpl>
96
+ <RakeTaskImpl description="Create tag v0.1.0 and build and push bridgetown_writebook-0.1.0.gem to rubygems.org" fullCommand="release[remote]" id="release[remote]" />
97
+ <RakeTaskImpl description="Run tests" fullCommand="test" id="test" />
98
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
99
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
100
+ <RakeTaskImpl id="release">
101
+ <subtasks>
102
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
103
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
104
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
105
+ </subtasks>
106
+ </RakeTaskImpl>
107
+ </subtasks>
108
+ </RakeTaskImpl>
109
+ </option>
110
+ </component>
111
+ </module>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/bridgetown_writebook.iml" filepath="$PROJECT_DIR$/.idea/bridgetown_writebook.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
6
+ </component>
7
+ </project>
@@ -50,8 +50,27 @@
50
50
  #
51
51
  # Read the Automations documentation: https://www.bridgetownrb.com/docs/automations
52
52
 
53
- append_to_file "config/boot.rb" do
53
+ if File.exist?("config/boot.rb")
54
+ append_to_file "config/boot.rb" do
55
+ <<~RUBY
56
+
57
+ require "bridgetown_writebook/commands"
58
+ RUBY
59
+ end
60
+ else
61
+ create_file "config/boot.rb" do
62
+ <<~RUBY
63
+ # frozen_string_literal: true
64
+
65
+ require "bridgetown_writebook/commands"
66
+ RUBY
67
+ end
68
+ end
69
+
70
+ create_file "config/boot.rb" do
54
71
  <<~RUBY
55
- require 'bridgetown_writebook/commands'
56
- RUBY
72
+ # frozen_string_literal: true
73
+
74
+ require "bridgetown_writebook/commands"
75
+ RUBY
57
76
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_all "bridgetown-core/commands/concerns"
4
- require "commands/book"
4
+ require_relative "commands/book"
5
5
 
6
6
  module BridgetownWritebook
7
7
  class Commands
@@ -0,0 +1,63 @@
1
+ require 'active_support/core_ext/numeric/conversions'
2
+
3
+ # frozen_string_literal: true
4
+ class Builders::Books < SiteBuilder
5
+ def initialize(name = nil, current_site = nil)
6
+ super
7
+ @books = []
8
+ end
9
+
10
+ def build
11
+ generator do
12
+ create_book_objects
13
+ generate_books
14
+ generate_index_page_for_books
15
+ end
16
+ end
17
+
18
+ def generate_index_page_for_books
19
+ books = @books
20
+ book_covers = books.map { |book| cover_for(book) }.join
21
+ add_resource nil, "books.md" do
22
+ layout "default"
23
+ permalink "/books/"
24
+ content <<-HTML
25
+ <ul class="list-none flex justify-center sm:grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-y-6 py-10 px-0 flex-wrap">
26
+ #{book_covers}
27
+ </ul>
28
+ HTML
29
+ end
30
+ end
31
+
32
+ def cover_for(book)
33
+ chapters_json = book.chapter_ids.to_json.gsub('"', '&quot;')
34
+
35
+ <<-HTML
36
+ <li data-controller="book" data-book-id-value="#{book.id}" data-book-chapters-value="#{chapters_json}" >
37
+ <a class="flex flex-col gap-2 max-w-[236px]" href="#{book.link}">
38
+ <div class="max-h-[378px] border rounded relative box-border" data-book-target="cover">
39
+ <img src="#{book.cover}" class="max-h-[378px] max-w-[236px] rounded">
40
+ </div>
41
+ <div class="text-center">#{book.name}</div>
42
+ <div class="text-sm text-center">#{book.authors}</div>
43
+ </a>
44
+ </li>
45
+ HTML
46
+ end
47
+
48
+ def create_book_objects
49
+ site.collections.books.resources
50
+ .group_by { |b| b.id.split("_books/").last.split("/").first }
51
+ .each do |book_id, chapters|
52
+ meta_file = chapters.find { |c| c.relative_path.to_s.end_with?('00-meta.md') }
53
+ regular_chapters = chapters.reject { |c| c.relative_path.to_s.end_with?('00-meta.md') }
54
+
55
+ resource = add_resource(:book, "books/#{book_id}.md") { permalink "/books/:slug/" }
56
+ @books << Book.new(resource, chapters: regular_chapters, meta: meta_file)
57
+ end
58
+ end
59
+
60
+ def generate_books
61
+ @books.each(&:generate)
62
+ end
63
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgetownWritebook
4
- VERSION = "0.1.0.1"
4
+ VERSION = "0.1.0.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown_writebook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.1
4
+ version: 0.1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
@@ -80,6 +80,10 @@ extra_rdoc_files: []
80
80
  files:
81
81
  - ".github/workflows/tests.yml"
82
82
  - ".gitignore"
83
+ - ".idea/.gitignore"
84
+ - ".idea/bridgetown_writebook.iml"
85
+ - ".idea/modules.xml"
86
+ - ".idea/vcs.xml"
83
87
  - ".rubocop.yml"
84
88
  - CHANGELOG.md
85
89
  - Gemfile
@@ -100,6 +104,7 @@ files:
100
104
  - lib/bridgetown_writebook/commands/chapter.rb
101
105
  - lib/bridgetown_writebook/models/book.rb
102
106
  - lib/bridgetown_writebook/models/chapter.rb
107
+ - lib/bridgetown_writebook/models/something.rb
103
108
  - lib/bridgetown_writebook/version.rb
104
109
  - package.json
105
110
  homepage: https://github.com/username/bridgetown_writebook