Top Level Namespace

Includes:
Lowline

Defined Under Namespace

Modules: Ditz, Enumerable, Lowline Classes: Array, NilClass, Numeric, Object, String, Time

Instance Attribute Summary

Attributes included from Lowline

#use_editor_if_possible

Instance Method Summary collapse

Methods included from Lowline

#ask, #ask_for_many, #ask_for_selection, #ask_multiline, #ask_multiline_or_editor, #ask_via_editor, #ask_yon, #editor, #run_editor

Instance Method Details

#run_pager(config) ⇒ Object

Git-style automatic pagination of all output. Call run_pager from any opperator needing pagination. Yoinked from nex-3.com/posts/73-git-style-automatic-paging-in-ruby#comments



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/ditz.rb', line 72

def run_pager config
  if RUBY_VERSION >= '1.9.0'
     return if RUBY_PLATFORM =~ /win32/
  else
     return if PLATFORM =~ /win32/
  end
  return unless STDOUT.tty?
  return if config.paginate == 'never'

  read, write = IO.pipe

  unless Kernel.fork # Child process
    STDOUT.reopen(write)
    STDERR.reopen(write) if STDERR.tty?
    read.close
    write.close
    return
  end

  # Parent process, become pager
  STDIN.reopen(read)
  read.close
  write.close

  if config.paginate == 'auto'
    ENV['LESS'] = '' unless ENV['LESS']  # += doesn't work on undefined var
    ENV['LESS'] += 'FRX'  # Don't page if the input is short enough
  end

  Kernel.select [STDIN] # Wait until we have input before we start the pager
  pager = ENV['PAGER'] || 'less'
  exec pager rescue exec "/bin/sh", "-c", pager
end

#timeObject

git ditz plugin

This plugin allows issues to be associated with git commits and git branches. Git commits can be easily tagged with a ditz issue with the ‘ditz commit’ command, and both ‘ditz show’ and the ditz HTML output will then contain a list of associated commits for each issue.

Issues can also be assigned a single git feature branch. In this case, all commits on that branch will listed as commits for that issue. This particular feature is fairly rudimentary, however—it assumes the reference point is the ‘master’ branch, and once the feature branch is merged back into master, the list of commits disappears.

Two configuration variables are added, which, when specified, are used to construct HTML links for the git commit id and branch names in the generated HTML output.

Commands added:

ditz set-branch: set the git branch of an issue
ditz commit: run git-commit, and insert the issue id into the commit
  message.

Usage:

1. add a line "- git" to the .ditz-plugins file in the project root
2. run ditz reconfigure, and enter the URL prefixes, if any, from
   which to create commit and branch links.
3. use 'ditz commit' with abandon.


29
# File 'lib/ditz/plugins/git.rb', line 29

require 'time'