standalone-ruby 1.5.1 → 1.5.2
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/CHANGELOG.md +53 -48
- data/bin/standalone-ruby +3 -3
- data/lib/data/c_compilers/tcc/include/_mingw.h +54 -54
- data/lib/data/c_compilers/tcc/include/assert.h +71 -71
- data/lib/data/c_compilers/tcc/include/conio.h +159 -159
- data/lib/data/c_compilers/tcc/include/ctype.h +232 -232
- data/lib/data/c_compilers/tcc/include/dir.h +26 -26
- data/lib/data/c_compilers/tcc/include/direct.h +95 -95
- data/lib/data/c_compilers/tcc/include/dirent.h +96 -96
- data/lib/data/c_compilers/tcc/include/dos.h +110 -110
- data/lib/data/c_compilers/tcc/include/errno.h +117 -117
- data/lib/data/c_compilers/tcc/include/excpt.h +20 -20
- data/lib/data/c_compilers/tcc/include/fcntl.h +135 -135
- data/lib/data/c_compilers/tcc/include/fenv.h +85 -85
- data/lib/data/c_compilers/tcc/include/float.h +224 -224
- data/lib/data/c_compilers/tcc/include/inttypes.h +275 -275
- data/lib/data/c_compilers/tcc/include/io.h +296 -296
- data/lib/data/c_compilers/tcc/include/limits.h +115 -115
- data/lib/data/c_compilers/tcc/include/locale.h +100 -100
- data/lib/data/c_compilers/tcc/include/malloc.h +87 -87
- data/lib/data/c_compilers/tcc/include/math.h +438 -438
- data/lib/data/c_compilers/tcc/include/mem.h +8 -8
- data/lib/data/c_compilers/tcc/include/memory.h +9 -9
- data/lib/data/c_compilers/tcc/include/process.h +158 -158
- data/lib/data/c_compilers/tcc/include/setjmp.h +72 -72
- data/lib/data/c_compilers/tcc/include/share.h +44 -44
- data/lib/data/c_compilers/tcc/include/signal.h +111 -111
- data/lib/data/c_compilers/tcc/include/stdarg.h +16 -16
- data/lib/data/c_compilers/tcc/include/stdbool.h +10 -10
- data/lib/data/c_compilers/tcc/include/stddef.h +26 -26
- data/lib/data/c_compilers/tcc/include/stdint.h +184 -184
- data/lib/data/c_compilers/tcc/include/stdio.h +413 -413
- data/lib/data/c_compilers/tcc/include/stdlib.h +482 -482
- data/lib/data/c_compilers/tcc/include/string.h +206 -206
- data/lib/data/c_compilers/tcc/include/sys/fcntl.h +8 -8
- data/lib/data/c_compilers/tcc/include/sys/file.h +9 -9
- data/lib/data/c_compilers/tcc/include/sys/locking.h +52 -52
- data/lib/data/c_compilers/tcc/include/sys/stat.h +190 -190
- data/lib/data/c_compilers/tcc/include/sys/time.h +3 -3
- data/lib/data/c_compilers/tcc/include/sys/timeb.h +82 -82
- data/lib/data/c_compilers/tcc/include/sys/types.h +118 -118
- data/lib/data/c_compilers/tcc/include/sys/unistd.h +9 -9
- data/lib/data/c_compilers/tcc/include/sys/utime.h +89 -89
- data/lib/data/c_compilers/tcc/include/tchar.h +367 -367
- data/lib/data/c_compilers/tcc/include/time.h +219 -219
- data/lib/data/c_compilers/tcc/include/unistd.h +10 -10
- data/lib/data/c_compilers/tcc/include/values.h +4 -4
- data/lib/data/c_compilers/tcc/include/varargs.h +11 -11
- data/lib/data/c_compilers/tcc/include/wchar.h +318 -318
- data/lib/data/c_compilers/tcc/include/wctype.h +127 -127
- data/lib/data/c_compilers/tcc/include/winapi/basetsd.h +119 -119
- data/lib/data/c_compilers/tcc/include/winapi/basetyps.h +144 -144
- data/lib/data/c_compilers/tcc/include/winapi/winbase.h +1852 -1852
- data/lib/data/c_compilers/tcc/include/winapi/wincon.h +207 -207
- data/lib/data/c_compilers/tcc/include/winapi/windef.h +240 -240
- data/lib/data/c_compilers/tcc/include/winapi/windows.h +176 -176
- data/lib/data/c_compilers/tcc/include/winapi/winerror.h +1054 -1054
- data/lib/data/c_compilers/tcc/include/winapi/wingdi.h +2843 -2843
- data/lib/data/c_compilers/tcc/include/winapi/winnetwk.h +346 -346
- data/lib/data/c_compilers/tcc/include/winapi/winnls.h +651 -651
- data/lib/data/c_compilers/tcc/include/winapi/winnt.h +2667 -2667
- data/lib/data/c_compilers/tcc/include/winapi/winreg.h +159 -159
- data/lib/data/c_compilers/tcc/include/winapi/winsvc.h +309 -309
- data/lib/data/c_compilers/tcc/include/winapi/winuser.h +3472 -3472
- data/lib/data/c_compilers/tcc/include/winapi/winver.h +133 -133
- data/lib/data/c_compilers/tcc/lib/gdi32.def +337 -337
- data/lib/data/c_compilers/tcc/lib/kernel32.def +763 -763
- data/lib/data/c_compilers/tcc/lib/msvcrt.def +782 -782
- data/lib/data/c_compilers/tcc/lib/user32.def +654 -654
- data/lib/data/exe_templates/launcher_stub.c +29 -29
- data/lib/data/exe_templates/launcher_stub.cpp +31 -31
- data/lib/data/launcher_templates/vbs/default_vbs.txt +7 -7
- data/lib/data/launcher_templates/vbs/vbs_gui.txt +8 -8
- data/lib/data/resource_files/default.rc +17 -17
- data/lib/displayer.rb +63 -63
- data/lib/exe_packer.rb +72 -68
- data/lib/launcher.rb +58 -71
- data/lib/launcher_handler.rb +40 -40
- data/lib/parameter_parser.rb +215 -201
- data/lib/ruby_copy.rb +48 -20
- data/lib/standalone_ruby.rb +6 -6
- data/lib/version/version.rb +2 -2
- metadata +3 -4
- data/lib/sfx_generator.rb +0 -9
@@ -1,30 +1,30 @@
|
|
1
|
-
#include <windows.h>
|
2
|
-
|
3
|
-
int main() {
|
4
|
-
char command[] = "wscript.exe launcher.vbs";
|
5
|
-
|
6
|
-
STARTUPINFO si = {0};
|
7
|
-
PROCESS_INFORMATION pi = {0};
|
8
|
-
|
9
|
-
if (CreateProcess(
|
10
|
-
NULL,
|
11
|
-
command,
|
12
|
-
NULL,
|
13
|
-
NULL,
|
14
|
-
FALSE,
|
15
|
-
0,
|
16
|
-
NULL,
|
17
|
-
NULL,
|
18
|
-
&si,
|
19
|
-
&pi
|
20
|
-
)) {
|
21
|
-
WaitForSingleObject(pi.hProcess, INFINITE);
|
22
|
-
|
23
|
-
CloseHandle(pi.hProcess);
|
24
|
-
CloseHandle(pi.hThread);
|
25
|
-
} else {
|
26
|
-
|
27
|
-
}
|
28
|
-
|
29
|
-
return 0;
|
1
|
+
#include <windows.h>
|
2
|
+
|
3
|
+
int main() {
|
4
|
+
char command[] = "wscript.exe launcher.vbs";
|
5
|
+
|
6
|
+
STARTUPINFO si = {0};
|
7
|
+
PROCESS_INFORMATION pi = {0};
|
8
|
+
|
9
|
+
if (CreateProcess(
|
10
|
+
NULL,
|
11
|
+
command,
|
12
|
+
NULL,
|
13
|
+
NULL,
|
14
|
+
FALSE,
|
15
|
+
0,
|
16
|
+
NULL,
|
17
|
+
NULL,
|
18
|
+
&si,
|
19
|
+
&pi
|
20
|
+
)) {
|
21
|
+
WaitForSingleObject(pi.hProcess, INFINITE);
|
22
|
+
|
23
|
+
CloseHandle(pi.hProcess);
|
24
|
+
CloseHandle(pi.hThread);
|
25
|
+
} else {
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
return 0;
|
30
30
|
}
|
@@ -1,31 +1,31 @@
|
|
1
|
-
#include <windows.h>
|
2
|
-
#include <iostream>
|
3
|
-
|
4
|
-
int main() {
|
5
|
-
const char* command = "wscript.exe LAUNCHER_FILE";
|
6
|
-
|
7
|
-
STARTUPINFO si = {0};
|
8
|
-
PROCESS_INFORMATION pi = {0};
|
9
|
-
|
10
|
-
if (CreateProcess(
|
11
|
-
NULL,
|
12
|
-
const_cast<LPSTR>(command),
|
13
|
-
NULL,
|
14
|
-
NULL,
|
15
|
-
FALSE,
|
16
|
-
0,
|
17
|
-
NULL,
|
18
|
-
NULL,
|
19
|
-
&si,
|
20
|
-
&pi
|
21
|
-
)) {
|
22
|
-
WaitForSingleObject(pi.hProcess, INFINITE);
|
23
|
-
|
24
|
-
CloseHandle(pi.hProcess);
|
25
|
-
CloseHandle(pi.hThread);
|
26
|
-
} else {
|
27
|
-
std::cerr << "CreateProcess failed with error code: " << GetLastError() << std::endl;
|
28
|
-
}
|
29
|
-
|
30
|
-
return 0;
|
31
|
-
}
|
1
|
+
#include <windows.h>
|
2
|
+
#include <iostream>
|
3
|
+
|
4
|
+
int main() {
|
5
|
+
const char* command = "wscript.exe LAUNCHER_FILE";
|
6
|
+
|
7
|
+
STARTUPINFO si = {0};
|
8
|
+
PROCESS_INFORMATION pi = {0};
|
9
|
+
|
10
|
+
if (CreateProcess(
|
11
|
+
NULL,
|
12
|
+
const_cast<LPSTR>(command),
|
13
|
+
NULL,
|
14
|
+
NULL,
|
15
|
+
FALSE,
|
16
|
+
0,
|
17
|
+
NULL,
|
18
|
+
NULL,
|
19
|
+
&si,
|
20
|
+
&pi
|
21
|
+
)) {
|
22
|
+
WaitForSingleObject(pi.hProcess, INFINITE);
|
23
|
+
|
24
|
+
CloseHandle(pi.hProcess);
|
25
|
+
CloseHandle(pi.hThread);
|
26
|
+
} else {
|
27
|
+
std::cerr << "CreateProcess failed with error code: " << GetLastError() << std::endl;
|
28
|
+
}
|
29
|
+
|
30
|
+
return 0;
|
31
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
Set objShell = CreateObject("WScript.Shell")
|
2
|
-
|
3
|
-
rubyPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "/STANDALONE_RUBY_PATH"
|
4
|
-
scriptPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "/STANDALONE_MAIN_FILE"
|
5
|
-
|
6
|
-
command = """" & rubyPath & """ """ & scriptPath & """"
|
7
|
-
objShell.Run command, 1, False
|
1
|
+
Set objShell = CreateObject("WScript.Shell")
|
2
|
+
|
3
|
+
rubyPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "/STANDALONE_RUBY_PATH"
|
4
|
+
scriptPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "/STANDALONE_MAIN_FILE"
|
5
|
+
|
6
|
+
command = """" & rubyPath & """ """ & scriptPath & """"
|
7
|
+
objShell.Run command, 1, False
|
@@ -1,8 +1,8 @@
|
|
1
|
-
Set objShell = CreateObject("WScript.Shell")
|
2
|
-
|
3
|
-
rubyPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "\STANDALONE_RUBY_PATH"
|
4
|
-
scriptPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "\STANDALONE_MAIN_FILE"
|
5
|
-
|
6
|
-
command = """" & rubyPath & """ """ & scriptPath & """"
|
7
|
-
|
8
|
-
objShell.Run command, 1, False
|
1
|
+
Set objShell = CreateObject("WScript.Shell")
|
2
|
+
|
3
|
+
rubyPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "\STANDALONE_RUBY_PATH"
|
4
|
+
scriptPath = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) & "\STANDALONE_MAIN_FILE"
|
5
|
+
|
6
|
+
command = """" & rubyPath & """ """ & scriptPath & """"
|
7
|
+
|
8
|
+
objShell.Run command, 1, False
|
@@ -1,17 +1,17 @@
|
|
1
|
-
#include <windows.h>
|
2
|
-
|
3
|
-
1 VERSIONINFO
|
4
|
-
FILEVERSION 1,0,0,0
|
5
|
-
PRODUCTVERSION 1,0,0,0
|
6
|
-
BEGIN
|
7
|
-
BLOCK "StringFileInfo"
|
8
|
-
BEGIN
|
9
|
-
BLOCK "040904B0"
|
10
|
-
BEGIN
|
11
|
-
VALUE "CompanyName", "Developer\0"
|
12
|
-
VALUE "FileDescription", "MyProgram\0"
|
13
|
-
VALUE "FileVersion", "1.0.0.0\0"
|
14
|
-
VALUE "ProductName", "MyProgram\0"
|
15
|
-
END
|
16
|
-
END
|
17
|
-
END
|
1
|
+
#include <windows.h>
|
2
|
+
|
3
|
+
1 VERSIONINFO
|
4
|
+
FILEVERSION 1,0,0,0
|
5
|
+
PRODUCTVERSION 1,0,0,0
|
6
|
+
BEGIN
|
7
|
+
BLOCK "StringFileInfo"
|
8
|
+
BEGIN
|
9
|
+
BLOCK "040904B0"
|
10
|
+
BEGIN
|
11
|
+
VALUE "CompanyName", "Developer\0"
|
12
|
+
VALUE "FileDescription", "MyProgram\0"
|
13
|
+
VALUE "FileVersion", "1.0.0.0\0"
|
14
|
+
VALUE "ProductName", "MyProgram\0"
|
15
|
+
END
|
16
|
+
END
|
17
|
+
END
|
data/lib/displayer.rb
CHANGED
@@ -1,64 +1,64 @@
|
|
1
|
-
require_relative 'version/version'
|
2
|
-
|
3
|
-
class Displayer
|
4
|
-
def initialize(params)
|
5
|
-
@params = params
|
6
|
-
end
|
7
|
-
|
8
|
-
def display_params
|
9
|
-
begin
|
10
|
-
puts("Parameters:")
|
11
|
-
|
12
|
-
display_map = {
|
13
|
-
"Platform" =>
|
14
|
-
"Project Path" => @params[:project_path],
|
15
|
-
"Resource File" => @params[:resource_file],
|
16
|
-
"Exe File" => @params[:exe],
|
17
|
-
"Ruby Path" => @params[:ruby_path],
|
18
|
-
"Ruby Folder" => @params[:ruby_path] ? File.basename(@params[:ruby_path]) : nil,
|
19
|
-
"Main File" => @params[:main_file],
|
20
|
-
"Launcher" => @params[:launcher],
|
21
|
-
"Launcher Type" => @params[:launcher_type],
|
22
|
-
"Template" => @params[:template] || "Default Template",
|
23
|
-
"Log Path" => "Users Documents Directory"
|
24
|
-
}
|
25
|
-
|
26
|
-
display_text = display_map.map { |key, value| " - #{key}: #{value}" if value }.compact
|
27
|
-
|
28
|
-
puts display_text.join("\n") unless display_text.empty?
|
29
|
-
|
30
|
-
rescue => e
|
31
|
-
print("Display Error: ".red); puts(e.message.red)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
def banner
|
37
|
-
banner = -<<"BANNER"
|
38
|
-
Standalone-Ruby v#{StandaloneRuby::VERSION} -
|
39
|
-
# Github: https://github.com/ardatetikbey/Standalone-Ruby
|
40
|
-
# RubyGems: https://rubygems.org/gems/standalone-ruby
|
41
|
-
|
42
|
-
BANNER
|
43
|
-
|
44
|
-
puts banner
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class String
|
49
|
-
def red
|
50
|
-
"\e[31m#{self}\e[0m"
|
51
|
-
end
|
52
|
-
|
53
|
-
def green
|
54
|
-
"\e[32m#{self}\e[0m"
|
55
|
-
end
|
56
|
-
|
57
|
-
def magenta
|
58
|
-
"\e[35m#{self}\e[0m"
|
59
|
-
end
|
60
|
-
|
61
|
-
def yellow
|
62
|
-
"\e[33m#{self}\e[0m"
|
63
|
-
end
|
1
|
+
require_relative 'version/version'
|
2
|
+
|
3
|
+
class Displayer
|
4
|
+
def initialize(params)
|
5
|
+
@params = params
|
6
|
+
end
|
7
|
+
|
8
|
+
def display_params
|
9
|
+
begin
|
10
|
+
puts("Parameters:")
|
11
|
+
|
12
|
+
display_map = {
|
13
|
+
"Platform" => @params[:platform],
|
14
|
+
"Project Path" => @params[:project_path],
|
15
|
+
"Resource File" => @params[:resource_file],
|
16
|
+
"Exe File" => @params[:exe],
|
17
|
+
"Ruby Path" => @params[:ruby_path],
|
18
|
+
"Ruby Folder" => @params[:ruby_path] ? File.basename(@params[:ruby_path]) : nil,
|
19
|
+
"Main File" => @params[:main_file],
|
20
|
+
"Launcher" => @params[:launcher],
|
21
|
+
"Launcher Type" => @params[:launcher_type],
|
22
|
+
"Template" => @params[:template] || "Default Template",
|
23
|
+
"Log Path" => "Users Documents Directory"
|
24
|
+
}
|
25
|
+
|
26
|
+
display_text = display_map.map { |key, value| " - #{key}: #{value}" if value }.compact
|
27
|
+
|
28
|
+
puts display_text.join("\n") unless display_text.empty?
|
29
|
+
|
30
|
+
rescue => e
|
31
|
+
print("Display Error: ".red); puts(e.message.red)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def banner
|
37
|
+
banner = -<<"BANNER"
|
38
|
+
Standalone-Ruby v#{StandaloneRuby::VERSION} - Make Ruby independent!
|
39
|
+
# Github: https://github.com/ardatetikbey/Standalone-Ruby
|
40
|
+
# RubyGems: https://rubygems.org/gems/standalone-ruby
|
41
|
+
|
42
|
+
BANNER
|
43
|
+
|
44
|
+
puts banner
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class String
|
49
|
+
def red
|
50
|
+
"\e[31m#{self}\e[0m"
|
51
|
+
end
|
52
|
+
|
53
|
+
def green
|
54
|
+
"\e[32m#{self}\e[0m"
|
55
|
+
end
|
56
|
+
|
57
|
+
def magenta
|
58
|
+
"\e[35m#{self}\e[0m"
|
59
|
+
end
|
60
|
+
|
61
|
+
def yellow
|
62
|
+
"\e[33m#{self}\e[0m"
|
63
|
+
end
|
64
64
|
end
|
data/lib/exe_packer.rb
CHANGED
@@ -1,68 +1,72 @@
|
|
1
|
-
class ExePacker
|
2
|
-
def initialize(params)
|
3
|
-
@params = params
|
4
|
-
end
|
5
|
-
|
6
|
-
def
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
def
|
62
|
-
"\e[
|
63
|
-
end
|
64
|
-
|
65
|
-
def
|
66
|
-
"\e[
|
67
|
-
end
|
68
|
-
|
1
|
+
class ExePacker
|
2
|
+
def initialize(params)
|
3
|
+
@params = params
|
4
|
+
end
|
5
|
+
|
6
|
+
def pack_linux
|
7
|
+
puts
|
8
|
+
end
|
9
|
+
|
10
|
+
def pack_windows
|
11
|
+
begin
|
12
|
+
stub_path = File.join(File.expand_path("data/exe_templates", __dir__), "launcher_stub.c")
|
13
|
+
stub_content = File.read(stub_path)
|
14
|
+
|
15
|
+
stub_output = "#{File.join(@params[:project_path].to_s, "launcher_stub.c")}"
|
16
|
+
exe_path = "#{File.join(@params[:project_path].to_s, "program.exe")}"
|
17
|
+
|
18
|
+
File.open(stub_output, 'w') { |f| f.write(stub_content) }
|
19
|
+
|
20
|
+
if @params[:use_gcc]
|
21
|
+
puts "\nChecking GCC and Windres..."
|
22
|
+
output = `where gcc`
|
23
|
+
gcc_path = output.strip
|
24
|
+
|
25
|
+
output = `where windres`
|
26
|
+
windres_path = output.strip
|
27
|
+
|
28
|
+
if File.exist?(output.strip)
|
29
|
+
puts "GCC Path: #{gcc_path}"
|
30
|
+
puts "Windres Path: #{windres_path}"
|
31
|
+
|
32
|
+
windres_command = "#{windres_path} #{@params[:resource_file].to_s} -O coff -o #{File.join(@params[:project_path].to_s, "program.o")}"
|
33
|
+
`#{windres_command}`
|
34
|
+
|
35
|
+
gcc_command = "#{gcc_path} -o #{exe_path} #{File.join(@params[:project_path].to_s, "program.o")} #{stub_output}"
|
36
|
+
`#{gcc_command}`
|
37
|
+
|
38
|
+
File.delete("#{File.join(@params[:project_path].to_s, 'program.o')}")
|
39
|
+
else
|
40
|
+
print("Error: ".red); puts("GCC could not be found!")
|
41
|
+
exit!
|
42
|
+
end
|
43
|
+
else
|
44
|
+
puts "\nUsing Tiny C Compiler (TCC)..."
|
45
|
+
|
46
|
+
tcc_path = File.join(File.expand_path("data/c_compilers/tcc", __dir__), "tcc.exe")
|
47
|
+
command = "#{tcc_path} -o #{exe_path} #{stub_output} -lkernel32"
|
48
|
+
`#{command}`
|
49
|
+
end
|
50
|
+
|
51
|
+
File.delete(stub_output)
|
52
|
+
|
53
|
+
puts("\nExe file has been generated!")
|
54
|
+
rescue Exception => err
|
55
|
+
print("Error: ".red); puts(err.message)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class String
|
61
|
+
def red
|
62
|
+
"\e[31m#{self}\e[0m"
|
63
|
+
end
|
64
|
+
|
65
|
+
def yellow
|
66
|
+
"\e[33m#{self}\e[0m"
|
67
|
+
end
|
68
|
+
|
69
|
+
def green_bold_dark
|
70
|
+
"\e[1m\e[38;5;28m#{self}\e[0m"
|
71
|
+
end
|
72
|
+
end
|
data/lib/launcher.rb
CHANGED
@@ -1,71 +1,58 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
|
3
|
-
require_relative 'displayer'
|
4
|
-
require_relative 'parameter_parser'
|
5
|
-
require_relative 'ruby_copy'
|
6
|
-
require_relative 'exe_packer'
|
7
|
-
require_relative 'launcher_handler'
|
8
|
-
|
9
|
-
class Launcher
|
10
|
-
def initialize
|
11
|
-
|
12
|
-
|
13
|
-
@
|
14
|
-
|
15
|
-
@
|
16
|
-
|
17
|
-
@
|
18
|
-
@
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class String
|
64
|
-
def red
|
65
|
-
"\e[31m#{self}\e[0m"
|
66
|
-
end
|
67
|
-
|
68
|
-
def yellow
|
69
|
-
"\e[33m#{self}\e[0m"
|
70
|
-
end
|
71
|
-
end
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
require_relative 'displayer'
|
4
|
+
require_relative 'parameter_parser'
|
5
|
+
require_relative 'ruby_copy'
|
6
|
+
require_relative 'exe_packer'
|
7
|
+
require_relative 'launcher_handler'
|
8
|
+
|
9
|
+
class Launcher
|
10
|
+
def initialize
|
11
|
+
@parser = ParameterParser.new
|
12
|
+
@parser.parse
|
13
|
+
@params = @parser.params
|
14
|
+
|
15
|
+
@displayer = Displayer.new(@params)
|
16
|
+
@ruby_copy = RubyCopy.new(@params)
|
17
|
+
@exe_packer = ExePacker.new(@params)
|
18
|
+
@launcher_handler = LauncherHandler.new(@params)
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
begin
|
23
|
+
Signal.trap("INT") do
|
24
|
+
puts "\nProgram interrupted. Shutting down..."
|
25
|
+
exit(0)
|
26
|
+
end
|
27
|
+
|
28
|
+
@displayer.banner
|
29
|
+
@displayer.display_params
|
30
|
+
|
31
|
+
if @params[:platform] == 'windows'
|
32
|
+
@ruby_copy.robocopy_interpreter
|
33
|
+
@launcher_handler.handle
|
34
|
+
@exe_packer.pack_windows
|
35
|
+
elsif @params[:platform] == 'linux'
|
36
|
+
@ruby_copy.rsync_interpreter
|
37
|
+
@exe_packer.pack_linux
|
38
|
+
end
|
39
|
+
|
40
|
+
print("\nWARNING: ".yellow); puts("Instead of changing the path of the created exe file, create a shortcut. The same applies here as in every application.")
|
41
|
+
|
42
|
+
puts("\nThis project is under development. If you encounter any errors, you can open an issue on Github.\nIf you want to make a suggestion, you can contact me.")
|
43
|
+
puts "Thanks for using Standalone-Ruby! Don't forget to star the project on Github."
|
44
|
+
rescue Exception => e
|
45
|
+
print("Launcher Error: "); puts("#{e.message}".red)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class String
|
51
|
+
def red
|
52
|
+
"\e[31m#{self}\e[0m"
|
53
|
+
end
|
54
|
+
|
55
|
+
def yellow
|
56
|
+
"\e[33m#{self}\e[0m"
|
57
|
+
end
|
58
|
+
end
|