Skip to content

Commit

Permalink
Update Bulmatown for Bridgetown 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed Nov 28, 2021
1 parent 53396d8 commit 57ca5aa
Show file tree
Hide file tree
Showing 25 changed files with 459 additions and 204 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Installation

Bulmatown requires Bridgetown v0.15 or later
Bulmatown requires Bridgetown v1.0 or later (for >= 1.2), or v0.15 or later (~1.1)

To install Bulmatown while creating a new Bridgetown site:

Expand Down
6 changes: 1 addition & 5 deletions bridgetown.automation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
add_bridgetown_plugin "bulmatown"
add_bridgetown_plugin "bridgetown-quick-search"

# 0.15 bug! :( can't use this:
#add_yarn_for_gem "bulmatown"

gem_version = (`bundle info bulmatown`).match(/\*.*\((.*?)\)/)[1]
run "yarn add bulmatown@#{gem_version}"
add_yarn_for_gem "bulmatown"

require 'fileutils'
require 'shellwords'
Expand Down
12 changes: 6 additions & 6 deletions bulmatown.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
spec.name = "bulmatown"
spec.version = Bulmatown::VERSION
spec.author = "Jared White"
spec.email = "jared@whitefusion.io"
spec.email = "jared@whitefusion.studio"
spec.summary = "A Bulma CSS starter theme for Bridgetown"
spec.homepage = "https://github.com/whitefusionhq/bulmatown"
spec.license = "MIT"
Expand All @@ -16,14 +16,14 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.metadata = { "yarn-add" => "bulmatown@#{Bulmatown::VERSION}" }

spec.required_ruby_version = ">= 2.5.0"
spec.required_ruby_version = ">= 2.7.0"

spec.add_dependency "bridgetown", ">= 0.15", "< 2.0"
spec.add_dependency "bridgetown-quick-search", "~> 1.0"
spec.add_dependency "bridgetown", ">= 1.0.0.alpha10", "< 2.0"
spec.add_dependency "bridgetown-quick-search", "~> 1.1"

spec.add_development_dependency "bundler"
spec.add_development_dependency "nokogiri", "~> 1.6"
spec.add_development_dependency "rake", "~> 12.0"
spec.add_development_dependency "rake", ">= 13.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rubocop-bridgetown", "~> 0.2"
spec.add_development_dependency "rubocop-bridgetown", "~> 0.3"
end
24 changes: 12 additions & 12 deletions components/bulmatown/collection.liquid
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<div class="columns is-multiline">
{% for document in collection %}
{% for resource in collection %}
{%- assign imagesource = metadata.bulmatown_theme.image_sizes.embed | default: "image" %}
<div class="column is-full-mobile is-full-tablet is-half-desktop">
<div class="box document-entry">
{% if document.image %}
{% if resource.image %}
<figure class="image is-5by3">
<a href="{{ document.url }}">
<img src="{{ document[imagesource] }}" />
<a href="{{ resource.relative_url }}">
<img src="{{ resource[imagesource] }}" />
</a>
</figure>
{% endif %}

<div class="content">
<h3>
<a class="is-decorationless" href="{{ document.url }}">
{{ document.title | smartify }}
<a class="is-decorationless" href="{{ resource.relative_url }}">
{{ resource.title | smartify }}
</a>
</h3>

{% if document.subtitle and document.subtitle != "" %}
{% assign excerpt = document.subtitle | smartify | prepend: "<p>" | append: "</p>" %}
{% elsif document.description and document.description != "" %}
{% assign excerpt = document.description | smartify | prepend: "<p>" | append: "</p>" %}
{% if resource.subtitle and resource.subtitle != "" %}
{% assign excerpt = resource.subtitle | smartify | prepend: "<p>" | append: "</p>" %}
{% elsif resource.description and resource.description != "" %}
{% assign excerpt = resource.description | smartify | prepend: "<p>" | append: "</p>" %}
{% else %}
{% assign excerpt = document.excerpt %}
{% assign excerpt = resource.excerpt %}
{% endif %}
{{ excerpt }}

<p class="mt-5">
{% render "bulmatown/button", type: "primary", label: "Continue Reading", link: document.url, icon: "file-text" %}
{% render "bulmatown/button", type: "primary", label: "Continue Reading", link: resource.relative_url, icon: "file-text" %}
</p>
</div>
</div>
Expand Down
15 changes: 0 additions & 15 deletions components/bulmatown/pagination.liquid
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
---
name: Pagination
description: Display previous page and/or next page buttons to navigate through paginated pages.
variables:
paginator:
- object
- The Bridgetown Paginator object ([see documentation here](https://www.bridgetownrb.com/docs/content/pagination/))
mocks:
paginator:
total_pages: 3
previous_page: true
previous_page_path: "#previous"
next_page: true
next_page_path: "#next"
---
{% if paginator.total_pages > 1 %}
<ul class="pagination mt-6">
{% if paginator.previous_page %}
Expand Down
3 changes: 1 addition & 2 deletions example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Happy Bridgetowning!

gem "bridgetown"
gem "bridgetown-quick-search", "~> 1.0", :group => :bridgetown_plugins

gem "bulmatown", group: :bridgetown_plugins
gem "bulmatown", group: :bridgetown_plugins, path: "../"
49 changes: 49 additions & 0 deletions example/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require "bridgetown"

Bridgetown.load_tasks

# Run rake without specifying any command to execute a deploy build by default.
task default: :deploy

#
# Standard set of tasks, which you can customize if you wish:
#
desc "Build the Bridgetown site for deployment"
task :deploy => [:clean, "frontend:build"] do
Bridgetown::Commands::Build.start
end

desc "Build the site in a test environment"
task :test do
ENV["BRIDGETOWN_ENV"] = "test"
Bridgetown::Commands::Build.start
end

desc "Runs the clean command"
task :clean do
Bridgetown::Commands::Clean.start
end

namespace :frontend do
desc "Build the frontend with Webpack for deployment"
task :build do
sh "yarn run webpack-build"
end

desc "Watch the frontend with Webpack during development"
task :dev do
sh "yarn run webpack-dev --color"
rescue Interrupt
end
end

#
# Add your own Rake tasks here! You can use `environment` as a prerequisite
# in order to write automations or other commands requiring a loaded site.
#
# task :my_task => :environment do
# puts site.root_dir
# automation do
# say_status :rake, "I'm a Rake tast =) #{site.config.url}"
# end
# end
29 changes: 29 additions & 0 deletions example/bin/bridgetown
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'bridgetown' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("bridgetown-core", "bridgetown")
29 changes: 29 additions & 0 deletions example/bin/bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

#
# This file was generated by Bundler.
#
# The application 'bridgetown' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path("../bundle", __FILE__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end

require "rubygems"
require "bundler/setup"

load Gem.bin_path("bridgetown-core", "bridgetown")
7 changes: 7 additions & 0 deletions example/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is used by Rack-based servers during the Bridgetown boot process.

require "bridgetown-core/rack/boot"

Bridgetown::Rack.boot

run RodaApp.freeze.app # see server/roda_app.rb
27 changes: 27 additions & 0 deletions example/config/puma.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Puma is a fast, concurrent web server for Ruby & Rack
#
# Learn more at: https://puma.io
#
port ENV.fetch("BRIDGETOWN_PORT") { 4000 }

# You can adjust the number of workers (separate processes) and threads
# (per process) based on your production system
#
if ENV["BRIDGETOWN_ENV"] == "production"
workers ENV.fetch("BRIDGETOWN_CONCURRENCY") { 4 }
end

max_threads_count = ENV.fetch("BRIDGETOWN_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("BRIDGETOWN_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count

# Preload the application for maximum performance
#
preload_app!

# Use the Bridgetown logger format
#
require "bridgetown-core/rack/logger"
log_formatter do |msg|
Bridgetown::Rack::Logger.message_with_prefix msg
end
Loading

0 comments on commit 57ca5aa

Please sign in to comment.