diff --git a/lib/train/extras/file_qnx.rb b/lib/train/extras/file_qnx.rb deleted file mode 100644 index 0b61ee53..00000000 --- a/lib/train/extras/file_qnx.rb +++ /dev/null @@ -1,34 +0,0 @@ -# encoding: utf-8 -# author: Christoph Hartmann -# author: Dominik Richter - -module Train::Extras - class QnxFile < UnixFile - def content - cat = 'cat' - cat = '/proc/boot/cat' if @backend.os[:release].to_i >= 7 - @content ||= case - when !exist? - nil - else - @backend.run_command("#{cat} #{@spath}").stdout || '' - end - end - - def type - if @backend.run_command("file #{@spath}").stdout.include?('directory') - return :directory - else - return :file - end - end - - %w{ - mode owner group uid gid mtime size selinux_label link_path mounted stat - }.each do |field| - define_method field.to_sym do - fail NotImplementedError, "QNX does not implement the #{m}() method yet." - end - end - end -end diff --git a/lib/train/file.rb b/lib/train/file.rb index f8748d3f..045b450d 100644 --- a/lib/train/file.rb +++ b/lib/train/file.rb @@ -1,4 +1,7 @@ # encoding: utf-8 +# +# author: Christoph Hartmann +# author: Dominik Richter require 'train/file/local' require 'train/file/local/unix' diff --git a/lib/train/file/remote/qnx.rb b/lib/train/file/remote/qnx.rb new file mode 100644 index 00000000..72a9c648 --- /dev/null +++ b/lib/train/file/remote/qnx.rb @@ -0,0 +1,40 @@ +# encoding: utf-8 +# +# author: Christoph Hartmann +# author: Dominik Richter + +require 'train/file/remote/unix' + +module Train + class File + class Remote + class Aix < Train::File::Remote::Unix + def content + cat = 'cat' + cat = '/proc/boot/cat' if @backend.os[:release].to_i >= 7 + @content ||= if !exist? + nil + else + @backend.run_command("#{cat} #{@spath}").stdout || '' + end + end + + def type + if @backend.run_command("file #{@spath}").stdout.include?('directory') + return :directory + else + return :file + end + end + + %w{ + mode owner group uid gid mtime size selinux_label link_path mounted stat + }.each do |field| + define_method field.to_sym do + fail NotImplementedError, "QNX does not implement the #{m}() method yet." + end + end + end + end + end +end diff --git a/lib/train/transports/ssh_connection.rb b/lib/train/transports/ssh_connection.rb index 7f43468c..7ea8f8cc 100644 --- a/lib/train/transports/ssh_connection.rb +++ b/lib/train/transports/ssh_connection.rb @@ -66,9 +66,7 @@ def file(path) elsif os.solaris? Train::File::Remote::Unix.new(self, path) elsif os[:name] == 'qnx' - Train::File::Remote::Qnx.new(self, path) - elsif os.windows? - Train::File::Remote::Windows.new(self, path) + Train::File::Remote::Qnx.new(self, path) else Train::File::Remote::Linux.new(self, path) end