cardigan 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -35,7 +35,8 @@ The commands available are (with the awesome power of tab completion):
35
35
  * unclaim <numbers> - removes the owner from the specified cards (by index from the list)
36
36
  * create <name> - creates a card with the specified name
37
37
  * open <name> - creates or opens the card and enters edit mode
38
- * columns - lists or changes the columns to be displayed by the list command
38
+ * display <columns> - lists or changes the columns to be displayed by the list command
39
+ * sort <columns> - lists or changes the columns to be used for sorting by the list command
39
40
  * destroy <numbers> - deletes the specified cards (by index from the list)
40
41
  * set <key> <numbers> - prompts for a field value and sets it on all specified cards (by index from the list)
41
42
  * workflow - enters workflow editing mode
@@ -45,13 +46,13 @@ The commands available are (with the awesome power of tab completion):
45
46
  * quit or exit or ctrl-d - exit
46
47
  * show - dumps the values of all card field values
47
48
  * set <key> - creates a new field and prompts for the new value
48
- * to <status> - changes the status of the card to the given status (the tab completion will be populated with the valid subsequent statuses from the current status)
49
+ * now <status> - changes the status of the card to the given status (the tab completion will be populated with the valid subsequent statuses from the current status)
49
50
 
50
51
  == Workflow mode
51
52
 
52
- Workflow is pretty simple - it is just for convenience in specifiying the set of valid statuses for cards with a specific status.
53
+ Workflow is pretty simple - it is just for convenience in specifiying the set of valid transitions for cards with a specific status.
53
54
 
54
- The only purpose is to populate tab completion in editing mode for a card.
55
+ The only purpose is to populate tab completion for the 'now' command in edit mode for a card.
55
56
 
56
57
  * quit or exit or ctrl-d - exit
57
58
  * show - dumps the current workflow (statuses with their valid subsequent statuses)
@@ -59,6 +60,10 @@ The only purpose is to populate tab completion in editing mode for a card.
59
60
  * add <status> <statuses> - add the specified statuses as valid transitions from status
60
61
  * remove <status> <statuses> - remove the specified statuses as valid transitions from status
61
62
 
63
+ == Walkthroughs
64
+
65
+ In case this documentation makes no sense at all, a few usage scenarios can be found here: http://gist.github.com/331647
66
+
62
67
  == Future plans
63
68
 
64
- Refer to the .cards for detailed story breakdown but importing, exporting and generating pretty html reports/charts.
69
+ Refer to the .cards for detailed story breakdown but importing, exporting, automatic vcs interaction and generating pretty html reports/charts seem to be the most important missing features.
@@ -7,11 +7,10 @@ module Cardigan
7
7
  @repository, @io = repository, io
8
8
  end
9
9
 
10
- def execute name
10
+ def execute text
11
11
  cards = @repository.cards
12
12
  formatter = TextReportFormatter.new @io
13
- a = 0
14
- @repository.columns.each do |column|
13
+ @repository.display_columns.each do |column|
15
14
  formatter.add_column(column, @repository.max_field_length(column))
16
15
  end
17
16
  formatter.output cards
@@ -1,6 +1,6 @@
1
1
  module Cardigan
2
2
  module Command
3
- class SelectColumns
3
+ class SpecifyDisplayColumns
4
4
  def initialize repository, io
5
5
  @repository, @io = repository, io
6
6
  end
@@ -0,0 +1,20 @@
1
+ module Cardigan
2
+ module Command
3
+ class SpecifyDisplayColumns
4
+ def initialize repository, io
5
+ @repository, @io = repository, io
6
+ end
7
+
8
+ def execute text
9
+ if text
10
+ @repository.display_columns = text.scan(/\w+/)
11
+ else
12
+ @io.say "current columns: #{@repository.display_columns.join(',')}"
13
+ columns = Set.new
14
+ @repository.cards.each {|card| columns += card.keys }
15
+ @io.say "available columns: #{columns.sort.join(',')}"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Cardigan
2
+ module Command
3
+ class SpecifySortColumns
4
+ def initialize repository, io
5
+ @repository, @io = repository, io
6
+ end
7
+
8
+ def execute text
9
+ if text
10
+ @repository.sort_columns = text.scan(/\w+/)
11
+ else
12
+ @io.say "current columns: #{@repository.sort_columns.join(',')}"
13
+ columns = Set.new
14
+ @repository.cards.each {|card| columns += card.keys }
15
+ @io.say "available columns: #{columns.sort.join(',')}"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -2,19 +2,24 @@ require 'forwardable'
2
2
 
3
3
  module Cardigan
4
4
  class FilteredRepository
5
- attr_accessor :filter, :columns, :sort
5
+ attr_accessor :filter, :sort_columns, :display_columns
6
6
 
7
7
  extend Forwardable
8
8
 
9
9
  def_delegators :@repository, :refresh, :save, :destroy, :find_or_create
10
10
 
11
- def initialize repository, sort, *columns
12
- @repository, @sort, @columns = repository, sort, columns
11
+ def initialize repository, user, *columns
12
+ @repository, @sort_columns, @display_columns, @user = repository, columns, columns, user
13
13
  end
14
14
 
15
15
  def cards
16
+ me = @user
16
17
  cards = @filter ? @repository.cards.select {|card| eval @filter } : @repository.cards
17
- cards.sort {|a,b| a[sort] <=> b[sort] }
18
+ cards.sort do |a,b|
19
+ a_values = sort_columns.map {|col| a[col] ? a[col] : '' }
20
+ b_values = sort_columns.map {|col| b[col] ? b[col] : '' }
21
+ a_values <=> b_values
22
+ end
18
23
  end
19
24
 
20
25
  def max_field_length name
@@ -11,7 +11,8 @@ require 'cardigan/command/filter_cards'
11
11
  require 'cardigan/command/list_cards'
12
12
  require 'cardigan/command/open_card'
13
13
  require 'cardigan/command/open_workflow'
14
- require 'cardigan/command/select_columns'
14
+ require 'cardigan/command/specify_display_columns'
15
+ require 'cardigan/command/specify_sort_columns'
15
16
  require 'cardigan/command/unclaim_cards'
16
17
  require 'cardigan/command/unfilter_cards'
17
18
 
@@ -20,17 +21,18 @@ module Cardigan
20
21
  include Context
21
22
 
22
23
  def initialize io, repository, name, workflow_repository
23
- @io, @repository, @name, @workflow_repository = io, FilteredRepository.new(repository, 'name', 'name'), name, workflow_repository
24
+ @io, @repository, @name, @workflow_repository = io, FilteredRepository.new(repository, name, 'name'), name, workflow_repository
24
25
  @prompt_text = "#{File.expand_path('.').split('/').last} > "
25
26
  @commands = {
26
27
  'claim' => Command::ClaimCards.new(@repository, @io),
27
- 'columns' => Command::SelectColumns.new(@repository, @io),
28
28
  'create' => Command::CreateCard.new(@repository),
29
29
  'destroy' => Command::DestroyCards.new(@repository, @io),
30
+ 'display' => Command::SpecifyDisplayColumns.new(@repository, @io),
30
31
  'filter' => Command::FilterCards.new(@repository, @io),
31
32
  'list' => Command::ListCards.new(@repository, @io),
32
33
  'open' => Command::OpenCard.new(@repository, @workflow_repository, @io),
33
34
  'set' => Command::BatchUpdateCards.new(@repository, @io),
35
+ 'sort' => Command::SpecifySortColumns.new(@repository, @io),
34
36
  'unclaim' => Command::UnclaimCards.new(@repository, @io),
35
37
  'unfilter' => Command::UnfilterCards.new(@repository),
36
38
  'workflow' => Command::OpenWorkflow.new(@workflow_repository, @io)
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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Ryall
@@ -43,6 +43,8 @@ files:
43
43
  - lib/cardigan/command/open_card.rb
44
44
  - lib/cardigan/command/open_workflow.rb
45
45
  - lib/cardigan/command/select_columns.rb
46
+ - lib/cardigan/command/specify_display_columns.rb
47
+ - lib/cardigan/command/specify_sort_columns.rb
46
48
  - lib/cardigan/command/unclaim_cards.rb
47
49
  - lib/cardigan/command/unfilter_cards.rb
48
50
  - lib/cardigan/context.rb