<p dir="auto">Another extraction from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3474165426" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/6424" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/6424/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/6424">#6424</a></p>
<p dir="auto">In order:</p>
<ol dir="auto">
<li>Extract the code of the <code class="notranslate">oauth:register_apps</code> task into a method, to allow reuse.</li>
<li>Use this to create an initial user <code class="notranslate">admin</code>.</li>
<li>Run <code class="notranslate">yarn install</code> in <code class="notranslate">bin/setup</code>, or it may not work.
<ul dir="auto">
<li>Related enough to this work. I was trying to get a user created by running <code class="notranslate">bin/setup</code>, which includes <code class="notranslate">db:prepare</code> and in turn runs <code class="notranslate">db:seed</code>.</li>
</ul>
</li>
</ol>
<p dir="auto">This takes inspiration from <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mmd/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mmd">@mmd</a>'s <a href="https://gist.github.com/mmd-osm/a3a0b5a8799a333e7fae578038aa7a93">https://gist.github.com/mmd-osm/a3a0b5a8799a333e7fae578038aa7a93</a>, but is much simpler. We can think about adding more in the future.</p>
<p dir="auto">Also related to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/gravitystorm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/gravitystorm">@gravitystorm</a>'s <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="810249299" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3101" data-hovercard-type="pull_request" data-hovercard-url="/openstreetmap/openstreetmap-website/pull/3101/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/pull/3101">#3101</a> (I should have a look at that).</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/openstreetmap/openstreetmap-website/pull/6432'>https://github.com/openstreetmap/openstreetmap-website/pull/6432</a></p>

<h4>Commit Summary</h4>
<ul>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432/commits/596c20bec4d6f2520dabf71df9973bd269c54e4e" class="commit-link">596c20b</a>  Refactor to allow reuse</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432/commits/991a4aa25d3c3742bf771644a17007d626ca182a" class="commit-link">991a4aa</a>  Simple seed script to provide an initial user</li>
  <li><a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432/commits/311483bb0c9afce8ddc04d59d8d3c3c01fabcc5f" class="commit-link">311483b</a>  NPM packages required to run db:prepare</li>
</ul>

<h4 style="display: inline-block">File Changes </h4> <p style="display: inline-block">(<a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432/files">4 files</a>)</p>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432/files#diff-83a07cb3b17898a530fb9aadd9b41c7fc9217cb6d0cdbcd6fbb0577cba79780b">bin/setup</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432/files#diff-c61a903a1201b0c7f076b0270377c20390c26f655ce63689d7d843296fcf63f3">db/seeds.rb</a>
    (36)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432/files#diff-12e1dfc2e5c26446ebed87d23e59642de3389d56e6bdd2fa1ab853951843e1f0">lib/oauth/util.rb</a>
    (69)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432/files#diff-c80cb946a5fc2663b76e4c75baef76130a38ec7e1f3ebc6651596ea8b9d85799">lib/tasks/register_oauth_apps.rake</a>
    (52)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/6432.patch'>https://github.com/openstreetmap/openstreetmap-website/pull/6432.patch</a></li>
  <li><a href='https://github.com/openstreetmap/openstreetmap-website/pull/6432.diff'>https://github.com/openstreetmap/openstreetmap-website/pull/6432.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/pull/6432">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLOZ6T3NF2VP245F5P33WPDXZAVCNFSM6AAAAACIQUCAKCVHI2DSMVQWIX3LMV43ASLTON2WKOZTGQ4TCNZQGU2TAMI">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLOUBV6BOTZFP4QQT5L3WPDXZA5CNFSM6AAAAACIQUCAKCWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHNAHZSTU.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/pull/6432</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/pull/6432",
"url": "https://github.com/openstreetmap/openstreetmap-website/pull/6432",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>