codersdojo 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- data/app/runner.rb +3 -1
- data/app/shell_wrapper.rb +5 -1
- data/spec/runner_spec.rb +4 -4
- metadata +3 -3
data/app/runner.rb
CHANGED
@@ -23,10 +23,12 @@ class Runner
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def execute
|
26
|
-
change_time = @shell.
|
26
|
+
change_time = @shell.modification_time @file
|
27
27
|
if change_time == @previous_change_time then
|
28
|
+
Progress.next
|
28
29
|
return
|
29
30
|
end
|
31
|
+
Progress.end
|
30
32
|
result = @shell.execute @run_command
|
31
33
|
result = TextConverter.new.remove_escape_sequences result
|
32
34
|
state_dir = @filename_formatter.state_dir @session_id, @step
|
data/app/shell_wrapper.rb
CHANGED
@@ -49,10 +49,14 @@ class ShellWrapper
|
|
49
49
|
content
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
52
|
+
def creation_time filename
|
53
53
|
File.new(filename).ctime
|
54
54
|
end
|
55
55
|
|
56
|
+
def modification_time filename
|
57
|
+
File.new(filename).mtime
|
58
|
+
end
|
59
|
+
|
56
60
|
def real_dir_entries dir
|
57
61
|
Dir.new(dir).entries - ["..", "."]
|
58
62
|
end
|
data/spec/runner_spec.rb
CHANGED
@@ -27,11 +27,11 @@ describe Runner, "in run mode" do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should create a state directory for every state" do
|
30
|
-
@shell_mock.should_receive(:
|
30
|
+
@shell_mock.should_receive(:modification_time).with("my_file.rb").and_return 1
|
31
31
|
@shell_mock.should_receive(:mkdir).with "#{STATE_DIR_PREFIX}0"
|
32
32
|
@shell_mock.should_receive(:cp).with "my_file.rb", "#{STATE_DIR_PREFIX}0"
|
33
33
|
@runner.start
|
34
|
-
@shell_mock.should_receive(:
|
34
|
+
@shell_mock.should_receive(:modification_time).with("my_file.rb").and_return 2
|
35
35
|
@shell_mock.should_receive(:mkdir).with "#{STATE_DIR_PREFIX}1"
|
36
36
|
@shell_mock.should_receive(:cp).with "my_file.rb", "#{STATE_DIR_PREFIX}1"
|
37
37
|
@runner.execute
|
@@ -39,11 +39,11 @@ describe Runner, "in run mode" do
|
|
39
39
|
|
40
40
|
it "should not run if the kata file wasn't modified" do
|
41
41
|
a_time = Time.new
|
42
|
-
@shell_mock.should_receive(:
|
42
|
+
@shell_mock.should_receive(:modification_time).with("my_file.rb").and_return a_time
|
43
43
|
@shell_mock.should_receive(:mkdir).with "#{STATE_DIR_PREFIX}0"
|
44
44
|
@shell_mock.should_receive(:cp).with "my_file.rb", "#{STATE_DIR_PREFIX}0"
|
45
45
|
@runner.start
|
46
|
-
@shell_mock.should_receive(:
|
46
|
+
@shell_mock.should_receive(:modification_time).with("my_file.rb").and_return a_time
|
47
47
|
@shell_mock.should_not_receive(:mkdir).with "#{STATE_DIR_PREFIX}1"
|
48
48
|
@shell_mock.should_not_receive(:cp).with "my_file.rb", "#{STATE_DIR_PREFIX}1"
|
49
49
|
@runner.execute
|
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:
|
4
|
+
hash: 11
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 14
|
10
|
+
version: 1.0.14
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- CodersDojo-Team
|