disclose 0.7.0 → 0.8.0
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 +4 -4
- data/lib/disclose.rb +1 -1
- data/lib/disclose/c.rb +40 -20
- data/lib/disclose/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c85f9d8f954fc9ced18459fa617c6f8d96af4091
|
4
|
+
data.tar.gz: 938d621f9209a86cbf5c57b4ed9138dc59c5e367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1879a2e084fe2cba271d75f74fe67fb59af1b1daaf1737e16faebc14cf4944e5c6c2add08035f18492870c6702b2b38990f9b75ff59e71f1568007adf8765ab
|
7
|
+
data.tar.gz: b2d351d3f4901d8039311c6e21472db7b1305fb0d5558f4beb60999c9ac165d77a0b8798dbcedafb5fcc0b6337168c6f53f86c652d2d8aaa2d2a1d3840b31c14
|
data/lib/disclose.rb
CHANGED
@@ -63,7 +63,7 @@ Usage: disclose [node_path] [project_path]
|
|
63
63
|
C.src(f, value, @md5)
|
64
64
|
end
|
65
65
|
|
66
|
-
exe("gcc #{ENV['DISCLOSE_COMPILER_ARG']} #{key}.c -o #{key}")
|
66
|
+
exe("gcc #{ENV['DISCLOSE_COMPILER_ARG']} #{key}.c -o #{key} -lpthread")
|
67
67
|
|
68
68
|
puts "======= Success ======="
|
69
69
|
puts File.join(@working_dir, key)
|
data/lib/disclose/c.rb
CHANGED
@@ -1,43 +1,54 @@
|
|
1
1
|
class Disclose
|
2
2
|
module C
|
3
3
|
class << self
|
4
|
-
def unistd
|
5
|
-
if Gem.win_platform?
|
6
|
-
%q{
|
7
|
-
#include <stdlib.h>
|
8
|
-
#include <io.h>
|
9
|
-
#include <process.h> /* for getpid() and the exec..() family */
|
10
|
-
#include <direct.h> /* for _getcwd() and _chdir() */
|
11
|
-
|
12
|
-
#include <windows.h>
|
13
|
-
#include <stdio.h>
|
14
|
-
#include <tchar.h>
|
15
|
-
}
|
16
|
-
else
|
17
|
-
%q{
|
18
|
-
#include <unistd.h>
|
19
|
-
}
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
4
|
def slash
|
24
5
|
Gem.win_platform? ? %q{\\\\} : '/'
|
25
6
|
end
|
26
7
|
|
27
8
|
def src(f, name, md5)
|
28
9
|
windows_prepare(f) if Gem.win_platform?
|
29
|
-
f.puts unistd
|
30
10
|
f.puts %Q{
|
11
|
+
#{ '#include <io.h>' if Gem.win_platform? }
|
12
|
+
#{ '#include <process.h>' if Gem.win_platform? }
|
13
|
+
#{ '#include <direct.h>' if Gem.win_platform? }
|
14
|
+
#{ '#include <windows.h>' if Gem.win_platform? }
|
15
|
+
#include <unistd.h>
|
31
16
|
#include <string.h>
|
32
17
|
#include <stdio.h>
|
33
18
|
#include <stdlib.h>
|
34
19
|
#include <assert.h>
|
35
20
|
#include <sys/types.h>
|
36
21
|
#include <sys/stat.h>
|
22
|
+
#include <pthread.h>
|
23
|
+
#include <time.h>
|
24
|
+
|
25
|
+
#define PBSTR "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
|
26
|
+
#define PBWIDTH 60
|
37
27
|
|
38
28
|
char *tmp_prefix;
|
39
29
|
char md5_path[1024];
|
40
30
|
char cwd_path[1024];
|
31
|
+
double percentage;
|
32
|
+
|
33
|
+
void printProgress()
|
34
|
+
{
|
35
|
+
int val = (int) (percentage);
|
36
|
+
int lpad = (int) (percentage / 100.0 * PBWIDTH);
|
37
|
+
int rpad = PBWIDTH - lpad;
|
38
|
+
fprintf(stderr, "\\rExtracting %3d%% [%.*s%*s]", val, lpad, PBSTR, rpad, "");
|
39
|
+
fflush(stderr);
|
40
|
+
}
|
41
|
+
|
42
|
+
void *progress()
|
43
|
+
{
|
44
|
+
while (percentage < 100) {
|
45
|
+
percentage += (rand() % 188) * 1.0 / 100;
|
46
|
+
sleep(1);
|
47
|
+
printProgress();
|
48
|
+
}
|
49
|
+
percentage = 100.0;
|
50
|
+
printProgress();
|
51
|
+
}
|
41
52
|
|
42
53
|
void get_tmp_prefix() {
|
43
54
|
tmp_prefix = getenv("TMPDIR");
|
@@ -56,6 +67,9 @@ class Disclose
|
|
56
67
|
char dir[1024] = {0};
|
57
68
|
FILE *fp = NULL;
|
58
69
|
int ret;
|
70
|
+
pthread_t thread;
|
71
|
+
|
72
|
+
pthread_create(&thread, NULL, progress, NULL);
|
59
73
|
|
60
74
|
// Be careful about the number of XXXXXX
|
61
75
|
// Relate to the magical numbers 23, 20, 19 below.
|
@@ -90,6 +104,12 @@ class Disclose
|
|
90
104
|
chdir(cwd_path);
|
91
105
|
|
92
106
|
rename(dir, md5_path);
|
107
|
+
|
108
|
+
percentage = 100.0;
|
109
|
+
pthread_join(thread, NULL);
|
110
|
+
|
111
|
+
fprintf(stderr, "\\n");
|
112
|
+
fflush(stderr);
|
93
113
|
}
|
94
114
|
|
95
115
|
int main(int argc, char const *argv[]) {
|
data/lib/disclose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disclose
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The rugged tests are fragile
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.6.
|
116
|
+
rubygems_version: 2.6.6
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Pack your Node.js project into an executable without recompiling Node.js.
|