{"id":22753220,"url":"https://github.com/nebulab/backport","last_synced_at":"2025-03-30T07:18:15.995Z","repository":{"id":141428459,"uuid":"152735289","full_name":"nebulab/backport","owner":"nebulab","description":"Manage your backported code with ease.","archived":false,"fork":false,"pushed_at":"2019-01-17T09:43:43.000Z","size":26,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-05T09:34:11.513Z","etag":null,"topics":["backport","deprecation","notice","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nebulab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-12T10:36:19.000Z","updated_at":"2019-01-17T09:43:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac843a82-bf3d-4108-ad36-0f4b815fdc4f","html_url":"https://github.com/nebulab/backport","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebulab%2Fbackport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebulab%2Fbackport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebulab%2Fbackport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nebulab%2Fbackport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nebulab","download_url":"https://codeload.github.com/nebulab/backport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285817,"owners_count":20752958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backport","deprecation","notice","ruby"],"created_at":"2024-12-11T06:09:39.317Z","updated_at":"2025-03-30T07:18:15.986Z","avatar_url":"https://github.com/nebulab.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backport\n\n[![Build Status](https://travis-ci.org/nebulab/backport.svg?branch=master)](https://travis-ci.org/nebulab/backport)\n[![Coverage Status](https://coveralls.io/repos/github/nebulab/backport/badge.svg?branch=master)](https://coveralls.io/github/nebulab/backport?branch=master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/c5705b7ed58864609452/maintainability)](https://codeclimate.com/github/nebulab/backport/maintainability)\n\nBackport helps you manage backported code with ease.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'backport'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install backport\n\n## Usage\n\nBackport is used by registering checks and creating notices (which are only displayed if a certain \ncheck returns true). A check can be either _static_ (when its result is defined when the check\nis defined) or _dynamic_ (when its result is computed every time a notice is defined). \n\nThe following examples illustrates both types of checks:\n\n```ruby\n# This is a dynamic check: it accepts an argument and determines\n# whether the Rails' version is greater than or equal to the argument. \nBackport.register_check(:rails_version_gte) do |version|\n  Rails.gem_version \u003e Gem::Version.new(version)\nend\n\n# You can also define dynamic checks by passing a proc as the\n# second argument to register_check.\nBackport.register_check(\n  :rails_version_gte, \n  -\u003e (version) { Rails.gem_version \u003e Gem::Version.new(version) }\n)\n\n# This is a static check: its value is defined when the check is defined.\nBackport.register_check(:rails5, Rails.gem_version \u003e= Gem::Version.new('5.0.0')) \n```\n\nAnd this is how you use both types of checks:\n\n```ruby\ndef my_method\n  Backport.notify('This method is not needed in Rails 5', :rails5)\n\n  # ...\nend\n\ndef my_other_method\n  Backport.notify('This method is not needed since Rails 5.1', :rails_version_gte, '5.1.0')\n\n  # ...\nend\n```\n\nYou can also use `#notify!` instead of `#notify` if you want to raise an exception rather than\nusing ActiveSupport's default deprecation behavior.\n\n### RSpec integration\n\nBackport also allows you to deprecate RSpec blocks, which is very useful when you backport both a\npiece of code _and_ its tests.\n\nTo enable the RSpec integration, add the following to your `spec_helper.rb` (after requiring RSpec):\n\n```ruby\nrequire 'backport/rspec'\n```\n\nNow, you can do this:\n\n```ruby\nRSpec.describe BackportedClass, backport: [\n  'This test is not needed as of 2.0', \n  :backported_library_gte, \n  '2.0'\n] do\n  it 'some test here' do\n    # ...\n  end\nend\n```\n\nIf the `backported_library_gte` check with `2.0` as its argument returns `true`, an\n`ActiveSupport::DeprecationException` will be raised and the test will fail.\n\nNote that the `backport` tag accepts the same exact arguments as the `#notify` method.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run \nthe tests. You can also run `bin/console` for an interactive prompt that will allow you to \nexperiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new \nversion, update the version number in `version.rb`, and then run `bundle exec rake release`, which \nwill create a git tag for the version, push git commits and tags, and push the `.gem` file to \n[rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/nebulab/backport. This \nproject is intended to be a safe, welcoming space for collaboration, and contributors are expected \nto adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Backport project’s codebases, issue trackers, chat rooms and mailing \nlists is expected to follow the [code of conduct](https://github.com/nebulab/backport/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnebulab%2Fbackport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnebulab%2Fbackport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnebulab%2Fbackport/lists"}