yarrow 0.1.1 → 0.1.2
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 +8 -8
- data/bin/yarrow +8 -0
- data/lib/yarrow/configuration.rb +10 -0
- data/lib/yarrow/console_runner.rb +200 -0
- data/lib/yarrow/defaults.yml +5 -0
- data/lib/yarrow/generator.rb +12 -0
- data/lib/yarrow/version.rb +4 -0
- data/lib/yarrow.rb +7 -0
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDc1MGQ3ZDI2ZWZjYjdmNDllZjJjODQ0ZTAwODE3OTgxOWNlYWZlYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGY5MzUyYzJmYmQxYWE2NTNkZTM0ODIyMjU4MDY0Mzg2MDkwYzZjNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWFiOWVjNDI4ZGYwNTJlMTMxYzRmYTk3YWI1MjI3MWU5Yjk5ZjUwMzBmY2Jl
|
10
|
+
OGJlNmIxMzJhOGUwMTQ1MmEzZGJjZDBlNjUyODI3ZGQwMzEyMDQ5NTgxZTcz
|
11
|
+
MjE4OTcwMGU3M2Y0YTQ4NzBkMjY0OWI3MDViNjE4NDliMTY3ZjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGU4NGQwNGZiNjY1NGM0MzIyNzkwOTkwNWQ5OWVmNjQyNWU1MWU0Yzg5MWVk
|
14
|
+
NzI3YmZhZWEwNmUxMzNlOWVjM2E1Y2IyZWM2NDM3NDA3ZjVkNzI1ZDdiNjc1
|
15
|
+
MWQxNmQxYTQ0YWU1NmYwNzNhNDhhMTdiM2UxNzk5NmRkZjY5NzU=
|
data/bin/yarrow
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
module Yarrow
|
2
|
+
|
3
|
+
class ConsoleRunner
|
4
|
+
|
5
|
+
SUCCESS = 0
|
6
|
+
FAILURE = 1
|
7
|
+
|
8
|
+
ENABLED_OPTIONS = {
|
9
|
+
:h => :help,
|
10
|
+
:v => :version,
|
11
|
+
:c => :config,
|
12
|
+
:t => :theme,
|
13
|
+
}
|
14
|
+
|
15
|
+
ALLOWED_CONFIG_FILES = [
|
16
|
+
'.yarrowdoc',
|
17
|
+
'Yarrowdoc'
|
18
|
+
]
|
19
|
+
|
20
|
+
def initialize(arguments, io=STDOUT)
|
21
|
+
@out = io
|
22
|
+
@arguments = arguments
|
23
|
+
@options = {}
|
24
|
+
@targets = []
|
25
|
+
@config = Configuration.load(File.dirname(__FILE__) + "/defaults.yml")
|
26
|
+
end
|
27
|
+
|
28
|
+
def config
|
29
|
+
@config
|
30
|
+
end
|
31
|
+
|
32
|
+
def run_application
|
33
|
+
print_header
|
34
|
+
|
35
|
+
begin
|
36
|
+
process_arguments
|
37
|
+
|
38
|
+
if has_option?(:version)
|
39
|
+
return SUCCESS
|
40
|
+
end
|
41
|
+
|
42
|
+
if has_option?(:help)
|
43
|
+
print_help
|
44
|
+
return SUCCESS
|
45
|
+
end
|
46
|
+
|
47
|
+
process_configuration
|
48
|
+
|
49
|
+
run_input_process
|
50
|
+
|
51
|
+
run_output_process
|
52
|
+
|
53
|
+
print_footer
|
54
|
+
|
55
|
+
SUCCESS
|
56
|
+
rescue Exception => e
|
57
|
+
print_error e
|
58
|
+
FAILURE
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def process_arguments
|
63
|
+
@arguments.each do |arg|
|
64
|
+
if is_option?(arg)
|
65
|
+
register_option(arg)
|
66
|
+
else
|
67
|
+
@targets << arg
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# def load_configuration(path)
|
73
|
+
# ALLOWED_CONFIG_FILES.each do |filename|
|
74
|
+
# config_path = path + '/' + filename
|
75
|
+
# if File.exists? config_path
|
76
|
+
# @config.deep_merge! Configuration.load(config_path)
|
77
|
+
# return
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
# end
|
81
|
+
|
82
|
+
def process_configuration
|
83
|
+
#load_configuration(Dir.pwd)
|
84
|
+
|
85
|
+
# @targets.each do |input_path|
|
86
|
+
# @config.deep_merge! load_configuration(input_path)
|
87
|
+
# end
|
88
|
+
|
89
|
+
if has_option?(:config)
|
90
|
+
path = @options[:config]
|
91
|
+
@config.deep_merge! Configuration.load(path)
|
92
|
+
end
|
93
|
+
|
94
|
+
@config.options = @options.to_hash
|
95
|
+
|
96
|
+
#normalize_theme_path
|
97
|
+
|
98
|
+
#theme = @config.options.theme
|
99
|
+
#@config.append load_configuration(theme)
|
100
|
+
end
|
101
|
+
|
102
|
+
def normalize_theme_path
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
def register_option(raw_option)
|
107
|
+
option = raw_option.gsub(":", "=")
|
108
|
+
if option.include? "="
|
109
|
+
parts = option.split("=")
|
110
|
+
option = parts[0]
|
111
|
+
value = parts[1]
|
112
|
+
else
|
113
|
+
value = true
|
114
|
+
end
|
115
|
+
|
116
|
+
name = option.gsub("-", "")
|
117
|
+
|
118
|
+
if option[0..1] == "--"
|
119
|
+
if ENABLED_OPTIONS.has_value?(name.to_sym)
|
120
|
+
@options[name.to_sym] = value
|
121
|
+
return
|
122
|
+
end
|
123
|
+
else
|
124
|
+
if ENABLED_OPTIONS.has_key?(name.to_sym)
|
125
|
+
@options[ENABLED_OPTIONS[name.to_sym]] = value
|
126
|
+
return
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
raise "Unrecognized option: #{raw_option}"
|
131
|
+
end
|
132
|
+
|
133
|
+
def is_option?(argument)
|
134
|
+
argument[0] == "-"
|
135
|
+
end
|
136
|
+
|
137
|
+
def has_option?(option)
|
138
|
+
@options.has_key? option
|
139
|
+
end
|
140
|
+
|
141
|
+
def run_input_process
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
def run_output_process
|
146
|
+
|
147
|
+
end
|
148
|
+
|
149
|
+
def print_header
|
150
|
+
@out.puts Yarrow::APP_NAME + " " + Yarrow::VERSION
|
151
|
+
end
|
152
|
+
|
153
|
+
def print_footer
|
154
|
+
@out.puts "Content generated at {path}!"
|
155
|
+
end
|
156
|
+
|
157
|
+
def print_error(e)
|
158
|
+
@out.puts "Error! " + e.to_s
|
159
|
+
end
|
160
|
+
|
161
|
+
def print_help
|
162
|
+
help = <<HELP
|
163
|
+
See http://yarrowdoc.org for more information.
|
164
|
+
|
165
|
+
Usage:
|
166
|
+
|
167
|
+
$ yarrow [options]
|
168
|
+
$ yarrow [options] <input>
|
169
|
+
$ yarrow [options] <input input> <output>
|
170
|
+
|
171
|
+
Arguments
|
172
|
+
|
173
|
+
<input> - Path to source directory or an individual source file. If not supplied
|
174
|
+
defaults to the current working directory. Multiple directories
|
175
|
+
can be specified by repeating arguments, separated by whitespace.
|
176
|
+
|
177
|
+
<output> - Path to the generated documentation. If not supplied, defaults to
|
178
|
+
./docs in the current working directory. If it does not exist, it
|
179
|
+
is created. If it does exist it remains in place, but existing
|
180
|
+
files are overwritten by new files with the same name.
|
181
|
+
|
182
|
+
Options
|
183
|
+
|
184
|
+
Use -o or --option for boolean switches and --option=value or --option:value
|
185
|
+
for options that require an explicit value to be set.
|
186
|
+
|
187
|
+
-h --help [switch] Display this help message and exit
|
188
|
+
-v --version [switch] Display version header and exit
|
189
|
+
-c --config [string] Path to a config properties file
|
190
|
+
-p --packages [string] Defines package convention for the model
|
191
|
+
-t --theme [string] Template theme for generated docs
|
192
|
+
|
193
|
+
|
194
|
+
HELP
|
195
|
+
@out.puts help
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
data/lib/yarrow.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yarrow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rickerby
|
@@ -26,10 +26,18 @@ dependencies:
|
|
26
26
|
version: '0'
|
27
27
|
description: Documentation generator
|
28
28
|
email: me@maetl.net
|
29
|
-
executables:
|
29
|
+
executables:
|
30
|
+
- yarrow
|
30
31
|
extensions: []
|
31
32
|
extra_rdoc_files: []
|
32
|
-
files:
|
33
|
+
files:
|
34
|
+
- bin/yarrow
|
35
|
+
- lib/yarrow/configuration.rb
|
36
|
+
- lib/yarrow/console_runner.rb
|
37
|
+
- lib/yarrow/defaults.yml
|
38
|
+
- lib/yarrow/generator.rb
|
39
|
+
- lib/yarrow/version.rb
|
40
|
+
- lib/yarrow.rb
|
33
41
|
homepage: http://rubygems.org/gems/yarrow
|
34
42
|
licenses: []
|
35
43
|
metadata: {}
|