bhook 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +17 -4
- data/Rakefile +1 -1
- data/bin/bhook +16 -5
- data/lib/bhook/args_parser.rb +19 -4
- data/lib/bhook/converter/html.rb +10 -3
- data/lib/bhook/directory.rb +8 -3
- data/lib/bhook/root_directory.rb +20 -0
- data/lib/bhook/theme/page.erb +119 -73
- data/lib/bhook/version.rb +1 -1
- data/lib/bhook/workspace.rb +1 -7
- data/lib/bhook/workspaces.rb +29 -0
- data/lib/bhook.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90521640ce67d31a8e080b88cb860559033426b3afc55f1a03d09d42d0a415c5
|
4
|
+
data.tar.gz: f10067505bfdaa6c8e6bc4892340bd07d6937c0882b5472772f815705ca463ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee03d8c7ea7a5e39db17acbf3638dcf53c3d2f37a55b897e6800ca24a0dde2efd4037806619438ea8097781a7c75e15de6a5a34bb25c7693cdd1b98f069f4193
|
7
|
+
data.tar.gz: 94bf726b2a6a3afb8490f172a01f992ea8bfd063a54ed2143b3ace48c644c15b93c5b5faf2a68f110b0a04a79bbed7b167846a60ec44e7bb206c1d24e5d5cfb3
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -9,11 +9,15 @@
|
|
9
9
|
|
10
10
|
Bhook is a static website generator that works off a git repo containing a markdown file based wiki, like for example, the [India Startup Wiki](https://gitlab.com/india-startups/wiki).
|
11
11
|
|
12
|
+
Since you control the source markdown, Bhook applies no restrictions on what you can put in there. Wanna embed a YouTube video in an `iframe`? Sure thing!
|
13
|
+
|
12
14
|
I use this to create [HTML versions of the wiki](https://sidu.in/wiki/startups) and of [my essays](https://sidu.in/essays/) that I can publish.
|
13
15
|
|
14
16
|
## Installation
|
15
17
|
|
16
|
-
|
18
|
+
`bhook` requires [`ruby`](https://www.ruby-lang.org/en/documentation/installation/). If you are on OSX or Linux, it is likely to already be installed.
|
19
|
+
|
20
|
+
To install `bhook` run:
|
17
21
|
|
18
22
|
$ gem install bhook
|
19
23
|
|
@@ -22,7 +26,7 @@ Install it yourself as:
|
|
22
26
|
Getting help:
|
23
27
|
|
24
28
|
$ bhook --help
|
25
|
-
Bhook version 0.
|
29
|
+
Bhook version 0.3.0
|
26
30
|
Usage: bhook --source /source/path --output /output/path
|
27
31
|
-s, --source=SOURCE Path to version controlled directory containing source md files
|
28
32
|
-o, --output=OUTPUT Path to directory where output files are to be generated
|
@@ -33,11 +37,20 @@ Getting help:
|
|
33
37
|
--benchmark Run a performance benchmark for the specified source
|
34
38
|
-h, --help Prints this help
|
35
39
|
|
36
|
-
|
40
|
+
### 1-to-1 mode
|
37
41
|
|
38
42
|
➜ essays git:(main) ✗ bhook -s . -o /tmp/out -t /tmp/out/theme -w -v
|
39
43
|
|
40
|
-
Here's an example `.bhook.yml` [config file](https://gitlab.com/india-startups/wiki/-/blob/master/.bhook.yml).
|
44
|
+
Here's an example `.bhook.yml` [config file](https://gitlab.com/india-startups/wiki/-/blob/master/.bhook.yml) for a source directory.
|
45
|
+
|
46
|
+
### n-to-1 mode
|
47
|
+
|
48
|
+
This requires the destination directory to have a `bhook.yml` config file set up that describes all the sources.
|
49
|
+
|
50
|
+
➜ kaiwren.github.com git:(main) ✗ bhook -w -v
|
51
|
+
|
52
|
+
Here's an example `.bhook.yml` [config file](https://github.com/kaiwren/kaiwren.github.com/blob/master/.bhook.yml) for a destination directory
|
53
|
+
with multiple source directories.
|
41
54
|
|
42
55
|
## Development
|
43
56
|
|
data/Rakefile
CHANGED
data/bin/bhook
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'bundler/setup'
|
5
|
-
|
5
|
+
require_relative File.join('..', 'lib', 'bhook')
|
6
6
|
|
7
7
|
puts "Bhook version #{Bhook::VERSION}"
|
8
8
|
parser = Bhook::ArgsParser.new(ARGV)
|
@@ -15,24 +15,35 @@ if args.help
|
|
15
15
|
exit
|
16
16
|
end
|
17
17
|
|
18
|
+
Bhook::L.level = args.verbose ? Logger::DEBUG : Logger::INFO
|
19
|
+
|
18
20
|
if args.generate_theme
|
19
21
|
Bhook::L.level = Logger::DEBUG
|
20
22
|
Bhook::ThemeGenerator.new(args.generate_theme).generate!
|
21
23
|
exit
|
22
24
|
end
|
23
25
|
|
24
|
-
|
26
|
+
workspaces = Bhook::Workspaces.new
|
25
27
|
|
26
|
-
|
28
|
+
if args.mount
|
29
|
+
args.mount.each do |project, from_to|
|
30
|
+
from = File.expand_path(from_to['from'])
|
31
|
+
to = File.expand_path(from_to['to'])
|
32
|
+
Bhook::L.debug "Mounting: #{project} \n\tfrom #{from} \n\tto #{to}"
|
33
|
+
workspaces.mount(Bhook::Workspace.new(from, to, args.theme))
|
34
|
+
end
|
35
|
+
else
|
36
|
+
workspaces.mount(Bhook::Workspace.new(args.source, args.output, args.theme))
|
37
|
+
end
|
27
38
|
|
28
39
|
if args.benchmark
|
29
40
|
require 'benchmark'
|
30
41
|
n = 10
|
31
42
|
Benchmark.bmbm do |bench|
|
32
43
|
Bhook::L.level = Logger::WARN
|
33
|
-
bench.report("Generate HTML #{n} times") { n.times {
|
44
|
+
bench.report("Generate HTML #{n} times") { n.times { workspaces.each(&:process!) } }
|
34
45
|
end
|
35
46
|
exit
|
36
47
|
end
|
37
48
|
|
38
|
-
args.watch ?
|
49
|
+
args.watch ? workspaces.watch! : workspaces.process!
|
data/lib/bhook/args_parser.rb
CHANGED
@@ -5,25 +5,29 @@ module Bhook
|
|
5
5
|
class ArgsParser
|
6
6
|
extend T::Sig
|
7
7
|
|
8
|
-
Options = Struct.new(:source, :output, :watch, :verbose, :theme, :generate_theme, :benchmark, :help)
|
8
|
+
Options = Struct.new(:source, :output, :watch, :verbose, :theme, :generate_theme, :benchmark, :mount, :help)
|
9
9
|
|
10
10
|
def initialize(argv)
|
11
|
-
@args = Options.new(nil, nil, false, false, Bhook::THEME_DIR_PATH, nil, false, false)
|
11
|
+
@args = Options.new(nil, nil, false, false, Bhook::THEME_DIR_PATH, nil, false, nil, false)
|
12
12
|
@argv = argv.clone
|
13
13
|
@opt_parser = build_opt_parser
|
14
14
|
end
|
15
15
|
|
16
16
|
def parse
|
17
|
+
if (mount = detect_and_read_mount_args_from_config_in_pwd)
|
18
|
+
@args.mount = mount
|
19
|
+
end
|
20
|
+
|
17
21
|
begin
|
18
22
|
@opt_parser.parse(@argv)
|
19
|
-
if generate_theme_missing? && help_missing? &&
|
23
|
+
if generate_theme_missing? && help_missing? &&
|
24
|
+
source_or_output_paths_missing? && mount_config_missing?
|
20
25
|
raise OptionParser::MissingArgument, 'See --help.'
|
21
26
|
end
|
22
27
|
rescue OptionParser::ParseError => e
|
23
28
|
puts "\nError! #{e.message}\n"
|
24
29
|
return nil
|
25
30
|
end
|
26
|
-
|
27
31
|
@args
|
28
32
|
end
|
29
33
|
|
@@ -33,6 +37,17 @@ module Bhook
|
|
33
37
|
|
34
38
|
private
|
35
39
|
|
40
|
+
def detect_and_read_mount_args_from_config_in_pwd
|
41
|
+
bhook_config_path = File.join(Dir.pwd, Config::BHOOK_CONFIG_FILE)
|
42
|
+
return unless File.exist?(bhook_config_path)
|
43
|
+
|
44
|
+
YAML.safe_load(File.read(bhook_config_path))['mount']
|
45
|
+
end
|
46
|
+
|
47
|
+
def mount_config_missing?
|
48
|
+
!@args.mount
|
49
|
+
end
|
50
|
+
|
36
51
|
def help_missing?
|
37
52
|
!@args.help
|
38
53
|
end
|
data/lib/bhook/converter/html.rb
CHANGED
@@ -24,21 +24,28 @@ module Bhook
|
|
24
24
|
|
25
25
|
sig { params(el: Kramdown::Element, indent: Integer).returns(String) }
|
26
26
|
def convert_header(el, indent)
|
27
|
-
header = super(el, indent)
|
28
27
|
src_title = el.options[:raw_text]
|
29
28
|
after_h1_html = @options[:after_h1_strategy].call(binding)
|
30
29
|
|
31
30
|
level = output_header_level(el.options[:level])
|
32
31
|
if level == 1
|
33
32
|
@options[:h1_callback].call(src_title)
|
34
|
-
"#{
|
33
|
+
"#{super(el, indent)}#{' ' * indent}#{after_h1_html}"
|
35
34
|
else
|
36
|
-
|
35
|
+
insert_anchor_into_header!(el)
|
36
|
+
super(el, indent)
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
private
|
41
41
|
|
42
|
+
sig { params(el: Kramdown::Element).void }
|
43
|
+
def insert_anchor_into_header!(el)
|
44
|
+
el.attr['id'] = generate_id(el.options[:raw_text]) if @options[:auto_ids] && !el.attr['id']
|
45
|
+
anchor = Kramdown::Element.new(:a, '', { 'href' => "##{el.attr['id']}", 'class' => 'header-anchor' })
|
46
|
+
el.children << anchor
|
47
|
+
end
|
48
|
+
|
42
49
|
sig { params(href_path: String).returns(T::Boolean) }
|
43
50
|
def valid_relative_md_link?(href_path)
|
44
51
|
(href_path.end_with?('.md') || href_path.include?('.md#')) &&
|
data/lib/bhook/directory.rb
CHANGED
@@ -8,15 +8,15 @@ module Bhook
|
|
8
8
|
GIT_DIR = '.git'
|
9
9
|
MD_EXT = '.md'
|
10
10
|
|
11
|
-
sig { params(src_path: Pathname, out_path: Pathname).returns(Bhook::
|
11
|
+
sig { params(src_path: Pathname, out_path: Pathname).returns(Bhook::RootDirectory) }
|
12
12
|
def self.new_root_directory(src_path, out_path)
|
13
|
-
new(src_path, out_path
|
13
|
+
RootDirectory.new(src_path, out_path)
|
14
14
|
end
|
15
15
|
|
16
16
|
sig { params(src_path: Pathname, out_path: Pathname, git: Git::Base, config: Bhook::Config).void }
|
17
17
|
def initialize(src_path, out_path, git, config)
|
18
18
|
@src_path = src_path
|
19
|
-
@out_path = T.let(
|
19
|
+
@out_path = T.let(build_out_path(src_path, out_path), Pathname)
|
20
20
|
@git = git
|
21
21
|
@config = config
|
22
22
|
@sub_dirs = T.let([], T::Array[Directory])
|
@@ -46,6 +46,11 @@ module Bhook
|
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
+
sig { params(src_path: Pathname, out_path: Pathname).returns(Pathname) }
|
50
|
+
def build_out_path(src_path, out_path)
|
51
|
+
out_path.join(src_path.basename)
|
52
|
+
end
|
53
|
+
|
49
54
|
sig { void }
|
50
55
|
def build_next_level_nodes
|
51
56
|
children = @src_path.children
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bhook
|
5
|
+
class RootDirectory < Directory
|
6
|
+
extend T::Sig
|
7
|
+
|
8
|
+
sig { params(src_path: Pathname, out_path: Pathname).void }
|
9
|
+
def initialize(src_path, out_path)
|
10
|
+
super(src_path, out_path, Git.open(src_path), Bhook::Config.new(src_path))
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
sig { params(_src_path: Pathname, out_path: Pathname).returns(Pathname) }
|
16
|
+
def build_out_path(_src_path, out_path)
|
17
|
+
out_path
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/bhook/theme/page.erb
CHANGED
@@ -1,82 +1,128 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html lang="en">
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
7
|
+
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
|
8
|
+
<link href='https://fonts.googleapis.com/css?family=Fira+Sans' rel='stylesheet' type='text/css'>
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
h2, h5 {
|
19
|
-
margin-bottom: 0.5em;
|
20
|
-
}
|
21
|
-
|
22
|
-
.after-h1 {
|
23
|
-
border-bottom: 1px solid #bbbbbb;
|
24
|
-
margin-bottom: 1.5em;
|
25
|
-
}
|
26
|
-
|
27
|
-
.footer {
|
28
|
-
margin: 0.5em 0 1.5em 0;
|
29
|
-
}
|
30
|
-
|
31
|
-
table {
|
32
|
-
margin: 0.5em 0 0.5em 0.5em;
|
33
|
-
}
|
34
|
-
|
35
|
-
table thead tr {
|
36
|
-
background: #eeeeee;
|
37
|
-
}
|
38
|
-
|
39
|
-
table td, table th {
|
40
|
-
padding: 0.1em 1em 0.1em 1em;
|
41
|
-
border: 1px solid #bbbbbb;
|
42
|
-
}
|
10
|
+
<!-- Bootstrap -->
|
11
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
12
|
+
<style>
|
13
|
+
body {
|
14
|
+
font-family: 'Fira Sans', sans-serif;
|
15
|
+
color: #000000;
|
16
|
+
}
|
43
17
|
|
44
|
-
|
18
|
+
h2, h3, h4, h5 {
|
19
|
+
margin-bottom: 0.5em;
|
20
|
+
margin-top: 0.5em;
|
21
|
+
}
|
22
|
+
|
23
|
+
h2 {
|
24
|
+
border-bottom: 1px solid #eaeaea;
|
25
|
+
}
|
26
|
+
|
27
|
+
h2 a.header-anchor, h3 a.header-anchor,
|
28
|
+
h4 a.header-anchor, h5 a.header-anchor {
|
29
|
+
float: left;
|
30
|
+
margin-left: -20px;
|
31
|
+
text-decoration: none;
|
32
|
+
outline: none;
|
33
|
+
position: relative;
|
34
|
+
}
|
35
|
+
|
36
|
+
h2 a.header-anchor:after, h3 a.header-anchor:after,
|
37
|
+
h4 a.header-anchor:after, h5 a.header-anchor:after {
|
38
|
+
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23333' fill-rule='evenodd' d='M9.683 6.676l-.047-.048C8.27 5.26 6.07 5.243 4.726 6.588l-2.29 2.29c-1.344 1.344-1.328 3.544.04 4.91 1.366 1.368 3.564 1.385 4.908.04l1.753-1.752c-.695.074-1.457-.078-2.176-.444L5.934 12.66c-.634.634-1.67.625-2.312-.017-.642-.643-.65-1.677-.017-2.312L6.035 7.9c.634-.634 1.67-.625 2.312.017.024.024.048.05.07.075l.003-.002c.36.36.943.366 1.3.01.355-.356.35-.938-.01-1.3l-.027-.024zM6.58 9.586l.048.05c1.367 1.366 3.565 1.384 4.91.04l2.29-2.292c1.344-1.343 1.328-3.542-.04-4.91-1.366-1.366-3.564-1.384-4.908-.04L7.127 4.187c.695-.074 1.457.078 2.176.444l1.028-1.027c.635-.634 1.67-.624 2.313.017.643.644.652 1.678.018 2.312l-2.43 2.432c-.635.634-1.67.624-2.313-.018-.024-.024-.048-.05-.07-.075l-.003.004c-.36-.362-.943-.367-1.3-.01-.355.355-.35.937.01 1.3.01.007.018.015.027.023z'/%3E%3C/svg%3E");
|
39
|
+
box-sizing: border-box;
|
40
|
+
font-size: medium;
|
41
|
+
visibility: hidden;
|
42
|
+
}
|
43
|
+
|
44
|
+
h2:hover a.header-anchor:after, h3:hover a.header-anchor:after,
|
45
|
+
h4:hover a.header-anchor:after, h5:hover a.header-anchor:after {
|
46
|
+
visibility: visible;
|
47
|
+
}
|
48
|
+
|
49
|
+
div.after-h1 {
|
50
|
+
border-bottom: 1px solid #bbbbbb;
|
51
|
+
margin-bottom: 1.5em;
|
52
|
+
}
|
53
|
+
|
54
|
+
div.youtube-video {
|
55
|
+
margin: 1em 0 1em 0;
|
56
|
+
width: 100%;
|
57
|
+
justify-content: center;
|
58
|
+
display: flex;
|
59
|
+
}
|
60
|
+
|
61
|
+
div.content {
|
62
|
+
}
|
63
|
+
|
64
|
+
div.footer {
|
65
|
+
margin: 0.5em 0 0.5em 0;
|
66
|
+
}
|
67
|
+
|
68
|
+
div.bhook-cta a {
|
69
|
+
font-size: x-small;
|
70
|
+
text-decoration: none;
|
71
|
+
margin-bottom: 1.5em;
|
72
|
+
color: #bbbbbb;
|
73
|
+
}
|
74
|
+
|
75
|
+
table {
|
76
|
+
margin: 0.5em 0 1em 0.5em;
|
77
|
+
}
|
78
|
+
|
79
|
+
table thead tr {
|
80
|
+
background: #eeeeee;
|
81
|
+
}
|
82
|
+
|
83
|
+
table td, table th {
|
84
|
+
padding: 0.1em 1em 0.1em 1em;
|
85
|
+
border: 1px solid #bbbbbb;
|
86
|
+
}
|
87
|
+
|
88
|
+
blockquote {
|
45
89
|
border-left: 10px solid #cccccc;
|
46
90
|
background: #eeeeee;
|
47
91
|
display: inline-block;
|
48
92
|
padding: 1em;
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
<%
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
</
|
93
|
+
}
|
94
|
+
</style>
|
95
|
+
<!-- Global site tag (gtag.js) - Google Analytics -->
|
96
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-CT9TWBW0WR"></script>
|
97
|
+
<script>
|
98
|
+
window.dataLayer = window.dataLayer || [];
|
99
|
+
function gtag() { dataLayer.push(arguments); }
|
100
|
+
gtag('js', new Date());
|
101
|
+
gtag('config', 'G-CT9TWBW0WR');
|
102
|
+
</script>
|
103
|
+
<title><%= src_title -%></title>
|
104
|
+
</head>
|
105
|
+
<body>
|
106
|
+
<div class="body container">
|
107
|
+
<div class="content row justify-content-center">
|
108
|
+
<div class="col-10">
|
109
|
+
<%= output %>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="footer d-flex justify-content-center">
|
113
|
+
<div>
|
114
|
+
<% short_sha = src_file_sha ? src_file_sha[0..7] : nil -%>
|
115
|
+
<% if file_url && short_sha -%>
|
116
|
+
v. <a href="<%= file_url -%>"><%= short_sha -%></a>,
|
117
|
+
<% elsif short_sha -%>
|
118
|
+
v. <%= short_sha -%>,
|
119
|
+
<% end -%>
|
120
|
+
<%= src_file_date -%> © <a href="https://sidu.in">Sidu Ponnappa</a>
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
<div class="bhook-cta d-flex justify-content-center">
|
124
|
+
<a href="https://gitlab.com/kaiwren/bhook" target="_blank">powered by bhook</a>
|
125
|
+
</div>
|
126
|
+
</div>
|
127
|
+
</body>
|
82
128
|
</html>
|
data/lib/bhook/version.rb
CHANGED
data/lib/bhook/workspace.rb
CHANGED
@@ -28,19 +28,13 @@ module Bhook
|
|
28
28
|
process!
|
29
29
|
end
|
30
30
|
listener.start
|
31
|
-
sleep
|
32
|
-
end
|
33
|
-
|
34
|
-
sig { returns(T::Array[MdFile]) }
|
35
|
-
def all_md_files
|
36
|
-
root_dir.all_md_files
|
37
31
|
end
|
38
32
|
|
39
33
|
private
|
40
34
|
|
41
35
|
sig { returns(Bhook::Directory) }
|
42
36
|
def root_dir
|
43
|
-
|
37
|
+
RootDirectory.new(@src_path, @out_path)
|
44
38
|
end
|
45
39
|
end
|
46
40
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Bhook
|
5
|
+
class Workspaces
|
6
|
+
extend T::Sig
|
7
|
+
|
8
|
+
sig { void }
|
9
|
+
def initialize
|
10
|
+
@workspaces = T.let([], T::Array[Bhook::Workspace])
|
11
|
+
end
|
12
|
+
|
13
|
+
sig { params(workspace: Workspace).void }
|
14
|
+
def mount(workspace)
|
15
|
+
@workspaces << workspace
|
16
|
+
end
|
17
|
+
|
18
|
+
sig { void }
|
19
|
+
def process!
|
20
|
+
@workspaces.each(&:process!)
|
21
|
+
end
|
22
|
+
|
23
|
+
sig { void }
|
24
|
+
def watch!
|
25
|
+
@workspaces.each(&:watch!)
|
26
|
+
Kernel.sleep
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/bhook.rb
CHANGED
@@ -32,5 +32,7 @@ require_relative 'bhook/theme_generator'
|
|
32
32
|
require_relative 'bhook/theme'
|
33
33
|
require_relative 'bhook/converter/html'
|
34
34
|
require_relative 'bhook/directory'
|
35
|
+
require_relative 'bhook/root_directory'
|
35
36
|
require_relative 'bhook/md_file'
|
36
37
|
require_relative 'bhook/workspace'
|
38
|
+
require_relative 'bhook/workspaces'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bhook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sidu Ponnappa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -202,12 +202,14 @@ files:
|
|
202
202
|
- lib/bhook/directory.rb
|
203
203
|
- lib/bhook/logger.rb
|
204
204
|
- lib/bhook/md_file.rb
|
205
|
+
- lib/bhook/root_directory.rb
|
205
206
|
- lib/bhook/theme.rb
|
206
207
|
- lib/bhook/theme/_after_h1.erb
|
207
208
|
- lib/bhook/theme/page.erb
|
208
209
|
- lib/bhook/theme_generator.rb
|
209
210
|
- lib/bhook/version.rb
|
210
211
|
- lib/bhook/workspace.rb
|
212
|
+
- lib/bhook/workspaces.rb
|
211
213
|
- sorbet/config
|
212
214
|
- sorbet/rbi/gems/ast.rbi
|
213
215
|
- sorbet/rbi/gems/bhook.rbi
|