codersdojo 1.1.22 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,8 +48,16 @@ class FilenameFormatter
48
48
  end
49
49
 
50
50
  def extract_last_path_item dir_path
51
- last = dir_path.split(ShellWrapper.new.dir_separator).last
52
- last.nil? ? "" : last
51
+ last_separated_by_slash = dir_path.split('/').last
52
+ last_separated_by_native = dir_path.split(ShellWrapper.new.dir_separator).last
53
+ last = [last_separated_by_slash, last_separated_by_native].min_by {|item| item.nil? ? 0 : item.size}
54
+ nil_to_empty_string last
55
+ end
56
+
57
+ private
58
+
59
+ def nil_to_empty_string object
60
+ object.nil? ? "" : object
53
61
  end
54
62
 
55
63
  end
data/app/shell_wrapper.rb CHANGED
@@ -72,7 +72,6 @@ class ShellWrapper
72
72
  }
73
73
  end
74
74
 
75
-
76
75
  def newest_dir_entry dir
77
76
  Dir.new(dir).sort_by do |entry|
78
77
  complete_path = File.join dir, entry
@@ -0,0 +1,25 @@
1
+ // Adapt the code to your code kata %kata_file%.
2
+ // Important: Test and production code has to be
3
+ // completely in this file.
4
+
5
+ require.paths.push(__dirname + '/../lib/');
6
+ require.paths.push(__dirname + '/../deps/');
7
+
8
+ var vows = require('vows'), assert = require('assert');
9
+
10
+ var foo = {
11
+ 'bar' : function() {
12
+ return "fixme"
13
+ }
14
+ };
15
+
16
+ vows.describe("%kata_file%").addBatch({
17
+ '%kata_file%' : {
18
+ topic: function() {
19
+ return foo.bar();
20
+ },
21
+ 'should do something' : function(data) {
22
+ assert.equal(data, "foo.bar");
23
+ }
24
+ }
25
+ }).export(module, {error: false});
@@ -1 +1 @@
1
- codersdojo start vows %kata_file%.js
1
+ codersdojo start "vows %kata_file%.js" %kata_file%.js
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: 63
4
+ hash: 61
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 22
10
- version: 1.1.22
9
+ - 23
10
+ version: 1.1.23
11
11
  platform: ruby
12
12
  authors:
13
13
  - CodersDojo-Team
@@ -106,9 +106,9 @@ files:
106
106
  - templates/javascript.jspec/run-endless.%sh%
107
107
  - templates/javascript.jspec/run-once.%sh%
108
108
  - templates/javascript.jspec/spec.js
109
+ - templates/javascript.vows/%kata_file%-test.js
109
110
  - templates/javascript.vows/README
110
111
  - templates/javascript.vows/run-endless.%sh%
111
- - templates/javascript.vows/spec.js
112
112
  - templates/python.pytest/%kata_file%.py
113
113
  - templates/python.pytest/README
114
114
  - templates/python.pytest/run-endless.%sh%
@@ -1,16 +0,0 @@
1
- // Adapt the code to your code kata %kata_file%.
2
- // Important: Test and production code has to be
3
- // completely in this file.
4
-
5
- describe '%kata_file%'
6
- describe '.foo()'
7
-
8
- function foo() {
9
- return "fixme"
10
- }
11
-
12
- it 'should do something'
13
- foo().should.be "foo"
14
- end
15
- end
16
- end