Sha256: fb5021fb6aa111d9d06d6d6301bef1a850911b0fc75a173104fea3cf220cf6c2

Contents?: true

Size: 967 Bytes

Versions: 8

Compression:

Stored size: 967 Bytes

Contents

module Roro

  class CLI < Thor
    
    no_commands do  

      def choices 
        { default: 'y', limited_to: ["y", "n"] }
      end
      
      def own_if_required
        system 'sudo chown -R $USER .'
      end   
      
      def as_system(command)
        command = OS.linux? ? "sudo #{command}" : command
        system command
      end

      def chown_if_required()
        warning = "It looks like you're running Docker on some flavor of Linux, in which case the files created by your containers are owned by the root user of the container, and not by the user of the host machine. Please change their ownership by supplying your password at the prompt.",
        action = "system 'sudo chown -R $USER .'"
        msg = []
        msg << ""
        msg << delineator
        msg << warning
        msg << ""
        msg.join("\n\n")
        puts msg
        eval(action)
      end

      def delineator
        ("-" * 80)
      end
    end
  end 
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
roro-0.3.14 lib/roro/cli/base/utilities.rb
roro-0.3.13 lib/roro/cli/base/utilities.rb
roro-0.3.12 lib/roro/cli/base/utilities.rb
roro-0.3.9 lib/roro/cli/base/utilities.rb
roro-0.3.8 lib/roro/cli/base/utilities.rb
roro-0.3.7 lib/roro/cli/base/utilities.rb
roro-0.3.6 lib/roro/cli/base/utilities.rb
roro-0.3.5 lib/roro/cli/base/utilities.rb