cardigan 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,8 @@ class Cardigan::Command::CountCards
6
6
  @repository, @io = repository, io
7
7
  end
8
8
 
9
- def execute text=''
9
+ def execute text=nil
10
+ text = '' unless text
10
11
  grouping_fields = text.scan(/\w+/)
11
12
  lengths = Array.new(grouping_fields.size, 0)
12
13
  counts = {}
@@ -0,0 +1,17 @@
1
+ require 'splat'
2
+ require 'cardigan/card_editor'
3
+
4
+ module Cardigan
5
+ module Command
6
+ class EditValue
7
+ def initialize entry, io
8
+ @entry, @io = entry, io
9
+ end
10
+
11
+ def execute key
12
+ value = @entry[key] ? @entry[key] : ''
13
+ Cardigan::CardEditor.new(@entry, @io).set key, value.to_editor
14
+ end
15
+ end
16
+ end
17
+ end
@@ -6,8 +6,12 @@ class Cardigan::Command::TotalCards
6
6
  @repository, @io = repository, io
7
7
  end
8
8
 
9
- def execute text
10
- count_field, *grouping_fields = text.scan(/\w+/)
9
+ def execute text=nil
10
+ count_field, *grouping_fields = text.scan(/\w+/) if text
11
+ unless count_field
12
+ @io.say 'missing required numeric total field'
13
+ return
14
+ end
11
15
  counts = {}
12
16
  @repository.each do |card|
13
17
  key = grouping_fields.map {|grouping_field| card[grouping_field] ? card[grouping_field] : ''}
@@ -10,6 +10,7 @@ module Cardigan
10
10
  @commands = {
11
11
  'now' => command(:change_status, @entry),
12
12
  'set' => command(:change_value, @entry, @io),
13
+ 'edit' => command(:edit_value, @entry, @io),
13
14
  'list' => command(:show_entry, @entry, @io)
14
15
  }
15
16
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Ryall
@@ -14,13 +14,27 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-10 00:00:00 +10:00
17
+ date: 2010-04-11 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: uuidtools
21
+ name: splat
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 1
30
+ - 0
31
+ version: 0.1.0
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: uuidtools
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
24
38
  requirements:
25
39
  - - ~>
26
40
  - !ruby/object:Gem::Version
@@ -30,11 +44,11 @@ dependencies:
30
44
  - 1
31
45
  version: 2.1.1
32
46
  type: :runtime
33
- version_requirements: *id001
47
+ version_requirements: *id002
34
48
  - !ruby/object:Gem::Dependency
35
49
  name: activesupport
36
50
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
51
+ requirement: &id003 !ruby/object:Gem::Requirement
38
52
  requirements:
39
53
  - - ~>
40
54
  - !ruby/object:Gem::Version
@@ -44,7 +58,7 @@ dependencies:
44
58
  - 5
45
59
  version: 2.3.5
46
60
  type: :runtime
47
- version_requirements: *id002
61
+ version_requirements: *id003
48
62
  description: |
49
63
  A command line utility that manages cards as individual files so that they can be added to a version control system
50
64
 
@@ -65,6 +79,7 @@ files:
65
79
  - lib/cardigan/command/count_cards.rb
66
80
  - lib/cardigan/command/create_card.rb
67
81
  - lib/cardigan/command/destroy_cards.rb
82
+ - lib/cardigan/command/edit_value.rb
68
83
  - lib/cardigan/command/export_cards.rb
69
84
  - lib/cardigan/command/filter_cards.rb
70
85
  - lib/cardigan/command/import_cards.rb