Class: R10K::SVN::WorkingDir

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/r10k/svn/working_dir.rb

Constant Summary

Constants included from Logging

Logging::LOG_LEVELS

Instance Method Summary collapse

Methods included from Logging

formatter, included, level, level=, levels, #logger, #logger_name, outputter, parse_level

Constructor Details

#initialize(full_path) ⇒ WorkingDir

Returns a new instance of WorkingDir.

Parameters:

  • full_path (Pathname)


8
9
10
# File 'lib/r10k/svn/working_dir.rb', line 8

def initialize(full_path)
  @full_path = full_path
end

Instance Method Details

#checkout(url, revision = nil) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/r10k/svn/working_dir.rb', line 36

def checkout(url, revision = nil)
  argv = ['checkout', url]
  argv << '-r' << revision if revision
  argv << @full_path.basename.to_s

  svn argv, :cwd => @full_path.parent
end

#is_svn?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/r10k/svn/working_dir.rb', line 12

def is_svn?
  dot_svn = @full_path + '.svn'
  dot_svn.exist?
end

#revisionObject



17
18
19
# File 'lib/r10k/svn/working_dir.rb', line 17

def revision
  info.slice(/^Revision: (\d+)$/, 1)
end

#rootObject



25
26
27
# File 'lib/r10k/svn/working_dir.rb', line 25

def root
  info.slice(/^Repository Root: (.*)$/, 1)
end

#update(revision = nil) ⇒ Object



29
30
31
32
33
34
# File 'lib/r10k/svn/working_dir.rb', line 29

def update(revision = nil)
  argv = %w[update]
  argv << '-r' << revision if revision

  svn argv, :cwd => @full_path
end

#urlObject



21
22
23
# File 'lib/r10k/svn/working_dir.rb', line 21

def url
  info.slice(/^URL: (.*)$/, 1)
end