cardigan 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  A simple command line project task tracking tool.
4
4
 
5
+ == Rationale
6
+
7
+ * command line tools are faster and cooler than any gui or web interface
8
+ * it makes sense to store work items in your source repository
9
+ * tab completion is awesome
10
+
5
11
  == Installation
6
12
 
7
13
  gem install cardigan
@@ -18,27 +24,26 @@ So what now?
18
24
 
19
25
  == Listing mode
20
26
 
21
- You are in listing mode.
27
+ You start in listing mode.
22
28
 
23
29
  The commands available are (with the awesome power of tab completion):
24
30
 
25
- * quit
26
- * exit
31
+ * quit or exit or ctrl-d - exit
27
32
  * list - shows all cards
28
33
  * filter <filter> - sets the filter for cards - this is ruby code such as card[:name].start_with?('a')
29
- * claim <name> - sets the owner of the card
30
- * unclaim <name> - removes the card owner
34
+ * claim <numbers> - sets the owner of the specified cards (by index number from the list view)
35
+ * unclaim <numbers> - removes the owner from the specified cards (by index number from the list view)
31
36
  * create <name> - creates a card with the specified name
32
37
  * open <name> - creates or opens the card and enters edit mode
33
- * columns - changes the list of columns to be displayed
38
+ * columns - lists or changes the columns to be displayed by the list command
34
39
  * destroy <numbers> - deletes the specified cards (by index number from the list view)
35
40
 
36
41
  == Editing mode
37
42
 
38
- * quit
39
- * exit
40
- * set <key> - creates a new key and prompts for the new value
43
+ * quit or exit or ctrl-d - exit
44
+ * show - dumps the values of all card field values
45
+ * set <key> - creates a new field and prompts for the new value
41
46
 
42
47
  == Future plans
43
48
 
44
- Refer to the .cards for detailed story breakdown but mostly importing, exporting and generating pretty html reports/charts.
49
+ Refer to the .cards for detailed story breakdown but mostly simple worflow, importing, exporting and generating pretty html reports/charts.
@@ -6,12 +6,18 @@ module Cardigan
6
6
 
7
7
  def initialize io, entry
8
8
  @io, @entry = io, entry
9
- @prompt_text = "#{File.expand_path('.').split('/').last.slice(0..1)}/#{entry['name']} > "
10
- @commands = ['set']
9
+ @prompt_text = "#{File.expand_path('.').split('/').last.slice(0..0)}/#{entry['name']} > "
10
+ @commands = ['set', 'show']
11
11
  end
12
12
 
13
13
  def set_command key
14
14
  @entry[key] = @io.ask("Enter the new value for #{key}")
15
15
  end
16
+
17
+ def show_command ignored=nil
18
+ @entry.keys.sort.each do |key|
19
+ @io.say "#{key}: #{@entry[key]}"
20
+ end
21
+ end
16
22
  end
17
23
  end
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'uuidtools'
3
+ require 'set'
3
4
  require 'cardigan/context'
4
5
  require 'cardigan/entry_context'
5
6
  require 'cardigan/text_report_formatter'
@@ -16,15 +17,9 @@ module Cardigan
16
17
 
17
18
  def refresh_commands
18
19
  @repository.refresh
19
- @commands = ['create', 'list', 'filter', 'unfilter', 'columns']
20
+ @commands = ['create', 'list', 'filter', 'unfilter', 'columns', 'claim', 'unclaim', 'destroy']
20
21
  @repository.cards.each do |card|
21
22
  @commands << "open #{card['name']}"
22
- @commands << "destroy #{card['name']}"
23
- if card['owner'] == @name
24
- @commands << "unclaim #{card['name']}"
25
- else
26
- @commands << "claim #{card['name']}"
27
- end
28
23
  end
29
24
  end
30
25
 
@@ -32,16 +27,14 @@ module Cardigan
32
27
  @repository.save @repository.find_or_create(name)
33
28
  end
34
29
 
35
- def open_command text
30
+ def open_command name
36
31
  card = @repository.find_or_create(name)
37
32
  EntryContext.new(@io, card).push
38
33
  @repository.save card
39
34
  end
40
35
 
41
- def destroy_command text
42
- cards = sorted_selection
43
- text.scan(/\d+/).each do |n|
44
- card = cards[n.to_i - 1]
36
+ def destroy_command numbers
37
+ each_card_from_indices(numbers) do |card|
45
38
  @io.say "destroying \"#{card['name']}\""
46
39
  @repository.destroy card
47
40
  end
@@ -62,7 +55,16 @@ module Cardigan
62
55
  end
63
56
 
64
57
  def columns_command text
65
- @columns = text.split(',') if text
58
+ if text
59
+ @columns = text.scan(/\w+/)
60
+ else
61
+ @io.say "current columns: #{@columns.join(',')}"
62
+ columns = Set.new
63
+ sorted_selection.each do |card|
64
+ columns += card.keys
65
+ end
66
+ @io.say "available columns: #{columns.sort.join(',')}"
67
+ end
66
68
  end
67
69
 
68
70
  def filter_command code
@@ -76,32 +78,36 @@ module Cardigan
76
78
  end
77
79
  end
78
80
 
79
- def claim_command name
80
- set_key name, 'owner', @name
81
+ def claim_command numbers
82
+ each_card_from_indices(numbers) do |card|
83
+ @io.say "claiming \"#{card['name']}\""
84
+ card['owner'] = @name
85
+ @repository.save card
86
+ end
81
87
  end
82
88
 
83
- def unclaim_command name
84
- set_key name, 'owner', nil
89
+ def unclaim_command numbers
90
+ each_card_from_indices(numbers) do |card|
91
+ @io.say "claiming \"#{card['name']}\""
92
+ card.delete('owner')
93
+ @repository.save card
94
+ end
85
95
  end
86
96
  private
87
- def max_field_length cards, name
88
- cards.map {|v| v[name] ? v[name].length : 0 }.max
97
+ def each_card_from_indices numbers
98
+ cards = sorted_selection
99
+ numbers.scan(/\d+/).each do |n|
100
+ yield cards[n.to_i - 1]
101
+ end
89
102
  end
90
103
 
104
+ def max_field_length cards, name
105
+ cards.map {|card| card[name] ? card[name].length : 0 }.max
106
+ end
107
+
91
108
  def sorted_selection
92
109
  cards = @filter ? @repository.cards.select {|card| eval @filter } : @repository.cards
93
110
  cards.sort {|a,b| a['name'] <=> b['name'] }
94
111
  end
95
-
96
- def set_key name, key, value
97
- card = @repository.find_card(name)
98
- if card
99
- card[key] = value
100
- @repository.save card
101
- else
102
- @io.say "unknown card #{text}"
103
- end
104
- end
105
112
  end
106
113
  end
107
-
@@ -18,7 +18,7 @@ module Cardigan
18
18
  row 'index', @columns.map {|tuple| tuple.first }
19
19
  hline
20
20
  hashes.each_with_index do |h,i|
21
- row i.to_s, @columns.map {|tuple| h[tuple.first]}
21
+ row (i+1).to_s, @columns.map {|tuple| h[tuple.first]}
22
22
  end
23
23
  hline
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cardigan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Ryall
@@ -9,19 +9,9 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-12 00:00:00 +11:00
12
+ date: 2010-03-13 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: highline
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ~>
22
- - !ruby/object:Gem::Version
23
- version: 1.5.1
24
- version:
25
15
  - !ruby/object:Gem::Dependency
26
16
  name: uuidtools
27
17
  type: :runtime
@@ -32,26 +22,6 @@ dependencies:
32
22
  - !ruby/object:Gem::Version
33
23
  version: 2.1.1
34
24
  version:
35
- - !ruby/object:Gem::Dependency
36
- name: crypt
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- version: 1.1.4
44
- version:
45
- - !ruby/object:Gem::Dependency
46
- name: pathname2
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ~>
52
- - !ruby/object:Gem::Version
53
- version: 1.6.3
54
- version:
55
25
  description: |
56
26
  A command line utility that manages cards as individual files so that they can be added to a version control system
57
27