codersdojo 1.1.15 → 1.1.16

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.
@@ -24,7 +24,7 @@ class ArgumentParser
24
24
  elsif command == "spec" then
25
25
  # 'spec" is for testing purpose only: do nothing special
26
26
  else
27
- raise ShellArgumentException
27
+ raise ShellArgumentException.new command
28
28
  end
29
29
  end
30
30
 
data/app/codersdojo.rb CHANGED
@@ -22,8 +22,10 @@ class CodersDojo
22
22
  begin
23
23
  arg_parser = ArgumentParser.new controller
24
24
  command = arg_parser.parse @params
25
- rescue ShellArgumentException
26
- controller.help
25
+ rescue ShellArgumentException => e
26
+ view.show_unknwon_command_message e.command
27
+ rescue PropertyFileMissingException => e
28
+ view.show_properties_file_missing_error e.filename
27
29
  end
28
30
  end
29
31
 
data/app/console_view.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'shell_wrapper'
2
2
  require 'text_template_machine'
3
+ require 'property_file_missing_exception'
3
4
 
4
5
  class ConsoleView
5
6
 
@@ -113,6 +114,11 @@ Command #{command} not known. Try '#{current_command_path} help' to list the sup
113
114
  helptext
114
115
  end
115
116
 
117
+ def show_unknwon_command_message command
118
+ show "Command #{command} not known.\n\n"
119
+ show_usage
120
+ end
121
+
116
122
  def show_start_kata command, file, framework
117
123
  show "Starting CodersDojo-Client with command #{command} and kata file #{file} with framework #{framework}. Use Ctrl+C to finish the kata."
118
124
  end
@@ -149,6 +155,14 @@ You finished your kata. Choose your next action:
149
155
  r) Resume the kata.
150
156
  msg
151
157
  end
158
+
159
+ def show_properties_file_missing_error filename
160
+ show <<-msg
161
+ Property file #{filename} is missing.
162
+ Maybe you created the directory structure with an older version of CodersDojo?
163
+ Recreate the directory structure with the current version with 'codersdojo setup ...'.
164
+ msg
165
+ end
152
166
 
153
167
  def show_kata_upload_hint
154
168
  show "You finished your kata. Now upload it with 'codersdojo upload'."
data/app/controller.rb CHANGED
@@ -5,6 +5,7 @@ require 'filename_formatter'
5
5
  class Controller
6
6
 
7
7
  def initialize shell, view, scaffolder, hostname
8
+ @property_filename = '.meta'
8
9
  @shell = shell
9
10
  @view = view
10
11
  @scaffolder = scaffolder
@@ -74,7 +75,7 @@ class Controller
74
75
  end
75
76
 
76
77
  def properties
77
- @shell.read_properties '.meta'
78
+ @shell.read_properties @property_filename
78
79
  end
79
80
 
80
81
  end
@@ -0,0 +1,9 @@
1
+ class PropertyFileMissingException < Exception
2
+
3
+ attr_accessor :filename
4
+
5
+ def initialize filename
6
+ @filename = filename
7
+ end
8
+
9
+ end
@@ -1,3 +1,9 @@
1
1
  class ShellArgumentException < Exception
2
2
 
3
+ attr_accessor :command
4
+
5
+ def initialize command
6
+ @command = command
7
+ end
8
+
3
9
  end
data/app/shell_wrapper.rb CHANGED
@@ -66,6 +66,13 @@ class ShellWrapper
66
66
  Dir.new(dir).entries - ["..", "."]
67
67
  end
68
68
 
69
+ def files_in_dir dir
70
+ Dir.new(dir).entries.find_all{|entry|
71
+ File.file? entry
72
+ }
73
+ end
74
+
75
+
69
76
  def newest_dir_entry dir
70
77
  Dir.new(dir).sort_by do |entry|
71
78
  complete_path = File.join dir, entry
@@ -82,7 +89,11 @@ class ShellWrapper
82
89
  end
83
90
 
84
91
  def read_properties filename
85
- YAML.load_file(filename)
92
+ begin
93
+ YAML.load_file filename
94
+ rescue
95
+ raise PropertyFileMissingException.new filename
96
+ end
86
97
  end
87
98
 
88
99
  def remove_command_name
@@ -1 +1,3 @@
1
1
  framework: clojure.is-test
2
+ source_files: .*\.clj
3
+
@@ -1 +1,2 @@
1
1
  framework: csharp.nunit
2
+ source_files: .*\.cs
@@ -1 +1,2 @@
1
1
  framework: forth.tester
2
+ source_files: .*\.fth
@@ -1 +1,3 @@
1
1
  framework: java.junit
2
+ source_files: .*\.java
3
+
@@ -1 +1,2 @@
1
1
  framework: javascript.jspec
2
+ source_files: .*\.js
@@ -1 +1,3 @@
1
1
  framework: javascript.vows
2
+ source_files: .*\.js
3
+
@@ -1 +1,3 @@
1
1
  framework: python.pytest
2
+ source_files: .*\.py
3
+
@@ -1 +1,3 @@
1
1
  framework: python.pyunit
2
+ source_files: .*\.py
3
+
@@ -1 +1,3 @@
1
1
  framework: ruby.test-unit
2
+ source_files: .*\.rb
3
+
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: 13
4
+ hash: 51
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 15
10
- version: 1.1.15
9
+ - 16
10
+ version: 1.1.16
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-10 00:00:00 +01:00
18
+ date: 2011-02-11 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -65,6 +65,7 @@ files:
65
65
  - app/controller.rb
66
66
  - app/filename_formatter.rb
67
67
  - app/progress.rb
68
+ - app/property_file_missing_exception.rb
68
69
  - app/runner.rb
69
70
  - app/scaffolder.rb
70
71
  - app/scheduler.rb