Sha256: 74b13283689c41b262d905280d95394fbe0c014817a007755234ceff227eab24

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 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

Divvy.register_plugin(Divvy::Plugins::FileUtilities)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
michaeldwan-divvy-0.1.2 lib/divvy/plugins/file_utilities.rb
michaeldwan-divvy-0.1.5 lib/divvy/plugins/file_utilities.rb