Contributing to a gem on github

J

Josh Cheek

[Note: parts of this message were removed to make it a legal post.]

Hi, there is a gem I want to use (bones-extras), but the part I want to use
doesn't work on 1.9.2 since they removed "." from the path (extremely
irritating, btw).

On my system, I can fix it, by editing the source to add "." to the
beginning of the file path, but that doesn't help anyone else, and it
doesn't help me later if I try to work on my project on a different
computer.

I figure this is a good opportunity to help an open source project, but I'm
not sure what to do. I know that I fork it on github, clone my fork, make
the change, push it back up, then send a pull request. But is there a blog
or anything that talks about the extra stuff? Do I change the version? How
do I word my commit? Are there any expectations of me that I should take
care to observe? How long do I keep my fork?

I want to contribute to other projects out, but the process seems
undocumented, and I'm unsure of my obligations / expectations.
 
E

elise huard

Hi, there is a gem I want to use (bones-extras), but the part I want to use
doesn't work on 1.9.2 since they removed "." from the path (extremely
irritating, btw).

On my system, I can fix it, by editing the source to add "." to the
beginning of the file path, but that doesn't help anyone else, and it
doesn't help me later if I try to work on my project on a different
computer.

I figure this is a good opportunity to help an open source project, but I'm
not sure what to do. I know that I fork it on github, clone my fork, make
the change, push it back up, then send a pull request. But is there a blog
or anything that talks about the extra stuff? Do I change the version? How
do I word my commit? Are there any expectations of me that I should take
care to observe? How long do I keep my fork?

I want to contribute to other projects out, but the process seems
undocumented, and I'm unsure of my obligations / expectations.

out of curiosity (google won't tell me, and probably missed that
particular discussion on teh mailing list): why was '.' removed from
the load path ?

as to the above question, my guess would be:
add
$: << "."
where relevant. There might be a more elegant way, though.
 
E

elise huard

or rather, require all the necessary files from the one loaded when
you load the gem.

 
J

Josh Cheek

[Note: parts of this message were removed to make it a legal post.]

out of curiosity (google won't tell me, and probably missed that
particular discussion on teh mailing list): why was '.' removed from
the load path ?

as to the above question, my guess would be:
add
$: << "."
where relevant. There might be a more elegant way, though.
Thanks, Elise. I had tried placing that at the top of my Rakefile, and it
did not work. It is unclear to me why not. The best ideas I can come up with
are that $: might be a "local global" like Regexp matches, or that rake
somehow knows to load bones-extras before it looks at my Rakefile.


or rather, require all the necessary files from the one loaded when
you load the gem.

Yes, I have a workaround similar to this that I am using. But as I said
above, it doesn't help anyone else, and this seems like a good opportunity
to learn how to contribute to OSS.
 
K

Klaus Stein

Josh Cheek said:
Hi, there is a gem I want to use (bones-extras), but the part I want to use
doesn't work on 1.9.2 since they removed "." from the path (extremely
irritating, btw).

On my system, I can fix it, by editing the source to add "." to the
beginning of the file path, [...]

You should _not_ use this fix, at least not for a public gem (as you are not
only responsible for your own system). There are (security) issues with
having the current directory in the load path and . is removed with intent.

Use require_relative or something similar to fix the gem.

I appreciate that you want to help the community, go on with that.

Klaus
 
J

Josh Cheek

[Note: parts of this message were removed to make it a legal post.]

Josh Cheek said:
Hi, there is a gem I want to use (bones-extras), but the part I want to use
doesn't work on 1.9.2 since they removed "." from the path (extremely
irritating, btw).

On my system, I can fix it, by editing the source to add "." to the
beginning of the file path, [...]

You should _not_ use this fix, at least not for a public gem (as you are
not
only responsible for your own system). There are (security) issues with
having the current directory in the load path and . is removed with intent.

Use require_relative or something similar to fix the gem.

I appreciate that you want to help the community, go on with that.

Klaus
The gem I was going to contribute to (bones-extras) has been deprecated, so
this is no longer an issue.

But for the sake of clarity (because this has been messing with my brain for
a while), require_relative requires relative to the current file's dir, not
relative to the working dir, so this would not work. (ruby-doc doesn't have
this listed, so I was never able to find it, but it is in the 1.9 Pickaxe)

In other words require_relative is equivalent to
require File.dirname(__FILE__)+'/file'
And what I am doing is equivalent to
require Dir.pwd + '/file'

So require_relative is not a solution. (nevermind that I was using it in a
FileList)

In fact, I expect that this misunderstanding means there is no problem at
all, so I am going to operate on the assumption that when you want to
require things relative to the working directory, that you _should_ begin
the string with a dot. ie `require './file'` If this is not acceptable, let
me know what is the proper way to do it. And if the reasoning is not
obvious, please explain it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top