codersdojo 1.1.11 → 1.1.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ class ArgumentParser
8
8
  @controller = controller
9
9
  end
10
10
 
11
- def parse params
11
+ def parse params
12
12
  command = params[0] ? params[0].downcase : ""
13
13
  if command == "help" then
14
14
  @controller.help params[1]
data/app/console_view.rb CHANGED
@@ -135,10 +135,28 @@ helptext
135
135
  show "Encountered network error while <#{command}>. Is http://www.codersdojo.com down?"
136
136
  end
137
137
 
138
+ def show_kata_exit_message
139
+ show <<-msg
140
+
141
+ You finished your kata. Choose your next action:
142
+ u) Upload the kata to http://www.codersdojo.com.
143
+ e) Exit without uploading.
144
+ r) Resume the kata.
145
+ msg
146
+ end
147
+
148
+ def show_kata_upload_hint
149
+ show "You finished your kata. Now upload it with 'codersdojo upload'."
150
+ end
151
+
138
152
  def show text
139
153
  puts @template_machine.render(text)
140
154
  end
141
155
 
156
+ def read_user_input
157
+ STDIN.gets
158
+ end
159
+
142
160
  def current_command_path
143
161
  $0.gsub '/', '%/%'
144
162
  end
data/app/controller.rb CHANGED
@@ -37,8 +37,11 @@ class Controller
37
37
  dojo = Runner.new @shell, SessionIdGenerator.new
38
38
  dojo.file = file
39
39
  dojo.run_command = command
40
- scheduler = Scheduler.new dojo
40
+ scheduler = Scheduler.new dojo, @view
41
41
  scheduler.start
42
+ if scheduler.last_action_was_upload? then
43
+ upload nil
44
+ end
42
45
  end
43
46
 
44
47
  # merge with 'upload_with_framework' when the framework parameter is removed
data/app/scheduler.rb CHANGED
@@ -1,19 +1,49 @@
1
1
  class Scheduler
2
2
 
3
- def initialize runner
3
+ def initialize runner, view
4
4
  @runner = runner
5
+ @view = view
6
+ @last_action = ""
5
7
  end
6
8
 
7
9
  def start
8
- trap("INT") {
9
- puts "\nYou finished your kata. Now upload it with 'codersdojo upload'."
10
- exit
11
- }
10
+ @last_action = ""
11
+ register_interrupt_listener
12
12
  @runner.start
13
- while true do
13
+ while continue? do
14
14
  sleep 1
15
15
  @runner.execute
16
16
  end
17
17
  end
18
18
 
19
+ def register_interrupt_listener
20
+ trap("INT") {
21
+ interrupt_kata
22
+ }
23
+ end
24
+
25
+ def interrupt_kata
26
+ @view.show_kata_exit_message
27
+ @last_action = @view.read_user_input.downcase
28
+ if last_action_was_exit? then
29
+ @view.show_kata_upload_hint
30
+ end
31
+ end
32
+
33
+ def continue?
34
+ @last_action == '' or last_action_was_resume?
35
+ end
36
+
37
+ def last_action_was_resume?
38
+ @last_action.start_with? 'r'
39
+ end
40
+
41
+ def last_action_was_exit?
42
+ @last_action.start_with? 'e'
43
+ end
44
+
45
+ def last_action_was_upload?
46
+ @last_action.start_with? 'u'
47
+ end
48
+
19
49
  end
data/app/shell_wrapper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'tempfile'
2
2
  require 'shell_process'
3
+ require 'yaml'
3
4
 
4
5
  class ShellWrapper
5
6
 
data/templates/any/README CHANGED
@@ -1,10 +1,11 @@
1
- Two shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-once.%sh% runs your tests once
3
4
  run-endless.%sh% runs your tests endlessly via run-once.%sh%
4
5
 
5
6
  run-once.%sh% is not implemented by now. You have to implement it appropriately.
6
7
 
7
- Run run-endless.%sh% and start your kata.
8
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
8
9
 
9
10
  Assumptions:
10
11
  - The whole kata source code is in the one %kata_file%.
@@ -1 +1,5 @@
1
- echo "Modify shell script run-once.%sh% so that it runs your tests once."
1
+ echo "Modify shell script run-once.%sh% so that it runs your tests once."
2
+ echo "Shell script may look similar to the one for Java with JUnit:"
3
+ echo " %rm% bin/%Kata_file%Test.class <- you don't need this if the language is interpreted"
4
+ echo " javac -cp lib/junit.jar -d bin %Kata_file%Test.java <- you don't need this if the language is interpreted"
5
+ echo " java -cp lib/junit.jar:bin org.junit.runner.JUnitCore %Kata_file%Test"
@@ -1,8 +1,9 @@
1
- Two shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-once.%sh% runs your tests once
3
4
  run-endless.%sh% runs your tests endlessly via run-once.%sh%
4
5
 
5
- Run run-endless.sh and start your kata.
6
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
6
7
 
7
8
  Assumptions:
8
9
  - The whole kata source code is in the one %kata_file%.clj.
@@ -0,0 +1,20 @@
1
+ using System;
2
+ using NUnit.Framework;
3
+
4
+ [TestFixture]
5
+ public class %Kata_file%Test
6
+ {
7
+ [Test]
8
+ public void testFoo()
9
+ {
10
+ Test object_under_test = new Test();
11
+ Assert.AreEqual("foo", object_under_test.foo());
12
+ }
13
+ }
14
+
15
+ public class %Kata_file%
16
+ {
17
+ public String foo(){
18
+ return "fixme";
19
+ }
20
+ }
@@ -0,0 +1,14 @@
1
+ These files were created:
2
+ README is what you are currently reading
3
+ run-once.%sh% runs your tests once
4
+ run-endless.%sh% runs your tests endlessly via run-once.%sh%
5
+
6
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
7
+
8
+ Assumptions:
9
+ - The .Net Framework is installed (from www.microsoft.com).
10
+ - in the Path variable:
11
+ csc (possible path=C:\Windows\Microsoft.NET\Framework\v4.0.30319\)
12
+ nunit-console (possible path=C:\Programme\NUnit 2.5.9\bin\net-2.0\)
13
+ - nunit.framework.dll is in the same directory as %kata_file%.cs.
14
+ - The whole kata source code is in the one %kata_file%.cs.
@@ -0,0 +1 @@
1
+ codersdojo start run-once.cmd %KataFile%.cs
@@ -0,0 +1,2 @@
1
+ csc /nologo /target:library /reference:nunit.framework.dll %KataFile%.cs
2
+ nunit-console %KataFile%.dll /nologo
@@ -1,8 +1,9 @@
1
- Two shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-once.%sh% runs your tests once
3
4
  run-endless.%sh% runs your tests endlessly via run-once.%sh%
4
5
 
5
- Run run-endless.%sh% and start your kata.
6
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
6
7
 
7
8
  Assumptions:
8
9
  - The whole kata source code is in the one %kata_file%.fth.
@@ -1,8 +1,9 @@
1
- Two shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-once.%sh% runs your tests once
3
4
  run-endless.%sh% runs your tests endlessly via run-once.%sh%
4
5
 
5
- Run run-endless.sh and start your kata.
6
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
6
7
 
7
8
  Assumptions:
8
9
  - A Java JDK is installed on your system and 'java' and 'javac' are in the path.
@@ -1,3 +1,3 @@
1
- rm bin/%Kata_file%Test.class
1
+ %rm% bin/%Kata_file%Test.class
2
2
  javac -cp lib/junit.jar -d bin %Kata_file%Test.java
3
3
  java -cp lib/junit.jar:bin org.junit.runner.JUnitCore %Kata_file%Test
@@ -1,8 +1,9 @@
1
- Two shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-once.%sh% runs your tests once
3
4
  run-endless.%sh% runs your tests endlessly via run-once.%sh%
4
5
 
5
- Run run-endless.%sh% and start your kata.
6
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
6
7
 
7
8
  Assumptions:
8
9
  - The whole kata source code is in the one %kata_file%.js.
@@ -1,7 +1,8 @@
1
- One shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-endless.%sh% runs your tests endlessly.
3
4
 
4
- Run run-endless.%sh% and start your kata.
5
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
5
6
 
6
7
  Assumptions:
7
8
  - The whole kata source code is in the one %kata_file%.js.
@@ -1,8 +1,9 @@
1
- Two shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-once.%sh% runs your tests once
3
4
  run-endless.%sh% runs your tests endlessly via run-once.%sh%
4
5
 
5
- Run run-endless.%sh% and start your kata.
6
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
6
7
 
7
8
  Assumptions:
8
9
  - The whole kata source code is in the one %kata_file%.py.
@@ -1,8 +1,9 @@
1
- Two shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-once.%sh% runs your tests once
3
4
  run-endless.%sh% runs your tests endlessly via run-once.%sh%
4
5
 
5
- Run run-endless.%sh% and start your kata.
6
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
6
7
 
7
8
  Assumptions:
8
9
  - The whole kata source code is in the one %kata_file%.py.
@@ -1,8 +1,9 @@
1
- Two shell scripts were created:
1
+ These files were created:
2
+ README is what you are currently reading
2
3
  run-once.%sh% runs your tests once
3
4
  run-endless.%sh% runs your tests endlessly via run-once.%sh%
4
5
 
5
- Run run-endless.%sh% and start your kata.
6
+ Run run-endless.%sh% and start your kata. (On Mac/Linux you have to call ./run-endless.%sh%.)
6
7
 
7
8
  Assumptions:
8
9
  - The whole kata source code is in the one %kata_file%.rb.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codersdojo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 11
10
- version: 1.1.11
9
+ - 12
10
+ version: 1.1.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - CodersDojo-Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-08 00:00:00 +01:00
18
+ date: 2011-02-09 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,6 +34,22 @@ dependencies:
34
34
  version: 1.6.1
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: term-ansicolor
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 29
46
+ segments:
47
+ - 1
48
+ - 0
49
+ - 5
50
+ version: 1.0.5
51
+ type: :runtime
52
+ version_requirements: *id002
37
53
  description: Client executes tests in an endless loop and logs source code and test result for later uplaod.
38
54
  email: codersdojo@it-agile.de
39
55
  executables:
@@ -70,6 +86,10 @@ files:
70
86
  - templates/clojure.is-test/README
71
87
  - templates/clojure.is-test/run-endless.%sh%
72
88
  - templates/clojure.is-test/run-once.%sh%
89
+ - templates/csharp.nunit/%kata_file%.cs
90
+ - templates/csharp.nunit/README
91
+ - templates/csharp.nunit/run-endless.%sh%
92
+ - templates/csharp.nunit/run-once.%sh%
73
93
  - templates/forth.tester/%kata_file%.fth
74
94
  - templates/forth.tester/README
75
95
  - templates/forth.tester/run-endless.%sh%