ottogen 0.0.1

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: a2eb6447d57749b9791d6750ae91aca7e688ce702d79002079161cc392e5c287
4
+ data.tar.gz: 393f728aaa88704edc336b1a4786af955e2d89b4ffb4ff6acf3243cdf92c00fb
5
+ SHA512:
6
+ metadata.gz: 91a077bb079ff03b3990bae8f97f0df6f5c69580736645728e22c68a6f20feadb53703ffaeda755c1387e14d1fa3141662eb6fbe7099ae8204d484e43333d0a7
7
+ data.tar.gz: 31d730da327381cd321932521cab67799ee389738ff1618f1ea0ceb4052a5943239cbbee2c92f887dd13eca56f761934fc5724684c9f5bda6f85a7887cb3e67b
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2022 Ian Johnson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # Otto
2
+
3
+ AsciiDoc static site generator.
4
+
5
+ # Quickstart
6
+
7
+ **Install Otto**
8
+
9
+ ``` sh
10
+ gem install ottogen
11
+ ```
12
+
13
+ **Initialize a new site**
14
+
15
+ ``` sh
16
+ mkdir mysite && cd mysite
17
+ otto init
18
+ ```
19
+
20
+ **Build the site**
21
+
22
+ ``` sh
23
+ otto build
24
+ ```
25
+
26
+ **Serve the site**
27
+
28
+ ``` sh
29
+ otto serve
30
+ ```
31
+
32
+ **View the site**
33
+
34
+ ``` sh
35
+ open http://127.0.0.1:8778/
36
+ ```
37
+
38
+ # AsciiDoc Crash Course
39
+
40
+ TODO
41
+
42
+ **Paragraphs**
43
+
44
+ **Text formatting**
45
+
46
+ **Links**
47
+
48
+ **Document header**
49
+
50
+ **Section titles**
51
+
52
+ **Automatic TOC**
53
+
54
+ **Includes**
55
+
56
+ **Lists**
57
+
58
+ **Images**
59
+
60
+ **Audio**
61
+
62
+ **Videos**
63
+
64
+ **Keyboard, button, and menu macros**
65
+
66
+ **Literals and source code**
67
+
68
+ **Admonitions**
69
+
70
+ **More delimited blocks**
71
+
72
+ **Tables**
73
+
74
+ **IDs, roles, and options**
data/bin/otto ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/ottogen/otto'
4
+
5
+ Ottogen::Otto.start(ARGV)
@@ -0,0 +1,35 @@
1
+ require 'thor'
2
+ require 'webrick'
3
+ require_relative './ottogen'
4
+
5
+ module Ottogen
6
+ class Otto < Thor
7
+ desc "init", "Initialize static site"
8
+ def init
9
+ Ottogen.init
10
+ end
11
+
12
+ desc "build", "Build the static site"
13
+ def build
14
+ Ottogen.build
15
+ end
16
+
17
+ desc "clean", "Clean the static site"
18
+ def clean
19
+ Ottogen.clean
20
+ end
21
+
22
+ desc "watch", "Watch changes to static site"
23
+ def watch
24
+ Ottogen.watch
25
+ end
26
+
27
+ desc "serve", "Serve the static site"
28
+ def serve
29
+ root = File.expand_path("#{Dir.pwd}/#{Ottogen::BUILD_DIR}")
30
+ server = WEBrick::HTTPServer.new :Port => 8778, :DocumentRoot => root
31
+ trap 'INT' do server.shutdown end
32
+ server.start
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,51 @@
1
+ require 'asciidoctor'
2
+ require 'fileutils'
3
+ require 'listen'
4
+
5
+ module Ottogen
6
+ class Ottogen
7
+ BUILD_DIR = '_build'.freeze
8
+ WELCOME = <<~ADOC
9
+ = Welcome to Otto!
10
+
11
+ Otto is a static site generator that uses AsciiDoc as a markup language.
12
+ ADOC
13
+
14
+ def self.init
15
+ puts "✨ ..."
16
+ File.write("index.adoc", WELCOME)
17
+ puts "✅"
18
+ end
19
+
20
+ def self.build
21
+ puts "🔨 ..."
22
+ Dir.mkdir(BUILD_DIR) unless Dir.exist?(BUILD_DIR)
23
+ Dir.glob('**/*.adoc').map do |name|
24
+ name.split('.').first
25
+ end.each do |doc|
26
+ Asciidoctor.convert_file "#{doc}.adoc",
27
+ safe: :safe,
28
+ mkdirs: true,
29
+ to_file: "#{BUILD_DIR}/#{doc}.html"
30
+ end
31
+ puts "✅"
32
+ end
33
+
34
+ def self.clean
35
+ puts "🧽 ..."
36
+ return unless Dir.exist?(BUILD_DIR)
37
+ FileUtils.rmtree(BUILD_DIR)
38
+ puts "✅"
39
+ end
40
+
41
+ def self.watch
42
+ puts "👀 Watching files..."
43
+ listener = Listen.to(Dir.pwd, ignore: [/_build/]) do |modified, added, removed|
44
+ puts(modified: modified, added: added, removed: removed)
45
+ build
46
+ end
47
+ listener.start
48
+ sleep
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,9 @@
1
+ require 'ottogen/ottogen'
2
+
3
+ module Ottogen
4
+ describe Ottogen do
5
+ it 'works' do
6
+ expect(1).to eq(1)
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ottogen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ian Johnson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-10-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rspec
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: |
28
+ # Otto
29
+
30
+ AsciiDoc static site generator.
31
+
32
+ # Quickstart
33
+
34
+ **Install Otto**
35
+
36
+ ``` sh
37
+ gem install ottogen
38
+ ```
39
+
40
+ **Initialize a new site**
41
+
42
+ ``` sh
43
+ mkdir mysite && cd mysite
44
+ otto init
45
+ ```
46
+
47
+ **Build the site**
48
+
49
+ ``` sh
50
+ otto build
51
+ ```
52
+
53
+ **Serve the site**
54
+
55
+ ``` sh
56
+ otto serve
57
+ ```
58
+
59
+ **View the site**
60
+
61
+ ``` sh
62
+ open http://127.0.0.1:8778/
63
+ ```
64
+
65
+ # AsciiDoc Crash Course
66
+
67
+ TODO
68
+
69
+ **Paragraphs**
70
+
71
+ **Text formatting**
72
+
73
+ **Links**
74
+
75
+ **Document header**
76
+
77
+ **Section titles**
78
+
79
+ **Automatic TOC**
80
+
81
+ **Includes**
82
+
83
+ **Lists**
84
+
85
+ **Images**
86
+
87
+ **Audio**
88
+
89
+ **Videos**
90
+
91
+ **Keyboard, button, and menu macros**
92
+
93
+ **Literals and source code**
94
+
95
+ **Admonitions**
96
+
97
+ **More delimited blocks**
98
+
99
+ **Tables**
100
+
101
+ **IDs, roles, and options**
102
+ email: tacoda@hey.com
103
+ executables:
104
+ - otto
105
+ extensions: []
106
+ extra_rdoc_files: []
107
+ files:
108
+ - LICENSE
109
+ - README.md
110
+ - bin/otto
111
+ - lib/ottogen/otto.rb
112
+ - lib/ottogen/ottogen.rb
113
+ - spec/ottogen/ottogen_spec.rb
114
+ homepage: https://github.com/tacoda/ottogen
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '1.9'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubygems_version: 3.3.3
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: AsciiDoc static site generator
137
+ test_files:
138
+ - spec/ottogen/ottogen_spec.rb