diff options
| author | Mike McQuaid | 2014-09-20 16:07:55 +0100 | 
|---|---|---|
| committer | Mike McQuaid | 2014-09-24 15:08:10 -0700 | 
| commit | b4edc15cb7510af52e1728eb91a1b3f3b1edf471 (patch) | |
| tree | db7a48abec7285641eafa4132d8f4e9eb0652521 | |
| parent | 91be9f5344d5931ddae6e4f905c18a607fa9e9f1 (diff) | |
| download | homebrew-b4edc15cb7510af52e1728eb91a1b3f3b1edf471.tar.bz2 | |
Generate RDoc documentation.
This is currently still very messy and we probably want to work out the
best way to declare what parts of our DSL/what files are "public".
Still, even if this is a WIP I'd rather get something committed sooner
rather than later and start iterating on this as a replacement for
`example_formula.rb` and the formula cookbook.
To test:
```bash
cd $(brew --prefix)/Library/Homebrew && \
  rdoc formula.rb requirement.rb utils.rb &&\
  open doc/index.html
```
Closes #32470.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Library/Homebrew/.rdoc_options | 17 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 14 | ||||
| -rw-r--r-- | Library/Homebrew/requirement.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/utils.rb | 4 | 
5 files changed, 40 insertions, 0 deletions
| diff --git a/.gitignore b/.gitignore index 4f0d5860e..594920004 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@  !/bin/brew  !/share/man/man1/brew.1  .DS_Store +/Library/Homebrew/doc  /Library/LinkedKegs  /Library/PinnedKegs  /Library/Taps diff --git a/Library/Homebrew/.rdoc_options b/Library/Homebrew/.rdoc_options new file mode 100644 index 000000000..b953b9e3b --- /dev/null +++ b/Library/Homebrew/.rdoc_options @@ -0,0 +1,17 @@ +--- !ruby/object:RDoc::Options +encoding: UTF-8 +static_path: [] +rdoc_include: +- . +charset: UTF-8 +exclude: +hyperlink_all: false +line_numbers: true +main_page: +markup: rdoc +page_dir: +show_hash: false +tab_width: 2 +title: Homebrew +visibility: :protected +webcvs: diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 96573b69f..840d4937d 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -11,9 +11,11 @@ require 'install_renamed'  require 'pkg_version'  class Formula +  # :startdoc:    include FileUtils    include Utils::Inreplace    extend Enumerable +  # :stopdoc:    attr_reader :name, :path    attr_reader :stable, :devel, :head, :active_spec @@ -138,6 +140,8 @@ class Formula      Keg.new(installed_prefix).version    end +  # :startdoc: +    # The directory in the cellar that the formula is installed to.    # This directory contains the formula's name and version.    def prefix(v=pkg_version) @@ -250,6 +254,8 @@ class Formula      false    end +  # :stopdoc: +    # yields self with current working directory set to the uncompressed tarball    def brew      validate_attributes :name, :version @@ -315,6 +321,8 @@ class Formula      "#<#{self.class.name}: #{path}>"    end +  # :startdoc: +    # Standard parameters for CMake builds.    # Using Build Type "None" tells cmake to use our CFLAGS,etc. settings.    # Setting it to Release would ignore our flags. @@ -333,6 +341,8 @@ class Formula      ]    end +  # :stopdoc: +    # Deprecated    def python(options={}, &block)      opoo 'Formula#python is deprecated and will go away shortly.' @@ -492,6 +502,8 @@ class Formula    protected +  # :startdoc: +    # Pretty titles the command and buffers stdout/stderr    # Throws if there's an error    def system cmd, *args @@ -554,6 +566,8 @@ class Formula      end    end +  # :stopdoc: +    private    def exec_cmd(cmd, args, out, logfn) diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index bc0c0b5a3..b34285931 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -3,6 +3,8 @@ require 'dependency'  require 'dependencies'  require 'build_environment' +# :startdoc: +  # A base class for non-formula requirements needed by formulae.  # A "fatal" requirement is one that will fail the build if it is not present.  # By default, Requirements are non-fatal. @@ -104,6 +106,8 @@ class Requirement      super(cmd, ORIGINAL_PATHS.join(File::PATH_SEPARATOR))    end +  # :stopdoc: +    class << self      include BuildEnvironmentDSL diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 9a95b3c3f..6dc5db45e 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -42,6 +42,8 @@ class Tty    end  end +# :startdoc: +  def ohai title, *sput    title = Tty.truncate(title) if $stdout.tty? && !ARGV.verbose?    puts "#{Tty.blue}==>#{Tty.white} #{title}#{Tty.reset}" @@ -71,6 +73,8 @@ def odie error    exit 1  end +# :stopdoc: +  def pretty_duration s    return "2 seconds" if s < 3 # avoids the plural problem ;)    return "#{s.to_i} seconds" if s < 120 | 
