codersdojo 1.1.07 → 1.1.08

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.
@@ -9,17 +9,19 @@ class ArgumentParser
9
9
  end
10
10
 
11
11
  def parse params
12
- command = params[0] ? params[0] : ""
13
- if command.downcase == "help" then
12
+ command = params[0] ? params[0].downcase : ""
13
+ if command == "help" then
14
14
  @controller.help params[1]
15
- elsif command.downcase == "setup" then
15
+ elsif command == "setup" then
16
16
  @controller.generate params[1], params[2] ? params[2] : '<kata_file>'
17
- elsif command.downcase == "upload" then
18
- @controller.upload params[1], params[2]
19
- elsif command.downcase == "start" then
17
+ elsif command == "upload" then
18
+ @controller.upload params[1]
19
+ elsif command == "upload-with-framework" then
20
+ @controller.upload_with_framework params[1], params[2]
21
+ elsif command == "start" then
20
22
  run_command = expand_run_command params[1]
21
23
  @controller.start run_command, params[2]
22
- elsif command.downcase == "spec" then
24
+ elsif command == "spec" then
23
25
  # 'spec" is for testing purpose only: do nothing special
24
26
  else
25
27
  raise ShellArgumentException
data/app/console_view.rb CHANGED
@@ -22,7 +22,13 @@ Commands:
22
22
  help, -h, --help Print this help text.
23
23
  help <command> See the details of the command.
24
24
  setup <framework> <kata_file> Setup the environment for running the kata.
25
- upload <framework> [<session_dir>] Upload the kata to http://www.codersdojo.org
25
+ upload [<session_dir>] Upload the kata to http://www.codersdojo.org
26
+ upload-with-framework <framework> [<session_dir>]
27
+ Upload the kata to http://www.codersdojo.org
28
+ !!! This command exists for compatibility reasons only.
29
+ !!! It will be removed in the near future.
30
+ !!! Please run 'setup' again to generate the .meta file
31
+ !!! and use 'upload' without the 'framework' parameter.
26
32
 
27
33
  Report bugs to <codersdojo@it-agile.de>
28
34
  helptext
@@ -35,6 +41,8 @@ helptext
35
41
  show_help_start
36
42
  elsif command == 'upload' then
37
43
  show_help_upload
44
+ elsif command == 'upload-with-framework' then
45
+ show_help_upload_with_framework
38
46
  else
39
47
  show_help_unknown command
40
48
  end
@@ -66,29 +74,46 @@ helptext
66
74
  end
67
75
 
68
76
  def show_help_upload
69
- templates = @scaffolder.list_templates
70
77
  puts <<-helptext
71
78
 
72
- upload <framework> [<session_directory>] Upload the kata written with <framework> in <session_directory> to codersdojo.com.
79
+ upload Upload the newest kata session in .codersdojo to codersdojo.com.
80
+
81
+ upload <session_directory> Upload the kata <session_directory> to codersdojo.com.
82
+ <session_directory> is relative to the working directory.
83
+
84
+ Examples:
85
+ :/dojo/my_kata$ #{$0} upload
86
+ Upload the newest kata located in directory ".codersdojo" to codersdojo.com.
87
+ :/dojo/my_kata$ #{$0} upload .codersdojo/2010-11-02_16-21-53
88
+ Upload the kata located in directory ".codersdojo/2010-11-02_16-21-53" to codersdojo.com.
89
+ helptext
90
+ end
91
+
92
+ def show_help_upload_with_framework
93
+ templates = @scaffolder.list_templates
94
+ puts <<-helptext
95
+
96
+ upload-with-framework <framework> [<session_directory>]
97
+ Upload the kata written with <framework> in <session_directory> to codersdojo.com.
73
98
  <session_directory> is relative to the working directory.
74
99
  If you don't specify a <session_directory> the newest session in .codersdojo is uploaded.
75
100
  By now <framework> is one of #{templates}.
76
101
  If you used another framework, use ??? and send an email to codersdojo@it-agile.de
77
102
 
78
103
  Example:
79
- :/dojo/my_kata$ #{$0} upload ruby.test-unit .codersdojo/2010-11-02_16-21-53
104
+ :/dojo/my_kata$ #{$0} upload-with-framework ruby.test-unit .codersdojo/2010-11-02_16-21-53
80
105
  Upload the kata (written in Ruby with the test/unit framework) located in directory ".codersdojo/2010-11-02_16-21-53" to codersdojo.com.
81
106
  helptext
82
107
  end
83
-
108
+
84
109
  def show_help_unknown command
85
110
  puts <<-helptext
86
111
  Command #{command} not known. Try '#{$0} help' to list the supported commands.
87
112
  helptext
88
113
  end
89
114
 
90
- def show_start_kata command, file
91
- puts "Starting CodersDojo-Client with command #{command} and kata file #{file}. Use Ctrl+C to finish the kata."
115
+ def show_start_kata command, file, framework
116
+ puts "Starting CodersDojo-Client with command #{command} and kata file #{file} with framework #{framework}. Use Ctrl+C to finish the kata."
92
117
  end
93
118
 
94
119
  def show_missing_command_argument_error command
@@ -96,8 +121,8 @@ helptext
96
121
  show_usage
97
122
  end
98
123
 
99
- def show_upload_start session_directory, hostname
100
- puts "Start upload from #{session_directory} to #{hostname}"
124
+ def show_upload_start session_directory, hostname, framework
125
+ puts "Start upload from #{session_directory} with framework #{framework} to #{hostname}"
101
126
  end
102
127
 
103
128
  def show_upload_result result
data/app/controller.rb CHANGED
@@ -33,20 +33,27 @@ class Controller
33
33
  @view.show_missing_command_argument_error "start"
34
34
  return
35
35
  end
36
- @view.show_start_kata command, file
37
- dojo = Runner.new ShellWrapper.new, SessionIdGenerator.new
36
+ @view.show_start_kata command, file, framework_property
37
+ dojo = Runner.new @shell, SessionIdGenerator.new
38
38
  dojo.file = file
39
39
  dojo.run_command = command
40
40
  scheduler = Scheduler.new dojo
41
41
  scheduler.start
42
42
  end
43
43
 
44
- def upload framework, session_directory
44
+ # merge with 'upload_with_framework' when the framework parameter is removed
45
+ def upload session_directory
46
+ upload_with_framework framework_property, session_directory
47
+ end
48
+
49
+ # framework parameter is obsolete since client version 1.1.08 (08-feb-2011)
50
+ # it stays here for compatibility reasons and will be removed in the near future
51
+ def upload_with_framework framework, session_directory
45
52
  formatter = FilenameFormatter.new
46
53
  if not session_directory then
47
54
  session_directory = formatter.session_dir @shell.newest_dir_entry(FilenameFormatter.codersdojo_workspace)
48
55
  end
49
- @view.show_upload_start session_directory, @hostname
56
+ @view.show_upload_start session_directory, @hostname, framework
50
57
  uploader = Uploader.new @hostname, framework, session_directory
51
58
  upload_result = uploader.upload
52
59
  @view.show_upload_result upload_result
@@ -54,5 +61,13 @@ class Controller
54
61
  @shell.open_with_default_app url
55
62
  end
56
63
 
64
+ def framework_property
65
+ properties['framework']
66
+ end
67
+
68
+ def properties
69
+ @shell.read_properties '.meta'
70
+ end
71
+
57
72
  end
58
73
 
data/app/shell_wrapper.rb CHANGED
@@ -77,6 +77,10 @@ class ShellWrapper
77
77
  execute "#{open_command_name} #{filename}"
78
78
  end
79
79
 
80
+ def read_properties filename
81
+ YAML.load_file(filename)
82
+ end
83
+
80
84
  def remove_command_name
81
85
  windows? ? 'del' : 'rm'
82
86
  end
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: 29
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 7
10
- version: 1.1.07
9
+ - 8
10
+ version: 1.1.08
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-04 00:00:00 +01:00
18
+ date: 2011-02-08 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency