Class: Bundler::Thor::Actions::CreateLink
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
| Class Chain: 
          self,
           CreateFile,EmptyDirectory | |
| Instance Chain: 
          self,
           CreateFile,EmptyDirectory | |
| Inherits: | Bundler::Thor::Actions::CreateFile 
 | 
| Defined in: | lib/bundler/vendor/thor/lib/thor/actions/create_link.rb | 
Overview
CreateLink is a subset of CreateFile, which instead of taking a block of data, just takes a source string from the user.
Class Method Summary
CreateFile - Inherited
EmptyDirectory - Inherited
| .new | Initializes given the source and destination. | 
Instance Attribute Summary
- #data readonly
- #exists? ⇒ Boolean readonly
- 
    
      #identical?  ⇒ Boolean 
    
    readonly
    Checks if the content of the file at the destination is identical to the rendered result. 
CreateFile - Inherited
| #data, | |
| #identical? | Checks if the content of the file at the destination is identical to the rendered result. | 
| #force_on_collision? | Shows the file collision menu to the user and gets the result. | 
EmptyDirectory - Inherited
| #base, #config, #destination, | |
| #exists? | Checks if the destination file already exists. | 
| #given_destination, #relative_destination, | |
| #destination= | Sets the absolute destination value from a relative destination value. | 
| #pretend? | Shortcut for pretend. | 
Instance Method Summary
CreateFile - Inherited
| #invoke!, | |
| #render | Holds the content to be added to the file. | 
| #force_or_skip_or_conflict | If force is true, run the action, otherwise check if it’s not being skipped. | 
| #on_conflict_behavior | Now on conflict we check if the file is identical or not. | 
EmptyDirectory - Inherited
| #invoke!, #revoke!, | |
| #convert_encoded_instructions | Filenames in the encoded form are converted. | 
| #invoke_with_conflict_check | Receives a hash of options and just execute the block if some conditions are met. | 
| #on_conflict_behavior | What to do when the destination file already exists. | 
| #on_file_clash_behavior, | |
| #say_status | Shortcut to say_status shell method. | 
Constructor Details
This class inherits a constructor from Bundler::Thor::Actions::CreateFile
Instance Attribute Details
#data (readonly)
[ GitHub ]# File 'lib/bundler/vendor/thor/lib/thor/actions/create_link.rb', line 28
attr_reader :data
    #exists?  ⇒ Boolean  (readonly)
  
  [ GitHub ]
# File 'lib/bundler/vendor/thor/lib/thor/actions/create_link.rb', line 55
def exists? super || File.symlink?(destination) end
    #identical?  ⇒ Boolean  (readonly)
  
Checks if the content of the file at the destination is identical to the rendered result.
Returns
- Boolean
- 
true if it is identical, false otherwise. 
# File 'lib/bundler/vendor/thor/lib/thor/actions/create_link.rb', line 35
def identical? exists? && File.identical?(render, destination) end
Instance Method Details
#invoke!
[ GitHub ]# File 'lib/bundler/vendor/thor/lib/thor/actions/create_link.rb', line 39
def invoke! invoke_with_conflict_check do require "fileutils" FileUtils.mkdir_p(File.dirname(destination)) # Create a symlink by default config[:symbolic] = true if config[:symbolic].nil? File.unlink(destination) if exists? if config[:symbolic] File.symlink(render, destination) else File.link(render, destination) end end given_destination end