ocra 1.1.0 → 1.1.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.
- data/History.txt +8 -0
 - data/Rakefile +45 -1
 - data/bin/ocra.rb +9 -7
 - data/lib/ocra.rb +1 -1
 - data/share/ocra/edicon.exe +0 -0
 - data/share/ocra/stub.exe +0 -0
 - data/share/ocra/stubw.exe +0 -0
 - data/test/test_ocra.rb +81 -16
 - metadata +4 -4
 
    
        data/History.txt
    CHANGED
    
    | 
         @@ -1,3 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            === 1.1.1
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Fixed duplicate entries in the RUBYLIB environment variable.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            * Another slight fix for relative load paths.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            * RUBYOPT is now set to the value it had when OCRA was invoked.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       1 
9 
     | 
    
         
             
            === 1.1.0
         
     | 
| 
       2 
10 
     | 
    
         | 
| 
       3 
11 
     | 
    
         
             
            * Added an icon to the executable. Can be replaced from a .ico file
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -8,13 +8,15 @@ Hoe.new('ocra', Ocra::VERSION) do |p| 
     | 
|
| 
       8 
8 
     | 
    
         
             
              p.developer('Lars Christensen', 'larsch@belunktum.dk')
         
     | 
| 
       9 
9 
     | 
    
         
             
            end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            task : 
     | 
| 
      
 11 
     | 
    
         
            +
            task :build_stub do
         
     | 
| 
       12 
12 
     | 
    
         
             
              sh "mingw32-make -C src"
         
     | 
| 
       13 
13 
     | 
    
         
             
              cp 'src/stub.exe', 'share/ocra/stub.exe'
         
     | 
| 
       14 
14 
     | 
    
         
             
              cp 'src/stubw.exe', 'share/ocra/stubw.exe'
         
     | 
| 
       15 
15 
     | 
    
         
             
              cp 'src/edicon.exe', 'share/ocra/edicon.exe'
         
     | 
| 
       16 
16 
     | 
    
         
             
            end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
      
 18 
     | 
    
         
            +
            file 'share/ocra/stub.exe' => :build_stub
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       18 
20 
     | 
    
         
             
            task :test => :stub
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
            task :standalone => [ 'bin/ocrasa.rb' ]
         
     | 
| 
         @@ -61,6 +63,9 @@ end 
     | 
|
| 
       61 
63 
     | 
    
         
             
            task :clean do
         
     | 
| 
       62 
64 
     | 
    
         
             
              rm_rf Dir.glob("bin/*.exe")
         
     | 
| 
       63 
65 
     | 
    
         
             
              sh "mingw32-make -C src clean"
         
     | 
| 
      
 66 
     | 
    
         
            +
              rm_f 'share/ocra/stub.exe'
         
     | 
| 
      
 67 
     | 
    
         
            +
              rm_f 'share/ocra/stubw.exe'
         
     | 
| 
      
 68 
     | 
    
         
            +
              rm_f 'share/ocra/edicon.exe'
         
     | 
| 
       64 
69 
     | 
    
         
             
            end
         
     | 
| 
       65 
70 
     | 
    
         | 
| 
       66 
71 
     | 
    
         
             
            task :test_standalone => :standalone do
         
     | 
| 
         @@ -69,4 +74,43 @@ task :test_standalone => :standalone do 
     | 
|
| 
       69 
74 
     | 
    
         
             
              ENV['TESTED_OCRA'] = nil
         
     | 
| 
       70 
75 
     | 
    
         
             
            end
         
     | 
| 
       71 
76 
     | 
    
         | 
| 
      
 77 
     | 
    
         
            +
            def each_ruby_version
         
     | 
| 
      
 78 
     | 
    
         
            +
              root = "h:/appl"
         
     | 
| 
      
 79 
     | 
    
         
            +
              Dir.glob(File.join(root, 'ruby-*','bin')).each do |path|
         
     | 
| 
      
 80 
     | 
    
         
            +
                path.tr!('/','\\')
         
     | 
| 
      
 81 
     | 
    
         
            +
                pathenv = ENV['PATH']
         
     | 
| 
      
 82 
     | 
    
         
            +
                ENV['PATH'] = path
         
     | 
| 
      
 83 
     | 
    
         
            +
                begin
         
     | 
| 
      
 84 
     | 
    
         
            +
                  yield
         
     | 
| 
      
 85 
     | 
    
         
            +
                ensure
         
     | 
| 
      
 86 
     | 
    
         
            +
                  ENV['PATH'] = pathenv
         
     | 
| 
      
 87 
     | 
    
         
            +
                end
         
     | 
| 
      
 88 
     | 
    
         
            +
              end
         
     | 
| 
      
 89 
     | 
    
         
            +
            end
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            task :setup_all_ruby do
         
     | 
| 
      
 92 
     | 
    
         
            +
              ENV['RUBYOPT'] = nil
         
     | 
| 
      
 93 
     | 
    
         
            +
              rubygemszip = "rubygems-1.3.4.zip"
         
     | 
| 
      
 94 
     | 
    
         
            +
              rubygemsdir = rubygemszip.gsub(/\.zip$/,'')
         
     | 
| 
      
 95 
     | 
    
         
            +
              sh "unzip rubygems-1.3.4.zip"
         
     | 
| 
      
 96 
     | 
    
         
            +
              begin
         
     | 
| 
      
 97 
     | 
    
         
            +
                cd "rubygems-1.3.4" do
         
     | 
| 
      
 98 
     | 
    
         
            +
                  each_ruby_version do
         
     | 
| 
      
 99 
     | 
    
         
            +
                    system("ruby -v")
         
     | 
| 
      
 100 
     | 
    
         
            +
                    system("ruby setup.rb")
         
     | 
| 
      
 101 
     | 
    
         
            +
                    system("gem install win32-api")
         
     | 
| 
      
 102 
     | 
    
         
            +
                  end
         
     | 
| 
      
 103 
     | 
    
         
            +
                end
         
     | 
| 
      
 104 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 105 
     | 
    
         
            +
                rm_rf "rubygems-1.3.4"
         
     | 
| 
      
 106 
     | 
    
         
            +
              end
         
     | 
| 
      
 107 
     | 
    
         
            +
            end
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
            task :test_all_ruby do
         
     | 
| 
      
 110 
     | 
    
         
            +
              each_ruby_version do
         
     | 
| 
      
 111 
     | 
    
         
            +
                system("ruby -v")
         
     | 
| 
      
 112 
     | 
    
         
            +
                system("ruby test/test_ocra.rb")
         
     | 
| 
      
 113 
     | 
    
         
            +
              end
         
     | 
| 
      
 114 
     | 
    
         
            +
            end
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
       72 
116 
     | 
    
         
             
            # vim: syntax=Ruby
         
     | 
    
        data/bin/ocra.rb
    CHANGED
    
    | 
         @@ -10,7 +10,7 @@ module Ocra 
     | 
|
| 
       10 
10 
     | 
    
         
             
              OP_DECOMPRESS_LZMA = 4
         
     | 
| 
       11 
11 
     | 
    
         
             
              OP_SETENV = 5
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
              VERSION = "1.1. 
     | 
| 
      
 13 
     | 
    
         
            +
              VERSION = "1.1.1"
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              IGNORE_MODULES = /^enumerator.so$/
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
         @@ -171,7 +171,7 @@ EOF 
     | 
|
| 
       171 
171 
     | 
    
         | 
| 
       172 
172 
     | 
    
         
             
              def Ocra.find_load_path(paths, path)
         
     | 
| 
       173 
173 
     | 
    
         
             
                if path[1,1] == ":"
         
     | 
| 
       174 
     | 
    
         
            -
                  rps = paths.map {|p| relative_path(p, path) }
         
     | 
| 
      
 174 
     | 
    
         
            +
                  rps = paths.map {|p| relative_path(File.expand_path(p), path) }
         
     | 
| 
       175 
175 
     | 
    
         
             
                  rps.zip(paths).sort_by {|x| x[0].size }.first[1]
         
     | 
| 
       176 
176 
     | 
    
         
             
                else
         
     | 
| 
       177 
177 
     | 
    
         
             
                  candidates = paths.select { |p| File.exist?(File.expand_path(path, p)) }
         
     | 
| 
         @@ -292,8 +292,8 @@ EOF 
     | 
|
| 
       292 
292 
     | 
    
         
             
                  end
         
     | 
| 
       293 
293 
     | 
    
         | 
| 
       294 
294 
     | 
    
         
             
                  # Set environment variable
         
     | 
| 
       295 
     | 
    
         
            -
                  sb.setenv('RUBYOPT', '')
         
     | 
| 
       296 
     | 
    
         
            -
                  sb.setenv('RUBYLIB', load_path.join(';'))
         
     | 
| 
      
 295 
     | 
    
         
            +
                  sb.setenv('RUBYOPT', ENV['RUBYOPT'] || '')
         
     | 
| 
      
 296 
     | 
    
         
            +
                  sb.setenv('RUBYLIB', load_path.uniq.join(';'))
         
     | 
| 
       297 
297 
     | 
    
         | 
| 
       298 
298 
     | 
    
         
             
                  # Launch the script
         
     | 
| 
       299 
299 
     | 
    
         
             
                  sb.createprocess("bin\\" + rubyexe, "#{rubyexe} \xff\\src\\" + Ocra.files[0])
         
     | 
| 
         @@ -307,7 +307,7 @@ EOF 
     | 
|
| 
       307 
307 
     | 
    
         
             
                def LibraryDetector.loaded_dlls
         
     | 
| 
       308 
308 
     | 
    
         
             
                  begin
         
     | 
| 
       309 
309 
     | 
    
         
             
                    require 'rubygems'
         
     | 
| 
       310 
     | 
    
         
            -
                    gem 'win32-api', '>=1. 
     | 
| 
      
 310 
     | 
    
         
            +
                    gem 'win32-api', '>=1.2.0'
         
     | 
| 
       311 
311 
     | 
    
         
             
                    require 'win32/api'
         
     | 
| 
       312 
312 
     | 
    
         
             
                  rescue Exception => e
         
     | 
| 
       313 
313 
     | 
    
         
             
                    puts "=== ERROR: Failed to load the win32-api gem. Install win32-api or use --no-autodll."
         
     | 
| 
         @@ -435,8 +435,10 @@ if File.basename(__FILE__) == File.basename($0) 
     | 
|
| 
       435 
435 
     | 
    
         
             
              ARGV.clear
         
     | 
| 
       436 
436 
     | 
    
         | 
| 
       437 
437 
     | 
    
         
             
              at_exit do
         
     | 
| 
       438 
     | 
    
         
            -
                 
     | 
| 
       439 
     | 
    
         
            -
             
     | 
| 
      
 438 
     | 
    
         
            +
                if $!.nil?
         
     | 
| 
      
 439 
     | 
    
         
            +
                  Ocra.build_exe
         
     | 
| 
      
 440 
     | 
    
         
            +
                  exit(0)
         
     | 
| 
      
 441 
     | 
    
         
            +
                end
         
     | 
| 
       440 
442 
     | 
    
         
             
              end
         
     | 
| 
       441 
443 
     | 
    
         | 
| 
       442 
444 
     | 
    
         
             
              puts "=== Loading script to check dependencies" unless Ocra.quiet
         
     | 
    
        data/lib/ocra.rb
    CHANGED
    
    
    
        data/share/ocra/edicon.exe
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/share/ocra/stub.exe
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/share/ocra/stubw.exe
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/test/test_ocra.rb
    CHANGED
    
    | 
         @@ -1,16 +1,36 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require "test/unit"
         
     | 
| 
       2 
     | 
    
         
            -
            require "ocra"
         
     | 
| 
       3 
2 
     | 
    
         
             
            require "tmpdir"
         
     | 
| 
       4 
3 
     | 
    
         
             
            require "fileutils"
         
     | 
| 
       5 
4 
     | 
    
         
             
            require "rbconfig"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            begin
         
     | 
| 
      
 7 
     | 
    
         
            +
              require "rubygems"
         
     | 
| 
      
 8 
     | 
    
         
            +
              gem 'win32-api', '>=1.2.0'
         
     | 
| 
      
 9 
     | 
    
         
            +
              require "win32/api"
         
     | 
| 
      
 10 
     | 
    
         
            +
              $have_win32_api = true
         
     | 
| 
      
 11 
     | 
    
         
            +
            rescue LoadError => e
         
     | 
| 
      
 12 
     | 
    
         
            +
              $have_win32_api = false
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       6 
15 
     | 
    
         
             
            include FileUtils
         
     | 
| 
       7 
16 
     | 
    
         | 
| 
       8 
17 
     | 
    
         
             
            class TestOcra < Test::Unit::TestCase
         
     | 
| 
       9 
18 
     | 
    
         | 
| 
      
 19 
     | 
    
         
            +
              # Default arguments for invoking OCRA when running tests.
         
     | 
| 
       10 
20 
     | 
    
         
             
              DefaultArgs = [ '--quiet', '--no-lzma' ]
         
     | 
| 
      
 21 
     | 
    
         
            +
              DefaultArgs.push '--no-autodll' if not $have_win32_api
         
     | 
| 
       11 
22 
     | 
    
         | 
| 
      
 23 
     | 
    
         
            +
              # Name of the tested ocra script.
         
     | 
| 
       12 
24 
     | 
    
         
             
              TESTED_OCRA = ENV['TESTED_OCRA'] || 'ocra.rb'
         
     | 
| 
       13 
25 
     | 
    
         | 
| 
      
 26 
     | 
    
         
            +
              # Root of OCRA.
         
     | 
| 
      
 27 
     | 
    
         
            +
              OcraRoot = File.expand_path(File.join(File.dirname(__FILE__), '..'))
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              # Path to test fixtures.
         
     | 
| 
      
 30 
     | 
    
         
            +
              FixturePath = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              attr_reader :ocra
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       14 
34 
     | 
    
         
             
              def initialize(*args)
         
     | 
| 
       15 
35 
     | 
    
         
             
                super(*args)
         
     | 
| 
       16 
36 
     | 
    
         
             
                @testnum = 0
         
     | 
| 
         @@ -18,30 +38,24 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       18 
38 
     | 
    
         
             
                ENV['RUBYOPT'] = ""
         
     | 
| 
       19 
39 
     | 
    
         
             
              end
         
     | 
| 
       20 
40 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
              def ocra
         
     | 
| 
       22 
     | 
    
         
            -
                @ocra
         
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
              OcraRoot = File.expand_path(File.join(File.dirname(__FILE__), '..'))
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
              FixturePath = File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
41 
     | 
    
         
             
              # Sets up an directory with a copy of a fixture and yields to the
         
     | 
| 
       30 
42 
     | 
    
         
             
              # block, then cleans up everything. A fixture here is a hierachy of
         
     | 
| 
       31 
43 
     | 
    
         
             
              # files located in test/fixtures.
         
     | 
| 
       32 
44 
     | 
    
         
             
              def with_fixture(name)
         
     | 
| 
       33 
45 
     | 
    
         
             
                path = File.join(FixturePath, name)
         
     | 
| 
       34 
     | 
    
         
            -
                 
     | 
| 
      
 46 
     | 
    
         
            +
                cp_r path, '.'
         
     | 
| 
       35 
47 
     | 
    
         
             
                begin
         
     | 
| 
       36 
48 
     | 
    
         
             
                  cd name do
         
     | 
| 
       37 
49 
     | 
    
         
             
                    yield
         
     | 
| 
       38 
50 
     | 
    
         
             
                  end
         
     | 
| 
       39 
51 
     | 
    
         
             
                ensure
         
     | 
| 
       40 
     | 
    
         
            -
                  rm_rf  
     | 
| 
      
 52 
     | 
    
         
            +
                  rm_rf name
         
     | 
| 
       41 
53 
     | 
    
         
             
                end
         
     | 
| 
       42 
54 
     | 
    
         
             
              end
         
     | 
| 
       43 
55 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
              # Sets up temporary environment  
     | 
| 
      
 56 
     | 
    
         
            +
              # Sets up temporary environment variables and yields to the
         
     | 
| 
      
 57 
     | 
    
         
            +
              # block. When the block exits, the environment variables are set
         
     | 
| 
      
 58 
     | 
    
         
            +
              # back to their original values.
         
     | 
| 
       45 
59 
     | 
    
         
             
              def with_env(hash)
         
     | 
| 
       46 
60 
     | 
    
         
             
                old = {}
         
     | 
| 
       47 
61 
     | 
    
         
             
                hash.each do |k,v|
         
     | 
| 
         @@ -57,6 +71,8 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       57 
71 
     | 
    
         
             
                end
         
     | 
| 
       58 
72 
     | 
    
         
             
              end
         
     | 
| 
       59 
73 
     | 
    
         | 
| 
      
 74 
     | 
    
         
            +
              # Test setup method. Creates a tempory directory to work in and
         
     | 
| 
      
 75 
     | 
    
         
            +
              # changes to it. 
         
     | 
| 
       60 
76 
     | 
    
         
             
              def setup
         
     | 
| 
       61 
77 
     | 
    
         
             
                @testnum += 1
         
     | 
| 
       62 
78 
     | 
    
         
             
                @tempdirname = ".ocratest-#{$$}-#{@testnum}"
         
     | 
| 
         @@ -64,11 +80,13 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       64 
80 
     | 
    
         
             
                Dir.chdir @tempdirname
         
     | 
| 
       65 
81 
     | 
    
         
             
              end
         
     | 
| 
       66 
82 
     | 
    
         | 
| 
      
 83 
     | 
    
         
            +
              # Test cleanup method. Exits the temporary directory and deletes it.
         
     | 
| 
       67 
84 
     | 
    
         
             
              def teardown
         
     | 
| 
       68 
85 
     | 
    
         
             
                Dir.chdir '..'
         
     | 
| 
       69 
86 
     | 
    
         
             
                FileUtils.rm_rf @tempdirname
         
     | 
| 
       70 
87 
     | 
    
         
             
              end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
              # Hello world test. Test that we can build and run executables.
         
     | 
| 
       72 
90 
     | 
    
         
             
              def test_helloworld
         
     | 
| 
       73 
91 
     | 
    
         
             
                with_fixture 'helloworld' do
         
     | 
| 
       74 
92 
     | 
    
         
             
                  assert system("ruby", ocra, "helloworld.rb", *DefaultArgs)
         
     | 
| 
         @@ -77,6 +95,8 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       77 
95 
     | 
    
         
             
                end
         
     | 
| 
       78 
96 
     | 
    
         
             
              end
         
     | 
| 
       79 
97 
     | 
    
         | 
| 
      
 98 
     | 
    
         
            +
              # Test that executables can writing a file to the current working
         
     | 
| 
      
 99 
     | 
    
         
            +
              # directory.
         
     | 
| 
       80 
100 
     | 
    
         
             
              def test_writefile
         
     | 
| 
       81 
101 
     | 
    
         
             
                with_fixture 'writefile' do
         
     | 
| 
       82 
102 
     | 
    
         
             
                  assert system("ruby", ocra, "writefile.rb", *DefaultArgs)
         
     | 
| 
         @@ -87,6 +107,7 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       87 
107 
     | 
    
         
             
                end
         
     | 
| 
       88 
108 
     | 
    
         
             
              end
         
     | 
| 
       89 
109 
     | 
    
         | 
| 
      
 110 
     | 
    
         
            +
              # Test that scripts can exit with a specific exit status code.
         
     | 
| 
       90 
111 
     | 
    
         
             
              def test_exitstatus
         
     | 
| 
       91 
112 
     | 
    
         
             
                with_fixture 'exitstatus' do
         
     | 
| 
       92 
113 
     | 
    
         
             
                  assert system("ruby", ocra, "exitstatus.rb", *DefaultArgs)
         
     | 
| 
         @@ -95,6 +116,7 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       95 
116 
     | 
    
         
             
                end
         
     | 
| 
       96 
117 
     | 
    
         
             
              end
         
     | 
| 
       97 
118 
     | 
    
         | 
| 
      
 119 
     | 
    
         
            +
              # Test that arguments are passed correctly to scripts.
         
     | 
| 
       98 
120 
     | 
    
         
             
              def test_arguments
         
     | 
| 
       99 
121 
     | 
    
         
             
                with_fixture 'arguments' do
         
     | 
| 
       100 
122 
     | 
    
         
             
                  assert system("ruby", ocra, "arguments.rb", *DefaultArgs)
         
     | 
| 
         @@ -104,6 +126,8 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       104 
126 
     | 
    
         
             
                end
         
     | 
| 
       105 
127 
     | 
    
         
             
              end
         
     | 
| 
       106 
128 
     | 
    
         | 
| 
      
 129 
     | 
    
         
            +
              # Test that the standard output from a script can be redirected to a
         
     | 
| 
      
 130 
     | 
    
         
            +
              # file.
         
     | 
| 
       107 
131 
     | 
    
         
             
              def test_stdout_redir
         
     | 
| 
       108 
132 
     | 
    
         
             
                with_fixture 'stdoutredir' do
         
     | 
| 
       109 
133 
     | 
    
         
             
                  assert system("ruby", ocra, "stdoutredir.rb", *DefaultArgs)
         
     | 
| 
         @@ -114,6 +138,8 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       114 
138 
     | 
    
         
             
                end
         
     | 
| 
       115 
139 
     | 
    
         
             
              end
         
     | 
| 
       116 
140 
     | 
    
         | 
| 
      
 141 
     | 
    
         
            +
              # Test that the standard input to a script can be redirected from a
         
     | 
| 
      
 142 
     | 
    
         
            +
              # file.
         
     | 
| 
       117 
143 
     | 
    
         
             
              def test_stdin_redir
         
     | 
| 
       118 
144 
     | 
    
         
             
                with_fixture 'stdinredir' do
         
     | 
| 
       119 
145 
     | 
    
         
             
                  assert system("ruby", ocra, "stdinredir.rb", *DefaultArgs)
         
     | 
| 
         @@ -123,9 +149,19 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       123 
149 
     | 
    
         
             
                end
         
     | 
| 
       124 
150 
     | 
    
         
             
              end
         
     | 
| 
       125 
151 
     | 
    
         | 
| 
      
 152 
     | 
    
         
            +
              # Test that executables can include dll's using the --dll
         
     | 
| 
      
 153 
     | 
    
         
            +
              # option. Sets PATH=. while running the executable so that it can't
         
     | 
| 
      
 154 
     | 
    
         
            +
              # find the DLL from the Ruby installation.
         
     | 
| 
       126 
155 
     | 
    
         
             
              def test_gdbmdll
         
     | 
| 
      
 156 
     | 
    
         
            +
                args = DefaultArgs.dup
         
     | 
| 
      
 157 
     | 
    
         
            +
                if not $have_win32_api
         
     | 
| 
      
 158 
     | 
    
         
            +
                  gdbmdll = Dir.glob(File.join(RbConfig::CONFIG['bindir'], 'gdbm*.dll'))[0]
         
     | 
| 
      
 159 
     | 
    
         
            +
                  return if gdbmdll.nil?
         
     | 
| 
      
 160 
     | 
    
         
            +
                  args.push '--dll', File.basename(gdbmdll)
         
     | 
| 
      
 161 
     | 
    
         
            +
                end
         
     | 
| 
      
 162 
     | 
    
         
            +
                
         
     | 
| 
       127 
163 
     | 
    
         
             
                with_fixture 'gdbmdll' do
         
     | 
| 
       128 
     | 
    
         
            -
                  assert system("ruby", ocra, "gdbmdll.rb", * 
     | 
| 
      
 164 
     | 
    
         
            +
                  assert system("ruby", ocra, "gdbmdll.rb", *args)
         
     | 
| 
       129 
165 
     | 
    
         
             
                  with_env 'PATH' => '.' do
         
     | 
| 
       130 
166 
     | 
    
         
             
                    system("gdbmdll.exe")
         
     | 
| 
       131 
167 
     | 
    
         
             
                    assert_equal 104, $?.exitstatus
         
     | 
| 
         @@ -133,6 +169,9 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       133 
169 
     | 
    
         
             
                end
         
     | 
| 
       134 
170 
     | 
    
         
             
              end
         
     | 
| 
       135 
171 
     | 
    
         | 
| 
      
 172 
     | 
    
         
            +
              # Test that scripts can require a file relative to the location of
         
     | 
| 
      
 173 
     | 
    
         
            +
              # the script and that such files are correctly added to the
         
     | 
| 
      
 174 
     | 
    
         
            +
              # executable.
         
     | 
| 
       136 
175 
     | 
    
         
             
              def test_relative_require
         
     | 
| 
       137 
176 
     | 
    
         
             
                with_fixture 'relativerequire' do
         
     | 
| 
       138 
177 
     | 
    
         
             
                  assert system("ruby", ocra, "relativerequire.rb", *DefaultArgs)
         
     | 
| 
         @@ -158,7 +197,9 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       158 
197 
     | 
    
         
             
              # ignored by Ocra (a warning may be logged).
         
     | 
| 
       159 
198 
     | 
    
         
             
              def test_autoload_missing
         
     | 
| 
       160 
199 
     | 
    
         
             
                with_fixture 'autoloadmissing' do
         
     | 
| 
       161 
     | 
    
         
            -
                   
     | 
| 
      
 200 
     | 
    
         
            +
                  args = DefaultArgs.dup
         
     | 
| 
      
 201 
     | 
    
         
            +
                  args.push '--no-warnings'
         
     | 
| 
      
 202 
     | 
    
         
            +
                  assert system("ruby", ocra, "autoloadmissing.rb", *args)
         
     | 
| 
       162 
203 
     | 
    
         
             
                  assert File.exist?("autoloadmissing.exe")
         
     | 
| 
       163 
204 
     | 
    
         
             
                  assert system("autoloadmissing.exe")
         
     | 
| 
       164 
205 
     | 
    
         
             
                end
         
     | 
| 
         @@ -251,10 +292,12 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       251 
292 
     | 
    
         
             
                end
         
     | 
| 
       252 
293 
     | 
    
         
             
              end
         
     | 
| 
       253 
294 
     | 
    
         | 
| 
      
 295 
     | 
    
         
            +
              # Test that ocra.rb accepts --version and outputs the version number.
         
     | 
| 
       254 
296 
     | 
    
         
             
              def test_version
         
     | 
| 
       255 
297 
     | 
    
         
             
                assert_match(/^Ocra \d+(\.\d)+$/, `ruby #{ocra} --version`)
         
     | 
| 
       256 
298 
     | 
    
         
             
              end
         
     | 
| 
       257 
299 
     | 
    
         | 
| 
      
 300 
     | 
    
         
            +
              # Test that ocra.rb accepts --icon.
         
     | 
| 
       258 
301 
     | 
    
         
             
              def test_icon
         
     | 
| 
       259 
302 
     | 
    
         
             
                with_fixture 'helloworld' do
         
     | 
| 
       260 
303 
     | 
    
         
             
                  icofile = File.join(OcraRoot, 'src', 'vit-ruby.ico')
         
     | 
| 
         @@ -264,6 +307,8 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       264 
307 
     | 
    
         
             
                end
         
     | 
| 
       265 
308 
     | 
    
         
             
              end
         
     | 
| 
       266 
309 
     | 
    
         | 
| 
      
 310 
     | 
    
         
            +
              # Test that additional non-script files can be added to the
         
     | 
| 
      
 311 
     | 
    
         
            +
              # executable and used by the script.
         
     | 
| 
       267 
312 
     | 
    
         
             
              def test_resource
         
     | 
| 
       268 
313 
     | 
    
         
             
                with_fixture 'resource' do
         
     | 
| 
       269 
314 
     | 
    
         
             
                  assert system("ruby", ocra, "resource.rb", "resource.txt", "res/resource.txt", *DefaultArgs)
         
     | 
| 
         @@ -271,5 +316,25 @@ class TestOcra < Test::Unit::TestCase 
     | 
|
| 
       271 
316 
     | 
    
         
             
                  assert system("resource.exe")
         
     | 
| 
       272 
317 
     | 
    
         
             
                end
         
     | 
| 
       273 
318 
     | 
    
         
             
              end
         
     | 
| 
       274 
     | 
    
         
            -
            end
         
     | 
| 
       275 
319 
     | 
    
         | 
| 
      
 320 
     | 
    
         
            +
              # Test that when exceptions are thrown, no executable will be built.
         
     | 
| 
      
 321 
     | 
    
         
            +
              def test_exception
         
     | 
| 
      
 322 
     | 
    
         
            +
                with_fixture 'exception' do
         
     | 
| 
      
 323 
     | 
    
         
            +
                  system("ruby \"#{ocra}\" exception.rb #{DefaultArgs.join(' ')} 2>NUL")
         
     | 
| 
      
 324 
     | 
    
         
            +
                  assert $?.exitstatus != 0
         
     | 
| 
      
 325 
     | 
    
         
            +
                  assert !File.exist?("exception.exe")
         
     | 
| 
      
 326 
     | 
    
         
            +
                end
         
     | 
| 
      
 327 
     | 
    
         
            +
              end
         
     | 
| 
      
 328 
     | 
    
         
            +
             
     | 
| 
      
 329 
     | 
    
         
            +
              # Test that the RUBYOPT environment variable is preserved.
         
     | 
| 
      
 330 
     | 
    
         
            +
              def test_rubyopt
         
     | 
| 
      
 331 
     | 
    
         
            +
                with_fixture 'environment' do
         
     | 
| 
      
 332 
     | 
    
         
            +
                  with_env "RUBYOPT" => "-rtime" do
         
     | 
| 
      
 333 
     | 
    
         
            +
                    assert system("ruby", ocra, "environment.rb", *DefaultArgs)
         
     | 
| 
      
 334 
     | 
    
         
            +
                    assert system("environment.exe")
         
     | 
| 
      
 335 
     | 
    
         
            +
                    env = Marshal.load(File.open("environment", "rb") { |f| f.read })
         
     | 
| 
      
 336 
     | 
    
         
            +
                    assert_equal "-rtime", env['RUBYOPT']
         
     | 
| 
      
 337 
     | 
    
         
            +
                  end
         
     | 
| 
      
 338 
     | 
    
         
            +
                end
         
     | 
| 
      
 339 
     | 
    
         
            +
              end
         
     | 
| 
      
 340 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ocra
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Lars Christensen
         
     | 
| 
         @@ -9,7 +9,7 @@ autorequire: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            date: 2009- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2009-06-01 00:00:00 +02:00
         
     | 
| 
       13 
13 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
         @@ -20,7 +20,7 @@ dependencies: 
     | 
|
| 
       20 
20 
     | 
    
         
             
                requirements: 
         
     | 
| 
       21 
21 
     | 
    
         
             
                - - ">="
         
     | 
| 
       22 
22 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       23 
     | 
    
         
            -
                    version: 1. 
     | 
| 
      
 23 
     | 
    
         
            +
                    version: 1.12.2
         
     | 
| 
       24 
24 
     | 
    
         
             
                version: 
         
     | 
| 
       25 
25 
     | 
    
         
             
            description: |-
         
     | 
| 
       26 
26 
     | 
    
         
             
              OCRA (One-Click Ruby Application) builds Windows executables from Ruby
         
     | 
| 
         @@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       74 
74 
     | 
    
         
             
            requirements: []
         
     | 
| 
       75 
75 
     | 
    
         | 
| 
       76 
76 
     | 
    
         
             
            rubyforge_project: ocra
         
     | 
| 
       77 
     | 
    
         
            -
            rubygems_version: 1.3. 
     | 
| 
      
 77 
     | 
    
         
            +
            rubygems_version: 1.3.4
         
     | 
| 
       78 
78 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       79 
79 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       80 
80 
     | 
    
         
             
            summary: OCRA (One-Click Ruby Application) builds Windows executables from Ruby source code
         
     |