codersdojo 1.5.05 → 1.5.06
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.
data/lib/argument_parser.rb
CHANGED
@@ -12,6 +12,7 @@ require 'commands/capture_single_run_command'
|
|
12
12
|
require 'commands/revert_to_green_command'
|
13
13
|
require 'commands/upload_command'
|
14
14
|
require 'commands/upload_no_open_command'
|
15
|
+
require 'commands/upload_zipped_session_command'
|
15
16
|
require 'commands/start_command'
|
16
17
|
|
17
18
|
class ArgumentParser
|
@@ -24,13 +25,14 @@ class ArgumentParser
|
|
24
25
|
@generate_command = GenerateCommand.new shell, view, scaffolder
|
25
26
|
@upload_command = UploadCommand.new shell, view, hostname
|
26
27
|
@upload_no_open_command = UploadNoOpenCommand.new @upload_command
|
28
|
+
@upload_zipped_session_command = UploadZippedSessionCommand.new shell, view, hostname
|
27
29
|
@init_session_command = InitSessionCommand.new view, runner
|
28
30
|
@capture_single_run_command = CaptureSingleRunCommand.new shell, view, runner
|
29
31
|
@revert_to_green_command = RevertToGreenCommand.new shell, view, meta_config_file, StateReader.new(shell)
|
30
32
|
@start_command = StartCommand.new meta_config_file, runner, view, [@upload_command, @revert_to_green_command]
|
31
33
|
@commands = [@help_command, @xhelp_command, @generate_command, @init_session_command,
|
32
34
|
@capture_single_run_command, @start_command, @revert_to_green_command,
|
33
|
-
@upload_command, @upload_no_open_command]
|
35
|
+
@upload_command, @upload_no_open_command, @upload_zipped_session_command]
|
34
36
|
end
|
35
37
|
|
36
38
|
def parse params
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'meta_config_file'
|
2
|
+
require 'upload/uploader'
|
3
|
+
|
4
|
+
class UploadZippedSessionCommand
|
5
|
+
|
6
|
+
attr_accessor :uploader
|
7
|
+
|
8
|
+
def initialize shell, view, hostname
|
9
|
+
@shell = shell
|
10
|
+
@view = view
|
11
|
+
@hostname = hostname
|
12
|
+
@uploader = Uploader.new(hostname, '', '')
|
13
|
+
@meta_file = MetaConfigFile.new @shell
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute
|
17
|
+
upload nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def execute_from_shell params
|
21
|
+
upload params[1]
|
22
|
+
end
|
23
|
+
|
24
|
+
def upload session_directory, open_browser=true
|
25
|
+
formatter = FilenameFormatter.new
|
26
|
+
framework = @meta_file.framework_property
|
27
|
+
if not session_directory then
|
28
|
+
session_directory = formatter.session_dir @shell.newest_dir_entry(FilenameFormatter.codersdojo_workspace)
|
29
|
+
end
|
30
|
+
@view.show_upload_start session_directory, @hostname, framework
|
31
|
+
@uploader.framework = framework
|
32
|
+
@uploader.session_dir = session_directory
|
33
|
+
upload_result = @uploader.upload_zipped_session
|
34
|
+
@view.show_upload_result upload_result
|
35
|
+
url = upload_result.split.last
|
36
|
+
if open_browser then
|
37
|
+
@shell.open_with_default_app url
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def command_key
|
42
|
+
'z'
|
43
|
+
end
|
44
|
+
|
45
|
+
def accepts_shell_command? command
|
46
|
+
command == 'upload-zip'
|
47
|
+
end
|
48
|
+
|
49
|
+
def continue_test_loop?
|
50
|
+
false
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
data/lib/console_view.rb
CHANGED
@@ -43,6 +43,7 @@ Commands:
|
|
43
43
|
init-session Create a new session dir within the .codersdojo dir.
|
44
44
|
capture-single-run <shell_command> <kata_file> Capture a single run.
|
45
45
|
start <shell_command> <kata_file> Start the continuous test loop.
|
46
|
+
upload-zip [<session_dir>] Upload session as a ZIP file (beta feature)
|
46
47
|
helptext
|
47
48
|
end
|
48
49
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "meta_config_file"
|
1
2
|
require "record/text_converter"
|
2
3
|
require "record/return_code_evaluator"
|
3
4
|
|
@@ -18,6 +19,7 @@ class StateRecorder
|
|
18
19
|
session_dir = @filename_formatter.session_dir @session_id
|
19
20
|
@shell.mkdir_p session_dir
|
20
21
|
session_dir
|
22
|
+
@shell.cp MetaConfigFile::PROPERTY_FILENAME, session_dir
|
21
23
|
end
|
22
24
|
|
23
25
|
def record_state files, process
|
@@ -31,7 +33,7 @@ class StateRecorder
|
|
31
33
|
@shell.mkdir state_dir
|
32
34
|
@shell.cp_r files, state_dir
|
33
35
|
write_result_file state_dir, result
|
34
|
-
write_info_file
|
36
|
+
write_info_file(state_dir, {:return_code => return_code, :date => "'#{date}'", :time => "'#{time}'", :step => @step})
|
35
37
|
@step += 1
|
36
38
|
end
|
37
39
|
|
data/lib/upload/uploader.rb
CHANGED
@@ -32,7 +32,6 @@ class Uploader
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def upload_kata_and_states
|
35
|
-
# upload_zipped_kata zip_kata
|
36
35
|
read_states
|
37
36
|
kata = upload_kata
|
38
37
|
finish_url = "#{@hostname}#{@@description_path}/#{XMLElementExtractor.extract('kata/private-uuid', kata)}"
|
@@ -55,12 +54,16 @@ class Uploader
|
|
55
54
|
RestClient.post "#{@hostname}#{@@kata_path}", kata_data
|
56
55
|
end
|
57
56
|
|
57
|
+
def upload_zipped_session
|
58
|
+
private_url = upload_zipped_kata zip_kata
|
59
|
+
"Complete kata information at #{private_url}"
|
60
|
+
end
|
61
|
+
|
58
62
|
def zip_kata
|
59
63
|
SessionZipper.new.compress @session_dir
|
60
64
|
end
|
61
65
|
|
62
66
|
def upload_zipped_kata zip_file_name
|
63
|
-
# RestClient.post "#{@hostname}#{@@zipped_kata_path}", {:zipped_kata => zip_file}
|
64
67
|
RestClient::Resource.new("#{@hostname}#{@@zipped_kata_path}").post(:transfer => { :path => "kata.zip" }, :upload => File.new(zip_file_name, 'rb'))
|
65
68
|
end
|
66
69
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 1.5.
|
8
|
+
- 6
|
9
|
+
version: 1.5.06
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- CodersDojo-Team
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-09-
|
17
|
+
date: 2011-09-26 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -64,13 +64,13 @@ dependencies:
|
|
64
64
|
prerelease: false
|
65
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - "="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
segments:
|
70
70
|
- 0
|
71
71
|
- 0
|
72
|
-
-
|
73
|
-
version: 0.0.
|
72
|
+
- 8
|
73
|
+
version: 0.0.8
|
74
74
|
type: :runtime
|
75
75
|
version_requirements: *id004
|
76
76
|
description: Client executes tests in an endless loop and logs source code and test result for later uplaod.
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/commands/start_command.rb
|
93
93
|
- lib/commands/upload_command.rb
|
94
94
|
- lib/commands/upload_no_open_command.rb
|
95
|
+
- lib/commands/upload_zipped_session_command.rb
|
95
96
|
- lib/commands/xhelp_command.rb
|
96
97
|
- lib/console_view.rb
|
97
98
|
- lib/filename_formatter.rb
|