rb2exe 0.1.49 → 0.1.50

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 228617d28fb7b751b1200c5e088b80c4714b2c49
4
- data.tar.gz: e27c3823553721eb252c9b1d1881cab4e646b6cc
3
+ metadata.gz: 874d811ecf45e005f753ebd0edfd007317fa05ee
4
+ data.tar.gz: 2cfb703f34ab4e50c705087a7bdc015523a9faa7
5
5
  SHA512:
6
- metadata.gz: ce2c78c045c2aa6e90b897496fbe522bee0c2b28c1e1690b65e484514bedea1ce26041588ce0602892e07a58b14ec2bdf995d4901e935694618cfd0e230586b5
7
- data.tar.gz: addd64f8fdfe721ad63e86fc313d8f989c795c523a15d088a57fc4035c9c3d427cad5f877da5dfbf46404ccb0deaef3f8fb3c86f0c136420767fc2dd6bf29bb4
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 script.rb <optional folder to include> <optional output filename>
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
- ## Usage Example:
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 your source files and THEY CAN BE EASILY EXTRACTED.
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 "Self-extract file created (filename is \"$3\")"
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("You need to specify a ruby file.") if blank?(main_app_path)
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?(ARGV[1])
42
+ if blank?(options[:add])
24
43
  app_dir = nil
25
44
  else
26
- app_dir = File.expand_path(ARGV[1])
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?(ARGV[2]) ? File.basename(ARGV[0], File.extname(ARGV[0])) : ARGV[2]
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
@@ -1,3 +1,3 @@
1
1
  module Rb2exe
2
- VERSION = "0.1.49"
2
+ VERSION = "0.1.50"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb2exe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.49
4
+ version: 0.1.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Loureiro