ursm-ditz 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/views.rb ADDED
@@ -0,0 +1,136 @@
1
+ require 'view'
2
+ require 'html'
3
+
4
+ module Ditz
5
+
6
+ class ScreenView < View
7
+ def initialize project, config, device=$stdout
8
+ @device = device
9
+ @config = config
10
+ end
11
+
12
+ def format_log_events events
13
+ return "none" if events.empty?
14
+ events.reverse.map do |time, who, what, comment|
15
+ "- #{what} (#{who.shortened_email}, #{time.ago} ago)" +
16
+ (comment =~ /\S/ ? "\n" + comment.gsub(/^/, " > ") : "")
17
+ end.join("\n")
18
+ end
19
+ private :format_log_events
20
+
21
+ def render_issue issue
22
+ status = case issue.status
23
+ when :closed
24
+ "#{issue.status_string}: #{issue.disposition_string}"
25
+ else
26
+ issue.status_string
27
+ end
28
+ desc = if issue.desc.size < 80 - "Description: ".length
29
+ issue.desc
30
+ else
31
+ "\n" + issue.desc.gsub(/^/, " ") + "\n"
32
+ end
33
+ @device.puts <<EOS
34
+ #{"Issue #{issue.name}".underline}
35
+ Title: #{issue.title}
36
+ Description: #{desc}
37
+ Type: #{issue.type}
38
+ Status: #{status}
39
+ Creator: #{issue.reporter}
40
+ Age: #{issue.creation_time.ago}
41
+ Release: #{issue.release}
42
+ References: #{issue.references.listify " "}
43
+ Identifier: #{issue.id}
44
+ EOS
45
+
46
+ self.class.view_additions_for(:issue_summary).each { |b| @device.print(b[issue, @config] || next) }
47
+ puts
48
+ self.class.view_additions_for(:issue_details).each { |b| @device.print(b[issue, @config] || next) }
49
+
50
+ @device.puts <<EOS
51
+ Event log:
52
+ #{format_log_events issue.log_events}
53
+ EOS
54
+ end
55
+ end
56
+
57
+ class HtmlView < View
58
+ def initialize project, config, dir
59
+ @project = project
60
+ @config = config
61
+ @dir = dir
62
+ @template_dir = File.dirname Ditz::find_ditz_file("index.rhtml")
63
+ end
64
+
65
+ def render_all
66
+ Dir.mkdir @dir unless File.exists? @dir
67
+ FileUtils.cp File.join(@template_dir, "style.css"), @dir
68
+
69
+ ## build up links
70
+ links = {}
71
+ @project.releases.each { |r| links[r] = "release-#{r.name}.html" }
72
+ @project.issues.each { |i| links[i] = "issue-#{i.id}.html" }
73
+ @project.components.each { |c| links[c] = "component-#{c.name}.html" }
74
+ links["unassigned"] = "unassigned.html" # special case: unassigned
75
+ links["index"] = "index.html" # special case: index
76
+
77
+ @project.issues.each do |issue|
78
+ fn = File.join @dir, links[issue]
79
+ #puts "Generating #{fn}..."
80
+
81
+ extra_summary = self.class.view_additions_for(:issue_summary).map { |b| b[issue, @config] }.compact
82
+ extra_details = self.class.view_additions_for(:issue_details).map { |b| b[issue, @config] }.compact
83
+
84
+ erb = ErbHtml.new(@template_dir, links, :issue => issue,
85
+ :release => (issue.release ? @project.release_for(issue.release) : nil),
86
+ :component => @project.component_for(issue.component),
87
+ :project => @project)
88
+
89
+ extra_summary_html = extra_summary.map { |string, extra_binding| erb.render_string string, extra_binding }.join
90
+ extra_details_html = extra_details.map { |string, extra_binding| erb.render_string string, extra_binding }.join
91
+
92
+ File.open(fn, "w") { |f| f.puts erb.render_template("issue", { :extra_summary_html => extra_summary_html, :extra_details_html => extra_details_html }) }
93
+ end
94
+
95
+ @project.releases.each do |r|
96
+ fn = File.join @dir, links[r]
97
+ #puts "Generating #{fn}..."
98
+ File.open(fn, "w") do |f|
99
+ f.puts ErbHtml.new(@template_dir, links, :release => r,
100
+ :issues => @project.issues_for_release(r), :project => @project).
101
+ render_template("release")
102
+ end
103
+ end
104
+
105
+ @project.components.each do |c|
106
+ fn = File.join @dir, links[c]
107
+ #puts "Generating #{fn}..."
108
+ File.open(fn, "w") do |f|
109
+ f.puts ErbHtml.new(@template_dir, links, :component => c,
110
+ :issues => @project.issues_for_component(c), :project => @project).
111
+ render_template("component")
112
+ end
113
+ end
114
+
115
+ fn = File.join @dir, links["unassigned"]
116
+ #puts "Generating #{fn}..."
117
+ File.open(fn, "w") do |f|
118
+ f.puts ErbHtml.new(@template_dir, links,
119
+ :issues => @project.unassigned_issues, :project => @project).
120
+ render_template("unassigned")
121
+ end
122
+
123
+ past_rels, upcoming_rels = @project.releases.partition { |r| r.released? }
124
+ fn = File.join @dir, links["index"]
125
+ #puts "Generating #{fn}..."
126
+ File.open(fn, "w") do |f|
127
+ f.puts ErbHtml.new(@template_dir, links, :project => @project,
128
+ :past_releases => past_rels, :upcoming_releases => upcoming_rels,
129
+ :components => @project.components).
130
+ render_template("index")
131
+ end
132
+ puts "Local generated URL: file://#{File.expand_path(fn)}"
133
+ end
134
+ end
135
+
136
+ end
data/man/ditz.1 ADDED
@@ -0,0 +1,38 @@
1
+ .TH "ditz" "1" "0.4" "" ""
2
+ .SH "NAME"
3
+ ditz \- simple, light\-weight distributed issue tracker
4
+ .SH "SYNOPSIS"
5
+ \fBditz\fR [ \fIoptions\fR ] \fIcommand\fR [ \fIarguments\fR ]
6
+
7
+ To list all available commands, use \fBditz help\fR. To get help for a specific command, use \fBditz help
8
+ command\fR.
9
+ .SH "DESCRIPTION"
10
+ Ditz is a simple, light\-weight distributed issue tracker designed to work with
11
+ distributed version control systems like darcs and git. Ditz maintains an issue
12
+ database directory on disk, with files written in a line\-based and human\-
13
+ editable format. This directory is kept under version control alongside
14
+ project code. Changes in issue state is handled by version control like code
15
+ change: included as part of a commit, merged with changes from other
16
+ developers, conflict\-resolved in the standard manner, etc.
17
+
18
+ Ditz provides a simple, console\-based interface for creating and updating the
19
+ issue database files, and some rudimentary HTML generation capabilities for
20
+ producing world\-readable status pages. It offers no central public method of
21
+ bug submission.
22
+ .SH "AUTHOR"
23
+ ditz was written by William Morgan <\fIwmorgan\-ditz@masanjin.net\fR>.
24
+
25
+ This manpage was written for the Debian package of ditz by Christian Garbs
26
+ <\fIdebian@cgarbs.de\fR>.
27
+ .SH "LICENSE"
28
+ Copyright (c) 2008 William Morgan.
29
+
30
+ This program is free software: you can redistribute it and/or modify
31
+ it under the terms of the GNU General Public License as published by
32
+ the Free Software Foundation, either version 3 of the License, or
33
+ (at your option) any later version.
34
+
35
+ This program is distributed in the hope that it will be useful,
36
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
37
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38
+ GNU General Public License for more details.
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ursm-ditz
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.4"
5
+ platform: ruby
6
+ authors:
7
+ - William Morgan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-08-21 00:00:00 -07:00
13
+ default_executable: ditz
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.7.0
23
+ version:
24
+ description: "Ditz is a simple, light-weight distributed issue tracker designed to work with distributed version control systems like git, darcs, Mercurial, and Bazaar. It can also be used with centralized systems like SVN. Ditz maintains an issue database directory on disk, with files written in a line-based and human-editable format. This directory can be kept under version control, alongside project code. There are several different ways to use ditz: 1. Treat issue change the same as code change: include it as part of commits, and merge it with changes from other developers, resolving conflicts in the usual manner. 2. Keep the issue database in the repository but in a separate branch. Issue changes can be managed by your VCS, but is not tied directly to code commits. 3. Keep the issue database separate and not under VCS at all. Ditz provides a simple, console-based interface for creating and updating the issue database file, and some rudimentary static HTML generation capabilities for producing world-readable status pages (for a demo, see the ditz ditz page). It currently offers no central public method of bug submission. Synopsis: # set up project. creates the bugs.yaml file. 1. ditz init 2. ditz add-release # add an issue 3. ditz add"
25
+ email: wmorgan-ditz@masanjin.net
26
+ executables:
27
+ - ditz
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README.txt
32
+ files:
33
+ - Changelog
34
+ - README.txt
35
+ - Rakefile
36
+ - ReleaseNotes
37
+ - bin/ditz
38
+ - lib/component.rhtml
39
+ - lib/ditz.rb
40
+ - lib/hook.rb
41
+ - lib/html.rb
42
+ - lib/index.rhtml
43
+ - lib/issue.rhtml
44
+ - lib/issue_table.rhtml
45
+ - lib/lowline.rb
46
+ - lib/model-objects.rb
47
+ - lib/model.rb
48
+ - lib/operator.rb
49
+ - lib/release.rhtml
50
+ - lib/trollop.rb
51
+ - lib/style.css
52
+ - lib/unassigned.rhtml
53
+ - lib/util.rb
54
+ - lib/view.rb
55
+ - lib/views.rb
56
+ - lib/plugins/git.rb
57
+ - lib/plugins/issue-claiming.rb
58
+ - lib/vendor/yaml_waml.rb
59
+ - contrib/completion/ditz.bash
60
+ - contrib/completion/_ditz.zsh
61
+ - man/ditz.1
62
+ has_rdoc: true
63
+ homepage: http://ditz.rubyforge.org
64
+ post_install_message:
65
+ rdoc_options:
66
+ - --main
67
+ - README.txt
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: "0"
75
+ version:
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: "0"
81
+ version:
82
+ requirements: []
83
+
84
+ rubyforge_project: ditz
85
+ rubygems_version: 1.2.0
86
+ signing_key:
87
+ specification_version: 2
88
+ summary: A simple issue tracker designed to integrate well with distributed version control systems like git and darcs. State is saved to a YAML file kept under version control, allowing issues to be closed/added/modified as part of a commit.
89
+ test_files: []
90
+