Forum: Ruby ruby2exe

Posted by Junkone (Guest)
on 2008-09-19 23:35
(Received via mailing list)
i get a error i dont understand. pl help
E:\TradingTools\Development\app\helpers>rubyscript2exe sendIM.rb
Tracing sendIM ...
e:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:19:
uninitialized constant Gem::Exception (NameError)
        from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:
4:in `require'
        from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:4
        from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:
10:in `require'
        from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:
10
        from e:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:767:in
`require'
        from e:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:767
        from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/exceptions.rb:
1:in `require'
        from e:/ruby/lib/ruby/site_ruby/1.8/rubygems/exceptions.rb:1
Couldn't execute this command (rc=256):
e:\ruby\bin\ruby -r 'rubygems/rubygems_version.rb' -r 'rubygems/
defaults.rb' -r 'thread.so' -r 'thread.rb' -r 'rbconfig.rb' -r
'rubygems/exceptions.rb' -r 'rubygems/requirement.rb' -r 'rubygems/
version.rb' -r 'rubygems/dependency.rb' -r 'rubygems/
gem_path_searcher.rb' -r 'rubygems/user_interaction.rb' -r 'rubygems/
platform.rb' -r 'rubygems/specification.rb'
-r 'zlib.so' -r 'socket.so' -r 'timeout.rb' -r 'net/protocol.rb' -r
'uri/common.rb' -r 'uri/generic.rb' -r 'uri/ftp.rb' -r 'uri/http.rb' -
r 'uri/https.rb' -r 'uri/ldap.rb' -r 'uri/mailto.rb' -r 'uri.rb' -r
'net/http.rb' -r 'stringio.so' -r 'rubygems/remote_fetcher.rb' -r
'rubygems/spec_fetcher.rb' -r 'rubygems/source_index.rb' -r 'rubygems/
builder.rb' -r 'rubygems/custom_require.rb' -r 'rubygems.rb' -r
'ubygems.rb' -r 'etc.so' -r 'fileutils.rb' -I
Posted by James Dinkel (jdinkel)
on 2008-09-20 07:32
rubyscript2exe has problems with rubygems 1.2.0.  You'll need to 
downgrade to rubygems 1.1.1.

James
Posted by Erik Veenstra (Guest)
on 2008-09-20 11:51
(Received via mailing list)
> You'll need to downgrade to rubygems 1.1.1.

You don't have to. This topic has been discussed before:

https://groups.google.com/group/ruby-talk-google/t...

gegroet,
Erik V.
Posted by Junkone (Guest)
on 2008-09-20 21:12
(Received via mailing list)
On Sep 20, 5:42 am, Erik Veenstra <erikv...@gmail.com> wrote:
> > You'll need to downgrade to rubygems 1.1.1.
>
> You don't have to. This topic has been discussed before:
>
> https://groups.google.com/group/ruby-talk-google/t......
>
> gegroet,
> Erik V.

i tried this
E:\TradingTools\Development\app\helpers>unset RUBYOPT
'unset' is not recognized as an internal or external command,
operable program or batch file.


but unset does not work in my machine. infact in that thread, the last
note is that thread seems that the issue is unresolved. are there any
more suggestions or i have to downgrade....
Posted by Axel (Guest)
on 2008-09-21 11:05
(Received via mailing list)
Hello,

I had the same problem two weeks ago and managed to solve it with the
following .bat file.
(The bat file starts rubyscript2exe.)


Short version:

<snip>
set rubyopt=
:: begin long line
ruby  C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3\bin
\rubyscript2exe  diashow.rb --rubyscript2exe-verbose
:: end long line
set rubyopt=-rubygems
pause
</snip>

Replace
  C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3\bin
\rubyscript2exe
by your absolute path to your rubyscript2exe

Replace
  diashow.rb
by the path to your ruby file you want to convert into an exe.



Long version:
<snip>
@echo off
cd
:: Setting working dir to the dir of this .bat file:
cd %0\..

if "%OS%"=="Windows_NT" ((cd /d %~dp0)&(goto next))
echo %0 | find.exe ":" >nul
if not errorlevel 1 %0\
cd %0\..
:next
echo Working dir:
cd

set rubyopt=
:: begin long line
ruby  C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3\bin
\rubyscript2exe  diashow.rb --rubyscript2exe-verbose
:: end long line
set rubyopt=-rubygems
pause
</snip>

Replace
  C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3\bin
\rubyscript2exe
by your absolute path to your rubyscript2exe

Replace
  diashow.rb
by the path to your ruby file you want to convert into an exe.


I'm using:
- gem 1.2.0
- rubyscript2exe-0.5.3
- ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
- Windows XP Home, running with administratory rights (right English
wording?)


Please let me know if this works for you, too.

Have a nice day,

Axel
Posted by unknown (Guest)
on 2008-09-22 06:50
(Received via mailing list)
On Sep 21, 2:03 am, Axel <a99.googlegroups....@dfgh.net> wrote:
> :: begin long line
> by your absolute path to your rubyscript2exe
> cd %0\..
> :: begin long line
> by your absolute path to your rubyscript2exe
> wording?)
>
> Please let me know if this works for you, too.
>
> Have a nice day,
>
> Axel

One little change.  ruby  C:\ruby\lib\ruby\gems\1.8\gems
\rubyscript2exe-0.5.3\bin\rubyscript2exe %1
--rubyscript2exe-verbose

%1 in the command line allows you to specify the path+filename of the
ruby program on the command line.  Makes your script a little more
generic.

Ryan
Posted by Axel (Guest)
on 2008-09-22 08:51
(Received via mailing list)
You're right. Thank you!

Axel
Posted by Raveendran .P (jazzezravi)
on 2009-09-04 09:07
I am getting this error

C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscript.d.3048.1/rubyscript2exe/require2lib.rb:60:in 
`gat
herlibs': undefined method `list' for Gem::Specification:Class 
(NoMethodError)
        from 
C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscript.d.3048.1/rubyscript2exe/require2lib.
rb:30
        from jazzez-FFbook-urls.rb:16
Couldn't execute this command (rc=256):
C:\ruby\bin\ruby  -I 
'C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscript.d.3048.1/rubyscript2exe' 
-I
 'C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscript.d.3048.1' -I 
'C:/ruby/lib/ruby/site_ruby/1.8' -
I 'C:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt' -I 
'C:/ruby/lib/ruby/site_ruby' -I 'C:/ruby/lib/ruby
/1.8' -I 'C:/ruby/lib/ruby/1.8/i386-mswin32' -I '.' -I 'C:/ruby/bin' -I 
'C:/DOCUME~1/RAVEEN~1/LOCAL
S~1/Temp/tar2rubyscript.d.3048.1/rubyscript2exe' -I 
'C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscr
ipt.d.3048.1/rubyscript2exe/lib' -I 
'C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscript.d.3048.1/rub
yscript2exe' -I 
'C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscript.d.3048.1/rubyscript2exe/lib' 
-r
'C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscript.d.3048.1/rubyscript2exe/require2lib.rb' 
'jazzez-
FFbook-urls.rb' --require2lib-verbose
Stopped.

Bat file code:

echo off
cd
:: Setting working dir to the dir of this .bat file:
cd %0\..

if "%OS%"=="Windows_NT" ((cd /d %~dp0)&(goto next))
echo %0 | find.exe ":" >nul
if not errorlevel 1 %0\
cd %0\..
:next
echo Working dir:
cd

set rubyopt=
:: begin long line
ruby 
C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3\bin\rubyscript2exe 
%1 --rubyscript2exe-verbose
:: end long line
set rubyopt=-rubygems
pause


I have tried from the link --> 
https://groups.google.com/group/ruby-talk-google/t...


Still no solution for this issue
Posted by Wu Junchen (phoenix520)
on 2009-09-04 10:04
Maybe you should try ocra instead of rubyscript2exe,it's excellent!
It support ruby1.9,waitr and so on.
http://github.com/larsch/ocra/tree/master
Posted by James Dinkel (jdinkel)
on 2009-09-04 16:19
Wu Junchen wrote:
> Maybe you should try ocra instead of rubyscript2exe,it's excellent!
> It support ruby1.9,waitr and so on.
> http://github.com/larsch/ocra/tree/master

I've pretty much given up on r2exe.  I don't want to be stuck using an 
old version of ruby and rubygems, and rc2exe development has been 
abandoned.  it looks like OCRA is the new choice, although I do not like 
it nearly as well as r2exe.
Posted by Raveendran .P (jazzezravi)
on 2009-09-08 07:11
Hi Wu and james,

Yes. Ocra Rocks.

Thanks
P.Raveendran
http://raveendran.wordpress.com
Posted by Leslie Viljoen (Guest)
on 2009-09-09 15:29
(Received via mailing list)
On Fri, Sep 4, 2009 at 9:08 AM, Raveendran
Perumalsamy<jazzezravi@gmail.com> wrote:
> I am getting this error
>
> C:/DOCUME~1/RAVEEN~1/LOCALS~1/Temp/tar2rubyscript.d.3048.1/rubyscript2exe/require2lib.rb:60:in
> `gat
> herlibs': undefined method `list' for Gem::Specification:Class
> (NoMethodError)


I have fixed this in my own local copy of RubyScript2Exe because I
can't get Ocra to work
(my Ocra problem is here:
http://rubyforge.org/forum/forum.php?thread_id=456...)

If you need to get RubyScript2Exe working on Windows, do this:

> c:
> cd \ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3

> C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3>ruby realstuff.rb --tar2rubyscript-justextract
> C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3>cd rubyscript2exe

 ... now make the changes mentioned below, then repackage with:

> C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3>tar2rubyscript rubyscript2exe realstuff.rb




The changes needed are in require2lib.rb, line 60 onwards needs to be 
like so:

 #Gem::Specification.list.each do |gem|
      Gem.loaded_specs.each do |name, gem|
        #if gem.loaded?
          $stderr.puts "Found gem #{gem.name} (#{gem.version})."  if 
VERBOSE

          fromdir  = File.join(gem.installation_path, "specifications")
          todir    =
File.expand_path("rubyscript2exe.gems/specifications", LIBDIR)

          fromfile  = File.join(fromdir, "#{gem.full_name}.gemspec")
          tofile  = File.join(todir, "#{gem.full_name}.gemspec")

          File.copy(fromfile, tofile)

          fromdir  = gem.full_gem_path
          todir    =
File.expand_path(File.join("rubyscript2exe.gems/gems", gem.full_name),
LIBDIR)

          Dir.copy(fromdir, todir)

          Dir.find(todir).each do |file|
            if File.file?(file)
              gem.require_paths.each do |lib|
                unless lib.empty?
                  lib  = File.expand_path(lib, todir)
                  lib  = lib + "/"

                  requireablefiles << file[lib.length..-1]  if file =~ 
/^#{lib}/
                end
              end
            end
          end
        #end

      end
    end

    ($" + LOADED).each do |req|
Posted by Raveendran .P (jazzezravi)
on 2009-09-10 06:36
Hi,

Error when i run the last command.

Error details:

C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3>tar2rubyscript 
rubyscript2exe realstuff.rb
'tar2rubyscript' is not recognized as an internal or external command,
operable program or batch file.



--tar2rubyscript-justextract
>> C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3>cd rubyscript2exe
> 
>  ... now make the changes mentioned below, then repackage with:
> 
>> C:\ruby\lib\ruby\gems\1.8\gems\rubyscript2exe-0.5.3>tar2rubyscript rubyscript2exe realstuff.rb
Posted by Bigmac Turdsplash (i8igmac)
on 2009-09-10 07:28
rubyscript2exe.rb

what is all that random junk at the bottem of the script? can this be 
removed?
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.