fluent_command_builder 0.1.21 → 0.1.22

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.
@@ -3,11 +3,12 @@ require File.expand_path(File.dirname(__FILE__) + '/command_base')
3
3
  module FluentCommandBuilder
4
4
  class CommandBuilder
5
5
 
6
- attr_reader :command_name
6
+ attr_accessor :command_name, :path
7
7
 
8
- def initialize command_name, command=nil
8
+ def initialize command_name, path=nil
9
9
  @command_name = command_name
10
- @command = command.to_s
10
+ @path = path
11
+ @args = ''
11
12
  end
12
13
 
13
14
  def format value, delimiter=nil, key_value_separator=nil
@@ -33,19 +34,29 @@ module FluentCommandBuilder
33
34
  end
34
35
 
35
36
  def append value
36
- @command << value
37
+ @args << value.to_s
38
+ end
39
+
40
+ def append_arg arg
41
+ append " #{arg.to_s}"
37
42
  end
38
43
 
39
44
  def to_s
40
- "#{@command_name} #{@command.strip}".strip
45
+ "#{executable} #{args}".strip
41
46
  end
42
47
 
43
48
  def args
44
- @command.strip
49
+ @args.strip
45
50
  end
46
51
 
47
52
  private
48
53
 
54
+ def executable
55
+ executable = @path ? File.join(@path, @command_name) : @command_name
56
+ executable.gsub! '/', '\\' if executable.include? '\\'
57
+ executable
58
+ end
59
+
49
60
  def hash_to_array hash, key_value_separator
50
61
  hash.map { |k, v| k.to_s + key_value_separator + v.to_s }
51
62
  end
@@ -6,9 +6,8 @@ module FluentCommandBuilder
6
6
  module V11
7
7
  COMMAND_NAME = 'installUtil'
8
8
  class InstallUtil < CommandBase
9
- def initialize builder, assembly_name
9
+ def initialize builder
10
10
  super builder
11
- @builder.append " #{@builder.format assembly_name}"
12
11
  end
13
12
  def help assembly_path=nil
14
13
  @builder.append ' /help'
@@ -37,18 +36,23 @@ module FluentCommandBuilder
37
36
  yield @builder if block_given?
38
37
  self
39
38
  end
39
+ def assembly_file_name assembly_file_name
40
+ @builder.append " #{@builder.format assembly_file_name}"
41
+ yield @builder if block_given?
42
+ self
43
+ end
40
44
  end
41
- def installutil assembly_name
45
+ def installutil
42
46
  builder = CommandBuilder.new COMMAND_NAME
43
- command = InstallUtil.new builder, assembly_name
47
+ command = InstallUtil.new builder
44
48
  yield builder if block_given?
45
49
  command
46
50
  end
47
51
  end
48
52
  end
49
- def installutil_11 assembly_name
53
+ def installutil_11
50
54
  builder = CommandBuilder.new InstallUtil::V11::COMMAND_NAME
51
- command = InstallUtil::V11::InstallUtil.new builder, assembly_name
55
+ command = InstallUtil::V11::InstallUtil.new builder
52
56
  yield builder if block_given?
53
57
  command
54
58
  end
@@ -6,9 +6,8 @@ module FluentCommandBuilder
6
6
  module V20
7
7
  COMMAND_NAME = 'installUtil'
8
8
  class InstallUtil < CommandBase
9
- def initialize builder, assembly_name=nil
9
+ def initialize builder
10
10
  super builder
11
- @builder.append " #{@builder.format assembly_name}" unless assembly_name.nil?
12
11
  end
13
12
  def help assembly_path=nil
14
13
  @builder.append ' /help'
@@ -22,7 +21,7 @@ module FluentCommandBuilder
22
21
  yield @builder if block_given?
23
22
  self
24
23
  end
25
- def assembly_name assembly_name
24
+ def assembly_strong_name assembly_name
26
25
  @builder.append " /assemblyName=#{@builder.format assembly_name}"
27
26
  yield @builder if block_given?
28
27
  self
@@ -42,18 +41,23 @@ module FluentCommandBuilder
42
41
  yield @builder if block_given?
43
42
  self
44
43
  end
44
+ def assembly_file_name assembly_file_name
45
+ @builder.append " #{@builder.format assembly_file_name}"
46
+ yield @builder if block_given?
47
+ self
48
+ end
45
49
  end
46
- def installutil assembly_name=nil
50
+ def installutil
47
51
  builder = CommandBuilder.new COMMAND_NAME
48
- command = InstallUtil.new builder, assembly_name
52
+ command = InstallUtil.new builder
49
53
  yield builder if block_given?
50
54
  command
51
55
  end
52
56
  end
53
57
  end
54
- def installutil_20 assembly_name=nil
58
+ def installutil_20
55
59
  builder = CommandBuilder.new InstallUtil::V20::COMMAND_NAME
56
- command = InstallUtil::V20::InstallUtil.new builder, assembly_name
60
+ command = InstallUtil::V20::InstallUtil.new builder
57
61
  yield builder if block_given?
58
62
  command
59
63
  end
@@ -6,9 +6,8 @@ module FluentCommandBuilder
6
6
  module V35
7
7
  COMMAND_NAME = 'installUtil'
8
8
  class InstallUtil < CommandBase
9
- def initialize builder, assembly_name=nil
9
+ def initialize builder
10
10
  super builder
11
- @builder.append " #{@builder.format assembly_name}" unless assembly_name.nil?
12
11
  end
13
12
  def help assembly_path=nil
14
13
  @builder.append ' /help'
@@ -22,7 +21,7 @@ module FluentCommandBuilder
22
21
  yield @builder if block_given?
23
22
  self
24
23
  end
25
- def assembly_name assembly_name
24
+ def assembly_strong_name assembly_name
26
25
  @builder.append " /assemblyName=#{@builder.format assembly_name}"
27
26
  yield @builder if block_given?
28
27
  self
@@ -42,18 +41,23 @@ module FluentCommandBuilder
42
41
  yield @builder if block_given?
43
42
  self
44
43
  end
44
+ def assembly_file_name assembly_file_name
45
+ @builder.append " #{@builder.format assembly_file_name}"
46
+ yield @builder if block_given?
47
+ self
48
+ end
45
49
  end
46
- def installutil assembly_name=nil
50
+ def installutil
47
51
  builder = CommandBuilder.new COMMAND_NAME
48
- command = InstallUtil.new builder, assembly_name
52
+ command = InstallUtil.new builder
49
53
  yield builder if block_given?
50
54
  command
51
55
  end
52
56
  end
53
57
  end
54
- def installutil_35 assembly_name=nil
58
+ def installutil_35
55
59
  builder = CommandBuilder.new InstallUtil::V35::COMMAND_NAME
56
- command = InstallUtil::V35::InstallUtil.new builder, assembly_name
60
+ command = InstallUtil::V35::InstallUtil.new builder
57
61
  yield builder if block_given?
58
62
  command
59
63
  end
@@ -6,9 +6,8 @@ module FluentCommandBuilder
6
6
  module V40
7
7
  COMMAND_NAME = 'installUtil'
8
8
  class InstallUtil < CommandBase
9
- def initialize builder, assembly_name=nil
9
+ def initialize builder
10
10
  super builder
11
- @builder.append " #{@builder.format assembly_name}" unless assembly_name.nil?
12
11
  end
13
12
  def help assembly_path=nil
14
13
  @builder.append ' /help'
@@ -16,7 +15,7 @@ module FluentCommandBuilder
16
15
  yield @builder if block_given?
17
16
  self
18
17
  end
19
- def assembly_name assembly_name
18
+ def assembly_strong_name assembly_name
20
19
  @builder.append " /assemblyName=#{@builder.format assembly_name}"
21
20
  yield @builder if block_given?
22
21
  self
@@ -48,18 +47,23 @@ module FluentCommandBuilder
48
47
  yield @builder if block_given?
49
48
  self
50
49
  end
50
+ def assembly_file_name assembly_file_name
51
+ @builder.append " #{@builder.format assembly_file_name}"
52
+ yield @builder if block_given?
53
+ self
54
+ end
51
55
  end
52
- def installutil assembly_name=nil
56
+ def installutil
53
57
  builder = CommandBuilder.new COMMAND_NAME
54
- command = InstallUtil.new builder, assembly_name
58
+ command = InstallUtil.new builder
55
59
  yield builder if block_given?
56
60
  command
57
61
  end
58
62
  end
59
63
  end
60
- def installutil_40 assembly_name=nil
64
+ def installutil_40
61
65
  builder = CommandBuilder.new InstallUtil::V40::COMMAND_NAME
62
- command = InstallUtil::V40::InstallUtil.new builder, assembly_name
66
+ command = InstallUtil::V40::InstallUtil.new builder
63
67
  yield builder if block_given?
64
68
  command
65
69
  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.1.21
4
+ version: 0.1.22
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-08 00:00:00.000000000 Z
12
+ date: 2012-02-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A command line builder with a fluent interface written in Ruby.
15
15
  email: matthew-github@matthewriley.name