Tracker 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -15,4 +15,4 @@
15
15
  * Make sure the options are valid. You can add new options in the hash in tracker.rb.
16
16
 
17
17
  == LICENSE
18
- See MIT-LICENSE.
18
+ See MIT-LICENSE.
data/bin/trac CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  # Handles connection to the database
6
6
 
7
- require "rubygems"
8
- require_gem "Tracker"
7
+ require File.dirname(__FILE__) + "/../lib/interface.rb"
8
+ require File.dirname(__FILE__) + "/../lib/database.rb"
9
9
 
10
10
  # The default database file_name
11
11
  DEFAULT_DATABASE_FILE_NAME = ".tracker_db"
@@ -25,7 +25,7 @@ def no_database_error(database_file = "the current")
25
25
  end
26
26
 
27
27
  # Is the user creating a new database?
28
- if ARGV.include?("create")
28
+ if ARGV.include?("create") && !ARGV.include?("help")
29
29
  if File.exists?(database)
30
30
  puts "A '.tracker_db' database already exists in the current directory. Try removing it to create a new one."
31
31
  exit
@@ -43,7 +43,7 @@ while !File.exists?(database) && iteration < 10
43
43
  end
44
44
 
45
45
  # Could we find the database?
46
- if iteration == 10 && !ARGV.include?("help") && !ARGV.include?("--file") && !ARGV.include?("-f")
46
+ if iteration == 10 && !ARGV.include?("help") && !ARGV.include?("-h") && !ARGV.include?("--help") && !ARGV.include?("--file") && !ARGV.include?("-f")
47
47
  no_database_error
48
48
  else
49
49
  if ARGV.include?("-f") || ARGV.include?("--file")
data/lib/action.rb CHANGED
@@ -75,5 +75,146 @@ module Action
75
75
  names = bugs.collect { |bug| bug.name }
76
76
  return names.uniq
77
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
78
219
  end
79
220
 
data/lib/bug.rb CHANGED
@@ -3,10 +3,10 @@ require_gem 'activerecord'
3
3
 
4
4
  # Fields are name (string), priority (int), area (string), status (boolean).
5
5
  class Bug < ActiveRecord::Base
6
- has_many :bug_descriptions, :exclusively_dependent => true
6
+ has_many :bug_descriptions, :dependent => :delete_all
7
7
  before_create :save_date_time
8
8
  before_update :save_date_time
9
-
9
+
10
10
  # Is the bug open?
11
11
  def open?
12
12
  !status
data/lib/interface.rb CHANGED
@@ -3,14 +3,19 @@ require File.dirname(__FILE__) + "/database.rb"
3
3
  require File.dirname(__FILE__) + "/action.rb"
4
4
  require File.dirname(__FILE__) + "/bug.rb"
5
5
  require File.dirname(__FILE__) + "/bug_description.rb"
6
+ require 'yaml'
6
7
 
7
8
  # The Interface's job is to act as the interface between the user and the Action module. The Interface will make sure that messages are outputted to the user and pass along actions to the Action module depending on whatever the command is.
8
9
  class Interface
9
10
 
10
11
  # Let the tracker interface have access to the bugger - controller
11
12
  def initialize()
12
- @filename = File.basename(__FILE__)
13
- @all_options = ["name", "priority", "area", "description"]
13
+ @filename = "trac"
14
+ config = {}
15
+ if File.exist?(ENV['HOME'] + "/.tracrc")
16
+ config = open(ENV['HOME'] + '/.tracrc') { |f| YAML.load(f) }
17
+ end
18
+ @all_options = ["name", "priority", "area", "description"].delete_if { |i| config.has_key? i }
14
19
  end
15
20
 
16
21
  # Parses ARGV and executes the correct bugger operations
@@ -27,33 +32,42 @@ class Interface
27
32
  if command.include?("append") # Appends a description to existing bug
28
33
  hash = include_name_or_id(hash)
29
34
  hash[:description] = Prompter.description? if !hash.has_key?(:description)
30
- Action::append_description(hash)
35
+ Action.append_description(hash)
31
36
  elsif command.include?("areas")
32
37
  puts "Searched ticket areas are:"
33
- Action::list_areas(hash).each { |area| puts " * " + area }
38
+ Action.list_areas(hash).each { |area| puts " * " + area }
34
39
  elsif command.include?("names")
35
40
  puts "Searched ticket names are:"
36
- Action::list_names(hash).each { |name| puts " * " + name }
41
+ Action.list_names(hash).each { |name| puts " * " + name }
37
42
  elsif command.include?("close") # Closes an existing bug
38
43
  hash = include_name_or_id(hash)
39
- Action::close_bug(hash)
44
+ Action.close_bug(hash)
40
45
  elsif command.include?("delete") # Deletes the bug from the database
41
46
  hash = include_name_or_id(hash)
42
- Action::delete_bug(hash)
47
+ Action.delete_bug(hash)
43
48
  elsif command.include?("list") # Lists either all open bugs or bugs by conditions
44
- bugs = Action::list_bugs(hash)
49
+ bugs = Action.list_bugs(hash)
45
50
  puts bugs.collect { |bug| get_print_info(bug) }.join("\n") if bugs.size > 0
46
51
  elsif command.include?("new") # Creates a new bug
47
52
  set_options(@all_options, hash)
48
- Action::new_bug(hash)
53
+ Action.new_bug(hash)
49
54
  elsif command.include?("open") # Opens a closed bug
50
55
  hash = include_name_or_id(hash)
51
- Action::open_bug(hash)
56
+ Action.open_bug(hash)
52
57
  elsif command.include?("update")
53
58
  hash = include_name_or_id(hash)
54
- Action::update_bug(hash)
59
+ Action.update_bug(hash)
55
60
  elsif command.include?("help") || command.include?("--help") # Prints usage
56
- print_usage
61
+ if !hash.has_key?(:name)
62
+ print_usage
63
+ elsif
64
+ method_name = "help_" + hash[:name]
65
+ if Action.respond_to?(method_name)
66
+ Action.send(method_name)
67
+ else
68
+ puts "The command #{hash[:name]} doesn't exist - try 'trac help' for a list of commands."
69
+ end
70
+ end
57
71
  else
58
72
  puts "Try '#{@filename} help'."
59
73
  end
@@ -112,8 +126,8 @@ class Interface
112
126
  working_string << "Ticket(#{bug.id}): #{bug.name}\n" if bug.id < 10
113
127
  working_string << "Ticket(#{bug.id}): #{bug.name}\n" if bug.id >= 10 && bug.id < 100
114
128
  working_string << "Ticket(#{bug.id}): #{bug.name}\n" if bug.id >= 100
115
- working_string << "Priority: #{bug.priority}\n"
116
- working_string << "Area: #{bug.area}\n"
129
+ working_string << "Priority: #{bug.priority}\n" unless bug.priority.nil?
130
+ working_string << "Area: #{bug.area}\n" unless bug.area.nil?
117
131
  working_string << "Description - #{bug.date_time.to_s(:short)}:\n"
118
132
  descriptions = bug.bug_descriptions.collect { |desc| " * " + desc.description }.join
119
133
  working_string << descriptions
@@ -136,7 +150,7 @@ class Interface
136
150
  puts " close [-i ID | -n NAME]"
137
151
  puts " delete [-i ID | -n NAME]"
138
152
  puts " list [-i ID | -n NAME | -p PRIORITY | -a AREA | -c | -o]"
139
- puts " help"
153
+ puts " help [command]"
140
154
  puts " new [-n NAME | -p PRIORITY | -a AREA | -d DESCRIPTION]"
141
155
  puts " open [-i ID | -n NAME]"
142
156
  puts " update [-i ID | -n NAME | -p PRIORITY | -a AREA]"
@@ -4,7 +4,7 @@ require File.dirname(__FILE__) + "/../lib/action.rb"
4
4
  require File.dirname(__FILE__) + "/../lib/database.rb"
5
5
  require File.dirname(__FILE__) + "/../lib/bug_description.rb"
6
6
 
7
- class TestBugger < Test::Unit::TestCase
7
+ class TestAction < Test::Unit::TestCase
8
8
  def setup
9
9
  Database::connect_to_database(".tracker_db")
10
10
  @bug_names = ["First", "Second", "Third", "Fourth"]
@@ -12,7 +12,8 @@ class TestBugger < Test::Unit::TestCase
12
12
  @bug_priorities = [1, 2, 3, 4]
13
13
  @bug_areas = ["One", "Two", "Three", "Four"]
14
14
  @bug_status = [true, true, false, false]
15
- @descriptions = ["First description", "Second description", "Third description"]
15
+ @descriptions =
16
+ ["First description", "Second description", "Third description"]
16
17
  end
17
18
 
18
19
  def teardown
@@ -23,19 +24,23 @@ class TestBugger < Test::Unit::TestCase
23
24
  end
24
25
 
25
26
  def test_append_description
26
- bug = Bug.create(:name => "test_append_description", :priority => 1, :area => "none")
27
- Action::append_description(:id => bug.id, :description => "Hello")
28
- Action::append_description(:name => "test_append_description", :description => "World")
27
+ bug = Bug.create(:name => "test_append_description",
28
+ :priority => 1, :area => "none")
29
+ Action.append_description(:id => bug.id, :description => "Hello")
30
+ Action.append_description(:name => "test_append_description",
31
+ :description => "World")
29
32
  assert_equal(bug.bug_descriptions[0].description, "Hello")
30
33
  assert_equal(bug.bug_descriptions[1].description, "World")
31
34
  end
32
35
 
33
36
  # An empty description should NOT be appened.
34
37
  def test_append_description_that_is_empty
35
- bug = Bug.create(:name => "test_append_empty_description", :priority => 1, :area => "none")
38
+ bug = Bug.create(:name => "test_append_empty_description",
39
+ :priority => 1, :area => "none")
36
40
  descriptions_to_test = ["", " ", " ", "\n", "\n\n", " \n ", "\n ", " \n"]
37
41
  descriptions_to_test.each do |string|
38
- Action::append_description(:name => "test_append_empty_description", :description => string)
42
+ Action.append_description(:name => "test_append_empty_description",
43
+ :description => string)
39
44
  end
40
45
  bug = Bug.find(bug.id)
41
46
  assert_equal(0, bug.bug_descriptions.size)
@@ -43,7 +48,7 @@ class TestBugger < Test::Unit::TestCase
43
48
 
44
49
  def test_close_bug
45
50
  bug = Bug.find_by_status(false)
46
- Action::close_bug(:id => bug.id)
51
+ Action.close_bug(:id => bug.id)
47
52
  bug = Bug.find_by_id(bug.id)
48
53
  assert(bug.closed?)
49
54
  bug.status = false
@@ -51,39 +56,44 @@ class TestBugger < Test::Unit::TestCase
51
56
  end
52
57
 
53
58
  def test_delete_bug
54
- bug = Bug.create(:name => "test_delete_bug", :priority => 2, :area => "none")
55
- Action::delete_bug(:name => "test_delete_bug")
59
+ bug = Bug.create(:name => "test_delete_bug",
60
+ :priority => 2, :area => "none")
61
+ Action.delete_bug(:name => "test_delete_bug")
56
62
  assert(!Bug.find_by_name("test_delete_bug"))
57
63
  end
58
64
 
59
65
  def test_list_bugs
60
- bugs = Action::list_bugs
66
+ bugs = Action.list_bugs
61
67
  bugs.each { |bug| assert(@bug_names.include?(bug.name)) }
62
- bugs = Action::list_bugs(:name => "First")
68
+ bugs = Action.list_bugs(:name => "First")
63
69
  assert_equal(0, bugs.size)
64
- bugs = Action::list_bugs(:status => false)
70
+ bugs = Action.list_bugs(:status => false)
65
71
  assert_equal(2, bugs.size)
66
72
  end
67
73
 
68
74
  # Make sure the listed bugs with a condition are ALL opened
69
75
  def test_open_list_bugs
70
76
  first = Bug.create(:name => "Another open bug", :area => "Four")
71
- second = Bug.create(:name => "Another closed bug", :area => "Four", :status => true)
72
- bugs = Action::list_bugs(:area => "Four")
77
+ second = Bug.create(:name => "Another closed bug",
78
+ :area => "Four", :status => true)
79
+ bugs = Action.list_bugs(:area => "Four")
73
80
  bugs.each { |bug| assert(bug.open?) }
74
81
  end
75
82
 
76
83
  def test_new_bug
77
- bug = Action::new_bug(:name => "test_new_bug", :priority => 1, :area => "none", :description => "This is a test description")
84
+ bug = Action.new_bug(:name => "test_new_bug",
85
+ :priority => 1, :area => "none",
86
+ :description => "This is a test description")
78
87
  assert(bug)
79
88
  assert(Bug.find_by_name("test_new_bug"))
80
89
  assert_equal(Bug.find_by_name("test_new_bug").name, "test_new_bug")
81
- assert_equal(bug.bug_descriptions[0].description, "This is a test description")
90
+ assert_equal(bug.bug_descriptions[0].description,
91
+ "This is a test description")
82
92
  end
83
93
 
84
94
  def test_open_bug
85
95
  bug = Bug.find_by_status(true)
86
- Action::open_bug(:id => bug.id)
96
+ Action.open_bug(:id => bug.id)
87
97
  bug = Bug.find_by_id(bug.id)
88
98
  assert(bug.open?)
89
99
  bug.status = true
@@ -91,9 +101,11 @@ class TestBugger < Test::Unit::TestCase
91
101
  end
92
102
 
93
103
  def test_update_bug
94
- bug = Bug.create(:name => "test_update_bug", :priority => 1, :area => "none")
104
+ bug = Bug.create(:name => "test_update_bug",
105
+ :priority => 1, :area => "none")
95
106
  assert(bug)
96
- Action::update_bug(:id => bug.id, :name => "new_name", :priority => 2, :area => "Nothing")
107
+ Action.update_bug(:id => bug.id, :name => "new_name",
108
+ :priority => 2, :area => "Nothing")
97
109
  bug = Bug.find_by_id(bug.id)
98
110
  assert_equal("new_name", bug.name)
99
111
  assert_equal("Nothing", bug.area)
@@ -102,34 +114,34 @@ class TestBugger < Test::Unit::TestCase
102
114
 
103
115
  # Should list all _open_ areas
104
116
  def test_list_areas
105
- areas = Action::list_areas
117
+ areas = Action.list_areas
106
118
  known_areas = ["Four", "Three"]
107
119
  areas.each { |area| assert(known_areas.include?(area)) }
108
120
  end
109
121
 
110
122
  # Should list all bug areas with the condition given
111
123
  def test_list_areas_with_conditions
112
- areas = Action::list_areas(:name => "Fourth")
124
+ areas = Action.list_areas(:name => "Fourth")
113
125
  assert_equal("Four", areas[0])
114
- areas = Action::list_areas(:priority => 3)
126
+ areas = Action.list_areas(:priority => 3)
115
127
  assert_equal("Three", areas[0])
116
128
  end
117
129
 
118
130
  # Should list all _open_ bug names
119
131
  def test_list_names
120
- names = Action::list_names
132
+ names = Action.list_names
121
133
  known_names = ["Fourth", "Third"]
122
134
  names.each { |name| assert(known_names.include?(name)) }
123
135
  end
124
136
 
125
137
  # Should list all _open_ bug names with the conditions given
126
138
  def test_list_names_with_conditions
127
- names = Action::list_names(:name => "Third")
139
+ names = Action.list_names(:name => "Third")
128
140
  assert_equal("Third", names[0])
129
- names = Action::list_names(:priority => 2)
141
+ names = Action.list_names(:priority => 2)
130
142
  assert_equal(nil, names[0])
131
- names = Action::list_names(:priority => 2, :status => true)
143
+ names = Action.list_names(:priority => 2, :status => true)
132
144
  assert_equal("Second", names[0])
133
145
  end
134
-
135
- end
146
+
147
+ end
@@ -1,6 +1,8 @@
1
1
  require "test/unit"
2
2
 
3
3
  require File.dirname(__FILE__) + "/../lib/bug.rb"
4
+ require File.dirname(__FILE__) + "/../lib/bug_description.rb"
5
+ require File.dirname(__FILE__) + "/../lib/database.rb"
4
6
 
5
7
  class TestBug < Test::Unit::TestCase
6
8
  def setup
@@ -62,4 +64,4 @@ class TestBug < Test::Unit::TestCase
62
64
  assert_raise(ActiveRecord::RecordNotFound) { Bug.find(id) }
63
65
  end
64
66
 
65
- end
67
+ end
@@ -1,6 +1,7 @@
1
1
  require "test/unit"
2
2
 
3
3
  require File.dirname(__FILE__) + "/../lib/bug_description.rb"
4
+ require File.dirname(__FILE__) + "/../lib/database.rb"
4
5
 
5
6
  class TestBugDescription < Test::Unit::TestCase
6
7
  def setup
@@ -3,7 +3,15 @@ require "test/unit"
3
3
  require File.dirname(__FILE__) + "/../lib/interface.rb"
4
4
 
5
5
  class TestInterface < Test::Unit::TestCase
6
+ def setup
7
+ @interface = Interface.new
8
+ end
9
+
6
10
  def test_truth
7
11
  assert(true, "Test truth.")
8
12
  end
13
+
14
+ def test_parse_help
15
+ assert true
16
+ end
9
17
  end
metadata CHANGED
@@ -3,9 +3,9 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: Tracker
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2006-08-23 00:00:00 -07:00
8
- summary: Command-line bug tracking database application.
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.
9
9
  require_paths:
10
10
  - lib
11
11
  email: bienhd@gmail.com
@@ -28,16 +28,12 @@ cert_chain:
28
28
  authors:
29
29
  - Hugh Bien
30
30
  files:
31
- - bin/fixture.rb
32
- - bin/package
33
31
  - bin/trac
34
- - tests/fixtures.yml
35
- - tests/tc_action.rb
36
- - tests/tc_bug.rb
37
- - tests/tc_bug_description.rb
38
- - tests/tc_integration.rb
39
- - tests/tc_interface.rb
40
- - tests/ts_tracker.rb
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
41
37
  - lib/action.rb
42
38
  - lib/bug.rb
43
39
  - lib/bug_description.rb
@@ -48,8 +44,12 @@ files:
48
44
  - db/migrate
49
45
  - README
50
46
  - MIT-LICENSE
51
- test_files: []
52
-
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
53
53
  rdoc_options: []
54
54
 
55
55
  extra_rdoc_files:
data/bin/fixture.rb DELETED
@@ -1,37 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "yaml"
4
- require "rubygems"
5
- require_gem "activerecord"
6
-
7
- # Load the fixtures file and database
8
- fixtures_file = ARGV[0] || "tests/fixtures.yml"
9
- database = ARGV[1] || ".tracker_db"
10
-
11
- # Load the YAML information
12
- yaml = YAML.load_file(fixtures_file)
13
-
14
- # Connect to the database file
15
- ActiveRecord::Base.establish_connection(
16
- :adapter => "sqlite3",
17
- :database => database
18
- )
19
-
20
- class Bug < ActiveRecord::Base
21
- end
22
-
23
- class BugDescription < ActiveRecord::Base
24
- end
25
-
26
- class String
27
- def to_constant
28
- return Bug if self == "Bug"
29
- return BugDescription if self == "BugDescription"
30
- end
31
- end
32
-
33
- yaml.each_pair do |key, value|
34
- key.to_constant.create( value )
35
- end
36
-
37
-
data/bin/package DELETED
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- cd lib
4
- cat *.rb >> final_package
5
- mv final_package ..
6
- cd ..
7
- cat tracker >> final_package
8
- sed -e 's/^require.*$//g' final_package > temp
9
- rm final_package
10
- cat lib/requires temp > final_package
11
- rm temp
12
- chmod a+x final_package
data/tests/fixtures.yml DELETED
@@ -1,3 +0,0 @@
1
- Bug:
2
- name: Test
3
-
data/tests/ts_tracker.rb DELETED
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Adds current directory - test - and the lib directory to current PATH
4
- $:.unshift File.join(File.dirname(__FILE__))
5
-
6
- # require needed library files
7
- require 'test/unit'
8
- require File.dirname(__FILE__) + "/../lib/database.rb"
9
-
10
- # Run all tests
11
- test_cases = `ls #{File.dirname(__FILE__)}`.split("\n").select{ |f| f =~ /tc.*\.rb/ }.each do |file|
12
- require File.join(File.dirname(__FILE__), file)
13
- end