Class: Capistrano::Rsync::Scm::Svn
- Inherits:
-
Base
- Object
- Base
- Capistrano::Rsync::Scm::Svn
show all
- Defined in:
- lib/capistrano/rsync/scm/svn.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#create_stage_cmds, #initialize, #update_stage_cmds
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
5
6
7
|
# File 'lib/capistrano/rsync/scm/svn.rb', line 5
def context
@context
end
|
Instance Method Details
#create_stage(repo, path) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/capistrano/rsync/scm/svn.rb', line 18
def create_stage(repo, path)
cmd = []
clone = %W[svn checkout]
clone << repo || "."
clone << path
clone << %W[--username #{context.fetch(:rsync_scm_username)}] if context.fetch(:rsync_scm_username)
clone << %W[--password #{context.fetch(:rsync_scm_password)}] if context.fetch(:rsync_scm_password)
run_cmd clone.flatten
end
|
#get_current_revision_cmd ⇒ Object
7
8
9
10
11
12
|
# File 'lib/capistrano/rsync/scm/svn.rb', line 7
def get_current_revision_cmd
temp = "svn info #{context.fetch(:version_url)}"
temp += " --username #{context.fetch(:rsync_scm_username)}" if context.fetch(:rsync_scm_username)
temp += " --password #{context.fetch(:rsync_scm_password)}" if context.fetch(:rsync_scm_password)
temp + " | grep 'Last Changed Rev:' | sed -e 's/Last Changed Rev: //'"
end
|
#get_last_ext_stage ⇒ Object
58
59
60
|
# File 'lib/capistrano/rsync/scm/svn.rb', line 58
def get_last_ext_stage
get_stage :repo_ext_url, :rsync_ext_stage
end
|
#get_last_main_stage ⇒ Object
62
63
64
|
# File 'lib/capistrano/rsync/scm/svn.rb', line 62
def get_last_main_stage
get_stage :repo_url, :rsync_stage
end
|
#get_stage(repo_key, path_key) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/capistrano/rsync/scm/svn.rb', line 45
def get_stage(repo_key, path_key)
if File.directory?(fetch(path_key))
repo = context.fetch(repo_key, ".")
path = context.fetch(path_key)
create_stage(repo, path)
else
Dir.chdir fetch(path_key) do
update_stage
end
end
end
|
#run_cmd(list = []) ⇒ Object
14
15
16
|
# File 'lib/capistrano/rsync/scm/svn.rb', line 14
def run_cmd(list = [])
Kernel.system *list
end
|
#update_stage ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/capistrano/rsync/scm/svn.rb', line 31
def update_stage
cmd = []
update = %W[svn update]
update << %W[--username #{context.fetch(:rsync_scm_username)}] if context.fetch(:rsync_scm_username)
update << %W[--password #{context.fetch(:rsync_scm_password)}] if context.fetch(:rsync_scm_password)
run_cmd update.flatten
checkout = %W[svn revert --recursive .]
run_cmd checkout
end
|