I contributed on rails

Not really? Well, I contributed on rails/spring. It is gem which rails app use to preload its files so that every time you run rails console or tests, you don’t have to wait until all the files are loaded. I have never worked with threads before, but again everything has a first. In fact, it is also the first  gem repository whose code I have read end to end. I have contributed on other gems but I just read the class or module I was working on.

Michael Grosser (@grosser) was really helpful and prompt with review of my PRs. Both of my PRs has gone through a lot of scrutiny, still I am happy that atleast one of them is merged. While reading the gem, I realized that rails had kept my exposure limited. In rails one doesn’t have to deal with attr_accesible, require, dependencies etc. You can be as sloppy as want and still everything will work.
Even after all the scrutiny, my PR managed to break the gem functionality. Have you ever used Bundler.setup? $LOAD_PATH? A few more things which you would probably never use on a normal rails app. Apparently `require bundler/setup` is extensively used in gems. It checks your gemfile and overrides the $LOAD_PATH with things it found there.
This is why I feel overwhelmed all the time. I am always afraid that I will break something, that I don’t know what I am doing. I start feeling that Michael and Jon must be think that I am idiot and I am wasting their time. Time they spent reviewing my PR, they could probably made the change themselves. Least I can do is be thankful to them for putting up with me.

When people say that you should read others code, they are right. You get to learn about different coding styles and many other cool things. For example, I found out that ActiveSupport has this `strip_heredoc` method which I could have used when I was testing markdown on glittergallery. I had just written a lot of plus (rubocop, max-LineLength: 80) and a lot of `\n`.

File.write(path_to_file.rb, <<-RUBY.strip_heredoc)
    class Foo
        def self.omg
            raise "omg"
        end
    end
RUBY

Above code will write content between <<-RUBY… RUBY in file you mentioned in well-formatted manner.

 

Advertisements
I contributed on rails

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s