Class: UploadCommand
- Inherits:
-
Object
- Object
- UploadCommand
- Defined in:
- lib/commands/upload_command.rb
Instance Attribute Summary collapse
-
#uploader ⇒ Object
Returns the value of attribute uploader.
Instance Method Summary collapse
- #accepts_shell_command?(command) ⇒ Boolean
- #command_key ⇒ Object
- #continue_test_loop? ⇒ Boolean
- #execute ⇒ Object
- #execute_from_shell(params) ⇒ Object
-
#initialize(shell, view, hostname) ⇒ UploadCommand
constructor
A new instance of UploadCommand.
- #upload(session_directory, open_browser = true) ⇒ Object
Constructor Details
#initialize(shell, view, hostname) ⇒ UploadCommand
Returns a new instance of UploadCommand.
8 9 10 11 12 13 14 |
# File 'lib/commands/upload_command.rb', line 8 def initialize shell, view, hostname @shell = shell @view = view @hostname = hostname @uploader = Uploader.new(hostname, '', '') @meta_file = MetaConfigFile.new @shell end |
Instance Attribute Details
#uploader ⇒ Object
Returns the value of attribute uploader.
6 7 8 |
# File 'lib/commands/upload_command.rb', line 6 def uploader @uploader end |
Instance Method Details
#accepts_shell_command?(command) ⇒ Boolean
45 46 47 |
# File 'lib/commands/upload_command.rb', line 45 def accepts_shell_command? command command == 'upload' end |
#command_key ⇒ Object
41 42 43 |
# File 'lib/commands/upload_command.rb', line 41 def command_key 'u' end |
#continue_test_loop? ⇒ Boolean
49 50 51 |
# File 'lib/commands/upload_command.rb', line 49 def continue_test_loop? false end |
#execute ⇒ Object
16 17 18 |
# File 'lib/commands/upload_command.rb', line 16 def execute upload nil end |
#execute_from_shell(params) ⇒ Object
20 21 22 |
# File 'lib/commands/upload_command.rb', line 20 def execute_from_shell params upload params[1] end |
#upload(session_directory, open_browser = true) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/commands/upload_command.rb', line 24 def upload session_directory, open_browser=true formatter = FilenameFormatter.new framework = @meta_file.framework_property if not session_directory then session_directory = formatter.session_dir @shell.newest_dir_entry(FilenameFormatter.codersdojo_workspace) end @view.show_upload_start session_directory, @hostname, framework @uploader.framework = framework @uploader.session_dir = session_directory upload_result = @uploader.upload @view.show_upload_result upload_result url = upload_result.split.last if open_browser then @shell.open_with_default_app url end end |