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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -22
- data/lib/data/{tcc → c_compilers/tcc}/include/_mingw.h +54 -54
- data/lib/data/{tcc → c_compilers/tcc}/include/assert.h +71 -71
- data/lib/data/{tcc → c_compilers/tcc}/include/conio.h +159 -159
- data/lib/data/{tcc → c_compilers/tcc}/include/ctype.h +232 -232
- data/lib/data/{tcc → c_compilers/tcc}/include/dir.h +26 -26
- data/lib/data/{tcc → c_compilers/tcc}/include/direct.h +95 -95
- data/lib/data/{tcc → c_compilers/tcc}/include/dirent.h +96 -96
- data/lib/data/{tcc → c_compilers/tcc}/include/dos.h +110 -110
- data/lib/data/{tcc → c_compilers/tcc}/include/errno.h +117 -117
- data/lib/data/{tcc → c_compilers/tcc}/include/excpt.h +20 -20
- data/lib/data/{tcc → c_compilers/tcc}/include/fcntl.h +135 -135
- data/lib/data/{tcc → c_compilers/tcc}/include/fenv.h +85 -85
- data/lib/data/{tcc → c_compilers/tcc}/include/float.h +224 -224
- data/lib/data/{tcc → c_compilers/tcc}/include/inttypes.h +275 -275
- data/lib/data/{tcc → c_compilers/tcc}/include/io.h +296 -296
- data/lib/data/{tcc → c_compilers/tcc}/include/limits.h +115 -115
- data/lib/data/{tcc → c_compilers/tcc}/include/locale.h +100 -100
- data/lib/data/{tcc → c_compilers/tcc}/include/malloc.h +87 -87
- data/lib/data/{tcc → c_compilers/tcc}/include/math.h +438 -438
- data/lib/data/{tcc → c_compilers/tcc}/include/mem.h +8 -8
- data/lib/data/{tcc → c_compilers/tcc}/include/memory.h +9 -9
- data/lib/data/{tcc → c_compilers/tcc}/include/process.h +158 -158
- data/lib/data/{tcc → c_compilers/tcc}/include/setjmp.h +72 -72
- data/lib/data/{tcc → c_compilers/tcc}/include/share.h +44 -44
- data/lib/data/{tcc → c_compilers/tcc}/include/signal.h +111 -111
- data/lib/data/{tcc → c_compilers/tcc}/include/stdarg.h +16 -16
- data/lib/data/{tcc → c_compilers/tcc}/include/stdbool.h +10 -10
- data/lib/data/{tcc → c_compilers/tcc}/include/stddef.h +26 -26
- data/lib/data/{tcc → c_compilers/tcc}/include/stdint.h +184 -184
- data/lib/data/{tcc → c_compilers/tcc}/include/stdio.h +413 -413
- data/lib/data/{tcc → c_compilers/tcc}/include/stdlib.h +482 -482
- data/lib/data/{tcc → c_compilers/tcc}/include/string.h +206 -206
- data/lib/data/{tcc → c_compilers/tcc}/include/sys/fcntl.h +8 -8
- data/lib/data/{tcc → c_compilers/tcc}/include/sys/file.h +9 -9
- data/lib/data/{tcc → c_compilers/tcc}/include/sys/locking.h +52 -52
- data/lib/data/{tcc → c_compilers/tcc}/include/sys/stat.h +190 -190
- data/lib/data/{tcc → c_compilers/tcc}/include/sys/time.h +3 -3
- data/lib/data/{tcc → c_compilers/tcc}/include/sys/timeb.h +82 -82
- data/lib/data/{tcc → c_compilers/tcc}/include/sys/types.h +118 -118
- data/lib/data/{tcc/include → c_compilers/tcc/include/sys}/unistd.h +9 -10
- data/lib/data/{tcc → c_compilers/tcc}/include/sys/utime.h +89 -89
- data/lib/data/{tcc → c_compilers/tcc}/include/tchar.h +367 -367
- data/lib/data/{tcc → c_compilers/tcc}/include/time.h +219 -219
- data/lib/data/{tcc/include/sys → c_compilers/tcc/include}/unistd.h +10 -9
- data/lib/data/{tcc → c_compilers/tcc}/include/values.h +4 -4
- data/lib/data/{tcc → c_compilers/tcc}/include/varargs.h +11 -11
- data/lib/data/{tcc → c_compilers/tcc}/include/wchar.h +318 -318
- data/lib/data/{tcc → c_compilers/tcc}/include/wctype.h +127 -127
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/basetsd.h +119 -119
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/basetyps.h +144 -144
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winbase.h +1852 -1852
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/wincon.h +207 -207
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/windef.h +240 -240
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/windows.h +176 -176
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winerror.h +1054 -1054
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/wingdi.h +2843 -2843
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winnetwk.h +346 -346
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winnls.h +651 -651
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winnt.h +2667 -2667
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winreg.h +159 -159
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winsvc.h +309 -309
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winuser.h +3472 -3472
- data/lib/data/{tcc → c_compilers/tcc}/include/winapi/winver.h +133 -133
- data/lib/data/{tcc → c_compilers/tcc}/lib/gdi32.def +337 -337
- data/lib/data/{tcc → c_compilers/tcc}/lib/kernel32.def +763 -763
- data/lib/data/{tcc → c_compilers/tcc}/lib/msvcrt.def +782 -782
- data/lib/data/{tcc → c_compilers/tcc}/lib/user32.def +654 -654
- data/lib/data/{exe_template → exe_templates}/launcher_stub.c +2 -2
- data/lib/data/exe_templates/launcher_stub.cpp +31 -0
- data/lib/data/{vbs → launcher_templates/vbs}/default_vbs.txt +7 -7
- data/lib/data/{vbs → launcher_templates/vbs}/vbs_gui.txt +8 -8
- data/lib/data/resource_files/default.rc +17 -0
- data/lib/{utils/displayer.rb → displayer.rb} +6 -6
- data/lib/exe_packer.rb +68 -0
- data/lib/{utils/launcher.rb → launcher.rb} +18 -24
- data/lib/launcher_handler.rb +41 -0
- data/lib/parameter_parser.rb +201 -0
- data/lib/{utils/ruby_copy.rb → ruby_copy.rb} +0 -6
- data/lib/sfx_generator.rb +9 -0
- data/lib/standalone_ruby.rb +1 -1
- data/lib/version/version.rb +1 -1
- metadata +84 -87
- data/lib/data/bat-cmd/default_bat_cmd.txt +0 -9
- data/lib/data/exe_template/launcher_stub.cpp +0 -9
- data/lib/data/tcc/tiny_impdef.exe +0 -0
- data/lib/data/tcc/tiny_libmaker.exe +0 -0
- data/lib/utils/config_generator.rb +0 -5
- data/lib/utils/exe_packer.rb +0 -72
- data/lib/utils/launcher_handler.rb +0 -111
- data/lib/utils/logger_helper.rb +0 -24
- data/lib/utils/parameter_parser.rb +0 -211
- /data/lib/data/{tcc → c_compilers/tcc}/lib/libtcc1.a +0 -0
- /data/lib/data/{tcc → c_compilers/tcc}/tcc.exe +0 -0
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standalone-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arda Tetik
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-13 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
|
-
description:
|
12
|
+
description: Convert your Ruby projects to exe files!
|
13
13
|
email:
|
14
14
|
- ardatetik1881@gmail.com
|
15
15
|
executables:
|
@@ -19,91 +19,88 @@ extra_rdoc_files: []
|
|
19
19
|
files:
|
20
20
|
- CHANGELOG.md
|
21
21
|
- bin/standalone-ruby
|
22
|
-
- lib/data/
|
23
|
-
- lib/data/
|
24
|
-
- lib/data/
|
25
|
-
- lib/data/tcc/include/
|
26
|
-
- lib/data/tcc/include/
|
27
|
-
- lib/data/tcc/include/
|
28
|
-
- lib/data/tcc/include/
|
29
|
-
- lib/data/tcc/include/
|
30
|
-
- lib/data/tcc/include/
|
31
|
-
- lib/data/tcc/include/
|
32
|
-
- lib/data/tcc/include/
|
33
|
-
- lib/data/tcc/include/
|
34
|
-
- lib/data/tcc/include/
|
35
|
-
- lib/data/tcc/include/
|
36
|
-
- lib/data/tcc/include/
|
37
|
-
- lib/data/tcc/include/
|
38
|
-
- lib/data/tcc/include/
|
39
|
-
- lib/data/tcc/include/
|
40
|
-
- lib/data/tcc/include/
|
41
|
-
- lib/data/tcc/include/
|
42
|
-
- lib/data/tcc/include/
|
43
|
-
- lib/data/tcc/include/
|
44
|
-
- lib/data/tcc/include/
|
45
|
-
- lib/data/tcc/include/
|
46
|
-
- lib/data/tcc/include/
|
47
|
-
- lib/data/tcc/include/
|
48
|
-
- lib/data/tcc/include/
|
49
|
-
- lib/data/tcc/include/
|
50
|
-
- lib/data/tcc/include/
|
51
|
-
- lib/data/tcc/include/
|
52
|
-
- lib/data/tcc/include/
|
53
|
-
- lib/data/tcc/include/
|
54
|
-
- lib/data/tcc/include/
|
55
|
-
- lib/data/tcc/include/
|
56
|
-
- lib/data/tcc/include/
|
57
|
-
- lib/data/tcc/include/sys/
|
58
|
-
- lib/data/tcc/include/sys/
|
59
|
-
- lib/data/tcc/include/sys/
|
60
|
-
- lib/data/tcc/include/sys/
|
61
|
-
- lib/data/tcc/include/sys/
|
62
|
-
- lib/data/tcc/include/sys/
|
63
|
-
- lib/data/tcc/include/
|
64
|
-
- lib/data/tcc/include/
|
65
|
-
- lib/data/tcc/include/
|
66
|
-
- lib/data/tcc/include/
|
67
|
-
- lib/data/tcc/include/
|
68
|
-
- lib/data/tcc/include/
|
69
|
-
- lib/data/tcc/include/
|
70
|
-
- lib/data/tcc/include/
|
71
|
-
- lib/data/tcc/include/
|
72
|
-
- lib/data/tcc/include/
|
73
|
-
- lib/data/tcc/include/winapi/
|
74
|
-
- lib/data/tcc/include/winapi/
|
75
|
-
- lib/data/tcc/include/winapi/
|
76
|
-
- lib/data/tcc/include/winapi/
|
77
|
-
- lib/data/tcc/include/winapi/
|
78
|
-
- lib/data/tcc/include/winapi/
|
79
|
-
- lib/data/tcc/include/winapi/
|
80
|
-
- lib/data/tcc/include/winapi/
|
81
|
-
- lib/data/tcc/include/winapi/
|
82
|
-
- lib/data/tcc/include/winapi/
|
83
|
-
- lib/data/tcc/include/winapi/
|
84
|
-
- lib/data/tcc/include/winapi/
|
85
|
-
- lib/data/tcc/
|
86
|
-
- lib/data/tcc/
|
87
|
-
- lib/data/tcc/
|
88
|
-
- lib/data/tcc/lib/
|
89
|
-
- lib/data/tcc/lib/
|
90
|
-
- lib/data/tcc/
|
91
|
-
- lib/data/
|
92
|
-
- lib/data/
|
93
|
-
- lib/data/
|
94
|
-
- lib/data/
|
95
|
-
- lib/data/
|
96
|
-
- lib/
|
97
|
-
- lib/
|
22
|
+
- lib/data/c_compilers/tcc/include/_mingw.h
|
23
|
+
- lib/data/c_compilers/tcc/include/assert.h
|
24
|
+
- lib/data/c_compilers/tcc/include/conio.h
|
25
|
+
- lib/data/c_compilers/tcc/include/ctype.h
|
26
|
+
- lib/data/c_compilers/tcc/include/dir.h
|
27
|
+
- lib/data/c_compilers/tcc/include/direct.h
|
28
|
+
- lib/data/c_compilers/tcc/include/dirent.h
|
29
|
+
- lib/data/c_compilers/tcc/include/dos.h
|
30
|
+
- lib/data/c_compilers/tcc/include/errno.h
|
31
|
+
- lib/data/c_compilers/tcc/include/excpt.h
|
32
|
+
- lib/data/c_compilers/tcc/include/fcntl.h
|
33
|
+
- lib/data/c_compilers/tcc/include/fenv.h
|
34
|
+
- lib/data/c_compilers/tcc/include/float.h
|
35
|
+
- lib/data/c_compilers/tcc/include/inttypes.h
|
36
|
+
- lib/data/c_compilers/tcc/include/io.h
|
37
|
+
- lib/data/c_compilers/tcc/include/limits.h
|
38
|
+
- lib/data/c_compilers/tcc/include/locale.h
|
39
|
+
- lib/data/c_compilers/tcc/include/malloc.h
|
40
|
+
- lib/data/c_compilers/tcc/include/math.h
|
41
|
+
- lib/data/c_compilers/tcc/include/mem.h
|
42
|
+
- lib/data/c_compilers/tcc/include/memory.h
|
43
|
+
- lib/data/c_compilers/tcc/include/process.h
|
44
|
+
- lib/data/c_compilers/tcc/include/setjmp.h
|
45
|
+
- lib/data/c_compilers/tcc/include/share.h
|
46
|
+
- lib/data/c_compilers/tcc/include/signal.h
|
47
|
+
- lib/data/c_compilers/tcc/include/stdarg.h
|
48
|
+
- lib/data/c_compilers/tcc/include/stdbool.h
|
49
|
+
- lib/data/c_compilers/tcc/include/stddef.h
|
50
|
+
- lib/data/c_compilers/tcc/include/stdint.h
|
51
|
+
- lib/data/c_compilers/tcc/include/stdio.h
|
52
|
+
- lib/data/c_compilers/tcc/include/stdlib.h
|
53
|
+
- lib/data/c_compilers/tcc/include/string.h
|
54
|
+
- lib/data/c_compilers/tcc/include/sys/fcntl.h
|
55
|
+
- lib/data/c_compilers/tcc/include/sys/file.h
|
56
|
+
- lib/data/c_compilers/tcc/include/sys/locking.h
|
57
|
+
- lib/data/c_compilers/tcc/include/sys/stat.h
|
58
|
+
- lib/data/c_compilers/tcc/include/sys/time.h
|
59
|
+
- lib/data/c_compilers/tcc/include/sys/timeb.h
|
60
|
+
- lib/data/c_compilers/tcc/include/sys/types.h
|
61
|
+
- lib/data/c_compilers/tcc/include/sys/unistd.h
|
62
|
+
- lib/data/c_compilers/tcc/include/sys/utime.h
|
63
|
+
- lib/data/c_compilers/tcc/include/tchar.h
|
64
|
+
- lib/data/c_compilers/tcc/include/time.h
|
65
|
+
- lib/data/c_compilers/tcc/include/unistd.h
|
66
|
+
- lib/data/c_compilers/tcc/include/values.h
|
67
|
+
- lib/data/c_compilers/tcc/include/varargs.h
|
68
|
+
- lib/data/c_compilers/tcc/include/wchar.h
|
69
|
+
- lib/data/c_compilers/tcc/include/wctype.h
|
70
|
+
- lib/data/c_compilers/tcc/include/winapi/basetsd.h
|
71
|
+
- lib/data/c_compilers/tcc/include/winapi/basetyps.h
|
72
|
+
- lib/data/c_compilers/tcc/include/winapi/winbase.h
|
73
|
+
- lib/data/c_compilers/tcc/include/winapi/wincon.h
|
74
|
+
- lib/data/c_compilers/tcc/include/winapi/windef.h
|
75
|
+
- lib/data/c_compilers/tcc/include/winapi/windows.h
|
76
|
+
- lib/data/c_compilers/tcc/include/winapi/winerror.h
|
77
|
+
- lib/data/c_compilers/tcc/include/winapi/wingdi.h
|
78
|
+
- lib/data/c_compilers/tcc/include/winapi/winnetwk.h
|
79
|
+
- lib/data/c_compilers/tcc/include/winapi/winnls.h
|
80
|
+
- lib/data/c_compilers/tcc/include/winapi/winnt.h
|
81
|
+
- lib/data/c_compilers/tcc/include/winapi/winreg.h
|
82
|
+
- lib/data/c_compilers/tcc/include/winapi/winsvc.h
|
83
|
+
- lib/data/c_compilers/tcc/include/winapi/winuser.h
|
84
|
+
- lib/data/c_compilers/tcc/include/winapi/winver.h
|
85
|
+
- lib/data/c_compilers/tcc/lib/gdi32.def
|
86
|
+
- lib/data/c_compilers/tcc/lib/kernel32.def
|
87
|
+
- lib/data/c_compilers/tcc/lib/libtcc1.a
|
88
|
+
- lib/data/c_compilers/tcc/lib/msvcrt.def
|
89
|
+
- lib/data/c_compilers/tcc/lib/user32.def
|
90
|
+
- lib/data/c_compilers/tcc/tcc.exe
|
91
|
+
- lib/data/exe_templates/launcher_stub.c
|
92
|
+
- lib/data/exe_templates/launcher_stub.cpp
|
93
|
+
- lib/data/launcher_templates/vbs/default_vbs.txt
|
94
|
+
- lib/data/launcher_templates/vbs/vbs_gui.txt
|
95
|
+
- lib/data/resource_files/default.rc
|
96
|
+
- lib/displayer.rb
|
97
|
+
- lib/exe_packer.rb
|
98
|
+
- lib/launcher.rb
|
99
|
+
- lib/launcher_handler.rb
|
100
|
+
- lib/parameter_parser.rb
|
101
|
+
- lib/ruby_copy.rb
|
102
|
+
- lib/sfx_generator.rb
|
98
103
|
- lib/standalone_ruby.rb
|
99
|
-
- lib/utils/config_generator.rb
|
100
|
-
- lib/utils/displayer.rb
|
101
|
-
- lib/utils/exe_packer.rb
|
102
|
-
- lib/utils/launcher.rb
|
103
|
-
- lib/utils/launcher_handler.rb
|
104
|
-
- lib/utils/logger_helper.rb
|
105
|
-
- lib/utils/parameter_parser.rb
|
106
|
-
- lib/utils/ruby_copy.rb
|
107
104
|
- lib/version/version.rb
|
108
105
|
homepage: https://github.com/ardatetikbey/Standalone-Ruby
|
109
106
|
licenses:
|
Binary file
|
Binary file
|
data/lib/utils/exe_packer.rb
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
require_relative 'logger_helper'
|
2
|
-
|
3
|
-
class ExePacker
|
4
|
-
def initialize(params)
|
5
|
-
@params = params
|
6
|
-
@logger = LoggerHelper.instance
|
7
|
-
end
|
8
|
-
|
9
|
-
def pack
|
10
|
-
begin
|
11
|
-
stub_path = File.join(File.expand_path("../data/exe_template", __dir__), "launcher_stub.c")
|
12
|
-
@logger.info("Reading stub template from: #{stub_path}")
|
13
|
-
|
14
|
-
stub_content = File.read(stub_path)
|
15
|
-
stub_content.gsub!("LAUNCHER_FILE", "#{File.basename(@params[:launcher])}")
|
16
|
-
|
17
|
-
stub_output = "#{File.join(@params[:project_path].to_s, "launcher_stub.c")}"
|
18
|
-
exe_path = "#{File.join(@params[:project_path].to_s, @params[:exe].to_s)}"
|
19
|
-
|
20
|
-
File.open(stub_output, 'w') { |f| f.write(stub_content) }
|
21
|
-
|
22
|
-
if @params[:use_gcc]
|
23
|
-
puts "\nChecking GCC..."
|
24
|
-
output = `where gcc`
|
25
|
-
|
26
|
-
if File.exist?(output.strip)
|
27
|
-
gcc_path = output.strip
|
28
|
-
puts "GCC Path: #{gcc_path}"
|
29
|
-
|
30
|
-
command = "#{gcc_path} -o #{exe_path} #{stub_output}"
|
31
|
-
@logger.info("Running command: #{command}")
|
32
|
-
`#{command}`
|
33
|
-
else
|
34
|
-
print("Error: ".red); puts("GCC could not be found!");
|
35
|
-
exit!
|
36
|
-
end
|
37
|
-
else
|
38
|
-
puts "\nUsing TCC..."
|
39
|
-
|
40
|
-
tcc_path = File.join(File.expand_path("../data/tcc", __dir__), "tcc.exe")
|
41
|
-
@logger.info("TCC Path: #{tcc_path}")
|
42
|
-
|
43
|
-
command = "#{tcc_path} -o #{exe_path} #{stub_output} -lkernel32"
|
44
|
-
@logger.info("Running command: #{command}")
|
45
|
-
`#{command}`
|
46
|
-
end
|
47
|
-
|
48
|
-
File.delete(stub_output)
|
49
|
-
@logger.info("Stub file deleted successfully")
|
50
|
-
|
51
|
-
puts("\nExe file has been generated!".green_bold_dark)
|
52
|
-
@logger.info("Exe file generated successfully at: #{exe_path}")
|
53
|
-
rescue Exception => err
|
54
|
-
@logger.error("Error occurred: #{err.message}")
|
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
|
@@ -1,111 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
require_relative 'logger_helper'
|
4
|
-
|
5
|
-
class LauncherHandler
|
6
|
-
def initialize(params)
|
7
|
-
@params = params
|
8
|
-
@logger = LoggerHelper.instance
|
9
|
-
end
|
10
|
-
|
11
|
-
def handle
|
12
|
-
begin
|
13
|
-
puts("\nThe template creation process has been started.")
|
14
|
-
|
15
|
-
# FileUtils.mkdir(File.join(@params[:project_path], "sRb_files"))
|
16
|
-
|
17
|
-
if @params[:template]
|
18
|
-
if @params[:gui] == true
|
19
|
-
ruby_file = "rubyw.exe"
|
20
|
-
else
|
21
|
-
ruby_file = "ruby.exe"
|
22
|
-
end
|
23
|
-
|
24
|
-
user_template = @params[:template].to_s
|
25
|
-
content = File.read(user_template)
|
26
|
-
@logger.info("The content of the user template has been read.")
|
27
|
-
|
28
|
-
content.gsub!("STANDALONE_RUBY_PATH", "#{File.join(File.basename(@params[:ruby_path].to_s), "bin", "#{ruby_file}")}")
|
29
|
-
@logger.info("Placed the defined Ruby interpreter path in the template.")
|
30
|
-
|
31
|
-
content.gsub!("STANDALONE_MAIN_FILE", "#{File.basename(@params[:main_file].to_s)}")
|
32
|
-
@logger.info("The main project file path defined in the template is placed.")
|
33
|
-
|
34
|
-
new_launcher_path = File.join(@params[:project_path].to_s, @params[:launcher_name].to_s)
|
35
|
-
File.open(new_launcher_path, "w") do |f_man|
|
36
|
-
f_man.puts content
|
37
|
-
end
|
38
|
-
|
39
|
-
@logger.info("New launcher file directory created as #{new_launcher_path.to_s}")
|
40
|
-
else
|
41
|
-
if @params[:launcher_type] == "vbs"
|
42
|
-
if @params[:gui] == true
|
43
|
-
vbs_template = File.join(File.expand_path("../data/vbs", __dir__), "vbs_gui.txt")
|
44
|
-
ruby_file = "rubyw.exe"
|
45
|
-
else
|
46
|
-
vbs_template = File.join(File.expand_path("../data/vbs", __dir__), "default_vbs.txt")
|
47
|
-
ruby_file = "ruby.exe"
|
48
|
-
end
|
49
|
-
|
50
|
-
puts "Using: #{vbs_template}"
|
51
|
-
|
52
|
-
if File.exist?(vbs_template)
|
53
|
-
content = File.read(vbs_template)
|
54
|
-
@logger.info("The content of the template has been read.")
|
55
|
-
|
56
|
-
content.gsub!("STANDALONE_RUBY_PATH", "#{File.join(File.basename(@params[:ruby_path].to_s), "bin", "#{ruby_file}")}")
|
57
|
-
@logger.info("Placed the defined Ruby interpreter path in the template.")
|
58
|
-
|
59
|
-
content.gsub!("STANDALONE_MAIN_FILE", "#{File.basename(@params[:main_file].to_s)}")
|
60
|
-
@logger.info("The main project file path defined in the template is placed.")
|
61
|
-
|
62
|
-
new_launcher_path = File.join(@params[:project_path].to_s, @params[:launcher_name].to_s)
|
63
|
-
File.open(new_launcher_path, "w") do |f_man|
|
64
|
-
f_man.puts content
|
65
|
-
end
|
66
|
-
|
67
|
-
@logger.info("New launcher file directory created as #{new_launcher_path.to_s}")
|
68
|
-
else
|
69
|
-
print("Handler Error: ".red); puts("The template file could not be found.")
|
70
|
-
@logger.error("Template file not found!")
|
71
|
-
exit!
|
72
|
-
end
|
73
|
-
else
|
74
|
-
if @params[:gui] == true
|
75
|
-
ruby_file = "rubyw.exe"
|
76
|
-
else
|
77
|
-
ruby_file = "ruby.exe"
|
78
|
-
end
|
79
|
-
|
80
|
-
bat_template = File.join(File.expand_path("../data/bat-cmd", __dir__), "default_bat_cmd.txt")
|
81
|
-
puts "Using: #{bat_template}"
|
82
|
-
|
83
|
-
if File.exist?(bat_template)
|
84
|
-
content = File.read(bat_template)
|
85
|
-
@logger.info("The content of the template has been read.")
|
86
|
-
|
87
|
-
content.gsub!("STANDALONE_RUBY_PATH", "#{File.join(File.basename(@params[:ruby_path].to_s), "bin", "#{ruby_file}")}")
|
88
|
-
@logger.info("Placed the defined Ruby interpreter path in the template.")
|
89
|
-
|
90
|
-
content.gsub!("STANDALONE_MAIN_FILE", "#{File.basename(@params[:main_file].to_s)}")
|
91
|
-
@logger.info("The main project file path defined in the template is placed.")
|
92
|
-
|
93
|
-
new_launcher_path = File.join(@params[:project_path].to_s, @params[:launcher_name].to_s)
|
94
|
-
File.open(new_launcher_path, "w") do |f_man|
|
95
|
-
f_man.puts content
|
96
|
-
end
|
97
|
-
|
98
|
-
@logger.info("New launcher file directory created as #{new_launcher_path.to_s}")
|
99
|
-
else
|
100
|
-
print("Handler Error: ".red); puts("The template file could not be found.")
|
101
|
-
@logger.error("Handler Error: Template file not found!")
|
102
|
-
exit!
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
rescue Exception => e
|
107
|
-
print("Handler Error: ".red); puts("#{e.message}")
|
108
|
-
@logger.error("Handler Error: #{e.message}")
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
data/lib/utils/logger_helper.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
require 'time'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
class LoggerHelper
|
6
|
-
def self.instance
|
7
|
-
documents_path = File.join(ENV['USERPROFILE'], 'Documents', 'standalone-ruby-logs')
|
8
|
-
|
9
|
-
FileUtils.mkdir_p(documents_path) unless Dir.exist?(documents_path)
|
10
|
-
|
11
|
-
timestamp = Time.now.strftime("%Y-%m-%d_%H-%M-%S")
|
12
|
-
log_file = File.join(documents_path, "standalone-ruby_#{timestamp}.log")
|
13
|
-
|
14
|
-
logger = Logger.new(log_file)
|
15
|
-
logger.level = Logger::INFO
|
16
|
-
|
17
|
-
logger.formatter = proc do |severity, datetime, progname, msg|
|
18
|
-
msg = "(empty message)" if msg.nil? || msg.strip.empty?
|
19
|
-
"#{datetime.strftime('%Y-%m-%d %H:%M:%S')} [#{severity}] #{msg}\n"
|
20
|
-
end
|
21
|
-
|
22
|
-
return logger
|
23
|
-
end
|
24
|
-
end
|
@@ -1,211 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'optparse'
|
3
|
-
|
4
|
-
require_relative 'logger_helper'
|
5
|
-
require_relative '../version/version'
|
6
|
-
|
7
|
-
class ParameterParser
|
8
|
-
def initialize
|
9
|
-
@params = {
|
10
|
-
threads: 5
|
11
|
-
}
|
12
|
-
|
13
|
-
@logger = LoggerHelper.instance
|
14
|
-
end
|
15
|
-
|
16
|
-
def normalize_paths!
|
17
|
-
@params.each do |key, value|
|
18
|
-
@params[key] = value.gsub('\\', '/') if value.is_a?(String)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def display_help
|
23
|
-
help_text = <<~EOT
|
24
|
-
Standalone-Ruby v#{StandaloneRuby::VERSION} - Package your Ruby projects as exe!
|
25
|
-
|
26
|
-
Usage: standalone-ruby [-h] [-p PROJECT_PATH] [-r RUBY_PATH] [-m MAIN_FILE] [-l LAUNCHER] [-t TEMPLATE] [-e EXE_FILE] [-c THREADS] [-g] [-v]
|
27
|
-
|
28
|
-
Options:
|
29
|
-
-p, --project PROJECT_PATH Target Ruby project path.
|
30
|
-
Ensures that the given project path exists. If not, an error is displayed.
|
31
|
-
|
32
|
-
-r, --ruby RUBY_PATH Path to the Ruby interpreter.
|
33
|
-
Ensures that the given Ruby path exists and contains a 'bin' directory.
|
34
|
-
|
35
|
-
-m, --main MAIN_FILE Path to the main Ruby file of the project.
|
36
|
-
Ensures that the specified Ruby file exists.
|
37
|
-
|
38
|
-
-l, --launcher LAUNCHER Launcher file name (either .vbs or .bat-cmd).
|
39
|
-
Ensure the launcher file exists and is of the correct type (either .vbs or .bat-cmd).
|
40
|
-
|
41
|
-
-t, --template TEMPLATE Template file for launcher.
|
42
|
-
Ensures that the specified template file exists.
|
43
|
-
|
44
|
-
-e, --exe EXE_FILE Name of the exe file to be used for output
|
45
|
-
|
46
|
-
-c, --threads THREADS Number of threads to use (default is 5).
|
47
|
-
Determines the number of threads used during the Ruby interpreter copy process and for Rubocopy operations.
|
48
|
-
A higher number of threads can speed up the process, but requires more system resources.
|
49
|
-
|
50
|
-
-g, --gui This option allows the rubyw.exe file in the bin folder to be used.
|
51
|
-
You can choose it for projects that include GUI.
|
52
|
-
|
53
|
-
-h, --help Show this help message.
|
54
|
-
|
55
|
-
-v, --version Show program version.
|
56
|
-
|
57
|
-
Notes:
|
58
|
-
- Make sure that the Ruby interpreter you are using includes all the gems required for the target project.
|
59
|
-
- The Ruby interpreter uses Robocopy for copying, and the number of threads given affects the speed of this operation.
|
60
|
-
|
61
|
-
For more details, please visit the documentation at:
|
62
|
-
https://github.com/ardatetikbey/Standalone-Ruby
|
63
|
-
|
64
|
-
EOT
|
65
|
-
|
66
|
-
puts help_text
|
67
|
-
end
|
68
|
-
|
69
|
-
def parse
|
70
|
-
begin
|
71
|
-
OptionParser.new do |opts|
|
72
|
-
note = "Note: https://github.com/ardatetikbey/Standalone-Ruby Don't forget to review my github document to get the best results."
|
73
|
-
opts.banner = "Usage: ruby #{$0} [options]\n#{note}"
|
74
|
-
|
75
|
-
opts.on("-p", "--project PROJECT_PATH", String, "Target Ruby project path") do |project_path|
|
76
|
-
project_path.strip!
|
77
|
-
if Dir.exist?("#{project_path}")
|
78
|
-
@params[:project_path] = project_path
|
79
|
-
else
|
80
|
-
print("Parser Error: ".red); puts("The specified project path #{project_path} could not be found!")
|
81
|
-
@logger.error("Parser Error: The project path #{project_path} could not be found!")
|
82
|
-
exit!
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
opts.on("-e", "--exe EXE", "Exe file name") do |exe|
|
87
|
-
@params[:exe] = exe
|
88
|
-
end
|
89
|
-
|
90
|
-
opts.on("-r", "--ruby RUBY_PATH", String, "Ruby interpreter path") do |ruby_path|
|
91
|
-
ruby_path.strip!
|
92
|
-
if Dir.exist?("#{ruby_path}")
|
93
|
-
if Dir.exist?(File.join(ruby_path, "bin"))
|
94
|
-
@params[:ruby_path] = ruby_path
|
95
|
-
end
|
96
|
-
else
|
97
|
-
print("Parser Error: ".red); puts("The specified Ruby path #{ruby_path} could not be found!")
|
98
|
-
@logger.error("Parser Error: The specified Ruby path #{ruby_path} could not be found!")
|
99
|
-
exit!
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
opts.on("--gcc") do
|
104
|
-
@params[:use_gcc] = true
|
105
|
-
end
|
106
|
-
|
107
|
-
opts.on("-m", "--main MAIN_FILE", String, "Path to the main ruby file of the project") do |main_file|
|
108
|
-
main_file.strip!
|
109
|
-
if File.exist?(main_file)
|
110
|
-
@params[:main_file] = main_file
|
111
|
-
else
|
112
|
-
print("Parser Error: ".red); puts("The specified file #{main_file} could not be found!")
|
113
|
-
@logger.error("Parser Error: The specified file #{main_file} could not be found!")
|
114
|
-
exit!
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
opts.on("-c", "--threads THREADS", Integer, "Number of threads to use (default is 5)") do |threads|
|
119
|
-
if threads.is_a?(Integer)
|
120
|
-
@params[:threads] = threads
|
121
|
-
else
|
122
|
-
print("Parser Error: ".red); puts("Invalid value for threads. Please provide an integer.")
|
123
|
-
@logger.error("Parser Error: Invalid value for threads.")
|
124
|
-
exit!
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
opts.on("-l", "--launcher LAUNCHER", String, "Launcher file name.type (vbs or bat-cmd)") do |launcher|
|
129
|
-
launcher.strip!
|
130
|
-
if launcher.include?(".vbs")
|
131
|
-
@params[:launcher] = launcher
|
132
|
-
@params[:launcher_type] = "vbs"
|
133
|
-
@params[:launcher_name] = File.basename(launcher)
|
134
|
-
elsif launcher.include?(".bat")
|
135
|
-
@params[:launcher] = launcher
|
136
|
-
@params[:launcher_type] = "bat"
|
137
|
-
@params[:launcher_name] = File.basename(launcher)
|
138
|
-
elsif launcher.include?(".cmd")
|
139
|
-
@params[:launcher] = launcher
|
140
|
-
@params[:launcher_type] = "cmd"
|
141
|
-
@params[:launcher_name] = File.basename(launcher)
|
142
|
-
else
|
143
|
-
print("Parser Error: ".red); puts("The supported launcher #{launcher} could not be found!")
|
144
|
-
@logger.error("Parser Error: The supported launcher path #{launcher} could not be found!")
|
145
|
-
exit!
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
opts.on("-t", "--template TEMPLATE", "Template file for launcher") do |template|
|
150
|
-
template.strip!
|
151
|
-
if File.exist?(template)
|
152
|
-
@params[:template] = template
|
153
|
-
else
|
154
|
-
print("Parser Error: ".red); puts("The specified template file #{template} could not be found!")
|
155
|
-
@logger.error("Parser Error: The specified template file #{template} could not be found!")
|
156
|
-
exit!
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
opts.on("-g", "--gui", "Project mode with visual interface") do
|
161
|
-
@params[:gui] = true
|
162
|
-
end
|
163
|
-
|
164
|
-
opts.on("-v", "--version") do
|
165
|
-
puts "Standalone Ruby Gem Version #{StandaloneRuby::VERSION}"
|
166
|
-
exit!
|
167
|
-
end
|
168
|
-
|
169
|
-
opts.on("-h", "--help", "Show this help message") do
|
170
|
-
display_help
|
171
|
-
exit!
|
172
|
-
end
|
173
|
-
|
174
|
-
normalize_paths!
|
175
|
-
end.parse!
|
176
|
-
|
177
|
-
if @params[:project_path].nil? || @params[:ruby_path].nil? || @params[:main_file].nil?
|
178
|
-
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.")
|
179
|
-
@logger.error("Parser Error: Missing required parameters.")
|
180
|
-
exit!
|
181
|
-
end
|
182
|
-
|
183
|
-
rescue Exception => e
|
184
|
-
print("Parser Error: ".red); puts("#{e.message}".red)
|
185
|
-
@logger.error("Parser Error: #{e.message}")
|
186
|
-
exit!
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
def params
|
191
|
-
@params
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
class String
|
196
|
-
def red
|
197
|
-
"\e[31m#{self}\e[0m"
|
198
|
-
end
|
199
|
-
|
200
|
-
def green
|
201
|
-
"\e[32m#{self}\e[0m"
|
202
|
-
end
|
203
|
-
|
204
|
-
def magenta
|
205
|
-
"\e[35m#{self}\e[0m"
|
206
|
-
end
|
207
|
-
|
208
|
-
def yellow
|
209
|
-
"\e[33m#{self}\e[0m"
|
210
|
-
end
|
211
|
-
end
|
File without changes
|
File without changes
|