git_miner 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a915c54b13e195ecbe3b95b74e4244702fd9bec71a984a87e59a02080ebddef
4
- data.tar.gz: 4661c7660d691af5e236064a7da19460d5adbad3f44881b3268d955e2e59f0ea
3
+ metadata.gz: 19036e9a860b64229bdf5abee8d489b155e325c2520b709707a4417821b93f92
4
+ data.tar.gz: 1b79a6eeab4b439777646ce8763a3c35cc9c3f776794cf0d828871c6609ebae9
5
5
  SHA512:
6
- metadata.gz: 5ed7b15ee18e8662845858310b5eaab75ad9e719f43c5f190dbaaf465905ab7b66261f4cea721f706b54fb41a7768a0da55ddd8282c284b12dd6d3aeb32a5ded
7
- data.tar.gz: 0a143498f08746fcb3fa71f69988209284ef65f7e5aec5aae2e1c952f599bcc25d93735102076d988b3ab4a8d5169e493c04a8738b42c04686a686a503557c10
6
+ metadata.gz: be3d54581beda0968cc66199a8d67de09633f7fa4af3073c590fe18990c1e51419deb14cd2a49e3e792ab47160368f907eac17372154659d1de2b0c9935eafe4
7
+ data.tar.gz: 185f6efc588f2aed729856911a5bd34af54e3b3a01c5018354440ad3ce560cd662e5dfbcb4147af49ce2bb80c8a4996674b82d2886cf6693aa89e44a9ed987d7
data/Gemfile.lock CHANGED
@@ -1,32 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_miner (0.2.2)
4
+ git_miner (0.2.4)
5
5
  concurrent-ruby (~> 1.1)
6
6
  parallel (~> 1.17)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- concurrent-ruby (1.1.9)
12
- diff-lcs (1.3)
13
- parallel (1.21.0)
14
- rake (13.0.1)
15
- rake-compiler (1.0.7)
11
+ concurrent-ruby (1.1.10)
12
+ diff-lcs (1.5.0)
13
+ parallel (1.22.1)
14
+ rake (13.0.6)
15
+ rake-compiler (1.2.1)
16
16
  rake
17
- rspec (3.8.0)
18
- rspec-core (~> 3.8.0)
19
- rspec-expectations (~> 3.8.0)
20
- rspec-mocks (~> 3.8.0)
21
- rspec-core (3.8.0)
22
- rspec-support (~> 3.8.0)
23
- rspec-expectations (3.8.3)
17
+ rspec (3.12.0)
18
+ rspec-core (~> 3.12.0)
19
+ rspec-expectations (~> 3.12.0)
20
+ rspec-mocks (~> 3.12.0)
21
+ rspec-core (3.12.0)
22
+ rspec-support (~> 3.12.0)
23
+ rspec-expectations (3.12.1)
24
24
  diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.8.0)
26
- rspec-mocks (3.8.0)
25
+ rspec-support (~> 3.12.0)
26
+ rspec-mocks (3.12.1)
27
27
  diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.8.0)
29
- rspec-support (3.8.0)
28
+ rspec-support (~> 3.12.0)
29
+ rspec-support (3.12.0)
30
30
 
31
31
  PLATFORMS
32
32
  ruby
@@ -1,14 +1,15 @@
1
1
  #include "ruby.h"
2
- #include "openssl/sha.h"
2
+
3
3
  #include <stdio.h>
4
4
  #include <stdbool.h>
5
+ #include <openssl/sha.h>
5
6
 
6
7
  VALUE GitMinerExt = Qnil;
7
8
 
8
9
  void Init_git_miner_ext();
9
10
 
10
11
  VALUE rb_sha1_hexdigest(VALUE self, VALUE rbString);
11
- VALUE rb_sha1_mine(VALUE self, int authorOffset, int committerOffset, int qty);
12
+ VALUE rb_sha1_mine(VALUE self, VALUE vAuthorOffset, VALUE vCommitterOffset, VALUE vQty);
12
13
 
13
14
  void Init_git_miner_ext() {
14
15
  GitMinerExt = rb_define_module("GitMinerExt");
@@ -18,9 +19,9 @@ void Init_git_miner_ext() {
18
19
 
19
20
  VALUE rb_sha1_hexdigest(VALUE self, VALUE rbString) {
20
21
  unsigned char result[SHA_DIGEST_LENGTH];
21
- const char *string = StringValueCStr(rbString);
22
+ const char* string = StringValueCStr(rbString);
22
23
 
23
- SHA1(string, strlen(string), result);
24
+ SHA1( (unsigned char*) string, strlen(string), result);
24
25
 
25
26
  unsigned char resultHex[SHA_DIGEST_LENGTH*2 + 1];
26
27
  int i = 0;
@@ -28,11 +29,15 @@ VALUE rb_sha1_hexdigest(VALUE self, VALUE rbString) {
28
29
  sprintf((char*)&(resultHex[i*2]), "%02x", result[i]);
29
30
  }
30
31
 
31
- printf("ShaGenDebug: %s\n", resultHex);
32
- return rb_str_new_cstr(resultHex);
32
+ printf("ShaGenDebug: %s\n",(char*) resultHex);
33
+ return rb_str_new_cstr((char*) resultHex);
33
34
  }
34
35
 
35
- VALUE rb_sha1_mine(VALUE self, int authorOffset, int committerOffset, int qty) {
36
+ VALUE rb_sha1_mine(VALUE self, VALUE vAuthorOffset, VALUE vCommitterOffset, VALUE vQty) {
37
+ long authorOffset = FIX2LONG(vAuthorOffset);
38
+ long committerOffset = FIX2LONG(vCommitterOffset);
39
+ int qty = FIX2INT(vQty);
40
+
36
41
  VALUE rbPrefix = rb_iv_get(self, "@prefix");
37
42
  char* prefix = StringValueCStr(rbPrefix);
38
43
 
@@ -75,24 +80,25 @@ VALUE rb_sha1_mine(VALUE self, int authorOffset, int committerOffset, int qty) {
75
80
  gitHeadTree,
76
81
  gitHeadParent,
77
82
  gitHeadAuthorPrefix,
78
- timestamp - authorOffset,
83
+ (int) (timestamp - authorOffset),
79
84
  gitHeadCommitterPrefix,
80
- timestamp - committerOffset,
85
+ (int) (timestamp - committerOffset),
81
86
  gitHeadMessage
82
87
  );
83
88
 
84
- sprintf(commitPrefix, "commit %d", strlen(currentHead));
89
+ sprintf(commitPrefix, "commit %d", (int) strlen(currentHead));
85
90
  sprintf(currentCommit, "%s_%s", commitPrefix, currentHead);
86
91
  currentCommit[strlen(commitPrefix)] = '\0';
87
92
 
88
- shaLen = strlen(commitPrefix) + 1 + strlen(currentHead);
89
- SHA1(currentCommit, shaLen, currentSha);
93
+ shaLen = (int) strlen(commitPrefix) + 1 + (int) strlen(currentHead);
94
+
95
+ SHA1( (unsigned char*) currentCommit, shaLen, currentSha);
90
96
 
91
97
  for (int j = 0; j < SHA_DIGEST_LENGTH; j++) {
92
98
  sprintf((char*)&(currentHex[j*2]), "%02x", currentSha[j]);
93
99
  }
94
100
 
95
- int prefixLen = strlen(prefix);
101
+ int prefixLen = (int) strlen(prefix);
96
102
  bool match = true;
97
103
  for(int j = 0; j < prefixLen; j++) {
98
104
  match = match && (prefix[j] == currentHex[j]);
@@ -7,5 +7,8 @@ extension_name = 'git_miner_ext'
7
7
  # The destination
8
8
  dir_config(extension_name)
9
9
 
10
+ # Requirement for SHA1
11
+ have_library("crypto")
12
+
10
13
  # Do the work
11
14
  create_makefile(extension_name)
@@ -1,3 +1,3 @@
1
1
  module GitMiner
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_miner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thierry Joyal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-30 00:00:00.000000000 Z
11
+ date: 2022-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
- rubygems_version: 3.2.32
153
+ rubygems_version: 3.3.26
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: git-mine shell executable