Class: R10K::SVN::WorkingDir

Inherits:
Object
  • Object
show all
Includes:
Execution, 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

Methods included from Execution

#execute

Constructor Details

#initialize(full_path) ⇒ WorkingDir

Returns a new instance of WorkingDir.

Parameters:

  • full_path (Pathname)


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

def initialize(full_path)
  @full_path = full_path
end

Instance Method Details

#checkout(url, revision = nil) ⇒ Object



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

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)


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

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

#revisionObject



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

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

#rootObject



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

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

#update(revision = nil) ⇒ Object



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

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

  svn argv, :cwd => @full_path
end

#urlObject



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

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