vedeu 0.8.27 → 0.8.28

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: 6d982f2ff8445c7766e1ea4f8ebc1686a73bc9e9
4
- data.tar.gz: ac882d53395e9f4d88493b712cd58c1484132bc0
3
+ metadata.gz: bd49dbbe4583758d2452063e9161fec5c9bc4d79
4
+ data.tar.gz: f4eeeda050db0fc5e52a03dae4bbcc2176073d23
5
5
  SHA512:
6
- metadata.gz: bcd158b827af91247492e2c69a452ea941c395202643e06a02e3c17c0f6eaec4a5fb7e81a7a324ef457eb0b70b5ea2cd9f539a83121bdc7edcc7702197d68a71
7
- data.tar.gz: 278c0088c5c2f06f0dcab500e8598513a80b9ba2814736962d2a7cf348075b883afc2a091e1573583f1cab68f01667b2895186a15c8860933a2d1691f955054a
6
+ metadata.gz: cd89d6b6433e244b82c6333b25b308791c99668cb34af1bb26f559b36e41db0b0ac1409048fa4a1f97914f7f46b05d60171a610cf109e9a963003ea15db91a96
7
+ data.tar.gz: 33269aa82e2aaf0759c7eb75795e5dd2ed1185fc14c61d14b4aea61eafe52f3b0a92507c0f41ac1bc465967b5ca67cce880e5e068328e346ac11f719b8bfb5ea
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
data/Dockerfile CHANGED
@@ -43,19 +43,19 @@ RUN tar -xzvf chruby-0.3.9.tar.gz && cd chruby-0.3.9/ && make install
43
43
  RUN wget -O ruby-install-0.5.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz
44
44
  RUN tar -xzvf ruby-install-0.5.0.tar.gz && cd ruby-install-0.5.0/ && make install
45
45
 
46
- # Install Ruby 2.2.2
47
- RUN ruby-install ruby 2.2.2
46
+ # Install Ruby 2.3.1
47
+ RUN ruby-install ruby 2.3.1
48
48
  RUN chown -R vedeu:vedeu /opt/rubies
49
49
 
50
50
  # Setup Chruby
51
51
  RUN echo '[ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ] || return' >> /etc/profile.d/chruby.sh
52
52
  RUN echo 'source /usr/local/share/chruby/chruby.sh' >> /etc/profile.d/chruby.sh
53
53
  RUN echo 'source /usr/local/share/chruby/auto.sh' >> $HOME/.bashrc
54
- RUN echo 'chruby ruby-2.2.2' >> $HOME/.bash_profile
54
+ RUN echo 'chruby ruby-2.3.1' >> $HOME/.bash_profile
55
55
  RUN echo "---\n:benchmark: false\n:bulk_threshold: 1000\n:backtrace: false\n:verbose: true\ngem: --no-ri --no-rdoc" >> $HOME/.gemrc
56
56
 
57
57
  # Setup PATH
58
- ENV PATH /opt/rubies/ruby-2.2.2/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/vedeu/gem/bin
58
+ ENV PATH /opt/rubies/ruby-2.3.1/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/vedeu/gem/bin
59
59
 
60
60
  RUN gem install bundler
61
61
 
@@ -13,7 +13,7 @@ class DSLApp
13
13
 
14
14
  Vedeu.configure do
15
15
  debug!
16
- log '/tmp/vedeu_integrations.log'
16
+ log Dir.tmpdir + '/vedeu_views_dsl.log'
17
17
  renderers [
18
18
  Vedeu::Renderers::Terminal.new(
19
19
  filename: Dir.tmpdir + "/#{TESTCASE}.out",
@@ -13,7 +13,7 @@ class DSLApp
13
13
 
14
14
  Vedeu.configure do
15
15
  debug!
16
- log '/tmp/vedeu_integrations.log'
16
+ log Dir.tmpdir + '/vedeu_views_dsl.log'
17
17
  renderers [
18
18
  Vedeu::Renderers::Terminal.new(
19
19
  filename: Dir.tmpdir + "/#{TESTCASE}.out",
@@ -13,7 +13,7 @@ class DSLApp
13
13
 
14
14
  Vedeu.configure do
15
15
  debug!
16
- log '/tmp/vedeu_integrations.log'
16
+ log Dir.tmpdir + '/vedeu_views_dsl.log'
17
17
  renderers [
18
18
  Vedeu::Renderers::Terminal.new(
19
19
  filename: Dir.tmpdir + "/#{TESTCASE}.out",
@@ -13,7 +13,7 @@ class DSLApp
13
13
 
14
14
  Vedeu.configure do
15
15
  debug!
16
- log '/tmp/vedeu_integrations.log'
16
+ log Dir.tmpdir + '/vedeu_views_dsl.log'
17
17
  renderers [
18
18
  Vedeu::Renderers::Terminal.new(
19
19
  filename: Dir.tmpdir + "/#{TESTCASE}.out",
@@ -86,9 +86,13 @@ module Vedeu
86
86
  # @return [Array<void>|void]
87
87
  def results
88
88
  @results ||= registered_events.map do |event|
89
- Vedeu.log(type: :event, message: message)
89
+ Vedeu.outdent do
90
+ Vedeu.log(type: :event, message: message)
90
91
 
91
- event.trigger(*args)
92
+ Vedeu.indent do
93
+ event.trigger(*args)
94
+ end
95
+ end
92
96
  end
93
97
  end
94
98
 
@@ -16,6 +16,27 @@ module Vedeu
16
16
 
17
17
  class << self
18
18
 
19
+ # @api private
20
+ # @!attribute [rw] count
21
+ # @return [Fixnum] Used by tests to access the `count`
22
+ # instance variable.
23
+ attr_accessor :count
24
+
25
+ # Used by {Vedeu::Events::Trigger} to indent log messages to
26
+ # show activity which occurs as part of that event triggering.
27
+ #
28
+ # @api private
29
+ # @macro param_block
30
+ # @return [NilClass|void]
31
+ def indent(&block)
32
+ @count ||= 0
33
+ @count += 1
34
+
35
+ yield if block_given?
36
+ ensure
37
+ outdent
38
+ end
39
+
19
40
  # Write a message to the Vedeu log file.
20
41
  #
21
42
  # @example
@@ -57,6 +78,25 @@ module Vedeu
57
78
  $stderr.puts log_entry(type, message)
58
79
  end
59
80
 
81
+ # Used by {Vedeu::Events::Trigger} to outdent log messages to
82
+ # show activity which occurs as part of the previous event
83
+ # triggering.
84
+ #
85
+ # @api private
86
+ # @macro param_block
87
+ # @return [void]
88
+ def outdent(&block)
89
+ result = yield if block_given?
90
+
91
+ if @count && @count > 0
92
+ @count -= 1
93
+ else
94
+ @count = 0
95
+ end
96
+
97
+ result
98
+ end
99
+
60
100
  # {include:file:docs/dsl/by_method/log_timestamp.md}
61
101
  # @return [String]
62
102
  def timestamp
@@ -75,13 +115,10 @@ module Vedeu
75
115
 
76
116
  private
77
117
 
78
- # @return [Boolean]
79
- def logger
80
- MonoLogger.new(Vedeu.config.log).tap do |log|
81
- log.formatter = proc do |_, _, _, message|
82
- formatted_message(message)
83
- end
84
- end
118
+ # @param type [Symbol] The type of log message.
119
+ # @return [Array<Symbol>]
120
+ def colours(type)
121
+ Vedeu::LOG_TYPES.fetch(type, [:default, :default])
85
122
  end
86
123
 
87
124
  # {include:file:docs/dsl/by_method/log_timestamp.md}
@@ -91,6 +128,11 @@ module Vedeu
91
128
  "#{timestamp}#{message}\n" if message
92
129
  end
93
130
 
131
+ # @return [String]
132
+ def indentation
133
+ ' ' * (@count ||= 0) * 2
134
+ end
135
+
94
136
  # Returns the message:
95
137
  #
96
138
  # [type] message
@@ -112,13 +154,16 @@ module Vedeu
112
154
  # @macro vedeu_logging_log_param_message
113
155
  # @return [String]
114
156
  def log_message(type, message)
115
- Vedeu.esc.colour(colours(type)[1]) { message }
157
+ Vedeu.esc.colour(colours(type)[1]) { indentation + message }
116
158
  end
117
159
 
118
- # @param type [Symbol] The type of log message.
119
- # @return [Array<Symbol>]
120
- def colours(type)
121
- Vedeu::LOG_TYPES.fetch(type, [:default, :default])
160
+ # @return [Boolean]
161
+ def logger
162
+ MonoLogger.new(Vedeu.config.log).tap do |log|
163
+ log.formatter = proc do |_, _, _, message|
164
+ formatted_message(message)
165
+ end
166
+ end
122
167
  end
123
168
 
124
169
  end # Eigenclass
@@ -127,6 +172,9 @@ module Vedeu
127
172
 
128
173
  end # Logging
129
174
 
175
+ # @api public
176
+ # @!method indent
177
+ # @see Vedeu::Logging::Log.indent
130
178
  # @api public
131
179
  # @!method log
132
180
  # @see Vedeu::Logging::Log.log
@@ -139,10 +187,15 @@ module Vedeu
139
187
  # @api public
140
188
  # @!method log_timestamp
141
189
  # @see Vedeu::Logging::Log.log_timestamp
190
+ # @api public
191
+ # @!method outdent
192
+ # @see Vedeu::Logging::Log.outdent
142
193
  def_delegators Vedeu::Logging::Log,
194
+ :indent,
143
195
  :log,
144
196
  :log_stdout,
145
197
  :log_stderr,
146
- :log_timestamp
198
+ :log_timestamp,
199
+ :outdent
147
200
 
148
201
  end # Vedeu
@@ -64,7 +64,7 @@ module Vedeu
64
64
 
65
65
  protected
66
66
 
67
- # @!attribute [r] input
67
+ # @!attribute [rw] plugins
68
68
  # @return [Array<String>]
69
69
  attr_accessor :plugins
70
70
 
@@ -4,6 +4,8 @@ module Vedeu
4
4
 
5
5
  module Presentation
6
6
 
7
+ # Provide access to the parent class for a {Vedeu::Views}
8
+ # instance.
7
9
  #
8
10
  # @api private
9
11
  #
@@ -4,6 +4,12 @@ module Vedeu
4
4
 
5
5
  module Repositories
6
6
 
7
+ # Allow the storing of values for a finite period to save repeated
8
+ # computation.
9
+ #
10
+ # @note
11
+ # This class is not currently used and will be used in future.
12
+ #
7
13
  # @api private
8
14
  #
9
15
  class Cache
data/lib/vedeu/version.rb CHANGED
@@ -3,6 +3,6 @@
3
3
  module Vedeu
4
4
 
5
5
  # The current version of Vedeu.
6
- VERSION = '0.8.27'
6
+ VERSION = '0.8.28'
7
7
 
8
8
  end # Vedeu
@@ -16,6 +16,55 @@ module Vedeu
16
16
  let(:_message) { 'Some message...' }
17
17
  let(:type) { :info }
18
18
 
19
+ describe '.count' do
20
+ it { described.must_respond_to(:count) }
21
+ end
22
+
23
+ describe '.count=' do
24
+ it { described.must_respond_to(:count=) }
25
+ end
26
+
27
+ describe '.indent' do
28
+ context 'when the block is given' do
29
+ subject { described.indent { :block_given } }
30
+
31
+ it { subject.must_equal(:block_given) }
32
+ end
33
+
34
+ context 'when the block is not given' do
35
+ subject { described.indent }
36
+
37
+ it { subject.must_equal(nil) }
38
+ end
39
+
40
+ context 'when the indentation count > 0' do
41
+ before { described.count = 2 }
42
+ after { described.count = nil }
43
+
44
+ subject { described.indent { :block_given } }
45
+
46
+ it { subject; described.count.must_equal(2) }
47
+ end
48
+
49
+ context 'when the indentation count is 0' do
50
+ before { described.count = 0 }
51
+ after { described.count = nil }
52
+
53
+ subject { described.indent { :block_given } }
54
+
55
+ it { subject; described.count.must_equal(0) }
56
+ end
57
+
58
+ context 'when the indentation count < 0' do
59
+ before { described.count = -2 }
60
+ after { described.count = nil }
61
+
62
+ subject { described.indent { :block_given } }
63
+
64
+ it { subject; described.count.must_equal(0) }
65
+ end
66
+ end
67
+
19
68
  describe '.log' do
20
69
  before { Vedeu.config.stubs(:log?).returns(enabled) }
21
70
 
@@ -63,6 +112,57 @@ module Vedeu
63
112
  end
64
113
  end
65
114
 
115
+ describe '.log_timestamp' do
116
+ it { described.must_respond_to(:log_timestamp) }
117
+ end
118
+
119
+ describe '.outdent' do
120
+ context 'when the block is given' do
121
+ subject { described.outdent { :block_given } }
122
+
123
+ it { subject.must_equal(:block_given) }
124
+ end
125
+
126
+ context 'when the block is not given' do
127
+ subject { described.outdent }
128
+
129
+ it { subject.must_equal(nil) }
130
+ end
131
+
132
+ context 'when the indentation count > 0' do
133
+ before { described.count = 2 }
134
+ after { described.count = nil }
135
+
136
+ subject { described.outdent { :block_given } }
137
+
138
+ it { subject; described.count.must_equal(1) }
139
+ end
140
+
141
+ context 'when the indentation count is 0' do
142
+ before { described.count = 0 }
143
+ after { described.count = nil }
144
+
145
+ subject { described.outdent { :block_given } }
146
+
147
+ it { subject; described.count.must_equal(0) }
148
+ end
149
+
150
+ context 'when the indentation count < 0' do
151
+ before { described.count = -2 }
152
+ after { described.count = nil }
153
+
154
+ subject { described.outdent { :block_given } }
155
+
156
+ it { subject; described.count.must_equal(0) }
157
+ end
158
+ end
159
+
160
+ describe '.timestamp' do
161
+ subject { described.timestamp }
162
+
163
+ # @todo Add more tests.
164
+ end
165
+
66
166
  end # Log
67
167
 
68
168
  end # Logging
data/vedeu.gemspec CHANGED
@@ -25,14 +25,14 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'guard-minitest', '2.4.4'
26
26
  spec.add_development_dependency 'guard-rubocop', '1.2.0'
27
27
  spec.add_development_dependency 'minitest', '5.8.4'
28
- spec.add_development_dependency 'minitest-reporters', '1.1.8'
28
+ spec.add_development_dependency 'minitest-reporters', '1.1.9'
29
29
  spec.add_development_dependency 'mocha', '1.1.0'
30
30
  spec.add_development_dependency 'rubocop', '0.39.0'
31
31
  spec.add_development_dependency 'simplecov', '0.11.2'
32
32
  spec.add_development_dependency 'simplecov-console', '0.3.0'
33
33
  spec.add_development_dependency 'yard', '0.8.7.6'
34
34
 
35
- spec.add_dependency 'bundler', '~> 1.11'
35
+ spec.add_dependency 'bundler', '~> 1.12'
36
36
  spec.add_dependency 'rake', '~> 10.5'
37
37
  spec.add_dependency 'thor', '0.19.1'
38
38
  spec.add_dependency 'vedeu_cli', '0.0.10'
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.8.27
4
+ version: 0.8.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Laking
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-22 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 1.1.8
75
+ version: 1.1.9
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 1.1.8
82
+ version: 1.1.9
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mocha
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.11'
159
+ version: '1.12'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '1.11'
166
+ version: '1.12'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rake
169
169
  requirement: !ruby/object:Gem::Requirement