Hello community, here is the log from the commit of package rubygem-yast-rake for openSUSE:Factory checked in at 2015-05-07 08:27:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-yast-rake (Old) and /work/SRC/openSUSE:Factory/.rubygem-yast-rake.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-yast-rake" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-yast-rake/rubygem-yast-rake.changes 2015-03-29 20:17:24.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-yast-rake.new/rubygem-yast-rake.changes 2015-05-07 08:27:57.000000000 +0200 @@ -1,0 +2,26 @@ +Tue Apr 28 15:38:56 UTC 2015 - lsle...@suse.cz + +- use rubocop for checking the code style + +------------------------------------------------------------------- +Tue Apr 28 13:34:00 UTC 2015 - lsle...@suse.cz + +- optionally load the tasks from yast-rake-ci if it is installed +- 0.2.3 + +------------------------------------------------------------------- +Thu Apr 23 18:27:49 UTC 2015 - lsle...@suse.cz + +- allow to run the "check:spelling" task outside a Git checkout + (to use it in the Jenkins jobs during package build) +- colorize the misspelled words in the output (if the "rainbow" + gem is installed) +- use YAML config files +- 0.2.2 + +------------------------------------------------------------------- +Wed Apr 1 10:07:26 UTC 2015 - jreidin...@suse.com + +- regenerate spec file to fix build for ruby2.2 in OBS + +------------------------------------------------------------------- Old: ---- yast-rake-0.2.1.gem New: ---- yast-rake-0.2.3.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-yast-rake.spec ++++++ --- /var/tmp/diff_new_pack.4wLd1g/_old 2015-05-07 08:27:57.000000000 +0200 +++ /var/tmp/diff_new_pack.4wLd1g/_new 2015-05-07 08:27:57.000000000 +0200 @@ -17,14 +17,15 @@ Name: rubygem-yast-rake -Version: 0.2.1 +Version: 0.2.3 Release: 0 %define mod_name yast-rake %define mod_full_name %{mod_name}-%{version} - BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: ruby-macros >= 1 -Url: http://github.org/yast/yast-rake +BuildRequires: %{rubygem gem2rpm} +BuildRequires: %{ruby} +BuildRequires: ruby-macros >= 5 +Url: http://github.org/openSUSE/yast-rake Source: http://rubygems.org/gems/%{mod_full_name}.gem Summary: Rake tasks providing basic work-flow for Yast development License: LGPL-2.1 @@ -35,34 +36,15 @@ send it to build service, create submit request to target repo or run client from git repo. -%package doc -Summary: RDoc documentation for %{mod_name} -Group: Development/Languages/Ruby -Requires: %{name} = %{version} - -%description doc -Documentation generated at gem installation time. -Usually in RDoc and RI formats. - %prep -#gem_unpack -#if you need patches, apply them here and replace the # with a % sign in the surrounding lines -#gem_build %build %install -%gem_install -f +%gem_install \ + --doc-files="COPYING" \ + -f -%files -%defattr(-,root,root,-) -%{_libdir}/ruby/gems/%{rb_ver}/cache/%{mod_full_name}.gem -%{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/ -%{_libdir}/ruby/gems/%{rb_ver}/specifications/%{mod_full_name}.gemspec -%doc %{_libdir}/ruby/gems/%{rb_ver}/gems/%{mod_full_name}/COPYING - -%files doc -%defattr(-,root,root,-) -%doc %{_libdir}/ruby/gems/%{rb_ver}/doc/%{mod_full_name}/ +%gem_packages %changelog ++++++ yast-rake-0.2.1.gem -> yast-rake-0.2.3.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/VERSION new/VERSION --- old/VERSION 2015-03-26 15:21:23.000000000 +0100 +++ new/VERSION 2015-04-29 10:53:52.000000000 +0200 @@ -1 +1 @@ -0.2.1 +0.2.3 Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/install.rake new/lib/tasks/install.rake --- old/lib/tasks/install.rake 2015-03-26 15:21:23.000000000 +0100 +++ new/lib/tasks/install.rake 2015-04-29 10:53:52.000000000 +0200 @@ -23,15 +23,14 @@ class Configuration attr_writer :install_locations - DESTDIR = ENV['DESTDIR'] || '/' - YAST_DIR = DESTDIR + '/usr/share/YaST2/' - YAST_LIB_DIR = DESTDIR + '/usr/lib/YaST2/' - YAST_DESKTOP_DIR = DESTDIR + '/usr/share/applications/YaST2/' - AUTOYAST_RNC_DIR = YAST_DIR + 'schema/autoyast/rnc/' - FILLUP_DIR = DESTDIR + '/var/adm/fillup-templates/' + DESTDIR = ENV["DESTDIR"] || "/" + YAST_DIR = DESTDIR + "/usr/share/YaST2/" + YAST_LIB_DIR = DESTDIR + "/usr/lib/YaST2/" + YAST_DESKTOP_DIR = DESTDIR + "/usr/share/applications/YaST2/" + AUTOYAST_RNC_DIR = YAST_DIR + "schema/autoyast/rnc/" + FILLUP_DIR = DESTDIR + "/var/adm/fillup-templates/" - - #specific directory that contain dynamic part of package name + # specific directory that contain dynamic part of package name def install_doc_dir DESTDIR + "/usr/share/doc/packages/#{package_name}/" end @@ -52,7 +51,7 @@ "**/src/autoyast[_-]rnc/*" => AUTOYAST_RNC_DIR, "**/src/fillup/*" => FILLUP_DIR, "**/src/desktop/*.desktop" => YAST_DESKTOP_DIR, - "{README*,COPYING,CONTRIBUTING.md}" => install_doc_dir, + "{README*,COPYING,CONTRIBUTING.md}" => install_doc_dir } end end @@ -62,7 +61,7 @@ task :install do config = ::Packaging::Configuration.instance config.install_locations.each_pair do |glob, install_to| - FileUtils.mkdir_p(install_to, :verbose => true) unless File.directory?(install_to) + FileUtils.mkdir_p(install_to, verbose: true) unless File.directory?(install_to) Dir[glob].each do |source| begin # do not use FileUtils.cp_r as it have different behavior if target diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/pot.rake new/lib/tasks/pot.rake --- old/lib/tasks/pot.rake 2015-03-26 15:21:23.000000000 +0100 +++ new/lib/tasks/pot.rake 2015-04-29 10:53:52.000000000 +0200 @@ -52,14 +52,14 @@ desc "Check translatable strings for common mistakes" # depends on the global "pot" task defined above - task :pot => :"rake:pot" do + task pot: :"rake:pot" do Dir["*.pot"].each do |pot| puts "Checking #{pot}..." lines = File.readlines(pot) # remove comments - lines.reject!{ |line| line.match(/^#/) } + lines.reject! { |line| line.match(/^#/) } # Ruby substitution present? - lines.select!{ |line| line.include?('#{') } + lines.select! { |line| line.include?("\#{") } clean_pot_lines(lines) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/run.rake new/lib/tasks/run.rake --- old/lib/tasks/run.rake 2015-03-26 15:21:23.000000000 +0100 +++ new/lib/tasks/run.rake 2015-04-29 10:53:52.000000000 +0200 @@ -21,8 +21,8 @@ end desc "Run given client" -task :run, :client do |t, args| - args.with_defaults = { :client => nil } +task :run, :client do |_t, args| + args.with_defaults = { client: nil } client = args[:client] if client client = Dir["**/src/clients/#{client}.rb"].first diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/spell.dict new/lib/tasks/spell.dict --- old/lib/tasks/spell.dict 2015-03-26 15:21:23.000000000 +0100 +++ new/lib/tasks/spell.dict 1970-01-01 01:00:00.000000000 +0100 @@ -1,43 +0,0 @@ -# This is the global custom dictionary shared with all YaST repositories. -# -# Write the words in alphabetical order, one word per line. -# If an unknown word is not generic put it into the repository specific dictionary. -# -API -bnc -boolean -Bugzilla -devel -DHCP -freenode -gh -GitHub -GitHub's -html -IRC -LDAP -md -NCurses -NFS -NIS -openSUSE -osc -Rakefile -rb -refactorings -RSpec -runlevel -SCR -SLP -sudo -SUSE -systemd -testsuite -UI -WFM -workflow -yast -YaST -ycp -YCP -zypper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/spell.yml new/lib/tasks/spell.yml --- old/lib/tasks/spell.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/tasks/spell.yml 2015-04-29 10:53:52.000000000 +0200 @@ -0,0 +1,50 @@ +# This is the global spellcheck config shared by all YaST repositories. + +--- +check: + - "**/*.html" + - "**/*.md" +ignore: [] +dictionary: + # + # Notes: Write the words in alphabetical order, if an unknown word + # is not generic put it into the repository specific dictionary. + # + - API + - bnc + - boolean + - Bugzilla + - devel + - DHCP + - freenode + - gh + - GitHub + - GitHub's + - html + - IRC + - LDAP + - md + - NCurses + - NFS + - NIS + - openSUSE + - osc + - Rakefile + - rb + - refactorings + - RSpec + - runlevel + - SCR + - SLP + - sudo + - SUSE + - systemd + - testsuite + - UI + - WFM + - workflow + - yast + - YaST + - ycp + - YCP + - zypper diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/spellcheck.rake new/lib/tasks/spellcheck.rake --- old/lib/tasks/spellcheck.rake 2015-03-26 15:21:23.000000000 +0100 +++ new/lib/tasks/spellcheck.rake 2015-04-29 10:53:52.000000000 +0200 @@ -28,97 +28,5 @@ # The lines starting with '#' character are ignored (used for comments), # -GLOBAL_DICTIONARY_FILE = "spell.dict" -CUSTOM_DICTIONARY_FILE = ".spell.dict" - -def read_dictionary_file(file) - puts "Loading custom dictionary (#{file})..." if verbose == true - words = File.read(file).split("\n") - - # remove comments - words.reject! { |word| word.start_with?("#")} - words.each(&:chomp!) -end - -# read the global and the repository custom dictionary -def read_custom_words - # read the global default custom dictionary - dict_path = File.expand_path("../#{GLOBAL_DICTIONARY_FILE}", __FILE__) - custom_words = read_dictionary_file(dict_path) - - # read the custom dictionary from the project directory if present - dict_path = CUSTOM_DICTIONARY_FILE - if File.exist?(dict_path) - local_dict = read_dictionary_file(dict_path) - duplicates = custom_words & local_dict - - if !duplicates.empty? - $stderr.puts "Warning: Found duplicates in the local dictionary (#{dict_path}):\n" - duplicates.each {|duplicate| $stderr.puts " #{duplicate}" } - $stderr.puts - end - - custom_words += local_dict - duplicates - end - - custom_words -end - -def aspell_speller - # raspell is an optional dependency, handle the missing case nicely - begin - require "raspell" - rescue LoadError - $stderr.puts "ERROR: Ruby gem \"raspell\" is not installed." - exit 1 - end - - # initialize aspell - speller = Aspell.new("en_US") - speller.suggestion_mode = Aspell::NORMAL - # ignore the HTML tags in the text - speller.set_option("mode", "html") - - speller -end - -namespace :check do - desc "Run spell checker (by default for *.md and *.html files in Git)" - task :spelling, :regexp do |t, args| - regexp = args[:regexp] || /\.(md|html)\z/ - success = true - - files = `git ls-files . | grep -v \\.gitignore`.split("\n") - files.select!{|file| file.match(regexp)} - - custom_words = read_custom_words - speller = aspell_speller - - files.each do |file| - puts "Checking #{file}..." if verbose == true - # spell check each line separately so we can report error locations properly - lines = File.read(file).split("\n") - - lines.each_with_index do |text, index| - misspelled = speller.list_misspelled([text]) - custom_words - - if !misspelled.empty? - success = false - puts "#{file}:#{index + 1}: #{text.inspect}" - misspelled.each do |word| - puts " #{word.inspect} => #{speller.suggest(word)}" - end - puts - end - end - end - - if success - puts "Spelling OK." - else - $stderr.puts "Spellcheck failed! (Fix it or add the words to " \ - "'#{CUSTOM_DICTIONARY_FILE}' file if it is OK.)" - exit 1 - end - end -end +require_relative "spellcheck_task" +Yast::SpellcheckTask.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tasks/spellcheck_task.rb new/lib/tasks/spellcheck_task.rb --- old/lib/tasks/spellcheck_task.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/tasks/spellcheck_task.rb 2015-04-29 10:53:52.000000000 +0200 @@ -0,0 +1,168 @@ +#-- +# Yast rake +# +# Copyright (C) 2015 Novell, Inc. +# This library is free software; you can redistribute it and/or modify +# it only under the terms of version 2.1 of the GNU Lesser General Public +# License as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +#++ +# +# Rake task for checking spelling in the documentation files. +# By default checks all *.md and *.html files. +# +# Supports custom dictionaries: +# +# - global dictionary located in the tasks gem (lib/tasks/spell.yml) +# - repository specific dictionary (.spell.yml in the root directory) +# +# The custom dictionaries are defined at the "dictionary" key. +# + +require "rake" +require "rake/tasklib" + +module Yast + # Defines a spellcheck rake task + class SpellcheckTask < Rake::TaskLib + GLOBAL_SPELL_CONFIG_FILE = File.expand_path("../spell.yml", __FILE__) + CUSTOM_SPELL_CONFIG_FILE = ".spell.yml" + + # define the Rake task in the constructor + def initialize + namespace :check do + desc "Run spell checker (by default for *.md and *.html files)" + task :spelling do + run_task + end + end + end + + private + + # optionally colorize the misspelled words if the rainbow gem is present + # @return [Boolean] true when the colorization support is present + def colorize? + return @colorize unless @colorize.nil? + + begin + require "rainbow" + @colorize = true + rescue LoadError + @colorize = false + end + end + + # create an Aspell speller object + # @return [Aspell] the speller object + def speller + return @speller if @speller + # raspell is an optional dependency, handle the missing case nicely + begin + require "raspell" + rescue LoadError + $stderr.puts "ERROR: Ruby gem \"raspell\" is not installed." + exit 1 + end + + # initialize aspell + @speller = Aspell.new("en_US") + @speller.suggestion_mode = Aspell::NORMAL + # ignore the HTML tags in the text + @speller.set_option("mode", "html") + + @speller + end + + # evaluate the files to check + # @return [Array<String>] list of files + def files_to_check + files = config["check"].reduce([]) { |a, e| a + Dir[e] } + config["ignore"].reduce(files) { |a, e| a - Dir[e] } + end + + # read a Yaml config file + def read_spell_config(file) + return {} unless File.exist?(file) + + puts "Loading config file (#{file})..." if verbose == true + require "yaml" + YAML.load_file(file) + end + + # print the duplicate dictionary entries + # @param dict1 [Array<String>] the first dictionary + # @param dict2 [Array<String>] the second dictionary + def report_duplicates(dict1, dict2) + duplicates = dict1 & dict2 + return if duplicates.empty? + + $stderr.puts "Warning: Found dictionary duplicates in the local dictionary " \ + "(#{CUSTOM_SPELL_CONFIG_FILE}):\n" + duplicates.each { |duplicate| $stderr.puts " #{duplicate}" } + $stderr.puts + end + + # return the merged global and the custom spell configs + # @return [Hash] the merged configuration to use + def config + return @config if @config + + @config = read_spell_config(GLOBAL_SPELL_CONFIG_FILE) + custom_config = read_spell_config(CUSTOM_SPELL_CONFIG_FILE) + + report_duplicates(config["dictionary"], custom_config["dictionary"].to_a) + + custom_config["dictionary"] = @config["dictionary"] + custom_config["dictionary"].to_a + custom_config["dictionary"].uniq! + + # override the global values by the local if present + @config.merge!(custom_config) + + @config + end + + # check the file using the spellchecker + # @param file [String] file name + # @return [Boolean] true on success (no spelling error found) + def check_file(file) + puts "Checking #{file}..." if verbose == true + # spell check each line separately so we can report error locations properly + lines = File.read(file).split("\n") + + success = true + lines.each_with_index do |text, index| + misspelled = speller.list_misspelled([text]) - config["dictionary"] + next if misspelled.empty? + + success = false + misspelled.each { |word| text.gsub!(word, Rainbow(word).red) } if colorize? + puts "#{file}:#{index + 1}: \"#{text}\"" + + misspelled.each { |word| puts " #{word.inspect} => #{speller.suggest(word)}" } + puts + end + + success + end + + # run the task + def run_task + if files_to_check.all? { |file| check_file(file) } + puts "Spelling OK." + else + $stderr.puts "Spellcheck failed! (Fix it or add the words to " \ + "'#{CUSTOM_SPELL_CONFIG_FILE}' file if it is OK.)" + exit 1 + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/yast/rake.rb new/lib/yast/rake.rb --- old/lib/yast/rake.rb 2015-03-26 15:21:23.000000000 +0100 +++ new/lib/yast/rake.rb 2015-04-29 10:53:52.000000000 +0200 @@ -17,11 +17,12 @@ #++ require "packaging" -#create wrapper to Packaging Configuration +# create wrapper to Packaging Configuration module Yast + # Yast::Task module contains helper methods module Tasks - def self.configuration &block - ::Packaging.configuration &block + def self.configuration(&block) + ::Packaging.configuration(&block) end # read the version from spec file @@ -45,7 +46,7 @@ Yast::Tasks.configuration do |conf| conf.obs_project = "YaST:Head" conf.obs_sr_project = "openSUSE:Factory" - conf.package_name = File.read("RPMNAME").strip if File.exists?("RPMNAME") + conf.package_name = File.read("RPMNAME").strip if File.exist?("RPMNAME") conf.version = Yast::Tasks.spec_version if !Dir.glob("package/*.spec").empty? conf.skip_license_check << /spell.dict$/ # skip license check for spelling dictionaries end @@ -56,3 +57,9 @@ load f end +# optionally load the tasks from yast-rake-ci if it is installed +begin + require "yast/rake_ci" +rescue LoadError + puts "INFO: Gem yast-rake-ci not installed, extra tasks not loaded" if verbose == true +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2015-03-26 15:21:23.000000000 +0100 +++ new/metadata 2015-04-29 10:55:55.000000000 +0200 @@ -1,14 +1,14 @@ --- !ruby/object:Gem::Specification name: yast-rake version: !ruby/object:Gem::Version - version: 0.2.1 + version: 0.2.3 platform: ruby authors: - Josef Reidinger autorequire: bindir: bin cert_chain: [] -date: 2015-03-26 00:00:00.000000000 Z +date: 2015-04-29 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: rake @@ -52,8 +52,9 @@ - lib/tasks/install.rake - lib/tasks/pot.rake - lib/tasks/run.rake -- lib/tasks/spell.dict +- lib/tasks/spell.yml - lib/tasks/spellcheck.rake +- lib/tasks/spellcheck_task.rb - lib/tasks/test_unit.rake - lib/tasks/version.rake - lib/yast/rake.rb