codersdojo 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/app/controller.rb CHANGED
@@ -19,8 +19,13 @@ class Controller
19
19
  end
20
20
 
21
21
  def generate framework, kata_file
22
- @scaffolder.scaffold framework, kata_file
23
- puts "\n" + @shell.read_file("README")
22
+ begin
23
+ @scaffolder.scaffold framework, kata_file
24
+ puts "\n" + @shell.read_file("README")
25
+ rescue
26
+ puts "Unkown framework #{framework}. Possible frameworks:"
27
+ puts @scaffolder.list_templates
28
+ end
24
29
  end
25
30
 
26
31
  def start command, file
data/app/scaffolder.rb CHANGED
@@ -27,19 +27,15 @@ class Scaffolder
27
27
 
28
28
  def scaffold template, kata_file
29
29
  @template_machine.placeholder_values['kata_file'] = kata_file
30
- begin
30
+ template = template == '???' ? ANY_TEMPLATE : template
31
31
  dir_path = "#{template_path}/#{template}"
32
32
  to_copy = @shell.real_dir_entries dir_path
33
- rescue
34
- dir_path = "#{template_path}/#{ANY_TEMPLATE}"
35
- to_copy = @shell.real_dir_entries dir_path
36
- end
37
- to_copy.each do |item|
38
- file_path = "#{dir_path}/#{item}"
39
- @shell.cp_r file_path, "."
40
- transform_file_content item
41
- transform_file_name item
42
- end
33
+ to_copy.each do |item|
34
+ file_path = "#{dir_path}/#{item}"
35
+ @shell.cp_r file_path, "."
36
+ transform_file_content item
37
+ transform_file_name item
38
+ end
43
39
  end
44
40
 
45
41
  def transform_file_content filename
data/app/shell_wrapper.rb CHANGED
@@ -54,8 +54,7 @@ class ShellWrapper
54
54
  end
55
55
 
56
56
  def real_dir_entries dir
57
- current_and_parent = 2
58
- Dir.new(dir).entries.drop current_and_parent
57
+ Dir.new(dir).entries - ["..", "."]
59
58
  end
60
59
 
61
60
  def file? filename
@@ -29,14 +29,6 @@ describe Scaffolder do
29
29
  @scaffolder.scaffold "a.template", 'myKata'
30
30
  end
31
31
 
32
- it "should use 'any' when the given template doesn't exist" do
33
- @shell_mock.should_receive(:real_dir_entries).with("aDir/templates/unknown.template").and_throw Exception
34
- @shell_mock.should_receive(:real_dir_entries).with("aDir/templates/any").and_return ["a"]
35
- @shell_mock.should_receive(:cp_r).with "aDir/templates/any/a", "."
36
- @shell_mock.should_receive(:file?).with("a").and_return false
37
- @scaffolder.scaffold "unknown.template", 'myKata'
38
- end
39
-
40
32
  it "should replace placeholder in template file README and shell scripts" do
41
33
  @shell_mock.should_receive(:real_dir_entries).with("aDir/templates/a.template").
42
34
  and_return ["a", "README", "run-once.sh", "run-endless.sh"]
@@ -7,6 +7,7 @@ Run run-endless.sh and start your kata.
7
7
  Assumptions:
8
8
  - A Java JDK is installed on your system and 'java' and 'javac' are in the path.
9
9
  - junit.jar is placed in the 'lib' directory.
10
+ - junit.jar contains JUnit 4.
10
11
  - The whole kata source code is in the one %Kata_file%Test.java.
11
12
  - The kata source file is placed in the 'src' directory.
12
13
  - The kata class file is generated into the 'bin' directory.
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: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 12
10
- version: 1.0.12
9
+ - 13
10
+ version: 1.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - CodersDojo-Team