xezat 0.3.1 → 0.3.2

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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/xezat/command/generate.rb +9 -0
  3. data/lib/xezat/detector/asciidoc.rb +1 -1
  4. data/lib/xezat/detector/autoconf-archive.rb +27 -0
  5. data/lib/xezat/detector/autoconf.rb +1 -1
  6. data/lib/xezat/detector/automake.rb +1 -1
  7. data/lib/xezat/detector/boost.m4.rb +1 -1
  8. data/lib/xezat/detector/cmake.rb +1 -1
  9. data/lib/xezat/detector/docbook2X.rb +1 -1
  10. data/lib/xezat/detector/font-util.rb +20 -0
  11. data/lib/xezat/detector/gengetopt.rb +1 -1
  12. data/lib/xezat/detector/gettext-devel.rb +2 -2
  13. data/lib/xezat/detector/gnulib.rb +1 -1
  14. data/lib/xezat/detector/gobject-introspection.rb +1 -1
  15. data/lib/xezat/detector/halibut.rb +1 -1
  16. data/lib/xezat/detector/libQt5Core-devel.rb +1 -1
  17. data/lib/xezat/detector/libtool.rb +1 -1
  18. data/lib/xezat/detector/make.rb +1 -1
  19. data/lib/xezat/detector/meson.rb +1 -1
  20. data/lib/xezat/detector/nasm.rb +1 -1
  21. data/lib/xezat/detector/ninja.rb +1 -1
  22. data/lib/xezat/detector/python27.rb +1 -1
  23. data/lib/xezat/detector/python36.rb +1 -1
  24. data/lib/xezat/detector/python37.rb +1 -1
  25. data/lib/xezat/detector/python38.rb +1 -1
  26. data/lib/xezat/detector/python39-docutils.rb +2 -2
  27. data/lib/xezat/detector/python39.rb +1 -1
  28. data/lib/xezat/detector/roundup.rb +1 -1
  29. data/lib/xezat/detector/waf.rb +1 -1
  30. data/lib/xezat/detector/xorg-util-macros.rb +20 -0
  31. data/lib/xezat/detectors.rb +1 -1
  32. data/lib/xezat/generator/cmake.rb +44 -0
  33. data/lib/xezat/generator/pkgconfig.rb +5 -7
  34. data/lib/xezat/generator.rb +6 -0
  35. data/lib/xezat/main.rb +1 -0
  36. data/lib/xezat/variables.rb +16 -4
  37. data/lib/xezat/version.rb +1 -1
  38. data/lib/xezat.rb +10 -1
  39. data/share/xezat/autoconf-archive.yml +583 -0
  40. data/share/xezat/template/cmake/cmake.erb +22 -0
  41. data/share/xezat/var2yaml.sh +1 -0
  42. data/xezat.gemspec +31 -11
  43. metadata +41 -34
  44. data/.fasterer.yml +0 -6
  45. data/.github/workflows/ruby.yml +0 -45
  46. data/.gitignore +0 -11
  47. data/.gitmodules +0 -3
  48. data/.rspec +0 -2
  49. data/.rubocop.yml +0 -36
  50. data/.ruby-version +0 -1
  51. data/Gemfile +0 -8
  52. data/Rakefile +0 -8
  53. data/bin/console +0 -15
  54. data/bin/setup +0 -8
  55. /data/share/xezat/template/{Makefile.am → pkgconfig/Makefile.am} +0 -0
  56. /data/share/xezat/template/{cmake.erb → pkgconfig/cmake.erb} +0 -0
  57. /data/share/xezat/template/{pkgconfig.erb → pkgconfig/pkgconfig.erb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bca5b54e336456b6aa2c9cc5af28c2f40c896e536a44df6374ce39dfdab700d
4
- data.tar.gz: fce7bb85622494444eb694b0973437b85de48d8ffb3e71cac01e118f08eda012
3
+ metadata.gz: 19e1eef962e59cf81c84a69ea321838d0b0542952073b429cb0f9af0d8cd7dd3
4
+ data.tar.gz: 88a9a875473d8e11ab01651393740b06af772b9c1f7ce18e9e3fc74909971b1b
5
5
  SHA512:
6
- metadata.gz: 8ccfb592b7c4462ec9b9ffbf71db32e8fa7749ca858760a85c67925ec4b9ba276b264365d8737aa34462f3ac1765580ff783b1815af277e85d6adc03c23c53bc
7
- data.tar.gz: 6a2a950848dae1d7cb967555209cb61e78d711659aac02ea6fa85061625ba381845b585d559667fc8e55aa78cba5bcef131b293530895f8a74d0b8b823c07914
6
+ metadata.gz: cf83fa1fbc96dfd22a07d64c974fc3d279cd00a3021315d18948011d44354624d8e426c88bdd654bd63c27a63b01ece6f47a842ed9cba54fb77cf50fa1d754d2
7
+ data.tar.gz: b4132baf3892fccce8e9b19f6701751878be50a74e08551cc601c921a1ccfe25f3b29f7730d160a7cda93c51306a95ba47e4234ce99a84754b40b4849a50f5e6
@@ -13,6 +13,15 @@ module Xezat
13
13
  require 'xezat/generator/pkgconfig'
14
14
  Generator::Pkgconfig.new(options, cygport).generate
15
15
  end
16
+
17
+ desc 'cmake cygport', 'Generate CMakeLists.txt'
18
+ option :overwrite, type: :boolean, aliases: '-o', desc: 'overwrite CMakeLists.txt'
19
+ option :srcdir, type: :string, aliases: '-s', desc: 'relative path to CMakeLists.txt'
20
+
21
+ def cmake(cygport)
22
+ require 'xezat/generator/cmake'
23
+ Generator::CMake.new(options, cygport).generate
24
+ end
16
25
  end
17
26
  end
18
27
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Asciidoc
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
11
 
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xezat
4
+ module Detector
5
+ class AutoconfArchive
6
+ def detect?(variables)
7
+ return false unless variables.keys.index do |key|
8
+ %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
9
+ end.nil?
10
+
11
+ autoconf_archive_file = File.expand_path(File.join(DATA_DIR, 'autoconf-archive.yml'))
12
+ autoconf_archive_macros = YAML.safe_load(File.open(autoconf_archive_file), symbolize_names: true, permitted_classes: [Symbol])
13
+
14
+ Find.find(variables[:S]) do |file|
15
+ next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
16
+
17
+ autoconf_archive_macros.each do |macro|
18
+ File.foreach(file) do |line|
19
+ return true if line.scrub.strip.start_with?(macro)
20
+ end
21
+ end
22
+ end
23
+ false
24
+ end
25
+ end
26
+ end
27
+ end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Autoconf
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return false unless variables.keys.index do |key|
10
10
  %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
11
11
  end.nil?
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Automake
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return false unless variables.keys.index do |key|
10
10
  %i[_cmake_CYGCLASS_ _meson_CYGCLASS_ _ninja_CYGCLASS_].include?(key)
11
11
  end.nil?
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class BoostM4
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
11
 
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Cmake
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  variables.key?(:_cmake_CYGCLASS_)
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Docbook2x
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
11
 
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'find'
4
+
5
+ module Xezat
6
+ module Detector
7
+ class FontUtil
8
+ def detect?(variables)
9
+ Find.find(variables[:S]) do |file|
10
+ next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
+
12
+ File.foreach(file) do |line|
13
+ return true if line.start_with?('XORG_FONT_MACROS_VERSION')
14
+ end
15
+ end
16
+ false
17
+ end
18
+ end
19
+ end
20
+ end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Gengetopt
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  return true if file.end_with?('.ggo', '.ggo.in')
11
11
  end
@@ -3,12 +3,12 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class GettextDevel
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  Find.find(variables[:S]) do |file|
8
8
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
9
9
 
10
10
  File.foreach(file) do |line|
11
- return true if /AM_GNU_GETTEXT|AM_ICONV|AC_GGZ_INTL/.match?(line.lstrip)
11
+ return true if /AM_GNU_GETTEXT|AM_ICONV|AC_GGZ_INTL/.match?(line.scrub.lstrip)
12
12
  end
13
13
  end
14
14
  false
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Gnulib
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
10
10
  return true if line.index('gnulib-tools')
11
11
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class GobjectIntrospection
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  File.directory?(File.join(variables[:D], 'usr', 'lib', 'girepository-1.0'))
10
10
  end
11
11
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Halibut
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  return true if file.end_with?('.but')
11
11
  end
@@ -3,7 +3,7 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class Libqt5coreDevel
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  variables.key?(:_qt5_qmake_CYGCLASS_)
8
8
  end
9
9
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Libtool
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  return true if file.end_with?("#{File::SEPARATOR}ltmain.sh")
11
11
  end
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Make
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:B]) do |file|
10
10
  return true if file.end_with?("#{File::SEPARATOR}Makefile", "#{File::SEPARATOR}makefile")
11
11
  end
@@ -3,7 +3,7 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class Meson
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  variables.key?(:_meson_CYGCLASS_)
8
8
  end
9
9
  end
@@ -3,7 +3,7 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class Nasm
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  if variables.key?(:_meson_CYGCLASS_)
8
8
  File.foreach(File.join(variables[:S], 'meson.build')) do |line|
9
9
  return true if line.include?("find_program('nasm')")
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Ninja
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if variables.key?(:_meson_CYGCLASS_)
10
10
 
11
11
  Find.find(variables[:B]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python27
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python2.7'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python36
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.6'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python37
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.7'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python38
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.8'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,12 +5,12 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python39Docutils
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  Find.find(variables[:S]) do |file|
10
10
  next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
11
 
12
12
  File.foreach(file) do |line|
13
- return true if line.strip.start_with?('AC_CHECK_PROG') && line.index('rst2man').is_a?(Integer)
13
+ return true if line.scrub.strip.start_with?('AC_CHECK_PROG') && line.index('rst2man').is_a?(Integer)
14
14
  end
15
15
  end
16
16
  if variables.key?(:_meson_CYGCLASS_)
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Python39
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  return true if File.directory?(File.join(variables[:D], 'usr', 'lib', 'python3.9'))
10
10
 
11
11
  Find.find(variables[:D]) do |file|
@@ -5,7 +5,7 @@ require 'find'
5
5
  module Xezat
6
6
  module Detector
7
7
  class Roundup
8
- def detect(variables)
8
+ def detect?(variables)
9
9
  File.foreach(File.join(variables[:top], variables[:cygportfile])) do |line|
10
10
  return true if line.index('roundup')
11
11
  end
@@ -3,7 +3,7 @@
3
3
  module Xezat
4
4
  module Detector
5
5
  class Waf
6
- def detect(variables)
6
+ def detect?(variables)
7
7
  if variables.key?(:_waf_CYGCLASS_)
8
8
  Find.find(variables[:S]) do |file|
9
9
  return false if file.end_with?("#{File::SEPARATOR}waf")
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'find'
4
+
5
+ module Xezat
6
+ module Detector
7
+ class XorgUtilMacros
8
+ def detect?(variables)
9
+ Find.find(variables[:S]) do |file|
10
+ next unless file.end_with?("#{File::SEPARATOR}configure.ac", "#{File::SEPARATOR}configure.in")
11
+
12
+ File.foreach(file) do |line|
13
+ return true if line.start_with?('XORG_MACROS_VERSION')
14
+ end
15
+ end
16
+ false
17
+ end
18
+ end
19
+ end
20
+ end
@@ -20,7 +20,7 @@ module Xezat
20
20
  @detectors.each do |name, detector|
21
21
  if variables[:PN].intern == name
22
22
  Xezat.logger.debug(" #{name} ... no (self)")
23
- elsif detector.detect(variables)
23
+ elsif detector.detect?(variables)
24
24
  tools << name
25
25
  Xezat.logger.debug(" #{name} ... yes")
26
26
  else
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'xezat/generator'
4
+ require 'xezat/variables'
5
+
6
+ module Xezat
7
+ module Generator
8
+ class CMake
9
+ include Xezat
10
+
11
+ def initialize(options, cygport)
12
+ @options = options
13
+ @cygport = cygport
14
+ end
15
+
16
+ def generate
17
+ Xezat.logger.debug('Start CMakeLists.txt generation')
18
+ vars = variables(@cygport)
19
+ generate_cmakelists(vars, @options)
20
+ Xezat.logger.debug('End CMakeLists.txt generation')
21
+ end
22
+
23
+ def generate_cmakelists(variables, options)
24
+ srcdir = variables[:CYGCONF_SOURCE] || variables[:CYGCMAKE_SOURCE] || variables[:S]
25
+ srcdir = File.expand_path(File.join(variables[:S], options['srcdir'])) if options['srcdir']
26
+ Xezat.logger.debug(" srcdir = #{srcdir}")
27
+
28
+ cmakelists = File.expand_path(File.join(srcdir, 'CMakeLists.txt'))
29
+ raise UnregeneratableConfigurationError, 'CMakeLists.txt already exists' if File.exist?(cmakelists) && !options['overwrite']
30
+
31
+ Xezat.logger.debug(' Generate CMakeLists.txt')
32
+
33
+ File.atomic_write(cmakelists) do |f|
34
+ f.write(get_cmakelists(variables))
35
+ end
36
+ end
37
+
38
+ def get_cmakelists(variables)
39
+ erb = File.expand_path(File.join(TEMPLATE_DIR, 'cmake', 'cmake.erb'))
40
+ ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -3,12 +3,10 @@
3
3
  require 'English'
4
4
  require 'facets/file/atomic_open'
5
5
  require 'facets/file/atomic_write'
6
+ require 'xezat/generator'
6
7
  require 'xezat/variables'
7
8
 
8
9
  module Xezat
9
- class UnregeneratableConfigurationError < StandardError
10
- end
11
-
12
10
  class AutotoolsFileNotFoundError < StandardError
13
11
  end
14
12
 
@@ -51,7 +49,7 @@ module Xezat
51
49
  end
52
50
 
53
51
  def get_pkg_config(variables)
54
- erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig.erb'))
52
+ erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'pkgconfig.erb'))
55
53
  ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
56
54
  end
57
55
 
@@ -72,7 +70,7 @@ module Xezat
72
70
  end
73
71
 
74
72
  def get_cmakelists(variables)
75
- erb = File.expand_path(File.join(TEMPLATE_DIR, 'cmake.erb'))
73
+ erb = File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'cmake.erb'))
76
74
  ERB.new(File.readlines(erb).join(nil), trim_mode: '%-').result(binding)
77
75
  end
78
76
 
@@ -84,7 +82,7 @@ module Xezat
84
82
  configure_ac = File.expand_path(File.join(srcdir, 'configure.in')) unless File.exist?(configure_ac)
85
83
  raise AutotoolsFileNotFoundError unless File.exist?(configure_ac)
86
84
 
87
- original_ac = File.read(configure_ac)
85
+ original_ac = File.read(configure_ac).scrub
88
86
 
89
87
  if /#{pn}.pc/.match?(original_ac)
90
88
  Xezat.logger.debug(" Not rewrite #{configure_ac}")
@@ -104,7 +102,7 @@ module Xezat
104
102
  break
105
103
  end
106
104
 
107
- commands_am = File.read(File.expand_path(File.join(TEMPLATE_DIR, 'Makefile.am')))
105
+ commands_am = File.read(File.expand_path(File.join(TEMPLATE_DIR, 'pkgconfig', 'Makefile.am')))
108
106
  File.atomic_open(makefile_am, 'a') do |fm|
109
107
  fm.write(commands_am)
110
108
  end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Xezat
4
+ class UnregeneratableConfigurationError < StandardError
5
+ end
6
+ end
data/lib/xezat/main.rb CHANGED
@@ -8,6 +8,7 @@ require 'xezat/version'
8
8
  module Xezat
9
9
  class Main < Thor
10
10
  include ZshCompletion::Command
11
+
11
12
  class_option :config, type: :string, aliases: '-c', desc: 'specify config', default: CONFIG_FILE
12
13
  class_option :help, type: :boolean, aliases: '-h', desc: 'help message'
13
14
 
@@ -10,7 +10,7 @@ require 'yaml'
10
10
  require 'xezat'
11
11
 
12
12
  module Xezat
13
- def variables(cygport)
13
+ def variables(cygport, var2yaml_fetcher: nil)
14
14
  cygport_dir = File.dirname(File.absolute_path(cygport))
15
15
  cache_file = File.expand_path(File.join(cygport_dir, "#{File.basename(cygport, '.cygport')}.#{Etc.uname[:machine]}.yml"))
16
16
 
@@ -23,9 +23,11 @@ module Xezat
23
23
  end
24
24
  end
25
25
 
26
- command = ['bash', File.expand_path(File.join(DATA_DIR, 'var2yaml.sh')), cygport]
27
- result, error, status = Open3.capture3(command.join(' '))
28
- raise CygportProcessError, error unless status.success?
26
+ result = if var2yaml_fetcher
27
+ var2yaml_fetcher.call(cygport)
28
+ else
29
+ execute_var2yaml(cygport)
30
+ end
29
31
 
30
32
  result.gsub!(/^.*\*\*\*.*$/, '')
31
33
 
@@ -55,4 +57,14 @@ module Xezat
55
57
  lineno += 1
56
58
  end
57
59
  end
60
+
61
+ private
62
+
63
+ def execute_var2yaml(cygport)
64
+ command = ['bash', File.expand_path(File.join(DATA_DIR, 'var2yaml.sh')), cygport]
65
+ result, error, status = Open3.capture3(command.join(' '))
66
+ raise CygportProcessError, error unless status.success?
67
+
68
+ result
69
+ end
58
70
  end
data/lib/xezat/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Xezat
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
data/lib/xezat.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'colorize'
3
4
  require 'logger'
4
5
 
5
6
  module Xezat
@@ -14,7 +15,15 @@ module Xezat
14
15
  end
15
16
  Xezat.logger = Logger.new($stdout)
16
17
  Xezat.logger.formatter = proc { |severity, datetime, _progname, message|
17
- "#{datetime}: [#{severity}] #{message}\n"
18
+ format = "#{datetime}: [#{severity}] #{message}\n"
19
+ case severity
20
+ when 'ERROR'
21
+ format.colorize(:red)
22
+ when 'WARN'
23
+ format.colorize(:yellow)
24
+ else
25
+ format
26
+ end
18
27
  }
19
28
 
20
29
  class CygportProcessError < StandardError