lib/fluent/diagtool/diagutils.rb in fluent-diagtool-1.0.2 vs lib/fluent/diagtool/diagutils.rb in fluent-diagtool-1.0.3

- old
+ new

@@ -12,19 +12,35 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # +module Diagtool + ON_WINDOWS = /mingw/.match?(RUBY_PLATFORM) + def self.windows? + ON_WINDOWS + end +end + require 'logger' require 'fileutils' require 'fluent/diagtool/collectutils' require 'fluent/diagtool/maskutils' require 'fluent/diagtool/validutils' +require 'fluent/diagtool/windows/diagutils' if Diagtool.windows? include Diagtool module Diagtool class DiagUtils + # TODO: Consider making the logic of this class more abstract and + # cutting out the unix-specific logic into a separate module as well. + # (Currently, very limited features are supported for Windows. + # In order to reduce impact on the existing logic for Unix-like. + # only Windows-specific logic is separated into the module, for now. + # In the future, the implementation of this class should be more abstract.) + prepend Windows::PlatformSpecificDiagUtils if Diagtool.windows? + def initialize(params) time = Time.new @time_format = time.strftime("%Y%m%d%0k%M%0S") @conf = parse_diagconf(params) @cmd_list = [ @@ -124,9 +140,20 @@ diaglogger_info("[Collect] config file is stored in #{tdconf}") diaglogger_info("[Collect] Collecting #{@conf[:package_name]} gem information...") tdgem = c.collect_tdgems() diaglogger_info("[Collect] #{@conf[:package_name]} gem information is stored in #{tdgem}") + + gem_info = c.collect_manually_installed_gems(tdgem) + diaglogger_info("[Collect] #{@conf[:package_name]} gem information (bundled by default) is stored in #{gem_info[:bundled]}") + diaglogger_info("[Collect] #{@conf[:package_name]} manually installed gem information is stored in #{gem_info[:local]}") + local_gems = File.read(gem_info[:local]).lines(chomp: true) + unless local_gems == [""] + diaglogger_info("[Collect] #{@conf[:package_name]} manually installed gems:") + local_gems.each do |gem| + diaglogger_info("[Collect] * #{gem}") + end + end diaglogger_info("[Collect] Collecting config file of OS log...") oslog = c.collect_oslog() if @conf[:mask] == 'yes' diaglogger_info("[Mask] Masking OS log file : #{oslog}...")