got stuck and cann't find appropriate guide how can I patch gem package
before it gets installed.
For example I'm trying to fix gem for Gosu library:
1. download the gem with "gem fetch gosu"
2. extract contents of the gem with "gem unpack gosu-0.7.45.gem"
3. apply a patch: cd gosu-0.7.45 && patch -p1
/path/to/patch/fix_cflags.patch
4. ??? how to rebuild a gem from modified sources ? I cann't find the
original gemspec.
5. ??? install modified gem with gem install ./gosu-0.7.45.gem
got stuck and cann't find appropriate guide how can I patch gem package
before it gets installed.
For example I'm trying to fix gem for Gosu library:
1. download the gem with "gem fetch gosu"
2. extract contents of the gem with "gem unpack gosu-0.7.45.gem"
3. apply a patch: cd gosu-0.7.45 && patch -p1
/path/to/patch/fix_cflags.patch
4. ??? how to rebuild a gem from modified sources ? I cann't find the
original gemspec.
5. ??? install modified gem with gem install ./gosu-0.7.45.gem
Why not just clone/fork it from GitHub, apply your patch and commit it,
then use bundler to install the gem using the :git => syntax?
gem 'gosu', :git => 'git://github.com/yourname/gosu.git' , or
gem 'gosu', :git => '/myproject/src/gosu.git' (if it's on your hard
drive)
I'm a bit for a Ruby noob but have modified gems this way myself several
times, very easy. Gosu has native code in C++ so not sure if that affects
it. If the above syntax fails, you can try running the Rakefile included in
the source to build the gem package locally.
- Jeff
···
On Sat, Sep 8, 2012 at 12:25 AM, David Unric <lists@ruby-forum.com> wrote:
Hi,
got stuck and cann't find appropriate guide how can I patch gem package
before it gets installed.
For example I'm trying to fix gem for Gosu library:
1. download the gem with "gem fetch gosu"
2. extract contents of the gem with "gem unpack gosu-0.7.45.gem"
3. apply a patch: cd gosu-0.7.45 && patch -p1
/path/to/patch/fix_cflags.patch
4. ??? how to rebuild a gem from modified sources ? I cann't find the
original gemspec.
5. ??? install modified gem with gem install ./gosu-0.7.45.gem
In this case is in github, so you can clone and even fork and do a
pull request to request your changes be in the next version for gosu.
regards
jordi
Ok, I can use the git sources and maybe install the libs with rake, but
still curious how to modify & rebuild the gem. I thought it has to be a
simple task.
4. ??? how to rebuild a gem from modified sources ? I cann't find the
original gemspec.
Doesn't `gem build` work for you?
gem unpack --spec
Will retrieve the original gem spec from the gem. If you've added new files you will need to update the gemspec.
Move this file into the unpacked gem directory then run `gem build`
5. ??? install modified gem with gem install ./gosu-0.7.45.gem
`gem install gosu --local`.
Also, .gem files are just ZIP archives, you can unpack them with any
archiver and modify the contents.
.gem files are tar files which contain (at least) a gzipped YAML file (metadata.gz, the gem spec) and a data.tar.gz (A gzipped tar file). Tools that only handle zip will not unpack them.
···
On Sep 7, 2012, at 10:21 AM, Bartosz Dziewoński <matma.rex@gmail.com> wrote:
For Gosu, because it has native extension, use the included Rakefile to
build the gem package.
- Jeff
···
On Sat, Sep 8, 2012 at 1:14 AM, David Unric <lists@ruby-forum.com> wrote:
Jordi Massaguer Pla wrote in post #1075065:
> I think you better look for the source code. Gosu is in
> https://github.com/jlnr/gosu . You can find the link for the source
> code in rubygems.org.
>
> In this case is in github, so you can clone and even fork and do a
> pull request to request your changes be in the next version for gosu.
>
> regards
>
> jordi
Ok, I can use the git sources and maybe install the libs with rake, but
still curious how to modify & rebuild the gem. I thought it has to be a
simple task.
4. ??? how to rebuild a gem from modified sources ? I cann't find the
original gemspec.
Doesn't `gem build` work for you?
gem unpack --spec
I did missed this option. THAT's the answer. Thank you.
Will retrieve the original gem spec from the gem. If you've added new
files you will need to update the gemspec.
Move this file into the unpacked gem directory then run `gem build`
5. ??? install modified gem with gem install ./gosu-0.7.45.gem
`gem install gosu --local`.
Also, .gem files are just ZIP archives, you can unpack them with any
archiver and modify the contents.
.gem files are tar files which contain (at least) a gzipped YAML file
(metadata.gz, the gem spec) and a data.tar.gz (A gzipped tar file).
Tools that only handle zip will not unpack them.
Correct. In addition all files stored in gem (tar) archive and
subarchive data.tar.gz have time set to 1.1.1970.
···
On Sep 7, 2012, at 10:21 AM, Bartosz Dziewoński <matma.rex@gmail.com> > wrote:
On Sep 7, 2012, at 10:21 AM, Bartosz Dziewoński <matma.rex@gmail.com> wrote:
Also, .gem files are just ZIP archives, you can unpack them with any
archiver and modify the contents.
.gem files are tar files which contain (at least) a gzipped YAML file (metadata.gz, the gem spec) and a data.tar.gz (A gzipped tar file). Tools that only handle zip will not unpack them.
Ok, I can use the git sources and maybe install the libs with rake, but
still curious how to modify & rebuild the gem. I thought it has to be a
simple task.