Hello community, here is the log from the commit of package rubygem-colorize for openSUSE:Factory checked in at 2016-07-01 09:59:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-colorize (Old) and /work/SRC/openSUSE:Factory/.rubygem-colorize.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-colorize" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-colorize/rubygem-colorize.changes 2015-04-25 11:25:48.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-colorize.new/rubygem-colorize.changes 2016-07-01 09:59:15.000000000 +0200 @@ -1,0 +2,13 @@ +Tue Jun 28 04:30:55 UTC 2016 - co...@suse.com + +- updated to version 0.8.0 + see installed CHANGELOG + + == 0.8.0 / 2016-06-27 + * add ColorizedString class + * update README file + * add rubocop.yml and follow style + * add italic mode + * remove interpreter warrnings + +------------------------------------------------------------------- Old: ---- colorize-0.7.7.gem New: ---- colorize-0.8.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-colorize.spec ++++++ --- /var/tmp/diff_new_pack.ywDtJb/_old 2016-07-01 09:59:16.000000000 +0200 +++ /var/tmp/diff_new_pack.ywDtJb/_new 2016-07-01 09:59:16.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-colorize # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,7 +24,7 @@ # Name: rubygem-colorize -Version: 0.7.7 +Version: 0.8.0 Release: 0 %define mod_name colorize %define mod_full_name %{mod_name}-%{version} @@ -35,14 +35,13 @@ Url: http://github.com/fazibear/colorize Source: http://rubygems.org/gems/%{mod_full_name}.gem Source1: gem2rpm.yml -Summary: Add color methods to String class +Summary: Ruby gem for colorizing text using ANSI escape sequences License: GPL-2.0 Group: Development/Languages/Ruby %description -Ruby String class extension. Adds methods to set text color, background color -and, text effects on ruby console and command line output, using ANSI escape -sequences. +Extends String class or add a ColorizedString with methods to set text color, +background color and text effects. %prep ++++++ colorize-0.7.7.gem -> colorize-0.8.0.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG new/CHANGELOG --- old/CHANGELOG 2015-04-19 10:54:25.000000000 +0200 +++ new/CHANGELOG 2016-06-27 14:16:49.000000000 +0200 @@ -1,3 +1,10 @@ +== 0.8.0 / 2016-06-27 + * add ColorizedString class + * update README file + * add rubocop.yml and follow style + * add italic mode + * remove interpreter warrnings + == 0.7.7 / 2015-04-19 * update gems diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 2015-04-19 10:54:25.000000000 +0200 +++ new/README.md 2016-06-27 14:16:49.000000000 +0200 @@ -1,7 +1,14 @@ colorize [![Gem Version](https://badge.fury.io/rb/colorize.svg)](http://badge.fury.io/rb/colorize) [![Build Status](https://travis-ci.org/fazibear/colorize.svg?branch=master)](https://travis-ci.org/fazibear/colorize) [![Code Climate](https://codeclimate.com/github/fazibear/colorize/badges/gpa.svg)](https://codeclimate.com/github/fazibear/colorize) [![Test Coverage](https://codeclimate.com/github/fazibear/colorize/badges/coverage.svg)](https://codeclimate.com/github/fazibear/colorize) ======== -Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences. +Ruby gem for colorizing text using ANSI escape sequences. +Extends `String` class or add a `ColorizedString` with methods to set text color, background color and text effects. + +modes +----- + +* `require 'colorize'` - Extends String class +* `require 'colorized_string'` - add ColorizedString class features -------- @@ -9,13 +16,24 @@ * change string color * change string background * change string effect +* display color samples +* disable colorization usage ----- -Some usage samples: - ```ruby +require 'colorize' + +String.colors # return array of all possible colors names +String.modes # return array of all possible modes +String.color_samples # displays color samples in all combinations +String.disable_colorization # check if colorization is disabled +String.disable_colorization = false # enable colorization +String.disable_colorization false # enable colorization +String.disable_colorization = true # disable colorization +String.disable_colorization true # disable colorization + puts "This is blue".colorize(:blue) puts "This is light blue".colorize(:light_blue) puts "This is also blue".colorize(:color => :blue) @@ -28,17 +46,31 @@ puts "This is uncolorized".blue.on_red.uncolorize ``` -Class methods: - ```ruby -String.colors # return array of all possible colors names -String.modes # return array of all possible modes -String.color_samples # displays color samples in all combinations -String.disable_colorization # check if colorization is disabled -String.disable_colorization = false # enable colorization -String.disable_colorization false # enable colorization -String.disable_colorization = true # disable colorization -String.disable_colorization true # disable colorization +require 'colorized_string' + +ColorizedString.colors # return array of all possible colors names +ColorizedString.modes # return array of all possible modes +ColorizedString.color_samples # displays color samples in all combinations +ColorizedString.disable_colorization # check if colorization is disabled +ColorizedString.disable_colorization = false # enable colorization +ColorizedString.disable_colorization false # enable colorization +ColorizedString.disable_colorization = true # disable colorization +ColorizedString.disable_colorization true # disable colorization + +puts ColorizedString["This is blue"].colorize(:blue) +puts ColorizedString["This is light blue"].colorize(:light_blue) +puts ColorizedString["This is also blue"].colorize(:color => :blue) +puts ColorizedString["This is light blue with red background"].colorize(:color => :light_blue, :background => :red) +puts ColorizedString["This is light blue with red background"].colorize(:light_blue ).colorize( :background => :red) +puts ColorizedString["This is blue text on red"].blue.on_red +puts ColorizedString["This is red on blue"].colorize(:red).on_blue +puts ColorizedString["This is red on blue and underline"].colorize(:red).on_blue.underline +puts ColorizedString["This is blue text on red"].blue.on_red.blink +puts ColorizedString["This is uncolorized"].blue.on_red.uncolorize + +puts ColorizedString.new("This is blue").blue +puts ColorizedString.new("This is light blue").colorize(:light_blue) ``` requirements @@ -56,7 +88,7 @@ license ------- -Copyright (C) 2007-2015 Michał Kalbarczyk +Copyright (C) 2007-2016 Michał Kalbarczyk This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 2015-04-19 10:54:25.000000000 +0200 +++ new/Rakefile 2016-06-27 14:16:49.000000000 +0200 @@ -5,4 +5,9 @@ end desc 'Run tests' -task :default => :test +task :default do + ENV['TEST'] = 'test/test_colorize.rb' + Rake::Task[:test].execute + ENV['TEST'] = 'test/test_colorized_string.rb' + Rake::Task[:test].execute +end Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/colorize.gemspec new/colorize.gemspec --- old/colorize.gemspec 2015-04-19 10:54:25.000000000 +0200 +++ new/colorize.gemspec 2016-06-27 14:16:49.000000000 +0200 @@ -1,16 +1,16 @@ Gem::Specification.new do |s| s.name = 'colorize' - s.version = '0.7.7' + s.version = '0.8.0' s.authors = ['Michał Kalbarczyk'] s.email = 'fazib...@gmail.com' - s.date = Time.now.strftime("%Y-%m-%d") + s.date = Time.now.strftime('%Y-%m-%d') s.homepage = 'http://github.com/fazibear/colorize' - s.description = 'Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences.' - s.summary = 'Add color methods to String class' - s.license = 'GPL-2' + s.description = 'Extends String class or add a ColorizedString with methods to set text color, background color and text effects.' + s.summary = 'Ruby gem for colorizing text using ANSI escape sequences.' + s.license = 'GPL-2.0' s.require_paths = ['lib'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/colorize/class_methods.rb new/lib/colorize/class_methods.rb --- old/lib/colorize/class_methods.rb 2015-04-19 10:54:25.000000000 +0200 +++ new/lib/colorize/class_methods.rb 2016-06-27 14:16:49.000000000 +0200 @@ -1,12 +1,15 @@ module Colorize module ClassMethods - # # Property to disable colorization # def disable_colorization(value = nil) if value.nil? - @disable_colorization || false + if defined?(@disable_colorization) + @disable_colorization || false + else + false + end else @disable_colorization = (value || false) end @@ -39,17 +42,17 @@ def color_samples colors.permutation(2).each do |background, color| sample_text = "#{color.inspect.rjust(15)} on #{background.inspect.ljust(15)}" - puts "#{sample_text.colorize(:color => color, :background => background)} #{sample_text}" + puts "#{new(sample_text).colorize(:color => color, :background => background)} #{sample_text}" end end # # Method removed, raise NoMethodError # - def color_matrix(txt = '') + def color_matrix(_ = '') fail NoMethodError, '#color_matrix method was removed, try #color_samples instead' end - + # private # @@ -76,13 +79,14 @@ { :default => 0, # Turn off all attributes :bold => 1, # Set bold mode + :italic => 3, # Set italic mode :underline => 4, # Set underline mode :blink => 5, # Set blink mode :swap => 7, # Exchange foreground and background colors :hide => 8 # Hide text (foreground color would be the same as background) } end - + # # Generate color and on_color methods # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/colorize/instance_methods.rb new/lib/colorize/instance_methods.rb --- old/lib/colorize/instance_methods.rb 2015-04-19 10:54:25.000000000 +0200 +++ new/lib/colorize/instance_methods.rb 2016-06-27 14:16:49.000000000 +0200 @@ -1,6 +1,5 @@ module Colorize module InstanceMethods - # # Change color of string # @@ -20,9 +19,9 @@ def colorize(params) return self if self.class.disable_colorization require_windows_libs - scan_for_colors.inject('') do |str, match| - defaults_colors(match) + scan_for_colors.inject(self.class.new) do |str, match| colors_from_params(match, params) + defaults_colors(match) str << "\033[#{match[0]};#{match[1]};#{match[2]}m#{match[3]}\033[0m" end end @@ -31,7 +30,7 @@ # Return uncolorized string # def uncolorize - scan_for_colors.inject('') do |str, match| + scan_for_colors.inject(self.class.new) do |str, match| str << match[3] end end @@ -70,8 +69,8 @@ # Set colors from params hash # def colors_from_hash(match, hash) - match[0] = mode(hash[:mode]) if mode(hash[:mode]) - match[1] = color(hash[:color]) if color(hash[:color]) + match[0] = mode(hash[:mode]) if mode(hash[:mode]) + match[1] = color(hash[:color]) if color(hash[:color]) match[2] = background_color(hash[:background]) if background_color(hash[:background]) end @@ -113,23 +112,21 @@ end def split_colors(match) - colors = (match[0] || "").split(';') - Array.new(4).tap do |array| - array[0], array[1], array[2] = colors if colors.length == 3 - array[1] = colors if colors.length == 1 - array[3] = match[1] || match[2] - end + colors = (match[0] || '').split(';') + array = Array.new(3) + array[0], array[1], array[2] = colors if colors.length == 3 + array[1] = colors if colors.length == 1 + array[3] = match[1] || match[2] + array end # # Require windows libs # def require_windows_libs - begin - require 'Win32/Console/ANSI' if RUBY_VERSION < "2.0.0" && RUBY_PLATFORM =~ /win32/ - rescue LoadError - raise 'You must gem install win32console to use colorize on Windows' - end + require 'Win32/Console/ANSI' if RUBY_VERSION < '2.0.0' && RUBY_PLATFORM =~ /win32/ + rescue LoadError + raise 'You must gem install win32console to use colorize on Windows' end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/colorize.rb new/lib/colorize.rb --- old/lib/colorize.rb 2015-04-19 10:54:25.000000000 +0200 +++ new/lib/colorize.rb 2016-06-27 14:16:49.000000000 +0200 @@ -1,7 +1,7 @@ require File.expand_path('colorize/class_methods', File.dirname(__FILE__)) require File.expand_path('colorize/instance_methods', File.dirname(__FILE__)) # -# Colorize String class extension. +# String class extension. # class String extend Colorize::ClassMethods diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-04-19 10:54:25.000000000 +0200 +++ new/metadata 2016-06-27 14:16:49.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: colorize version: !ruby/object:Gem::Version - version: 0.7.7 + version: 0.8.0 platform: ruby authors: - Michał Kalbarczyk autorequire: bindir: bin cert_chain: [] -date: 2015-04-19 00:00:00.000000000 Z +date: 2016-06-27 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake @@ -52,9 +52,8 @@ - - "~>" - !ruby/object:Gem::Version version: '0.4' -description: Ruby String class extension. Adds methods to set text color, background - color and, text effects on ruby console and command line output, using ANSI escape - sequences. +description: Extends String class or add a ColorizedString with methods to set text + color, background color and text effects. email: fazib...@gmail.com executables: [] extensions: [] @@ -71,7 +70,7 @@ - test/test_colorize.rb homepage: http://github.com/fazibear/colorize licenses: -- GPL-2 +- GPL-2.0 metadata: {} post_install_message: rdoc_options: [] @@ -89,9 +88,9 @@ version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.4.5 +rubygems_version: 2.5.1 signing_key: specification_version: 4 -summary: Add color methods to String class +summary: Ruby gem for colorizing text using ANSI escape sequences. test_files: - test/test_colorize.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_colorize.rb new/test/test_colorize.rb --- old/test/test_colorize.rb 2015-04-19 10:54:25.000000000 +0200 +++ new/test/test_colorize.rb 2016-06-27 14:16:49.000000000 +0200 @@ -1,7 +1,7 @@ -require "codeclimate-test-reporter" +require 'codeclimate-test-reporter' CodeClimate::TestReporter.start -require "minitest/autorun" +require 'minitest/autorun' require File.dirname(__FILE__) + '/../lib/colorize' class TestColorize < Minitest::Test @@ -68,25 +68,28 @@ def test_uncolorize assert_equal 'This is uncolorized'.blue.on_red.uncolorize, - "This is uncolorized" + 'This is uncolorized' end def test_colorized? assert_equal 'Red'.red.colorized?, true assert_equal 'Blue'.colorized?, false assert_equal 'Green'.blue.green.uncolorize.colorized?, false - assert_equal ('none' + 'red'.red + 'none' + 'blue'.blue + 'none').colorized?, true - assert_equal ('none' + 'red'.red + 'none' + 'blue'.blue + 'none').uncolorize.colorized?, false + end + + def test_concatenated__colorize? + assert_equal "none #{'red'.red} none #{'blue'.blue} none".colorized?, true + assert_equal "none #{'red'.red} none #{'blue'.blue} none".uncolorize.colorized?, false end def test_concatenated_strings_on_green - assert_equal ('none' + 'red'.red + 'none' + 'blue'.blue + 'none').on_green, - "\e[0;39;42mnone\e[0m\e[0;31;42mred\e[0m\e[0;39;42mnone\e[0m\e[0;34;42mblue\e[0m\e[0;39;42mnone\e[0m" + assert_equal "none #{'red'.red} none #{'blue'.blue} none".on_green, + "\e[0;39;42mnone \e[0m\e[0;31;42mred\e[0m\e[0;39;42m none \e[0m\e[0;34;42mblue\e[0m\e[0;39;42m none\e[0m" end def test_concatenated_strings_uncolorize - assert_equal ('none' + 'red'.red + 'none' + 'blue'.blue + 'none').uncolorize, - "nonerednonebluenone" + assert_equal "none #{'red'.red} none #{'blue'.blue} none".uncolorize, + 'none red none blue none' end def test_frozen_strings