Giter VIP home page Giter VIP logo

end_of_life's Introduction

End of Life

This gem lists GitHub repositories using end-of-life Ruby versions.

End of Life Demo

Installation

gem install end_of_life

Usage

  1. Set up a GitHub access token (we recommend using a read-only token);
  1. Export the GITHUB_TOKEN environment variable or set it when calling end_of_life;

  2. Use the end_of_life command to list the repositories:

$ GITHUB_TOKEN=something end_of_life # if your platform supports symlinks, you can use the `eol` command instead
[✔] Fetching repositories...
[✔] Searching for EOL Ruby in repositories...

Found 2 repositories using EOL Ruby (<= 2.7.8):
┌───┬──────────────────────────────────────────────┬──────────────┐
│   │ Repository                                   │ Ruby version │
├───┼──────────────────────────────────────────────┼──────────────┤
│ 1 │ https://github.com/MatheusRich/my_rails_app  │ 2.5.8        │
│ 2 │ https://github.com/MatheusRich/some_repo     │ 2.5.0        │
└───┴──────────────────────────────────────────────┴──────────────┘

Options

There are some options to help you filter down the results:

Usage: end_of_life [options]
        --exclude=NAME,NAME2           Exclude repositories containing a certain word in its name. You can specify up to five words.
        --public-only                  Searches only public repostories
        --private-only                 Searches only private repostories
        --repo, --repository=USER/REPO Searches a specific repostory
        --org, --organization=ORG,ORG2 Searches within specific organizations
    -u, --user=NAME                    Sets the user used on the repository search
        --max-eol-days-away NUMBER     Sets the maximum number of days away a version can be from EOL. It defaults to 0.
        --include-archived             Includes archived repositories on the search
    -v, --version                      Displays end_of_life version
    -h, --help                         Displays this help

How it works

This gem fetches all your GitHub repositories that contain Ruby code, then searches for files that may have a Ruby version. Currently, those files are: .ruby-version, Gemfile, Gemfile.lock, and .tool-version. We parse these files and extract the minimum Ruby version used in the repository.

The EOL Ruby version is provided by https://endoflife.date/, with a file fallback.

IMPORTANT: To parse Gemfiles, we need to execute the code inside it. Be careful because this may be a security risk. We plan to add a secure parser for Gemfiles in the future.

Some other limitations are listed on the issues page.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/MatheusRich/end_of_life.

License

The gem is available as open source under the terms of the MIT License.

end_of_life's People

Contributors

colindean avatar dependabot[bot] avatar duncan-bayne avatar matheusrich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

end_of_life's Issues

Make HTTP requests in parallel

When we fetch files from a repo, we (currently) make 4 sequential HTTP requests (for each repo!). This is not ideal since it's a blocking operation. Can we leverage async Ruby to make at least the file fetching requests in parallel?

fetch_file(".ruby-version"),
fetch_file("Gemfile"),
fetch_file("Gemfile.lock"),
fetch_file(".tool-versions")

Provide a Docker image and instructions how to use it

I don't do much Ruby these days but I've got a whole lot of projects I built 2010-2019 that use "the Ruby version as of the day I started" for the most part and I've only upgraded when necessary. Bad maintainer or busy maintainer, I don't know.

I'd love to be able to do

docker run --rm -it -e GITHUB_TOKEN="${GITHUB_TOKEN}" matheusrich/end_of_life:latest

and get a report. That could even turn into a cronjob on my containers server or a GitHub Action or something.

Allow running in the context of CI for a particular repo

This is a lovely idea, but where I would particularly like to know about EOL Ruby versions is in my CI pipeline for new builds of a repo. Ideally, I could have a configuration file that specifies how far away from EOL I am willing to allow my repo to be, and then the CI action fails my build if it is run too close to the EOL.

Since you already of the code for finding the min Ruby version for a repo, this feels like a possible extension of this gem. Alternatively, I could imagine forking and creating a different gem focused on this use-case. What are your thoughts?

Support more tools

Currently, we only support Ruby, but it's feasible to support more languages and libraries (like Rails).

List "almost" EOL repos

If the language is not EOL, but it'll be in the next three months, we could flag it as well. I'm not sure how the output should look, tho.

Support GitLab as well as GitHub

I have a number of projects in GitLab; it'd be nice to be able to run end_of_life against those projects as well.

I imagine that introducing this would mostly be a matter of introducing an abstraction (Foundry?) around the Oktokit library that the Repository class could use.

One could then build integrations with GitLab and possibly other foundries like sourcehut.

Allow skipping archived repos

I don't know if it's possible to filter these repos via the API serach, though.

Note: it looks like it's possible to exclude archived repos with archived:{false,true}

We can provide this feature via a CLI option like --skip-archives

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.