Class: Rake::SvnDependency

Inherits:
Task
  • Object
show all
Includes:
DSL
Defined in:
lib/rake-plus/svn_dep.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Task

#file_missing?, #out_of_date?

Class Method Details

.scope_name(scope, task_name) ⇒ Object

Git based tasks ignore the scope when creating the name.



51
# File 'lib/rake-plus/svn_dep.rb', line 51

def scope_name(scope, task_name); task_name end

Instance Method Details

#basenameObject



28
29
30
# File 'lib/rake-plus/svn_dep.rb', line 28

def basename
  base = File.basename(name)
end

#branch(val = nil) ⇒ Object



7
8
9
10
# File 'lib/rake-plus/svn_dep.rb', line 7

def branch(val = nil)
  @branch = val if val
  @branch || "trunk"
end

#execute(args = nil) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rake-plus/svn_dep.rb', line 32

def execute(args=nil)
  if File.directory?(local_path)
    Dir.chdir(local_path) do
      sh "svn update"
    end
  else
    FileUtils.mkdir_p File.dirname(local_path)
    sh "svn checkout #{name}/#{branch} #{local_path}"
  end
  super
end

#local_pathObject



24
25
26
# File 'lib/rake-plus/svn_dep.rb', line 24

def local_path
  RakePlus.cache_dir / "svn" / basename
end

#needed?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/rake-plus/svn_dep.rb', line 12

def needed?
  return :checkout_missing unless File.directory?(local_path)
end

#timestampObject



16
17
18
19
20
21
22
# File 'lib/rake-plus/svn_dep.rb', line 16

def timestamp
  if File.exist?(local_path / 'svn')
    File.mtime(local_path / 'svn')
  else
    Rake::EARLY
  end
end

#unpack_to(dir) ⇒ Object

Like .tar archives, creates a folder beneath it



45
46
47
# File 'lib/rake-plus/svn_dep.rb', line 45

def unpack_to(dir)
  sh "cp -R #{local_path} #{dir}"
end