fluent_command_builder 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/lib/fluent_command_builder/command_builders/appcfg_python.rb +1 -1
  2. data/lib/fluent_command_builder/command_builders/aspnet_compiler.rb +1 -1
  3. data/lib/fluent_command_builder/command_builders/bundle.rb +1 -1
  4. data/lib/fluent_command_builder/command_builders/cucumber.rb +1 -1
  5. data/lib/fluent_command_builder/command_builders/dev_appserver_python.rb +1 -1
  6. data/lib/fluent_command_builder/command_builders/dotcover.rb +1 -1
  7. data/lib/fluent_command_builder/command_builders/dotcover_21.rb +309 -0
  8. data/lib/fluent_command_builder/command_builders/fastlinkchecker.rb +1 -1
  9. data/lib/fluent_command_builder/command_builders/installutil.rb +1 -1
  10. data/lib/fluent_command_builder/command_builders/msbuild.rb +1 -1
  11. data/lib/fluent_command_builder/command_builders/msdeploy.rb +1 -1
  12. data/lib/fluent_command_builder/command_builders/mstest.rb +1 -1
  13. data/lib/fluent_command_builder/command_builders/netsh.rb +1 -1
  14. data/lib/fluent_command_builder/command_builders/nuget.rb +1 -1
  15. data/lib/fluent_command_builder/command_builders/nunit.rb +1 -1
  16. data/lib/fluent_command_builder/command_builders/rake.rb +1 -1
  17. data/lib/fluent_command_builder/command_builders/security_osx.rb +1 -1
  18. data/lib/fluent_command_builder/command_builders/sevenzip.rb +1 -1
  19. data/lib/fluent_command_builder/command_builders/simian.rb +1 -1
  20. data/lib/fluent_command_builder/command_builders/team_foundation.rb +1 -1
  21. data/lib/fluent_command_builder/command_builders/team_foundation_tee.rb +1 -1
  22. data/lib/fluent_command_builder/command_builders/xcodebuild.rb +1 -1
  23. data/lib/fluent_command_builder/internal/command_builder_config.rb +6 -4
  24. data/lib/fluent_command_builder/internal/path_finders/unix_path_finder.rb +1 -1
  25. data/lib/fluent_command_builder/{internal/version_detectors.rb → version_detectors.rb} +0 -0
  26. data/lib/fluent_command_builder/{internal/version_detectors → version_detectors}/appengine_python_version_detector.rb +6 -3
  27. data/lib/fluent_command_builder/{internal/version_detectors → version_detectors}/default_version_detector.rb +8 -6
  28. data/lib/fluent_command_builder/version_detectors/dot_net_framework_version_detector.rb +24 -0
  29. data/lib/fluent_command_builder/{internal/version_detectors → version_detectors}/osx_version_detector.rb +5 -1
  30. data/lib/fluent_command_builder/{internal/version_detectors → version_detectors}/standard_version_detector.rb +7 -7
  31. data/lib/fluent_command_builder/{internal/version_detectors → version_detectors}/windows_version_detector.rb +0 -0
  32. data/lib/fluent_command_builder/{internal/version_validator.rb → version_validator.rb} +17 -14
  33. metadata +15 -13
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -0,0 +1,309 @@
1
+ # Generated code. Do not modify.
2
+
3
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/command_base')
4
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/command_builder_config')
5
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
6
+
7
+ module FluentCommandBuilder
8
+ module DotCover
9
+ module V21
10
+ VERSION = '2.1'
11
+ @@config = CommandBuilderConfig.new FluentCommandBuilder::DotCover::COMMAND_NAME, VERSION
12
+ @@config.version_detector = FluentCommandBuilder::DotCover.version_detector
13
+ def configure_dotcover
14
+ yield @@config
15
+ @@config.validate_path
16
+ @@config.validate_version
17
+ end
18
+ def dotcover
19
+ b = UnderlyingBuilder.new @@config
20
+ c = DotCover.new(b)
21
+ yield b if block_given?
22
+ c
23
+ end
24
+ class DotCover < CommandBase
25
+ def initialize(underlying_builder)
26
+ super underlying_builder
27
+ end
28
+ def analyse(configuration_file=nil)
29
+ Analyse.new @b, configuration_file
30
+ end
31
+ def cover(configuration_file=nil)
32
+ Cover.new @b, configuration_file
33
+ end
34
+ def delete(configuration_file=nil)
35
+ Delete.new @b, configuration_file
36
+ end
37
+ def help(command=nil, file_name=nil)
38
+ @b.append ' help'
39
+ @b.append " #{@b.format command}" unless command.nil?
40
+ @b.append " #{@b.format file_name}" unless file_name.nil?
41
+ yield @b if block_given?
42
+ self
43
+ end
44
+ def list(configuration_file=nil)
45
+ List.new @b, configuration_file
46
+ end
47
+ def merge(configuration_file=nil)
48
+ Merge.new @b, configuration_file
49
+ end
50
+ def report(configuration_file=nil)
51
+ Report.new @b, configuration_file
52
+ end
53
+ def version(output_file_name=nil)
54
+ Version.new @b, output_file_name
55
+ end
56
+ def zip(configuration_file=nil)
57
+ Zip.new @b, configuration_file
58
+ end
59
+ end
60
+ class Analyse < CommandBase
61
+ def initialize(underlying_builder, configuration_file=nil)
62
+ super underlying_builder
63
+ @b.append ' analyse'
64
+ @b.append " #{@b.format configuration_file}" unless configuration_file.nil?
65
+ end
66
+ def analyse_target_arguments(bool)
67
+ @b.append " /analyseTargetArguments=#{@b.format bool}"
68
+ yield @b if block_given?
69
+ self
70
+ end
71
+ def attribute_filters(filters)
72
+ @b.append " /attributeFilters=#{@b.format filters, ';'}"
73
+ yield @b if block_given?
74
+ self
75
+ end
76
+ def filters(filters)
77
+ @b.append " /filters=#{@b.format filters, ';'}"
78
+ yield @b if block_given?
79
+ self
80
+ end
81
+ def inherit_console(bool)
82
+ @b.append " /inheritConsole=#{@b.format bool}"
83
+ yield @b if block_given?
84
+ self
85
+ end
86
+ def log_file(log_file)
87
+ @b.append " /logFile=#{@b.format log_file}"
88
+ yield @b if block_given?
89
+ self
90
+ end
91
+ def output(snapshot_path)
92
+ @b.append " /output=#{@b.format snapshot_path}"
93
+ yield @b if block_given?
94
+ self
95
+ end
96
+ def report_type(report_type)
97
+ @b.append " /reportType=#{@b.format report_type}"
98
+ yield @b if block_given?
99
+ self
100
+ end
101
+ def target_arguments(target_arguments)
102
+ @b.append " /targetArguments=#{@b.format target_arguments}"
103
+ yield @b if block_given?
104
+ self
105
+ end
106
+ def target_executable(target_executable)
107
+ @b.append " /targetExecutable=#{@b.format target_executable}"
108
+ yield @b if block_given?
109
+ self
110
+ end
111
+ def target_working_dir(target_working_dir)
112
+ @b.append " /targetWorkingDir=#{@b.format target_working_dir}"
113
+ yield @b if block_given?
114
+ self
115
+ end
116
+ def temp_dir(temp_dir)
117
+ @b.append " /tempDir=#{@b.format temp_dir}"
118
+ yield @b if block_given?
119
+ self
120
+ end
121
+ end
122
+ class Cover < CommandBase
123
+ def initialize(underlying_builder, configuration_file=nil)
124
+ super underlying_builder
125
+ @b.append ' cover'
126
+ @b.append " #{@b.format configuration_file}" unless configuration_file.nil?
127
+ end
128
+ def analyse_target_arguments(bool)
129
+ @b.append " /analyseTargetArguments=#{@b.format bool}"
130
+ yield @b if block_given?
131
+ self
132
+ end
133
+ def attribute_filters(filters)
134
+ @b.append " /attributeFilters=#{@b.format filters, ';'}"
135
+ yield @b if block_given?
136
+ self
137
+ end
138
+ def filters(filters)
139
+ @b.append " /filters=#{@b.format filters, ';'}"
140
+ yield @b if block_given?
141
+ self
142
+ end
143
+ def inherit_console(bool)
144
+ @b.append " /inheritConsole=#{@b.format bool}"
145
+ yield @b if block_given?
146
+ self
147
+ end
148
+ def log_file(log_file)
149
+ @b.append " /logFile=#{@b.format log_file}"
150
+ yield @b if block_given?
151
+ self
152
+ end
153
+ def output(snapshot_path)
154
+ @b.append " /output=#{@b.format snapshot_path}"
155
+ yield @b if block_given?
156
+ self
157
+ end
158
+ def target_arguments(target_arguments)
159
+ @b.append " /targetArguments=#{@b.format target_arguments}"
160
+ yield @b if block_given?
161
+ self
162
+ end
163
+ def target_executable(target_executable)
164
+ @b.append " /targetExecutable=#{@b.format target_executable}"
165
+ yield @b if block_given?
166
+ self
167
+ end
168
+ def target_working_dir(target_working_dir)
169
+ @b.append " /targetWorkingDir=#{@b.format target_working_dir}"
170
+ yield @b if block_given?
171
+ self
172
+ end
173
+ def temp_dir(temp_dir)
174
+ @b.append " /tempDir=#{@b.format temp_dir}"
175
+ yield @b if block_given?
176
+ self
177
+ end
178
+ end
179
+ class Delete < CommandBase
180
+ def initialize(underlying_builder, configuration_file=nil)
181
+ super underlying_builder
182
+ @b.append ' delete'
183
+ @b.append " #{@b.format configuration_file}" unless configuration_file.nil?
184
+ end
185
+ def log_file(log_file)
186
+ @b.append " /logFile=#{@b.format log_file}"
187
+ yield @b if block_given?
188
+ self
189
+ end
190
+ def source(source)
191
+ @b.append " /source=#{@b.format source}"
192
+ yield @b if block_given?
193
+ self
194
+ end
195
+ end
196
+ class List < CommandBase
197
+ def initialize(underlying_builder, configuration_file=nil)
198
+ super underlying_builder
199
+ @b.append ' list'
200
+ @b.append " #{@b.format configuration_file}" unless configuration_file.nil?
201
+ end
202
+ def log_file(log_file)
203
+ @b.append " /logFile=#{@b.format log_file}"
204
+ yield @b if block_given?
205
+ self
206
+ end
207
+ def output(snapshot_path)
208
+ @b.append " /output=#{@b.format snapshot_path}"
209
+ yield @b if block_given?
210
+ self
211
+ end
212
+ def source(source)
213
+ @b.append " /source=#{@b.format source}"
214
+ yield @b if block_given?
215
+ self
216
+ end
217
+ end
218
+ class Merge < CommandBase
219
+ def initialize(underlying_builder, configuration_file=nil)
220
+ super underlying_builder
221
+ @b.append ' merge'
222
+ @b.append " #{@b.format configuration_file}" unless configuration_file.nil?
223
+ end
224
+ def log_file(log_file)
225
+ @b.append " /logFile=#{@b.format log_file}"
226
+ yield @b if block_given?
227
+ self
228
+ end
229
+ def output(snapshot_path)
230
+ @b.append " /output=#{@b.format snapshot_path}"
231
+ yield @b if block_given?
232
+ self
233
+ end
234
+ def source(source)
235
+ @b.append " /source=#{@b.format source}"
236
+ yield @b if block_given?
237
+ self
238
+ end
239
+ def temp_dir(temp_dir)
240
+ @b.append " /tempDir=#{@b.format temp_dir}"
241
+ yield @b if block_given?
242
+ self
243
+ end
244
+ end
245
+ class Report < CommandBase
246
+ def initialize(underlying_builder, configuration_file=nil)
247
+ super underlying_builder
248
+ @b.append ' report'
249
+ @b.append " #{@b.format configuration_file}" unless configuration_file.nil?
250
+ end
251
+ def log_file(log_file)
252
+ @b.append " /logFile=#{@b.format log_file}"
253
+ yield @b if block_given?
254
+ self
255
+ end
256
+ def output(snapshot_path)
257
+ @b.append " /output=#{@b.format snapshot_path}"
258
+ yield @b if block_given?
259
+ self
260
+ end
261
+ def report_type(report_type)
262
+ @b.append " /reportType=#{@b.format report_type}"
263
+ yield @b if block_given?
264
+ self
265
+ end
266
+ def source(source)
267
+ @b.append " /source=#{@b.format source}"
268
+ yield @b if block_given?
269
+ self
270
+ end
271
+ end
272
+ class Version < CommandBase
273
+ def initialize(underlying_builder, output_file_name=nil)
274
+ super underlying_builder
275
+ @b.append ' version'
276
+ @b.append " #{@b.format output_file_name}" unless output_file_name.nil?
277
+ end
278
+ def log_file(log_file)
279
+ @b.append " /logFile=#{@b.format log_file}"
280
+ yield @b if block_given?
281
+ self
282
+ end
283
+ end
284
+ class Zip < CommandBase
285
+ def initialize(underlying_builder, configuration_file=nil)
286
+ super underlying_builder
287
+ @b.append ' zip'
288
+ @b.append " #{@b.format configuration_file}" unless configuration_file.nil?
289
+ end
290
+ def log_file(log_file)
291
+ @b.append " /logFile=#{@b.format log_file}"
292
+ yield @b if block_given?
293
+ self
294
+ end
295
+ def output(snapshot_path)
296
+ @b.append " /output=#{@b.format snapshot_path}"
297
+ yield @b if block_given?
298
+ self
299
+ end
300
+ def source(source)
301
+ @b.append " /source=#{@b.format source}"
302
+ yield @b if block_given?
303
+ self
304
+ end
305
+ end
306
+
307
+ end
308
+ end
309
+ end
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../internal/version_detectors')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors')
4
4
  require File.expand_path(File.dirname(__FILE__) + '/../internal/underlying_builder')
5
5
 
6
6
  module FluentCommandBuilder
@@ -1,6 +1,6 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../version_validator')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../version_detectors/default_version_detector')
1
3
  require File.expand_path(File.dirname(__FILE__) + '/path_validator')
2
- require File.expand_path(File.dirname(__FILE__) + '/version_validator')
3
- require File.expand_path(File.dirname(__FILE__) + '/version_detectors/default_version_detector')
4
4
 
5
5
  module FluentCommandBuilder
6
6
  class CommandBuilderConfig
@@ -18,7 +18,7 @@ module FluentCommandBuilder
18
18
  @path_validation_level = :fatal
19
19
  @version_validation_level = :fatal
20
20
  @path_validator = PathValidator.new self
21
- @version_validator = VersionValidator.new self
21
+ @version_validator = nil
22
22
  @is_windows = !ENV['WINDIR'].nil?
23
23
  end
24
24
 
@@ -27,7 +27,9 @@ module FluentCommandBuilder
27
27
  end
28
28
 
29
29
  def validate_version
30
- @version_validator.validate if @version
30
+ return unless @version
31
+ v = @version_validator || VersionValidator.new(@command_name, @version_detector)
32
+ v.validate @version, evaluated_path
31
33
  end
32
34
 
33
35
  def executable
@@ -5,7 +5,7 @@ module FluentCommandBuilder
5
5
  executable = `which #{executable_name}`
6
6
  real_executable = `readlink #{executable}`.strip
7
7
  result = real_executable == '' ? executable : real_executable
8
- return unless result
8
+ return if result.to_s == ''
9
9
  File.dirname result
10
10
  end
11
11
 
@@ -1,16 +1,19 @@
1
1
  require 'yaml'
2
- require File.expand_path(File.dirname(__FILE__) + '/../path_finder')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/path_finder')
3
3
 
4
4
  module FluentCommandBuilder
5
5
  class AppEnginePythonVersionDetector
6
6
 
7
+ attr_accessor :path_finder
8
+
7
9
  def initialize(command_name)
8
10
  @command_name = command_name
11
+ @path_finder = FluentCommandBuilder.path_finder
9
12
  end
10
13
 
11
14
  def version(path=nil)
12
- path ||= FluentCommandBuilder.path_finder.find_path @command_name
13
- return unless path
15
+ path ||= @path_finder.find_path @command_name
16
+ return unless path && File.exist?(path)
14
17
  version_file = File.join path, 'VERSION'
15
18
  version_hash = YAML::load_file version_file
16
19
  version_hash['release']
@@ -1,24 +1,25 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../path_finder')
2
- require File.expand_path(File.dirname(__FILE__) + '/../version')
1
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/path_finder')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/version')
3
3
  require File.expand_path(File.dirname(__FILE__) + '/standard_version_detector')
4
4
 
5
5
  module FluentCommandBuilder
6
6
  class DefaultVersionDetector
7
7
 
8
+ attr_accessor :path_finder
9
+
8
10
  def initialize(command_name)
9
11
  @command_name = command_name
10
12
  @command_args = %w(--version -version /version --help -help /help version help)
13
+ @path_finder = FluentCommandBuilder.path_finder
11
14
  end
12
15
 
13
16
  def version(path=nil)
14
- path ||= FluentCommandBuilder.path_finder.find_path @command_name
15
- return unless path
16
-
17
+ path ||= @path_finder.find_path @command_name
18
+ return unless path && File.exist?(path)
17
19
  @command_args.each do |command_arg|
18
20
  version = try_get_version command_arg
19
21
  return version if version
20
22
  end
21
-
22
23
  try_get_version
23
24
  end
24
25
 
@@ -26,6 +27,7 @@ module FluentCommandBuilder
26
27
 
27
28
  def try_get_version(command_arg=nil)
28
29
  d = StandardVersionDetector.new @command_name, command_arg
30
+ d.path_finder = @path_finder
29
31
  d.version
30
32
  end
31
33
 
@@ -0,0 +1,24 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/path_finder')
2
+
3
+ module FluentCommandBuilder
4
+ class DotNetFrameworkVersionDetector
5
+
6
+ attr_accessor :path_finder, :backticks_executor
7
+
8
+ def initialize
9
+ @path_finder = FluentCommandBuilder.path_finder
10
+ @backticks_executor = BackticksExecutor.new
11
+ end
12
+
13
+ def version(path=nil)
14
+ path ||= @path_finder.find_path 'msbuild'
15
+ return unless path && File.exist?(path)
16
+ Dir.chdir path do
17
+ command = 'msbuild /version'
18
+ output = @backticks_executor.execute command
19
+ output.scan(/\[Microsoft .NET Framework, Version (.+)\]/).first
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -5,9 +5,13 @@ module FluentCommandBuilder
5
5
 
6
6
  attr_accessor :backticks_executor
7
7
 
8
+ def initialize
9
+ @backticks_executor = BackticksExecutor.new
10
+ end
11
+
8
12
  def version(path=nil)
9
13
  d = StandardVersionDetector.new 'sw_vers', '-productVersion'
10
- d.backticks_executor = @backticks_executor if @backticks_executor
14
+ d.backticks_executor = @backticks_executor
11
15
  d.version
12
16
  end
13
17
 
@@ -1,22 +1,22 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../path_finder')
2
- require File.expand_path(File.dirname(__FILE__) + '/../version')
3
- require File.expand_path(File.dirname(__FILE__) + '/../../command_executors/backticks_executor')
1
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/path_finder')
2
+ require File.expand_path(File.dirname(__FILE__) + '/../internal/version')
3
+ require File.expand_path(File.dirname(__FILE__) + '/../command_executors/backticks_executor')
4
4
 
5
5
  module FluentCommandBuilder
6
6
  class StandardVersionDetector
7
7
 
8
- attr_accessor :backticks_executor
8
+ attr_accessor :path_finder, :backticks_executor
9
9
 
10
10
  def initialize(command_name, command_arg=nil)
11
11
  @command_name = command_name
12
12
  @command_arg = command_arg
13
+ @path_finder = FluentCommandBuilder.path_finder
13
14
  @backticks_executor = BackticksExecutor.new
14
15
  end
15
16
 
16
17
  def version(path=nil)
17
- path ||= FluentCommandBuilder.path_finder.find_path @command_name
18
- return unless path
19
- return unless File.exist? path
18
+ path ||= @path_finder.find_path @command_name
19
+ return unless path && File.exist?(path)
20
20
  Dir.chdir path do
21
21
  command = %Q["#{@command_name}" #{@command_arg} 2>&1]
22
22
  output = @backticks_executor.execute command
@@ -1,21 +1,24 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/printer')
1
+ require File.expand_path(File.dirname(__FILE__) + '/internal/printer')
2
2
 
3
3
  module FluentCommandBuilder
4
4
  class VersionValidator
5
5
 
6
- attr_accessor :printer, :should_abort_on_fatal
6
+ attr_accessor :validation_level, :should_abort_on_fatal, :printer
7
7
 
8
- def initialize(command_builder_config)
9
- @c = command_builder_config
10
- @printer = Printer.new
8
+ def initialize(target_name, version_detector)
9
+ @target_name = target_name
10
+ @version_detector = version_detector
11
+ @validation_level = :fatal
11
12
  @should_abort_on_fatal = true
13
+ @printer = FluentCommandBuilder::Printer.new
12
14
  end
13
15
 
14
- def validate
16
+ def validate(expected_version_string, path=nil)
15
17
  validate_validation_level
16
- return if validation_level == :off
18
+ return if @validation_level == :off
17
19
 
18
- @actual_version_string = @c.version_detector.version(@c.evaluated_path)
20
+ @expected_version_string = expected_version_string
21
+ @actual_version_string = @version_detector.version path
19
22
 
20
23
  unless actual_version
21
24
  @printer.print_warning error_message('unable to determine actual version')
@@ -40,7 +43,7 @@ module FluentCommandBuilder
40
43
  private
41
44
 
42
45
  def validation_level
43
- @c.version_validation_level
46
+ @validation_level
44
47
  end
45
48
 
46
49
  def validate_validation_level
@@ -51,15 +54,12 @@ module FluentCommandBuilder
51
54
  [:off, :warn, :fatal].include? validation_level
52
55
  end
53
56
 
54
-
55
-
56
-
57
57
  def is_valid?
58
58
  actual_version.to_a.first(expected_version.to_a.length) == expected_version.to_a
59
59
  end
60
60
 
61
61
  def expected_version
62
- @expected_version ||= Version.new(@c.version)
62
+ @expected_version ||= Version.new(@expected_version_string)
63
63
  end
64
64
 
65
65
  def actual_version
@@ -67,7 +67,10 @@ module FluentCommandBuilder
67
67
  end
68
68
 
69
69
  def error_message(actual_version)
70
- %Q[Version validation for command "#{@c.command_name}" failed. Expected version #{expected_version} but was #{actual_version}.]
70
+ m = 'Version validation '
71
+ m += %Q[for "#{@target_name}" ] if @target_name
72
+ m += "failed. Expected version #{expected_version} but was #{actual_version}."
73
+ m
71
74
  end
72
75
 
73
76
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent_command_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-23 00:00:00.000000000 Z
12
+ date: 2012-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70300608096120 !ruby/object:Gem::Requirement
16
+ requirement: &70183412696920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70300608096120
24
+ version_requirements: *70183412696920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: term-ansicolor
27
- requirement: &70300608095680 !ruby/object:Gem::Requirement
27
+ requirement: &70183412696480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70300608095680
35
+ version_requirements: *70183412696480
36
36
  description: Fluent Command Builder makes building command lines easy and clean.
37
37
  email: matthew-github@matthewriley.name
38
38
  executables: []
@@ -59,6 +59,7 @@ files:
59
59
  - lib/fluent_command_builder/command_builders/dotcover_11.rb
60
60
  - lib/fluent_command_builder/command_builders/dotcover_12.rb
61
61
  - lib/fluent_command_builder/command_builders/dotcover_20.rb
62
+ - lib/fluent_command_builder/command_builders/dotcover_21.rb
62
63
  - lib/fluent_command_builder/command_builders/fastlinkchecker.rb
63
64
  - lib/fluent_command_builder/command_builders/fastlinkchecker_21.rb
64
65
  - lib/fluent_command_builder/command_builders/installutil.rb
@@ -118,14 +119,15 @@ files:
118
119
  - lib/fluent_command_builder/internal/printer.rb
119
120
  - lib/fluent_command_builder/internal/underlying_builder.rb
120
121
  - lib/fluent_command_builder/internal/version.rb
121
- - lib/fluent_command_builder/internal/version_detectors/appengine_python_version_detector.rb
122
- - lib/fluent_command_builder/internal/version_detectors/default_version_detector.rb
123
- - lib/fluent_command_builder/internal/version_detectors/osx_version_detector.rb
124
- - lib/fluent_command_builder/internal/version_detectors/standard_version_detector.rb
125
- - lib/fluent_command_builder/internal/version_detectors/windows_version_detector.rb
126
- - lib/fluent_command_builder/internal/version_detectors.rb
127
- - lib/fluent_command_builder/internal/version_validator.rb
128
122
  - lib/fluent_command_builder/password_formatter.rb
123
+ - lib/fluent_command_builder/version_detectors/appengine_python_version_detector.rb
124
+ - lib/fluent_command_builder/version_detectors/default_version_detector.rb
125
+ - lib/fluent_command_builder/version_detectors/dot_net_framework_version_detector.rb
126
+ - lib/fluent_command_builder/version_detectors/osx_version_detector.rb
127
+ - lib/fluent_command_builder/version_detectors/standard_version_detector.rb
128
+ - lib/fluent_command_builder/version_detectors/windows_version_detector.rb
129
+ - lib/fluent_command_builder/version_detectors.rb
130
+ - lib/fluent_command_builder/version_validator.rb
129
131
  - lib/fluent_command_builder.rb
130
132
  homepage: http://rubygems.org/gems/fluent_command_builder
131
133
  licenses: []