summaryrefslogtreecommitdiff
path: root/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-22 23:08:05 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-22 23:08:05 +0000
commit7825e8363d4b2ccad8e2d3f5eeba9e26f6656911 (patch)
tree83cbcf419e0feeb2ab0fd063ed85e0776eb0081b /lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
parent73bed0312895322e0fd18310e840356c8e6af812 (diff)
Postponing the Bundler merge.
I faced a big issue about Bundler with ruby core. I have no time to resolve it issue before 2.5 final release. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/bundler/vendor/thor/lib/thor/actions/create_link.rb')
-rw-r--r--lib/bundler/vendor/thor/lib/thor/actions/create_link.rb60
1 files changed, 0 insertions, 60 deletions
diff --git a/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb b/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
deleted file mode 100644
index 3a664401b4..0000000000
--- a/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-require "bundler/vendor/thor/lib/thor/actions/create_file"
-
-class Bundler::Thor
- module Actions
- # Create a new file relative to the destination root from the given source.
- #
- # ==== Parameters
- # destination<String>:: the relative path to the destination root.
- # source<String|NilClass>:: the relative path to the source root.
- # config<Hash>:: give :verbose => false to not log the status.
- # :: give :symbolic => false for hard link.
- #
- # ==== Examples
- #
- # create_link "config/apache.conf", "/etc/apache.conf"
- #
- def create_link(destination, *args)
- config = args.last.is_a?(Hash) ? args.pop : {}
- source = args.first
- action CreateLink.new(self, destination, source, config)
- end
- alias_method :add_link, :create_link
-
- # CreateLink is a subset of CreateFile, which instead of taking a block of
- # data, just takes a source string from the user.
- #
- class CreateLink < CreateFile #:nodoc:
- attr_reader :data
-
- # 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.
- #
- def identical?
- exists? && File.identical?(render, destination)
- end
-
- 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
-
- def exists?
- super || File.symlink?(destination)
- end
- end
- end
-end