Sha256: 805a1a240a9f19926ba47caebfa59c4f89800a273627bcc02dad2f03b6551dc7

Contents?: true

Size: 734 Bytes

Versions: 9

Compression:

Stored size: 734 Bytes

Contents

module Minke
  module Helpers
    class Shell
      ##
      # Executes a shell command and returns the return status
      def execute command
        puts command
        system("#{command}")
      end

      def execute_and_return command
        log = `#{command}`
        return log.strip
      end

      def mktmpdir
        Dir.mktmpdir
      end

      def remove_entry_secure dir
        FileUtils.remove_entry_secure dir
      end

      def write_file filename, data
        File.open(filename, 'w') { |file| file.write(data) }
      end

      def read_file filename
        File.open(filename, 'rb') { |file| file.read }.strip
      end

      def exist? filename
        File.exist? filename
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
minke-1.12.9 lib/minke/helpers/shell.rb
minke-1.12.8 lib/minke/helpers/shell.rb
minke-1.12.7 lib/minke/helpers/shell.rb
minke-1.12.5 lib/minke/helpers/shell.rb
minke-1.12.4 lib/minke/helpers/shell.rb
minke-1.12.3 lib/minke/helpers/shell.rb
minke-1.12.2 lib/minke/helpers/shell.rb
minke-1.12.0 lib/minke/helpers/shell.rb
minke-1.11.9 lib/minke/helpers/shell.rb