codersdojo 1.1.06 → 1.1.07

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.
Files changed (3) hide show
  1. data/app/controller.rb +4 -1
  2. data/app/shell_wrapper.rb +22 -2
  3. metadata +4 -4
data/app/controller.rb CHANGED
@@ -48,7 +48,10 @@ class Controller
48
48
  end
49
49
  @view.show_upload_start session_directory, @hostname
50
50
  uploader = Uploader.new @hostname, framework, session_directory
51
- @view.show_upload_result uploader.upload
51
+ upload_result = uploader.upload
52
+ @view.show_upload_result upload_result
53
+ url = upload_result.split.last
54
+ @shell.open_with_default_app url
52
55
  end
53
56
 
54
57
  end
data/app/shell_wrapper.rb CHANGED
@@ -29,10 +29,11 @@ class ShellWrapper
29
29
  end
30
30
 
31
31
  def execute command
32
- spec_pipe = IO.popen(command, "r")
32
+ redirect_stderr_to_stdout = "2>&1"
33
+ spec_pipe = IO.popen("#{command} #{redirect_stderr_to_stdout}", "r")
33
34
  result = spec_pipe.read MAX_STDOUT_LENGTH
34
35
  spec_pipe.close
35
- puts result
36
+ puts result unless result.nil?
36
37
  result
37
38
  end
38
39
 
@@ -72,9 +73,23 @@ class ShellWrapper
72
73
  File.file? filename
73
74
  end
74
75
 
76
+ def open_with_default_app filename
77
+ execute "#{open_command_name} #{filename}"
78
+ end
79
+
75
80
  def remove_command_name
76
81
  windows? ? 'del' : 'rm'
77
82
  end
83
+
84
+ def open_command_name
85
+ if windows? then
86
+ 'start'
87
+ elsif mac? then
88
+ 'open'
89
+ else
90
+ 'xdg-open'
91
+ end
92
+ end
78
93
 
79
94
  def shell_extension
80
95
  windows? ? 'cmd' : 'sh'
@@ -89,5 +104,10 @@ class ShellWrapper
89
104
  platform.include?("windows") or platform.include?("mingw32")
90
105
  end
91
106
 
107
+ def mac?
108
+ platform = RUBY_PLATFORM.downcase
109
+ platform.include?("universal-darwin")
110
+ end
111
+
92
112
  end
93
113
 
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 6
10
- version: 1.1.06
9
+ - 7
10
+ version: 1.1.07
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-01 00:00:00 +01:00
18
+ date: 2011-02-04 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency