From 996feaf62c1b38c40fdd6600a9c252ff3118a208 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Mon, 13 Feb 2023 22:58:22 -0800 Subject: [PATCH] Update gems and add .ruby-version --- ruby/.ruby-version | 1 + ruby/Gemfile.lock | 3 ++- ruby/a1 | 5 +---- ruby/shell.rb | 2 ++ ruby/test/shell_test.rb | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 ruby/.ruby-version diff --git a/ruby/.ruby-version b/ruby/.ruby-version new file mode 100644 index 0000000..fd2a018 --- /dev/null +++ b/ruby/.ruby-version @@ -0,0 +1 @@ +3.1.0 diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 47b95df..254b503 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -27,6 +27,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-22 DEPENDENCIES minitest (~> 5.15) @@ -38,4 +39,4 @@ RUBY VERSION ruby 3.1.0p0 BUNDLED WITH - 2.3.3 + 2.4.6 diff --git a/ruby/a1 b/ruby/a1 index 55b8a20..6f81bd5 100755 --- a/ruby/a1 +++ b/ruby/a1 @@ -1,9 +1,6 @@ #!/usr/bin/env ruby -w require 'English' - -$LOAD_PATH << File.expand_path(__dir__) - -require 'shell' +require_relative './shell' Shell::CLI.new.run(args: ARGV) if $PROGRAM_NAME == __FILE__ diff --git a/ruby/shell.rb b/ruby/shell.rb index 22df219..c113b43 100644 --- a/ruby/shell.rb +++ b/ruby/shell.rb @@ -1,3 +1,5 @@ +$LOAD_PATH << File.expand_path(__dir__) + require 'shell/cli' require 'shell/repl' diff --git a/ruby/test/shell_test.rb b/ruby/test/shell_test.rb index 7500ae2..bbd31ea 100644 --- a/ruby/test/shell_test.rb +++ b/ruby/test/shell_test.rb @@ -18,7 +18,7 @@ class ShellTest < Minitest::Test end def test_expands_environment_variables - assert_equal ENV['HOME'], `#{A1_PATH} -c 'echo $HOME'`.chomp + assert_equal Dir.home, `#{A1_PATH} -c 'echo $HOME'`.chomp assert system("#{A1_PATH} -c 'echo $HOME' >/dev/null") end