Tracker 0.1.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: Tracker
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.2
7
- date: 2007-01-20 00:00:00 -08:00
8
- summary: Bug tracking application with a command-line interface and a backend SQLite3 database.
6
+ version: 1.0.0
7
+ date: 2007-05-12 00:00:00 -07:00
8
+ summary: A command line ticket tracker for solo projects.
9
9
  require_paths:
10
10
  - lib
11
- email: bienhd@gmail.com
12
- homepage: http://ieng6.ucsd.edu/~hbien/tracker
11
+ email:
12
+ homepage:
13
13
  rubyforge_project:
14
14
  description:
15
15
  autorequire:
16
- default_executable: trac
16
+ default_executable:
17
17
  bindir: bin
18
- has_rdoc: true
18
+ has_rdoc: false
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
21
  - - ">"
@@ -25,58 +25,27 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  platform: ruby
26
26
  signing_key:
27
27
  cert_chain:
28
- authors:
29
- - Hugh Bien
28
+ post_install_message:
29
+ authors: []
30
+
30
31
  files:
31
- - bin/trac
32
- - test/test_action.rb
33
- - test/test_bug.rb
34
- - test/test_bug_description.rb
35
- - test/test_integration.rb
36
- - test/test_interface.rb
37
- - lib/action.rb
38
- - lib/bug.rb
39
- - lib/bug_description.rb
40
- - lib/database.rb
41
- - lib/helper.rb
42
- - lib/interface.rb
43
- - lib/prompter.rb
44
- - db/migrate
45
32
  - README
46
- - MIT-LICENSE
47
- test_files:
48
- - test/test_action.rb
49
- - test/test_bug.rb
50
- - test/test_bug_description.rb
51
- - test/test_integration.rb
52
- - test/test_interface.rb
33
+ - Rakefile
34
+ - lib/comment.rb
35
+ - lib/environment.rb
36
+ - lib/ticket.rb
37
+ - lib/tracker.rb
38
+ test_files: []
39
+
53
40
  rdoc_options: []
54
41
 
55
- extra_rdoc_files:
56
- - README
57
- - MIT-LICENSE
42
+ extra_rdoc_files: []
43
+
58
44
  executables:
59
45
  - trac
60
46
  extensions: []
61
47
 
62
48
  requirements: []
63
49
 
64
- dependencies:
65
- - !ruby/object:Gem::Dependency
66
- name: sqlite3-ruby
67
- version_requirement:
68
- version_requirements: !ruby/object:Gem::Version::Requirement
69
- requirements:
70
- - - ">"
71
- - !ruby/object:Gem::Version
72
- version: 0.0.0
73
- version:
74
- - !ruby/object:Gem::Dependency
75
- name: activerecord
76
- version_requirement:
77
- version_requirements: !ruby/object:Gem::Version::Requirement
78
- requirements:
79
- - - ">"
80
- - !ruby/object:Gem::Version
81
- version: 0.0.0
82
- version:
50
+ dependencies: []
51
+
@@ -1,9 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) 2006 Hugh Bien
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/db/migrate DELETED
@@ -1,70 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "rubygems"
4
- require_gem "activerecord"
5
-
6
- puts "Removing the database..."
7
- `rm .tracker_db` if File.exists?(".tracker_db")
8
-
9
- # Connect to the database
10
- ActiveRecord::Base.establish_connection(
11
- :adapter => "sqlite3",
12
- :database => ".tracker_db"
13
- )
14
-
15
- # Create the bugs table
16
- ActiveRecord::Schema.define do
17
- create_table "bugs" do |t|
18
- t.column "name", :string
19
- t.column "priority", :int
20
- t.column "area", :string
21
- t.column "status", :boolean, :default => false
22
- t.column "date_time", :date_time
23
- end
24
- end
25
-
26
- # Creates the bug_descriptions
27
- ActiveRecord::Schema.define do
28
- create_table "bug_descriptions" do |t|
29
- t.column "bug_id", :int
30
- t.column "date_time", :date_time
31
- t.column "description", :text
32
- end
33
- end
34
-
35
- class Bug < ActiveRecord::Base
36
- has_many :bug_descriptions
37
- end
38
-
39
- class BugDescription < ActiveRecord::Base
40
- belongs_to :bugs
41
- end
42
-
43
- puts "Populating database with test data..."
44
- yesterday = 1.day.ago.to_s(:db)
45
- today = Time.now.to_s(:db)
46
- tomorrow = 1.day.from_now.to_s(:db)
47
-
48
- # Add test data to the database
49
- bug = Bug.create(:name => "First", :priority => 1, :area => "One", :date_time => yesterday, :status => true)
50
- bug.bug_descriptions.create(:date_time => yesterday, :description => "First description.\n")
51
- bug.bug_descriptions.create(:date_time => today, :description => "Second description.\n")
52
- bug.bug_descriptions.create(:date_time => today, :description => "Third description.\n")
53
-
54
- bug = Bug.create(:name => "Second", :priority => 2, :area => "Two", :date_time => today, :status => true)
55
- bug.bug_descriptions.create(:date_time => yesterday, :description => "First description.\n")
56
- bug.bug_descriptions.create(:date_time => today, :description => "Second description.\n")
57
- bug.bug_descriptions.create(:date_time => today, :description => "Third description.\n")
58
-
59
- bug = Bug.create(:name => "Third", :priority => 3, :area => "Three", :date_time => tomorrow)
60
- bug.bug_descriptions.create(:date_time => yesterday, :description => "First description.\n")
61
- bug.bug_descriptions.create(:date_time => today, :description => "Second description.\n")
62
- bug.bug_descriptions.create(:date_time => today, :description => "Third description.\n")
63
-
64
- bug = Bug.create(:name => "Fourth", :priority => 4, :area => "Four", :date_time => tomorrow)
65
- bug.bug_descriptions.create(:date_time => yesterday, :description => "First description.\n")
66
- bug.bug_descriptions.create(:date_time => today, :description => "Second description.\n")
67
- bug.bug_descriptions.create(:date_time => today, :description => "Third description.\n")
68
-
69
-
70
-
@@ -1,220 +0,0 @@
1
- require File.dirname(__FILE__) + "/bug.rb"
2
- require File.dirname(__FILE__) + "/helper.rb"
3
-
4
- # The Action module is just a simple interface for the Bug class. Use this instead of using the Bug class directly, it should satisfy all actions needed to CRUD from the bugs database.
5
- module Action
6
- # Adds a new description to an existing bug. Used when a user wants to add new information found about a bug. Takes a hash as parameter where one item is either :name or :id and the other is :description
7
- def self.append_description(hash)
8
- return nil if hash[:description] =~ /^\s*$/ # Returns nil if no description given
9
- bug = Bug.search(hash)
10
- bug.bug_descriptions.create(:description => hash[:description])
11
- end
12
-
13
- # Closes the bug from being listed.
14
- def self.close_bug(hash)
15
- bug = Bug.search(hash)
16
- bug.update_attributes(:status => true)
17
- end
18
-
19
- # Delets the bug with the given id/name and associated bug descriptions
20
- def self.delete_bug(hash)
21
- bug = Bug.search(hash)
22
- bug.destroy
23
- end
24
-
25
- # Lists all of the open bugs by whatever conditions are meant
26
- # The intersection of the conditions are returned
27
- # By default, status is false
28
- def self.list_bugs(hash = Hash.new)
29
- hash[:status] = false unless hash.has_key?(:status)
30
- bugs = Bug.find(:all, :conditions => Helper::hash_to_sql(hash), :order => "priority DESC, date_time")
31
- return bugs
32
- end
33
-
34
- # Takes a hash as a parameter which is the data for the bug.
35
- # * name - Descriptive name used for searching
36
- # * priority - an integer, 1 being the highest priority, as large a number as you want.
37
- # * area - Area, can be the filename, classname, or programmer name, etc.
38
- # * description - Quick description, what was expected, what actually happened, and how to reproduce the bug.
39
- def self.new_bug(hash)
40
- description = hash[:description]
41
- hash.delete(:description)
42
- bug = Bug.create(hash)
43
- bug.bug_descriptions.create(:description => description)
44
- return bug
45
- end
46
-
47
- # Opens a bug to be listed.
48
- def self.open_bug(hash)
49
- bug = Bug.search(hash)
50
- bug.update_attributes(:status => false)
51
- end
52
-
53
- # Updates the given bug with new information
54
- def self.update_bug(hash)
55
- bug = Bug.search(hash)
56
- bug.update_attributes(hash)
57
- end
58
-
59
- # Returns all of the areas for the open bugs
60
- def self.list_areas(*args)
61
- # Find all open bugs
62
- bugs = list_bugs(*args)
63
-
64
- # Get all of the unique areas from the bugs
65
- areas = bugs.collect { |bug| bug.area }
66
- return areas.uniq
67
- end
68
-
69
- # Returns all of the names of the open bugs
70
- def self.list_names(*args)
71
- # Find all open bugs
72
- bugs = list_bugs(*args)
73
-
74
- # Get all of the uniqe names from the bugs
75
- names = bugs.collect { |bug| bug.name }
76
- return names.uniq
77
- end
78
-
79
- def self.help_create
80
- puts "create: Creates the database in the current directory."
81
- puts "usage: trac create"
82
- puts ""
83
- puts "Creates the file '.tracker_db' in the current directory if it doesn't already exist. This file is the SQLite3 database that Tracker will use to store your data in."
84
- end
85
-
86
- def self.help_append
87
- puts "append: Appends the description of a ticket with new comment."
88
- puts "usage: trac append [-i ID | -n NAME | -d DESCRIPTION]"
89
- puts ""
90
- puts "Prompts the user for another description of the ticket. Tracker will append the additional information to the description field of the ticket."
91
- puts ""
92
- puts "Available options:"
93
- puts " -i ID | --id ID | ID"
94
- puts " -n NAME | --name NAME | NAME"
95
- puts " -d DESCRIPTION | --description DESCRIPTION"
96
- puts ""
97
- puts "Sample usage: trac append -n 'old_bug' -d 'This is a new description.'"
98
- end
99
-
100
- def self.help_close
101
- puts "close: Closes a ticket."
102
- puts "usage: trac close [-i ID | -n NAME]"
103
- puts ""
104
- puts "Closes the ticket with the given ID or NAME. Can be used with a shorthand notation - 'trac close ticket_name' is the same as 'trac close -n ticket_name'."
105
- puts ""
106
- puts "Available options:"
107
- puts " -i ID | --id ID | ID"
108
- puts " -n NAME | --name NAME | NAME"
109
- end
110
-
111
- def self.help_delete
112
- puts "delete: Deletes a ticket from the database."
113
- puts "usage: trac delete [-i ID | -n NAME]"
114
- puts ""
115
- puts "Deletes the ticket, permanently, from the database. Be careful with this command, you _cannot_ recover any tickets that are deleted and there are _no_ warnings that ask 'Are you sure?'"
116
- puts ""
117
- puts "Available options:"
118
- puts " -i ID | --id ID | ID"
119
- puts " -n NAME | --name NAME | NAME"
120
- end
121
-
122
- def self.help_list
123
- puts "list: Lists all open tickets for viewing."
124
- puts "usage: trac list [-i ID | -n NAME | -p PRIORITY | -a AREA | -c | -o]"
125
- puts ""
126
- puts "This command accepts conditions to filter which tickets are listed:
127
- * trac list -p 1
128
- Lists all tickets with priority 1.
129
- * trac list -a SOME_AREA
130
- Lists all tickets with area SOME_AREA.
131
- * trac list --closed
132
- Lists all closed tickets (by default, will only list open tickets)."
133
- puts ""
134
- puts "Available options:"
135
- puts " -i ID | --id ID | ID"
136
- puts " -n NAME | --name NAME | NAME"
137
- puts " -p PRIORITY | --priority PRIORITY"
138
- puts " -a AREA | --area AREA"
139
- puts " -d DESCRIPTION | --description DESCRIPTION"
140
- puts " -c | --closed"
141
- puts " -o | --open"
142
- end
143
-
144
- def self.help_help
145
- puts "help: Displays help messages."
146
- puts "usage: trac help [COMMAND]"
147
- puts ""
148
- puts "Displays the help message for [COMMAND]. For a list of commands, just use 'trac help' with no arguments."
149
- end
150
-
151
- def self.help_new
152
- puts "new: Creates a new ticket to enter in the database."
153
- puts "usage: trac new [-n NAME | -p PRIORITY | -a AREA | -d DESCRIPTION]"
154
- puts ""
155
- puts "If no options are given, this command will prompt you for all required fields. If an option is given, that option is used for the ticket."
156
- puts ""
157
- puts "Sample usage: trac new -n NEW_TICKET_NAME"
158
- end
159
-
160
- def self.help_open
161
- puts "open: Opens a ticket."
162
- puts "usage: trac open [-i ID | -n NAME]"
163
- puts ""
164
- puts "Opens the ticket with the given ID or NAME. Can be used with a shorthand notation - 'trac open ticket_name' is the same as 'trac open -n ticket_name'."
165
- puts ""
166
- puts "Available options:"
167
- puts " -i ID | --id ID | ID"
168
- puts " -n NAME | --name NAME | NAME"
169
- end
170
-
171
- def self.help_update
172
- puts "update: Updates a ticket's fields."
173
- puts "usage: trac update [-i ID | -n NAME | -p PRIORITY | -a AREA]"
174
- puts ""
175
- puts "Will update a ticket's name, priority, and/or area. To use it, just supply the command with either a name or id and the new updated fields:
176
- * trac update -n some_ticket -p 1
177
- Changes the ticket with name 'some_ticket' to have a priority of 1.
178
- * trac update -i 2 -n new_name
179
- Changes ticket #2 to have the name 'new_name'."
180
- puts ""
181
- puts "Available options:"
182
- puts " -i ID | --id ID | ID"
183
- puts " -n NAME | --name NAME | NAME"
184
- puts " -p PRIORITY | --priority PRIORITY"
185
- puts " -a AREA | --area AREA"
186
- end
187
-
188
- def self.help_areas
189
- puts "areas: Lists all areas."
190
- puts "usage: trac areas [-i ID | -n NAME | -p PRIORITY | -a AREA | -c | -o]"
191
- puts ""
192
- puts "This command is the same as 'trac list' except instead of displaying the entire ticket, it only displays the ticket's areas. This command is meant to be used as a quick look-up for existing areas."
193
- puts ""
194
- puts "Available options:"
195
- puts " -i ID | --id ID | ID"
196
- puts " -n NAME | --name NAME | NAME"
197
- puts " -p PRIORITY | --priority PRIORITY"
198
- puts " -a AREA | --area AREA"
199
- puts " -d DESCRIPTION | --description DESCRIPTION"
200
- puts " -c | --closed"
201
- puts " -o | --open"
202
- end
203
-
204
- def self.help_names
205
- puts "names: Lists all areas."
206
- puts "usage: trac names [-i ID | -n NAME | -p PRIORITY | -a AREA | -c | -o]"
207
- puts ""
208
- puts "This command is the same as 'trac list' except instead of displaying the entire ticket, it only displays the ticket's names. This command is meant to be used as a quick look-up for existing names."
209
- puts ""
210
- puts "Available options:"
211
- puts " -i ID | --id ID | ID"
212
- puts " -n NAME | --name NAME | NAME"
213
- puts " -p PRIORITY | --priority PRIORITY"
214
- puts " -a AREA | --area AREA"
215
- puts " -d DESCRIPTION | --description DESCRIPTION"
216
- puts " -c | --closed"
217
- puts " -o | --open"
218
- end
219
- end
220
-
data/lib/bug.rb DELETED
@@ -1,63 +0,0 @@
1
- require 'rubygems'
2
- require_gem 'activerecord'
3
-
4
- # Fields are name (string), priority (int), area (string), status (boolean).
5
- class Bug < ActiveRecord::Base
6
- has_many :bug_descriptions, :dependent => :delete_all
7
- before_create :save_date_time
8
- before_update :save_date_time
9
-
10
- # Is the bug open?
11
- def open?
12
- !status
13
- end
14
-
15
- # Is the bug closed?
16
- def closed?
17
- status
18
- end
19
-
20
- # Searches for a bug with given name or id
21
- def self.search(term=nil)
22
- # Get the needed search term if the argument is a hash
23
- term = self.get_term(term) if term.kind_of?(Hash)
24
-
25
- # Find the right bug
26
- bug = self.get_bug_from_id_or_name(term)
27
-
28
- # What to do if the bug isn't found
29
- if bug == nil
30
- raise Exception, "Bug not found with name '#{term}'." if term.kind_of?(String)
31
- raise Exception, "Bug not found with id \##{term}." if term.kind_of?(Fixnum)
32
- end
33
-
34
- # Return the bug
35
- return bug
36
- end
37
-
38
- private
39
- # Makes sure the time is saved whenever a bug is saved or modified
40
- def save_date_time
41
- self.date_time = Time.now.to_s(:db)
42
- end
43
-
44
- # Gets the term (name or id) out of a hash
45
- def self.get_term(hash)
46
- term = hash[:name] if hash.has_key?(:name)
47
- term = hash[:id] if hash.has_key?(:id)
48
- return term
49
- end
50
-
51
- # Get the bug when given an id or name
52
- def self.get_bug_from_id_or_name(search_key)
53
- if search_key.kind_of?(String)
54
- bug = find_by_name(search_key)
55
- elsif search_key.kind_of?(Fixnum)
56
- bug = find_by_id(search_key)
57
- end
58
- return bug
59
- end
60
-
61
- alias_method :opened?, :open?
62
-
63
- end