2944 Commits

Author SHA1 Message Date
Mike McQuaid
2c7ac3c244 CONTRIBUTING: actually fix this time. 2013-01-22 09:47:37 +00:00
Rory O’Kane
7a685856c5 CONTRIBUTING: fix link to Acceptable Formulae.
To match the recent renaming of that wiki article.

Closes Homebrew/homebrew#17249.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-22 08:54:07 +00:00
Jack Nagel
a03bbf5797 Use new requirement syntax 2013-01-21 17:36:34 -06:00
Jack Nagel
452e79cf68 Allow satisfied? to be specified in a block
Instead of overriding #satisfied?, Requirement subclasses can specify
the condition in a block:

  satisfy do
    some_condition?
  end

The contents of the block are evaluated in the context of the instance,
and so have access to instance variables and instance methods as before.
Additionally, it is wrapped in an ENV.with_build_environment block. This
can be disabled by passing :build_env => false to satisfy:

  satisfy :build_env => false do
    some_condition?
  end
2013-01-21 17:24:12 -06:00
Jack Nagel
09d4a7fb36 Block-style env DSL examples 2013-01-21 17:24:11 -06:00
Jack Nagel
2503cedf2c Object#instance_exec for Ruby 1.8.6
Not thread safe! But I don't think we care.

We want to evaluate the env DSL block in the context of ENV for asthetic
reasons, but we also want access to methods on the requirement instance.
We can use #instance_exec to pass the requirement itself into the block:

  class Foo < Requirement
    env do |req|
      append 'PATH', req.some_path
    end

    def some_path
      which 'something'
    end
  end

Also add a simplified version of Object#instance_exec for Ruby 1.8.6.
2013-01-21 17:24:11 -06:00
Jack Nagel
c53af42117 Allow env DSL to take a block
In addition to

  env :userpaths
  env :std

requirements can now do

  env do
    append 'PATH', '/some/path/to/bin'
    # and more
  end
2013-01-21 17:24:10 -06:00
Jack Nagel
d06824c357 ENV.with_build_environment 2013-01-21 17:24:10 -06:00
Jack Nagel
3d92f1c683 build: reorganize #install for readability 2013-01-21 17:14:16 -06:00
Jack Nagel
1f505af566 tests: add mocha mocking library 2013-01-21 17:14:16 -06:00
Matt Di Pasquale
e9158ca6dc brew upgrade: improve exit codes.
exit 1 if formulae given but none outdated

Closes Homebrew/homebrew#17199.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-21 19:55:09 +00:00
Jack Nagel
d4dc1bbd15 superenv: favor /opt/X11 over /usr/X11 when both exist
This is the order of precedence used elsewhere in Homebrew when
detecting X11 versions and prefixes.

Fixes Homebrew/homebrew#16598.
2013-01-20 19:46:01 -06:00
Misty De Meo
7f9fbe2636 Document HOMEBREW_NO_EMOJI in manpage 2013-01-19 17:29:09 -06:00
Randy Thiemann
766bc13cfb Allow hiding Homebrew emoji with an env var.
Closes Homebrew/homebrew#17085.
Closes Homebrew/homebrew#17086.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-19 23:13:01 +00:00
Jack Nagel
b568742428 Fix JSON smoke test
- Simplify encoding example because hashes are unordered.
 - Fix broken require
2013-01-17 22:29:20 -06:00
Jack Nagel
6b59e610f0 doctor: loosen git origin regexp
If the repository is set up by `brew update`, the remote URL is
https://github.com/mxcl/homebrew.git, but if it is set up by the install
script, the .git suffix is omitted.
2013-01-17 21:46:02 -06:00
Jack Nagel
997f9d0075 Update multi_json to 1.5.0
This contains updates to the OkJson library that allow objects to define
to_json for serialization, and this will be used in the upcoming options
and deps work.
2013-01-17 21:39:43 -06:00
Jack Nagel
58440a2c5b Make Formula#installed? more idiomatic 2013-01-17 21:30:23 -06:00
Simon Sigurdhsson
8000fb807f Doctor check for origin
Added checks on doctor.rb for:

* Missing git origin
* git origin not pointing at mxcl/homebrew

Tests use `git config --get remote.origin.url`.
Also added printout of origin to --config.rb.

Fixes Homebrew/homebrew#14399.
Closes Homebrew/homebrew#17117.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-01-17 17:18:15 -06:00
Jack Nagel
968782a31b Tests for Requirement DSL 2013-01-15 18:55:10 -06:00
Jack Nagel
175820af69 Tests for BuildEnvironment 2013-01-15 18:55:10 -06:00
Jack Nagel
bdece49b05 version: mark some methods as protected 2013-01-15 18:20:56 -06:00
Adam Vandenberg
e30392820f fix grammar 2013-01-14 15:18:12 -08:00
Jack Nagel
3c04d14cc9 options: sort options consistently 2013-01-14 15:08:13 -06:00
Jack Nagel
adf80ba0a8 info: sort conflicts consistently 2013-01-14 14:57:50 -06:00
Jack Nagel
870f095c69 Restore keg-only caveats
Fixes Homebrew/homebrew#16989.
2013-01-14 14:57:42 -06:00
Chad Catlett
2a4a3c3a95 Fix uses cmd
Fixes Homebrew/homebrew#17074.
Closes Homebrew/homebrew#17075.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-01-14 06:44:53 -08:00
Jack Nagel
fe4f39dcee Split up dependency test coverage
The DependencyCollector tests are really integration tests, while the
rest are closer to real unit tests. Split them up so that the tests can
be run in isolation on a per-class basis.
2013-01-13 21:01:15 -06:00
Jack Nagel
e629f14d56 Remove <=> from Dependency interface
It is important that dep equality corresponds to the name attribute, but
we may want to use the Comparable interface to sort them by installation
order in the future. Code that needs to sort them alphabetically should
just use sort_by.
2013-01-13 21:01:15 -06:00
Xiyue Deng
2d445d54b5 Add tex requirement
* Detect `latex' and `bibtex' commands.
* Recommend installing MacTeX when no LaTeX installation is found.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-01-13 18:25:35 -08:00
Jack Nagel
8f88850cdb Only mark install as attempted if it was actually attempted
Commit 30a08f5cc707 ("Don't attempt installation multiple times") was
correct in raising FormulaInstallationAlreadyAttemptedError early enough
to prevent the other exceptions in #check_install_sanity from being
raised, but it should not have moved the point at which formulae are
added to the attempted set. Doing so prevents the installer from being
instantiated multiple times on the same formula, even if installation
was never attempted.

Put it back where it belongs.
2013-01-13 15:46:46 -06:00
Jack Nagel
900a5fec2d Beef up deps tests 2013-01-12 21:20:46 -06:00
Jack Nagel
09b77a7785 Define HOMEBREW_LIBRARY for tests 2013-01-12 17:51:29 -06:00
Samuel John
bc3c07d197 Give a fresh 🍺 after hard work of brew install
- Name of the brewed formula in "Summary" heading.
- At the beginning of the summary line a 🍺  is given out
  (but only on Lion or above). This acts as a nice
  visual marker for the end of a brew-ing process.
- When brewing a dependency, the name is highlighted in green.
- `oh1` is bold, too (like ohai).

Closes Homebrew/homebrew#16020.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-11 11:16:11 +00:00
Jack Nagel
5c799ef8c8 Don't attempt installation multiple times
When a dependency of a formula specified on the command-line is also
specified, *after* the dependent formula, installation proceeds as part
of the dependent's dependency tree and then is attempted again because
the user asked for it explicitly. This results in the installer raising
a CannotInstallFormulaError because it has already been installed.

For example:

  $ brew install graphviz pkg-config
  ==> Installing graphviz dependency: pkg-config
  ...
  ==> Installing graphviz
  ...
  Error: pkg-config-0.27.1 already installed

We already have a mechanism for dealing with this, but it does not kick
in early enough. Move the installation attempt check into
FormulaInstaller#check_install_sanity and catch the exception in the
appropriate places.

Fixes Homebrew/homebrew#16957.
2013-01-10 16:46:54 -06:00
Samuel John
4291bc29db Make MPIRequirement satisfied on Xcode-only Macs
Closes Homebrew/homebrew#16409.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-01-10 16:02:07 -06:00
Jack Nagel
951620f146 Restore ARGV even if an exception is raised 2013-01-10 15:57:21 -06:00
Jack Nagel
79295ecaf8 More robust way to avoid attempting to marshal Procs 2013-01-09 19:25:02 -06:00
Jack Nagel
003a9e7fd7 Don't store test Proc if we might need to marshall the formula
Procs cannot be marshalled, but formula objects may be as part of the
BuildError exception. If the formula object has a reference to a Proc,
this will fail.

Work around it by not storing the test Procs during installations.
2013-01-09 18:33:35 -06:00
Jack Nagel
0949d952dc Define Symbol#to_proc for Ruby 1.8.6
Ruby 1.8.6 doesn't have Symbol#to_proc, which allows things like
map(&:to_s) rather than map { |o| o.to_s }. 1.8.7 does, though, and
since it is used in a bunch of the superenv code we should attempt to
keep it compatible with 1.8.6.

Closes Homebrew/homebrew#16046.
2013-01-09 17:36:17 -06:00
Misty De Meo
05772f8ccf doctor: use -V for python version
`python --version` doesn't work in some (very) old versions of
python. While I doubt this is going to come up very often, it's
theoretically possible someone has an old python first in their
path. (python -V works on all versions I'm aware of, including
python3, and comes before --version in the --help anyway.)

Also skips the warning in case the regexp matches nothing, which
probably shouldn't happen. But if it does we shouldn't produce the
wrong warning.
2013-01-09 17:09:28 -06:00
Jack Nagel
4dffd3beb9 Set userpaths before processing requirement ENV modifications 2013-01-09 11:46:51 -06:00
Adam Vandenberg
47dcc3f770 Cleaner: allow non-empty paths to be pruned from cleaning 2013-01-08 21:27:30 -08:00
Mike Lapinsky
1815e6caa1 Don't remove linked formulas when doing a 'cleanup'
Closes Homebrew/homebrew#16947.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-01-08 09:50:12 -08:00
Jack Nagel
e3068f631a Prune LinkedKegs relative to correct path
Fixes Homebrew/homebrew#16948.
2013-01-08 11:03:13 -06:00
Jack Nagel
c2fd7856d2 Prevent repeated lookups of nil-valued keys 2013-01-08 10:21:28 -06:00
Jack Nagel
dfa387700d Allow conversion of Dependencies to Array
This is needed for the intersection code in `brew deps` to work right,
but can hopefully be refactored away somehow eventually.
2013-01-07 18:17:51 -06:00
Mike McQuaid
c670339c02 Fix brew-test-bot for new test DSL. 2013-01-07 23:48:10 +00:00
Jack Nagel
967a60a054 Detect when tests are defined 2013-01-07 17:37:28 -06:00
Jack Nagel
429caf69a9 Remove Array subclassing
Inheriting from Array (and other core types) is problematic:

  - It exposes a very wide interface with many methods that are not
    really relevant to the subclass.
  - It can cause some weird side effects, as many Array operations are
    in C and have hardcoded return values; for example, combining two
    array subclasses returns a new Array instead of the subclass.

Avoid these problems using delegation and the Enumerable module where
applicable.
2013-01-07 14:32:14 -06:00