Era-Dorta / gosu-android

A Gosu implementation for Android devices, undergraduate project
MIT License
31 stars 2 forks source link

Package gosu-android as a RubyGem #7

Open donv opened 11 years ago

Era-Dorta commented 11 years ago

I've just pushed a first build to https://rubygems.org/gems/gosu_android. It is the first one I've ever done but I hope it does not have any bugs.

donv commented 11 years ago

What I had in mind was not a generator, but a library type gem that lets game developers include gosu in their app using the Gemfile.apk file to create a libs/bundle.jar.

I can make a pull request, if you like.

donv commented 11 years ago

Actually, the gem works well already except that it depends on ruboto. If you remove the dependency on the ruboto gem, game developers can use the gosu_android gem by creating a Gemfile.apk like this:

source 'https://rubygems.org/'

gem 'gosu_android'

The files in lib will the be included in the Ruboto app, and the Java classes will be in the classpath. The gems are packaged in libs/bundle.jar. You only need the require statement:

require 'gosu_android'
Era-Dorta commented 11 years ago

First, thank you so much for contributing to gosu_android :-) About your comments, I didn't quite understand you, Should I simple remove the dependency on ruboto? Or should I do something else?

donv commented 11 years ago

I included the change in the pull request you merged. The gem should be good to go. You can remove the bin/gosu_android binary and the generator logic unless you want to offer this as a separate option.

donv commented 11 years ago

Sorry! I see now that I didn't include that change in the pull request. Yes, you should remove the dependency on ruboto from the gem.

Era-Dorta commented 11 years ago

I removed the ruboto dependency and I pushed a new version to rubygems. Then I tried to test if it worked using the Gemfile.apk. But it fails because the resources files are not included/copied, again I have never used bundler and after looking at their documentation I am left with no idea about what to do.

donv commented 11 years ago

The resource files are just part of the examples, and regular use of gosu-android should add their own resources, right? It seems wrong to insert the example resources in every app that uses gosu-android.

Only the contents of the "lib" directory is included in the app when using Gemfile.apk, so you could keep the generator in "bin" and use files outside of "lib".

donv commented 11 years ago

You could have two gems: One "core" like gem with the app code and jar, and one generator gem.

Era-Dorta commented 11 years ago

Right now gosu_android uses one res file to draw fonts, so I think I'll go with the two gems approach. Thanks for the advice :+1:

donv commented 11 years ago

Could you release a new version of the gem? I am writing a tutorial in the Ruboto WIKI and it would be great if I could use require 'gosu' instead of require 'gosh_android' since that is used in the examples.

Could you release the gem as a regular gem instead of a pre-release gem? For example 0.0.5 ?

When you include an aplhabetic part in the version name, it is considered a pre-release, and it is not installed to users unless they explicitly specify that they wish pre-releases. I included the ".dev" part in the version in my pull request to indicate that it was work in progress. This is very common so that developers can see that a gem is built from non-tagged non-released source. It is common to remove the ".dev" part just before release to RubyGems, and then add it back until the next release.

donv commented 11 years ago

The tutorial is here: https://github.com/ruboto/ruboto/wiki/Tutorial:-write-a-gosu-game

ashes999 commented 11 years ago

@donv works on my machine. But shouldn't you need to run gosu_android -a to copy the JAR over to your Ruboto application?

donv commented 11 years ago

The jar file is automatically included in your app in the libs/bundle.jar file since the jar file is in the lib directory of the gosu_android gem.

ashes999 commented 11 years ago

Oh nice, I didn't know that. I'll update the gosu_android docs.

Era-Dorta commented 11 years ago

Version 0.0.4 pushed :-) , Sorry it took so long, but gem push was throwing some weird http 405 errors.