module Ditz

issue-claiming ditz plugin

This plugin allows people to claim issues. This is useful for avoiding duplication of work---you can check to see if someone's claimed an issue before starting to work on it, and you can let people know what you're working on.

Commands added:

ditz claim: claim an issue for yourself
ditz unclaim: unclaim a claimed issue
ditz mine: show all issues claimed by you
ditz claimed: show all claimed issues, by developer
ditz unclaimed: show all unclaimed issues

Usage:

1. add a line "- issue-claiming" to the .ditz-plugins file in the project
   root
2. use the above commands to abandon

git-sync ditz plugin

This plugin is useful for when you want synchronized, non-distributed issue coordination with other developers, and you're using git. It allows you to synchronize issue updates with other developers by using the 'ditz sync' command, which does all the git work of sending and receiving issue change for you. However, you have to set things up in a very specific way for this to work:

  1. Your ditz state must be on a separate branch. I recommend calling it 'bugs'. Create this branch, do a ditz init, and push it to the remote repo. (This means you won't be able to mingle issue change and code change in the same commits. If you care.)

  2. Make a checkout of the bugs branch in a separate directory, but NOT in your code checkout. If you're developing in a directory called "project", I recommend making a ../project-bugs/ directory, cloning the repo there as well, and keeping that directory checked out to the 'bugs' branch. (There are various complicated things you can do to make that directory share git objects with your code directory, but I wouldn't bother unless you really care about disk space. Just make it an independent clone.)

  3. Set that directory as your issue-dir in your .ditz-config file in your code checkout directory. (This file should be in .gitignore, btw.)

  4. Run 'ditz reconfigure' and fill in the local branch name, remote branch name, and remote repo for the issue tracking branch.

Once that's set up, 'ditz sync' will change to the bugs checkout dir, bundle up any changes you've made to issue status, push them to the remote repo, and pull any new changes in too. All ditz commands will read from your bugs directory, so you should be able to use ditz without caring about where things are anymore.

This complicated setup is necessary to avoid accidentally mingling code change and issue change. With this setup, issue change is synchronized, but how you synchronize code is still up to you.

Usage:

0. read all the above text very carefully
1. add a line "- git-sync" to the .ditz-plugins file in the project
   root
2. run 'ditz reconfigure' and answer its questions
3. run 'ditz sync' with abandon

Constants

VERSION

Public Class Methods

debug(s) click to toggle source
# File lib/ditz.rb, line 5
def debug s
  puts "# #{s}" if $verbose
end
find_dir_containing(target, start=Pathname.new(".")) click to toggle source

helper for recursive search

# File lib/ditz.rb, line 35
def find_dir_containing target, start=Pathname.new(".")
  return start if (start + target).exist?
  unless start.parent.realpath == start.realpath
    find_dir_containing target, start.parent
  end
end
find_ditz_file(fn) click to toggle source

my brilliant solution to the 'gem datadir' problem

# File lib/ditz.rb, line 43
def find_ditz_file fn
  dir = $:.find { |p| File.exist? File.expand_path(File.join(p, fn)) }
  raise "can't find #{fn} in any load path" unless dir
  File.expand_path File.join(dir, fn)
end
has_readline=(val) click to toggle source
# File lib/ditz.rb, line 14
def self.has_readline= val
  @has_readline = val
end
has_readline?() click to toggle source
# File lib/ditz.rb, line 10
def self.has_readline?
  @has_readline
end
home_dir() click to toggle source
# File lib/ditz.rb, line 26
def home_dir
  @home ||=
    ENV["HOME"] || (ENV["HOMEDRIVE"] && ENV["HOMEPATH"] ? ENV["HOMEDRIVE"] + ENV["HOMEPATH"] : nil) || begin
    $stderr.puts "warning: can't determine home directory, using '.'"
    "."
  end
end
load_plugins(fn) click to toggle source
# File lib/ditz.rb, line 49
def load_plugins fn
  Ditz::debug "loading plugins from #{fn}"
  plugins = YAML::load_file $opts[:plugins_file]
  plugins.each do |p|
    fn = Ditz::find_ditz_file "plugins/#{p}.rb"
    Ditz::debug "loading plugin #{p.inspect} from #{fn}"
    require File.expand_path(fn)
  end
  plugins
end