Class: Gitenv::Copy
- Inherits:
-
Object
- Object
- Gitenv::Copy
- Defined in:
- lib/gitenv/copy.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(config, file, options = {}) ⇒ Copy
constructor
A new instance of Copy.
- #to_s ⇒ Object
- #update! ⇒ Object
Constructor Details
#initialize(config, file, options = {}) ⇒ Copy
Returns a new instance of Copy.
9 10 11 |
# File 'lib/gitenv/copy.rb', line 9 def initialize config, file, = {} @config, @file, @options = config, file, end |
Instance Method Details
#description ⇒ Object
28 29 30 |
# File 'lib/gitenv/copy.rb', line 28 def description "#{target} << #{source}" end |
#to_s ⇒ Object
22 23 24 25 26 |
# File 'lib/gitenv/copy.rb', line 22 def to_s color, mark, msg = status justification = @options[:justify] ? ' ' * (@options[:justify] - description.length) : '' %/ #{Paint[mark, color]} #{Paint[target, :cyan]} << #{source}#{justification}#{Paint[msg, color]}/ end |
#update! ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/gitenv/copy.rb', line 13 def update! if File.exists?(target) && !File.exists?(target_copy) FileUtils.mv target, target_copy end if !File.exists?(target) FileUtils.copy source, target end end |