Sha256: 55f3a43d1105790d6b2e0284b5fb07ede4d3f04d8e944cf7ed6e6d1f588a050b

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

module Divvy
  module Plugins
    module FileUtilities
      
      # Makes a directory
      # path is the diretory to create. This will not create the directory if it already exists
      # mode is the file mode of the directory. If nil, no mode changes will be made
      def mkdir(path, mode = nil)
        run("[ -d #{path} ] || mkdir -p #{path}")
        run("chmod #{mode} #{dir}") unless mode.nil?
      end
      
      def push_text(path, text)
        run("[ -f #{path} ] || touch #{path}")
        run("echo '#{text}' | tee -a #{path}")
        # "echo '#{text}' |#{'sudo' if option?(:sudo)} tee -a #{path}"
      end
      
    end
  end
end

register_plugin(Divvy::Plugins::FileUtilities)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mdwan-divvy-0.1.2 lib/divvy/plugins/file_utilities.rb