Skip to content

Commit

Permalink
Add 'which?' method
Browse files Browse the repository at this point in the history
  • Loading branch information
alem0lars committed Apr 20, 2016
1 parent 0bafa3c commit 7dacfe0
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Next version

*tbd*
- Add `which?` utility method, that checks if a executable is available.

## Current and previous versions

Expand Down
1 change: 1 addition & 0 deletions build-cfg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sources:
- exts/string
- exts/hash
- exts/pathname
- exts/mkmf
- exts/thor
- core/io
- grammars/base_lexer
Expand Down
12 changes: 12 additions & 0 deletions build/fizzy
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ require "shellwords"
require "strscan"
require "uri"
require "yaml"
require "mkmf"

# Try to require `thor` or raise an exception.
begin
Expand Down Expand Up @@ -174,6 +175,13 @@ class Pathname

end

# ☞ Exts → Mkmf ────────────────────────────────────────────────────────────────

module MakeMakefile::Logging
# Turn off output on `mkmf` methods.
@quiet = true
end

# ☞ Exts → Thor ────────────────────────────────────────────────────────────────

class Thor
Expand Down Expand Up @@ -633,6 +641,10 @@ module Fizzy::Environment

include Fizzy::IO

def which?(name)
find_executable(name.to_s)
end

# Return the environment variable matching the provided `name`.
#
def get_env(name, default: nil)
Expand Down
4 changes: 4 additions & 0 deletions mkmf.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
find_executable: checking for clang... -------------------- yes

--------------------

4 changes: 4 additions & 0 deletions src/core/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module Fizzy::Environment

include Fizzy::IO

def which?(name)
find_executable(name.to_s)
end

# Return the environment variable matching the provided `name`.
#
def get_env(name, default: nil)
Expand Down
4 changes: 4 additions & 0 deletions src/exts/mkmf.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MakeMakefile::Logging
# Turn off output on `mkmf` methods.
@quiet = true
end
1 change: 1 addition & 0 deletions src/requires.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require "strscan"
require "uri"
require "yaml"
require "mkmf"

# Try to require `thor` or raise an exception.
begin
Expand Down

0 comments on commit 7dacfe0

Please sign in to comment.