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



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

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



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

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



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

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



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
77
# File 'lib/depengine/dsl/repository.rb', line 47

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



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

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



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

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



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

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



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

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