1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
File: CONTRIBUTING
— Documentation by YARD 0.9.37
</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "CONTRIBUTING";
relpath = '';
</script>
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="file_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="_index.html">Index</a> »
<span class="title">File: CONTRIBUTING</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><div id='filecontents'><h1 id="contributing">Contributing</h1>
<p>Bug reports and pull requests are welcome on <a href="https://codeberg.org/ruby-oauth/oauth2">CodeBerg</a>, <a href="https://gitlab.com/ruby-oauth/oauth2/">GitLab</a>, or <a href="https://github.com/ruby-oauth/oauth2">GitHub</a>.<br>
This project should be a safe, welcoming space for collaboration, so contributors agree to adhere to<br>
the <a href="https://gitlab.com/ruby-oauth/oauth2/-/blob/main/CODE_OF_CONDUCT.md">code of conduct</a>.</p>
<p>To submit a patch, please fork the project, create a patch with tests, and send a pull request.</p>
<p>Remember to <a href="https://keepachangelog.com/en/1.0.0/"><img src="https://img.shields.io/badge/keep--a--changelog-1.0.0-FFDD67.svg?style=flat" alt="Keep A Changelog"></a> if you make changes.</p>
<h2 id="help-out">Help out!</h2>
<p>Take a look at the <code>reek</code> list which is the file called <code>REEK</code> and find something to improve.</p>
<p>Follow these instructions:</p>
<ol>
<li>Fork the repository</li>
<li>Create a feature branch (<code>git checkout -b my-new-feature</code>)</li>
<li>Make some fixes.</li>
<li>Commit changes (<code>git commit -am 'Added some feature'</code>)</li>
<li>Push to the branch (<code>git push origin my-new-feature</code>)</li>
<li>Make sure to add tests for it. This is important, so it doesn’t break in a future release.</li>
<li>Create new Pull Request.</li>
</ol>
<h2 id="executables-vs-rake-tasks">Executables vs Rake tasks</h2>
<p>Executables shipped by oauth2 can be used with or without generating the binstubs.<br>
They will work when oauth2 is installed globally (i.e., <code>gem install oauth2</code>) and do not require that oauth2 be in your bundle.</p>
<ul>
<li>kettle-changelog</li>
<li>kettle-commit-msg</li>
<li>oauth2-setup</li>
<li>kettle-dvcs</li>
<li>kettle-pre-release</li>
<li>kettle-readme-backers</li>
<li>kettle-release</li>
</ul>
<p>However, the rake tasks provided by oauth2 do require oauth2 to be added as a development dependency and loaded in your Rakefile.<br>
See the full list of rake tasks in head of Rakefile</p>
<p><strong>Gemfile</strong></p>
<pre class="code language-ruby"><code class="language-ruby">group :development do
gem "oauth2", require: false
end
</code></pre>
<p><strong>Rakefile</strong></p>
<pre class="code language-ruby"><code class="language-ruby"># Rakefile
require "oauth2"
</code></pre>
<h2 id="environment-variables-for-local-development">Environment Variables for Local Development</h2>
<p>Below are the primary environment variables recognized by stone_checksums (and its integrated tools). Unless otherwise noted, set boolean values to the string “true” to enable.</p>
<p>General/runtime</p>
<ul>
<li>DEBUG: Enable extra internal logging for this library (default: false)</li>
<li>REQUIRE_BENCH: Enable <code>require_bench</code> to profile requires (default: false)</li>
<li>CI: When set to true, adjusts default rake tasks toward CI behavior</li>
</ul>
<p>Coverage (kettle-soup-cover / SimpleCov)</p>
<ul>
<li>K_SOUP_COV_DO: Enable coverage collection (default: true in .envrc)</li>
<li>K_SOUP_COV_FORMATTERS: Comma-separated list of formatters (html, xml, rcov, lcov, json, tty)</li>
<li>K_SOUP_COV_MIN_LINE: Minimum line coverage threshold (integer, e.g., 100)</li>
<li>K_SOUP_COV_MIN_BRANCH: Minimum branch coverage threshold (integer, e.g., 100)</li>
<li>K_SOUP_COV_MIN_HARD: Fail the run if thresholds are not met (true/false)</li>
<li>K_SOUP_COV_MULTI_FORMATTERS: Enable multiple formatters at once (true/false)</li>
<li>K_SOUP_COV_OPEN_BIN: Path to browser opener for HTML (empty disables auto-open)</li>
<li>MAX_ROWS: Limit console output rows for simplecov-console (e.g., 1)<br>
Tip: When running a single spec file locally, you may want <code>K_SOUP_COV_MIN_HARD=false</code> to avoid failing thresholds for a partial run.</li>
</ul>
<p>GitHub API and CI helpers</p>
<ul>
<li>GITHUB_TOKEN or GH_TOKEN: Token used by <code>ci:act</code> and release workflow checks to query GitHub Actions status at higher rate limits</li>
</ul>
<p>Releasing and signing</p>
<ul>
<li>SKIP_GEM_SIGNING: If set, skip gem signing during build/release</li>
<li>GEM_CERT_USER: Username for selecting your public cert in <code>certs/<USER>.pem</code> (defaults to $USER)</li>
<li>SOURCE_DATE_EPOCH: Reproducible build timestamp. <code>kettle-release</code> will set this automatically for the session.</li>
</ul>
<p>Git hooks and commit message helpers (exe/kettle-commit-msg)</p>
<ul>
<li>GIT_HOOK_BRANCH_VALIDATE: Branch name validation mode (e.g., <code>jira</code>) or <code>false</code> to disable</li>
<li>GIT_HOOK_FOOTER_APPEND: Append a footer to commit messages when goalie allows (true/false)</li>
<li>GIT_HOOK_FOOTER_SENTINEL: Required when footer append is enabled — a unique first-line sentinel to prevent duplicates</li>
<li>GIT_HOOK_FOOTER_APPEND_DEBUG: Extra debug output in the footer template (true/false)</li>
</ul>
<p>For a quick starting point, this repository’s <code>.envrc</code> shows sane defaults, and <code>.env.local</code> can override them locally.</p>
<h2 id="appraisals">Appraisals</h2>
<p>From time to time the <a href="https://github.com/appraisal-rb/appraisal2">appraisal2</a> gemfiles in <code>gemfiles/</code> will need to be updated.<br>
They are created and updated with the commands:</p>
<pre class="code language-console"><code class="language-console">bin/rake appraisal:update
</code></pre>
<p>When adding an appraisal to CI, check the <a href="https://github.com/ruby/ruby-builder/releases/tag/toolcache">runner tool cache</a> to see which runner to use.</p>
<h2 id="the-reek-list">The Reek List</h2>
<p>Take a look at the <code>reek</code> list which is the file called <code>REEK</code> and find something to improve.</p>
<p>To refresh the <code>reek</code> list:</p>
<pre class="code language-console"><code class="language-console">bundle exec reek > REEK
</code></pre>
<h2 id="run-tests">Run Tests</h2>
<p>To run all tests</p>
<pre class="code language-console"><code class="language-console">bundle exec rake test
</code></pre>
<h3 id="spec-organization-required">Spec organization (required)</h3>
<ul>
<li>One spec file per class/module. For each class or module under <code>lib/</code>, keep all of its unit tests in a single spec file under <code>spec/</code> that mirrors the path and file name exactly: <code>lib/oauth2/release_cli.rb</code> -> <code>spec/oauth2/release_cli_spec.rb</code>.</li>
<li>Never add a second spec file for the same class/module. Examples of disallowed names: <code>*_more_spec.rb</code>, <code>*_extra_spec.rb</code>, <code>*_status_spec.rb</code>, or any other suffix that still targets the same class. If you find yourself wanting a second file, merge those examples into the canonical spec file for that class/module.</li>
<li>Exception: Integration specs that intentionally span multiple classes. Place these under <code>spec/integration/</code> (or a clearly named integration folder), and do not directly mirror a single class. Name them after the scenario, not a class.</li>
<li>Migration note: If a duplicate spec file exists, move all examples into the canonical file and delete the duplicate. Do not leave stubs or empty files behind.</li>
</ul>
<h2 id="lint-it">Lint It</h2>
<p>Run all the default tasks, which includes running the gradually autocorrecting linter, <code>rubocop-gradual</code>.</p>
<pre class="code language-console"><code class="language-console">bundle exec rake
</code></pre>
<p>Or just run the linter.</p>
<pre class="code language-console"><code class="language-console">bundle exec rake rubocop_gradual:autocorrect
</code></pre>
<p>For more detailed information about using RuboCop in this project, please see the <a href="file.RUBOCOP.html" title="RUBOCOP.md">RUBOCOP.md</a> guide. This project uses <code>rubocop_gradual</code> instead of vanilla RuboCop, which requires specific commands for checking violations.</p>
<h3 id="important-do-not-add-inline-rubocop-disables">Important: Do not add inline RuboCop disables</h3>
<p>Never add <code># rubocop:disable ...</code> / <code># rubocop:enable ...</code> comments to code or specs (except when following the few existing <code>rubocop:disable</code> patterns for a rule already being disabled elsewhere in the code). Instead:</p>
<ul>
<li>Prefer configuration-based exclusions when a rule should not apply to certain paths or files (e.g., via <code>.rubocop.yml</code>).</li>
<li>When a violation is temporary and you plan to fix it later, record it in <code>.rubocop_gradual.lock</code> using the gradual workflow:
<ul>
<li>
<code>bundle exec rake rubocop_gradual:autocorrect</code> (preferred)</li>
<li>
<code>bundle exec rake rubocop_gradual:force_update</code> (only when you cannot fix the violations immediately)</li>
</ul>
</li>
</ul>
<p>As a general rule, fix style issues rather than ignoring them. For example, our specs should follow RSpec conventions like using <code>described_class</code> for the class under test.</p>
<h2 id="contributors">Contributors</h2>
<p>Your picture could be here!</p>
<p><a href="https://github.com/ruby-oauth/oauth2/graphs/contributors"><img src="https://contrib.rocks/image?repo=ruby-oauth/oauth2" alt="Contributors"></a></p>
<p>Made with <a href="https://contrib.rocks">contributors-img</a>.</p>
<p>Also see GitLab Contributors: <a href="https://gitlab.com/ruby-oauth/oauth2/-/graphs/main">https://gitlab.com/ruby-oauth/oauth2/-/graphs/main</a></p>
<h2 id="for-maintainers">For Maintainers</h2>
<h3 id="one-time-per-maintainer-setup">One-time, Per-maintainer, Setup</h3>
<p><strong>IMPORTANT</strong>: To sign a build,<br>
a public key for signing gems will need to be picked up by the line in the<br>
<code>gemspec</code> defining the <code>spec.cert_chain</code> (check the relevant ENV variables there).<br>
All releases to RubyGems.org are signed releases.<br>
See: <a href="https://guides.rubygems.org/security/#building-gems">RubyGems Security Guide</a></p>
<p>NOTE: To build without signing the gem set <code>SKIP_GEM_SIGNING</code> to any value in the environment.</p>
<h3 id="to-release-a-new-version">To release a new version:</h3>
<h4 id="automated-process">Automated process</h4>
<ol>
<li>Update version.rb to contian the correct version-to-be-released.</li>
<li>Run <code>bundle exec kettle-changelog</code>.</li>
<li>Run <code>bundle exec kettle-release</code>.</li>
</ol>
<h4 id="manual-process">Manual process</h4>
<ol>
<li>Run <code>bin/setup && bin/rake</code> as a “test, coverage, & linting” sanity check</li>
<li>Update the version number in <code>version.rb</code>, and ensure <code>CHANGELOG.md</code> reflects changes</li>
<li>Run <code>bin/setup && bin/rake</code> again as a secondary check, and to update <code>Gemfile.lock</code>
</li>
<li>Run <code>git commit -am "🔖 Prepare release v<VERSION>"</code> to commit the changes</li>
<li>Run <code>git push</code> to trigger the final CI pipeline before release, and merge PRs
<ul>
<li>NOTE: Remember to <a href="https://github.com/ruby-oauth/oauth2/actions">check the build</a>.</li>
</ul>
</li>
<li>Run <code>export GIT_TRUNK_BRANCH_NAME="$(git remote show origin | grep 'HEAD branch' | cut -d ' ' -f5)" && echo $GIT_TRUNK_BRANCH_NAME</code>
</li>
<li>Run <code>git checkout $GIT_TRUNK_BRANCH_NAME</code>
</li>
<li>Run <code>git pull origin $GIT_TRUNK_BRANCH_NAME</code> to ensure latest trunk code</li>
<li>Optional for older Bundler (< 2.7.0): Set <code>SOURCE_DATE_EPOCH</code> so <code>rake build</code> and <code>rake release</code> use the same timestamp and generate the same checksums
<ul>
<li>If your Bundler is >= 2.7.0, you can skip this; builds are reproducible by default.</li>
<li>Run <code>export SOURCE_DATE_EPOCH=$EPOCHSECONDS && echo $SOURCE_DATE_EPOCH</code>
</li>
<li>If the echo above has no output, then it didn’t work.</li>
<li>Note: <code>zsh/datetime</code> module is needed, if running <code>zsh</code>.</li>
<li>In older versions of <code>bash</code> you can use <code>date +%s</code> instead, i.e. <code>export SOURCE_DATE_EPOCH=$(date +%s) && echo $SOURCE_DATE_EPOCH</code>
</li>
</ul>
</li>
<li>Run <code>bundle exec rake build</code>
</li>
<li>Run <code>bin/gem_checksums</code> (more context <a href="https://github.com/rubygems/rubygems/pull/6022">1</a>, <a href="https://github.com/rubygems/guides/pull/325">2</a>)<br>
to create SHA-256 and SHA-512 checksums. This functionality is provided by the <code>stone_checksums</code><br>
<a href="https://github.com/galtzo-floss/stone_checksums">gem</a>.
<ul>
<li>The script automatically commits but does not push the checksums</li>
</ul>
</li>
<li>Sanity check the SHA256, comparing with the output from the <code>bin/gem_checksums</code> command:
<ul>
<li><code>sha256sum pkg/<gem name>-<version>.gem</code></li>
</ul>
</li>
<li>Run <code>bundle exec rake release</code> which will create a git tag for the version,<br>
push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>
</li>
</ol>
</div></div>
<div id="footer">
Generated on Mon Sep 15 21:28:40 2025 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.37 (ruby-3.4.5).
</div>
</div>
</body>
</html>
|