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

Create a JSON page per tool #260

Merged
merged 2 commits into from
Jun 10, 2021

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Jun 10, 2021

Fixes #90.

Creates a JSON page per tool.

$ ruby _plugins/create-json-files.rb
$ cat api/python/3.9.json # existing file
{"release":"2020-10-05","eol":"2025-10-05","latest":"3.9.5","link":"https://www.python.org/downloads/release/python-395/"}
$ cat api/python.json # new file
[{"cycle":3.9,"data":{"release":"2020-10-05","eol":"2025-10-05","latest":"3.9.5","link":"https://www.python.org/downloads/release/python-395/"}},{"cycle":3.8,"data":{"release":"2019-10-14","eol":"2024-10-14","latest":"3.8.10","link":"https://www.python.org/downloads/release/python-3810/"}},{"cycle":3.7,"data":{"release":"2018-06-27","eol":"2023-06-27","latest":"3.7.10","link":"https://www.python.org/downloads/release/python-3710/"}},{"cycle":3.6,"data":{"release":"2016-12-23","eol":"2021-12-23","latest":"3.6.13","link":"https://www.python.org/downloads/release/python-3613/"}},{"cycle":3.5,"data":{"release":"2015-09-30","eol":"2020-09-13","latest":"3.5.10","link":"https://www.python.org/downloads/release/python-3510/"}},{"cycle":3.4,"data":{"release":"2014-03-16","eol":"2019-03-18","latest":"3.4.10","link":"https://www.python.org/downloads/release/python-3410/"}},{"cycle":3.3,"data":{"release":"2012-09-29","eol":"2017-09-29","latest":"3.3.7","link":"https://www.python.org/downloads/release/python-337/"}},{"cycle":2.7,"data":{"release":"2010-07-03","eol":"2020-01-01","latest":"2.7.18","link":"https://github.com/python/cpython/blob/2.7/Misc/NEWS.d/2.7.18rc1.rst"}}]

Prettified the JSON looks like this, is this the right sort of format?

[
  {
    "cycle": 3.9,
    "data": {
      "release": "2020-10-05",
      "eol": "2025-10-05",
      "latest": "3.9.5",
      "link": "https://www.python.org/downloads/release/python-395/"
    }
  },
  {
    "cycle": 3.8,
    "data": {
      "release": "2019-10-14",
      "eol": "2024-10-14",
      "latest": "3.8.10",
      "link": "https://www.python.org/downloads/release/python-3810/"
    }
  },
  {
    "cycle": 3.7,
    "data": {
      "release": "2018-06-27",
      "eol": "2023-06-27",
      "latest": "3.7.10",
      "link": "https://www.python.org/downloads/release/python-3710/"
    }
  },
  {
    "cycle": 3.6,
    "data": {
      "release": "2016-12-23",
      "eol": "2021-12-23",
      "latest": "3.6.13",
      "link": "https://www.python.org/downloads/release/python-3613/"
    }
  },
  {
    "cycle": 3.5,
    "data": {
      "release": "2015-09-30",
      "eol": "2020-09-13",
      "latest": "3.5.10",
      "link": "https://www.python.org/downloads/release/python-3510/"
    }
  },
  {
    "cycle": 3.4,
    "data": {
      "release": "2014-03-16",
      "eol": "2019-03-18",
      "latest": "3.4.10",
      "link": "https://www.python.org/downloads/release/python-3410/"
    }
  },
  {
    "cycle": 3.3,
    "data": {
      "release": "2012-09-29",
      "eol": "2017-09-29",
      "latest": "3.3.7",
      "link": "https://www.python.org/downloads/release/python-337/"
    }
  },
  {
    "cycle": 2.7,
    "data": {
      "release": "2010-07-03",
      "eol": "2020-01-01",
      "latest": "2.7.18",
      "link": "https://github.com/python/cpython/blob/2.7/Misc/NEWS.d/2.7.18rc1.rst"
    }
  }
]

@hugovk
Copy link
Member Author

hugovk commented Jun 10, 2021

This was referenced Jun 10, 2021
@captn3m0
Copy link
Member

Thanks a lot, this looks neat. How about flattening the data object?

Something like:

[{
  "cycle": 3.9,
  "release": "2020-10-05",
  "eol": "2025-10-05",
  "latest": "3.9.5",
  "link": "https://www.python.org/downloads/release/python-395/"
},{...}]

@hugovk
Copy link
Member Author

hugovk commented Jun 10, 2021

Good idea, updated:

https://deploy-preview-260--endoflife-date.netlify.app/api/python.json

[
  {
    "cycle": 3.9,
    "release": "2020-10-05",
    "eol": "2025-10-05",
    "latest": "3.9.5",
    "link": "https://www.python.org/downloads/release/python-395/"
  },
  {
    "cycle": 3.8,
    "release": "2019-10-14",
    "eol": "2024-10-14",
    "latest": "3.8.10",
    "link": "https://www.python.org/downloads/release/python-3810/"
  },
  {
    "cycle": 3.7,
    "release": "2018-06-27",
    "eol": "2023-06-27",
    "latest": "3.7.10",
    "link": "https://www.python.org/downloads/release/python-3710/"
  },
  {
    "cycle": 3.6,
    "release": "2016-12-23",
    "eol": "2021-12-23",
    "latest": "3.6.13",
    "link": "https://www.python.org/downloads/release/python-3613/"
  },
  {
    "cycle": 3.5,
    "release": "2015-09-30",
    "eol": "2020-09-13",
    "latest": "3.5.10",
    "link": "https://www.python.org/downloads/release/python-3510/"
  },
  {
    "cycle": 3.4,
    "release": "2014-03-16",
    "eol": "2019-03-18",
    "latest": "3.4.10",
    "link": "https://www.python.org/downloads/release/python-3410/"
  },
  {
    "cycle": 3.3,
    "release": "2012-09-29",
    "eol": "2017-09-29",
    "latest": "3.3.7",
    "link": "https://www.python.org/downloads/release/python-337/"
  },
  {
    "cycle": 2.7,
    "release": "2010-07-03",
    "eol": "2020-01-01",
    "latest": "2.7.18",
    "link": "https://github.com/python/cpython/blob/2.7/Misc/NEWS.d/2.7.18rc1.rst"
  }
]

@captn3m0
Copy link
Member

Validated against a few more tools, and everything looks good. Thanks a lot 🥇, merging.

@captn3m0 captn3m0 merged commit 80ff641 into endoflife-date:master Jun 10, 2021
@captn3m0
Copy link
Member

I also made the API available over CORS (#261), so there's more scope for experiments.

@captn3m0 captn3m0 mentioned this pull request Jun 10, 2021
2 tasks
@hugovk hugovk deleted the json-page-per-tool branch June 10, 2021 20:22
@marcwrobel marcwrobel added the api Changes that relates to API label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Changes that relates to API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON API urls for collections
3 participants