101 Commits

Author SHA1 Message Date
Markus Reiter
52ff988530 Fix RuboCop CaseEquality. 2016-09-23 15:30:06 +02:00
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
07d904fdb5 requirement: more obvious error message.
Make it more obvious which class was unsatisfied to produce this error
message.
2016-07-11 09:03:19 +01:00
Dominyk Tiller
e3b6c96b5d
requirement: update cask wording
We now have "magic" to automatically handle `brew cask` and `brew bundle`
calls without needing to tap those taps manually beforehand. Let's reflect that
in this wording for consistency.

Closes #427.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2016-07-01 04:31:02 +01:00
Satoshi Ohmori
6f50b45797 Fix typo [ci skip]
Closes Homebrew/homebrew#48008.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-13 21:37:22 +01:00
Xu Cheng
66c0b06d72 utils: add which_all
Similar to which, except it returns all of paths where binary is found.
i.e. it's equivalent to `which -a`.
2016-01-03 21:00:11 +08:00
Mike McQuaid
e5ba31fcdc Allow multiple option_names in dep/reqs.
This means that dependencies can be merged but still maintain all
their option names.

Closes Homebrew/homebrew#46916.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-12-15 08:37:16 +00:00
Xu Cheng
01d7f4e766 remove Requirement#pour_bottle?
It's never used since a0a93f1b3b7b2be9b8a319be91086ffe220f8e32.

Closes Homebrew/homebrew#43462.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-01 19:19:13 +08:00
Xu Cheng
fe830e4099 Requirement: support tap formula as default_formula
Closes Homebrew/homebrew#43107.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-08-20 17:31:17 +08:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Xu Cheng
c6e1090c43 requirement: allow access default_formula directly 2015-06-07 20:32:45 +08:00
Mike McQuaid
88208af8e4 requirement: add cask and download attributes.
Print out the message pointing to the Cask and/or download location too.a
2014-12-28 12:14:49 +00:00
Mike McQuaid
645e82df83 Remove {start,stop}doc as we're using Yard now. 2014-12-06 09:14:20 +00:00
Jack Nagel
9dfc5e39e8 Fix Requirement equality 2014-11-12 17:35:16 -06:00
Jack Nagel
33dfc8e8b8 Don't allocate arrays in Requirement#hash 2014-11-12 17:33:58 -06:00
Jack Nagel
7b550b9486 Use alias_method instead of an extra ivar 2014-10-09 21:54:36 -05:00
Mike McQuaid
05739585d1 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 Homebrew/homebrew#32470.
2014-09-24 15:08:10 -07:00
Jack Nagel
181654ddaf Remove two more unnecessary default arguments 2014-08-14 19:58:36 -05:00
Jack Nagel
d4602b1711 Eliminate some indirection in evaluating requirement env blocks 2014-07-07 22:01:52 -05:00
Jack Nagel
dff74d9c67 Don't set @env on instances 2014-07-07 21:32:35 -05:00
Jack Nagel
a13a4f4704 Keep DSL related code in one place 2014-07-07 20:20:29 -05:00
Jack Nagel
618b894c3e Replace ComparableSet with a Requirements collection 2014-07-03 14:50:57 -05:00
Jack Nagel
2e44ffe80f Move require into method to avoid circular require
There is a nasty circular dependency here:

formula.rb
  requirement.rb
    extend/ENV.rb
      extend/ENV/shared.rb
        formula.rb

Probably the information that the build environment needs from formula
should be passed in at runtime, but that seems hard and I really just
want to be able to run the tests with warnings turned on. :/
2014-07-02 21:27:19 -05:00
Jack Nagel
fbefa76ce2 Always use class.name to build inspect strings 2014-07-01 18:39:15 -05:00
Jack Nagel
502078099f Prefer self.class.name to self.class.to_s 2014-06-12 16:13:07 -05:00
Jack Nagel
099c8c15ae Deprecate implicit build-time requirements 2014-05-30 18:16:56 -05:00
Mike McQuaid
767da444f9 requirement: add pour_bottle? method.
Allows disabling bottles from requirements.
2014-04-03 19:47:15 +01:00
Jack Nagel
8bfcdf0bd8 Remove special X11 proxy deps 2014-03-05 20:45:44 -06:00
Jack Nagel
1981e78eb2 Eliminate mutation of Dependency objects 2014-02-27 14:22:43 -06:00
Jack Nagel
08055e1776 Ensure option names are consistent for default formula requirements 2013-12-09 14:36:10 -06:00
Jack Nagel
ea8f51256b Use ENV.append_path 2013-08-19 17:21:13 -05:00
Jack Nagel
a03120868f No longer call ENV.userpaths! in requirements
Instead we use which with a custom PATH.
2013-08-19 12:33:00 -05:00
Jack Nagel
eebc04ec9b Move common stuff to extend/ENV.rb 2013-08-19 12:32:57 -05:00
Jack Nagel
10949ad75d Fix some #eql? correctness issues
The implementation of #eql? and #hash should ensure that if a.eql?(b),
then a.hash == b.hash, but #eql? itself should not *depend* on #hash.

For example, given

  class Thingy
    def eql?
      instance_of?(other.class) && hash == other.hash
    end

    def hash
      [name, *tags].hash
    end
  end

if #hash produces a collision for different values of [name, *tags], two
Thingy objects will appear to be eql?, even though this is not the case.
Instead, #eql? should depend on the equality of name and tags directly.
2013-06-27 01:18:45 -05:00
Jack Nagel
3b725995ba Yield correct dependent when expanding requirements 2013-06-25 10:12:14 -05:00
Jack Nagel
553b1a0dbb Requirement: callers are responsible for invoking #satisfied?
This hack was necessary since requirements were not checked again
in the forked build process, but now they are, and calling it again
after the build environment has been set up can produce incorrect
results. In fact, if it happens to return false the second time,
the env modification will be skipped altogether.
2013-06-24 10:42:43 -05:00
Jack Nagel
8507ba3da4 Add Requirement#inspect 2013-06-07 22:24:36 -05:00
Jack Nagel
b97b013fce Extract attr_rw from Formula for reuse
Closes Homebrew/homebrew#20239.
2013-06-04 11:06:18 -05:00
Jack Nagel
873d9766ae Allow explicit conversion of requirements to deps
Fixes Homebrew/homebrew#19857.
2013-06-03 16:52:00 -05:00
Jack Nagel
3937d2bb84 Refactor Requirement.expand 2013-06-03 16:47:27 -05:00
Jack Nagel
fae363268b Requirement: fix typo 2013-06-02 17:14:42 -05:00
Mike McQuaid
92ccfc548e Allow requirements to specify a default formula.
This allows default resolution of requirements without user intervention.

Closes Homebrew/homebrew#19627.
2013-05-10 13:37:41 +01:00
Jack Nagel
b322020338 Reduce allocations in dependency construction
By always passing around a single, unnested array rather than splatting
and then defensively flattening and compacting things, we can avoid
allocating a bunch of unnecessary arrays. This gives a performance boost
of roughly 4% when enumerating 2500 formulae, and has the side effect of
cleaning up the dependency API.
2013-05-06 16:08:50 -05:00
Jack Nagel
1b0f0824fe Requirement: env DSL is evaluated in context of self, not ENV
This was meant to support:

  env do |req|
    append_path 'PATH', req.some_method
    ...
  end

i.e., the block was evaluated in the context of ENV. But it turned out
to be not so useful after all, so I'm ripping it out before something
actually depends on it.
2013-04-01 16:17:35 -05:00
Jack Nagel
3d5bda3f0a Simplify this regexp 2013-02-12 16:28:50 -06:00
Jack Nagel
71f85300b4 Establish a convention for Requirement names
The name attribute of requirements is used when generating options for
the :optional and :recommended dependency tags.

Unless otherwise specified, the name attribute of a Requirement will be
populated by stripping any module prefixes from the beginning and
"Dependency" or "Requirement" from end of the class name and downcasing
the result.

Closes Homebrew/homebrew#17759.
2013-02-12 16:26:10 -06:00
Jack Nagel
608fd55809 Fix typo 2013-02-07 18:58:26 -06:00
Jack Nagel
1408610b81 Proper recursive expansion of requirements with filtering
Expand requirements recursively while applying the same optional? and
recommended? filters that dependencies are run through. Options
generated by requirements are now checked against the correct list of
requirements, eliminating the temporary "best guess" logic in the
installer.
2013-01-31 15:40:06 -06:00
Jack Nagel
f4b126cc14 Create proxy classes for "partial" X11 dependencies
When a formula's dependency tree contains more than one X11 dependency,
they are de-duplicated by comparing the min_version attribute. However,
this can result in broken dependency trees if one of the X11Dependency
objects was actually specified as e.g. `:libpng`.

In practice, this only matters when one or more of the dependencies has
additional metadata that makes it distinct from the rest, i.e. an
:optional or :recommended tag.

To combat this, make these special, "partial" X11 dependencies instances
of different classes so that they are not de-duped.

It will still be necessary, at the time when requirements are expanded
by the installer, to de-duplicate any remaining X11 dependencies after
applying the optional/recommended filters in order to avoid duplicated
modifications to the environment (as ENV.x11 is not idempotent).

c.f. Homebrew/homebrew#17369.
2013-01-31 15:39:26 -06:00
Jack Nagel
210401654b Allow specifying a name attribute for X11Dependency 2013-01-28 10:35:14 -06:00