From db6d86caf29b06a4d1b89165e8fae20a17a6edbe Mon Sep 17 00:00:00 2001 From: Vitalii Elenhaupt Date: Sat, 4 Nov 2017 12:20:10 +0200 Subject: [PATCH] Crystal next support --- .gitignore | 2 ++ spec/integration/icr_spec.cr | 2 +- src/icr.cr | 2 +- src/icr/executer.cr | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b53ea81..bf7cc27 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /bin/icr src/bin + +.icr.*.cr diff --git a/spec/integration/icr_spec.cr b/spec/integration/icr_spec.cr index c6744d6..d9b67fc 100644 --- a/spec/integration/icr_spec.cr +++ b/spec/integration/icr_spec.cr @@ -358,7 +358,7 @@ describe "icr command" do icr("v__ = 0").should match /0/ icr("v__1 = 0").should match /0/ icr("filename = \"spec__helper.cr\"").should match /spec__helper.cr/ - icr("require \"secure_random\"").should match /ok/ + icr("require \"random/secure\"").should match /ok/ end end end diff --git a/src/icr.cr b/src/icr.cr index cbba1b2..93df444 100644 --- a/src/icr.cr +++ b/src/icr.cr @@ -1,7 +1,7 @@ require "readline" require "tempfile" require "io/memory" -require "secure_random" +require "random/secure" require "compiler/crystal/syntax" diff --git a/src/icr/executer.cr b/src/icr/executer.cr index 4c47ddb..12588b3 100644 --- a/src/icr/executer.cr +++ b/src/icr/executer.cr @@ -6,7 +6,7 @@ module Icr # Temporary file where generated source code is written # NOTE: File is created in the current dir, in order to be able to # require local files. - @tmp_file_name = ".icr_#{SecureRandom.urlsafe_base64}.cr" + @tmp_file_name = ".icr_#{Random::Secure.urlsafe_base64}.cr" @tmp_file_path = File.join(Dir.current, @tmp_file_name) # Accumulates the output from previous executions, so we can distinguish the @@ -19,7 +19,7 @@ module Icr io_out = IO::Memory.new io_error = IO::Memory.new command = "#{CRYSTAL_COMMAND} #{@tmp_file_path} --no-debug" - status = Process.run(command, nil, nil, false, true, nil, io_out, io_error) + status = Process.run(command, shell: true, output: io_out, error: io_error) print_source_file if @debug File.delete(@tmp_file_path)