standalone-ruby 1.4.2 → 1.5.1

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 (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +36 -22
  3. data/lib/data/{tcc → c_compilers/tcc}/include/_mingw.h +54 -54
  4. data/lib/data/{tcc → c_compilers/tcc}/include/assert.h +71 -71
  5. data/lib/data/{tcc → c_compilers/tcc}/include/conio.h +159 -159
  6. data/lib/data/{tcc → c_compilers/tcc}/include/ctype.h +232 -232
  7. data/lib/data/{tcc → c_compilers/tcc}/include/dir.h +26 -26
  8. data/lib/data/{tcc → c_compilers/tcc}/include/direct.h +95 -95
  9. data/lib/data/{tcc → c_compilers/tcc}/include/dirent.h +96 -96
  10. data/lib/data/{tcc → c_compilers/tcc}/include/dos.h +110 -110
  11. data/lib/data/{tcc → c_compilers/tcc}/include/errno.h +117 -117
  12. data/lib/data/{tcc → c_compilers/tcc}/include/excpt.h +20 -20
  13. data/lib/data/{tcc → c_compilers/tcc}/include/fcntl.h +135 -135
  14. data/lib/data/{tcc → c_compilers/tcc}/include/fenv.h +85 -85
  15. data/lib/data/{tcc → c_compilers/tcc}/include/float.h +224 -224
  16. data/lib/data/{tcc → c_compilers/tcc}/include/inttypes.h +275 -275
  17. data/lib/data/{tcc → c_compilers/tcc}/include/io.h +296 -296
  18. data/lib/data/{tcc → c_compilers/tcc}/include/limits.h +115 -115
  19. data/lib/data/{tcc → c_compilers/tcc}/include/locale.h +100 -100
  20. data/lib/data/{tcc → c_compilers/tcc}/include/malloc.h +87 -87
  21. data/lib/data/{tcc → c_compilers/tcc}/include/math.h +438 -438
  22. data/lib/data/{tcc → c_compilers/tcc}/include/mem.h +8 -8
  23. data/lib/data/{tcc → c_compilers/tcc}/include/memory.h +9 -9
  24. data/lib/data/{tcc → c_compilers/tcc}/include/process.h +158 -158
  25. data/lib/data/{tcc → c_compilers/tcc}/include/setjmp.h +72 -72
  26. data/lib/data/{tcc → c_compilers/tcc}/include/share.h +44 -44
  27. data/lib/data/{tcc → c_compilers/tcc}/include/signal.h +111 -111
  28. data/lib/data/{tcc → c_compilers/tcc}/include/stdarg.h +16 -16
  29. data/lib/data/{tcc → c_compilers/tcc}/include/stdbool.h +10 -10
  30. data/lib/data/{tcc → c_compilers/tcc}/include/stddef.h +26 -26
  31. data/lib/data/{tcc → c_compilers/tcc}/include/stdint.h +184 -184
  32. data/lib/data/{tcc → c_compilers/tcc}/include/stdio.h +413 -413
  33. data/lib/data/{tcc → c_compilers/tcc}/include/stdlib.h +482 -482
  34. data/lib/data/{tcc → c_compilers/tcc}/include/string.h +206 -206
  35. data/lib/data/{tcc → c_compilers/tcc}/include/sys/fcntl.h +8 -8
  36. data/lib/data/{tcc → c_compilers/tcc}/include/sys/file.h +9 -9
  37. data/lib/data/{tcc → c_compilers/tcc}/include/sys/locking.h +52 -52
  38. data/lib/data/{tcc → c_compilers/tcc}/include/sys/stat.h +190 -190
  39. data/lib/data/{tcc → c_compilers/tcc}/include/sys/time.h +3 -3
  40. data/lib/data/{tcc → c_compilers/tcc}/include/sys/timeb.h +82 -82
  41. data/lib/data/{tcc → c_compilers/tcc}/include/sys/types.h +118 -118
  42. data/lib/data/{tcc/include → c_compilers/tcc/include/sys}/unistd.h +9 -10
  43. data/lib/data/{tcc → c_compilers/tcc}/include/sys/utime.h +89 -89
  44. data/lib/data/{tcc → c_compilers/tcc}/include/tchar.h +367 -367
  45. data/lib/data/{tcc → c_compilers/tcc}/include/time.h +219 -219
  46. data/lib/data/{tcc/include/sys → c_compilers/tcc/include}/unistd.h +10 -9
  47. data/lib/data/{tcc → c_compilers/tcc}/include/values.h +4 -4
  48. data/lib/data/{tcc → c_compilers/tcc}/include/varargs.h +11 -11
  49. data/lib/data/{tcc → c_compilers/tcc}/include/wchar.h +318 -318
  50. data/lib/data/{tcc → c_compilers/tcc}/include/wctype.h +127 -127
  51. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/basetsd.h +119 -119
  52. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/basetyps.h +144 -144
  53. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winbase.h +1852 -1852
  54. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/wincon.h +207 -207
  55. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/windef.h +240 -240
  56. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/windows.h +176 -176
  57. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winerror.h +1054 -1054
  58. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/wingdi.h +2843 -2843
  59. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winnetwk.h +346 -346
  60. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winnls.h +651 -651
  61. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winnt.h +2667 -2667
  62. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winreg.h +159 -159
  63. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winsvc.h +309 -309
  64. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winuser.h +3472 -3472
  65. data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winver.h +133 -133
  66. data/lib/data/{tcc → c_compilers/tcc}/lib/gdi32.def +337 -337
  67. data/lib/data/{tcc → c_compilers/tcc}/lib/kernel32.def +763 -763
  68. data/lib/data/{tcc → c_compilers/tcc}/lib/msvcrt.def +782 -782
  69. data/lib/data/{tcc → c_compilers/tcc}/lib/user32.def +654 -654
  70. data/lib/data/{exe_template → exe_templates}/launcher_stub.c +2 -2
  71. data/lib/data/exe_templates/launcher_stub.cpp +31 -0
  72. data/lib/data/{vbs → launcher_templates/vbs}/default_vbs.txt +7 -7
  73. data/lib/data/{vbs → launcher_templates/vbs}/vbs_gui.txt +8 -8
  74. data/lib/data/resource_files/default.rc +17 -0
  75. data/lib/{utils/displayer.rb → displayer.rb} +6 -6
  76. data/lib/exe_packer.rb +68 -0
  77. data/lib/{utils/launcher.rb → launcher.rb} +18 -24
  78. data/lib/launcher_handler.rb +41 -0
  79. data/lib/parameter_parser.rb +201 -0
  80. data/lib/{utils/ruby_copy.rb → ruby_copy.rb} +0 -6
  81. data/lib/sfx_generator.rb +9 -0
  82. data/lib/standalone_ruby.rb +1 -1
  83. data/lib/version/version.rb +1 -1
  84. metadata +84 -87
  85. data/lib/data/bat-cmd/default_bat_cmd.txt +0 -9
  86. data/lib/data/exe_template/launcher_stub.cpp +0 -9
  87. data/lib/data/tcc/tiny_impdef.exe +0 -0
  88. data/lib/data/tcc/tiny_libmaker.exe +0 -0
  89. data/lib/utils/config_generator.rb +0 -5
  90. data/lib/utils/exe_packer.rb +0 -72
  91. data/lib/utils/launcher_handler.rb +0 -111
  92. data/lib/utils/logger_helper.rb +0 -24
  93. data/lib/utils/parameter_parser.rb +0 -211
  94. /data/lib/data/{tcc → c_compilers/tcc}/lib/libtcc1.a +0 -0
  95. /data/lib/data/{tcc → c_compilers/tcc}/tcc.exe +0 -0
@@ -1,7 +1,7 @@
1
1
  #include <windows.h>
2
2
 
3
3
  int main() {
4
- char command[] = "wscript.exe LAUNCHER_FILE";
4
+ char command[] = "wscript.exe launcher.vbs";
5
5
 
6
6
  STARTUPINFO si = {0};
7
7
  PROCESS_INFORMATION pi = {0};
@@ -27,4 +27,4 @@ int main() {
27
27
  }
28
28
 
29
29
  return 0;
30
- }
30
+ }
@@ -0,0 +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,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
@@ -0,0 +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,17 +1,18 @@
1
- require_relative 'logger_helper'
2
- require_relative '../version/version'
1
+ require_relative 'version/version'
3
2
 
4
3
  class Displayer
5
4
  def initialize(params)
6
5
  @params = params
7
- @logger = LoggerHelper.instance
8
6
  end
9
7
 
10
8
  def display_params
11
9
  begin
10
+ puts("Parameters:")
11
+
12
12
  display_map = {
13
- "Platform" => @params[:platform],
13
+ "Platform" => $platform,
14
14
  "Project Path" => @params[:project_path],
15
+ "Resource File" => @params[:resource_file],
15
16
  "Exe File" => @params[:exe],
16
17
  "Ruby Path" => @params[:ruby_path],
17
18
  "Ruby Folder" => @params[:ruby_path] ? File.basename(@params[:ruby_path]) : nil,
@@ -22,13 +23,12 @@ class Displayer
22
23
  "Log Path" => "Users Documents Directory"
23
24
  }
24
25
 
25
- display_text = display_map.map { |key, value| "#{key}: #{value}" if value }.compact
26
+ display_text = display_map.map { |key, value| " - #{key}: #{value}" if value }.compact
26
27
 
27
28
  puts display_text.join("\n") unless display_text.empty?
28
29
 
29
30
  rescue => e
30
31
  print("Display Error: ".red); puts(e.message.red)
31
- @logger.error("Display Error: #{e.message}")
32
32
  end
33
33
  end
34
34
 
data/lib/exe_packer.rb ADDED
@@ -0,0 +1,68 @@
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,22 +1,21 @@
1
1
  require 'optparse'
2
2
 
3
- class Launcher
4
- require_relative 'displayer'
5
- require_relative 'parameter_parser'
6
- require_relative 'ruby_copy'
7
- require_relative 'logger_helper'
8
- require_relative 'exe_packer'
9
- require_relative 'launcher_handler'
10
- # require_relative 'config_generator'
3
+ require_relative 'displayer'
4
+ require_relative 'parameter_parser'
5
+ require_relative 'ruby_copy'
6
+ require_relative 'exe_packer'
7
+ require_relative 'launcher_handler'
11
8
 
9
+ class Launcher
12
10
  def initialize
11
+ platform_analysis
12
+
13
13
  @parser = ParameterParser.new
14
14
  @parser.parse
15
15
  @params = @parser.params
16
16
 
17
17
  @displayer = Displayer.new(@params)
18
18
  @ruby_copy = RubyCopy.new(@params)
19
- @logger = LoggerHelper.instance
20
19
  @exe_packer = ExePacker.new(@params)
21
20
  @launcher_handler = LauncherHandler.new(@params)
22
21
  end
@@ -24,43 +23,38 @@ class Launcher
24
23
  def platform_analysis
25
24
  case RUBY_PLATFORM
26
25
  when /win32|mingw|cygwin/
27
- @params[:platform] = 'Windows'
28
- @logger.info("Working on windows platform.")
26
+ $platform = 'win32'
29
27
  else
30
28
  print("Error: ".red); puts("This platform is not supported! Exiting...")
31
- @logger.error("This platform is not supported! Exiting...")
32
29
  exit!
33
30
  end
34
31
  end
35
32
 
33
+
36
34
  def run
37
35
  begin
38
36
  Signal.trap("INT") do
39
- @logger.info("The program was closed because an interrupt command was detected.")
40
37
  puts "\nProgram interrupted. Shutting down..."
41
38
  exit(0)
42
39
  end
43
40
 
44
- platform_analysis
45
-
46
- @logger.info("the executor function is started.")
47
41
  @displayer.banner
48
- @logger.info("Banner display was made.")
49
42
  @displayer.display_params
50
- @logger.info("The parameters entered by the user are reflected on the screen.")
51
43
  @ruby_copy.robocopy_interpreter
52
- @logger.info("Ruby interpreter copy function completed.")
53
44
  @launcher_handler.handle
54
- @logger.info("Launcher handler finished.")
55
45
  @exe_packer.pack
56
- @logger.info("Exe pack finished.")
57
46
 
58
- puts "Thanks for using Standalone-Ruby! Don't forget to star the project on Github."
47
+ if @params[:one_file_exe]
48
+ require_relative 'sfx_generator'
49
+ @sfx_generator = SFXGenerator.new(@params)
50
+ @sfx_generator.generate_sfx
51
+ end
59
52
 
60
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.")
61
- @logger.info("Program finished.")
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."
62
57
  rescue Exception => e
63
- @logger.error("Launcher Error: #{e.message}")
64
58
  print("Launcher Error: "); puts("#{e.message}".red)
65
59
  end
66
60
  end
@@ -0,0 +1,41 @@
1
+ require 'fileutils'
2
+
3
+ class LauncherHandler
4
+ def initialize(params)
5
+ @params = params
6
+ end
7
+
8
+ def handle
9
+ begin
10
+ puts("\nThe template creation process has been started.")
11
+
12
+ ruby_file = @params[:gui] ? "rubyw.exe" : "ruby.exe"
13
+
14
+ if @params[:gui] == true
15
+ vbs_template = File.join(File.expand_path("data/launcher_templates/vbs", __dir__), "vbs_gui.txt")
16
+ else
17
+ vbs_template = File.join(File.expand_path("data/launcher_templates/vbs", __dir__), "default_vbs.txt")
18
+ end
19
+
20
+ puts "Using: #{vbs_template}"
21
+
22
+ if File.exist?(vbs_template)
23
+ content = File.read(vbs_template)
24
+
25
+ content.gsub!("STANDALONE_RUBY_PATH", "#{File.join(File.basename(@params[:ruby_path].to_s), "bin", "#{ruby_file}")}")
26
+ content.gsub!("STANDALONE_MAIN_FILE", "#{File.basename(@params[:main_file].to_s)}")
27
+
28
+ new_launcher_path = File.join(@params[:project_path].to_s, @params[:launcher_name].to_s)
29
+ File.open(new_launcher_path, "w") do |f_man|
30
+ f_man.puts content
31
+ end
32
+
33
+ else
34
+ print("Handler Error: ".red); puts("The template file could not be found.")
35
+ exit!
36
+ end
37
+ rescue Exception => e
38
+ print("Handler Error: ".red); puts("#{e.message}")
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,201 @@
1
+ require 'fileutils'
2
+ require 'tmpdir'
3
+ require 'optparse'
4
+
5
+ require_relative 'version/version'
6
+
7
+ class ParameterParser
8
+ def initialize
9
+ @params = {
10
+ threads: 5,
11
+ sfx_path: Dir.tmpdir,
12
+ exe: "program.exe",
13
+ resource_file: File.join(File.expand_path("data/resource_files", __dir__), "default.rc"),
14
+ launcher: "launcher.vbs",
15
+ launcher_name: "launcher.vbs",
16
+ launcher_type: "vbs"
17
+ }
18
+
19
+ end
20
+
21
+ def normalize_paths!
22
+ @params.each do |key, value|
23
+ @params[key] = value.gsub('\\', '/') if value.is_a?(String)
24
+ end
25
+ end
26
+
27
+ def display_help
28
+ help_text = <<~EOT
29
+ Standalone-Ruby v#{StandaloneRuby::VERSION} - Convert your Ruby projects to exe files!
30
+
31
+ Usage: standalone-ruby [--help] [--project-path PROJECT_PATH] [--ruby-path RUBY_PATH] [--main-file MAIN_FILE] [--launcher LAUNCHER] [--gui]
32
+ [--template TEMPLATE] [--exe-file EXE_FILE] [--threads THREADS] [--resource-file resource_file] [--gcc] [--version]
33
+
34
+ Required Options:
35
+ --project-path PROJECT_PATH
36
+ Target Ruby project path.
37
+
38
+ --ruby RUBY_PATH
39
+ Path to the Ruby interpreter.
40
+
41
+ --main-file MAIN_FILE
42
+ Path to the main Ruby file of the project.
43
+
44
+ Extra Options:
45
+ --exe-file EXE_FILE
46
+ Name of the exe file to be used for output (default is program.exe).
47
+
48
+ --threads THREADS
49
+ Number of threads to use (default is 5). Determines the number of threads used during the Ruby interpreter
50
+ copy process and for Robocopy operations. A higher number of threads can speed up the process, but requires more system resources.
51
+
52
+ --resource-file RESOURCE_FILE
53
+ Resource file (.rc) for the exe file to be created. Only possible with MinGW.
54
+
55
+ --help
56
+ Show this help message and exit.
57
+
58
+ --version
59
+ Show program version and exit.
60
+
61
+ --gcc
62
+ Use GCC compiler for exe file.
63
+
64
+ --gui
65
+ This option allows the rubyw.exe file in the bin folder to be used.
66
+ You can choose it for projects that include GUI.
67
+
68
+ Notes:
69
+ - Make sure that the Ruby interpreter you are using includes all the gems required for the target project.
70
+ - The Ruby interpreter uses Robocopy for copying, and the number of threads given affects the speed of this operation.
71
+
72
+ For more details, please visit the documentation at:
73
+ https://github.com/ardatetikbey/Standalone-Ruby
74
+
75
+ EOT
76
+
77
+ puts help_text
78
+ end
79
+
80
+ def parse
81
+ begin
82
+ OptionParser.new do |opts|
83
+ note = "Note: https://github.com/ardatetikbey/Standalone-Ruby Don't forget to review my github document to get the best results."
84
+ opts.banner = "Usage: ruby #{$0} [options]\n#{note}"
85
+
86
+ opts.on("--sfx-path SFX_PATH") do |sfx_path|
87
+ @params[:sfx_path] = sfx_path
88
+ end
89
+
90
+ opts.on("--resource-file RESOURCE_FILE") do |resource_file|
91
+ if File.exist?(resource_file)
92
+ @params[:resource_file] = resource_file
93
+ else
94
+ print("Parser Error: ".red); puts("The specified resource file #{resource_file} could not be found!")
95
+ exit!
96
+ end
97
+ end
98
+
99
+ opts.on("--one-file-exe") do
100
+ @params[:one_file_exe] = true
101
+ end
102
+
103
+ opts.on("--ruby-path RUBY_PATH") do |ruby_path|
104
+ ruby_path.strip!
105
+ if Dir.exist?("#{ruby_path}")
106
+ if Dir.exist?(File.join(ruby_path, "bin"))
107
+ @params[:ruby_path] = ruby_path
108
+ end
109
+ else
110
+ print("Parser Error: ".red); puts("The specified Ruby path #{ruby_path} could not be found!")
111
+ exit!
112
+ end
113
+ end
114
+
115
+ opts.on("--project-path PROJECT_PATH", String) do |project_path|
116
+ project_path.strip!
117
+ if Dir.exist?("#{project_path}")
118
+ @params[:project_path] = project_path
119
+ else
120
+ print("Parser Error: ".red); puts("The specified project path #{project_path} could not be found!")
121
+ exit!
122
+ end
123
+ end
124
+
125
+ opts.on("--exe-file EXE_FILE") do |exe|
126
+ @params[:exe] = exe
127
+ end
128
+
129
+ opts.on("--gcc") do
130
+ @params[:use_gcc] = true
131
+ end
132
+
133
+ opts.on("--main-file MAIN_FILE", String) do |main_file|
134
+ main_file.strip!
135
+ if File.exist?(main_file)
136
+ @params[:main_file] = main_file
137
+ else
138
+ print("Parser Error: ".red); puts("The specified file #{main_file} could not be found!")
139
+ exit!
140
+ end
141
+ end
142
+
143
+ opts.on("--threads THREADS", Integer) do |threads|
144
+ if threads.is_a?(Integer)
145
+ @params[:threads] = threads
146
+ else
147
+ print("Parser Error: ".red); puts("Invalid value for threads. Please provide an integer.")
148
+ exit!
149
+ end
150
+ end
151
+
152
+ opts.on("--gui") do
153
+ @params[:gui] = true
154
+ end
155
+
156
+ opts.on("--version") do
157
+ puts "Standalone Ruby Gem Version #{StandaloneRuby::VERSION}"
158
+ exit!
159
+ end
160
+
161
+ opts.on("--help") do
162
+ display_help
163
+ exit!
164
+ end
165
+ end.parse!
166
+
167
+ normalize_paths!
168
+
169
+ if @params[:project_path].nil? || @params[:ruby_path].nil? || @params[:main_file].nil?
170
+ print("Error: ".red); puts("Missing required parameters. Please provide the necessary parameters:\n -p, -r, -m.\nYou can use the -h parameter for the help menu.")
171
+ exit!
172
+ end
173
+
174
+ rescue Exception => e
175
+ print("Parser Error: ".red); puts("#{e.message}".red)
176
+ exit!
177
+ end
178
+ end
179
+
180
+ def params
181
+ @params
182
+ end
183
+ end
184
+
185
+ class String
186
+ def red
187
+ "\e[31m#{self}\e[0m"
188
+ end
189
+
190
+ def green
191
+ "\e[32m#{self}\e[0m"
192
+ end
193
+
194
+ def magenta
195
+ "\e[35m#{self}\e[0m"
196
+ end
197
+
198
+ def yellow
199
+ "\e[33m#{self}\e[0m"
200
+ end
201
+ end
@@ -1,9 +1,6 @@
1
- require_relative 'logger_helper'
2
-
3
1
  class RubyCopy
4
2
  def initialize(params)
5
3
  @params = params
6
- @logger = LoggerHelper.instance
7
4
  end
8
5
 
9
6
  def robocopy_interpreter
@@ -11,16 +8,13 @@ class RubyCopy
11
8
  puts("\nThe Ruby interpreter copying process has been started.")
12
9
  print("WARNING: ".yellow); puts("If you are using a development kit, the copying process may take a long time.")
13
10
 
14
- @logger.info("Robocopy process started using backticks.")
15
11
  copy_output = `robocopy "#{@params[:ruby_path]}" "#{File.join(@params[:project_path].to_s, File.basename(@params[:ruby_path].to_s))}" /E /MT:#{@params[:threads].to_i} /V /ETA /NFL /NDL /R:1000000 /W:30 /NP`
16
12
  puts "Robocopy Command: robocopy \"#{@params[:ruby_path]}\" \"#{File.join(@params[:project_path], File.basename(@params[:ruby_path]))}\" /E /MT:#{@params[:threads].to_i} /V /ETA /NFL /NDL /R:1000000 /W:30 /NP"
17
13
 
18
- @logger.info("Robocopy output printed to screen.")
19
14
 
20
15
  puts("The Ruby interpreter copying process has been completed.")
21
16
  rescue Exception => e
22
17
  print("Copy Error: ".red); puts("#{e.message}".red)
23
- @logger.error("Copy Error: #{e.message}")
24
18
  end
25
19
  end
26
20
  end
@@ -0,0 +1,9 @@
1
+ class SFXGenerator
2
+ def initialize(params)
3
+ @params = params
4
+ end
5
+
6
+ def generate_sfx
7
+
8
+ end
9
+ end
@@ -1,4 +1,4 @@
1
- require_relative 'utils/launcher'
1
+ require_relative 'launcher'
2
2
 
3
3
  class Program
4
4
  def run
@@ -1,3 +1,3 @@
1
1
  module StandaloneRuby
2
- VERSION = "1.4.2"
2
+ VERSION = "1.5.1"
3
3
  end