fig 1.23.0 → 1.23.1.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/Changes +14 -0
  3. data/bin/fig +76 -14
  4. data/bin/fig-debug +76 -14
  5. data/bin/fig.bat +3 -1
  6. data/lib/fig.rb +3 -1
  7. data/lib/fig/application_configuration.rb +2 -0
  8. data/lib/fig/at_exit.rb +2 -0
  9. data/lib/fig/command.rb +2 -0
  10. data/lib/fig/command/action.rb +2 -0
  11. data/lib/fig/command/action/clean.rb +2 -0
  12. data/lib/fig/command/action/dump_package_definition_for_command_line.rb +2 -0
  13. data/lib/fig/command/action/dump_package_definition_parsed.rb +2 -0
  14. data/lib/fig/command/action/dump_package_definition_text.rb +2 -0
  15. data/lib/fig/command/action/get.rb +2 -0
  16. data/lib/fig/command/action/help.rb +2 -0
  17. data/lib/fig/command/action/help_long.rb +2 -0
  18. data/lib/fig/command/action/list_configs.rb +2 -0
  19. data/lib/fig/command/action/list_dependencies.rb +2 -0
  20. data/lib/fig/command/action/list_dependencies/all_configs.rb +2 -0
  21. data/lib/fig/command/action/list_dependencies/default.rb +2 -0
  22. data/lib/fig/command/action/list_dependencies/graphviz.rb +2 -0
  23. data/lib/fig/command/action/list_dependencies/graphviz_all_configs.rb +2 -0
  24. data/lib/fig/command/action/list_dependencies/tree.rb +2 -0
  25. data/lib/fig/command/action/list_dependencies/tree_all_configs.rb +2 -0
  26. data/lib/fig/command/action/list_local.rb +2 -0
  27. data/lib/fig/command/action/list_remote.rb +2 -0
  28. data/lib/fig/command/action/list_variables.rb +2 -0
  29. data/lib/fig/command/action/list_variables/all_configs.rb +2 -0
  30. data/lib/fig/command/action/list_variables/default.rb +2 -0
  31. data/lib/fig/command/action/list_variables/graphviz.rb +2 -0
  32. data/lib/fig/command/action/list_variables/graphviz_all_configs.rb +2 -0
  33. data/lib/fig/command/action/list_variables/tree.rb +2 -0
  34. data/lib/fig/command/action/list_variables/tree_all_configs.rb +2 -0
  35. data/lib/fig/command/action/options.rb +2 -0
  36. data/lib/fig/command/action/publish.rb +2 -0
  37. data/lib/fig/command/action/publish_local.rb +2 -0
  38. data/lib/fig/command/action/role/has_no_sub_action.rb +2 -0
  39. data/lib/fig/command/action/role/has_sub_action.rb +2 -0
  40. data/lib/fig/command/action/role/list_all_configs.rb +2 -0
  41. data/lib/fig/command/action/role/list_as_graphviz.rb +2 -0
  42. data/lib/fig/command/action/role/list_base_config.rb +2 -0
  43. data/lib/fig/command/action/role/list_dependencies_as_graphviz.rb +2 -0
  44. data/lib/fig/command/action/role/list_dependencies_flat.rb +2 -0
  45. data/lib/fig/command/action/role/list_dependencies_in_a_tree.rb +2 -0
  46. data/lib/fig/command/action/role/list_variables_as_graphviz.rb +2 -0
  47. data/lib/fig/command/action/role/list_variables_in_a_tree.rb +2 -0
  48. data/lib/fig/command/action/role/list_walking_dependency_tree.rb +2 -0
  49. data/lib/fig/command/action/role/publish.rb +2 -0
  50. data/lib/fig/command/action/role/update.rb +2 -0
  51. data/lib/fig/command/action/run_command_line.rb +2 -0
  52. data/lib/fig/command/action/run_command_statement.rb +2 -0
  53. data/lib/fig/command/action/source_package.rb +2 -0
  54. data/lib/fig/command/action/update.rb +2 -0
  55. data/lib/fig/command/action/update_if_missing.rb +2 -0
  56. data/lib/fig/command/action/version.rb +3 -1
  57. data/lib/fig/command/action/version_plain.rb +2 -0
  58. data/lib/fig/command/coverage_support.rb +2 -0
  59. data/lib/fig/command/initialization.rb +21 -0
  60. data/lib/fig/command/option_error.rb +2 -0
  61. data/lib/fig/command/options.rb +17 -0
  62. data/lib/fig/command/options/parser.rb +2 -0
  63. data/lib/fig/command/package_applier.rb +2 -0
  64. data/lib/fig/command/package_loader.rb +2 -0
  65. data/lib/fig/config_file_error.rb +2 -0
  66. data/lib/fig/deparser.rb +2 -0
  67. data/lib/fig/deparser/v0.rb +2 -0
  68. data/lib/fig/deparser/v1.rb +2 -0
  69. data/lib/fig/deparser/v1_base.rb +2 -0
  70. data/lib/fig/deparser/v2.rb +2 -0
  71. data/lib/fig/environment_variables.rb +2 -0
  72. data/lib/fig/environment_variables/case_insensitive.rb +2 -0
  73. data/lib/fig/environment_variables/case_sensitive.rb +2 -0
  74. data/lib/fig/external_program.rb +64 -25
  75. data/lib/fig/figrc.rb +2 -0
  76. data/lib/fig/file_not_found_error.rb +2 -0
  77. data/lib/fig/grammar/base.rb +3 -1
  78. data/lib/fig/grammar/base.treetop +2 -0
  79. data/lib/fig/grammar/v0.rb +3 -1
  80. data/lib/fig/grammar/v0.treetop +2 -0
  81. data/lib/fig/grammar/v1.rb +3 -1
  82. data/lib/fig/grammar/v1.treetop +2 -0
  83. data/lib/fig/grammar/v1_base.rb +3 -1
  84. data/lib/fig/grammar/v1_base.treetop +2 -0
  85. data/lib/fig/grammar/v2.rb +3 -1
  86. data/lib/fig/grammar/v2.treetop +2 -0
  87. data/lib/fig/grammar/version.rb +3 -1
  88. data/lib/fig/grammar/version.treetop +2 -0
  89. data/lib/fig/grammar/version_identification.rb +3 -1
  90. data/lib/fig/grammar/version_identification.treetop +2 -0
  91. data/lib/fig/grammar_monkey_patches.rb +2 -0
  92. data/lib/fig/include_backtrace.rb +2 -0
  93. data/lib/fig/log4r/outputter.rb +2 -0
  94. data/lib/fig/log4r_config_error.rb +2 -0
  95. data/lib/fig/logging.rb +2 -0
  96. data/lib/fig/logging/colorizable.rb +2 -0
  97. data/lib/fig/network_error.rb +2 -0
  98. data/lib/fig/no_such_package_config_error.rb +2 -0
  99. data/lib/fig/not_yet_parsed_package.rb +2 -0
  100. data/lib/fig/operating_system.rb +2 -0
  101. data/lib/fig/package.rb +2 -0
  102. data/lib/fig/package_cache.rb +2 -0
  103. data/lib/fig/package_definition_text_assembler.rb +2 -0
  104. data/lib/fig/package_descriptor.rb +2 -0
  105. data/lib/fig/package_descriptor_parse_error.rb +2 -0
  106. data/lib/fig/package_parse_error.rb +2 -0
  107. data/lib/fig/parser.rb +2 -0
  108. data/lib/fig/parser_package_build_state.rb +2 -0
  109. data/lib/fig/protocol.rb +2 -0
  110. data/lib/fig/protocol/file.rb +2 -0
  111. data/lib/fig/protocol/ftp.rb +2 -0
  112. data/lib/fig/protocol/http.rb +2 -0
  113. data/lib/fig/protocol/netrc_enabled.rb +2 -0
  114. data/lib/fig/protocol/sftp.rb +2 -0
  115. data/lib/fig/protocol/ssh.rb +2 -0
  116. data/lib/fig/repository.rb +2 -0
  117. data/lib/fig/repository_error.rb +2 -0
  118. data/lib/fig/repository_package_publisher.rb +31 -5
  119. data/lib/fig/runtime_environment.rb +2 -0
  120. data/lib/fig/statement/archive.rb +2 -0
  121. data/lib/fig/statement/asset.rb +2 -0
  122. data/lib/fig/statement/command.rb +2 -0
  123. data/lib/fig/statement/configuration.rb +2 -0
  124. data/lib/fig/statement/environment_variable.rb +2 -0
  125. data/lib/fig/statement/grammar_version.rb +2 -0
  126. data/lib/fig/statement/include.rb +2 -0
  127. data/lib/fig/statement/include_file.rb +2 -0
  128. data/lib/fig/statement/override.rb +2 -0
  129. data/lib/fig/statement/path.rb +2 -0
  130. data/lib/fig/statement/resource.rb +2 -0
  131. data/lib/fig/statement/retrieve.rb +2 -0
  132. data/lib/fig/statement/set.rb +2 -0
  133. data/lib/fig/statement/synthetic_raw_text.rb +2 -0
  134. data/lib/fig/tokenized_string.rb +2 -0
  135. data/lib/fig/tokenized_string/plain_segment.rb +2 -0
  136. data/lib/fig/tokenized_string/token.rb +2 -0
  137. data/lib/fig/update_lock.rb +2 -0
  138. data/lib/fig/url.rb +2 -0
  139. data/lib/fig/url_access_disallowed_error.rb +2 -0
  140. data/lib/fig/user_input_error.rb +2 -0
  141. data/lib/fig/working_directory_maintainer.rb +2 -0
  142. data/lib/fig/working_directory_metadata.rb +2 -0
  143. metadata +5 -18
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/command/action/role/has_no_sub_action'
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/command/action/role/has_no_sub_action'
3
5
  require 'fig/command/action/role/publish'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/command/action/role/has_no_sub_action'
3
5
  require 'fig/command/action/role/publish'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Fig; end
2
4
  class Fig::Command; end
3
5
  module Fig::Command::Action; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Fig; end
2
4
  class Fig::Command; end
3
5
  module Fig::Command::Action; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Fig; end
2
4
  class Fig::Command; end
3
5
  module Fig::Command::Action; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'set'
2
4
 
3
5
  module Fig; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Fig; end
2
4
  class Fig::Command; end
3
5
  module Fig::Command::Action; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Fig; end
2
4
  class Fig::Command; end
3
5
  module Fig::Command::Action; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
 
3
5
  module Fig; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
 
3
5
  module Fig; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'cgi'
2
4
 
3
5
  module Fig; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/statement/path'
3
5
  require 'fig/statement/set'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'set'
2
4
 
3
5
  require 'fig/include_backtrace'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/package_loader'
2
4
  require 'fig/package'
3
5
  require 'fig/statement/configuration'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
 
3
5
  module Fig; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/command/action/role/has_no_sub_action'
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/command/action/role/has_no_sub_action'
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/command/action/role/has_no_sub_action'
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/command/action/role/has_no_sub_action'
3
5
  require 'fig/command/action/role/update'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action'
2
4
  require 'fig/command/action/role/has_no_sub_action'
3
5
  require 'fig/command/action/role/update'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig'
2
4
  require 'fig/command'
3
5
  require 'fig/command/action'
@@ -24,7 +26,7 @@ class Fig::Command::Action::Version
24
26
  end
25
27
 
26
28
  def execute()
27
- puts @version_message || File.basename($0) + ' v' + Fig::VERSION
29
+ puts @version_message || 'fig v' + Fig::VERSION
28
30
 
29
31
  return EXIT_SUCCESS
30
32
  end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig'
2
4
  require 'fig/command'
3
5
  require 'fig/command/action'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  # This is not a normal module/class. It contains code to be run by bin/fig and
2
4
  # bin/fig-debug when doing coverage.
3
5
 
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+
3
+ # This is not a normal module/class. It contains code to be run by bin/fig and
4
+ # bin/fig-debug just after process startup.
5
+
6
+ ( [1, 9, 2] <=> ( RUBY_VERSION.split(".").collect {|x| x.to_i} ) ) <= 0 or
7
+ abort "Ruby v1.9.2 is required; this is v#{RUBY_VERSION}."
8
+
9
+ if ENV['FIG_COVERAGE']
10
+ require File.expand_path(
11
+ File.join(
12
+ File.dirname(__FILE__), %w< coverage_support.rb >
13
+ )
14
+ )
15
+ end
16
+
17
+ $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), %w< .. .. > ))
18
+
19
+ require 'rubygems'
20
+
21
+ require 'fig/command'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/user_input_error'
2
4
 
3
5
  module Fig; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/command/action/clean'
2
4
  require 'fig/command/action/dump_package_definition_for_command_line'
3
5
  require 'fig/command/action/dump_package_definition_parsed'
@@ -62,6 +64,7 @@ class Fig::Command::Options
62
64
  attr_reader :package_definition_file
63
65
  attr_reader :parser
64
66
  attr_reader :publish_comment
67
+ attr_reader :publish_comment_path
65
68
  attr_reader :shell_command
66
69
  attr_reader :suppress_cleanup_of_retrieves
67
70
  attr_reader :suppress_includes
@@ -349,6 +352,14 @@ Running commands:
349
352
  @publish_comment = comment
350
353
  end
351
354
 
355
+ @parser.on(
356
+ '--publish-comment-file PATH',
357
+ STARTS_WITH_NON_HYPHEN,
358
+ 'file to include as a comment in published package'
359
+ ) do |path|
360
+ @publish_comment_path = path
361
+ end
362
+
352
363
  @force = nil
353
364
  @parser.on(
354
365
  '--force',
@@ -880,6 +891,12 @@ Running commands:
880
891
  )
881
892
  end
882
893
 
894
+ if @publish_comment_path && (! @base_action || ! @base_action.publish?)
895
+ raise Fig::Command::OptionError.new(
896
+ 'Cannot use --publish-comment-file when not publishing.'
897
+ )
898
+ end
899
+
883
900
  if @log_to_stdout && @log_config
884
901
  raise Fig::Command::OptionError.new(
885
902
  'Cannot use --log-to-stdout and --log-config at the same time.'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'optparse'
2
4
 
3
5
  require 'fig/command/option_error'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/package'
2
4
  require 'fig/package_descriptor'
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/not_yet_parsed_package'
2
4
  require 'fig/package_descriptor'
3
5
  require 'fig/parser'
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/user_input_error'
2
4
 
3
5
  module Fig
data/lib/fig/deparser.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  # Note: we very specifically do not require the files containing the
2
4
  # Deparser classes in order to avoid circular dependencies.
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/deparser'
2
4
 
3
5
  module Fig; end
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/deparser'
2
4
  require 'fig/deparser/v1_base'
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Fig; end
2
4
  module Fig::Deparser; end
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/deparser'
2
4
  require 'fig/deparser/v1_base'
3
5
 
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Fig; end;
2
4
 
3
5
  # Abstract manager of a set of environment variables.
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/environment_variables'
2
4
 
3
5
  module Fig; end;
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'fig/environment_variables'
2
4
 
3
5
  module Fig; end;
@@ -1,34 +1,40 @@
1
+ # coding: utf-8
2
+
1
3
  require 'stringio'
2
4
 
3
- require 'fig/operating_system'
5
+ require 'fig/user_input_error'
4
6
 
5
7
  module Fig; end
6
8
 
7
9
  class Fig::ExternalProgram
8
- def self.set_up_open3
9
- require 'open3'
10
- def self.popen(*cmd)
11
- exit_code = nil
10
+ def self.popen(*cmd)
11
+ exit_code = nil
12
12
 
13
- Open3.popen3(*cmd) { |stdin, stdout, stderr, wait_thread|
14
- yield stdin, stdout, stderr
13
+ options = {}
14
+ stdin_read, stdin_write = IO.pipe Encoding::UTF_8, Encoding::UTF_8
15
+ options[:in] = stdin_read
16
+ stdin_write.sync = true
15
17
 
16
- exit_code = wait_thread.value
17
- }
18
+ stdout_read, stdout_write = IO.pipe Encoding::UTF_8, Encoding::UTF_8
19
+ options[:out] = stdout_write
18
20
 
19
- return exit_code
20
- end
21
- end
21
+ stderr_read, stderr_write = IO.pipe Encoding::UTF_8, Encoding::UTF_8
22
+ options[:err] = stderr_write
23
+
24
+ popen_run(
25
+ cmd,
26
+ options,
27
+ [stdin_read, stdout_write, stderr_write],
28
+ [stdin_write, stdout_read, stderr_read],
29
+ ) do
30
+ |stdin, stdout, stderr, wait_thread|
22
31
 
23
- if Fig::OperatingSystem.windows?
24
- set_up_open3
25
- else
26
- require 'open4'
27
- def self.popen(*cmd)
28
- return Open4::popen4(*cmd) { |pid, stdin, stdout, stderr|
29
- yield stdin, stdout, stderr
30
- }
32
+ yield stdin, stdout, stderr
33
+
34
+ exit_code = wait_thread.value
31
35
  end
36
+
37
+ return exit_code
32
38
  end
33
39
 
34
40
  def self.capture(command_line, input = nil)
@@ -52,6 +58,9 @@ class Fig::ExternalProgram
52
58
  |handle|
53
59
 
54
60
  begin
61
+ # #readpartial() is busted in that it is returning a byte array in
62
+ # a String with a bogus Encoding, even though the bytes may not be
63
+ # valid in the Encoding.
55
64
  input_to_output[handle] << handle.readpartial(4096)
56
65
  rescue EOFError
57
66
  input_to_output.delete handle
@@ -60,13 +69,43 @@ class Fig::ExternalProgram
60
69
  end
61
70
  end
62
71
 
63
- if ! output.nil?
64
- output = output.string
72
+ output_string = string_io_byte_array_to_utf8_string output
73
+ errors_string = string_io_byte_array_to_utf8_string errors
74
+
75
+ return output_string, errors_string, result
76
+ end
77
+
78
+ private
79
+
80
+ # Stolen from open3.rb
81
+ def self.popen_run(cmd, opts, child_io, parent_io)
82
+ pid = spawn(*cmd, opts)
83
+ wait_thr = Process.detach(pid)
84
+ child_io.each {|io| io.close }
85
+ result = [*parent_io, wait_thr]
86
+ if defined? yield
87
+ begin
88
+ return yield(*result)
89
+ ensure
90
+ parent_io.each{|io| io.close unless io.closed?}
91
+ wait_thr.join
92
+ end
65
93
  end
66
- if ! errors.nil?
67
- errors = errors.string
94
+ result
95
+ end
96
+
97
+ # There appears to be no way to convert from a byte array to a UTF-8 string
98
+ # cleanly, with a report of where things are wrong.
99
+ def self.string_io_byte_array_to_utf8_string(string_io)
100
+ string = string_io.string
101
+ string.force_encoding(Encoding::UTF_8)
102
+ if ! string.valid_encoding?
103
+ # Seriously lame, uninformative error message, but, hopefully, this is
104
+ # rare and I don't think I can spend the time to gather the information
105
+ # to make this better right now.
106
+ raise UserInputError.new 'Got invalid UTF-8 input.'
68
107
  end
69
108
 
70
- return output, errors, result
109
+ return string
71
110
  end
72
111
  end