rb2exe 0.1.49 → 0.1.50
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/bin/build +5 -2
- data/bin/rb2exe +24 -5
- data/lib/rb2exe/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 874d811ecf45e005f753ebd0edfd007317fa05ee
|
4
|
+
data.tar.gz: 2cfb703f34ab4e50c705087a7bdc015523a9faa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 363c21d250dd12d2547bf23166f5788d1b77765b518f54d415e921f9a791d8ff21bb445a233a4e5b79bb7e751a84e8db5812e025fc094d20ae504a14ba2b9cc0
|
7
|
+
data.tar.gz: 35dfcf39c838a3eb7ddc56a373f937631d462dddc64cf2d2e99c7b77d3d518114d740a06cb9c36288cdd461459a0d32f93c28b1578eb432e58417a0cad073ab4
|
data/README.md
CHANGED
@@ -11,23 +11,31 @@ gem install rb2exe
|
|
11
11
|
## Usage
|
12
12
|
|
13
13
|
```bash
|
14
|
-
rb2exe
|
14
|
+
rb2exe RUBY_SCRIPT [options]
|
15
|
+
-q, --quiet Do not run verbosely
|
16
|
+
-a, --add FOLDER Add an entire folder (eg. ".")
|
17
|
+
-o, --output OUTPUT Output executable filename
|
18
|
+
-h, --help Help
|
15
19
|
```
|
16
20
|
|
17
|
-
##
|
21
|
+
## Example:
|
18
22
|
```bash
|
19
23
|
mkdir test
|
20
24
|
cd test
|
21
25
|
echo "puts 'Hello world'" > test.rb
|
26
|
+
|
22
27
|
rb2exe test.rb
|
23
28
|
./test
|
24
29
|
```
|
25
30
|
|
31
|
+
|
26
32
|
## Security
|
27
33
|
|
28
34
|
rb2exe DOESN'T protects your source code.
|
29
35
|
|
30
|
-
In fact, the produced executable file contains all
|
36
|
+
In fact, the produced executable file contains all the source files and THEY CAN BE EASILY EXTRACTED.
|
37
|
+
|
38
|
+
You can see the list of the added source files when you run rb2exe.
|
31
39
|
|
32
40
|
rb2exe just packages your source files (plus a stand-alone ruby) in an auto-extract zip file. It doesn't protects your code in any way.
|
33
41
|
|
data/bin/build
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
cd $1/payload
|
3
|
+
|
4
|
+
if ! $4; then
|
3
5
|
echo "Adding files:"
|
4
6
|
ls lib/app -1A
|
5
7
|
echo ""
|
8
|
+
fi
|
9
|
+
|
6
10
|
tar cf ../payload.tar ./*
|
7
11
|
cd ..
|
8
12
|
|
@@ -22,6 +26,5 @@ else
|
|
22
26
|
fi
|
23
27
|
|
24
28
|
chmod +x output
|
25
|
-
echo "
|
26
|
-
echo "SUCCESS!"
|
29
|
+
echo "SUCCESS! (filename is \"$3\")"
|
27
30
|
exit 0
|
data/bin/rb2exe
CHANGED
@@ -5,32 +5,51 @@
|
|
5
5
|
# Eg: rb2exe test.rb . exe_output
|
6
6
|
#
|
7
7
|
require "tmpdir"
|
8
|
+
require 'optparse'
|
8
9
|
|
9
10
|
def blank?(arg)
|
10
11
|
"#{arg}".strip == ""
|
11
12
|
end
|
12
13
|
|
14
|
+
|
15
|
+
# Arguments
|
16
|
+
options = {
|
17
|
+
quiet: false,
|
18
|
+
add: nil,
|
19
|
+
output: nil
|
20
|
+
}
|
21
|
+
opt_parser = OptionParser.new do |opts|
|
22
|
+
opts.banner = "Usage: rb2exe RUBY_SCRIPT [options]"
|
23
|
+
opts.version = Rb2exe::VERSION
|
24
|
+
|
25
|
+
opts.on("-q", "--quiet", "Do not run verbosely") { |v| options[:quiet] = v }
|
26
|
+
opts.on("-a", "--add FOLDER", "Add an entire folder (eg. \".\")") { |v| options[:add] = v }
|
27
|
+
opts.on("-o", "--output OUTPUT", "Output executable filename") { |v| options[:output] = v }
|
28
|
+
opts.on("-h","--help", "Help") { puts opt_parser }
|
29
|
+
end
|
30
|
+
opt_parser.parse!
|
31
|
+
|
13
32
|
# Gem path
|
14
33
|
gem_dir = File.expand_path(File.dirname(__FILE__) + "/..")
|
15
34
|
|
16
35
|
# Main ruby app (filename)
|
17
36
|
main_app_path = ARGV[0]
|
18
|
-
abort("
|
37
|
+
abort("#{opt_parser}") if blank?(main_app_path)
|
19
38
|
abort("#{ARGV[0]} doesn't exist.") if ! File.exists?(ARGV[0])
|
20
39
|
|
21
40
|
# App directory
|
22
41
|
pwd = Dir.pwd
|
23
|
-
if blank?(
|
42
|
+
if blank?(options[:add])
|
24
43
|
app_dir = nil
|
25
44
|
else
|
26
|
-
app_dir = File.expand_path(
|
45
|
+
app_dir = File.expand_path(options[:add])
|
27
46
|
abort "Directory #{app_dir} doesn't exist." if ! Dir.exists?(app_dir)
|
28
47
|
end
|
29
48
|
|
30
49
|
# Executable filename
|
31
50
|
# If not specified, uses the main app filename without its extension. Eg.:
|
32
51
|
# script.rb -> script
|
33
|
-
exe_fn = blank?(
|
52
|
+
exe_fn = blank?(options[:output]) ? File.basename(ARGV[0], File.extname(ARGV[0])) : options[:output]
|
34
53
|
abort("Can't use '#{exe_fn}' as a filename (there's a folder with this name).") if Dir.exists?("#{pwd}/#{exe_fn}")
|
35
54
|
|
36
55
|
# Ruby version should be 2.2.2, 64 bits:
|
@@ -54,7 +73,7 @@ Dir.mktmpdir do |tmp_dir|
|
|
54
73
|
FileUtils.cp_r("#{gem_dir}/bin/installer", "#{tmp_dir}/payload/") # Create a wrapper script (name it as "installer")
|
55
74
|
FileUtils.cp_r("#{gem_dir}/bin/build", "#{tmp_dir}/") # Package builder
|
56
75
|
FileUtils.cp_r("#{gem_dir}/bin/decompress", "#{tmp_dir}/")
|
57
|
-
result = `#{tmp_dir}/build #{tmp_dir} #{main_app_path} #{exe_fn}`
|
76
|
+
result = `#{tmp_dir}/build #{tmp_dir} #{main_app_path} #{exe_fn} #{options[:quiet]}`
|
58
77
|
FileUtils.mv("#{tmp_dir}/output", "#{pwd}/#{exe_fn}") # Output
|
59
78
|
end
|
60
79
|
print result
|
data/lib/rb2exe/version.rb
CHANGED