Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try out shoes-4.0.0.pre1.gem and packaging your app #137

Closed
ashbb opened this issue Oct 24, 2012 · 16 comments
Closed

Try out shoes-4.0.0.pre1.gem and packaging your app #137

ashbb opened this issue Oct 24, 2012 · 16 comments
Milestone

Comments

@ashbb
Copy link
Member

ashbb commented Oct 24, 2012

If you have Windows, try out the following steps.

  • mkdir c:\tmp\hello
  • Save your app snippet as c:\tmp\hello\hello.rb
Shoes.app do
  para 'hello shoes 4!!'
end
  • Download shoes-4.0.0.pre1.gem from here.
  • jruby --1.9 -S gem install shoes-4.0.0.pre1.gem
  • cd c:\jruby\lib\ruby\gems\1.8\gems\shoes-4.0.0.pre1
  • bin\shoes.bat -p swt:app c:\tmp\hello\hello.rb
  • Close your app window by hand. You get c:\tmp\hello\pkg directory.
  • cd "c:\tmp\hello\pkg\hello.app\Contents\Java"
  • java -Djruby.compat.version=1.9 -jar hello.jar

Your app will be launched from in the hello.jar.

shoes4-shoesapp.jar-snapshot.png

ps. If you are OSX or Linux user, read README.


Note: Updated shoes-4.0.0.pre1.gem and modified the above steps.

@wasnotrice
Copy link
Member

Here is @ashbb's Shoes App.app, packaged on Windows 7, running on OS X 10.8:

![](https://dl.dropbox.com/u/610739/Screenshots/Screen Shot 2012-10-24 at 11.31.14 AM.png)

Great work, @ashbb!!!

Also, if you only want to package a .jar (and not an .app) you _should_ be able to run

bin\shoes.bat -p swt:jar c:\tmp\hello\hello.rb
cd c:\tmp\hello\pkg
java -Djruby.compat.version=1.9 -jar shoesapp.jar

If that doesn't work, we should fix it :P

@XULRunner42
Copy link

OK, I tried it, and I could not get it to work. It is so confusing, what is the point of an app folder if it doesn't come with everything you need to run? I tried to follow the instructions in shoes.bat, but I could not get past

Errno::ENOENT: No such file or directory - swt:app
  initialize at org/jruby/RubyFile.java:500
        open at org/jruby/RubyIO.java:1135
        gets at org/jruby/RubyArgsFile.java:251
        gets at org/jruby/RubyKernel.java:324

I think I am calling it wrong.

I did not know you could put screenshots into github issues, but here is where it would have gone:

Standard (packaged) E17/X11 in Ubuntu Linux with Shoes 4 test app

Shoes4 App

It's pretty big, if it doesn't come with Java and it doesn't come with JRuby, then what is all this other stuff? :-)
Tested on:

OpenJDK 1.6.0_24 (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

(Ubuntu Precise)

Clearly I did not get the instructions... tried also bin/shoes from the gem like this:

shoes-4.0.0.pre1$ ruby bin/shoes -p swt:app /tmp/hello/hello.rb
SyntaxError: /home/yebyen/.rvm/gems/jruby-1.6.8/gems/shoes-4.0.0.pre1/lib/shoes/color.rb:204: syntax error, unexpected '='

      define_method(c) do |alpha = nil|
                                 ^
  require at org/jruby/RubyKernel.java:1062
  require at /home/yebyen/.rvm/gems/jruby-1.6.8/gems/shoes-4.0.0.pre1/lib/shoes/color.rb:36
   (root) at /home/yebyen/.rvm/gems/jruby-1.6.8/gems/shoes-4.0.0.pre1/lib/shoes.rb:22
  require at org/jruby/RubyKernel.java:1062
   (root) at /home/yebyen/.rvm/gems/jruby-1.6.8/gems/shoes-4.0.0.pre1/lib/shoes.rb:2
  require at org/jruby/RubyKernel.java:1062
   (root) at bin/shoes:3

@wasnotrice
Copy link
Member

OK, I tried it, and I could not get it to work. It is so confusing, what is the point of an app folder if it doesn't come with everything you need to run?

This first packaging effort is to produce a .app. This contains everything you need to run your app _on a Mac_ :)

We'll get Linux and Windows working next!

I tried to follow the instructions in shoes.bat,

This one is for Windows, so it won't work on Linux.

tried also bin/shoes from the gem

That's the one you want! The error you are getting is because your jruby is running in 1.8 mode, but you need it to be in 1.9 mode. Try

$ export JRUBY_OPTS=--1.9

(you only need to do this once per shell session. To make it permanent, place it in your ~/.profile or some such file.

$ bin/shoes -p swt:app /tmp/hello/hello.rb

This should create a .app that will run on a Mac. As @ashbb says, you can run the .jar from inside the .app like this:

$ java -jar /tmp/hello/pkg/Shoes\ App.app/Contents/Java/shoesapp.jar

To create a plain .jar that you can run on Linux, try

$ bin/shoes -p swt:jar /tmp/hello/hello.rb
$ java -jar /tmp/hello/pkg/shoesapp.jar

The packager isn't yet smart enough to name your .jar "hello.jar" ;)

Let us know how it works!

@XULRunner42
Copy link

I was about to try jruby-head instead, thanks for saving me the time...

I will try it! Thanks! :)

@wasnotrice
Copy link
Member

Well now that you mention it, I think jruby 1.7 (current head) runs in 1.9 mode by default, so that would probably work too :)

@steveklabnik
Copy link
Member

Yes, 1.7 does.

@wasnotrice
Copy link
Member

@XULRunner42 I fixed some bugs in the jar packager, so pull new changes before you try it.

PS Now your jar will be called "hello.jar" :)

@ashbb
Copy link
Member Author

ashbb commented Oct 25, 2012

@wasnotrice Thanks for fixing JAR packaging paths for CLI. Now the swt:jar option works well on Windows. :)

@bassnode
Copy link

bassnode commented Mar 1, 2013

I get an error about an invalid config. I've tried both copying the sample icon files into the script's directory and copying the example app.yaml into the dir and removing the icon statements - still errors. I'm on the very latest sha, FWIW. Let me know if you need more details.

$ uname -a
Darwin bassnode-macbookair.local 12.2.1 Darwin Kernel Version 12.2.1: Thu Oct 18 16:32:48 PDT 2012; root:xnu-2050.20.9~2/RELEASE_X86_64 x86_64

$ ruby -v
jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64]

$ /Users/bassnode/.rvm/gems/jruby-1.7.3/gems/shoes-4.0.0.pre1/bin/shoes -p swt:app hello.rb 
Packaging swt:app...
ArgumentError: Invalid configuration.
  - OS X icon file configured as '', but couldn't find file at .
  initialize at /Users/bassnode/.rvm/gems/jruby-1.7.3/gems/shoes-4.0.0.pre1/lib/shoes/swt/package/app.rb:19
         new at /Users/bassnode/.rvm/rubies/jruby-1.7.3/lib/ruby/shared/rubygems/custom_require.rb:11
     package at /Users/bassnode/.rvm/gems/jruby-1.7.3/gems/shoes-4.0.0.pre1/lib/shoes/cli.rb:64
        each at org/jruby/RubyArray.java:1613
     package at /Users/bassnode/.rvm/gems/jruby-1.7.3/gems/shoes-4.0.0.pre1/lib/shoes/cli.rb:62
         run at /Users/bassnode/.rvm/gems/jruby-1.7.3/gems/shoes-4.0.0.pre1/lib/shoes/cli.rb:85
      (root) at -e:1

@PragTob
Copy link
Member

PragTob commented Mar 2, 2013

Hi there, I think you can find help with this comment or in the thread... it should definitely be pointed out more :-) Basically I believe you have to adjust the app.yml, the default one doesn't work on its own!

Cheers,
Tobi

@davorb
Copy link
Member

davorb commented Mar 2, 2013

We need to move that to the wiki.

@bassnode
Copy link

bassnode commented Mar 3, 2013

@PragTob I changed the run directive and copied over the Shoes.icns and it worked. Initially, I removed the whole icons section of the yaml file but the app packaging process failed...so I can assume (w/o looking at the source) that an icon is required. As a fix, maybe the gem could load the icon it ships with when the current app doesn't have one. Or just not require one :)
I'll try to make a pull request for that at some point.

@wasnotrice
Copy link
Member

@bassnode this should definitely be fixed as you describe. Packaging need to be robust, and to work with zero user configuration. I'm halfway through extracting packaging into another gem. That's why I'm so slow on this :(

@bassnode
Copy link

bassnode commented Mar 4, 2013

ok, then I'll wait to see how that gem turns out before submitting any pull
requests.
On Mar 3, 2013 11:56 AM, "Eric Watson" notifications@github.com wrote:

@bassnode https://github.com/bassnode this should definitely be fixed
as you describe. Packaging need to be robust, and to work with zero user
configuration. I'm halfway through extracting packaging into another gem.
That's why I'm so slow on this :(


Reply to this email directly or view it on GitHubhttps://github.com//issues/137#issuecomment-14353665
.

@wasnotrice
Copy link
Member

@bassnode see #212 for an update on extracting packaging. Once that's squared away, I'll hit this.

@PragTob
Copy link
Member

PragTob commented Sep 28, 2014

Packaging is in the README and stuff, guess we don't need this anymore. Let me know if you disagree - if there are leftover issues that don't have an open issue please open one :-)

Thanks!

@PragTob PragTob closed this as completed Sep 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants