Forum: Ruby rubyscript2exe problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2adb706d2adaf702d024464851b7ef38?d=identicon&s=25 Mew Shew (mewshew)
on 2008-12-03 06:43
Hi all,

This is my first post so forgive me if step on any forum conventions.
I'm not a programmer in any real sense - I just like playing around.
However I've managed to build an app that helps me do my work. Other
people in my workplace have now expressed interest in using the app.

I'm trying to convert the ruby app to .exe using the rubyscript2exe gem.

everytime I try I get this:

C:/Ruby/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/bin/rubyscript2exe:5:in
`replace': can't modify frozen string (TypeError)
        from
C:/Ruby/lib/ruby/gems/1.8/gems/rubyscript2exe-0.5.3/bin/rubyscript2exe:5
        from C:/Ruby/bin/rubyscript2exe:19:in `load'
        from C:/Ruby/bin/rubyscript2exe:19


The command I run is: rubyscript2exe application.rb
I'm running this from command prompt whilst in the directory containing
the .rb file.

tried updating all gems, completely reinstalling Ruby to the most recent
installation and still have this problem.

I'm assuming that this is caused by some simple oversight. Any
suggestions would be greatly appreciated. :)
Beb77c4602c3cac7a12149431366ed11?d=identicon&s=25 The Higgs bozo (higgsbozo)
on 2008-12-03 07:12
2adb706d2adaf702d024464851b7ef38?d=identicon&s=25 Mew Shew (mewshew)
on 2008-12-03 09:41
The Higgs bozo wrote:
>
> http://www.ruby-forum.com/topic/170355
>
> http://letmegooglethatforyou.com/?q=rubyscript2exe...

I have already tried the solution in the first link (see above where I
mention that I have tried a complete reinstall of Ruby) as well as all
others that I could find on google but thanks very much for your helpful
response.

I'm only asking for help because I've been unable to find a solution
that worked after several hours of trying.
621080472679266b8e9b81aff4800398?d=identicon&s=25 Saji N. Hameed (Guest)
on 2008-12-03 10:02
(Received via mailing list)
* Jim Mahony <mewshew@hotmail.com> [2008-12-03 17:35:40 +0900]:

>
> I'm only asking for help because I've been unable to find a solution
> that worked after several hours of trying.

Hope you tried the one mentioned at

http://rha7dotcom.blogspot.com/2008/09/rubyscript2...


Meanwhile it may also be worthwhile to check out crate for your
packaging needs (see below)

saji
---

From: Jeremy Hinegardner <jeremy@hinegardner.org>
Subject: [ANN] crate 0.1.1 Released
To: ruby-talk ML <ruby-talk@ruby-lang.org>
Reply-To: ruby-talk@ruby-lang.org
Mail-Followup-To: Ruby Talk <ruby-talk@ruby-lang.org>
Date: Tue, 2 Dec 2008 02:12:02 +0900
User-Agent: Mutt/1.5.16 (2007-06-09)
Message-Id: <20081201171730.GA11397@hinegardner.org>


I'm pleased to announce that Crate, the project I spoke on at RubyConf
this year, has reached a releasable stage.

  gem install crate

Crate is a tool to help package up your application as a custom static
build of the ruby interpreter plus all dependant binary extensions.
All the pure ruby code (the ruby application, the ruby stdlib, etc) is
packed into one or more SQLite databases.

The final distributable pieces are a single executable and a few SQLite
databases which can be then wrapped up appropriately as an OS X App; a
self extracting executable for Windows; a shar archive, rpm or tarball
for Unixes.

Project:  http://copiousfreetime.rubyforge.org/crate/
Tutorial:
http://copiousfreetime.org/articles/2008/11/30/pac...
with-crate.html


> --
> Posted via http://www.ruby-forum.com/.
>
>

--
Saji N. Hameed

APEC Climate Center                  +82 51 668 7470
National Pension Corporation Busan Building 12F
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705      saji@apcc21.net
KOREA
2adb706d2adaf702d024464851b7ef38?d=identicon&s=25 Mew Shew (mewshew)
on 2008-12-03 11:51
Saji N. Hameed wrote:
> * Jim Mahony <mewshew@hotmail.com> [2008-12-03 17:35:40 +0900]:
>
>>
>> I'm only asking for help because I've been unable to find a solution
>> that worked after several hours of trying.
>
> Hope you tried the one mentioned at
>
> http://rha7dotcom.blogspot.com/2008/09/rubyscript2...
>
>
> Meanwhile it may also be worthwhile to check out crate for your
> packaging needs (see below)
>
> saji

Hi Saji

Thanks for the response.

Yes I have tried the solution in the link and it didn't make any
noticable difference (the actual line it refers to wasn't exactly where
the solution says it's supposed to be so I figure its refering to an
older version - i tried the fix regardless).

As for Crate - thanks for the tip. I'll give it a go. :)
Ae36591847393e58ff189704f5eb18f2?d=identicon&s=25 Jeremy Hinegardner (Guest)
on 2008-12-04 06:42
(Received via mailing list)
On Wed, Dec 03, 2008 at 07:45:38PM +0900, Mew Shew wrote:
> >
> Yes I have tried the solution in the link and it didn't make any
> noticable difference (the actual line it refers to wasn't exactly where
> the solution says it's supposed to be so I figure its refering to an
> older version - i tried the fix regardless).
>
> As for Crate - thanks for the tip. I'll give it a go. :)

This sounds like a perfect opportunity to use crate on windows.  Please
let me
know how I can help, I have yet to distribute a windows application with
it.
And I want to make sure windows is supported, feel free to contact me on
or off
list and we can get you up and running.

enjoy,

-jeremy
2adb706d2adaf702d024464851b7ef38?d=identicon&s=25 Mew Shew (mewshew)
on 2008-12-05 05:40
Jeremy Hinegardner wrote:

> This sounds like a perfect opportunity to use crate on windows.  Please
> let me
> know how I can help, I have yet to distribute a windows application with
> it.
> And I want to make sure windows is supported, feel free to contact me on
> or off
> list and we can get you up and running.
>
> enjoy,
>
> -jeremy

Hey Jeremy,

Thanks very much for the response. I thought your name looked familiar.
I've been reading through the crate tutorial on your website.

I extremely keen to get my app working as a self-contained executable
but have so far been unsucessful. I followed your tutorial and hit a
problem quite early. See below:

C:\>gem install crate
Successfully installed crate-0.1.1
1 gem installed
Installing ri documentation for crate-0.1.1...
Installing RDoc documentation for crate-0.1.1...

C:\>crate -v
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require': no such file to load -- logging (LoadError)
        from
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
        from C:/Ruby/lib/ruby/gems/1.8/gems/crate-0.1.1/lib/crate.rb:7
        from
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
        from
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
        from
C:/Ruby/lib/ruby/gems/1.8/gems/crate-0.1.1/lib/crate/main.rb:1
        from
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
        from
C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
        from C:/Ruby/lib/ruby/gems/1.8/gems/crate-0.1.1/bin/crate:7
        from C:/Ruby/bin/crate:19:in `load'
        from C:/Ruby/bin/crate:19

C:\>

I can't help but get the impression that there is something that I'm
doing wrong or something wrong with my installation (though I have
reinstalled Ruby and all gems with the same result).

If you can provide any insight or assistence it would be greatly
appreciated. :)
Beb77c4602c3cac7a12149431366ed11?d=identicon&s=25 The Higgs bozo (higgsbozo)
on 2008-12-05 06:22
Mew Shew wrote:
> The Higgs bozo wrote:
>>
>> http://www.ruby-forum.com/topic/170355
>>
>> http://letmegooglethatforyou.com/?q=rubyscript2exe...
>
> I have already tried the solution in the first link (see above where I
> mention that I have tried a complete reinstall of Ruby)

You said that you installed "to the most recent installation", but the
first link suggests not using the most recent.  Are you sure you tried
ruby186-26.exe?  Your error is exactly the same as the one myself and
others had, which was solved by going back to that version.
Ae36591847393e58ff189704f5eb18f2?d=identicon&s=25 Jeremy Hinegardner (Guest)
on 2008-12-06 02:03
(Received via mailing list)
On Fri, Dec 05, 2008 at 01:35:03PM +0900, Mew Shew wrote:
> > enjoy,
> problem quite early. See below:
>         from
> C:/Ruby/lib/ruby/gems/1.8/gems/crate-0.1.1/lib/crate/main.rb:1
> C:\>
>
> I can't help but get the impression that there is something that I'm
> doing wrong or something wrong with my installation (though I have
> reinstalled Ruby and all gems with the same result).
>
> If you can provide any insight or assistence it would be greatly
> appreciated. :)

No, this is my mistake, I forgot to include logging as a gem dependency.
if you run 'gem install logging' then this error will clear up.  I'll
push a new
version of crate out by monday that has this fix in it.

enjoy,

-jeremy
2adb706d2adaf702d024464851b7ef38?d=identicon&s=25 Mew Shew (mewshew)
on 2008-12-06 02:44
The Higgs bozo wrote:
> Mew Shew wrote:
>> The Higgs bozo wrote:
>>>
>>> http://www.ruby-forum.com/topic/170355
>>>
>>> http://letmegooglethatforyou.com/?q=rubyscript2exe...
>>
>> I have already tried the solution in the first link (see above where I
>> mention that I have tried a complete reinstall of Ruby)
>
> You said that you installed "to the most recent installation", but the
> first link suggests not using the most recent.  Are you sure you tried
> ruby186-26.exe?  Your error is exactly the same as the one myself and
> others had, which was solved by going back to that version.

I realised that the version of Ruby on my home PC was ruby186-26, tried
it out and it worked. Thanks a bunch.
349d517e0dcaf44bcb703978b87bf546?d=identicon&s=25 James Cowlishaw (cowlibob)
on 2009-06-04 16:41
The Higgs bozo wrote:
>
> http://www.ruby-forum.com/topic/170355
>
> http://letmegooglethatforyou.com/?q=rubyscript2exe...

This fix is not reliable; assignment to $0 doesn't reallocate it's
buffer, hence the new string may be truncated.

Try this in a file test.rb:

  10.times do
    $0 = $0 + "."
    puts "#{$0} (#{$0.size})"
  end

You'll see the output:

  >ruby test.rb
  test.rb. (8)
  test.rb.. (9)
  test.rb... (10)
  test.rb.... (11)
  test.rb.... (11)
  test.rb.... (11)
  test.rb.... (11)
  test.rb.... (11)
  test.rb.... (11)
  test.rb.... (11)
  >Exit code: 0

The fix is to alias $0:

  $progname = $0
  alias $PROGRAM_NAME $0
  alias $0 $progname

  10.times do
    $0 = $0 + "."
    puts "#{$0} (#{$0.size})"
  end

The output is then correct:

  >ruby test.rb
  test.rb. (8)
  test.rb.. (9)
  test.rb... (10)
  test.rb.... (11)
  test.rb..... (12)
  test.rb...... (13)
  test.rb....... (14)
  test.rb........ (15)
  test.rb......... (16)
  test.rb.......... (17)
  >Exit code: 0


See http://github.com/cowlibob/rubyscript2exe for the complete fixed
script.

Cowlibob.
This topic is locked and can not be replied to.