summaryrefslogtreecommitdiff
path: root/new/bin
diff options
context:
space:
mode:
authormms <git@sapka.me>2025-01-08 21:24:33 +0100
committermms <git@sapka.me>2025-01-08 21:24:33 +0100
commit4004a55b0e324c35cbc7d58b831e49efd484ab93 (patch)
tree3ff4c68c28165b6d08c1a49532e8421193433d65 /new/bin
parent2781360c7c25404c5a1fd03ed3472d43367ed8c6 (diff)
feat: rubocop
Diffstat (limited to 'new/bin')
-rw-r--r--new/bin/builder.rb20
-rw-r--r--new/bin/deployer.rb17
-rw-r--r--new/bin/mixins/splash.rb140
-rwxr-xr-xnew/bin/server.rb26
4 files changed, 112 insertions, 91 deletions
diff --git a/new/bin/builder.rb b/new/bin/builder.rb
index d3a273a4..7172cf85 100644
--- a/new/bin/builder.rb
+++ b/new/bin/builder.rb
@@ -1,7 +1,9 @@
+# frozen_string_literal: true
+
require 'optparse'
-require_relative "../lib/crys"
-require_relative "mixins/splash.rb"
+require_relative '../lib/crys'
+require_relative 'mixins/splash'
Options = Struct.new(:filepath)
@options = Options.new
@@ -13,32 +15,34 @@ OptionParser.new do |opts|
@options[:filepath] = n
end
- opts.on('-a', '--all', 'Process all files') do |v|
+ opts.on('-a', '--all', 'Process all files') do |_v|
@options[:filepath] = :all
end
end.parse!
-
module Crys
class BuilderRunner
-
- def initialize(file_path:, image_dir:, output_dir:, builder_class:, batch_builder_class:)
+ def initialize(file_path:, image_dir:, output_dir:, builder_class:, batch_builder_class:, theme_dir:, pages_db:)
@file_path = file_path
@output_dir = output_dir
@builder_class = builder_class
@batch_builder_class = batch_builder_class
@image_dir = image_dir
+ @theme_dir = theme_dir
+ @pages_db = pages_db
end
def run
if file_path == :all
- batch_builder_class.new.build
+ batch_builder_class.new(pages_db: pages_db, output_dir: output_dir, image_dir: image_dir,
+ builder_class: builder_class).build
else
builder_class.new(file_path: file_path, output_dir: output_dir, image_dir: image_dir).build
end
end
private
- attr_reader :builder_class, :file_path, :output_dir, :image_dir, :batch_builder_class
+
+ attr_reader :builder_class, :file_path, :output_dir, :image_dir, :batch_builder_class, :theme_dir, :pages_db
end
end
diff --git a/new/bin/deployer.rb b/new/bin/deployer.rb
new file mode 100644
index 00000000..4b6610cf
--- /dev/null
+++ b/new/bin/deployer.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+require_relative '../lib/crys'
+require_relative 'mixins/splash'
+
+module Crys
+ class DeployerRunner
+ def initialize(source:, dest:)
+ @source = source
+ @dest = dest
+ end
+
+ def run
+ Crys::Deployer.new(source: @source, dest: @dest).run
+ end
+ end
+end
diff --git a/new/bin/mixins/splash.rb b/new/bin/mixins/splash.rb
index 04cdaca4..ad73f0f7 100644
--- a/new/bin/mixins/splash.rb
+++ b/new/bin/mixins/splash.rb
@@ -1,80 +1,81 @@
+# frozen_string_literal: true
+
module Crys
module Splash
- SPLASH_1 = <<-HEREDOC
- ▄████▄ ██▀███ ▓██ ██▓ ██████ ██████ ██▓▄▄▄█████▓▓█████
-▒██▀ ▀█ ▓██ ▒ ██▒ ▒██ ██▒▒██ ▒ ▒██ ▒ ▓██▒▓ ██▒ ▓▒▓█ ▀
-▒▓█ ▄ ▓██ ░▄█ ▒ ▒██ ██░░ ▓██▄ ░ ▓██▄ ▒██▒▒ ▓██░ ▒░▒███
-▒▓▓▄ ▄██▒▒██▀▀█▄ ░ ▐██▓░ ▒ ██▒ ▒ ██▒░██░░ ▓██▓ ░ ▒▓█ ▄
-▒ ▓███▀ ░░██▓ ▒██▒ ░ ██▒▓░▒██████▒▒▒██████▒▒░██░ ▒██▒ ░ ░▒████▒
-░ ░▒ ▒ ░░ ▒▓ ░▒▓░ ██▒▒▒ ▒ ▒▓▒ ▒ ░▒ ▒▓▒ ▒ ░░▓ ▒ ░░ ░░ ▒░ ░
- ░ ▒ ░▒ ░ ▒░ ▓██ ░▒░ ░ ░▒ ░ ░░ ░▒ ░ ░ ▒ ░ ░ ░ ░ ░
-░ ░░ ░ ▒ ▒ ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░
-░ ░ ░ ░ ░ ░ ░ ░ ░ ░
-░ ░ ░
-HEREDOC
+ SPLASH_1 = <<~HEREDOC
+ ▄████▄ ██▀███ ▓██ ██▓ ██████ ██████ ██▓▄▄▄█████▓▓█████#{' '}
+ ▒██▀ ▀█ ▓██ ▒ ██▒ ▒██ ██▒▒██ ▒ ▒██ ▒ ▓██▒▓ ██▒ ▓▒▓█ ▀#{' '}
+ ▒▓█ ▄ ▓██ ░▄█ ▒ ▒██ ██░░ ▓██▄ ░ ▓██▄ ▒██▒▒ ▓██░ ▒░▒███#{' '}
+ ▒▓▓▄ ▄██▒▒██▀▀█▄ ░ ▐██▓░ ▒ ██▒ ▒ ██▒░██░░ ▓██▓ ░ ▒▓█ ▄#{' '}
+ ▒ ▓███▀ ░░██▓ ▒██▒ ░ ██▒▓░▒██████▒▒▒██████▒▒░██░ ▒██▒ ░ ░▒████▒
+ ░ ░▒ ▒ ░░ ▒▓ ░▒▓░ ██▒▒▒ ▒ ▒▓▒ ▒ ░▒ ▒▓▒ ▒ ░░▓ ▒ ░░ ░░ ▒░ ░
+ ░ ▒ ░▒ ░ ▒░ ▓██ ░▒░ ░ ░▒ ░ ░░ ░▒ ░ ░ ▒ ░ ░ ░ ░ ░
+ ░ ░░ ░ ▒ ▒ ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░#{' '}
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
+ ░ ░ ░#{' '}
+ HEREDOC
+
+ SPLASH_2 = <<~HEREDOC
+ _/_/_/ _/_/_/ _/ _/#{' '}
+ _/ _/ _/_/ _/ _/ _/_/_/ _/ _/_/_/_/ _/_/#{' '}
+ _/ _/_/ _/ _/ _/_/ _/_/ _/ _/ _/_/_/_/#{' '}
+ _/ _/ _/ _/ _/_/ _/ _/ _/ _/#{' '}
+ _/_/_/ _/ _/_/_/ _/_/_/ _/_/_/ _/ _/_/ _/_/_/#{' '}
+ _/#{' '}
+ _/_/#{' '}
+ HEREDOC
- SPLASH_2 = <<-HEREDOC
- _/_/_/ _/_/_/ _/ _/
- _/ _/ _/_/ _/ _/ _/_/_/ _/ _/_/_/_/ _/_/
- _/ _/_/ _/ _/ _/_/ _/_/ _/ _/ _/_/_/_/
-_/ _/ _/ _/ _/_/ _/ _/ _/ _/
- _/_/_/ _/ _/_/_/ _/_/_/ _/_/_/ _/ _/_/ _/_/_/
- _/
- _/_/
-HEREDOC
-
SPLASH_3 = <<-HEREDOC
@@@@@@@ @@@@@@@ @@@ @@@ @@@@@@ @@@@@@ @@@ @@@@@@@ @@@@@@@@
- !@@ @@! @@@ @@! !@@ !@@ !@@ @@! @@! @@!
- !@! @!@!!@! !@!@! !@@!! !@@!! !!@ @!! @!!!:!
- :!! !!: :!! !!: !:! !:! !!: !!: !!:
+ !@@ @@! @@@ @@! !@@ !@@ !@@ @@! @@! @@!#{' '}
+ !@! @!@!!@! !@!@! !@@!! !@@!! !!@ @!! @!!!:!#{' '}
+ :!! !!: :!! !!: !:! !:! !!: !!: !!:#{' '}
:: :: : : : : .: ::.: : ::.: : : : : :: :::
-HEREDOC
+ HEREDOC
- SPLASH_4 = <<-HEREDOC
- ██████╗██████╗ ██╗ ██╗███████╗███████╗██╗████████╗███████╗
-██╔════╝██╔══██╗╚██╗ ██╔╝██╔════╝██╔════╝██║╚══██╔══╝██╔════╝
-██║ ██████╔╝ ╚████╔╝ ███████╗███████╗██║ ██║ █████╗
-██║ ██╔══██╗ ╚██╔╝ ╚════██║╚════██║██║ ██║ ██╔══╝
-╚██████╗██║ ██║ ██║ ███████║███████║██║ ██║ ███████╗
- ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚══════╝
-HEREDOC
+ SPLASH_4 = <<~HEREDOC
+ ██████╗██████╗ ██╗ ██╗███████╗███████╗██╗████████╗███████╗
+ ██╔════╝██╔══██╗╚██╗ ██╔╝██╔════╝██╔════╝██║╚══██╔══╝██╔════╝
+ ██║ ██████╔╝ ╚████╔╝ ███████╗███████╗██║ ██║ █████╗#{' '}
+ ██║ ██╔══██╗ ╚██╔╝ ╚════██║╚════██║██║ ██║ ██╔══╝#{' '}
+ ╚██████╗██║ ██║ ██║ ███████║███████║██║ ██║ ███████╗
+ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚══════╝
+ HEREDOC
- SPLASH_5 = <<-HEREDOC
- █████████ █████████ ███ █████
- ███░░░░░███ ███░░░░░███ ░░░ ░░███
- ███ ░░░ ████████ █████ ████ █████ ░███ ░░░ ████ ███████ ██████
-░███ ░░███░░███░░███ ░███ ███░░ ░░█████████ ░░███ ░░░███░ ███░░███
-░███ ░███ ░░░ ░███ ░███ ░░█████ ░░░░░░░░███ ░███ ░███ ░███████
-░░███ ███ ░███ ░███ ░███ ░░░░███ ███ ░███ ░███ ░███ ███░███░░░
- ░░█████████ █████ ░░███████ ██████ ░░█████████ █████ ░░█████ ░░██████
- ░░░░░░░░░ ░░░░░ ░░░░░███ ░░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░
- ███ ░███
- ░░██████
- ░░░░░░
-HEREDOC
+ SPLASH_5 = <<~HEREDOC
+ █████████ █████████ ███ █████#{' '}
+ ███░░░░░███ ███░░░░░███ ░░░ ░░███#{' '}
+ ███ ░░░ ████████ █████ ████ █████ ░███ ░░░ ████ ███████ ██████#{' '}
+ ░███ ░░███░░███░░███ ░███ ███░░ ░░█████████ ░░███ ░░░███░ ███░░███
+ ░███ ░███ ░░░ ░███ ░███ ░░█████ ░░░░░░░░███ ░███ ░███ ░███████#{' '}
+ ░░███ ███ ░███ ░███ ░███ ░░░░███ ███ ░███ ░███ ░███ ███░███░░░#{' '}
+ ░░█████████ █████ ░░███████ ██████ ░░█████████ █████ ░░█████ ░░██████#{' '}
+ ░░░░░░░░░ ░░░░░ ░░░░░███ ░░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░#{' '}
+ ███ ░███#{' '}
+ ░░██████#{' '}
+ ░░░░░░#{' '}
+ HEREDOC
- SPLASH_6 = <<-HEREDOC
- ▄▀▄▄▄▄ ▄▀▀▄▀▀▀▄ ▄▀▀▄ ▀▀▄ ▄▀▀▀▀▄ ▄▀▀▀▀▄ ▄▀▀█▀▄ ▄▀▀▀█▀▀▄ ▄▀▀█▄▄▄▄
-█ █ ▌ █ █ █ █ ▀▄ ▄▀ █ █ ▐ █ █ ▐ █ █ █ █ █ ▐ ▐ ▄▀ ▐
-▐ █ ▐ █▀▀█▀ ▐ █ ▀▄ ▀▄ ▐ █ ▐ ▐ █ █▄▄▄▄▄
- █ ▄▀ █ █ ▀▄ █ ▀▄ █ █ █ █ ▌
- ▄▀▄▄▄▄▀ █ █ ▄▀ █▀▀▀ █▀▀▀ ▄▀▀▀▀▀▄ ▄▀ ▄▀▄▄▄▄
-█ ▐ ▐ ▐ █ ▐ ▐ █ █ █ █ ▐
-▐ ▐ ▐ ▐ ▐ ▐
-HEREDOC
-
- SPLASH_7 = <<-HEREDOC
-:'######::'########::'##:::'##::'######:::'######::'####:'########:'########:
-'##... ##: ##.... ##:. ##:'##::'##... ##:'##... ##:. ##::... ##..:: ##.....::
- ##:::..:: ##:::: ##::. ####::: ##:::..:: ##:::..::: ##::::: ##:::: ##:::::::
- ##::::::: ########::::. ##::::. ######::. ######::: ##::::: ##:::: ######:::
- ##::::::: ##.. ##:::::: ##:::::..... ##::..... ##:: ##::::: ##:::: ##...::::
- ##::: ##: ##::. ##::::: ##::::'##::: ##:'##::: ##:: ##::::: ##:::: ##:::::::
-. ######:: ##:::. ##:::: ##::::. ######::. ######::'####:::: ##:::: ########:
-:......:::..:::::..:::::..::::::......::::......:::....:::::..:::::........::
-HEREDOC
+ SPLASH_6 = <<~HEREDOC
+ ▄▀▄▄▄▄ ▄▀▀▄▀▀▀▄ ▄▀▀▄ ▀▀▄ ▄▀▀▀▀▄ ▄▀▀▀▀▄ ▄▀▀█▀▄ ▄▀▀▀█▀▀▄ ▄▀▀█▄▄▄▄#{' '}
+ █ █ ▌ █ █ █ █ ▀▄ ▄▀ █ █ ▐ █ █ ▐ █ █ █ █ █ ▐ ▐ ▄▀ ▐#{' '}
+ ▐ █ ▐ █▀▀█▀ ▐ █ ▀▄ ▀▄ ▐ █ ▐ ▐ █ █▄▄▄▄▄#{' '}
+ █ ▄▀ █ █ ▀▄ █ ▀▄ █ █ █ █ ▌#{' '}
+ ▄▀▄▄▄▄▀ █ █ ▄▀ █▀▀▀ █▀▀▀ ▄▀▀▀▀▀▄ ▄▀ ▄▀▄▄▄▄#{' '}
+ █ ▐ ▐ ▐ █ ▐ ▐ █ █ █ █ ▐#{' '}
+ ▐ ▐ ▐ ▐ ▐ ▐#{' '}
+ HEREDOC
+ SPLASH_7 = <<~HEREDOC
+ :'######::'########::'##:::'##::'######:::'######::'####:'########:'########:
+ '##... ##: ##.... ##:. ##:'##::'##... ##:'##... ##:. ##::... ##..:: ##.....::
+ ##:::..:: ##:::: ##::. ####::: ##:::..:: ##:::..::: ##::::: ##:::: ##:::::::
+ ##::::::: ########::::. ##::::. ######::. ######::: ##::::: ##:::: ######:::
+ ##::::::: ##.. ##:::::: ##:::::..... ##::..... ##:: ##::::: ##:::: ##...::::
+ ##::: ##: ##::. ##::::: ##::::'##::: ##:'##::: ##:: ##::::: ##:::: ##:::::::
+ . ######:: ##:::. ##:::: ##::::. ######::. ######::'####:::: ##:::: ########:
+ :......:::..:::::..:::::..::::::......::::......:::....:::::..:::::........::
+ HEREDOC
SPLASH = [
SPLASH_1,
@@ -83,12 +84,11 @@ HEREDOC
SPLASH_4,
SPLASH_5,
SPLASH_6,
- SPLASH_7,
- ]
+ SPLASH_7
+ ].freeze
def print_splash
puts SPLASH.sample
end
-
end
end
diff --git a/new/bin/server.rb b/new/bin/server.rb
index 8133623a..d1e85ddd 100755
--- a/new/bin/server.rb
+++ b/new/bin/server.rb
@@ -1,31 +1,31 @@
-require "launchy"
+# frozen_string_literal: true
-require_relative "../lib/crys"
-require_relative "mixins/splash.rb"
+require 'launchy'
+require_relative '../lib/crys'
+require_relative 'mixins/splash'
module Crys
class ServerRunner
-
include Splash
-
+
def initialize(server_class:, root:, section:)
@root = File.expand_path root
@server = server_class.new(root: root)
@section = section
end
- def serve
- puts ""
- print_splash
- puts "Hello mms to \e[1m" + section + "\e[22m"
- puts "Serving from: " + root
- puts ""
- server.start
+ def serve
+ puts ''
+ print_splash
+ puts "Hello mms to \e[1m#{section}\e[22m"
+ puts "Serving from: #{root}"
+ puts ''
+ server.start
end
private
attr_reader :root, :server, :section
end
-end
+end