fluent_command_builder 0.6.0 → 0.7.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.
Files changed (76) hide show
  1. data/lib/fluent_command_builder.rb +3 -0
  2. data/lib/fluent_command_builder/command_base.rb +21 -10
  3. data/lib/fluent_command_builder/command_builders/appcfg_python.rb +1 -1
  4. data/lib/fluent_command_builder/command_builders/appcfg_python_16.rb +995 -994
  5. data/lib/fluent_command_builder/command_builders/appcfg_python_17.rb +991 -990
  6. data/lib/fluent_command_builder/command_builders/aspnet_compiler.rb +1 -1
  7. data/lib/fluent_command_builder/command_builders/aspnet_compiler_20.rb +30 -29
  8. data/lib/fluent_command_builder/command_builders/aspnet_compiler_40.rb +30 -29
  9. data/lib/fluent_command_builder/command_builders/bundle.rb +1 -1
  10. data/lib/fluent_command_builder/command_builders/bundle_11.rb +102 -101
  11. data/lib/fluent_command_builder/command_builders/cucumber.rb +1 -1
  12. data/lib/fluent_command_builder/command_builders/cucumber_11.rb +60 -59
  13. data/lib/fluent_command_builder/command_builders/cucumber_12.rb +62 -61
  14. data/lib/fluent_command_builder/command_builders/dev_appserver_python.rb +1 -1
  15. data/lib/fluent_command_builder/command_builders/dev_appserver_python_16.rb +72 -71
  16. data/lib/fluent_command_builder/command_builders/dev_appserver_python_17.rb +72 -71
  17. data/lib/fluent_command_builder/command_builders/dotcover.rb +1 -1
  18. data/lib/fluent_command_builder/command_builders/dotcover_10.rb +17 -16
  19. data/lib/fluent_command_builder/command_builders/dotcover_11.rb +101 -100
  20. data/lib/fluent_command_builder/command_builders/dotcover_12.rb +101 -100
  21. data/lib/fluent_command_builder/command_builders/dotcover_20.rb +105 -104
  22. data/lib/fluent_command_builder/command_builders/installutil.rb +1 -1
  23. data/lib/fluent_command_builder/command_builders/installutil_11.rb +15 -14
  24. data/lib/fluent_command_builder/command_builders/installutil_20.rb +17 -16
  25. data/lib/fluent_command_builder/command_builders/installutil_35.rb +17 -16
  26. data/lib/fluent_command_builder/command_builders/installutil_40.rb +20 -19
  27. data/lib/fluent_command_builder/command_builders/msbuild.rb +1 -1
  28. data/lib/fluent_command_builder/command_builders/msbuild_20.rb +27 -26
  29. data/lib/fluent_command_builder/command_builders/msbuild_30.rb +27 -26
  30. data/lib/fluent_command_builder/command_builders/msbuild_35.rb +43 -42
  31. data/lib/fluent_command_builder/command_builders/msbuild_40.rb +46 -45
  32. data/lib/fluent_command_builder/command_builders/msdeploy.rb +1 -1
  33. data/lib/fluent_command_builder/command_builders/msdeploy_71.rb +61 -60
  34. data/lib/fluent_command_builder/command_builders/mstest.rb +1 -1
  35. data/lib/fluent_command_builder/command_builders/mstest_100.rb +41 -40
  36. data/lib/fluent_command_builder/command_builders/mstest_80.rb +33 -32
  37. data/lib/fluent_command_builder/command_builders/mstest_90.rb +35 -34
  38. data/lib/fluent_command_builder/command_builders/netsh.rb +1 -1
  39. data/lib/fluent_command_builder/command_builders/netsh_61.rb +139 -138
  40. data/lib/fluent_command_builder/command_builders/nuget.rb +17 -0
  41. data/lib/fluent_command_builder/command_builders/nuget_20.rb +433 -0
  42. data/lib/fluent_command_builder/command_builders/nunit.rb +1 -1
  43. data/lib/fluent_command_builder/command_builders/nunit_25.rb +50 -49
  44. data/lib/fluent_command_builder/command_builders/nunit_26.rb +66 -65
  45. data/lib/fluent_command_builder/command_builders/rake.rb +1 -1
  46. data/lib/fluent_command_builder/command_builders/rake_09.rb +48 -47
  47. data/lib/fluent_command_builder/command_builders/security_osx.rb +1 -1
  48. data/lib/fluent_command_builder/command_builders/security_osx_107.rb +55 -54
  49. data/lib/fluent_command_builder/command_builders/sevenzip.rb +1 -1
  50. data/lib/fluent_command_builder/command_builders/sevenzip_92.rb +211 -210
  51. data/lib/fluent_command_builder/command_builders/simian.rb +1 -1
  52. data/lib/fluent_command_builder/command_builders/simian_23.rb +47 -46
  53. data/lib/fluent_command_builder/command_builders/team_foundation.rb +1 -1
  54. data/lib/fluent_command_builder/command_builders/team_foundation_100.rb +822 -821
  55. data/lib/fluent_command_builder/command_builders/team_foundation_tee.rb +1 -1
  56. data/lib/fluent_command_builder/command_builders/team_foundation_tee_100.rb +744 -743
  57. data/lib/fluent_command_builder/command_builders/xcodebuild.rb +1 -1
  58. data/lib/fluent_command_builder/command_builders/xcodebuild_43.rb +103 -87
  59. data/lib/fluent_command_builder/command_builders/xcodebuild_44.rb +123 -107
  60. data/lib/fluent_command_builder/executor.rb +44 -0
  61. data/lib/fluent_command_builder/executors/backticks_executor.rb +7 -0
  62. data/lib/fluent_command_builder/executors/dry_run_executor.rb +7 -0
  63. data/lib/fluent_command_builder/executors/rake_sh_executor.rb +10 -0
  64. data/lib/fluent_command_builder/executors/system_executor.rb +7 -0
  65. data/lib/fluent_command_builder/path_finder.rb +20 -0
  66. data/lib/fluent_command_builder/path_finders/unix_path_finder.rb +13 -0
  67. data/lib/fluent_command_builder/path_finders/windows_path_finder.rb +14 -0
  68. data/lib/fluent_command_builder/underlying_builder.rb +75 -59
  69. data/lib/fluent_command_builder/version.rb +40 -0
  70. data/lib/fluent_command_builder/version_detectors/lib/appengine_python_version_detector.rb +1 -2
  71. data/lib/fluent_command_builder/version_detectors/lib/standard_version_detector.rb +13 -13
  72. data/lib/fluent_command_builder/version_validator.rb +37 -0
  73. metadata +16 -7
  74. data/lib/command_version_detector.rb +0 -1
  75. data/lib/fluent_command_builder/util.rb +0 -18
  76. data/lib/fluent_command_builder/version_detectors/lib/path_finder.rb +0 -43
@@ -0,0 +1,44 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/executors/backticks_executor')
2
+ require File.expand_path(File.dirname(__FILE__) + '/executors/dry_run_executor')
3
+ require File.expand_path(File.dirname(__FILE__) + '/executors/rake_sh_executor')
4
+ require File.expand_path(File.dirname(__FILE__) + '/executors/system_executor')
5
+
6
+ module FluentCommandBuilder
7
+ class Executor
8
+
9
+ attr_accessor :backticks_executor, :dry_run_executor, :rake_sh_executor, :system_executor
10
+
11
+ def initialize
12
+ @backticks_executor = BackticksExecutor.new
13
+ @dry_run_executor = DryRunExecutor.new
14
+ @rake_sh_executor = RakeShExecutor.new
15
+ @system_executor = SystemExecutor.new
16
+ end
17
+
18
+ def execute_backticks(command)
19
+ @backticks_executor.execute command
20
+ end
21
+
22
+ def execute_dry_run(command)
23
+ @dry_run_executor.execute command
24
+ end
25
+
26
+ def execute_rake_sh(command)
27
+ @rake_sh_executor.execute command
28
+ end
29
+
30
+ def execute_system(command)
31
+ @system_executor.execute command
32
+ end
33
+
34
+ end
35
+
36
+ def self.executor
37
+ @executor ||= Executor.new
38
+ end
39
+
40
+ def self.executor=(value)
41
+ @executor = value
42
+ end
43
+
44
+ end
@@ -0,0 +1,7 @@
1
+ module FluentCommandBuilder
2
+ class BackticksExecutor
3
+ def execute(command)
4
+ `#{command}`
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module FluentCommandBuilder
2
+ class DryRunExecutor
3
+ def execute(command)
4
+ puts command
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rake'
2
+ include Rake::DSL
3
+
4
+ module FluentCommandBuilder
5
+ class RakeShExecutor
6
+ def execute(command)
7
+ sh command
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module FluentCommandBuilder
2
+ class SystemExecutor
3
+ def execute(command)
4
+ system command
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,20 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/path_finders/unix_path_finder')
2
+ require File.expand_path(File.dirname(__FILE__) + '/path_finders/windows_path_finder')
3
+
4
+ module FluentCommandBuilder
5
+
6
+ def self.path_finder
7
+ @path_finder ||= is_windows? ? WindowsPathFinder.new : UnixPathFinder.new
8
+ end
9
+
10
+ def self.path_finder=(value)
11
+ @path_finder = value
12
+ end
13
+
14
+ private
15
+
16
+ def self.is_windows?
17
+ !ENV['WINDIR'].nil?
18
+ end
19
+
20
+ end
@@ -0,0 +1,13 @@
1
+ module FluentCommandBuilder
2
+ class UnixPathFinder
3
+
4
+ def find_path(executable_name)
5
+ executable = `which #{executable_name}`
6
+ real_executable = `readlink #{executable}`.strip
7
+ result = real_executable == '' ? executable : real_executable
8
+ return unless result
9
+ File.dirname result
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module FluentCommandBuilder
2
+ class WindowsPathFinder
3
+
4
+ def find_path(executable_name)
5
+ paths = ENV['PATH'].split ';'
6
+ extensions = ENV['PATHEXT'].split ';'
7
+ possibilities = paths.map { |path| extensions.map { |ext| File.join(path, executable_name + ext.downcase).gsub('/', '\\') } }.flatten
8
+ executable = possibilities.select { |exe| File.exist? exe }.first
9
+ return unless executable
10
+ File.dirname executable
11
+ end
12
+
13
+ end
14
+ end
@@ -1,60 +1,76 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/command_base')
2
-
3
- module FluentCommandBuilder
4
- class UnderlyingBuilder
5
-
6
- attr_accessor :command_name, :path
7
-
8
- def initialize(command_name=nil)
9
- @command_name = command_name
10
- @path = nil
11
- @args = ''
12
- end
13
-
14
- def format(value, delimiter=' ', key_value_separator='=')
15
- case
16
- when value.kind_of?(CommandBase)
17
- value.to_s
18
- when value.kind_of?(Hash)
19
- format_hash value, delimiter, key_value_separator
20
- when value.kind_of?(Array)
21
- format_array value, delimiter
22
- else
23
- quote_if_includes_space value.to_s
24
- end
25
- end
26
-
27
- def append(value)
28
- @args << value.to_s
29
- end
30
-
31
- def to_s
32
- "#{quote_if_includes_space executable} #{args}".strip
33
- end
34
-
35
- def args
36
- @args.strip
37
- end
38
-
39
- def executable
40
- executable = @path ? File.join(@path, @command_name) : @command_name
41
- executable.gsub! '/', '\\' if executable.include? '\\'
42
- executable
43
- end
44
-
45
- private
46
-
47
- def format_hash(hash, delimiter, key_value_separator)
48
- hash.map { |k, v| quote_if_includes_space(k.to_s) + key_value_separator + quote_if_includes_space(v.to_s) }.join delimiter
49
- end
50
-
51
- def format_array(array, delimiter)
52
- array.map { |v| quote_if_includes_space v }.join delimiter
53
- end
54
-
55
- def quote_if_includes_space(value)
56
- value.to_s.include?(' ') ? %Q["#{value}"] : value
57
- end
58
-
59
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/command_base')
2
+ require File.expand_path(File.dirname(__FILE__) + '/executor')
3
+ require File.expand_path(File.dirname(__FILE__) + '/path_finder')
4
+
5
+ module FluentCommandBuilder
6
+
7
+ def self.default_executor
8
+ @default_executor ||= self.executor.rake_sh_executor
9
+ end
10
+
11
+ def self.default_executor=(value)
12
+ @default_executor = value
13
+ end
14
+
15
+ class UnderlyingBuilder
16
+
17
+ attr_accessor :command_name, :path, :executor
18
+
19
+ def initialize(command_name=nil)
20
+ @command_name = command_name
21
+ @path = nil
22
+ @executor = FluentCommandBuilder.default_executor
23
+ @args = ''
24
+ end
25
+
26
+ def format(value, delimiter=' ', key_value_separator='=')
27
+ case
28
+ when value.kind_of?(CommandBase)
29
+ value.to_s
30
+ when value.kind_of?(Hash)
31
+ format_hash value, delimiter, key_value_separator
32
+ when value.kind_of?(Array)
33
+ format_array value, delimiter
34
+ else
35
+ quote_if_includes_space value.to_s
36
+ end
37
+ end
38
+
39
+ def append(value)
40
+ @args << value.to_s
41
+ end
42
+
43
+ def to_s
44
+ "#{quote_if_includes_space executable} #{args}".strip
45
+ end
46
+
47
+ def args
48
+ @args.strip
49
+ end
50
+
51
+ def executable
52
+ executable = @path ? File.join(@path, @command_name) : @command_name
53
+ executable.gsub! '/', '\\' if executable.include? '\\'
54
+ executable
55
+ end
56
+
57
+ def execute
58
+ @executor.execute to_s
59
+ end
60
+
61
+ private
62
+
63
+ def format_hash(hash, delimiter, key_value_separator)
64
+ hash.map { |k, v| quote_if_includes_space(k.to_s) + key_value_separator + quote_if_includes_space(v.to_s) }.join delimiter
65
+ end
66
+
67
+ def format_array(array, delimiter)
68
+ array.map { |v| quote_if_includes_space v }.join delimiter
69
+ end
70
+
71
+ def quote_if_includes_space(value)
72
+ value.to_s.include?(' ') ? %Q["#{value}"] : value
73
+ end
74
+
75
+ end
60
76
  end
@@ -0,0 +1,40 @@
1
+ module FluentCommandBuilder
2
+ class Version
3
+
4
+ attr_accessor :version
5
+
6
+ def initialize(version)
7
+ raise "#{version} is not a valid version." unless Version.is_valid? version
8
+ @version = version
9
+ end
10
+
11
+ def compact
12
+ @version.match(/^\d+\.\d+/)[0].sub('.', '')
13
+ end
14
+
15
+ def to_s(precision=nil)
16
+ return @version unless precision
17
+ @version.split('.').first(precision).join('.')
18
+ end
19
+
20
+ def self.is_valid?(version)
21
+ version =~ /^(?:\d+\.)+(?:\d+)$/
22
+ end
23
+
24
+ def self.match(value)
25
+ version = value.match(/(?:\d+\.)+(?:\d+)/) { |m| m[0] }
26
+ version ? Version.new(version) : nil
27
+ end
28
+ end
29
+
30
+ def version_module(command_module)
31
+ version = command_module.respond_to?(:version) ? Version.new(command_module.version) : nil
32
+ raise "Unable to determine version for #{command_module::COMMAND_NAME}." unless version
33
+ module_name = "#{command_module.name}::V#{version.compact}"
34
+ begin
35
+ eval module_name
36
+ rescue
37
+ raise "Unable to load #{module_name}. Please consider contributing."
38
+ end
39
+ end
40
+ end
@@ -1,11 +1,10 @@
1
1
  require 'yaml'
2
- require File.expand_path(File.dirname(__FILE__) + '/path_finder')
3
2
 
4
3
  module FluentCommandBuilder
5
4
  class AppEnginePythonVersionDetector
6
5
 
7
6
  def self.version(executable_name, path=nil)
8
- path ||= PathFinder.find_path executable_name
7
+ path ||= FluentCommandBuilder.path_finder.find_path executable_name
9
8
  return unless path
10
9
  version_file = File.join path, 'VERSION'
11
10
  version_hash = YAML::load_file version_file
@@ -1,14 +1,14 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/path_finder')
2
-
3
- module FluentCommandBuilder
4
- class StandardVersionDetector
5
- def self.version(executable_name, executable_args, path=nil)
6
- path ||= PathFinder.find_path executable_name
7
- return unless path
8
- executable = File.join path, executable_name
9
- command = %Q["#{executable}" #{executable_args} 2>&1]
10
- output = `#{command}`
11
- output.match(/(?:\d+\.)(?:\d+\.?)+/) { |m| m[0] }
12
- end
13
- end
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../version')
2
+
3
+ module FluentCommandBuilder
4
+ class StandardVersionDetector
5
+ def self.version(executable_name, executable_args, path=nil)
6
+ path ||= FluentCommandBuilder.path_finder.find_path executable_name
7
+ return unless path
8
+ executable = File.join path, executable_name
9
+ command = %Q["#{executable}" #{executable_args} 2>&1]
10
+ output = FluentCommandBuilder.executor.execute_backticks command
11
+ Version.match(output).version
12
+ end
13
+ end
14
14
  end
@@ -0,0 +1,37 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/version')
2
+
3
+ module FluentCommandBuilder
4
+
5
+ class VersionValidator
6
+
7
+ def initialize(command_builder_class, path)
8
+ @command_builder_class = command_builder_class
9
+ @path = path
10
+ end
11
+
12
+ def is_valid?
13
+ version_in_use.compact == version_on_path.compact
14
+ end
15
+
16
+ def validate
17
+ is_valid = version_in_use.compact == version_on_path.compact
18
+ puts "WARNING: Command Builder version #{version_in_use} does not match tool version #{version_on_path}." unless is_valid
19
+ end
20
+
21
+ def version_in_use
22
+ @version_in_use ||= Version.new(module_at_index(2)::VERSION)
23
+ end
24
+
25
+ def version_on_path
26
+ @version_on_path ||= Version.new(module_at_index(1).version(@path))
27
+ end
28
+
29
+ private
30
+
31
+ def module_at_index(index)
32
+ module_name = @command_builder_class.name.split('::').first(index + 1).join('::')
33
+ eval module_name
34
+ end
35
+
36
+ end
37
+ 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.6.0
4
+ version: 0.7.0
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-08-15 00:00:00.000000000 Z
12
+ date: 2012-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70213346205840 !ruby/object:Gem::Requirement
16
+ requirement: &70355872904220 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,14 +21,13 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70213346205840
24
+ version_requirements: *70355872904220
25
25
  description: Fluent Command Builder makes building command lines easy and intuitive.
26
26
  email: matthew-github@matthewriley.name
27
27
  executables: []
28
28
  extensions: []
29
29
  extra_rdoc_files: []
30
30
  files:
31
- - lib/command_version_detector.rb
32
31
  - lib/fluent_command_builder/command_base.rb
33
32
  - lib/fluent_command_builder/command_builders/appcfg_python.rb
34
33
  - lib/fluent_command_builder/command_builders/appcfg_python_16.rb
@@ -67,6 +66,8 @@ files:
67
66
  - lib/fluent_command_builder/command_builders/mstest_90.rb
68
67
  - lib/fluent_command_builder/command_builders/netsh.rb
69
68
  - lib/fluent_command_builder/command_builders/netsh_61.rb
69
+ - lib/fluent_command_builder/command_builders/nuget.rb
70
+ - lib/fluent_command_builder/command_builders/nuget_20.rb
70
71
  - lib/fluent_command_builder/command_builders/nunit.rb
71
72
  - lib/fluent_command_builder/command_builders/nunit_25.rb
72
73
  - lib/fluent_command_builder/command_builders/nunit_26.rb
@@ -85,8 +86,16 @@ files:
85
86
  - lib/fluent_command_builder/command_builders/xcodebuild.rb
86
87
  - lib/fluent_command_builder/command_builders/xcodebuild_43.rb
87
88
  - lib/fluent_command_builder/command_builders/xcodebuild_44.rb
89
+ - lib/fluent_command_builder/executor.rb
90
+ - lib/fluent_command_builder/executors/backticks_executor.rb
91
+ - lib/fluent_command_builder/executors/dry_run_executor.rb
92
+ - lib/fluent_command_builder/executors/rake_sh_executor.rb
93
+ - lib/fluent_command_builder/executors/system_executor.rb
94
+ - lib/fluent_command_builder/path_finder.rb
95
+ - lib/fluent_command_builder/path_finders/unix_path_finder.rb
96
+ - lib/fluent_command_builder/path_finders/windows_path_finder.rb
88
97
  - lib/fluent_command_builder/underlying_builder.rb
89
- - lib/fluent_command_builder/util.rb
98
+ - lib/fluent_command_builder/version.rb
90
99
  - lib/fluent_command_builder/version_detectors/appcfg_python.rb
91
100
  - lib/fluent_command_builder/version_detectors/aspnet_compiler.rb
92
101
  - lib/fluent_command_builder/version_detectors/bundle.rb
@@ -95,7 +104,6 @@ files:
95
104
  - lib/fluent_command_builder/version_detectors/dotcover.rb
96
105
  - lib/fluent_command_builder/version_detectors/installutil.rb
97
106
  - lib/fluent_command_builder/version_detectors/lib/appengine_python_version_detector.rb
98
- - lib/fluent_command_builder/version_detectors/lib/path_finder.rb
99
107
  - lib/fluent_command_builder/version_detectors/lib/standard_version_detector.rb
100
108
  - lib/fluent_command_builder/version_detectors/msbuild.rb
101
109
  - lib/fluent_command_builder/version_detectors/msdeploy.rb
@@ -107,6 +115,7 @@ files:
107
115
  - lib/fluent_command_builder/version_detectors/sevenzip.rb
108
116
  - lib/fluent_command_builder/version_detectors/team_foundation.rb
109
117
  - lib/fluent_command_builder/version_detectors/xcodebuild.rb
118
+ - lib/fluent_command_builder/version_validator.rb
110
119
  - lib/fluent_command_builder.rb
111
120
  homepage: http://rubygems.org/gems/fluent_command_builder
112
121
  licenses: []