Skip to content

Commit

Permalink
Generate and push rubydoc.brew.sh
Browse files Browse the repository at this point in the history
This is a replacement for the rubydoc.info site that has been a bit
unreliable for us.

Also, note we're using the community Ruby style guide now rather than
the GitHub one.
  • Loading branch information
MikeMcQuaid committed Mar 28, 2019
1 parent f1f792e commit 97e5123
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 62 deletions.
10 changes: 10 additions & 0 deletions .github/main.workflow
@@ -0,0 +1,10 @@
workflow "Push" {
on = "push"
resolves = ["Generate rubydoc.brew.sh"]
}

action "Generate rubydoc.brew.sh" {
uses = "docker://ruby:latest"
runs = ".github/main.workflow.sh"
secrets = ["RUBYDOC_DEPLOY_KEY"]
}
36 changes: 36 additions & 0 deletions .github/main.workflow.sh
@@ -0,0 +1,36 @@
#!/bin/bash

set -e

# silence bundler complaining about being root
mkdir ~/.bundle
echo 'BUNDLE_SILENCE_ROOT_WARNING: "1"' > ~/.bundle/config

# configure git
git config --global user.name "BrewTestBot"
git config --global user.email "homebrew-test-bot@lists.sfconservancy.org"

# setup SSH
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "$RUBYDOC_DEPLOY_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"

# clone rubydoc.brew.sh with SSH so we can push back
git clone git@github.com:Homebrew/rubydoc.brew.sh
cd rubydoc.brew.sh

# clone latest Homebrew/brew
git clone --depth=1 https://github.com/Homebrew/brew

# run rake to build documentation
gem install bundler
bundle install
bundle exec rake

# commit and push generated files
git add docs
git diff --exit-code HEAD -- docs && exit 0
git commit -m 'docs: update from Homebrew/brew push' docs
git push
5 changes: 3 additions & 2 deletions Library/Homebrew/README.md
@@ -1,8 +1,9 @@
# Homebrew's Formula API
This is the (partially) documented public API for Homebrew.

This is the public API for Homebrew.

The main class you should look at is the {Formula} class (and classes linked from there). That's the class that's used to create Homebrew formulae (i.e. package descriptions). Assume anything else you stumble upon is private.

You may also find the [Formula Cookbook](https://docs.brew.sh/Formula-Cookbook) and [Ruby Style Guide](https://github.com/styleguide/ruby) helpful in creating formulae.
You may also find the [Formula Cookbook](https://docs.brew.sh/Formula-Cookbook) and [Ruby Style Guide](https://github.com/rubocop-hq/ruby-style-guide#the-ruby-style-guide) helpful in creating formulae.

Good luck!
2 changes: 1 addition & 1 deletion Library/Homebrew/formula.rb
Expand Up @@ -32,7 +32,7 @@
# @see Pathname
# @see https://www.rubydoc.info/stdlib/fileutils FileUtils
# @see https://docs.brew.sh/Formula-Cookbook Formula Cookbook
# @see https://github.com/styleguide/ruby Ruby Style Guide
# @see https://github.com/rubocop-hq/ruby-style-guide#the-ruby-style-guide Ruby Style Guide
#
# <pre>class Wget < Formula
# homepage "https://www.gnu.org/software/wget/"
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/formula_creator.rb
Expand Up @@ -80,7 +80,7 @@ def generate!
def template
<<~ERB
# Documentation: https://docs.brew.sh/Formula-Cookbook
# https://www.rubydoc.info/github/Homebrew/brew/master/Formula
# https://rubydoc.brew.sh/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class #{Formulary.class_s(name)} < Formula
desc "#{desc}"
Expand Down
114 changes: 57 additions & 57 deletions docs/Formula-Cookbook.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/Prose-Style-Guidelines.md
Expand Up @@ -16,7 +16,7 @@ Homebrew's audience includes users with a wide range of education and experience

We strive for "correct" but not "fancy" usage. Think newspaper article, not academic paper.

This is a set of guidelines to be applied using human judgment, not a set of hard and fast rules. It is like [The Economist's Style Guide](https://web.archive.org/web/20170830001125/https://www.economist.com/styleguide/introduction) or [Garner's Modern American Usage](https://en.wikipedia.org/wiki/Garner's_Modern_American_Usage). It is less like the [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide). All guidelines here are open to interpretation and discussion. 100% conformance to these guidelines is *not* a goal.
This is a set of guidelines to be applied using human judgment, not a set of hard and fast rules. It is like [The Economist's Style Guide](https://web.archive.org/web/20170830001125/https://www.economist.com/styleguide/introduction) or [Garner's Modern American Usage](https://en.wikipedia.org/wiki/Garner's_Modern_American_Usage). It is less like the [Ruby Style Guide](https://github.com/rubocop-hq/ruby-style-guide#the-ruby-style-guide). All guidelines here are open to interpretation and discussion. 100% conformance to these guidelines is *not* a goal.

The intent of this document is to help authors make decisions about clarity, style, and consistency. It is not to help settle arguments about who knows English better. Don't use this document to be a jerk.

Expand Down

0 comments on commit 97e5123

Please sign in to comment.