module JamfRubyExtensions::Pathname::Utils
Public Instance Methods
j_append(content)
click to toggle source
Append some string content to a file.
Simpler than always using an open(‘a’) block
# File lib/jamf/ruby_extensions/pathname/utils.rb 58 def j_append(content) 59 self.open('a') { |f| f.write content.to_s } 60 end
Also aliased as: jss_append
j_chown(usr, grp)
click to toggle source
Pathname
should use FileUtils.chown, not File.chown
# File lib/jamf/ruby_extensions/pathname/utils.rb 72 def j_chown(usr, grp) 73 FileUtils.chown usr, grp, @path 74 end
Also aliased as: jss_chown
j_cp(dest, **options)
click to toggle source
Copy a path to a destination @see FileUtils.cp
# File lib/jamf/ruby_extensions/pathname/utils.rb 32 def j_cp(dest, **options) 33 FileUtils.cp @path, dest.to_s, **options 34 end
Also aliased as: jss_cp
j_cp_r(dest, **options)
click to toggle source
Recursively copy this path to a destination @see FileUtils.cp_r
# File lib/jamf/ruby_extensions/pathname/utils.rb 39 def j_cp_r(dest, **options) 40 FileUtils.cp_r @path, dest.to_s, **options 41 end
Also aliased as: jss_cp_r
j_save(content)
click to toggle source
Write some string content to a file.
Simpler than always using an open(‘w’) block CAUTION this overwrites files!
# File lib/jamf/ruby_extensions/pathname/utils.rb 49 def j_save(content) 50 self.open('w') { |f| f.write content.to_s } 51 end
Also aliased as: jss_save
j_touch()
click to toggle source
Touching can sometimes be good
@see FileUtils.touch
# File lib/jamf/ruby_extensions/pathname/utils.rb 66 def j_touch 67 FileUtils.touch @path 68 end
Also aliased as: jss_touch