This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: rake -P | ruby rake-prereqs-to-dot.rb | dot -Tpng | imgcat | |
require 'pp' | |
tasks = {} | |
dependencies = nil | |
ARGF.each_line.lazy.map(&:strip).each do |line| | |
if match = line.match(/^rake (.*)/) | |
dependencies = tasks[match[1]] ||= [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Like sh, but | |
# 1. lets you specify a file to redirect output to and | |
# 2. removes the file if there's an error | |
def sh_redirect(*args, out:) | |
sh(*args, { out: out }, {}) do |ok, status| | |
unless ok | |
rm_f out | |
raise "Command failed: `#{args.join(' ')}`\nDeleted `#{out}`" | |
end | |
end |
OlderNewer