xli-mm 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/CHANGES +1 -0
  2. data/LICENSE.TXT +203 -0
  3. data/README +99 -0
  4. data/Rakefile +303 -0
  5. data/TODO +58 -0
  6. data/bin/mm +14 -0
  7. data/install.rb +88 -0
  8. data/lib/mm/api/mingle.rb +72 -0
  9. data/lib/mm/api.rb +30 -0
  10. data/lib/mm/command/console.rb +44 -0
  11. data/lib/mm/console/card.rb +70 -0
  12. data/lib/mm/console/card_resource_command.rb +60 -0
  13. data/lib/mm/console/no_resource_command.rb +31 -0
  14. data/lib/mm/console/processor.rb +65 -0
  15. data/lib/mm/console/runtime_variable.rb +18 -0
  16. data/lib/mm/console/select_index_command.rb +13 -0
  17. data/lib/mm/console/selecting_list.rb +57 -0
  18. data/lib/mm/console/simple_command/base.rb +38 -0
  19. data/lib/mm/console/simple_command/clean_cache.rb +22 -0
  20. data/lib/mm/console/simple_command/help.rb +113 -0
  21. data/lib/mm/console/simple_command/open.rb +29 -0
  22. data/lib/mm/console/simple_command/runtime_variables.rb +34 -0
  23. data/lib/mm/console/simple_command/tabs.rb +21 -0
  24. data/lib/mm/console/simple_command/todo.rb +90 -0
  25. data/lib/mm/console/simple_command.rb +7 -0
  26. data/lib/mm/console/system_cmd.rb +51 -0
  27. data/lib/mm/console/transition.rb +23 -0
  28. data/lib/mm/console/view.rb +43 -0
  29. data/lib/mm/mml.tab.rb +468 -0
  30. data/lib/mm/repository.rb +41 -0
  31. data/lib/mm/resource/mingle.rb +50 -0
  32. data/lib/mm/resource.rb +8 -0
  33. data/lib/mm/utils.rb +11 -0
  34. data/lib/mm.rb +23 -0
  35. data/mm.gemspec +32 -0
  36. data/test/api_test.rb +7 -0
  37. data/test/console_test.rb +317 -0
  38. data/test/console_view_test.rb +66 -0
  39. data/test/expectation_helper.rb +57 -0
  40. data/test/help_test.rb +11 -0
  41. data/test/history_test.rb +110 -0
  42. data/test/open_test.rb +73 -0
  43. data/test/selecting_list_test.rb +7 -0
  44. data/test/system_command_test.rb +34 -0
  45. data/test/todo_test.rb +100 -0
  46. data/test/transitions_test.rb +109 -0
  47. metadata +107 -0
@@ -0,0 +1,34 @@
1
+ require File.dirname(__FILE__) + '/expectation_helper'
2
+
3
+ Expectations do
4
+ expect "svn status result" do
5
+ @runtime = $helper.runtime
6
+ @runtime[:api][:execute_cmd, "which \"svn\""] = [0, "/usr/bin/svn\n"]
7
+ @runtime[:api][:execute_cmd, "svn status"] = [0, "svn status result"]
8
+
9
+ processor = MM::Console::Processor.new(@runtime)
10
+ processor.process("svn status")
11
+ end
12
+
13
+ expect "svn status result" do
14
+ @runtime = $helper.runtime
15
+ @runtime[:api][:execute_cmd, "which \"svn\""] = [0, "/usr/bin/svn\n"]
16
+ @runtime[:api][:execute_cmd, "svn status"] = [0, "svn status result"]
17
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
18
+
19
+ processor = MM::Console::Processor.new(@runtime)
20
+ processor.process("#1")
21
+ processor.process("svn status")
22
+ end
23
+
24
+ expect "svn ci result" do
25
+ @runtime = $helper.runtime
26
+ @runtime[:api][:execute_cmd, "which \"svn\""] = [0, "/usr/bin/svn\n"]
27
+ @runtime[:api][:execute_cmd, "svn ci -m 'cant parsed'"] = [0, "svn ci result"]
28
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
29
+
30
+ processor = MM::Console::Processor.new(@runtime)
31
+ processor.process("#1")
32
+ processor.process("svn ci -m 'cant parsed'")
33
+ end
34
+ end
data/test/todo_test.rb ADDED
@@ -0,0 +1,100 @@
1
+ require File.dirname(__FILE__) + '/expectation_helper'
2
+
3
+ #Tags: todo
4
+ Expectations do
5
+ expect '! > Nothing.' do
6
+ @runtime = $helper.runtime
7
+ processor = MM::Console::Processor.new(@runtime)
8
+ processor.process('todo').to_s
9
+ end
10
+
11
+ expect %Q{
12
+ 0) \e[0;33mStart Work: this is important\e[0m
13
+
14
+ ! > Type index number to select item from list.
15
+ } do
16
+ @runtime = $helper.runtime
17
+ processor = MM::Console::Processor.new(@runtime)
18
+ processor.process('todo this is important').to_s
19
+ end
20
+
21
+ expect true do
22
+ @runtime = $helper.runtime
23
+ processor = MM::Console::Processor.new(@runtime)
24
+ processor.process('todo this is important')
25
+ processor.process('todo').to_s.include?('this is important')
26
+ end
27
+
28
+ expect %Q{
29
+ 0) \e[0;33mStart Work: this is important\e[0m
30
+
31
+ ! > Type index number to select item from list.
32
+ } do
33
+ @runtime = $helper.runtime
34
+ processor = MM::Console::Processor.new(@runtime)
35
+ processor.process('todo this is important')
36
+ processor.process('list').to_s
37
+ end
38
+
39
+ expect %Q{
40
+ 0) \e[1;31mComplete: this is important\e[0m
41
+
42
+ ! > Type index number to select item from list.
43
+ } do
44
+ @runtime = $helper.runtime
45
+ processor = MM::Console::Processor.new(@runtime)
46
+ processor.process('todo this is important')
47
+ processor.process('0').to_s
48
+ end
49
+
50
+ expect %Q{
51
+ 0) \e[0;90mDelete: this is important\e[0m
52
+
53
+ ! > Type index number to select item from list.
54
+ } do
55
+ @runtime = $helper.runtime
56
+ processor = MM::Console::Processor.new(@runtime)
57
+ processor.process('todo this is important')
58
+ processor.process('0')
59
+ processor.process('0').to_s
60
+ end
61
+
62
+ expect %Q{
63
+ 0) \e[0;33mStart Work: this should be index 0\e[0m
64
+ 1) \e[0;33mStart Work: this is important\e[0m
65
+
66
+ ! > Type index number to select item from list.
67
+ } do
68
+ @runtime = $helper.runtime
69
+ processor = MM::Console::Processor.new(@runtime)
70
+ processor.process('todo this is important')
71
+ processor.process('todo this should be index 0').to_s
72
+ end
73
+
74
+ expect %Q{
75
+ 0) \e[1;31mComplete: this is important\e[0m
76
+ 1) \e[0;33mStart Work: this should be index 0\e[0m
77
+
78
+ ! > Type index number to select item from list.
79
+ } do
80
+ @runtime = $helper.runtime
81
+ processor = MM::Console::Processor.new(@runtime)
82
+ processor.process('todo this is important')
83
+ processor.process('todo this should be index 0')
84
+ processor.process('1').to_s
85
+ end
86
+
87
+ expect %Q{
88
+ 0) \e[0;33mStart Work: this should be index 0\e[0m
89
+ 1) \e[0;90mDelete: this is important\e[0m
90
+
91
+ ! > Type index number to select item from list.
92
+ } do
93
+ @runtime = $helper.runtime
94
+ processor = MM::Console::Processor.new(@runtime)
95
+ processor.process('todo this is important')
96
+ processor.process('todo this should be index 0')
97
+ processor.process('1')
98
+ processor.process('0').to_s
99
+ end
100
+ end
@@ -0,0 +1,109 @@
1
+ require File.dirname(__FILE__) + '/expectation_helper'
2
+
3
+ Expectations do
4
+ expect 'card transition executed' do
5
+ @runtime = $helper.runtime
6
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
7
+ @runtime[:api][:create_transition_execution, {:transition => 'Start fix', :card => 1, :properties => nil, :comment => nil}] = 'card transition executed'
8
+
9
+ processor = MM::Console::Processor.new(@runtime)
10
+ processor.process('Start fix #1')
11
+ end
12
+
13
+ expect 'card transition executed' do
14
+ @runtime = $helper.runtime
15
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
16
+ @runtime[:api][:create_transition_execution, {:transition => 'start fix', :card => 1, :properties => nil, :comment => nil}] = 'card transition executed'
17
+
18
+ processor = MM::Console::Processor.new(@runtime)
19
+ processor.process('start fix #1')
20
+ end
21
+
22
+ expect 'card transition executed' do
23
+ @runtime = $helper.runtime
24
+ card = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
25
+ @runtime[:api][:find_card_by_number, 1] = card
26
+ @runtime[:api][:card_transitions, card] = ['Start fix']
27
+ @runtime[:api][:create_transition_execution, {:transition => 'start fix', :card => 1, :properties => nil, :comment => nil}] = 'card transition executed'
28
+
29
+ processor = MM::Console::Processor.new(@runtime)
30
+ processor.process('#1')
31
+ processor.process('start fix')
32
+ end
33
+
34
+ expect 'story 1' do
35
+ @runtime = $helper.runtime
36
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
37
+ @runtime[:api][:create_transition_execution, {:transition => 'Start fix', :card => 1, :properties => nil, :comment => nil}] = 'card transition executed successfully'
38
+
39
+ processor = MM::Console::Processor.new(@runtime)
40
+ processor.process('Start fix #1')
41
+ @runtime[:context].to_s
42
+ end
43
+
44
+ expect 'card transition executed' do
45
+ @runtime = $helper.runtime
46
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
47
+ @runtime[:api][:create_transition_execution, {:transition => 'Start fix', :card => 1, :properties => [{:name => 'p', :value => 'v'}], :comment => 'comment'}] = 'card transition executed'
48
+
49
+ processor = MM::Console::Processor.new(@runtime)
50
+ processor.process('#1')
51
+ processor.process('Start fix with p => v (comment)')
52
+ end
53
+
54
+ expect MM::Console::SelectingList.new(['Complete', 'Close'], MM::Console::CardTransition) do
55
+ @runtime = $helper.runtime
56
+ card = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
57
+ @runtime[:api][:find_card_by_number, 1] = card
58
+ @runtime[:api][:card_transitions, card] = ['Complete', 'Close']
59
+
60
+ processor = MM::Console::Processor.new(@runtime)
61
+ processor.process('#1')
62
+ processor.process('transitions')
63
+ end
64
+
65
+ expect 'card transition executed' do
66
+ @runtime = $helper.runtime
67
+ card = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
68
+ @runtime[:api][:find_card_by_number, 1] = card
69
+ @runtime[:api][:card_transitions, card] = ['Complete', 'Close']
70
+ @runtime[:api][:create_transition_execution, {:transition => 'Complete', :card => 1, :properties=>nil, :comment=>nil}] = 'card transition executed'
71
+
72
+ processor = MM::Console::Processor.new(@runtime)
73
+ processor.process('#1')
74
+ processor.process('transitions')
75
+ processor.process('0')
76
+ end
77
+
78
+ expect "card transition executed" do
79
+ @runtime = $helper.runtime
80
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
81
+ @runtime[:api][:create_transition_execution, {:transition => 'Complete fix', :card => 1, :properties => [{:name => 'resolution', :value => 'fixed'}], :comment => nil}] = 'card transition executed'
82
+
83
+ processor = MM::Console::Processor.new(@runtime)
84
+ processor.process('fixed = \'Complete fix with resolution => fixed\'')
85
+ processor.process("#1")
86
+ processor.process('fixed')
87
+ end
88
+
89
+ expect "card transition executed" do
90
+ @runtime = $helper.runtime
91
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
92
+ @runtime[:api][:create_transition_execution, {:transition => 'Complete fix', :card => 1, :properties => [{:name => 'resolution', :value => 'fixed'}], :comment => nil}] = 'card transition executed'
93
+
94
+ processor = MM::Console::Processor.new(@runtime)
95
+ processor.process('fixed = \'Complete fix #1 with resolution => fixed\'')
96
+ processor.process('fixed')
97
+ end
98
+
99
+ expect 'card transition executed' do
100
+ @runtime = $helper.runtime
101
+ @runtime[:api][:find_card_by_number, 1] = $helper.card(:number => 1, :name => 'first card', :card_type_name => 'story')
102
+ @runtime[:api][:create_transition_execution, {:transition => 'Complete fix', :card => 1, :properties => [{:name => 'revision', :value => '2'}], :comment => nil}] = 'card transition executed'
103
+
104
+ processor = MM::Console::Processor.new(@runtime)
105
+ processor.process('#1')
106
+ processor.process('revision = 2')
107
+ processor.process('Complete fix with revision => #{revision}')
108
+ end
109
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xli-mm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Li Xiao
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-08-13 00:00:00 -07:00
13
+ default_executable: mm
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activeresource
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">"
21
+ - !ruby/object:Gem::Version
22
+ version: 2.0.1
23
+ version:
24
+ description:
25
+ email: iam@li-xiao.com
26
+ executables:
27
+ - mm
28
+ extensions: []
29
+
30
+ extra_rdoc_files: []
31
+
32
+ files:
33
+ - lib/mm/api/mingle.rb
34
+ - lib/mm/api.rb
35
+ - lib/mm/command/console.rb
36
+ - lib/mm/console/card.rb
37
+ - lib/mm/console/card_resource_command.rb
38
+ - lib/mm/console/no_resource_command.rb
39
+ - lib/mm/console/processor.rb
40
+ - lib/mm/console/runtime_variable.rb
41
+ - lib/mm/console/select_index_command.rb
42
+ - lib/mm/console/selecting_list.rb
43
+ - lib/mm/console/simple_command/base.rb
44
+ - lib/mm/console/simple_command/clean_cache.rb
45
+ - lib/mm/console/simple_command/help.rb
46
+ - lib/mm/console/simple_command/open.rb
47
+ - lib/mm/console/simple_command/runtime_variables.rb
48
+ - lib/mm/console/simple_command/tabs.rb
49
+ - lib/mm/console/simple_command/todo.rb
50
+ - lib/mm/console/simple_command.rb
51
+ - lib/mm/console/system_cmd.rb
52
+ - lib/mm/console/transition.rb
53
+ - lib/mm/console/view.rb
54
+ - lib/mm/mml.tab.rb
55
+ - lib/mm/repository.rb
56
+ - lib/mm/resource/mingle.rb
57
+ - lib/mm/resource.rb
58
+ - lib/mm/utils.rb
59
+ - lib/mm.rb
60
+ - bin/mm
61
+ - bin
62
+ - CHANGES
63
+ - install.rb
64
+ - lib
65
+ - LICENSE.TXT
66
+ - Rakefile
67
+ - README
68
+ - TODO
69
+ - mm.gemspec
70
+ has_rdoc: false
71
+ homepage: http://github.com/xli/mm/tree/master
72
+ post_install_message:
73
+ rdoc_options: []
74
+
75
+ require_paths:
76
+ - lib
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: "0"
82
+ version:
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ requirements: []
90
+
91
+ rubyforge_project:
92
+ rubygems_version: 1.2.0
93
+ signing_key:
94
+ specification_version: 2
95
+ summary: MM is a development console integrating with Mingle(http://studios.thoughtworks.com/) by Mingle REST API.
96
+ test_files:
97
+ - test/api_test.rb
98
+ - test/console_test.rb
99
+ - test/console_view_test.rb
100
+ - test/expectation_helper.rb
101
+ - test/help_test.rb
102
+ - test/history_test.rb
103
+ - test/open_test.rb
104
+ - test/selecting_list_test.rb
105
+ - test/system_command_test.rb
106
+ - test/todo_test.rb
107
+ - test/transitions_test.rb