Sha256: a2f597453f0d2064fcd9eeab26833f0dd61f54c1f6b1e7f76c94faa89aac532e

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

namespace :ditz do
  
  command :close do |c|
    c.desc "Close a Ditz bug and commit saying that it has been closed"
    
    c.opt :message, "Any notes concerning this bug", :short => '-m', :type => :string, :default => ''
    
    c.on_run do |opts, args|
      repo  = opts[:repository]
      msg   = opts[:message]
      issue = args.shift
      
      system "ditz close #{issue}"
      
      repo.commit :message => "Closed Bug ##{issue}#{msg.empty? ? '' : ": #{msg}"}"
    end
  end
  
  command :add do |c|
    c.desc "Add a Ditz bug and commit saying that it has been opened"
    
    c.opt :message, "Any notes concerning this bug", :short => '-m', :type => :string, :default => ''
    
    c.on_run do |opts, args|
      repo  = opts[:repository]
      msg   = opts[:message]
      
      system "ditz add"
      
      # seydar: *sigh* i hate taking advantage of side effects
      # File.read('.ditz-config') =~ /^issue_dir:(.+)$/
      # bugs = $1.strip
      # adgar: then don't use them!
      bugs = File.read('.ditz-config').match(/^issue_dir:(.+)$/)[1].strip
      
      Amp::Command[:add].run opts, [bugs]
      repo.commit :message => "Added Bugs"
    end
  end
  
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
amp-0.5.3 lib/amp/extensions/ditz.rb
amp-0.5.2 lib/amp/extensions/ditz.rb
amp-0.5.1 lib/amp/extensions/ditz.rb
amp-pure-0.5.0 lib/amp/extensions/ditz.rb
amp-0.5.0 lib/amp/extensions/ditz.rb