whirled_peas 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 740b5ae88bfdd0f6dfbf4b1ef9e220a4298ddd8f4d8b01d62e904e3bfb4e109b
4
- data.tar.gz: 1e78f0bf1664187825441258909a750c74455017266d01b4b64d5cdd7c609572
3
+ metadata.gz: 563cc06007d90aa0599b61c5366a5d9b2c5224ec2973367b6c358cad95ddaedc
4
+ data.tar.gz: fa798abdfb8a8e4fd229f08b964c8ee4f4d480939ece9ddaeb5731c171985504
5
5
  SHA512:
6
- metadata.gz: '0960008e3b09aae39cf0655ff57d6dde8859bd3437844b68b37fd72b49bc04199dae2fa5544ba219f795d87f5b5ada80d56f0e96f005eaffddbd74de67d4037c'
7
- data.tar.gz: ce998b69ac1db491577cdfaaaa4b35fb79a0bd07d24c622f426e38b1ff3eb0851ff10c90d24b8b7f48dc1b97dd01c11f93960a011c2611df201f3d86c45ce65a
6
+ metadata.gz: 1be24e74d75f87a001b26f216e320d4a4680c48513e48c42047d2c2168a9404471704731df97ced5954facdc4ca7316580f6078db5670e45067c7e8ed3ee4cd3
7
+ data.tar.gz: 86f3b995575fc7ff8b6bb83adf368182a684faece1584cffb7b1150bd47ce082adaba5b0d4ce0b83d19d2ec2d795bd31db19d35c990e6d0065698c050161bcd0
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.4.0 - 2021-01-22
4
+
5
+ - [7fd6712](https://github.com/tcollier/whirled_peas/tree/7fd6712818c94cdbfd81828277ca67c705e01793): BREAKING: replace `WhirledPeas.start` with command line executable
6
+ - [2535342](https://github.com/tcollier/whirled_peas/tree/25353424f1ab4af4880f44eb7ddd28afefbbb9b2): Add support for loading screen
7
+ - [7388fc2](https://github.com/tcollier/whirled_peas/tree/7388fc2eacdc8045b725311c11d650d6b8654be8): Add support for title fonts
8
+ - [b345155](https://github.com/tcollier/whirled_peas/tree/b345155b1c212cabe73f9a2562ac8dbbedbbb6df): Add command to list title fonts to executable
9
+ - [d3a8324](https://github.com/tcollier/whirled_peas/tree/d3a832496c36985993217ff11b6d83dd4697c4ed): Add commands for debugging application to executable
10
+
3
11
  ## v0.3.0 - 2021-01-21
4
12
 
5
13
  - [617f802](https://github.com/tcollier/whirled_peas/tree/617f8027d6688a2ec81a3e594e529c94485cee85): BREAKING: send frames directly to EventLoop (`Producer#send` renamed to `Producer#send_frame`)
data/README.md CHANGED
@@ -24,9 +24,9 @@ Or install it yourself as:
24
24
 
25
25
  A Whirled Peas application consists of the following pieces
26
26
 
27
- 1. [REQUIRED] The driver, which emits lightweight frame events
28
- 1. [REQUIRED] The main template factory, which builds templates to convert frame events from the driver into terminal graphics
29
- 1. [OPTIONAL] A loading screen template factory, which is used while content is loading
27
+ - The driver (required) - the code that is to be visualized, it emits lightweight frame events through a producer
28
+ - The main template factory (required) - builds templates to convert frame events from the driver into terminal graphics
29
+ - A loading screen template factory (optional) - builds templates to display while content is loading
30
30
 
31
31
  These pieces are configured as following
32
32
 
@@ -39,7 +39,7 @@ class TemplateFactory
39
39
  WhirledPeas.template do |body|
40
40
  body.add_box('Title') do |_, settings|
41
41
  settings.underline = true
42
- "Hello #{args['name']}"
42
+ "Hello #{args[:name]}"
43
43
  end
44
44
  # ...
45
45
  end
@@ -48,7 +48,7 @@ end
48
48
 
49
49
  class Driver
50
50
  def start(producer)
51
- producer.send_frame('starting', args: { 'name' => 'World' })
51
+ producer.send_frame('starting', args: { name: 'World' })
52
52
  # ...
53
53
  end
54
54
  end
@@ -67,7 +67,7 @@ $ whirled_peas start visualize.rb
67
67
 
68
68
  The optional loading screen can be configured like
69
69
 
70
- ````ruby
70
+ ```ruby
71
71
  class LoadingTemplateFactory
72
72
  def build
73
73
  WhirledPeas.template do |t|
@@ -98,7 +98,7 @@ The driver is the application code to be visualized. This is typically a lightwe
98
98
  def start(producer)
99
99
  # application code here
100
100
  end
101
- ````
101
+ ```
102
102
 
103
103
  The producer provides a single method
104
104
 
@@ -107,12 +107,14 @@ The producer provides a single method
107
107
  #
108
108
  # @param name [String] application defined name for the frame. The template factory will be provided this name
109
109
  # @param duration [Number] time in seconds this frame should be displayed for (defaults to 1 frame)
110
- # @param args [Hash] key value pairs to send as arguments to the template factory
110
+ # @param args [Hash<Symbol, Object>] key value pairs to send as arguments to the template factory
111
111
  def send_frame(name, duration:, args:)
112
112
  # implementation
113
113
  end
114
114
  ```
115
115
 
116
+ **IMPORTANT**: the keys for arguments must be symbols.
117
+
116
118
  #### Example
117
119
 
118
120
  Simple application that loads a set of numbers and looks for a pair that adds up to 1,000
@@ -66,11 +66,13 @@ module WhirledPeas
66
66
 
67
67
  class ConfigCommand < Command
68
68
  def start
69
- require args[0]
69
+ require config
70
70
  end
71
71
 
72
72
  private
73
73
 
74
+ attr_reader :config
75
+
74
76
  def validate!
75
77
  if args.length == 0
76
78
  @error_text = "#{self.class.command_name} requires a config file"
@@ -78,6 +80,8 @@ module WhirledPeas
78
80
  @error_text = "File not found: #{args[0]}"
79
81
  elsif args[0][-3..-1] != '.rb'
80
82
  @error_text = 'Config file should be a .rb file'
83
+ else
84
+ @config = args[0][0] == '/' ? args[0] : File.join(Dir.pwd, args[0])
81
85
  end
82
86
  end
83
87
 
@@ -23,8 +23,7 @@ module WhirledPeas
23
23
  @running
24
24
  end
25
25
 
26
- def start
27
- screen = UI::Screen.new
26
+ def start(screen=UI::Screen.new)
28
27
  wait_for_content(screen)
29
28
  play_content(screen)
30
29
  rescue
@@ -39,6 +38,7 @@ module WhirledPeas
39
38
 
40
39
  def stop
41
40
  logger.info(LOGGER_ID) { 'Stopping...' }
41
+ enqueue(Frame::EOF, nil, {})
42
42
  @running = false
43
43
  end
44
44
 
@@ -1,3 +1,3 @@
1
1
  module WhirledPeas
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whirled_peas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Collier