digest-xxhash 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,6 @@ require 'digest'
2
2
 
3
3
  module Digest
4
4
  class XXHash < Digest::Class
5
- VERSION = "0.2.2"
5
+ VERSION = "0.2.3"
6
6
  end
7
7
  end
@@ -0,0 +1,59 @@
1
+ require 'singleton'
2
+
3
+ # Provides an alternate implementation of 'install' and 'install:local'.
4
+ #
5
+ # This mainly allows options to be forwarded to `gem install`.
6
+ #
7
+ class AltInstallTask < Rake::TaskLib
8
+ module GemName
9
+ def gem_name
10
+ gemspec = Bundler::GemHelper.gemspec
11
+ "#{gemspec.name}-#{gemspec.version}.gem"
12
+ end
13
+ end
14
+
15
+ module TaskComment
16
+ include GemName
17
+
18
+ def comment
19
+ comment = "Build and install #{gem_name} into system gems"
20
+ comment += " without network access" if name.to_s == "install:local"
21
+ comment
22
+ end
23
+
24
+ def full_comment
25
+ comment + "."
26
+ end
27
+ end
28
+
29
+ include Singleton
30
+ include GemName
31
+
32
+ def initialize
33
+ define
34
+ end
35
+
36
+ def define
37
+ [:install, :"install:local"].each do |name|
38
+ Rake::Task[name].clear if Rake::Task.task_defined?(name)
39
+ task(name => :build){ |task| execute_task(task) }
40
+ .singleton_class.prepend(TaskComment)
41
+ end
42
+ end
43
+
44
+ private
45
+ def pkg_dir
46
+ @pkg_dir ||= File.join(Bundler::GemHelper.instance.base, "pkg")
47
+ end
48
+
49
+ def execute_task(task)
50
+ built_gem = File.join(pkg_dir, gem_name)
51
+ raise "Gem '#{built_gem}' unexpectedly doesn't exist." unless File.exist? built_gem
52
+ gem_command = (ENV["GEM_COMMAND"].shellsplit rescue nil) || ["gem"]
53
+ opts = ARGV.select{ |e| e =~ /\A--?/ }
54
+ opts.unshift "--local" if task.name.to_s == "install:local"
55
+ Process.wait spawn(*gem_command, "install", built_gem, *opts)
56
+ end
57
+ end
58
+
59
+ AltInstallTask.instance
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digest-xxhash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - konsolebox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-12 00:00:00.000000000 Z
11
+ date: 2021-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -92,6 +92,7 @@ files:
92
92
  - ext/digest/xxhash/utils.h
93
93
  - ext/digest/xxhash/xxhash.h
94
94
  - lib/digest/xxhash/version.rb
95
+ - rakelib/alt-install-task.rake
95
96
  - test/produce-vectors-with-ruby-xxhash.rb
96
97
  - test/produce-vectors-with-xxhsum.rb
97
98
  - test/test.rb