vedeu 0.4.4 → 0.4.5

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
  SHA1:
3
- metadata.gz: ce46fbb0f483168f5c1817fc857b4f1134afdc48
4
- data.tar.gz: fe7eeaa6731a12dc572479b89f88de211cdf0c05
3
+ metadata.gz: b6fef3c64356f6fae8e4aa5d76793f341be2a743
4
+ data.tar.gz: a7f195736cbfd4e597a7381450b431a13d1b7ea3
5
5
  SHA512:
6
- metadata.gz: d996c0a1dc1ddb48cc050343ac91ee2d8ecba8035d833796d4a1fb0c07cc5cce75c265a12bd8b3c6c22de2e3b477805b602e20dcb8e4cc98112bf7e5cf31731c
7
- data.tar.gz: 0d42cd88c6680854c1cd322762182d90f0dff970230db9064f709b382c36089a1c01cd406e24a74b9db6262055723eb37bd0cff64d06b4e5fe72cc923f39b23d
6
+ metadata.gz: 4223a8d24f54f96ac5dd2c1bcad229e9ec335bd5d4426091736426d9dd4a86005c7f270fb2b9ab374f59eb4e8a3fb9b0953f36f68aac65e40275bccb1ddfe8f3
7
+ data.tar.gz: 91c862b85ab11f9506648a135bde2aa1c2a54d7ad87ccafd017d998fa2f7856a5c12a2d64ee2bb84c9b067ab27071ea72bdf80ff4537bfe2a253ced83b400753
@@ -66,6 +66,7 @@ module Vedeu
66
66
 
67
67
  private
68
68
 
69
+ # @return [Configuration]
69
70
  attr_reader :configuration
70
71
 
71
72
  # Runs the application loop either once, or forever (exceptions and signals
@@ -199,7 +199,7 @@ module Vedeu
199
199
  }
200
200
  end
201
201
 
202
- # @param value []
202
+ # @param value [void]
203
203
  # @return [void]
204
204
  def options=(value)
205
205
  instance.options = value
@@ -48,6 +48,8 @@ module Vedeu
48
48
  # Returns an instance of DSL::Border.
49
49
  #
50
50
  # @param model [Border]
51
+ # @param client [Object]
52
+ # @return [Vedeu::DSL::Border]
51
53
  def initialize(model, client = nil)
52
54
  @model = model
53
55
  @client = client
@@ -273,7 +275,11 @@ module Vedeu
273
275
 
274
276
  private
275
277
 
276
- attr_reader :client, :model
278
+ # @return [Object]
279
+ attr_reader :client
280
+
281
+ # @return [Border]
282
+ attr_reader :model
277
283
 
278
284
  end # Border
279
285
 
@@ -136,7 +136,11 @@ module Vedeu
136
136
 
137
137
  private
138
138
 
139
- attr_reader :client, :model
139
+ # @return [Object]
140
+ attr_reader :client
141
+
142
+ # @return [Geometry]
143
+ attr_reader :model
140
144
 
141
145
  end # Geometry
142
146
 
@@ -59,6 +59,8 @@ module Vedeu
59
59
  # Returns an instance of DSL::Keymap.
60
60
  #
61
61
  # @param model [Keymap]
62
+ # @param client [Object]
63
+ # @return [Vedeu::DSL::Keymap]
62
64
  def initialize(model, client = nil)
63
65
  @model = model
64
66
  @client = client
@@ -124,7 +126,11 @@ module Vedeu
124
126
 
125
127
  private
126
128
 
127
- attr_reader :client, :model
129
+ # @return [Object]
130
+ attr_reader :client
131
+
132
+ # @return [Keymap]
133
+ attr_reader :model
128
134
 
129
135
  end # Keymap
130
136
 
@@ -14,7 +14,8 @@ module Vedeu
14
14
  # Return a new instance of DSL::Menu.
15
15
  #
16
16
  # @param model [Vedeu::Menu]
17
- # @return [DSL::Menu]
17
+ # @param client [Object]
18
+ # @return [Vedeu::DSL::Menu]
18
19
  def initialize(model, client = nil)
19
20
  @model = model
20
21
  @client = client
@@ -74,7 +75,11 @@ module Vedeu
74
75
 
75
76
  private
76
77
 
77
- attr_reader :client, :model
78
+ # @return [Object]
79
+ attr_reader :client
80
+
81
+ # @return [Menu]
82
+ attr_reader :model
78
83
 
79
84
  end # Menu
80
85
 
@@ -49,7 +49,11 @@ module Vedeu
49
49
 
50
50
  private
51
51
 
52
- attr_reader :client, :model
52
+ # @return [Object]
53
+ attr_reader :client
54
+
55
+ # @return [Composition]
56
+ attr_reader :model
53
57
 
54
58
  # @param name [String] The name of the interface.
55
59
  # @return [Hash]
@@ -60,7 +60,11 @@ module Vedeu
60
60
 
61
61
  private
62
62
 
63
- attr_reader :client, :model
63
+ # @return [Object]
64
+ attr_reader :client
65
+
66
+ # @return [Group]
67
+ attr_reader :model
64
68
 
65
69
  end # Group
66
70
 
@@ -209,7 +209,11 @@ module Vedeu
209
209
 
210
210
  private
211
211
 
212
- attr_reader :client, :model
212
+ # @return [Object]
213
+ attr_reader :client
214
+
215
+ # @return [Interface]
216
+ attr_reader :model
213
217
 
214
218
  # @return [Hash]
215
219
  def attributes
@@ -45,6 +45,8 @@ module Vedeu
45
45
  # Returns an instance of DSL::Line.
46
46
  #
47
47
  # @param model [Vedeu::Line]
48
+ # @param client [Object]
49
+ # @return [Vedeu::DSL::Line]
48
50
  def initialize(model, client = nil)
49
51
  @model = model
50
52
  @client = client
@@ -111,7 +113,11 @@ module Vedeu
111
113
 
112
114
  private
113
115
 
114
- attr_reader :client, :model
116
+ # @return [Object]
117
+ attr_reader :client
118
+
119
+ # @return [Line]
120
+ attr_reader :model
115
121
 
116
122
  # @return [Hash]
117
123
  def attributes
@@ -18,6 +18,8 @@ module Vedeu
18
18
  # Returns an instance of DSL::Stream.
19
19
  #
20
20
  # @param model [Vedeu::Stream]
21
+ # @param client [Object]
22
+ # @return [Vedeu::DSL::Stream]
21
23
  def initialize(model, client = nil)
22
24
  @model = model
23
25
  @client = client
@@ -34,7 +36,11 @@ module Vedeu
34
36
 
35
37
  private
36
38
 
37
- attr_reader :client, :model
39
+ # @return [Object]
40
+ attr_reader :client
41
+
42
+ # @return [Stream]
43
+ attr_reader :model
38
44
 
39
45
  # @return [Hash]
40
46
  def attributes
@@ -9,6 +9,9 @@ module Vedeu
9
9
  #
10
10
  class Launcher
11
11
 
12
+ # @!attribute [r] exit_code
13
+ # @return [Fixnum] Return value indicating successful execution (0) or an
14
+ # error occurred (1).
12
15
  attr_reader :exit_code
13
16
 
14
17
  # @see Vedeu::Launcher#initialize
@@ -31,7 +31,9 @@ module Vedeu
31
31
  # @param member [String]
32
32
  # @return [Group]
33
33
  def add(member)
34
- Group.new({ name: name, members: members.add(member) }).store
34
+ @members = members.add(member)
35
+
36
+ Group.new({ name: name, members: @members }).store
35
37
  end
36
38
 
37
39
  # Return the members as a Set.
@@ -46,7 +48,9 @@ module Vedeu
46
48
  # @param member [String]
47
49
  # @return [Group]
48
50
  def remove(member)
49
- Group.new({ name: name, members: members.delete(member) }).store
51
+ @members = members.delete(member)
52
+
53
+ Group.new({ name: name, members: @members }).store
50
54
  end
51
55
 
52
56
  # Remove all members from the group.
@@ -58,6 +62,7 @@ module Vedeu
58
62
 
59
63
  private
60
64
 
65
+ # @return [Hash]
61
66
  def defaults
62
67
  {
63
68
  members: [],
@@ -28,21 +28,6 @@ module Vedeu
28
28
  @name = name
29
29
  end
30
30
 
31
- # @todo What do we do about resizing terminals. I don't want to overwrite
32
- # the stored geometry and when the terminal returns to original size not also
33
- # return the interface back to its originally prescribed dimensions.
34
- #
35
- # @note
36
- # If the buffer has geometry stored, we should check whether this is different
37
- # to the geometries repository- the client application is wanting to resize
38
- # or move the interface.
39
- #
40
- # If it is different, overwrite the old geometry with the new.
41
- #
42
- # If the buffer does not have geometry stored, retrieve the geometry for this
43
- # interface from the geometries repository so we can draw this buffer in the
44
- # correct place.
45
- #
46
31
  # @return [Array<Interface>]
47
32
  def compose
48
33
  buffer.map do |view|
@@ -107,9 +107,11 @@ module Vedeu
107
107
  # @param value [String|Symbol]
108
108
  # @return [String]
109
109
  def string(value = '')
110
- return '' if value.to_sym.empty?
110
+ name = value.to_sym
111
111
 
112
- sequences.fetch(value.to_sym, proc { '' }).call
112
+ return '' if name.empty?
113
+
114
+ send(name) rescue ''
113
115
  end
114
116
 
115
117
  # Return the escape sequence to render a border character.
@@ -124,33 +126,6 @@ module Vedeu
124
126
 
125
127
  private
126
128
 
127
- # @return [Hash]
128
- def sequences
129
- {
130
- bg_reset: proc { bg_reset },
131
- blink: proc { blink },
132
- blink_off: proc { blink_off },
133
- bold: proc { bold },
134
- bold_off: proc { bold_off },
135
- clear: proc { clear },
136
- clear_line: proc { clear_line },
137
- clear_last_line: proc { clear_last_line },
138
- colour_reset: proc { colour_reset },
139
- dim: proc { dim },
140
- fg_reset: proc { fg_reset },
141
- hide_cursor: proc { hide_cursor },
142
- negative: proc { negative },
143
- normal: proc { normal },
144
- positive: proc { positive },
145
- reset: proc { reset },
146
- screen_init: proc { screen_init },
147
- screen_exit: proc { screen_exit },
148
- show_cursor: proc { show_cursor },
149
- underline: proc { underline },
150
- underline_off: proc { underline_off },
151
- }
152
- end
153
-
154
129
  # @return [String]
155
130
  def bg_reset
156
131
  "\e[49m"
@@ -43,10 +43,58 @@ module Vedeu
43
43
  }
44
44
 
45
45
  it { subject.must_be_instance_of(Vedeu::Group) }
46
+
47
+ it { subject.members.must_equal(Set['editor_interface']) }
46
48
  end
47
49
 
48
50
  end # Group
49
51
 
52
+ describe 'integration' do
53
+
54
+ context 'it does not work without a name' do
55
+ subject {
56
+ Vedeu.group('') do
57
+ add('main_interface')
58
+ end
59
+ }
60
+
61
+ it { proc { subject }.must_raise(MissingRequired) }
62
+ end
63
+
64
+ context 'it adds interface names to the group' do
65
+ subject {
66
+ Vedeu.group('my_group') do
67
+ add('main_interface')
68
+ add('status_interface')
69
+ add('command_interface')
70
+ end
71
+ }
72
+
73
+ it { subject.members.size.must_equal(3) }
74
+
75
+ it { subject.members.must_equal(
76
+ Set['main_interface', 'status_interface', 'command_interface']
77
+ ) }
78
+ end
79
+
80
+ context 'it does not add duplicate names to the group' do
81
+ subject {
82
+ Vedeu.group('my_group') do
83
+ add('main_interface')
84
+ add('status_interface')
85
+ add('main_interface')
86
+ end
87
+ }
88
+
89
+ it { subject.members.size.must_equal(2) }
90
+
91
+ it { subject.members.must_equal(
92
+ Set['main_interface', 'status_interface']
93
+ ) }
94
+ end
95
+
96
+ end
97
+
50
98
  end # DSL
51
99
 
52
100
  end # Vedeu
data/vedeu.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'vedeu'
7
- spec.version = '0.4.4'
7
+ spec.version = '0.4.5'
8
8
  spec.authors = ['Gavin Laking']
9
9
  spec.email = ['gavinlaking@gmail.com']
10
10
  spec.summary = %q{A terminal case of wonderland.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vedeu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba