todorb 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,10 @@
1
+ = todorb 1.2.0, 2010-07-08
2
+ * added search terms for list
3
+ todorb list testing -window # (match testing, but reject window)
4
+ todorb list -- -windows perl python # (reject windows, match perl or python)
5
+ * move lib/common under lib/todorb/common since it was loading wrong
6
+ libs from another gem
7
+
1
8
  = todorb 1.1.1, 2010-06-24
2
9
  * fixed --show-actions option
3
10
  = todorb 1.1.0, 2010-06-23
data/Rakefile CHANGED
@@ -12,8 +12,8 @@ begin
12
12
  gem.authors = ["Rahul Kumar"]
13
13
  gem.rubyforge_project = "todorb"
14
14
  #gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
15
- gem.add_development_dependency "subcommand", ">= 1.0.4"
16
- gem.add_dependency "subcommand", ">= 1.0.4"
15
+ gem.add_development_dependency "subcommand", ">= 1.0.5"
16
+ gem.add_dependency "subcommand", ">= 1.0.5"
17
17
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
18
  end
19
19
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.2.0
@@ -10,9 +10,9 @@
10
10
  =end
11
11
  require 'rubygems'
12
12
  #require 'csv'
13
- require 'common/colorconstants'
14
- require 'common/sed'
15
- require 'common/cmdapp'
13
+ require 'todorb/common/colorconstants'
14
+ require 'todorb/common/sed'
15
+ require 'todorb/common/cmdapp'
16
16
  require 'subcommand'
17
17
  include ColorConstants
18
18
  include Sed
@@ -272,9 +272,17 @@ class Todo
272
272
  end
273
273
  end
274
274
  def list args
275
+ incl, excl = Cmdapp._list_args args
275
276
  populate
276
277
  grep if @options[:grep]
277
278
  filter if @options[:filter]
279
+ @data = Cmdapp.filter_rows( @data, incl) do |row, regexp|
280
+ row[1] =~ regexp
281
+ end
282
+ @data = Cmdapp.filter_rows( @data, excl) do |row, regexp|
283
+ row[1] !~ regexp
284
+ end
285
+
278
286
  sort if @options[:sort]
279
287
  renumber if @options[:renumber]
280
288
  colorize # << currently this is where I print !! Since i colorize the whole line
@@ -208,5 +208,39 @@ module Cmdapp
208
208
  v
209
209
  end
210
210
 
211
+ # separates args to list-like operations
212
+ # +xxx means xxx should match in output
213
+ # -xxx means xxx should not exist in output
214
+ # @param [Array] list of search terms to match or not-match
215
+ # @return [Array, Array] array of terms that should match, and array of terms
216
+ # that should not match.
217
+ def _list_args args
218
+ incl = []
219
+ excl = []
220
+ args.each do |e|
221
+ if e[0] == '+'
222
+ incl << e[1..-1]
223
+ elsif e[0] == '-'
224
+ excl << e[1..-1]
225
+ else
226
+ incl << e
227
+ end
228
+ end
229
+ incl = nil if incl.empty?
230
+ excl = nil if excl.empty?
231
+ return incl, excl
232
+ end
233
+ ##
234
+ # creates a regexp and for each row returns the row and the regexp
235
+ # you can use the regexp on whatever part of the row you want to match or reject
236
+ def filter_rows rows, incl
237
+ if incl
238
+ incl_str = incl.join "|"
239
+ r = Regexp.new incl_str
240
+ #rows = rows.select { |row| row['title'] =~ r }
241
+ rows = rows.select { |row| yield(row, r) }
242
+ end
243
+ rows
244
+ end
211
245
 
212
246
  end
File without changes
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{todorb}
8
- s.version = "1.1.1"
8
+ s.version = "1.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rahul Kumar"]
12
- s.date = %q{2010-06-24}
12
+ s.date = %q{2010-07-08}
13
13
  s.default_executable = %q{todorb}
14
14
  s.description = %q{command-line program that manages a todo list text file, incl subtasks, status, priorities etc }
15
15
  s.email = %q{sentinel1879@gmail.com}
@@ -26,10 +26,10 @@ Gem::Specification.new do |s|
26
26
  "Rakefile",
27
27
  "VERSION",
28
28
  "bin/todorb",
29
- "lib/common/cmdapp.rb",
30
- "lib/common/colorconstants.rb",
31
- "lib/common/sed.rb",
32
29
  "lib/todorb.rb",
30
+ "lib/todorb/common/cmdapp.rb",
31
+ "lib/todorb/common/colorconstants.rb",
32
+ "lib/todorb/common/sed.rb",
33
33
  "tests/Makefile",
34
34
  "tests/README",
35
35
  "tests/aggregate-results.sh",
@@ -68,15 +68,15 @@ Gem::Specification.new do |s|
68
68
  s.specification_version = 3
69
69
 
70
70
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
71
- s.add_development_dependency(%q<subcommand>, [">= 1.0.4"])
72
- s.add_runtime_dependency(%q<subcommand>, [">= 1.0.4"])
71
+ s.add_development_dependency(%q<subcommand>, [">= 1.0.5"])
72
+ s.add_runtime_dependency(%q<subcommand>, [">= 1.0.5"])
73
73
  else
74
- s.add_dependency(%q<subcommand>, [">= 1.0.4"])
75
- s.add_dependency(%q<subcommand>, [">= 1.0.4"])
74
+ s.add_dependency(%q<subcommand>, [">= 1.0.5"])
75
+ s.add_dependency(%q<subcommand>, [">= 1.0.5"])
76
76
  end
77
77
  else
78
- s.add_dependency(%q<subcommand>, [">= 1.0.4"])
79
- s.add_dependency(%q<subcommand>, [">= 1.0.4"])
78
+ s.add_dependency(%q<subcommand>, [">= 1.0.5"])
79
+ s.add_dependency(%q<subcommand>, [">= 1.0.5"])
80
80
  end
81
81
  end
82
82
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1
8
- - 1
9
- version: 1.1.1
7
+ - 2
8
+ - 0
9
+ version: 1.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rahul Kumar
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-24 00:00:00 +05:30
17
+ date: 2010-07-08 00:00:00 +05:30
18
18
  default_executable: todorb
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -27,8 +27,8 @@ dependencies:
27
27
  segments:
28
28
  - 1
29
29
  - 0
30
- - 4
31
- version: 1.0.4
30
+ - 5
31
+ version: 1.0.5
32
32
  type: :development
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
@@ -41,8 +41,8 @@ dependencies:
41
41
  segments:
42
42
  - 1
43
43
  - 0
44
- - 4
45
- version: 1.0.4
44
+ - 5
45
+ version: 1.0.5
46
46
  type: :runtime
47
47
  version_requirements: *id002
48
48
  description: "command-line program that manages a todo list text file, incl subtasks, status, priorities etc "
@@ -62,10 +62,10 @@ files:
62
62
  - Rakefile
63
63
  - VERSION
64
64
  - bin/todorb
65
- - lib/common/cmdapp.rb
66
- - lib/common/colorconstants.rb
67
- - lib/common/sed.rb
68
65
  - lib/todorb.rb
66
+ - lib/todorb/common/cmdapp.rb
67
+ - lib/todorb/common/colorconstants.rb
68
+ - lib/todorb/common/sed.rb
69
69
  - tests/Makefile
70
70
  - tests/README
71
71
  - tests/aggregate-results.sh