yarrow 0.6.4 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b44d99f6d8696237f4e571ab6f6301fe337c93c6ff218e735acd1c0ed3fbe29
4
- data.tar.gz: 12419fb4e83374e8ff79700fa8a6b14cfcf3ed5a44cd94adc91f8885a3e7f9fe
3
+ metadata.gz: ff50d9afd65a1ab1f8fd668c7db4acc0ceacabc095bccd65b384c2b47f8e7eb0
4
+ data.tar.gz: cb0f022b2163753231e701b98e1da2da2ee963b61cd635031f4128b7ce6034be
5
5
  SHA512:
6
- metadata.gz: af1fdac9c1ac87957f098dd5fe1e3e22d7ac9b78756838226a596a8262bcd438c185cad81dfa3b5ae5f3f071d9c203afdea5e668a79d9b80096a140e310aef3b
7
- data.tar.gz: e237d7964723ad433fab071ef36026979f5a5d2010fc11ce3b787566b8f4c12232b47c8b5dadb0043e93db1d5cd8679b99ec71db303269d244c1e8687b0204aa
6
+ metadata.gz: 93f4705d0556fee8b22ea19ca0a42a272a85ec52b7ced0ab408072147b27789173465c5ea0bcb4f95787da01499499f16d57971b325de5af3bb2d0a1b1f8ccf4
7
+ data.tar.gz: 59df4131a12acd9bd7ea051c1e308d17b99cd391e63e07b5582340f8bcd7e2be1216b98a32e2b4a86d8b88278dd11505d7d0b689997d249ca30057222ca4cc4e
data/lib/yarrow/config.rb CHANGED
@@ -37,6 +37,7 @@ module Yarrow
37
37
  :port,
38
38
  :host,
39
39
  :handler,
40
+ :docroot,
40
41
  :middleware,
41
42
  :root_dir
42
43
  )
@@ -69,5 +69,8 @@ module Yarrow
69
69
  ##
70
70
  # Raised when a required config section or property is missing.
71
71
  class ConfigurationError < StandardError
72
+ def self.missing_section(name)
73
+ new("Missing config section #{name.to_sym}")
74
+ end
72
75
  end
73
76
  end
@@ -31,27 +31,27 @@ module Yarrow
31
31
 
32
32
  def run_application
33
33
  print_header
34
-
34
+
35
35
  begin
36
36
  process_arguments
37
-
37
+
38
38
  if has_option?(:version)
39
39
  return SUCCESS
40
40
  end
41
-
41
+
42
42
  if has_option?(:help)
43
43
  print_help
44
44
  return SUCCESS
45
45
  end
46
-
46
+
47
47
  process_configuration
48
-
48
+
49
49
  run_input_process
50
-
50
+
51
51
  run_output_process
52
-
52
+
53
53
  print_footer
54
-
54
+
55
55
  SUCCESS
56
56
  rescue Exception => e
57
57
  print_error e
@@ -81,20 +81,20 @@ module Yarrow
81
81
 
82
82
  def process_configuration
83
83
  # load_configuration(Dir.pwd)
84
-
84
+
85
85
  # @targets.each do |input_path|
86
86
  # @config.deep_merge! load_configuration(input_path)
87
87
  # end
88
-
88
+
89
89
  if has_option?(:config)
90
90
  path = @options[:config]
91
91
  @config.deep_merge! Configuration.load(path)
92
92
  end
93
-
93
+
94
94
  @config.options = @options.to_hash
95
95
 
96
96
  # normalize_theme_path
97
-
97
+
98
98
  # theme = @config.options.theme
99
99
  # @config.append load_configuration(theme)
100
100
  end
@@ -113,9 +113,9 @@ module Yarrow
113
113
  else
114
114
  value = true
115
115
  end
116
-
116
+
117
117
  name = option.gsub("-", "")
118
-
118
+
119
119
  if option[0..1] == "--"
120
120
  if ENABLED_OPTIONS.has_value?(name.to_sym)
121
121
  @options[name.to_sym] = value
@@ -127,7 +127,7 @@ module Yarrow
127
127
  return
128
128
  end
129
129
  end
130
-
130
+
131
131
  raise "Unrecognized option: #{raw_option}"
132
132
  end
133
133
 
@@ -142,7 +142,7 @@ module Yarrow
142
142
  def run_input_process
143
143
  # noop
144
144
  end
145
-
145
+
146
146
  def run_output_process
147
147
  # noop
148
148
  end
@@ -161,7 +161,7 @@ module Yarrow
161
161
 
162
162
  def print_help
163
163
  help = <<HELP
164
- See http://yarrowdoc.org for more information.
164
+ See http://yarrow.maetl.net for more information.
165
165
 
166
166
  Usage:
167
167
 
@@ -22,7 +22,7 @@ server:
22
22
  auto_index: true
23
23
  default_index: index.html
24
24
  default_type: text/plain
25
- port: 4000
25
+ port: 5005
26
26
  host: localhost
27
27
  handler: webrick
28
28
  middleware:
data/lib/yarrow/server.rb CHANGED
@@ -6,9 +6,13 @@ module Yarrow
6
6
  class Server
7
7
  attr_reader :config
8
8
 
9
+ def self.default
10
+ new(Yarrow::Configuration.load_defaults)
11
+ end
12
+
9
13
  def initialize(instance_config)
10
14
  if instance_config.server.nil?
11
- raise ConfigurationError.new("Missing server entry")
15
+ raise ConfigurationError.missing_section(:server)
12
16
  end
13
17
 
14
18
  @config = instance_config
@@ -57,6 +61,7 @@ module Yarrow
57
61
  app.use(DirectoryIndex, root: docroot, index: default_index)
58
62
 
59
63
  app_args = [docroot, {}].tap { |args| args.push(default_type) if default_type }
64
+
60
65
  static_app = Rack::File.new(*app_args)
61
66
 
62
67
  if live_reload?
@@ -89,7 +94,7 @@ module Yarrow
89
94
 
90
95
  trap(:INT) do
91
96
  handler.shutdown if handler.respond_to?(:shutdown)
92
- reactor.stop
97
+ reactor.stop if live_reload?
93
98
  end
94
99
 
95
100
  handler.run(app, run_options)
@@ -97,7 +102,10 @@ module Yarrow
97
102
 
98
103
  private
99
104
 
100
- ##
105
+ # Host directory of the mounted web server.
106
+ #
107
+ # Fallback to `config.output_dir`.
108
+ #
101
109
  # @return [String]
102
110
  def docroot
103
111
  config.output_dir
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Yarrow
3
3
  APP_NAME = 'Yarrow'
4
- VERSION = '0.6.4'
4
+ VERSION = '0.7.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yarrow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-29 00:00:00.000000000 Z
11
+ date: 2021-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mementus
@@ -243,7 +243,7 @@ homepage: http://rubygemspec.org/gems/yarrow
243
243
  licenses:
244
244
  - MIT
245
245
  metadata: {}
246
- post_install_message:
246
+ post_install_message:
247
247
  rdoc_options: []
248
248
  require_paths:
249
249
  - lib
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  version: '0'
260
260
  requirements: []
261
261
  rubygems_version: 3.1.2
262
- signing_key:
262
+ signing_key:
263
263
  specification_version: 4
264
264
  summary: Documentation generator based on a fluent data model.
265
265
  test_files: []