bridgetown_writebook 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2c25aa1ad6696109457b735df53aed475b1c7c2b3797c26d13c35b106ae900b6
4
+ data.tar.gz: 3f7d2626aa3e8b136d3e08ceac6da90953165840a0a5a4e14bf809a817a6eb74
5
+ SHA512:
6
+ metadata.gz: 9bad682e488ee4de5377045ab507bf59d0e636ab707bc4321550a32140e7feaeecf68ccbc5fa248acbd0cfec6800f0dbe3a5f1c3cfe302c54b3474049febfefd
7
+ data.tar.gz: bcb3a49ad89e9c122d1aa6d681df9c18b3c4687c70489d931f2b52e2308d6bd4b8bc93fcada0b148161a0eb0b1ac5a7aa24cad81047b28b4fdf798a23ca3f655
@@ -0,0 +1,32 @@
1
+ name: Tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - "*"
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ ruby_version: [2.7.7, 3.0.5, 3.1.3, 3.2.0]
17
+ bridgetown_version: [1.2.0]
18
+ continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
19
+ # Has to be top level to cache properly
20
+ env:
21
+ BUNDLE_JOBS: 3
22
+ BUNDLE_PATH: "vendor/bundle"
23
+ BRIDGETOWN_VERSION: ${{ matrix.bridgetown_version }}
24
+ steps:
25
+ - uses: actions/checkout@master
26
+ - name: Setup Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby_version }}
30
+ bundler-cache: true
31
+ - name: Test with Rake
32
+ run: script/cibuild
data/.gitignore ADDED
@@ -0,0 +1,40 @@
1
+ /vendor
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
16
+ *.gem
17
+ Gemfile.lock
18
+ .bundle
19
+ .ruby-version
20
+
21
+ # Node
22
+ node_modules
23
+ .npm
24
+ .node_repl_history
25
+
26
+ # Yarn
27
+ yarn-error.log
28
+ yarn-debug.log*
29
+ .pnp/
30
+ .pnp.js
31
+
32
+ # Yarn Integrity file
33
+ .yarn-integrity
34
+
35
+ test/dest
36
+ .bridgetown-metadata
37
+ .bridgetown-cache
38
+ .bridgetown-webpack
39
+
40
+ .env
data/.rubocop.yml ADDED
@@ -0,0 +1,23 @@
1
+ require: rubocop-bridgetown
2
+
3
+ inherit_gem:
4
+ rubocop-bridgetown: .rubocop.yml
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.7
8
+
9
+ Exclude:
10
+ - .gitignore
11
+ - .rubocop.yml
12
+ - "*.gemspec"
13
+
14
+ - Gemfile.lock
15
+ - CHANGELOG.md
16
+ - LICENSE.txt
17
+ - README.md
18
+ - Rakefile
19
+ - bridgetown.automation.rb
20
+
21
+ - script/**/*
22
+ - test/fixtures/**/*
23
+ - vendor/**/*
data/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ - ...
11
+
12
+ ## [0.1.0] - YYYY-MM-DD
13
+
14
+ - First version
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec
5
+
6
+ gem "bridgetown", ENV["BRIDGETOWN_VERSION"] if ENV["BRIDGETOWN_VERSION"]
7
+
8
+ group :test do
9
+ gem "minitest"
10
+ gem "minitest-profile"
11
+ gem "minitest-reporters"
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020-present
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # Sample plugin for Bridgetown
2
+
3
+ _NOTE: This isn't a real plugin! Copy this sample code and use it to create your own Ruby gem! [Help guide here…](https://www.bridgetownrb.com/docs/plugins)_ 😃
4
+
5
+ _You can run_ `bridgetown plugins new` _to easily set up a customized version of this starter repo._
6
+
7
+ A Bridgetown plugin to [fill in the blank]…
8
+
9
+ ## Installation
10
+
11
+ Run this command to add this plugin to your site's Gemfile:
12
+
13
+ ```shell
14
+ bundle add my_awesome_plugin
15
+ ```
16
+
17
+ Then add the initializer to your configuration in `config/initializers.rb`:
18
+
19
+ ```ruby
20
+ init :my_awesome_plugin
21
+ ```
22
+
23
+ Or if there's a `bridgetown.automation.rb` automation script, you can run that instead for guided setup:
24
+
25
+ ```shell
26
+ bin/bridgetown apply https://github.com/username/my_awesome_plugin
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ The plugin will…
32
+
33
+ ### Optional configuration options
34
+
35
+ The plugin will automatically use any of the following metadata variables if they are present in your site's `_data/site_metadata.yml` file.
36
+
37
+
38
+
39
+ ## Testing
40
+
41
+ * Run `bundle exec rake test` to run the test suite
42
+ * Or run `script/cibuild` to validate with Rubocop and Minitest together.
43
+
44
+ ## Contributing
45
+
46
+ 1. Fork it (https://github.com/username/my-awesome-plugin/fork)
47
+ 2. Clone the fork using `git clone` to your local development machine.
48
+ 3. Create your feature branch (`git checkout -b my-new-feature`)
49
+ 4. Commit your changes (`git commit -am 'Add some feature'`)
50
+ 5. Push to the branch (`git push origin my-new-feature`)
51
+ 6. Create a new Pull Request
52
+
53
+ ----
54
+
55
+ ## Releasing (you can delete this section in your own plugin repo)
56
+
57
+ To release a new version of the plugin, simply bump up the version number in both `version.rb` and
58
+ `package.json`, and then run `script/release`. This will require you to have a registered account
59
+ with both the [RubyGems.org](https://rubygems.org) and [NPM](https://www.npmjs.com) registries.
60
+ You can optionally remove the `package.json` and `frontend` folder if you don't need to package frontend
61
+ assets for Webpack.
62
+
63
+ If you run into any problems or need further guidance, please check out our [Bridgetown community resources](https://www.bridgetownrb.com/docs/community)
64
+ where friendly folks are standing by to help you build and release your plugin or theme.
65
+
66
+ **NOTE:** make sure you add the `bridgetown-plugin` [topic](https://github.com/topics/bridgetown-plugin) to your
67
+ plugin's GitHub repo so the plugin or theme will show up on [Bridgetown's official Plugin Directory](https://www.bridgetownrb.com/plugins)! (There may be a day or so delay before you see it appear.)
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/test_*.rb"]
8
+ t.warning = false
9
+ end
10
+
11
+ task :default => :test
@@ -0,0 +1,57 @@
1
+ # If your plugin requires a lot of steps to get set up, consider writing an automation to help guide users.
2
+ # You could set up and configure all sorts of things, for example:
3
+ #
4
+ # add_gem("my_plugin")
5
+ #
6
+ # add_yarn_for_gem("my_plugin")
7
+ #
8
+ # add_initializer :"my_plugin" do
9
+ # <<~RUBY
10
+ # do
11
+ # some_config_key 12345
12
+ # end
13
+ # RUBY
14
+ # end
15
+ #
16
+ # create_builder "my_nifty_builder.rb" do
17
+ # <<~RUBY
18
+ # class MyNeatBuilder < SiteBuilder
19
+ # def build
20
+ # puts MyPlugin.hello
21
+ # end
22
+ # end
23
+ # RUBY
24
+ # end
25
+ #
26
+ # javascript_import do
27
+ # <<~JS
28
+ # import { MyPlugin } from "my_plugin"
29
+ # JS
30
+ # end
31
+ #
32
+ # javascript_import 'import "my_plugin/frontend/styles/index.css"'
33
+ #
34
+ # create_file "src/_data/plugin_data.yml" do
35
+ # <<~YAML
36
+ # data:
37
+ # goes: here
38
+ # YAML
39
+ # end
40
+ #
41
+ # color = ask("What's your favorite color?")
42
+ #
43
+ # append_to_file "bridgetown.config.yml" do
44
+ # <<~YAML
45
+ #
46
+ # my_plugin:
47
+ # favorite_color: #{color}
48
+ # YAML
49
+ # end
50
+ #
51
+ # Read the Automations documentation: https://www.bridgetownrb.com/docs/automations
52
+
53
+ append_to_file "config/boot.rb" do
54
+ <<~RUBY
55
+
56
+ RUBY
57
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/bridgetown_writebook/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bridgetown_writebook"
7
+ spec.version = BridgetownWritebook::VERSION
8
+ spec.author = "Bridgetown Team"
9
+ spec.email = "maintainers@bridgetownrb.com"
10
+ spec.summary = "Sample code for creating new Bridgetown plugins"
11
+ spec.homepage = "https://github.com/username/bridgetown_writebook"
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features|frontend)/!) }
15
+ spec.test_files = spec.files.grep(%r!^test/!)
16
+ spec.require_paths = ["lib"]
17
+ # Uncomment this if you wish to supply a companion NPM package:
18
+ # spec.metadata = { "yarn-add" => "bridgetown_writebook@#{BridgetownWritebook::VERSION}" }
19
+
20
+ spec.required_ruby_version = ">= 2.7.0"
21
+
22
+ spec.add_dependency "bridgetown", ">= 1.2.0", "< 2.0"
23
+
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "rake", ">= 13.0"
26
+ spec.add_development_dependency "rubocop-bridgetown", "~> 0.3"
27
+ end
@@ -0,0 +1 @@
1
+ <p>Just use <code>layout: bridgetown_writebook/layout</code> in your page's front matter.</p>
@@ -0,0 +1,17 @@
1
+ # rubocop:disable all
2
+ module BridgetownWritebook
3
+ class PluginComponent < Bridgetown::Component
4
+ def initialize(hi:)
5
+ @hi = hi
6
+ end
7
+
8
+ # You can remove this and add an ERB, Serbea, etc. template file…or you can
9
+ # use something like Phlex if you're feeling adventurous!
10
+ def template
11
+ <<~HTML
12
+ Well hello there #{hi}!
13
+ HTML
14
+ end
15
+ end
16
+ end
17
+ # rubocop:enable all
@@ -0,0 +1,8 @@
1
+ ---
2
+ layout: default
3
+ title: Example Page
4
+ ---
5
+
6
+ If all goes well, this page will be accessible as [`{{ resource.data.relative_url }}`]({{ resource.data.relative_url }}), and you will see a photo of a train:
7
+
8
+ ![Train on Rails]({{ "/bridgetown_writebook/train-on-rails.jpeg" | relative_url }})
@@ -0,0 +1,9 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ <p>You can include this layout in your site! 🥳</p>
6
+
7
+ {% render "bridgetown_writebook/layout_help" %}
8
+
9
+ {{ content }}
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BridgetownWritebook
4
+ class Builder < Bridgetown::Builder
5
+ def build
6
+ liquid_tag "bridgetown_writebook" do
7
+ "This plugin works!"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BridgetownWritebook
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bridgetown"
4
+ require "bridgetown_writebook/builder"
5
+
6
+ # @param config [Bridgetown::Configuration::ConfigurationDSL]
7
+ Bridgetown.initializer :bridgetown_writebook do |config|
8
+ # Add code here which will run when a site includes
9
+ # `init :bridgetown_writebook`
10
+ # in its configuration
11
+
12
+ # Add default configuration data:
13
+ config.bridgetown_writebook ||= {}
14
+ config.bridgetown_writebook.my_setting ||= 123
15
+
16
+ # Register your builder:
17
+ config.builder BridgetownWritebook::Builder
18
+
19
+ # You can optionally supply a source manifest:
20
+ config.source_manifest(
21
+ origin: BridgetownWritebook,
22
+ components: File.expand_path("../components", __dir__),
23
+ layouts: File.expand_path("../layouts", __dir__),
24
+ content: File.expand_path("../content", __dir__)
25
+ )
26
+ end
data/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "bridgetown_writebook",
3
+ "version": "0.1.0",
4
+ "main": "frontend/javascript/index.js",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/username/bridgetown_writebook.git"
8
+ },
9
+ "author": "Bridgetown Maintainers <maintainers@bridgetownrb.com>",
10
+ "homepage": "https://www.bridgetownrb.com",
11
+ "license": "MIT",
12
+ "private": false,
13
+ "files": [
14
+ "frontend"
15
+ ]
16
+ }
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bridgetown_writebook
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bridgetown Team
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-08-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bridgetown
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.2.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 1.2.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '13.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '13.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rubocop-bridgetown
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.3'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.3'
75
+ description:
76
+ email: maintainers@bridgetownrb.com
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - ".github/workflows/tests.yml"
82
+ - ".gitignore"
83
+ - ".rubocop.yml"
84
+ - CHANGELOG.md
85
+ - Gemfile
86
+ - LICENSE.txt
87
+ - README.md
88
+ - Rakefile
89
+ - bridgetown.automation.rb
90
+ - bridgetown_writebook.gemspec
91
+ - components/bridgetown_writebook/layout_help.liquid
92
+ - components/bridgetown_writebook/plugin_component.rb
93
+ - content/bridgetown_writebook/example_page.md
94
+ - content/bridgetown_writebook/train-on-rails.jpeg
95
+ - layouts/bridgetown_writebook/layout.html
96
+ - lib/bridgetown_writebook.rb
97
+ - lib/bridgetown_writebook/builder.rb
98
+ - lib/bridgetown_writebook/version.rb
99
+ - package.json
100
+ homepage: https://github.com/username/bridgetown_writebook
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 2.7.0
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubygems_version: 3.5.13
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: Sample code for creating new Bridgetown plugins
123
+ test_files: []