[rubydetroit] branding my own clone of a gem

7 views
Skip to first unread message

Larry Siden

unread,
May 5, 2010, 11:49:17 PM5/5/10
to rubyd...@googlegroups.com, a2...@googlegroups.com
I forked a repository from GitHub with a gem that I had to make a custom mod to.  When I install that gem, it bumps the version number, so that when I do "gem list x" it says "gem.1.0.99" (for example), but I want it to say "gem 1.0.99-lsiden" so that when the maintainers release a new version with rev 99, I will not confuse it with my own.  What do I have to modify in the Rakefile to get this to work?

I tried this: http://pastie.org/947896, but it didn't take.

Should I just rename the gem to something like "x-lsiden" so that I can distinguish it as my own when I run "gem list"?  Is there a best or common practice for this use-case?


Larry Siden, 734-926-9614, http://umich.edu/~lsiden

The United States is a nation of laws - badly written and randomly enforced.
--Frank Zappa 1940-1993

--
You received this message because you are subscribed to the Google
Groups "Detroit.rb" group.
To post to this group, send email to rubyd...@googlegroups.com
To unsubscribe from this group, send email to
rubydetroit...@googlegroups.com

Daniel Parker

unread,
May 6, 2010, 9:14:02 AM5/6/10
to rubyd...@googlegroups.com, a2...@googlegroups.com
Larry, what you want to do is actually change the name of the gem itself. Probably prepend your name: lsiden-gemname. You'll have to change that name in the Rakefile, then when you build the gem (using rake) it should create the appropriate filename as well. I would also advise that you append an extra ".1" to the end of the version number so it is obvious that the version has been slightly modified.

- daniel parker -

"You have granted me life and steadfast love, and your care has preserved my spirit." Job 10:12
"The LORD is my chosen portion and my cup . . . indeed, I have a beautiful inheritance." Psalm 16:5-6
"Give what you can ... take nothing back!"

Brandon Dimcheff

unread,
May 6, 2010, 12:14:54 AM5/6/10
to rubyd...@googlegroups.com
Yeah, change the name in the gemspec, register the gem on gemcutter, and then push your custom gem. [username]-[gemname] seems to be a common idiom. Then you can use that in your Gemfile or whatever and you'll always get yours.

- brandon

Larry Siden

unread,
May 6, 2010, 10:17:21 PM5/6/10
to rubyd...@googlegroups.com
Not sure where to add the .1.  There is a major-version, minor-version, and package #.  I think they need to be proper integers so that they can be easily bumped by the script.  Also, until they install my patch, I'm going to have to keep rebase-ing my little fix with their updates in order to stay up-to-date, so the current system lsiden-xxx-1.0.yyyy will always tell me where I'm at.  But thanks!

Larry Siden, 734-926-9614, http://umich.edu/~lsiden

The United States is a nation of laws - badly written and randomly enforced.
--Frank Zappa 1940-1993


Larry Siden

unread,
May 7, 2010, 12:18:21 AM5/7/10
to rubyd...@googlegroups.com
I changed "rack" to "lsiden-rack" on line 31 of the Rakefile, http://pastie.org/949575 but it still generates a file named "rack-1.1.0.gem".  Here's a few lines of output, where it should be "lsiden-rack-..." instead of "rack-..." despite my mod to the Rakefile on line 31:

git archive --format=tar --prefix=rack-1.1.0/ HEAD^{tree} >rack-1.1.0.tar
pax -waf rack-1.1.0.tar -s ':^:rack-1.1.0/:' SPEC ChangeLog doc rack.gemspec
gzip -f -9 rack-1.1.0.tar

then a bit later,

mv stage/lsiden-rack-1.1.0.tar.gz stage/lsiden-rack-1.1.0.gem .
mv: cannot stat `stage/lsiden-rack-1.1.0.tar.gz': No such file or directory
mv: cannot stat `stage/lsiden-rack-1.1.0.gem': No such file or directory

Even worse, when I install it without the name changes, "rvm 1.9 gem install rack-1.1.0.gem", my change to lib/rack/chunked.rb doesn't appear in the actual installed gem, as if gem is re-installing rack from the web despite the command line argument!  I took care to uninstall rack, before re-installing it from this custom package, and also tried "gem install -l" and "gem install -i .".

What's even weirder, the installed gem does have a change I submitted that the maintainer added to the HEAD (way past the latest release), but doesn't have another change I made locally before building with ("rake officialrelease").  But both the change in HEAD is not part of the official release so it could have only come from my local hard drive where I cloned it.

Obviously, I'm missing something big time here.  Should I be posting this on the Rack forum or is this something really generic that I'm missing b/c I'm still a Ruby-newbie?

Larry Siden, 734-926-9614, http://umich.edu/~lsiden

The United States is a nation of laws - badly written and randomly enforced.
--Frank Zappa 1940-1993


On Thu, May 6, 2010 at 9:14 AM, Daniel Parker <dcpa...@gmail.com> wrote:

Larry Siden

unread,
May 7, 2010, 12:54:33 AM5/7/10
to rubyd...@googlegroups.com
Update: I got "rake officialrelease; gem install ..." to work.  I had to delete the .gem, .tar.gz , and staging/ dir (basically, everything that isn't tracked by Git).  For some reason, these files weren't getting re-built.  Unlike another gem I use, Rack has no "clean" task in the Rakefile so you have to do your own cleaning! 

Larry Siden, 734-926-9614, http://umich.edu/~lsiden

The United States is a nation of laws - badly written and randomly enforced.
--Frank Zappa 1940-1993


Larry Siden

unread,
May 7, 2010, 9:39:48 AM5/7/10
to Daniel Parker, rubyd...@googlegroups.com, a2...@googlegroups.com
FYI, Added this issue w/ fix to Rack http://github.com/rack/rack/issues/issue/21, and this w/ fix to Sproutcore, http://github.com/sproutit/sproutcore-abbot/issues/issue/4.

If you respond, please remember to remove from the addr field whatever list you may not be subscribed to so that your message does not bounce.

Larry Siden, 734-926-9614, http://umich.edu/~lsiden

The United States is a nation of laws - badly written and randomly enforced.
--Frank Zappa 1940-1993


On Fri, May 7, 2010 at 8:50 AM, Larry Siden <lsi...@gmail.com> wrote:
For sproutcore, no problem.  sproutcore sits at the top of the food-chain (inversely), which means that while it depends on many other gems, no gems are dependent on it.  So rebranding it to lsiden-sproutcore was easy.  It installs some scripts, like sc-server that require '../lib/...' so no changes to the scripts are necessary - they use relative paths.

But rebranding rack might be a different story, and in any case, I want to get the maintainer to accept my latest patch (a simple one-liner) into the HEAD so that I don't have to go through such hoops.  It's already a pain that I have to remember to run git fetch, git rebase, delete all the cruft and rebuild and "gem install ...pkg" instead of just "gem install rack" whenever I want to update it.

I think the only reason he didn't apply my latest patch is that I forgot to post it on the Issues Wiki in Github.  I'll do that in a few minutes.

I'm trying to get everything in order to deploy it on Heroku.  Daniel, can you tell me how I can easily generate a list of all the package dependencies.  $" gives me all the modules loaded, but I really just want all the packages required.

Larry Siden, 734-926-9614, http://umich.edu/~lsiden

The United States is a nation of laws - badly written and randomly enforced.
--Frank Zappa 1940-1993


On Fri, May 7, 2010 at 6:06 AM, Daniel Parker <dcpa...@gmail.com> wrote:
By the way, I've done it too. :)


On May 6, 2010, at 10:14 PM, Larry Siden <lsi...@gmail.com> wrote:

Thanks for advise on querying multiple lists.  I hadn't thought about that.

Larry Siden, 734-926-9614, http://umich.edu/~lsiden

The United States is a nation of laws - badly written and randomly enforced.
--Frank Zappa 1940-1993


On Thu, May 6, 2010 at 9:29 AM, Daniel Parker <dcpa...@gmail.com> wrote:
And Larry, don't email two groups in the same email. Use two separate emails if you really feel the need to ask two groups at the same time. When anyone graciously replies to you, if they aren't in both groups, they get a Mail Delivery Failure email back from the group(s) they aren't a member of. Of course you don't want to cause that. :)

- daniel parker -


On Wed, May 5, 2010 at 11:49 PM, Larry Siden <lsi...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages