summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2021-12-14 11:20:02 -0500
committerAustin Ziegler <austin@zieglers.ca>2021-12-14 11:21:10 -0500
commitb8082a4a3c0f4a3f7169d9f4a637e1fdd9d33810 (patch)
treef447c838b6a7b6302ff05d61e0a99d99472811c5 /Rakefile
parente4b02743f4f2d40cd43b0ec9071d6a5ba9787336 (diff)
downloaddiff-lcs-b8082a4a3c0f4a3f7169d9f4a637e1fdd9d33810.tar.gz
Add more versions to unit test
Technical Change Notes ====================== - Handle a bug in hoe with later versions of Ruby and/or Psych.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile35
1 files changed, 35 insertions, 0 deletions
diff --git a/Rakefile b/Rakefile
index 613a8d4..0bb7300 100644
--- a/Rakefile
+++ b/Rakefile
@@ -5,6 +5,41 @@ require 'rspec'
require 'rspec/core/rake_task'
require 'hoe'
+# This is required until https://github.com/seattlerb/hoe/issues/112 is fixed
+class Hoe
+ def with_config
+ config = Hoe::DEFAULT_CONFIG
+
+ rc = File.expand_path("~/.hoerc")
+ homeconfig = load_config(rc)
+ config = config.merge(homeconfig)
+
+ localconfig = load_config(File.expand_path(File.join(Dir.pwd, ".hoerc")))
+ config = config.merge(localconfig)
+
+ yield config, rc
+ end
+
+ def load_config(name)
+ File.exist?(name) ? safe_load_yaml(name) : {}
+ end
+
+ def safe_load_yaml(name)
+ return safe_load_yaml_file(name) if YAML.respond_to?(:safe_load_file)
+
+ data = IO.binread(name)
+ YAML.safe_load(data, permitted_classes: [Regexp])
+ rescue
+ YAML.safe_load(data, [Regexp])
+ end
+
+ def safe_load_yaml_file(name)
+ YAML.safe_load_file(name, permitted_classes: [Regexp])
+ rescue
+ YAML.safe_load_file(name, [Regexp])
+ end
+end
+
Hoe.plugin :bundler
Hoe.plugin :doofus
Hoe.plugin :gemspec2