From ab1b603c7855f5f356609dc8d4b2433745acbdb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=2E=20Sch=C3=A4fer?= Date: Tue, 6 Jan 2015 22:06:55 +0100 Subject: [PATCH] Require thread-gem and solve problem with visibility of variable p in convert-grammars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * The `thread`-gem is required for the script, because otherwise Ruby throws an error that `Queue` in line 259 is an uninitialized constant * The variable `p` was previously in the same method with the status message saying `OK ‹path› ‹converted scopes›`. But `p` is now defined in load_grammars() and thus not visible when showing the OK-message in install_grammars(). This was solved by adding a path-parameter to install_grammars(). --- script/convert-grammars | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/script/convert-grammars b/script/convert-grammars index a9b2bfea..7f3a0ee9 100755 --- a/script/convert-grammars +++ b/script/convert-grammars @@ -5,6 +5,7 @@ require 'net/http' require 'optparse' require 'plist' require 'set' +require 'thread' require 'tmpdir' require 'uri' require 'yaml' @@ -195,7 +196,7 @@ def load_grammars(tmp_dir, source, all_scopes) end end -def install_grammars(grammars) +def install_grammars(grammars, path) installed = [] grammars.each do |grammar| @@ -204,7 +205,7 @@ def install_grammars(grammars) installed << scope end - $stderr.puts("OK #{p.url} (#{installed.join(', ')})") + $stderr.puts("OK #{path} (#{installed.join(', ')})") end def run_thread(queue, all_scopes) @@ -221,7 +222,7 @@ def run_thread(queue, all_scopes) Dir.mkdir(dir) grammars = load_grammars(dir, source, all_scopes) - install_grammars(grammars) if $options[:install] + install_grammars(grammars, source) if $options[:install] end end end