Class: Bundler::Source::SVN::SVNProxy
- Inherits:
-
Object
- Object
- Bundler::Source::SVN::SVNProxy
- Defined in:
- lib/bundler/source/svn/svn_proxy.rb
Overview
The SVNProxy is responsible to interact with svn repositories. All actions required by the SVN source is encapsulated in this object.
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
-
#ref ⇒ Object
Returns the value of attribute ref.
- #revision ⇒ Object
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #checkout ⇒ Object
- #copy_to(destination) ⇒ Object
-
#initialize(path, uri, ref, revision = nil, svn = nil) ⇒ SVNProxy
constructor
A new instance of SVNProxy.
Constructor Details
#initialize(path, uri, ref, revision = nil, svn = nil) ⇒ SVNProxy
Returns a new instance of SVNProxy.
37 38 39 40 41 42 43 44 |
# File 'lib/bundler/source/svn/svn_proxy.rb', line 37 def initialize(path, uri, ref, revision = nil, svn = nil) @path = path @uri = uri @ref = ref @revision = revision @svn = svn raise SVNNotInstalledError.new if allow? && !Bundler.svn_present? end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
34 35 36 |
# File 'lib/bundler/source/svn/svn_proxy.rb', line 34 def path @path end |
#ref ⇒ Object
Returns the value of attribute ref.
34 35 36 |
# File 'lib/bundler/source/svn/svn_proxy.rb', line 34 def ref @ref end |
#revision ⇒ Object
46 47 48 |
# File 'lib/bundler/source/svn/svn_proxy.rb', line 46 def revision @revision ||= svn("info --revision #{ref} #{uri_escaped} | grep \"Revision\" | awk '{print $2}'").strip end |
#uri ⇒ Object
Returns the value of attribute uri.
34 35 36 |
# File 'lib/bundler/source/svn/svn_proxy.rb', line 34 def uri @uri end |
Instance Method Details
#checkout ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bundler/source/svn/svn_proxy.rb', line 50 def checkout if path.exist? Bundler.ui.confirm "Updating #{uri}" in_path do svn_retry %|update --force --quiet --revision #{revision}| end else Bundler.ui.info "Fetching #{uri}" FileUtils.mkdir_p(path.dirname) svn_retry %|checkout --revision #{revision} #{uri_escaped} "#{path}"| end end |
#copy_to(destination) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/bundler/source/svn/svn_proxy.rb', line 63 def copy_to(destination) FileUtils.mkdir_p(destination.dirname) FileUtils.rm_rf(destination) FileUtils.cp_r(path, destination) File.chmod((0777 & ~File.umask), destination) end |