edploy 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/edploy.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "edploy"
6
- s.version = "2.0.0"
6
+ s.version = "2.0.1"
7
7
  s.authors = ["Ewout Vonk"]
8
8
  s.email = ["dev@ewout.to"]
9
9
  s.homepage = "https://github.com/ewoutvonk/edploy"
@@ -10,19 +10,20 @@ sudo_mkdir_p = []
10
10
  mkdir_p = []
11
11
  sudo_chown = []
12
12
  rm_rf = []
13
+ sudo_cp_a = {}
13
14
  cp_a = {}
14
15
  sudo_ln_nfs = {}
15
16
  ln_nfs = {}
16
17
  commands = []
17
18
 
18
- SYMLINK_DURING_DEPLOY.each do |source_template, target_template|
19
- is_dir_symlink = source_template.end_with?('/')
19
+ (COPY_DURING_DEPLOY || {}).each do |source_template, target_template|
20
+ source_is_dir = source_template.end_with?('/')
20
21
  source = source_template.gsub(/:[^\/]+/) { |s| Kernel.const_get(s[1..-1].upcase.to_sym) }.gsub(/\/$/, '')
21
22
  target = target_template.gsub(/:[^\/]+/) { |s| Kernel.const_get(s[1..-1].upcase.to_sym) }
22
23
 
23
24
  target_is_inside_project = target.start_with?(DEPLOY_TO)
24
25
  source_is_inside_project = source.start_with?(DEPLOY_TO)
25
- if is_dir_symlink
26
+ if source_is_dir
26
27
  unless File.exists?(source)
27
28
  if source_is_inside_project
28
29
  mkdir_p << source
@@ -31,15 +32,40 @@ SYMLINK_DURING_DEPLOY.each do |source_template, target_template|
31
32
  end
32
33
  sudo_chown << source
33
34
  end
34
- rm_rf << target if File.exists?(target) && !File.symlink?(target) && is_inside_project
35
+ rm_rf << target if File.exists?(target) && target_is_inside_project
35
36
  end
36
37
  if target_is_inside_project
37
- ln_nfs[source] = target
38
+ cp_a[source] = target
38
39
  else
39
- sudo_ln_nfs[source] = target
40
+ sudo_cp_a[source] = target
40
41
  end
41
42
  end
42
43
 
44
+ (SYMLINK_DURING_DEPLOY || {}).each do |source_template, target_template|
45
+ is_dir_symlink = source_template.end_with?('/')
46
+ source = source_template.gsub(/:[^\/]+/) { |s| Kernel.const_get(s[1..-1].upcase.to_sym) }.gsub(/\/$/, '')
47
+ target = target_template.gsub(/:[^\/]+/) { |s| Kernel.const_get(s[1..-1].upcase.to_sym) }
48
+
49
+ target_is_inside_project = target.start_with?(DEPLOY_TO)
50
+ source_is_inside_project = source.start_with?(DEPLOY_TO)
51
+ if is_dir_symlink
52
+ unless File.exists?(source)
53
+ if source_is_inside_project
54
+ mkdir_p << source
55
+ else
56
+ sudo_mkdir_p << source
57
+ end
58
+ sudo_chown << source
59
+ end
60
+ rm_rf << target if File.exists?(target) && !File.symlink?(target) && target_is_inside_project
61
+ end
62
+ if target_is_inside_project
63
+ ln_nfs[source] = target
64
+ else
65
+ sudo_ln_nfs[source] = target
66
+ end
67
+ end
68
+
43
69
  stage_host_files_dir = File.join(PROJECT_PATH, 'config', 'edploy', 'copy', 'project_files', STAGE, MY_HOSTNAME)
44
70
  stage_role_files_dir = File.join(PROJECT_PATH, 'config', 'edploy', 'copy', 'project_files', STAGE, MY_HOSTNAME_WITHOUT_INDEX)
45
71
  stage_files_dir = File.join(PROJECT_PATH, 'config', 'edploy', 'copy', 'project_files', STAGE)
@@ -63,6 +89,7 @@ commands << "sudo mkdir -p #{sudo_mkdir_p.uniq.join(' ')}" unless sudo_mkdir_p.e
63
89
  commands << "mkdir -p #{mkdir_p.uniq.join(' ')}" unless mkdir_p.empty?
64
90
  commands << "sudo chown #{DEPLOY_USER}:#{DEPLOY_GROUP} #{sudo_chown.uniq.join(' ')}" unless sudo_chown.empty?
65
91
  commands << "rm -rf #{rm_rf.uniq.join(' ')}" unless rm_rf.empty?
92
+ commands += sudo_cp_a.map { |source, target| "sudo cp -a #{source} #{target}" }
66
93
  commands += cp_a.map { |source, target| "cp -a #{source} #{target}" }
67
94
  commands += sudo_ln_nfs.map { |source, target| "sudo ln -nfs #{source} #{target}" }
68
95
  commands += ln_nfs.map { |source, target| "ln -nfs #{source} #{target}" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-07 00:00:00.000000000Z
12
+ date: 2012-02-11 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &70279503919100 !ruby/object:Gem::Requirement
16
+ requirement: &70243797042740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70279503919100
24
+ version_requirements: *70243797042740
25
25
  description: A gem which allows for fast, easy and efficient deploys with capistrano
26
26
  email:
27
27
  - dev@ewout.to