capistrano_copy 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba1eb7f9bd30dc8b63af15aa1cc9ecd1e1b8fed5
4
- data.tar.gz: 140099b6ad4bf8635f71c82adfb361b44bcb6048
3
+ metadata.gz: 8921dfcf7113d03239217ab980c19d457fc4f3a4
4
+ data.tar.gz: 82e3736f80e132a2b28b5bc167b5dd364cfc9b6d
5
5
  SHA512:
6
- metadata.gz: 45831d317686e7bbf9bc27fad81234b4c2e2a0874249d80a30fa589e3b1f3208b2dab0351491ad42cfc977023547a70a871e36992385dc565714496b2bedf5e2
7
- data.tar.gz: 0b8441b39ac247598129b4949b70053c977f45340511a380d90644d1a4fd2731684a46d435adee7991701e79d558532c1bcc1bda12283988e343507719de0a53
6
+ metadata.gz: bccbc04e841be354b6cd338445ece586d1dca6cf7dfff7f827f98e21d17961a1e0cd046a58be08bce5d7bbd0aed877b4dbd9b2ff80abbc8f79409cc1da100a37
7
+ data.tar.gz: ada5cc88cf05298e2d37f6da096c24fc52e3735ece22e190e3123e0a8db70693db015f90ff4236589269d8eef8ed14c70eac874fdadb0b84b051bda04e77703d
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "capistrano_copy"
7
- spec.version = "1.0.0"
7
+ spec.version = "1.0.1"
8
8
  spec.authors = ["NDrive Dev Ops"]
9
9
  spec.email = ["devops@ndrive.com"]
10
10
 
@@ -3,56 +3,59 @@ namespace :copy do
3
3
  archive_name = "archive.tar.gz"
4
4
  include_dir = fetch(:include_dir) || "*"
5
5
  exclude_dir = Array(fetch(:exclude_dir))
6
- base_dir = fetch(:base_dir) || "dist"
7
- @deployed = false
6
+ base_dir = fetch(:base_dir)
8
7
 
9
- exclude_args = exclude_dir.map { |dir| "--exclude '#{dir}'"}
8
+ unless base_dir.nil?
9
+ @deployed = false
10
10
 
11
- # Defalut to :all roles
12
- tar_roles = fetch(:tar_roles, 'all')
11
+ exclude_args = exclude_dir.map { |dir| "--exclude '#{dir}'"}
13
12
 
14
- desc "Archive files to #{archive_name}"
15
- file archive_name => FileList[File.join(base_dir)].exclude(archive_name) do |t|
16
- cmd = ["tar -cvz -f #{t.name} #{base_dir}"]
17
- sh cmd.join(' ')
18
- end
13
+ # Defalut to :all roles
14
+ tar_roles = fetch(:tar_roles, 'all')
15
+
16
+ desc "Archive files to #{archive_name}"
17
+ file archive_name => FileList[File.join(base_dir)].exclude(archive_name) do |t|
18
+ cmd = ["tar -cvz -f #{t.name} #{base_dir}"]
19
+ sh cmd.join(' ')
20
+ end
21
+
22
+ desc "Deploy #{archive_name} to release_path"
23
+ task :deploy => archive_name do |t|
24
+ unless @deployed
25
+ @deployed = true
26
+ tarball = t.prerequisites.first
19
27
 
20
- desc "Deploy #{archive_name} to release_path"
21
- task :deploy => archive_name do |t|
22
- unless @deployed
23
- @deployed = true
24
- tarball = t.prerequisites.first
28
+ on roles(:all) do
29
+ # Make sure the release directory exists
30
+ execute :mkdir, "-p", release_path
25
31
 
26
- on roles(:all) do
27
- # Make sure the release directory exists
28
- execute :mkdir, "-p", release_path
32
+ # Create a temporary file on the server
33
+ tmp_file = capture("mktemp")
29
34
 
30
- # Create a temporary file on the server
31
- tmp_file = capture("mktemp")
35
+ # Upload the archive, extract it and finally remove the tmp_file
36
+ upload!(tarball, tmp_file)
37
+ execute :tar, "-xzf", tmp_file, "-C", release_path
38
+ execute :rm, tmp_file
32
39
 
33
- # Upload the archive, extract it and finally remove the tmp_file
34
- upload!(tarball, tmp_file)
35
- execute :tar, "-xzf", tmp_file, "-C", release_path
36
- execute :rm, tmp_file
40
+ # move dist folder to root
41
+ execute :mv, release_path.join("#{base_dir}/*"), release_path
42
+ execute :rm, '-rf', release_path.join(base_dir)
37
43
 
38
- # move dist folder to root
39
- execute :mv, release_path.join("#{base_dir}/*"), release_path
40
- execute :rm, '-rf', release_path.join(base_dir)
44
+ Rake::Task["deploy:symlink:release"].invoke
45
+ Rake::Task['deploy:finishing'].invoke
46
+ end
41
47
 
42
- Rake::Task["deploy:symlink:release"].invoke
43
- Rake::Task['deploy:finishing'].invoke
48
+ Rake::Task["copy:clean"].invoke
44
49
  end
50
+ end
45
51
 
46
- Rake::Task["copy:clean"].invoke
52
+ task :clean do |t|
53
+ # Delete the local archive
54
+ File.delete archive_name if File.exists? archive_name
47
55
  end
48
- end
49
56
 
50
- task :clean do |t|
51
- # Delete the local archive
52
- File.delete archive_name if File.exists? archive_name
57
+ task :create_release => :deploy
58
+ task :check
59
+ task :set_current_revision
53
60
  end
54
-
55
- task :create_release => :deploy
56
- task :check
57
- task :set_current_revision
58
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano_copy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NDrive Dev Ops
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler