Class: Gitenv::Symlink
- Inherits:
-
Object
- Object
- Gitenv::Symlink
- Defined in:
- lib/gitenv/symlink.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(config, file, options = {}) ⇒ Symlink
constructor
A new instance of Symlink.
- #to_s ⇒ Object
- #update! ⇒ Object
Constructor Details
#initialize(config, file, options = {}) ⇒ Symlink
Returns a new instance of Symlink.
7 8 9 |
# File 'lib/gitenv/symlink.rb', line 7 def initialize config, file, = {} @config, @file, = config, file, end |
Instance Method Details
#description ⇒ Object
23 24 25 |
# File 'lib/gitenv/symlink.rb', line 23 def description "#{link} -> #{target}" end |
#to_s ⇒ Object
17 18 19 20 21 |
# File 'lib/gitenv/symlink.rb', line 17 def to_s color, mark, msg = status justification = [:justify] ? ' ' * ([:justify] - description.length) : '' %/ #{Paint[mark, color]} #{Paint[link, :cyan]} -> #{target}#{justification}#{Paint[msg, color]}/ end |
#update! ⇒ Object
11 12 13 14 15 |
# File 'lib/gitenv/symlink.rb', line 11 def update! unless File.exists? link File.symlink target, link end end |