From 160654efd4f6e46349e0f5d8b8e965d2f10ad184 Mon Sep 17 00:00:00 2001 From: Phil Ross Date: Sun, 8 Sep 2013 22:27:09 +0100 Subject: [PATCH] Add a Gemfile. Use the full path to the lib directory when running tests from Rake to avoid an 'insecure operation - require' error on Ruby 1.8.7 caused by bundler adding a tainted lib directory to the load path. --- .gitignore | 1 + Gemfile | 7 +++++++ Rakefile | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 Gemfile diff --git a/.gitignore b/.gitignore index de31a456..cf985014 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ doc pkg +Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..122c5494 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source "https://rubygems.org" + +gemspec + +group :test do + gem 'rake' +end diff --git a/Rakefile b/Rakefile index a6ca1a2e..c7df9089 100644 --- a/Rakefile +++ b/Rakefile @@ -35,6 +35,8 @@ begin rescue LoadError, RuntimeError end +BASE_DIR = File.expand_path(File.dirname(__FILE__)) + task :default => [:test] spec = eval(File.read('tzinfo.gemspec')) @@ -105,7 +107,8 @@ def setup_tests(test_task, type) # timezone isn't GMT). This won't work on Windows. ENV['TZ'] = 'America/Los_Angeles' - test_task.pattern = File.join(File.expand_path(File.dirname(__FILE__)), 'test', "ts_all_#{type}.rb") + test_task.libs = [File.join(BASE_DIR, 'lib')] + test_task.pattern = File.join(BASE_DIR, 'test', "ts_all_#{type}.rb") end Rake::TestTask.new(:test_ruby) do |t|