Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gem::Specification should allow to specify source code repository/location #1007

Closed
fwolfst opened this Issue Sep 8, 2014 · 5 comments

Comments

3 participants
@fwolfst
Copy link

fwolfst commented Sep 8, 2014

Hi,

I would find it handy if "Source Code" link on rubygems.org would not have to be populated by hand for each gem, but instead be read from the Specification (https://github.com/rubygems/rubygems/blob/master/lib/rubygems/specification.rb).

It might look like:

    Gem::Specification.new do |spec|
      spec.name = "mygem"
      # ...
      spec.source_code_link = "https://github.com/fwolfste/magento_remote" # or wherever it is
      # ...
    end

This would ease e.g. forking and inspecting existing code. When gem owners do not populate this field on rubygems, potential contributors have only access to the installed version of the code (e.g. in .gems/)or search the web and hope to find the right project.

@drbrain

This comment has been minimized.

Copy link
Member

drbrain commented Sep 8, 2014

RubyGems allows this through metadata.

if you want to make this automatic you should:

  1. Figure out a good key
  2. Submit a patch to rubygems/rubygems.org to use the appropriate metadata key when new gems are pushed.

@drbrain drbrain closed this Sep 8, 2014

@drbrain drbrain added this to the 2.5 milestone Sep 8, 2014

@fwolfst

This comment has been minimized.

Copy link
Author

fwolfst commented Sep 9, 2014

Thanks @drbrain for these instructions.

This sounds as it would then be guaranteed to get this functionality :)
Honestly, from a (your?) view as a maintainer, does this feature makes sense? I would love to see it and do understand your implementation recipe, but I won't start coding if chances for the patches to be accepted are low.

@fwolfst

This comment has been minimized.

Copy link
Author

fwolfst commented Sep 9, 2014

The patch might probably simply go against https://github.com/rubygems/rubygems.org/blob/master/app/models/linkset.rb#L15
Without deep diving, my first try would be this:

def update_attributes_from_gem_specification!(spec)
  self.update_attributes!(:home => spec.homepage,
    # Fetch "Source Code" link from metadata/repository_url
     :code => spec.metadata[:repository_url])
end
@drbrain

This comment has been minimized.

Copy link
Member

drbrain commented Sep 9, 2014

I'm not familiar with the rubygems.org source code, submitting a pull request with this change and a test will get a review, though.

@fwolfst

This comment has been minimized.

Copy link
Author

fwolfst commented Sep 10, 2014

Follow up in rubygems/rubygems.org#718 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.