Module: Deployment::Methods::Repository

Defined in:
lib/depengine/dsl/repository.rb

Instance Method Summary collapse

Instance Method Details

#get_dir_from_samba(source, target) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/depengine/dsl/repository.rb', line 4

def get_dir_from_samba(source, target)
  Helper.validates_presence_of @cdb['samba_repository'], 'Samba repository not set'

  samba            = Provider::Repository.new
  samba.repository = @cdb['samba_repository']
  samba.samba_mountpoints = @cdb['samba_mountpoints']
  samba.method     = 'samba'
  samba.worker  = self
  samba.get_from_repository(source, File.join($recipe_config[:deploy_home], target))
end

#get_file_from_maven(source, target) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/depengine/dsl/repository.rb', line 15

def get_file_from_maven(source, target)
  Helper.validates_presence_of @cdb['maven_repository'], 'Maven repository not set'

  maven            = Provider::Repository.new
  maven.repository = @cdb['maven_repository']
  maven.user       = @cdb['maven_user']
  maven.password   = @cdb['maven_password']
  maven.method     = 'maven'
  maven.get_from_repository(source, File.join($recipe_config[:deploy_home], target))
end

#get_file_via_scp(source, target, options = {}) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/depengine/dsl/repository.rb', line 26

def get_file_via_scp(source, target, options = {})
  Helper.validates_presence_of @cdb['scp_source_host'], \
                               'scp source host not set'
  Helper.validates_presence_of @cdb['scp_source_user'], \
                               'scp source user not set'

  scp            = Provider::Repository.new
  scp.host       = @cdb['scp_source_host']
  scp.user       = @cdb['scp_source_user']
  if options[:ssh_key_file]
    scp.sshkey   = File.join(File.dirname($exec_file_path), \
                             options[:ssh_key_file])
  else
    scp.sshkey   = File.join(File.dirname($exec_file_path), \
                             @cdb['ssh_key_file'])
  end
  scp.method     = 'scp'
  scp.get_from_repository(source, File.join($recipe_config[:deploy_home], target))
end

#get_file_via_svn(source, target, options = {}) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/depengine/dsl/repository.rb', line 46

def get_file_via_svn(source, target, options = {})
  Helper.validates_presence_of @cdb['svn_binary'], \
                               'svn binary not set'
  Helper.validates_presence_of @cdb['svn_source_base_url'], \
                               'svn base url  not set'
  Helper.validates_presence_of @cdb['svn_source_user'], \
                               'svn source user not set'
  Helper.validates_presence_of @cdb['svn_source_command'], \
                               'svn command not set'

  svn            = Provider::Repository.new
  svn.svnbinary  = @cdb['svn_binary']
  svn.user       = @cdb['svn_source_user']
  svn.password   = @cdb['svn_source_password'] if @cdb['svn_source_password']
  svn.method     = 'svn'

  if options[:svn_command]
    svn.svncmd     = options[:svn_command]
  else
    svn.svncmd     = @cdb['svn_source_command'] + " -r#{options[:revision]}"
  end

  if options[:svn_repository]
    svn.repository = options[:svn_repository]
  else
    svn.repository = @cdb['svn_source_base_url']
  end

  svn.get_from_repository(source, \
                          File.join($recipe_config[:deploy_home], target))
end

#git_checkout(branch_name, options = {}) ⇒ Object



85
86
87
88
89
90
# File 'lib/depengine/dsl/repository.rb', line 85

def git_checkout(branch_name, options = {})
  publisher = ::Provider::Git.new
  publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url']
  publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local']
  publisher.checkout(branch_name, options)
end

#git_fetch(options = {}) ⇒ Object



78
79
80
81
82
83
# File 'lib/depengine/dsl/repository.rb', line 78

def git_fetch(options = {})
  publisher = ::Provider::Git.new
  publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url']
  publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local']
  publisher.fetch
end

#git_submodule(submodule_option, options = {}) ⇒ Object



92
93
94
95
96
97
# File 'lib/depengine/dsl/repository.rb', line 92

def git_submodule(submodule_option, options = {})
  publisher = ::Provider::Git.new
  publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url']
  publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local']
  publisher.submodule(submodule_option, options)
end

#git_tag(tag_name, options = {}) ⇒ Object



99
100
101
102
103
104
# File 'lib/depengine/dsl/repository.rb', line 99

def git_tag(tag_name, options = {})
  publisher = ::Provider::Git.new
  publisher.repository_url = options[:git_repository_url] || @cdb['git_repository_url']
  publisher.repository_local_dir = options[:git_repository_local] || @cdb['git_repository_local']
  publisher.tag(tag_name, options)
end