standalone-ruby 1.5.1 → 1.5.3

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.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -48
  3. data/bin/standalone-ruby +5 -3
  4. data/lib/data/c_compilers/tcc/include/_mingw.h +54 -54
  5. data/lib/data/c_compilers/tcc/include/assert.h +71 -71
  6. data/lib/data/c_compilers/tcc/include/conio.h +159 -159
  7. data/lib/data/c_compilers/tcc/include/ctype.h +232 -232
  8. data/lib/data/c_compilers/tcc/include/dir.h +26 -26
  9. data/lib/data/c_compilers/tcc/include/direct.h +95 -95
  10. data/lib/data/c_compilers/tcc/include/dirent.h +96 -96
  11. data/lib/data/c_compilers/tcc/include/dos.h +110 -110
  12. data/lib/data/c_compilers/tcc/include/errno.h +117 -117
  13. data/lib/data/c_compilers/tcc/include/excpt.h +20 -20
  14. data/lib/data/c_compilers/tcc/include/fcntl.h +135 -135
  15. data/lib/data/c_compilers/tcc/include/fenv.h +85 -85
  16. data/lib/data/c_compilers/tcc/include/float.h +224 -224
  17. data/lib/data/c_compilers/tcc/include/inttypes.h +275 -275
  18. data/lib/data/c_compilers/tcc/include/io.h +296 -296
  19. data/lib/data/c_compilers/tcc/include/limits.h +115 -115
  20. data/lib/data/c_compilers/tcc/include/locale.h +100 -100
  21. data/lib/data/c_compilers/tcc/include/malloc.h +87 -87
  22. data/lib/data/c_compilers/tcc/include/math.h +438 -438
  23. data/lib/data/c_compilers/tcc/include/mem.h +8 -8
  24. data/lib/data/c_compilers/tcc/include/memory.h +9 -9
  25. data/lib/data/c_compilers/tcc/include/process.h +158 -158
  26. data/lib/data/c_compilers/tcc/include/setjmp.h +72 -72
  27. data/lib/data/c_compilers/tcc/include/share.h +44 -44
  28. data/lib/data/c_compilers/tcc/include/signal.h +111 -111
  29. data/lib/data/c_compilers/tcc/include/stdarg.h +16 -16
  30. data/lib/data/c_compilers/tcc/include/stdbool.h +10 -10
  31. data/lib/data/c_compilers/tcc/include/stddef.h +26 -26
  32. data/lib/data/c_compilers/tcc/include/stdint.h +184 -184
  33. data/lib/data/c_compilers/tcc/include/stdio.h +413 -413
  34. data/lib/data/c_compilers/tcc/include/stdlib.h +482 -482
  35. data/lib/data/c_compilers/tcc/include/string.h +206 -206
  36. data/lib/data/c_compilers/tcc/include/sys/fcntl.h +8 -8
  37. data/lib/data/c_compilers/tcc/include/sys/file.h +9 -9
  38. data/lib/data/c_compilers/tcc/include/sys/locking.h +52 -52
  39. data/lib/data/c_compilers/tcc/include/sys/stat.h +190 -190
  40. data/lib/data/c_compilers/tcc/include/sys/time.h +3 -3
  41. data/lib/data/c_compilers/tcc/include/sys/timeb.h +82 -82
  42. data/lib/data/c_compilers/tcc/include/sys/types.h +118 -118
  43. data/lib/data/c_compilers/tcc/include/sys/unistd.h +9 -9
  44. data/lib/data/c_compilers/tcc/include/sys/utime.h +89 -89
  45. data/lib/data/c_compilers/tcc/include/tchar.h +367 -367
  46. data/lib/data/c_compilers/tcc/include/time.h +219 -219
  47. data/lib/data/c_compilers/tcc/include/unistd.h +10 -10
  48. data/lib/data/c_compilers/tcc/include/values.h +4 -4
  49. data/lib/data/c_compilers/tcc/include/varargs.h +11 -11
  50. data/lib/data/c_compilers/tcc/include/wchar.h +318 -318
  51. data/lib/data/c_compilers/tcc/include/wctype.h +127 -127
  52. data/lib/data/c_compilers/tcc/include/winapi/basetsd.h +119 -119
  53. data/lib/data/c_compilers/tcc/include/winapi/basetyps.h +144 -144
  54. data/lib/data/c_compilers/tcc/include/winapi/winbase.h +1852 -1852
  55. data/lib/data/c_compilers/tcc/include/winapi/wincon.h +207 -207
  56. data/lib/data/c_compilers/tcc/include/winapi/windef.h +240 -240
  57. data/lib/data/c_compilers/tcc/include/winapi/windows.h +176 -176
  58. data/lib/data/c_compilers/tcc/include/winapi/winerror.h +1054 -1054
  59. data/lib/data/c_compilers/tcc/include/winapi/wingdi.h +2843 -2843
  60. data/lib/data/c_compilers/tcc/include/winapi/winnetwk.h +346 -346
  61. data/lib/data/c_compilers/tcc/include/winapi/winnls.h +651 -651
  62. data/lib/data/c_compilers/tcc/include/winapi/winnt.h +2667 -2667
  63. data/lib/data/c_compilers/tcc/include/winapi/winreg.h +159 -159
  64. data/lib/data/c_compilers/tcc/include/winapi/winsvc.h +309 -309
  65. data/lib/data/c_compilers/tcc/include/winapi/winuser.h +3472 -3472
  66. data/lib/data/c_compilers/tcc/include/winapi/winver.h +133 -133
  67. data/lib/data/c_compilers/tcc/lib/gdi32.def +337 -337
  68. data/lib/data/c_compilers/tcc/lib/kernel32.def +763 -763
  69. data/lib/data/c_compilers/tcc/lib/msvcrt.def +782 -782
  70. data/lib/data/c_compilers/tcc/lib/user32.def +654 -654
  71. data/lib/data/exe_templates/launcher_stub.c +29 -29
  72. data/lib/data/exe_templates/launcher_stub.cpp +31 -31
  73. data/lib/data/launcher_templates/vbs/default_vbs.txt +7 -7
  74. data/lib/data/launcher_templates/vbs/vbs_gui.txt +8 -8
  75. data/lib/data/resource_files/default.rc +17 -17
  76. data/lib/displayer.rb +60 -63
  77. data/lib/exe_packer.rb +72 -68
  78. data/lib/launcher.rb +57 -71
  79. data/lib/launcher_handler.rb +40 -40
  80. data/lib/parameter_parser.rb +218 -201
  81. data/lib/ruby_copy.rb +48 -20
  82. data/lib/standalone_ruby.rb +6 -6
  83. data/lib/version/version.rb +2 -2
  84. metadata +4 -5
  85. 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,61 @@
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" => $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} - Package your Ruby projects as exe!
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("Working with:")
11
+
12
+ display_map = {
13
+ "Platform" => @params[:platform],
14
+ "Project Path" => @params[:project_path],
15
+ "Resource File" => @params[:resource_file],
16
+ "Exe File" => "program.exe",
17
+ "Prefix" => @params[:ruby][:prefix],
18
+ "Main File" => @params[:main_file],
19
+ "Launcher" => "launcher.vbs",
20
+ "Template" => "Default Template",
21
+ }
22
+
23
+ display_text = display_map.map { |key, value| " - #{key}: #{value}" if value }.compact
24
+
25
+ puts display_text.join("\n") unless display_text.empty?
26
+
27
+ rescue => e
28
+ print("Display Error: ".red); puts(e.message.red)
29
+ end
30
+ end
31
+
32
+
33
+ def banner
34
+ banner = -<<"BANNER"
35
+ Standalone-Ruby v#{StandaloneRuby::VERSION} - Make Ruby independent!
36
+ # Github: https://github.com/ardatetikbey/Standalone-Ruby
37
+ # RubyGems: https://rubygems.org/gems/standalone-ruby
38
+
39
+ BANNER
40
+
41
+ puts banner
42
+ end
43
+ end
44
+
45
+ class String
46
+ def red
47
+ "\e[31m#{self}\e[0m"
48
+ end
49
+
50
+ def green
51
+ "\e[32m#{self}\e[0m"
52
+ end
53
+
54
+ def magenta
55
+ "\e[35m#{self}\e[0m"
56
+ end
57
+
58
+ def yellow
59
+ "\e[33m#{self}\e[0m"
60
+ end
64
61
  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 pack
7
- begin
8
- stub_path = File.join(File.expand_path("data/exe_templates", __dir__), "launcher_stub.c")
9
- stub_content = File.read(stub_path)
10
-
11
- stub_output = "#{File.join(@params[:project_path].to_s, "launcher_stub.c")}"
12
- exe_path = "#{File.join(@params[:project_path].to_s, @params[:exe].to_s)}"
13
-
14
- File.open(stub_output, 'w') { |f| f.write(stub_content) }
15
-
16
- if @params[:use_gcc]
17
- puts "\nChecking GCC and Windres..."
18
- output = `where gcc`
19
- gcc_path = output.strip
20
-
21
- output = `where windres`
22
- windres_path = output.strip
23
-
24
- if File.exist?(output.strip)
25
- puts "GCC Path: #{gcc_path}"
26
- puts "Windres Path: #{windres_path}"
27
-
28
- windres_command = "#{windres_path} #{@params[:resource_file].to_s} -O coff -o #{File.join(@params[:project_path].to_s, "program.o")}"
29
- `#{windres_command}`
30
-
31
- gcc_command = "#{gcc_path} -o #{exe_path} #{File.join(@params[:project_path].to_s, "program.o")} #{stub_output}"
32
- `#{gcc_command}`
33
-
34
- File.delete("#{File.join(@params[:project_path].to_s, 'program.o')}")
35
- else
36
- print("Error: ".red); puts("GCC could not be found!")
37
- exit!
38
- end
39
- else
40
- puts "\nUsing Tiny C Compiler (TCC)..."
41
-
42
- tcc_path = File.join(File.expand_path("data/c_compilers/tcc", __dir__), "tcc.exe")
43
- command = "#{tcc_path} -o #{exe_path} #{stub_output} -lkernel32"
44
- `#{command}`
45
- end
46
-
47
- File.delete(stub_output)
48
-
49
- puts("\nExe file has been generated!")
50
- rescue Exception => err
51
- print("Error: ".red); puts(err.message)
52
- end
53
- end
54
- end
55
-
56
- class String
57
- def red
58
- "\e[31m#{self}\e[0m"
59
- end
60
-
61
- def yellow
62
- "\e[33m#{self}\e[0m"
63
- end
64
-
65
- def green_bold_dark
66
- "\e[1m\e[38;5;28m#{self}\e[0m"
67
- end
68
- end
1
+ class ExePacker
2
+ def initialize(params)
3
+ @params = params
4
+ end
5
+
6
+ def pack_linux
7
+ # Version 2.0.0
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,57 @@
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
- platform_analysis
12
-
13
- @parser = ParameterParser.new
14
- @parser.parse
15
- @params = @parser.params
16
-
17
- @displayer = Displayer.new(@params)
18
- @ruby_copy = RubyCopy.new(@params)
19
- @exe_packer = ExePacker.new(@params)
20
- @launcher_handler = LauncherHandler.new(@params)
21
- end
22
-
23
- def platform_analysis
24
- case RUBY_PLATFORM
25
- when /win32|mingw|cygwin/
26
- $platform = 'win32'
27
- else
28
- print("Error: ".red); puts("This platform is not supported! Exiting...")
29
- exit!
30
- end
31
- end
32
-
33
-
34
- def run
35
- begin
36
- Signal.trap("INT") do
37
- puts "\nProgram interrupted. Shutting down..."
38
- exit(0)
39
- end
40
-
41
- @displayer.banner
42
- @displayer.display_params
43
- @ruby_copy.robocopy_interpreter
44
- @launcher_handler.handle
45
- @exe_packer.pack
46
-
47
- if @params[:one_file_exe]
48
- require_relative 'sfx_generator'
49
- @sfx_generator = SFXGenerator.new(@params)
50
- @sfx_generator.generate_sfx
51
- end
52
-
53
- 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.")
54
-
55
- 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.")
56
- puts "Thanks for using Standalone-Ruby! Don't forget to star the project on Github."
57
- rescue Exception => e
58
- print("Launcher Error: "); puts("#{e.message}".red)
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
+ # Version 2.0.0
37
+ end
38
+
39
+ 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.")
40
+
41
+ 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.")
42
+ puts "Thanks for using Standalone-Ruby! Don't forget to star the project on Github."
43
+ rescue Exception => e
44
+ print("Launcher Error: "); puts("#{e.message}".red)
45
+ end
46
+ end
47
+ end
48
+
49
+ class String
50
+ def red
51
+ "\e[31m#{self}\e[0m"
52
+ end
53
+
54
+ def yellow
55
+ "\e[33m#{self}\e[0m"
56
+ end
57
+ end