wabur 0.5.0 → 0.6.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.
@@ -155,7 +155,7 @@ class TestIoShell < Minitest::Test
155
155
  # desired.
156
156
  script.each { |pair|
157
157
  unless pair[0].nil?
158
- to_w.puts(WAB::Impl::Data.new(pair[0], false).json)
158
+ to_w.puts(WAB::Impl::Data.new(pair[0]).json)
159
159
  to_w.flush
160
160
  end
161
161
 
@@ -179,7 +179,7 @@ class TestIoShell < Minitest::Test
179
179
  # fail. Thats okay as the write is only to tell the child to shutdown
180
180
  # and it already has.
181
181
  begin
182
- to_w.puts(WAB::Impl::Data.new({ api: -2 }, false).json)
182
+ to_w.puts(WAB::Impl::Data.new({ api: -2 }).json)
183
183
  to_w.flush
184
184
  rescue Exception
185
185
  end
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ $VERBOSE = true
5
+
6
+ $: << __dir__
7
+ while (index = ARGV.index('-I'))
8
+ _, path = ARGV.slice!(index, 2)
9
+ $: << path
10
+ end
11
+
12
+ require 'optparse'
13
+ require 'wab'
14
+ require 'wab/io'
15
+
16
+ # This app is expected to be spawned from a WAB runner. This demonstrates one
17
+ # possible mode for running WAB applications. It is the least performant of
18
+ # the WAB run options.
19
+
20
+ $verbose = false
21
+ $thread_count = 1
22
+ $opts = OptionParser.new("Usage: sample [options]
23
+
24
+ Acts as a remote Controller in a WAB deployment. Input is from stdin and output
25
+ is on stdout. If verbosity is turned on it is sent to stderr.
26
+ ")
27
+ $opts.on('-v', 'verbose output on stderr') { $verbose = true }
28
+ $opts.on('-t', '--thread-count Integer', Integer, 'thread count') { |t| $thread_count = t }
29
+ $opts.on('-h', '--help', 'show this page') { $stderr.puts $opts.help; Process.exit!(0) }
30
+
31
+ $opts.parse(ARGV)
32
+
33
+ shell = WAB::IO::Shell.new($thread_count, 'kind', 1)
34
+ shell.logger.level = Logger::INFO if $verbose
35
+
36
+ shell.register_controller('ui', UIController.new(shell))
37
+ shell.register_controller('Entry', WAB::OpenController.new(shell))
38
+ shell.register_controller('Article', WAB::OpenController.new(shell))
39
+
40
+ begin
41
+ shell.start
42
+ rescue Interrupt
43
+ # ignore
44
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'wab/ui'
4
+
5
+ class UIController < WAB::UI::MultiFlow
6
+
7
+ def initialize(shell)
8
+ super
9
+
10
+ add_flow(WAB::UI::RestFlow.new(shell,
11
+ {
12
+ kind: 'Entry',
13
+ }, ['$ref']))
14
+ add_flow(WAB::UI::RestFlow.new(shell,
15
+ {
16
+ kind: 'Article',
17
+ }, ['$ref']))
18
+ end
19
+
20
+ end # UIController
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wabur
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-04 00:00:00.000000000 Z
11
+ date: 2017-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj
@@ -241,6 +241,8 @@ files:
241
241
  - test/test_model.rb
242
242
  - test/test_runner.rb
243
243
  - test/tests.rb
244
+ - test/tmp/lib/spawn.rb
245
+ - test/tmp/lib/ui_controller.rb
244
246
  homepage: http://github.com/ohler55/wabur
245
247
  licenses:
246
248
  - MIT
@@ -295,3 +297,5 @@ test_files:
295
297
  - test/test_model.rb
296
298
  - test/test_runner.rb
297
299
  - test/tests.rb
300
+ - test/tmp/lib/spawn.rb
301
+ - test/tmp/lib/ui_controller.rb