Class: Pathname
- Defined in:
- lib/jss/ruby_extensions/pathname.rb,
lib/jamf/ruby_extensions/pathname.rb
Overview
include the modules loaded above
Instance Method Summary collapse
-
#j_append(content) ⇒ Object
included
from JamfRubyExtensions::Pathname::Utils
Append some string content to a file.
-
#j_chown(usr, grp) ⇒ Object
included
from JamfRubyExtensions::Pathname::Utils
Pathname should use FileUtils.chown, not File.chown.
-
#j_cp(dest, options = {}) ⇒ Object
included
from JamfRubyExtensions::Pathname::Utils
Copy a path to a destination.
-
#j_cp_r(dest, options = {}) ⇒ Object
included
from JamfRubyExtensions::Pathname::Utils
Recursively copy this path to a destination.
-
#j_include?(other) ⇒ Boolean
included
from JamfRubyExtensions::Pathname::Predicates
does a path include another? i.e.
-
#j_real_file? ⇒ Boolean
included
from JamfRubyExtensions::Pathname::Predicates
Is this a real file rather than a symlink?.
-
#j_save(content) ⇒ Object
included
from JamfRubyExtensions::Pathname::Utils
Write some string content to a file.
-
#j_touch ⇒ Object
included
from JamfRubyExtensions::Pathname::Utils
Touching can sometimes be good.
-
#jss_append(content) ⇒ Object
Append some string content to a file.
-
#jss_chown(u, g) ⇒ Object
Pathname should use FileUtils.chown, not File.chown.
-
#jss_cp(dest, options = {}) ⇒ Object
Copy a path to a destination.
-
#jss_cp_r(dest, options = {}) ⇒ Object
Recursively copy this path to a destination.
-
#jss_real_file? ⇒ Boolean
Is this a real file rather than a symlink?.
-
#jss_save(content) ⇒ Object
Write some string content to a file.
-
#jss_touch ⇒ Object
Touching can be good.
Instance Method Details
#j_append(content) ⇒ Object Originally defined in module JamfRubyExtensions::Pathname::Utils
Append some string content to a file.
Simpler than always using an open('a') block
#j_chown(usr, grp) ⇒ Object Originally defined in module JamfRubyExtensions::Pathname::Utils
Pathname should use FileUtils.chown, not File.chown
#j_cp(dest, options = {}) ⇒ Object Originally defined in module JamfRubyExtensions::Pathname::Utils
Copy a path to a destination
#j_cp_r(dest, options = {}) ⇒ Object Originally defined in module JamfRubyExtensions::Pathname::Utils
Recursively copy this path to a destination
#j_include?(other) ⇒ Boolean Originally defined in module JamfRubyExtensions::Pathname::Predicates
does a path include another? i.e. is 'other' a descendant of self ?
#j_real_file? ⇒ Boolean Originally defined in module JamfRubyExtensions::Pathname::Predicates
Is this a real file rather than a symlink?
#j_save(content) ⇒ Object Originally defined in module JamfRubyExtensions::Pathname::Utils
Write some string content to a file.
Simpler than always using an open('w') block CAUTION this overwrites files!
#j_touch ⇒ Object Originally defined in module JamfRubyExtensions::Pathname::Utils
Touching can sometimes be good
#jss_append(content) ⇒ Object
Append some string content to a file.
Simpler than always using an open('a') block
63 64 65 |
# File 'lib/jss/ruby_extensions/pathname.rb', line 63 def jss_append(content) self.open('a'){|f| f.write content.to_s} end |
#jss_chown(u, g) ⇒ Object
Pathname should use FileUtils.chown, not File.chown
75 76 77 |
# File 'lib/jss/ruby_extensions/pathname.rb', line 75 def jss_chown(u,g) FileUtils.chown u, g, @path end |
#jss_cp(dest, options = {}) ⇒ Object
Copy a path to a destination
40 41 42 |
# File 'lib/jss/ruby_extensions/pathname.rb', line 40 def jss_cp(dest, = {}) FileUtils.cp @path, dest.to_s, end |
#jss_cp_r(dest, options = {}) ⇒ Object
Recursively copy this path to a destination
46 47 48 |
# File 'lib/jss/ruby_extensions/pathname.rb', line 46 def jss_cp_r(dest, = {}) FileUtils.cp_r @path, dest.to_s, end |
#jss_real_file? ⇒ Boolean
Is this a real file rather than a symlink?
34 35 36 |
# File 'lib/jss/ruby_extensions/pathname.rb', line 34 def jss_real_file? FileTest.jss_real_file? self end |
#jss_save(content) ⇒ Object
Write some string content to a file.
Simpler than always using an open('w') block CAUTION this overwrites files!
55 56 57 |
# File 'lib/jss/ruby_extensions/pathname.rb', line 55 def jss_save(content) self.open('w'){|f| f.write content.to_s} end |
#jss_touch ⇒ Object
Touching can be good
70 71 72 |
# File 'lib/jss/ruby_extensions/pathname.rb', line 70 def jss_touch FileUtils.touch @path end |