FISH
This commit is contained in:
parent
29bc4bc769
commit
7829058f8e
|
@ -1,2 +1,5 @@
|
|||
vim/bundle/*
|
||||
vim/vim/*
|
||||
|
||||
fish/fish/fish_history
|
||||
fish/fish/fishd.*
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
brew install autoconf automake cmake doxygen fish freetype git graphicsmagickwget htop-osx httperf jq libevent libspatialite memcached mysql nginx node openssl phantomjs postgis postgresql pyqt python python3 qt rbenv rbenv-vars readline redis riak sqlite the_silver_searcher tmux v8
|
|
@ -1,7 +1,5 @@
|
|||
# I'm just unable to remember this shit
|
||||
# Taken from http://www.analysisandsolutions.com/code/chmod.htm
|
||||
#!/bin/bash
|
||||
|
||||
chmod-help () {
|
||||
echo "\
|
||||
+---+-----+-------------------------+
|
||||
| 0 | --- | no access |
|
||||
|
@ -14,4 +12,3 @@ chmod-help () {
|
|||
| 7 | rwx | read, write and execute |
|
||||
+---+-----+-------------------------+\
|
||||
"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
defaults write com.apple.Dock autohide-delay -float $1 && killall Dock
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# credit: http://nparikh.org/notes/zshrc.txt
|
||||
# Usage: smartextract <file>
|
||||
# Description: extracts archived files / mounts disk images
|
||||
# Note: .dmg/hdiutil is Mac OS X-specific.
|
||||
|
||||
if [ -f $1 ]; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar -jxvf $1 ;;
|
||||
*.tar.gz) tar -zxvf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.dmg) hdiutil mount $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar -xvf $1 ;;
|
||||
*.tbz2) tar -jxvf $1 ;;
|
||||
*.tgz) tar -zxvf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.ZIP) unzip $1 ;;
|
||||
*.pax) cat $1 | pax -r ;;
|
||||
*.pax.Z) uncompress $1 --stdout | pax -r ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*) echo "'$1' cannot be extracted/mounted via smartextract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Undo your last commit, but don't throw away your changes
|
||||
|
||||
git reset --soft HEAD^
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
last_commit = `git rev-parse HEAD`.chomp
|
||||
system 'git pull --rebase'
|
||||
|
||||
news = `git whatchanged #{last_commit}..HEAD`
|
||||
|
||||
files = Hash.new do |hash, key|
|
||||
hash[key] = { :status => [], :author => [] }
|
||||
end
|
||||
conflict = false
|
||||
current_author = ''
|
||||
|
||||
news.split("\n").each do |str|
|
||||
am = str.match(/Author: (.*?) <.*/)
|
||||
current_author = am[1] unless am.nil?
|
||||
|
||||
fm = str.match(/^:.*?\.\.\. ([A-Z]+)\t(.*)/)
|
||||
next if fm.nil?
|
||||
|
||||
m, status, file = *fm
|
||||
|
||||
files[file][:status] << status
|
||||
files[file][:author] << current_author
|
||||
|
||||
conflict = true if status.length > 1
|
||||
end
|
||||
|
||||
files.each do |file, info|
|
||||
color_code = case info[:status].first
|
||||
when 'D' then 31
|
||||
when 'A' then 32
|
||||
else 33
|
||||
end
|
||||
puts "\e[1m\e[#{color_code}m#{info[:status].first}\e[0m #{file} (\e[34m#{info[:author].uniq.join(', ')}\e[0m)"
|
||||
end
|
||||
|
||||
exit if conflict
|
||||
|
||||
# Running bundle command if needed
|
||||
system 'bundle' if files.keys.include?('Gemfile')
|
||||
|
||||
# Migrating if schema has changed
|
||||
if files.keys.include?('db/schema.rb')
|
||||
system 'bundle exec rake db:migrate'
|
||||
system 'git checkout db/schema.rb' # Reseting schema
|
||||
end
|
|
@ -0,0 +1,364 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
HELP = <<EOS
|
||||
git-wtf displays the state of your repository in a readable, easy-to-scan
|
||||
format. It's useful for getting a summary of how a branch relates to a remote
|
||||
server, and for wrangling many topic branches.
|
||||
|
||||
git-wtf can show you:
|
||||
- How a branch relates to the remote repo, if it's a tracking branch.
|
||||
- How a branch relates to integration branches, if it's a feature branch.
|
||||
- How a branch relates to the feature branches, if it's an integration
|
||||
branch.
|
||||
|
||||
git-wtf is best used before a git push, or between a git fetch and a git
|
||||
merge. Be sure to set color.ui to auto or yes for maximum viewing pleasure.
|
||||
EOS
|
||||
|
||||
KEY = <<EOS
|
||||
KEY:
|
||||
() branch only exists locally
|
||||
{} branch only exists on a remote repo
|
||||
[] branch exists locally and remotely
|
||||
|
||||
x merge occurs both locally and remotely
|
||||
~ merge occurs only locally
|
||||
(space) branch isn't merged in
|
||||
|
||||
(It's possible for merges to occur remotely and not locally, of course, but
|
||||
that's a less common case and git-wtf currently doesn't display anything
|
||||
special for it.)
|
||||
EOS
|
||||
|
||||
USAGE = <<EOS
|
||||
Usage: git wtf [branch+] [options]
|
||||
|
||||
If [branch] is not specified, git-wtf will use the current branch. The possible
|
||||
[options] are:
|
||||
|
||||
-l, --long include author info and date for each commit
|
||||
-a, --all show all branches across all remote repos, not just
|
||||
those from origin
|
||||
-A, --all-commits show all commits, not just the first 5
|
||||
-s, --short don't show commits
|
||||
-k, --key show key
|
||||
-r, --relations show relation to features / integration branches
|
||||
--dump-config print out current configuration and exit
|
||||
|
||||
git-wtf uses some heuristics to determine which branches are integration
|
||||
branches, and which are feature branches. (Specifically, it assumes the
|
||||
integration branches are named "master", "next" and "edge".) If it guesses
|
||||
incorrectly, you will have to create a .git-wtfrc file.
|
||||
|
||||
To start building a configuration file, run "git-wtf --dump-config >
|
||||
.git-wtfrc" and edit it. The config file is a YAML file that specifies the
|
||||
integration branches, any branches to ignore, and the max number of commits to
|
||||
display when --all-commits isn't used. git-wtf will look for a .git-wtfrc file
|
||||
starting in the current directory, and recursively up to the root.
|
||||
|
||||
IMPORTANT NOTE: all local branches referenced in .git-wtfrc must be prefixed
|
||||
with heads/, e.g. "heads/master". Remote branches must be of the form
|
||||
remotes/<remote>/<branch>.
|
||||
EOS
|
||||
|
||||
COPYRIGHT = <<EOS
|
||||
git-wtf Copyright 2008--2009 William Morgan <wmorgan at the masanjin dot nets>.
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation, either version 3 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details.
|
||||
|
||||
You can find the GNU General Public License at: http://www.gnu.org/licenses/
|
||||
EOS
|
||||
|
||||
require 'yaml'
|
||||
CONFIG_FN = ".git-wtfrc"
|
||||
|
||||
class Numeric; def pluralize s; "#{to_s} #{s}" + (self != 1 ? "s" : "") end end
|
||||
|
||||
if ARGV.delete("--help") || ARGV.delete("-h")
|
||||
puts USAGE
|
||||
exit
|
||||
end
|
||||
|
||||
## poor man's trollop
|
||||
$long = ARGV.delete("--long") || ARGV.delete("-l")
|
||||
$short = ARGV.delete("--short") || ARGV.delete("-s")
|
||||
$all = ARGV.delete("--all") || ARGV.delete("-a")
|
||||
$all_commits = ARGV.delete("--all-commits") || ARGV.delete("-A")
|
||||
$dump_config = ARGV.delete("--dump-config")
|
||||
$key = ARGV.delete("--key") || ARGV.delete("-k")
|
||||
$show_relations = ARGV.delete("--relations") || ARGV.delete("-r")
|
||||
ARGV.each { |a| abort "Error: unknown argument #{a}." if a =~ /^--/ }
|
||||
|
||||
## search up the path for a file
|
||||
def find_file fn
|
||||
while true
|
||||
return fn if File.exist? fn
|
||||
fn2 = File.join("..", fn)
|
||||
return nil if File.expand_path(fn2) == File.expand_path(fn)
|
||||
fn = fn2
|
||||
end
|
||||
end
|
||||
|
||||
want_color = `git config color.wtf`
|
||||
want_color = `git config color.ui` if want_color.empty?
|
||||
$color = case want_color.chomp
|
||||
when "true"; true
|
||||
when "auto"; $stdout.tty?
|
||||
end
|
||||
|
||||
def red s; $color ? "\033[31m#{s}\033[0m" : s end
|
||||
def green s; $color ? "\033[32m#{s}\033[0m" : s end
|
||||
def yellow s; $color ? "\033[33m#{s}\033[0m" : s end
|
||||
def cyan s; $color ? "\033[36m#{s}\033[0m" : s end
|
||||
def grey s; $color ? "\033[1;30m#{s}\033[0m" : s end
|
||||
def purple s; $color ? "\033[35m#{s}\033[0m" : s end
|
||||
|
||||
## the set of commits in 'to' that aren't in 'from'.
|
||||
## if empty, 'to' has been merged into 'from'.
|
||||
def commits_between from, to
|
||||
if $long
|
||||
`git log --pretty=format:"- %s [#{yellow "%h"}] (#{purple "%ae"}; %ar)" #{from}..#{to}`
|
||||
else
|
||||
`git log --pretty=format:"- %s [#{yellow "%h"}]" #{from}..#{to}`
|
||||
end.split(/[\r\n]+/)
|
||||
end
|
||||
|
||||
def show_commits commits, prefix=" "
|
||||
if commits.empty?
|
||||
puts "#{prefix} none"
|
||||
else
|
||||
max = $all_commits ? commits.size : $config["max_commits"]
|
||||
max -= 1 if max == commits.size - 1 # never show "and 1 more"
|
||||
commits[0 ... max].each { |c| puts "#{prefix}#{c}" }
|
||||
puts grey("#{prefix}... and #{commits.size - max} more (use -A to see all).") if commits.size > max
|
||||
end
|
||||
end
|
||||
|
||||
def ahead_behind_string ahead, behind
|
||||
[ahead.empty? ? nil : "#{ahead.size.pluralize 'commit'} ahead",
|
||||
behind.empty? ? nil : "#{behind.size.pluralize 'commit'} behind"].
|
||||
compact.join("; ")
|
||||
end
|
||||
|
||||
def widget merged_in, remote_only=false, local_only=false, local_only_merge=false
|
||||
left, right = case
|
||||
when remote_only; %w({ })
|
||||
when local_only; %w{( )}
|
||||
else %w([ ])
|
||||
end
|
||||
middle = case
|
||||
when merged_in && local_only_merge; green("~")
|
||||
when merged_in; green("x")
|
||||
else " "
|
||||
end
|
||||
print left, middle, right
|
||||
end
|
||||
|
||||
def show b
|
||||
have_both = b[:local_branch] && b[:remote_branch]
|
||||
|
||||
pushc, pullc, oosync = if have_both
|
||||
[x = commits_between(b[:remote_branch], b[:local_branch]),
|
||||
y = commits_between(b[:local_branch], b[:remote_branch]),
|
||||
!x.empty? && !y.empty?]
|
||||
end
|
||||
|
||||
if b[:local_branch]
|
||||
puts "Local branch: " + green(b[:local_branch].sub(/^heads\//, ""))
|
||||
|
||||
if have_both
|
||||
if pushc.empty?
|
||||
puts "#{widget true} in sync with remote"
|
||||
else
|
||||
action = oosync ? "push after rebase / merge" : "push"
|
||||
puts "#{widget false} NOT in sync with remote (you should #{action})"
|
||||
show_commits pushc unless $short
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if b[:remote_branch]
|
||||
puts "Remote branch: #{cyan b[:remote_branch]} (#{b[:remote_url]})"
|
||||
|
||||
if have_both
|
||||
if pullc.empty?
|
||||
puts "#{widget true} in sync with local"
|
||||
else
|
||||
action = pushc.empty? ? "merge" : "rebase / merge"
|
||||
puts "#{widget false} NOT in sync with local (you should #{action})"
|
||||
show_commits pullc unless $short
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts "\n#{red "WARNING"}: local and remote branches have diverged. A merge will occur unless you rebase." if oosync
|
||||
end
|
||||
|
||||
def show_relations b, all_branches
|
||||
ibs, fbs = all_branches.partition { |name, br| $config["integration-branches"].include?(br[:local_branch]) || $config["integration-branches"].include?(br[:remote_branch]) }
|
||||
if $config["integration-branches"].include? b[:local_branch]
|
||||
puts "\nFeature branches:" unless fbs.empty?
|
||||
fbs.each do |name, br|
|
||||
next if $config["ignore"].member?(br[:local_branch]) || $config["ignore"].member?(br[:remote_branch])
|
||||
next if br[:ignore]
|
||||
local_only = br[:remote_branch].nil?
|
||||
remote_only = br[:local_branch].nil?
|
||||
name = if local_only
|
||||
purple br[:name]
|
||||
elsif remote_only
|
||||
cyan br[:name]
|
||||
else
|
||||
green br[:name]
|
||||
end
|
||||
|
||||
## for remote_only branches, we'll compute wrt the remote branch head. otherwise, we'll
|
||||
## use the local branch head.
|
||||
head = remote_only ? br[:remote_branch] : br[:local_branch]
|
||||
|
||||
remote_ahead = b[:remote_branch] ? commits_between(b[:remote_branch], head) : []
|
||||
local_ahead = b[:local_branch] ? commits_between(b[:local_branch], head) : []
|
||||
|
||||
if local_ahead.empty? && remote_ahead.empty?
|
||||
puts "#{widget true, remote_only, local_only} #{name} #{local_only ? "(local-only) " : ""}is merged in"
|
||||
elsif local_ahead.empty?
|
||||
puts "#{widget true, remote_only, local_only, true} #{name} merged in (only locally)"
|
||||
else
|
||||
behind = commits_between head, (br[:local_branch] || br[:remote_branch])
|
||||
ahead = remote_only ? remote_ahead : local_ahead
|
||||
puts "#{widget false, remote_only, local_only} #{name} #{local_only ? "(local-only) " : ""}is NOT merged in (#{ahead_behind_string ahead, behind})"
|
||||
show_commits ahead unless $short
|
||||
end
|
||||
end
|
||||
else
|
||||
puts "\nIntegration branches:" unless ibs.empty? # unlikely
|
||||
ibs.sort_by { |v, br| v }.each do |v, br|
|
||||
next if $config["ignore"].member?(br[:local_branch]) || $config["ignore"].member?(br[:remote_branch])
|
||||
next if br[:ignore]
|
||||
local_only = br[:remote_branch].nil?
|
||||
remote_only = br[:local_branch].nil?
|
||||
name = remote_only ? cyan(br[:name]) : green(br[:name])
|
||||
|
||||
ahead = commits_between v, (b[:local_branch] || b[:remote_branch])
|
||||
if ahead.empty?
|
||||
puts "#{widget true, local_only} merged into #{name}"
|
||||
else
|
||||
#behind = commits_between b[:local_branch], v
|
||||
puts "#{widget false, local_only} NOT merged into #{name} (#{ahead.size.pluralize 'commit'} ahead)"
|
||||
show_commits ahead unless $short
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#### EXECUTION STARTS HERE ####
|
||||
|
||||
## find config file and load it
|
||||
$config = { "integration-branches" => %w(heads/master heads/next heads/edge), "ignore" => [], "max_commits" => 5 }.merge begin
|
||||
fn = find_file CONFIG_FN
|
||||
if fn && (h = YAML::load_file(fn)) # yaml turns empty files into false
|
||||
h["integration-branches"] ||= h["versions"] # support old nomenclature
|
||||
h
|
||||
else
|
||||
{}
|
||||
end
|
||||
end
|
||||
|
||||
if $dump_config
|
||||
puts $config.to_yaml
|
||||
exit
|
||||
end
|
||||
|
||||
## first, index registered remotes
|
||||
remotes = `git config --get-regexp ^remote\.\*\.url`.split(/[\r\n]+/).inject({}) do |hash, l|
|
||||
l =~ /^remote\.(.+?)\.url (.+)$/ or next hash
|
||||
hash[$1] ||= $2
|
||||
hash
|
||||
end
|
||||
|
||||
## next, index followed branches
|
||||
branches = `git config --get-regexp ^branch\.`.split(/[\r\n]+/).inject({}) do |hash, l|
|
||||
case l
|
||||
when /branch\.(.*?)\.remote (.+)/
|
||||
name, remote = $1, $2
|
||||
|
||||
hash[name] ||= {}
|
||||
hash[name].merge! :remote => remote, :remote_url => remotes[remote]
|
||||
when /branch\.(.*?)\.merge ((refs\/)?heads\/)?(.+)/
|
||||
name, remote_branch = $1, $4
|
||||
hash[name] ||= {}
|
||||
hash[name].merge! :remote_mergepoint => remote_branch
|
||||
end
|
||||
hash
|
||||
end
|
||||
|
||||
## finally, index all branches
|
||||
remote_branches = {}
|
||||
`git show-ref`.split(/[\r\n]+/).each do |l|
|
||||
sha1, ref = l.chomp.split " refs/"
|
||||
|
||||
if ref =~ /^heads\/(.+)$/ # local branch
|
||||
name = $1
|
||||
next if name == "HEAD"
|
||||
branches[name] ||= {}
|
||||
branches[name].merge! :name => name, :local_branch => ref
|
||||
elsif ref =~ /^remotes\/(.+?)\/(.+)$/ # remote branch
|
||||
remote, name = $1, $2
|
||||
remote_branches["#{remote}/#{name}"] = true
|
||||
next if name == "HEAD"
|
||||
ignore = !($all || remote == "origin")
|
||||
|
||||
branch = name
|
||||
if branches[name] && branches[name][:remote] == remote
|
||||
# nothing
|
||||
else
|
||||
name = "#{remote}/#{branch}"
|
||||
end
|
||||
|
||||
branches[name] ||= {}
|
||||
branches[name].merge! :name => name, :remote => remote, :remote_branch => "#{remote}/#{branch}", :remote_url => remotes[remote], :ignore => ignore
|
||||
end
|
||||
end
|
||||
|
||||
## assemble remotes
|
||||
branches.each do |k, b|
|
||||
next unless b[:remote] && b[:remote_mergepoint]
|
||||
b[:remote_branch] = if b[:remote] == "."
|
||||
b[:remote_mergepoint]
|
||||
else
|
||||
t = "#{b[:remote]}/#{b[:remote_mergepoint]}"
|
||||
remote_branches[t] && t # only if it's still alive
|
||||
end
|
||||
end
|
||||
|
||||
show_dirty = ARGV.empty?
|
||||
targets = if ARGV.empty?
|
||||
[`git symbolic-ref HEAD`.chomp.sub(/^refs\/heads\//, "")]
|
||||
else
|
||||
ARGV.map { |x| x.sub(/^heads\//, "") }
|
||||
end.map { |t| branches[t] or abort "Error: can't find branch #{t.inspect}." }
|
||||
|
||||
targets.each do |t|
|
||||
show t
|
||||
show_relations t, branches if $show_relations || t[:remote_branch].nil?
|
||||
end
|
||||
|
||||
modified = show_dirty && `git ls-files -m` != ""
|
||||
uncommitted = show_dirty && `git diff-index --cached HEAD` != ""
|
||||
|
||||
if $key
|
||||
puts
|
||||
puts KEY
|
||||
end
|
||||
|
||||
puts if modified || uncommitted
|
||||
puts "#{red "NOTE"}: working directory contains modified files." if modified
|
||||
puts "#{red "NOTE"}: staging area contains staged but uncommitted files." if uncommitted
|
||||
|
||||
# the end!
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env ruby
|
||||
# Usage: gitio URL [CODE]
|
||||
#
|
||||
# Turns a github.com URL
|
||||
# into a git.io URL
|
||||
#
|
||||
# Created by @defunkt:
|
||||
# https://gist.github.com/1209316
|
||||
#
|
||||
# Copies the git.io URL to your clipboard.
|
||||
|
||||
url = ARGV[0]
|
||||
code = ARGV[1]
|
||||
|
||||
if url !~ /^(https?:\/\/)?(gist\.)?github.com/
|
||||
abort "* github.com URLs only"
|
||||
end
|
||||
|
||||
if url !~ /^http/
|
||||
url = "https://#{url}"
|
||||
end
|
||||
|
||||
if code
|
||||
code = "-F code=#{code}"
|
||||
end
|
||||
|
||||
output = `curl -i http://git.io -F 'url=#{url}' #{code} 2> /dev/null`
|
||||
if output =~ /Location: (.+)\n?/
|
||||
puts $1
|
||||
`echo #$1 | pbcopy`
|
||||
else
|
||||
puts output
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
for code in $(seq -w 0 255)
|
||||
do
|
||||
printf "%03s: %bLorem ipsum dolor sit amet%b\n" "${code}" "\e[38;05;${code}m" "\e[m"
|
||||
done
|
|
@ -0,0 +1 @@
|
|||
/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl
|
64
bin/vandal
64
bin/vandal
|
@ -1,64 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'fileutils'
|
||||
require 'open-uri'
|
||||
require 'yaml'
|
||||
|
||||
BASE_DIR = File.join(File.dirname(__FILE__), '..', 'vim')
|
||||
BUNDLE_DIR = File.join(BASE_DIR, 'bundle')
|
||||
PACKAGES_FILE = File.join(BASE_DIR, 'packages.yml')
|
||||
|
||||
ACTION = ARGV[0]
|
||||
exit unless [nil, 'edit', 'install', 'update'].include?(ACTION)
|
||||
|
||||
if ACTION == 'edit'
|
||||
`subl #{PACKAGES_FILE}`
|
||||
exit
|
||||
end
|
||||
|
||||
PACKAGES = (YAML.load_file(PACKAGES_FILE) || {}).map do |package|
|
||||
package['dir'] = File.join(BUNDLE_DIR, package['dir'])
|
||||
package
|
||||
end
|
||||
INSTALLED = Dir.entries(BUNDLE_DIR).delete_if{ |f| ['.', '..'].include?(f) }
|
||||
|
||||
def install(meta)
|
||||
`git clone git@github.com:#{meta['github']}.git #{meta['dir']} 2>/dev/null`
|
||||
FileUtils.mv("#{meta['dir']}/.git", "#{meta['dir']}/_git")
|
||||
end
|
||||
|
||||
def update(meta)
|
||||
FileUtils.mv("#{meta['dir']}/_git", "#{meta['dir']}/.git")
|
||||
`cd #{meta['dir']} && git pull 2>/dev/null`
|
||||
FileUtils.mv("#{meta['dir']}/.git", "#{meta['dir']}/_git")
|
||||
end
|
||||
|
||||
def remove(dir)
|
||||
name = dir.split(?/).last.gsub(/\.-/, '_').split(?_).map(&:capitalize).join(' ')
|
||||
puts "Removing #{name}"
|
||||
FileUtils.rm_r(File.join(BUNDLE_DIR, dir))
|
||||
end
|
||||
|
||||
# Removing packages
|
||||
(INSTALLED - PACKAGES.map{ |b| b['dir'].split(?/).last }).each{ |b| remove(b) }
|
||||
|
||||
PACKAGES.each do |meta|
|
||||
if File.exist?(meta['dir'])
|
||||
if ACTION != 'install'
|
||||
puts "Updating #{meta['name']}"
|
||||
update(meta)
|
||||
else
|
||||
puts "Using #{meta['name']}"
|
||||
end
|
||||
else
|
||||
if ACTION != 'update'
|
||||
puts "Installing #{meta['name']}"
|
||||
install(meta)
|
||||
else
|
||||
puts "Using #{meta['name']}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts
|
||||
puts 'Done'
|
|
@ -0,0 +1 @@
|
|||
complete -x -c c -a "(ls $PROJECTS)"
|
|
@ -0,0 +1 @@
|
|||
complete -x -c h -a "(ls $HOME)"
|
|
@ -0,0 +1,17 @@
|
|||
function __cache_or_get_rake_completion -d "Create rake completions"
|
||||
mkdir -p "/tmp/rake_completion_cache_for_$USER"
|
||||
set -l hashed_pwd (pwd | md5)
|
||||
set -l rake_cache_file "/tmp/rake_completion_cache_for_$USER/$hashed_pwd"
|
||||
|
||||
if not test -f "$rake_cache_file"
|
||||
rake -T 2>&1 | sed -e "s/^rake \([a-z:_0-9!\-]*\).*#\(.*\)/\1 \2/" > "$rake_cache_file"
|
||||
end
|
||||
cat "$rake_cache_file"
|
||||
end
|
||||
|
||||
function __run_rake_completion
|
||||
test -f rakefile; or test -f Rakefile; or test -f rakefile.rb; or test -f Rakefile.rb
|
||||
end
|
||||
|
||||
complete -x -c rake -a "(__cache_or_get_rake_completion)" -n __run_rake_completion
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
set -U EDITOR vi
|
||||
|
||||
set -x FISH $HOME/.config/fish
|
||||
set -x DF $HOME/.dotfiles
|
||||
set -x PROJECTS $HOME/Code
|
||||
|
||||
set -x fish_greeting ''
|
||||
|
||||
. $FISH/includes/alias.fish
|
||||
. $FISH/includes/ruby.fish
|
||||
. $FISH/includes/path.fish
|
|
@ -0,0 +1,3 @@
|
|||
function c
|
||||
cd $PROJECTS/$argv[1]
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
set_color blue
|
||||
printf (__fish_basedir)
|
||||
if test -d .git
|
||||
set_color magenta
|
||||
__fish_git_need_commit
|
||||
end
|
||||
set_color normal
|
||||
printf ' › '
|
||||
end
|
||||
|
||||
function __fish_basedir
|
||||
echo (pwd | rev | cut -d/ -f1 | rev)
|
||||
end
|
||||
|
||||
function __fish_git_need_commit
|
||||
/usr/local/bin/git diff --stat 2>/dev/null | awk -F',' '/files? changed/ { lc += $2 + $3 } END {
|
||||
if (lc > 100) printf " -- Y U NO COMMIT!? --"
|
||||
}'
|
||||
end
|
|
@ -0,0 +1,36 @@
|
|||
function fish_right_prompt --description 'Write out the right prompt'
|
||||
if test -d .git
|
||||
__fish_git_unpushed
|
||||
__fish_git_dirty
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_git_branch
|
||||
echo (/usr/local/bin/git symbolic-ref HEAD 2>/dev/null | rev | cut -d/ -f1 | rev)
|
||||
end
|
||||
|
||||
function __fish_git_is_dirty
|
||||
echo (/usr/local/bin/git status --porcelain)
|
||||
end
|
||||
|
||||
function __fish_git_dirty
|
||||
if [ (__fish_git_is_dirty) ]
|
||||
set_color red
|
||||
else
|
||||
set_color green
|
||||
end
|
||||
printf "%s" (__fish_git_branch)
|
||||
set_color normal
|
||||
end
|
||||
|
||||
function __fish_git_is_unpushed
|
||||
echo (/usr/local/bin/git cherry -v "@{upstream}" 2>/dev/null)
|
||||
end
|
||||
|
||||
function __fish_git_unpushed
|
||||
if [ (__fish_git_is_unpushed) ]
|
||||
set_color cyan
|
||||
printf "✖ "
|
||||
set_color normal
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function h
|
||||
cd $HOME/$argv[1]
|
||||
end
|
|
@ -0,0 +1,49 @@
|
|||
alias reload! ". $HOME/.config/fish/config.fish"
|
||||
alias b "bundle exec"
|
||||
|
||||
alias ll "ls -lah"
|
||||
alias please "sudo"
|
||||
|
||||
# Ruby & Rails
|
||||
alias b "bundle exec"
|
||||
|
||||
alias rails "bundle exec rails"
|
||||
alias rake "bundle exec rake"
|
||||
alias rspec "bundle exec rspec"
|
||||
alias cap "bundle exec cap"
|
||||
alias cucumber "bundle exec cucumber"
|
||||
|
||||
alias mkbundle "bundle install --path vendor/gems"
|
||||
alias ss "git up; bundle --quiet; bundle exec rake db:migrate"
|
||||
alias rc "rails c"
|
||||
alias rs "rails s"
|
||||
alias rs1 "rails s -p3001"
|
||||
alias rs2 "rails s -p3002"
|
||||
alias fs "bundle exec foreman start"
|
||||
|
||||
# Git
|
||||
alias git "git-achievements"
|
||||
alias gl "git log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
|
||||
alias gc "git ci -m"
|
||||
alias ga "git add -u; git add .; git st"
|
||||
alias gs "git st"
|
||||
alias gd "git diff"
|
||||
alias gp "git push"
|
||||
alias gu "gut up"
|
||||
alias gb "git br"
|
||||
|
||||
# OSX
|
||||
alias hidedesktop "defaults write com.apple.finder CreateDesktop -bool false; killall Finder"
|
||||
alias showdesktop "defaults write com.apple.finder CreateDesktop -bool true; killall Finder"
|
||||
|
||||
# Services start-ups and shut-downs
|
||||
alias mysql-start="mysql.server start"
|
||||
alias mysql-stop="mysql.server stop"
|
||||
alias mysql-restart="mysql.server restart"
|
||||
|
||||
alias postgres-start="pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start"
|
||||
alias postgres-stop="pg_ctl -D /usr/local/var/postgres stop -s -m fast"
|
||||
|
||||
alias redis-start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist"
|
||||
alias redis-stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist"
|
||||
alias redis-restart="redis-stop; redis-start"
|
|
@ -0,0 +1,10 @@
|
|||
set -x PATH /usr/local/sbin $PATH
|
||||
set -x PATH $HOME/.dotfiles/bin $PATH
|
||||
set -x PATH $HOME/.rbenv/shims $PATH
|
||||
set -x PATH /usr/local/share/npm/bin $PATH
|
||||
set -x PATH /usr/local/share/python $PATH
|
||||
set -x PATH ~/.dotfiles/bin $PATH
|
||||
set -x PATH /usr/local/share/npm/bin $PATH
|
||||
set -x PATH /usr/local/share/python $PATH
|
||||
set -x PATH ~/.misc/git-achievements $PATH
|
||||
set -x PATH /Applications/Sublime\ Text\ 3.app/Contents/SharedSupport/bin $PATH
|
|
@ -0,0 +1,8 @@
|
|||
set -x RUBYOPT "-Ku" # Remove it after migration to 2.0
|
||||
|
||||
set -x RUBY_HEAP_MIN_SLOTS 800000
|
||||
set -x RUBY_HEAP_FREE_MIN 100000
|
||||
set -x RUBY_FREE_MIN 200000
|
||||
set -x RUBY_HEAP_SLOTS_INCREMENT 300000
|
||||
set -x RUBY_HEAP_SLOTS_GROWTH_FACTOR 1
|
||||
set -x RUBY_GC_MALLOC_LIMIT 79000000
|
3
setup.sh
3
setup.sh
|
@ -2,8 +2,9 @@
|
|||
ln -s ~/.dotfiles/git/gitconfig ~/.gitconfig
|
||||
ln -s ~/.dotfiles/git/gitignore ~/.gitignore
|
||||
|
||||
# ZSH
|
||||
# ZSH and Fish
|
||||
ln -s ~/.dotfiles/zsh/zshrc ~/.zshrc
|
||||
ln -s ~/.dotfiles/fish/profile ~/.profile
|
||||
|
||||
# Ruby
|
||||
ln -s ~/.dotfiles/ruby/gemrc ~/.gemrc
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
# credit: http://nparikh.org/notes/zshrc.txt
|
||||
# Usage: smartextract <file>
|
||||
# Description: extracts archived files / mounts disk images
|
||||
# Note: .dmg/hdiutil is Mac OS X-specific.
|
||||
|
||||
extract () {
|
||||
if [ -f $1 ]; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar -jxvf $1 ;;
|
||||
*.tar.gz) tar -zxvf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.dmg) hdiutil mount $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar -xvf $1 ;;
|
||||
*.tbz2) tar -jxvf $1 ;;
|
||||
*.tgz) tar -zxvf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.ZIP) unzip $1 ;;
|
||||
*.pax) cat $1 | pax -r ;;
|
||||
*.pax.Z) uncompress $1 --stdout | pax -r ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*) echo "'$1' cannot be extracted/mounted via smartextract()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
dock-delay() {
|
||||
defaults write com.apple.Dock autohide-delay -float $1 && killall Dock
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
show-colors() {
|
||||
for code in {000..255}; do print -P -- "$code: %F{$code}Lorem ipsum dolor sit amet%f"; done
|
||||
}
|
Loading…
Reference in New Issue