|
3 | 3 | # @title README
|
4 | 4 | -->
|
5 | 5 |
|
6 |
| -# The Git Gem |
| 6 | +# The `git` Gem |
7 | 7 |
|
8 |
| -The Git Gem provides an API that can be used to create, read, and manipulate |
| 8 | +[](https://badge.fury.io/rb/git) |
| 9 | +[](https://rubydoc.info/gems/git/file/CHANGELOG.md) |
| 10 | +[](https://github.com/ruby-git/ruby-git/actions/workflows/continuous_integration.yml) |
| 11 | +[](https://codeclimate.com/github/ruby-git/ruby-git) |
| 12 | +[](https://github.com/ruby-git/ruby-git) |
| 13 | +[](https://rubydoc.info/gems/git) |
| 14 | +[](https://github.com/ruby-git/ruby-git/blob/master/LICENSE) |
| 15 | + |
| 16 | +The git Gem provides an API that can be used to create, read, and manipulate |
9 | 17 | Git repositories by wrapping system calls to the `git` binary. The API can be
|
10 | 18 | used for working with Git in complex interactions including branching and
|
11 | 19 | merging, object inspection and manipulation, history, patch generation and
|
12 | 20 | more.
|
13 | 21 |
|
14 |
| -## Homepage |
| 22 | +## Basic Usage |
15 | 23 |
|
16 |
| -The project source code is at: |
| 24 | +Get started by obtaining a repository object by: |
17 | 25 |
|
18 |
| -http://github.com/ruby-git/ruby-git |
| 26 | +* Opening an existing working copy with [Git.open](https://rubydoc.info/gems/git/Git#open-class_method) |
| 27 | +* Initializing a new repository with [Git.init](https://rubydoc.info/gems/git/Git#init-class_method) |
| 28 | +* Cloning a repository with [Git.clone](https://rubydoc.info/gems/git/Git#clone-class_method) |
19 | 29 |
|
20 |
| -## Documentation |
| 30 | +Methods that can be called on a repository object are documented in [Git::Base](https://rubydoc.info/gems/git/Git/Base) |
21 | 31 |
|
22 |
| -Detailed documentation can be found at: |
| 32 | +## Install |
23 | 33 |
|
24 |
| -https://rubydoc.info/gems/git/Git.html |
| 34 | +You can install the `git` gem with the following command: |
25 | 35 |
|
26 |
| -Get started by obtaining a repository object by: |
27 |
| - |
28 |
| -* opening an existing working copy with [Git.open](https://rubydoc.info/gems/git/Git#open-class_method) |
29 |
| -* initializing a new repository with [Git.init](https://rubydoc.info/gems/git/Git#init-class_method) |
30 |
| -* cloning a repository with [Git.clone](https://rubydoc.info/gems/git/Git#clone-class_method) |
| 36 | +```shell |
| 37 | +gem install git |
| 38 | +``` |
31 | 39 |
|
32 |
| -Methods that can be called on a repository object are documented in [Git::Base](https://rubydoc.info/gems/git/Git/Base) |
| 40 | +## Deprecation Warnings |
33 | 41 |
|
34 |
| -## Install |
| 42 | +Deprecation warnings are managed with the `Git.deprecation` attribute. |
35 | 43 |
|
36 |
| -You can install Ruby/Git like this: |
| 44 | +Use this object to define deprecations in the source code: |
37 | 45 |
|
| 46 | +```ruby |
| 47 | +Git.deprecation.deprecate_methods(Git::Branch, stashes: 'use Git::Base#stash_list instead') |
38 | 48 | ```
|
39 |
| -sudo gem install git |
| 49 | + |
| 50 | +The default action when using deprecated items (methods, classes, etc.) is to output |
| 51 | +a **DEPRECATION WARNING** to `$stderr` like the following: |
| 52 | + |
| 53 | +```text |
| 54 | +DEPRECATION WARNING: stashes is deprecated and will be removed from git 2.0.0 (use Git::Base.stash_list instead) |
40 | 55 | ```
|
41 | 56 |
|
42 |
| -## Code Status |
| 57 | +The action taken when a deprecated item is used is defined by setting the behavior |
| 58 | +on the deprecation object: |
| 59 | + |
| 60 | +```ruby |
| 61 | +# Log all deprecation warnings to $stderr (the default) |
| 62 | +Git.deprecation = :stderr |
| 63 | + |
| 64 | +# Raise an ActiveSupport::DeprecationException |
| 65 | +Git.deprecation = :raise |
| 66 | + |
| 67 | +# Do nothing |
| 68 | +Git.deprecation = :silence |
| 69 | +``` |
43 | 70 |
|
44 |
| -* [](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI) |
45 |
| -* [](https://codeclimate.com/github/ruby-git/ruby-git) |
46 |
| -* [](https://badge.fury.io/rb/git) |
| 71 | +See [ActiveSupport::Deprecation](https://api.rubyonrails.org/classes/ActiveSupport/Deprecation.html) |
| 72 | +for more details on how to use deprecations. |
47 | 73 |
|
48 | 74 | ## Major Objects
|
49 | 75 |
|
|
0 commit comments