Commit graph

19 commits

Author SHA1 Message Date
Timothy Fenney
74fd8a362e Add quotes for variables in replace 2015-07-28 21:20:01 -04:00
Blaine Schmeisser
f908cc9b8f Update amend to set the current date on the commit. 2015-07-12 13:16:26 -07:00
Grayson Wright
d68ba14669 Update tat script to accept optional session name
If no session name is provided,
it will generate one from the current directory.
2015-05-15 17:37:25 -07:00
Derek Prior
734c130822 Add "bundle search" subcommand
Bundler 1.8+ added support for git-style subcommands. Any scripts
starting with `bundler-` in your path are executable as bundler
subcommands.

This adds `search` as a subcommand that uses `ag` to search for a string
among all gems in your bundle (default) or optionally a specific gem.
I've found this useful for finding the source of puzzling deprecations,
finding what gem provides a method, and other various things.
2015-05-08 14:44:00 -07:00
Dan Croak
24b34d1bec Move Git aliases to subcommand scripts
Any executable script on you PATH
that is named `git-some-name`
will be available as a git subcommand,
which means you could do `git some-name` to run the script.

Git adds them to `git help -a` under the title
"git commands available from elsewhere on your $PATH",
which will then power the auto completion,
so that will also work for any command you add.

http://blog.zamith.pt/blog/2014/11/05/supercharging-your-git/

Examples of other projects that structure their dotfiles like this:

https://github.com/robbyrussell/oh-my-zsh
https://github.com/tj/git-extras
https://github.com/holman/dotfiles
2015-04-27 13:47:52 -07:00
Zachary Jones
44f678312d set --nocolor flag to make piping xargs safe 2015-02-23 14:39:06 -08:00
Chris Toomey
fa18537afd Update tat script to also work from within tmux
The existing script would fail if run from within tmux as the default
behavior would cause a nested tmux session which is bad. This update
detects if the current context is within tmux and properly handles this
by creating a detached session and switching to it as needed.

The idea with this is for tat to behave correctly regardless of context,
which I believe this update achieves. Existing users and workflows all
work identically, but now this adds support for a workflow that remains
within tmux at all times.

I prefer to remain within tmux all the time, rather than falling back to
the shell, navigating to another directory, and then creating the
session from there. With this update, I split a pane in the current tmux
window, navigate to the directory for the new session, and use `tat` to
open (or attach) to the new-session without ever leaving tmux.

I actually [have a binding that I use for this][], `C-b` (I am
"breaking" out a new session), that is mapped to `bind C-b send-keys
'tat && exit' 'C-m'`, which also cleans up the pane.

The reason for wanting this workflow is I am pretty strict about keeping
a tmux session focused to a single project (~ maps to a git repo). I
regularly want to reference another app and will use this workflow to
quickly open that project in a new session.

A "detached" session is one which has no clients attached. [From the man
page entry][] for `new-session`: `The new session is attached to the
current terminal unless -d is given.` This essentially creates it in the
background, preventing nesting. Then the script can attach the current
client using the `switch-client` command.

[have a binding that I use for this]: 01cc928672/tmux/tmux.conf (L89)
[From the man page entry]: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/tmux.1?query=tmux&sec=1
2014-12-09 13:06:49 -05:00
Ian C. Anderson
48873f79cb tat command now works in directories with periods
- Running `tat` in the robots.thoughtbot.com directory was throwing a
'bad session name' tmux error
- See http://sourceforge.net/p/tmux/tickets/109/
2014-07-22 20:58:15 -04:00
Dustan Kasten
7c4a093ef6 tat: create tmux session if nonexistent 2014-06-16 10:20:16 -07:00
Dan Croak
64e6dfa4c6 Isolate credits to README
Per @mikeburns' suggestion.
2013-06-18 16:47:01 -07:00
Dan Croak
cb6170d2f8 Extract dev/staging/prod binaries to parity gem
https://github.com/croaky/parity
2013-05-12 17:38:22 -07:00
Gabe Berke-Williams
1f4e6d1370 Use ag instead of ack
https://github.com/ggreer/the_silver_searcher

* ag is faster than ack
* ag searches all files by default (but still ignores gitignored files). This
  removes the need for ack's `--type-add=` options.
* The command is 33% shorter than ack!
2013-03-01 23:28:36 -05:00
Dan Croak
99c8831c94 Add replace script
Find and replace by a given list of files.
2013-02-28 10:24:36 -08:00
Joe Ferris
6603b694b0 Replace s shell script with rspec shell function and alias
* Use a regular alias to make `s` short for `rspec`
* Use an `rspec` shell function to route to zeus when appropriate
* Removes confusion from `s` working differently than `rspec`
* Removes need to use a special alias to get zeus working
2013-01-18 13:24:53 -05:00
Dan Croak
8649403044 Add Heroku scripts
staging:

    staging console
    staging migrate
    staging process
    staging open
    watch staging ps
    staging tail

production:

    production backup
    production console
    production migrate
    production open
    watch production ps
    production tail

load-backup-into:

    load-backup-into staging
    load-backup-into development

Notes on the last command:

* Copy latest production database backup into development database using
  preferred pgbackups + pg_restore method recommended by Heroku.
* Do not assume local development database name.
* Get local database name from config/database.yml.
* This did not previously exist in dotfiles.

Supporting change for these commands:

* Add ~/.bin to the PATH.

https://github.com/thoughtbot/dotfiles/pull/76
2013-01-12 18:06:12 -08:00
Dan Croak
df3dd5129b Attach to tmux session w/ current directory name
I've been experimenting with a workflow where I only run long-running
processes in tmux. Examples:

    zeus start
    foreman start
    rake

tmux (or screen) are good at that: maintaining a long-running process
across shell sessions.

Instead of opening another tmux pane for vim and another for git
commands, Rails generators, test runs, etc., I do all of that outside of
tmux in my normal shell window. Those are all targeted, quick, actions.
They are what I am doing *right now*. It's my workspace.

While experimenting with this process, I noticed, I do jump into tmux
more often. Therefore, I wanted a shorter command for attaching to the
tmux session with the same name as the current directory.
2013-01-08 16:45:28 -08:00
Greg Lazarev
9de82eb791 Pass all parameters to the executable 2012-12-03 09:07:14 -08:00
Dan Croak
80b77cdefc Run specs directly from vim
* Run current spec file.
* Run spec nearest cursor.
* Run last spec that was run.
* Convert s alias to s script, use Zeus if present.
2012-11-19 09:04:34 -08:00
Dan Croak
d8adb07377 Add git-churn script
After you commit a bug fix to a feature branch, find out if the code
you changed to fix the bug is in files that change often:

    git-churn

If the buggy code changes often, find smells and refactor them. Separate
the parts that change often from the parts that don't.

Conversely, avoid refactoring areas with low churn. Refactoring changes
code, and with each change, you risk introducing new bugs.

Example:

     [feature-branch][~/dev/rails-app] churn
     2 app/controllers/accepts_controller.rb
     2 config/database.yml
     4 app/helpers/application_helper.rb
     4 config/application.rb
     9 spec/models/user_spec.rb
     9 spec/spec_helper.rb
    12 spec/requests/dashboard_spec.rb
    13 spec/models/feedback_spec.rb
    19 app/models/feedback.rb
    21 app/models/user.rb
2012-11-15 22:46:10 -08:00