paperwork 0.2.6 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/Rakefile +1 -1
- data/bin/paperwork +6 -0
- data/lib/paperwork.rb +2 -0
- data/lib/paperwork/cli.rb +83 -0
- data/lib/paperwork/tasks/build_file.rb +1 -3
- data/lib/paperwork/tasks/document.rb +14 -15
- data/lib/paperwork/tasks/middleman_template/lib/info_helpers.rb +6 -6
- data/lib/paperwork/tasks/template.rb +7 -7
- data/lib/paperwork/version.rb +1 -1
- data/paperwork.gemspec +1 -0
- data/{site.yml → paperwork.yml} +8 -0
- metadata +19 -6
- data/bin/console +0 -15
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2e693dd5bb169466f35243976c240df90b650c5a026b958fb2ad359362b97da
|
4
|
+
data.tar.gz: 47d925596e691ea695051d32196b20d2f1f4af1bd4cbf52c828090c7904da41e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7743a376ef7a4cbacc04d71770622c4363a503a2396ec6135522b8fe266ecd774913c10af0c46bb561c68c454138daf90e71a8f1fcd2b15c1f554f08abc8f642
|
7
|
+
data.tar.gz: 8d428a9773633ade5b13b79ed1f7d5e98cdd1f480b85a3370d22e36c48c5735155ac240c459c1f25816cf960c26708eaaf1220600021af838bdd7e8e9225df50
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
paperwork (0.
|
4
|
+
paperwork (0.3.4)
|
5
5
|
rake (~> 12.3)
|
6
6
|
redcarpet (~> 3.5.0)
|
7
|
+
thor (~> 1.1.0)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
@@ -51,6 +52,7 @@ GEM
|
|
51
52
|
docile (~> 1.1)
|
52
53
|
simplecov-html (~> 0.11)
|
53
54
|
simplecov-html (0.12.2)
|
55
|
+
thor (1.1.0)
|
54
56
|
unicode-display_width (1.7.0)
|
55
57
|
|
56
58
|
PLATFORMS
|
data/Rakefile
CHANGED
@@ -13,4 +13,4 @@ task rebuild: [:clean, :build]
|
|
13
13
|
task default: :spec
|
14
14
|
CLEAN.include(".work/coverage")
|
15
15
|
|
16
|
-
paperwork :doc, sources: ["README.md", "nested_example/navdemo.md", "
|
16
|
+
paperwork :doc, sources: ["README.md", "nested_example/navdemo.md", "paperwork.yml", "custom.js", "custom.css"]
|
data/bin/paperwork
ADDED
data/lib/paperwork.rb
CHANGED
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
# globla namespace for paperwork
|
5
|
+
#
|
6
|
+
module Paperwork
|
7
|
+
require "yaml"
|
8
|
+
require "thor"
|
9
|
+
require "paperwork"
|
10
|
+
|
11
|
+
##
|
12
|
+
# command line interface for paperwork
|
13
|
+
#
|
14
|
+
class CLI < Thor
|
15
|
+
attr_accessor :config
|
16
|
+
|
17
|
+
CONFIG_FILE = "paperwork.yml"
|
18
|
+
|
19
|
+
class_option :verbose, aliases: "-v", desc: "be verbose about the build", type: :boolean, default: false
|
20
|
+
|
21
|
+
desc "build",
|
22
|
+
<<~DESC
|
23
|
+
creates documentation as defined in
|
24
|
+
#{CONFIG_FILE} and writes it to
|
25
|
+
'#{Paperwork::Config[:build_root]}/<name>/build'
|
26
|
+
DESC
|
27
|
+
def build
|
28
|
+
build_internal "build"
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "rebuild",
|
32
|
+
<<~DESC
|
33
|
+
removes previous builds and creates
|
34
|
+
documentation as defined in
|
35
|
+
#{CONFIG_FILE} and writes it to
|
36
|
+
'#{Paperwork::Config[:build_root]}/<name>/build'
|
37
|
+
DESC
|
38
|
+
def rebuild
|
39
|
+
build_internal "rebuild"
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "server",
|
43
|
+
"starts a aerver that serves documentation as defined in #{CONFIG_FILE}"
|
44
|
+
def server
|
45
|
+
build_internal "server"
|
46
|
+
end
|
47
|
+
|
48
|
+
protected
|
49
|
+
|
50
|
+
def build_internal(task)
|
51
|
+
setup_config
|
52
|
+
setup_tasks
|
53
|
+
invoke_tasks task
|
54
|
+
end
|
55
|
+
|
56
|
+
def setup_config
|
57
|
+
unless File.exist?(CONFIG_FILE)
|
58
|
+
raise Exception.new(
|
59
|
+
"#{CONFIG_FILE} not found. You need to create a configuration file first."
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
yaml = YAML.load_file(CONFIG_FILE)
|
64
|
+
self.config = yaml["config"]
|
65
|
+
self.config["sources"] << CONFIG_FILE
|
66
|
+
|
67
|
+
return unless self.config.nil?
|
68
|
+
|
69
|
+
raise Exception.new(
|
70
|
+
"No 'config' found in #{CONFIG_FILE}. You need to describe the build setup in a 'config' section first."
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def setup_tasks
|
75
|
+
paperwork self.config["name"], sources: self.config["sources"]
|
76
|
+
end
|
77
|
+
|
78
|
+
def invoke_tasks(target)
|
79
|
+
Rake::Task["paperwork:#{self.config["name"]}:set_verbose"].invoke if options[:verbose]
|
80
|
+
Rake::Task["paperwork:#{self.config["name"]}:#{target}"].invoke
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -68,17 +68,16 @@ module Paperwork
|
|
68
68
|
task self.name => self.dependencies do
|
69
69
|
verbose_flag = Paperwork::Config[:verbose] ? " --verbose" : ""
|
70
70
|
Dir.chdir(self.dir) do
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
out: :out,
|
75
|
-
|
76
|
-
|
77
|
-
)
|
71
|
+
cmd = "bundle exec middleman build#{verbose_flag}"
|
72
|
+
if defined? Bundler
|
73
|
+
Bundler.with_unbundled_env do
|
74
|
+
Process.spawn(cmd, out: :out, in: :in, err: :err)
|
75
|
+
end
|
76
|
+
else
|
77
|
+
Process.spawn(cmd, out: :out, in: :in, err: :err)
|
78
78
|
end
|
79
79
|
Process.waitall
|
80
80
|
end
|
81
|
-
|
82
81
|
puts
|
83
82
|
puts "...Done!"
|
84
83
|
puts "build artifacts are located in #{File.join(self.dir, "build")}"
|
@@ -109,13 +108,13 @@ module Paperwork
|
|
109
108
|
desc "start middleman server for editing documents and get visual feedback with live reload"
|
110
109
|
task server: :build do
|
111
110
|
Dir.chdir(self.dir) do
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
out: :out,
|
116
|
-
|
117
|
-
|
118
|
-
)
|
111
|
+
cmd = "bundle exec middleman server"
|
112
|
+
if defined? Bundler
|
113
|
+
Bundler.with_unbundled_env do
|
114
|
+
Process.spawn(cmd, out: :out, in: :in, err: :err)
|
115
|
+
end
|
116
|
+
else
|
117
|
+
Process.spawn(cmd, out: :out, in: :in, err: :err)
|
119
118
|
end
|
120
119
|
puts
|
121
120
|
puts "+---------------------------------------------------------------+"
|
@@ -35,16 +35,16 @@ module InfoHelpers
|
|
35
35
|
relative + stringifyable.to_s
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
data.respond_to?(:
|
38
|
+
def paperwork?
|
39
|
+
data.respond_to?(:paperwork)
|
40
40
|
end
|
41
41
|
|
42
42
|
def navbar?
|
43
|
-
|
43
|
+
paperwork? && data.paperwork.respond_to?(:navbar)
|
44
44
|
end
|
45
45
|
|
46
46
|
def navbar_links
|
47
|
-
nav = data.
|
47
|
+
nav = data.paperwork.navbar.links if navbar?
|
48
48
|
nav ||= {}
|
49
49
|
mapped = {}
|
50
50
|
nav.each do |name, link|
|
@@ -54,10 +54,10 @@ module InfoHelpers
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def navbar_brand
|
57
|
-
data.
|
57
|
+
data.paperwork.navbar.brand if navbar?
|
58
58
|
end
|
59
59
|
|
60
60
|
def footer_text
|
61
|
-
data.
|
61
|
+
data.paperwork.footer if paperwork?
|
62
62
|
end
|
63
63
|
end
|
@@ -28,13 +28,13 @@ module Paperwork
|
|
28
28
|
directory self.name => self.dependencies do
|
29
29
|
cp_r template, self.dir
|
30
30
|
Dir.chdir(self.dir) do
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
out: :out,
|
35
|
-
|
36
|
-
|
37
|
-
)
|
31
|
+
cmd = "bundle install --path=../.bundle/gems --jobs 8 --without test development"
|
32
|
+
if defined? Bundler
|
33
|
+
Bundler.with_unbundled_env do
|
34
|
+
Process.spawn(cmd, out: :out, in: :in, err: :err)
|
35
|
+
end
|
36
|
+
else
|
37
|
+
Process.spawn(cmd, out: :out, in: :in, err: :err)
|
38
38
|
end
|
39
39
|
Process.spawn("yarn install", out: :out, in: :in, err: :err)
|
40
40
|
Process.waitall
|
data/lib/paperwork/version.rb
CHANGED
data/paperwork.gemspec
CHANGED
data/{site.yml → paperwork.yml}
RENAMED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paperwork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Schmid
|
@@ -108,12 +108,25 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 3.5.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: thor
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.1.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.1.0
|
111
125
|
description:
|
112
126
|
email:
|
113
127
|
- couchbelag@gmail.com
|
114
128
|
executables:
|
115
|
-
-
|
116
|
-
- setup
|
129
|
+
- paperwork
|
117
130
|
extensions: []
|
118
131
|
extra_rdoc_files: []
|
119
132
|
files:
|
@@ -127,13 +140,13 @@ files:
|
|
127
140
|
- LICENSE.txt
|
128
141
|
- README.md
|
129
142
|
- Rakefile
|
130
|
-
- bin/
|
131
|
-
- bin/setup
|
143
|
+
- bin/paperwork
|
132
144
|
- custom.css
|
133
145
|
- custom.js
|
134
146
|
- lib/paperwork.rb
|
135
147
|
- lib/paperwork/assets/paperwork/presentation.css
|
136
148
|
- lib/paperwork/assets/presentation.css
|
149
|
+
- lib/paperwork/cli.rb
|
137
150
|
- lib/paperwork/config.rb
|
138
151
|
- lib/paperwork/tasks.rb
|
139
152
|
- lib/paperwork/tasks/base.rb
|
@@ -163,7 +176,7 @@ files:
|
|
163
176
|
- lib/paperwork/version.rb
|
164
177
|
- nested_example/navdemo.md
|
165
178
|
- paperwork.gemspec
|
166
|
-
-
|
179
|
+
- paperwork.yml
|
167
180
|
homepage: https://gitlab.com/couchbelag/paperwork
|
168
181
|
licenses:
|
169
182
|
- MIT
|
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "paperwork"
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
IRB.start(__FILE__)
|