codersdojo 1.4.07 → 1.5.00
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/bin/codersdojo +1 -1
- data/{app → lib}/argument_parser.rb +9 -9
- data/{app → lib}/scaffolder.rb +5 -1
- metadata +25 -40
- data/app/capture_single_run_command.rb +0 -36
- data/app/filename.rb +0 -61
- data/app/generate_command.rb +0 -34
- data/app/help_command.rb +0 -27
- data/app/init_session_command.rb +0 -27
- data/app/progress.rb +0 -19
- data/app/revert_to_green_command.rb +0 -52
- data/app/session_zipper.rb +0 -19
- data/app/shell_argument_exception.rb +0 -9
- data/app/shell_process.rb +0 -5
- data/app/shell_wrapper.rb +0 -161
- data/app/start_command.rb +0 -35
- data/app/upload_command.rb +0 -53
- data/app/upload_no_open_command.rb +0 -23
- data/app/xhelp_command.rb +0 -23
- /data/{app → lib}/codersdojo.rb +0 -0
- /data/{app → lib}/console_view.rb +0 -0
- /data/{app → lib}/filename_formatter.rb +0 -0
- /data/{app → lib}/info_property_file.rb +0 -0
- /data/{app → lib}/meta_config_file.rb +0 -0
- /data/{app → lib}/property_file_missing_exception.rb +0 -0
- /data/{app → lib}/return_code_evaluator.rb +0 -0
- /data/{app → lib}/runner.rb +0 -0
- /data/{app → lib}/scheduler.rb +0 -0
- /data/{app → lib}/session_id_generator.rb +0 -0
- /data/{app → lib}/state.rb +0 -0
- /data/{app → lib}/state_reader.rb +0 -0
- /data/{app → lib}/text_converter.rb +0 -0
- /data/{app → lib}/text_template_machine.rb +0 -0
- /data/{app → lib}/uploader.rb +0 -0
- /data/{app → lib}/xml_element_extractor.rb +0 -0
data/bin/codersdojo
CHANGED
@@ -14,7 +14,7 @@ msg
|
|
14
14
|
end
|
15
15
|
|
16
16
|
show_update_message_when_old
|
17
|
-
codersdojo_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', '
|
17
|
+
codersdojo_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
18
18
|
$LOAD_PATH.unshift(codersdojo_dir) unless $LOAD_PATH.include?(codersdojo_dir)
|
19
19
|
require 'codersdojo'
|
20
20
|
CodersDojo.new(ARGV).run
|
@@ -5,15 +5,15 @@ require 'shell_wrapper'
|
|
5
5
|
require 'console_view'
|
6
6
|
require 'return_code_evaluator'
|
7
7
|
require 'state_reader'
|
8
|
-
require 'help_command'
|
9
|
-
require 'xhelp_command'
|
10
|
-
require 'generate_command'
|
11
|
-
require 'init_session_command'
|
12
|
-
require 'capture_single_run_command'
|
13
|
-
require 'revert_to_green_command'
|
14
|
-
require 'upload_command'
|
15
|
-
require 'upload_no_open_command'
|
16
|
-
require 'start_command'
|
8
|
+
require 'commands/help_command'
|
9
|
+
require 'commands/xhelp_command'
|
10
|
+
require 'commands/generate_command'
|
11
|
+
require 'commands/init_session_command'
|
12
|
+
require 'commands/capture_single_run_command'
|
13
|
+
require 'commands/revert_to_green_command'
|
14
|
+
require 'commands/upload_command'
|
15
|
+
require 'commands/upload_no_open_command'
|
16
|
+
require 'commands/start_command'
|
17
17
|
|
18
18
|
class ArgumentParser
|
19
19
|
|
data/{app → lib}/scaffolder.rb
RENAMED
@@ -60,10 +60,14 @@ class Scaffolder
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def template_path
|
63
|
-
file_path_elements =
|
63
|
+
file_path_elements = Scaffolder::current_file.split '/'
|
64
64
|
file_path_elements[-2..-1] = nil
|
65
65
|
(file_path_elements << 'templates').join '/'
|
66
66
|
end
|
67
67
|
|
68
|
+
def self.current_file
|
69
|
+
__FILE__
|
70
|
+
end
|
71
|
+
|
68
72
|
end
|
69
73
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
7
|
+
- 5
|
8
|
+
- 0
|
9
|
+
version: 1.5.00
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- CodersDojo-Team
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
type: :runtime
|
61
61
|
version_requirements: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: shell-utils
|
64
64
|
prerelease: false
|
65
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
@@ -68,9 +68,9 @@ dependencies:
|
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
segments:
|
70
70
|
- 0
|
71
|
-
-
|
72
|
-
-
|
73
|
-
version: 0.
|
71
|
+
- 0
|
72
|
+
- 1
|
73
|
+
version: 0.0.1
|
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.
|
@@ -82,39 +82,24 @@ extensions: []
|
|
82
82
|
extra_rdoc_files: []
|
83
83
|
|
84
84
|
files:
|
85
|
-
-
|
86
|
-
-
|
87
|
-
-
|
88
|
-
-
|
89
|
-
-
|
90
|
-
-
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
-
|
95
|
-
-
|
96
|
-
-
|
97
|
-
-
|
98
|
-
-
|
99
|
-
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
103
|
-
- app/session_id_generator.rb
|
104
|
-
- app/session_zipper.rb
|
105
|
-
- app/shell_argument_exception.rb
|
106
|
-
- app/shell_process.rb
|
107
|
-
- app/shell_wrapper.rb
|
108
|
-
- app/start_command.rb
|
109
|
-
- app/state.rb
|
110
|
-
- app/state_reader.rb
|
111
|
-
- app/text_converter.rb
|
112
|
-
- app/text_template_machine.rb
|
113
|
-
- app/upload_command.rb
|
114
|
-
- app/upload_no_open_command.rb
|
115
|
-
- app/uploader.rb
|
116
|
-
- app/xhelp_command.rb
|
117
|
-
- app/xml_element_extractor.rb
|
85
|
+
- lib/argument_parser.rb
|
86
|
+
- lib/codersdojo.rb
|
87
|
+
- lib/console_view.rb
|
88
|
+
- lib/filename_formatter.rb
|
89
|
+
- lib/info_property_file.rb
|
90
|
+
- lib/meta_config_file.rb
|
91
|
+
- lib/property_file_missing_exception.rb
|
92
|
+
- lib/return_code_evaluator.rb
|
93
|
+
- lib/runner.rb
|
94
|
+
- lib/scaffolder.rb
|
95
|
+
- lib/scheduler.rb
|
96
|
+
- lib/session_id_generator.rb
|
97
|
+
- lib/state.rb
|
98
|
+
- lib/state_reader.rb
|
99
|
+
- lib/text_converter.rb
|
100
|
+
- lib/text_template_machine.rb
|
101
|
+
- lib/uploader.rb
|
102
|
+
- lib/xml_element_extractor.rb
|
118
103
|
- templates/any/README
|
119
104
|
- templates/any/run-endless.%sh%
|
120
105
|
- templates/any/run-once.%sh%
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'runner'
|
2
|
-
|
3
|
-
class CaptureSingleRunCommand
|
4
|
-
|
5
|
-
COMMAND_NAME = 'capture-single-run'
|
6
|
-
|
7
|
-
def initialize shell, view, runner
|
8
|
-
@shell = shell
|
9
|
-
@view = view
|
10
|
-
@runner = runner
|
11
|
-
end
|
12
|
-
|
13
|
-
def execute_from_shell params
|
14
|
-
unless params[1] then @view.show_missing_command_argument_error COMMAND_NAME, "shell_command"; return end
|
15
|
-
unless params[2] then @view.show_missing_command_argument_error COMMAND_NAME, "kata_file"; return end
|
16
|
-
capture_single_run params[1], params[2]
|
17
|
-
end
|
18
|
-
|
19
|
-
def capture_single_run run_command, kata_file
|
20
|
-
@runner.run_command = run_command
|
21
|
-
session_id = @shell.newest_dir_entry(FilenameFormatter.codersdojo_workspace)
|
22
|
-
filename_formatter = FilenameFormatter.new
|
23
|
-
last_state_dir = @shell.newest_dir_entry(filename_formatter.session_dir session_id)
|
24
|
-
step = last_state_dir.nil? ? 0 : filename_formatter.step_number_from_state_dir(last_state_dir) + 1
|
25
|
-
@runner.execute_once kata_file, session_id, step
|
26
|
-
end
|
27
|
-
|
28
|
-
def accepts_shell_command? command
|
29
|
-
command == COMMAND_NAME
|
30
|
-
end
|
31
|
-
|
32
|
-
def continue_test_loop?
|
33
|
-
false
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/app/filename.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
class Filename
|
2
|
-
|
3
|
-
DIR_SEPARATOR = '/'
|
4
|
-
WINDOWS_DIR_SEPARATOR = '\\'
|
5
|
-
|
6
|
-
attr_accessor :path_items
|
7
|
-
|
8
|
-
def initialize filename
|
9
|
-
filename = filename.gsub(WINDOWS_DIR_SEPARATOR, DIR_SEPARATOR)
|
10
|
-
@path_items = filename.split(DIR_SEPARATOR).delete_if{|item| item.empty?}
|
11
|
-
@absolute_path = filename.start_with? DIR_SEPARATOR
|
12
|
-
end
|
13
|
-
|
14
|
-
def absolute_path?
|
15
|
-
@absolute_path
|
16
|
-
end
|
17
|
-
|
18
|
-
def relative_path?
|
19
|
-
not absolute_path?
|
20
|
-
end
|
21
|
-
|
22
|
-
def without_extension
|
23
|
-
if @path_items.size > 0 and @path_items.last.include? '.' then
|
24
|
-
Filename.new(to_s.split('.')[0..-2].join('.'))
|
25
|
-
else
|
26
|
-
clone
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def extract_last_path_item
|
31
|
-
Filename.new(nil_to_empty_string @path_items.last)
|
32
|
-
end
|
33
|
-
|
34
|
-
def remove_last_path_item
|
35
|
-
Filename.new(make_string(@path_items[0..-2]))
|
36
|
-
end
|
37
|
-
|
38
|
-
def to_unix_s
|
39
|
-
make_string @path_items
|
40
|
-
end
|
41
|
-
|
42
|
-
def to_windows_s
|
43
|
-
make_string @path_items, WINDOWS_DIR_SEPARATOR
|
44
|
-
end
|
45
|
-
|
46
|
-
def to_s
|
47
|
-
to_unix_s
|
48
|
-
end
|
49
|
-
|
50
|
-
private
|
51
|
-
|
52
|
-
def make_string the_path_items, seperator=DIR_SEPARATOR
|
53
|
-
prefix = absolute_path? ? seperator : ''
|
54
|
-
prefix + the_path_items.join(seperator)
|
55
|
-
end
|
56
|
-
|
57
|
-
def nil_to_empty_string object
|
58
|
-
object.nil? ? "" : object
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
data/app/generate_command.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
class GenerateCommand
|
2
|
-
|
3
|
-
def initialize shell, view, scaffolder
|
4
|
-
@shell = shell
|
5
|
-
@view = view
|
6
|
-
@scaffolder = scaffolder
|
7
|
-
end
|
8
|
-
|
9
|
-
def execute_from_shell params
|
10
|
-
generate params[1], params[2]
|
11
|
-
end
|
12
|
-
|
13
|
-
def generate framework, kata_file
|
14
|
-
if not kata_file then
|
15
|
-
@view.show_missing_command_argument_error "setup", "kata_file"
|
16
|
-
return
|
17
|
-
end
|
18
|
-
begin
|
19
|
-
@scaffolder.scaffold framework, kata_file
|
20
|
-
@view.show "\n" + @shell.read_file("README")
|
21
|
-
rescue
|
22
|
-
@view.show_unknown_framework_error framework, @scaffolder.list_templates
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def accepts_shell_command? command
|
27
|
-
command == 'setup'
|
28
|
-
end
|
29
|
-
|
30
|
-
def continue_test_loop?
|
31
|
-
false
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
data/app/help_command.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
class HelpCommand
|
2
|
-
|
3
|
-
def initialize view
|
4
|
-
@view = view
|
5
|
-
end
|
6
|
-
|
7
|
-
def execute_from_shell params
|
8
|
-
help params[1]
|
9
|
-
end
|
10
|
-
|
11
|
-
def help command=nil
|
12
|
-
if command then
|
13
|
-
@view.show_detailed_help command.downcase
|
14
|
-
else
|
15
|
-
@view.show_help
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def accepts_shell_command? command
|
20
|
-
['help', '-h', '--help'].member? command
|
21
|
-
end
|
22
|
-
|
23
|
-
def continue_test_loop?
|
24
|
-
false
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
data/app/init_session_command.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'runner'
|
2
|
-
|
3
|
-
class InitSessionCommand
|
4
|
-
|
5
|
-
def initialize view, runner
|
6
|
-
@view = view
|
7
|
-
@runner = runner
|
8
|
-
end
|
9
|
-
|
10
|
-
def execute_from_shell params
|
11
|
-
init_session
|
12
|
-
end
|
13
|
-
|
14
|
-
def init_session
|
15
|
-
session_dir = @runner.init_session
|
16
|
-
@view.show_init_session_result session_dir
|
17
|
-
end
|
18
|
-
|
19
|
-
def accepts_shell_command? command
|
20
|
-
command == 'init-session'
|
21
|
-
end
|
22
|
-
|
23
|
-
def continue_test_loop?
|
24
|
-
false
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
data/app/progress.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
class Progress
|
2
|
-
|
3
|
-
def self.write_empty_progress states
|
4
|
-
STDOUT.print "#{states} states to upload"
|
5
|
-
STDOUT.print "["+" "*states+"]"
|
6
|
-
STDOUT.print "\b"*(states+1)
|
7
|
-
STDOUT.flush
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.next
|
11
|
-
STDOUT.print "."
|
12
|
-
STDOUT.flush
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.end
|
16
|
-
STDOUT.puts
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
@@ -1,52 +0,0 @@
|
|
1
|
-
|
2
|
-
class RevertToGreenCommand
|
3
|
-
|
4
|
-
def initialize shell, view, meta_config_file, state_reader
|
5
|
-
@shell = shell
|
6
|
-
@view = view
|
7
|
-
@meta_config_file = meta_config_file
|
8
|
-
@state_reader = state_reader
|
9
|
-
end
|
10
|
-
|
11
|
-
def execute_from_shell params
|
12
|
-
revert_to_green
|
13
|
-
end
|
14
|
-
|
15
|
-
def execute
|
16
|
-
revert_to_green
|
17
|
-
end
|
18
|
-
|
19
|
-
def revert_to_green
|
20
|
-
formatter = FilenameFormatter.new
|
21
|
-
@state_reader.session_dir = formatter.session_dir @shell.newest_dir_entry(FilenameFormatter.codersdojo_workspace)
|
22
|
-
@state_reader.goto_last_state
|
23
|
-
state = @state_reader.read_previous_state if @state_reader.state_exist?
|
24
|
-
while @state_reader.state_exist? and state.red?
|
25
|
-
state = @state_reader.read_previous_state
|
26
|
-
end
|
27
|
-
if @state_reader.state_exist? and state.green?
|
28
|
-
@view.show_revert_to_step @state_reader.next_step+1
|
29
|
-
@shell.rm_r @meta_config_file.source_files
|
30
|
-
state.files.each do |file|
|
31
|
-
dest_file = Filename.new(file).extract_last_path_item.to_s
|
32
|
-
@shell.write_file dest_file, @shell.read_file(file)
|
33
|
-
end
|
34
|
-
else
|
35
|
-
@view.show_no_green_state_to_revert_to
|
36
|
-
@state_reader.goto_last_state
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def command_key
|
41
|
-
'g'
|
42
|
-
end
|
43
|
-
|
44
|
-
def accepts_shell_command? command
|
45
|
-
command == 'revert-to-green'
|
46
|
-
end
|
47
|
-
|
48
|
-
def continue_test_loop?
|
49
|
-
true
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
data/app/session_zipper.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'zip/zip'
|
2
|
-
require 'zip/zipfilesystem'
|
3
|
-
|
4
|
-
class SessionZipper
|
5
|
-
|
6
|
-
def compress(path)
|
7
|
-
path.sub!(%r[/$],'')
|
8
|
-
archive = File.join(path,File.basename(path))+'.zip'
|
9
|
-
FileUtils.rm archive, :force=>true
|
10
|
-
|
11
|
-
Zip::ZipFile.open(archive, 'w') do |zipfile|
|
12
|
-
Dir["#{path}/**/**"].reject{|f|f==archive}.each do |file|
|
13
|
-
zipfile.add(file.sub(path+'/',''),file)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
archive
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
data/app/shell_process.rb
DELETED
data/app/shell_wrapper.rb
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
require 'shell_process'
|
3
|
-
require 'yaml'
|
4
|
-
|
5
|
-
class ShellWrapper
|
6
|
-
|
7
|
-
MAX_STDOUT_LENGTH = 100000
|
8
|
-
|
9
|
-
def cp source, destination
|
10
|
-
FileUtils.cp source, destination
|
11
|
-
end
|
12
|
-
|
13
|
-
def cp_r source, destination
|
14
|
-
FileUtils.cp_r source, destination
|
15
|
-
end
|
16
|
-
|
17
|
-
def rm_r file_regex
|
18
|
-
files_in_dir_tree('.', file_regex).each do |file|
|
19
|
-
FileUtils.rm file
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def mkdir dir
|
24
|
-
FileUtils.mkdir dir
|
25
|
-
end
|
26
|
-
|
27
|
-
def mkdir_p dirs
|
28
|
-
FileUtils.mkdir_p dirs
|
29
|
-
end
|
30
|
-
|
31
|
-
def rename old_filename, new_filename
|
32
|
-
File.rename old_filename, new_filename
|
33
|
-
end
|
34
|
-
|
35
|
-
def current_file
|
36
|
-
__FILE__
|
37
|
-
end
|
38
|
-
|
39
|
-
def execute command
|
40
|
-
process = ShellProcess.new
|
41
|
-
redirect_stderr_to_stdout = "2>&1"
|
42
|
-
spec_pipe = IO.popen("#{command} #{redirect_stderr_to_stdout}", "r")
|
43
|
-
process.output = spec_pipe.read MAX_STDOUT_LENGTH
|
44
|
-
spec_pipe.close
|
45
|
-
process.return_code = $?.exitstatus
|
46
|
-
puts process.output unless process.output.nil?
|
47
|
-
process
|
48
|
-
end
|
49
|
-
|
50
|
-
def write_file filename, content
|
51
|
-
file = File.new filename, "w"
|
52
|
-
file << content
|
53
|
-
file.close
|
54
|
-
end
|
55
|
-
|
56
|
-
def read_file filename
|
57
|
-
file = File.new filename
|
58
|
-
content = file.read
|
59
|
-
file.close
|
60
|
-
content
|
61
|
-
end
|
62
|
-
|
63
|
-
def creation_time filename
|
64
|
-
File.ctime(filename)
|
65
|
-
end
|
66
|
-
|
67
|
-
def modification_time filename
|
68
|
-
File.mtime(filename)
|
69
|
-
end
|
70
|
-
|
71
|
-
def real_dir_entries dir
|
72
|
-
Dir.new(dir).entries - ["..", "."]
|
73
|
-
end
|
74
|
-
|
75
|
-
def files_in_dir dir, regexp_pattern=nil
|
76
|
-
Dir.new(dir).entries.find_all{|entry|
|
77
|
-
file_matches_regexp? entry, regexp_pattern
|
78
|
-
}
|
79
|
-
end
|
80
|
-
|
81
|
-
def files_in_dir_tree dir, regexp_pattern=nil
|
82
|
-
Dir.glob("#{dir}/**/*").find_all{|entry|
|
83
|
-
file_matches_regexp? entry, regexp_pattern
|
84
|
-
}.sort
|
85
|
-
end
|
86
|
-
|
87
|
-
def file_matches_regexp? dir_entry, regexp_pattern
|
88
|
-
File.file?(dir_entry) and (not regexp_pattern or dir_entry =~ Regexp.new(regexp_pattern))
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
def newest_dir_entry dir, files=nil
|
93
|
-
unless files then files = real_dir_entries(dir) end
|
94
|
-
files.sort_by do |entry|
|
95
|
-
complete_path = File.join dir, entry
|
96
|
-
File.mtime(complete_path)
|
97
|
-
end.last
|
98
|
-
end
|
99
|
-
|
100
|
-
def file? filename
|
101
|
-
File.file? filename
|
102
|
-
end
|
103
|
-
|
104
|
-
def open_with_default_app filename
|
105
|
-
execute "#{open_command_name} #{filename}"
|
106
|
-
end
|
107
|
-
|
108
|
-
def read_properties filename
|
109
|
-
begin
|
110
|
-
YAML.load_file filename
|
111
|
-
rescue
|
112
|
-
raise PropertyFileMissingException.new filename
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def remove_command_name
|
117
|
-
windows? ? 'del' : 'rm'
|
118
|
-
end
|
119
|
-
|
120
|
-
def open_command_name
|
121
|
-
if windows? then
|
122
|
-
'start'
|
123
|
-
elsif mac? then
|
124
|
-
'open'
|
125
|
-
else
|
126
|
-
'xdg-open'
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def expand_run_command command
|
131
|
-
if command.end_with?(".sh") then
|
132
|
-
"bash #{command}"
|
133
|
-
else
|
134
|
-
command
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
def shell_extension
|
139
|
-
windows? ? 'cmd' : 'sh'
|
140
|
-
end
|
141
|
-
|
142
|
-
def path_separator
|
143
|
-
windows? ? ';' : ':'
|
144
|
-
end
|
145
|
-
|
146
|
-
def dir_separator
|
147
|
-
File::ALT_SEPARATOR ? File::ALT_SEPARATOR : File::SEPARATOR
|
148
|
-
end
|
149
|
-
|
150
|
-
def windows?
|
151
|
-
platform = RUBY_PLATFORM.downcase
|
152
|
-
platform.include?("windows") or platform.include?("mingw32")
|
153
|
-
end
|
154
|
-
|
155
|
-
def mac?
|
156
|
-
platform = RUBY_PLATFORM.downcase
|
157
|
-
platform.include?("universal-darwin")
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
data/app/start_command.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'meta_config_file'
|
2
|
-
require 'scheduler'
|
3
|
-
|
4
|
-
class StartCommand
|
5
|
-
|
6
|
-
def initialize meta_config_file, runner, view, eval_loop_commands
|
7
|
-
@runner = runner
|
8
|
-
@view = view
|
9
|
-
@meta_file = meta_config_file
|
10
|
-
@eval_loop_commands = eval_loop_commands
|
11
|
-
end
|
12
|
-
|
13
|
-
def execute_from_shell params
|
14
|
-
start params[1], params[2]
|
15
|
-
end
|
16
|
-
|
17
|
-
def start command, file
|
18
|
-
unless command then @view.show_missing_command_argument_error "start", "shell_command"; return end
|
19
|
-
if file then @view.show_deprecated_command_argument_warning "start", "kata_file" end # since 30-may-2011, remove argument in later version
|
20
|
-
@view.show_start_kata command, file, @meta_file.framework_property
|
21
|
-
@runner.source_files = @meta_file.source_files
|
22
|
-
@runner.run_command = command
|
23
|
-
scheduler = Scheduler.new @runner, @view, @eval_loop_commands
|
24
|
-
scheduler.start
|
25
|
-
end
|
26
|
-
|
27
|
-
def accepts_shell_command? command
|
28
|
-
command == 'start'
|
29
|
-
end
|
30
|
-
|
31
|
-
def continue_test_loop?
|
32
|
-
true
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
data/app/upload_command.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'meta_config_file'
|
2
|
-
require 'uploader'
|
3
|
-
|
4
|
-
class UploadCommand
|
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
|
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
|
-
'u'
|
43
|
-
end
|
44
|
-
|
45
|
-
def accepts_shell_command? command
|
46
|
-
command == 'upload'
|
47
|
-
end
|
48
|
-
|
49
|
-
def continue_test_loop?
|
50
|
-
false
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
class UploadNoOpenCommand
|
2
|
-
|
3
|
-
def initialize upload_command
|
4
|
-
@upload_command = upload_command
|
5
|
-
end
|
6
|
-
|
7
|
-
def execute_from_shell params
|
8
|
-
upload params[1]
|
9
|
-
end
|
10
|
-
|
11
|
-
def upload session_directory
|
12
|
-
@upload_command.upload session_directory, false
|
13
|
-
end
|
14
|
-
|
15
|
-
def accepts_shell_command? command
|
16
|
-
command == 'upload-no-open'
|
17
|
-
end
|
18
|
-
|
19
|
-
def continue_test_loop?
|
20
|
-
false
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
data/app/xhelp_command.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
class XHelpCommand
|
2
|
-
|
3
|
-
def initialize view
|
4
|
-
@view = view
|
5
|
-
end
|
6
|
-
|
7
|
-
def execute_from_shell params
|
8
|
-
help params[1]
|
9
|
-
end
|
10
|
-
|
11
|
-
def help command=nil
|
12
|
-
if command then
|
13
|
-
@view.show_detailed_help command.downcase
|
14
|
-
else
|
15
|
-
@view.show_extended_help
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def accepts_shell_command? command
|
20
|
-
command == 'xhelp'
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
/data/{app → lib}/codersdojo.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/{app → lib}/runner.rb
RENAMED
File without changes
|
/data/{app → lib}/scheduler.rb
RENAMED
File without changes
|
File without changes
|
/data/{app → lib}/state.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
/data/{app → lib}/uploader.rb
RENAMED
File without changes
|
File without changes
|