capistrano-git-copy 1.3.2 → 1.4.0

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: bb2d212e098eb884c15a2a7a3f0b9dbc6e5a137e
4
- data.tar.gz: 672168b65f58dc804469c16f3cca712d389c0240
3
+ metadata.gz: 025c8ab7ba62a08ce7aafd9ba3acd35a9ca0df58
4
+ data.tar.gz: c434d3eb0fb1d4ca524b8238710e68f4e493f13f
5
5
  SHA512:
6
- metadata.gz: 55587ebd76886541942c3d0336fcfaaf992f34dac15d75073fee6293c90523ab14cd0e0fbd63ccce9f9a66eda9b218acf09c311848259b482c0057339bfab32e
7
- data.tar.gz: 3118f37767103641b52ba4ac5991267d78daa591e7ac3ef753a25ecefbb5b3f90f7d124361a1ff83e4aa1ff5395839b541bd73b40a32964d7904080525bc0f6a
6
+ metadata.gz: 6db2be56e86f392f15e80d5d9d94b748b34215b0885b10c453aa8cf1b1a9b56d82f40d4631d10ccfcfe97933fc4e71a6ea8896c21465852708d9b64f20335592
7
+ data.tar.gz: 03ed553534d07288c570ecc654d447cc884993b779bb8189183505a19ae8b92648d9969bf1b4d17fab61ef53b23de369258003669d80c57d1fc38be500b48813
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 1.4.0 (2017-05-31)
4
+ ### Feature
5
+ - deploy subdirectory
6
+
3
7
  ## 1.3.2 (2017-04-30)
4
8
  ### Changes
5
9
  - updated _git-archive-all_ to 1.16.4
data/README.md CHANGED
@@ -26,6 +26,7 @@ require 'capistrano/git_copy'
26
26
  install_plugin Capistrano::GitCopy::SCM
27
27
  ```
28
28
 
29
+ ### Submodules
29
30
  By default, it includes all submodules into the deployment package. However,
30
31
  if they are not needed in a particular deployment, you can disable them with
31
32
  a configuration option:
@@ -37,6 +38,30 @@ adding them to `git_excludes`:
37
38
  ```ruby
38
39
  append :git_excludes, 'config/database.yml.example', 'test', 'rspec'
39
40
  ```
41
+ **git-archive-all does not support .gitattributes yet - please set with_submodules to false to make e.g. export-ignore work**
42
+
43
+ ### Subdirectories
44
+
45
+ It is also possible to deploy only a subdirectory to the remote server:
46
+ ```ruby
47
+ set :upload_path, 'dist'
48
+ ```
49
+ This makes it possible to compile or build something locally and only upload the result
50
+ ```ruby
51
+ namespace :deploy do
52
+ before :'git_copy:create_release', :'deploy:build_app'
53
+
54
+ task :build_app do
55
+ run_locally do
56
+ within(fetch(:git_copy_plugin).repo_cache_path) do
57
+ execute :npm, :install
58
+ execute :npm, :run, :'build-dist'
59
+ end
60
+ end
61
+ end
62
+ end
63
+ ```
64
+
40
65
  ## Notes
41
66
 
42
67
  * Uses [git-archive-all](https://github.com/Kentzo/git-archive-all) for bundling repositories.
@@ -10,7 +10,7 @@ module Capistrano
10
10
  def set_defaults
11
11
  set_if_empty :with_submodules, true
12
12
  set_if_empty :git_excludes, []
13
- set_if_empty :repo_tree, false
13
+ set_if_empty :upload_path, '.'
14
14
  end
15
15
 
16
16
  # define plugin tasks
@@ -86,12 +86,12 @@ module Capistrano
86
86
  #
87
87
  # @return void
88
88
  def prepare_release
89
- target = fetch(:repo_tree) ? "HEAD:#{fetch(:repo_tree)}" : 'HEAD'
90
-
91
- if fetch(:with_submodules)
89
+ if fetch(:upload_path) != '.'
90
+ backend.execute(:tar, '-czf', archive_path, '-C', fetch(:upload_path), '.')
91
+ elsif fetch(:with_submodules)
92
92
  backend.execute(git_archive_all_bin, "--prefix=''", archive_path)
93
93
  else
94
- git(:archive, '--format=tar', target, '|', 'gzip', "> #{archive_path}")
94
+ git(:archive, '--format=tar', 'HEAD', '|', 'gzip', "> #{archive_path}")
95
95
  end
96
96
 
97
97
  exclude_files_from_archive if fetch(:git_excludes, []).count > 0
@@ -139,7 +139,7 @@ module Capistrano
139
139
  #
140
140
  # @return [String]
141
141
  def repo_cache_path
142
- @_repo_cache_path ||= File.join(tmp_path, 'repo')
142
+ @_repo_cache_path ||= fetch(:git_repo_cach_path, File.join(tmp_path, 'repo'))
143
143
  end
144
144
 
145
145
  # Path to archive
@@ -183,9 +183,9 @@ module Capistrano
183
183
  def exclude_files_from_archive
184
184
  archive_dir = File.join(tmp_path, 'archive')
185
185
 
186
- backend.execute :rm, '-rf', archive_dir
187
- backend.execute :mkdir, '-p', archive_dir
188
- backend.execute :tar, '-xzf', archive_path, '-C', archive_dir
186
+ backend.execute(:rm, '-rf', archive_dir)
187
+ backend.execute(:mkdir, '-p', archive_dir)
188
+ backend.execute(:tar, '-xzf', archive_path, '-C', archive_dir)
189
189
 
190
190
  fetch(:git_excludes, []).each do |f|
191
191
  file_path = File.join(archive_dir, f.gsub(/\A\//, ''))
@@ -199,7 +199,7 @@ module Capistrano
199
199
  FileUtils.rm_rf(file_path)
200
200
  end
201
201
 
202
- backend.execute :tar, '-czf', archive_path, '-C', archive_dir, '.'
202
+ backend.execute(:tar, '-czf', archive_path, '-C', archive_dir, '.')
203
203
  end
204
204
  end
205
205
  end
@@ -1,20 +1,20 @@
1
- git_copy_plugin = self
1
+ set :git_copy_plugin, self
2
2
 
3
3
  namespace :git_copy do
4
4
  desc 'Check that the repository is reachable'
5
5
  task :check do
6
6
  run_locally do
7
- git_copy_plugin.check
7
+ fetch(:git_copy_plugin).check
8
8
  end
9
9
  end
10
10
 
11
11
  desc 'Clone the repo to the cache'
12
12
  task :clone do
13
13
  run_locally do
14
- if git_copy_plugin.test
15
- info t(:mirror_exists, at: git_copy_plugin.repo_cache_path)
14
+ if fetch(:git_copy_plugin).test
15
+ info t(:mirror_exists, at: fetch(:git_copy_plugin).repo_cache_path)
16
16
  else
17
- git_copy_plugin.clone
17
+ fetch(:git_copy_plugin).clone
18
18
  end
19
19
  end
20
20
  end
@@ -22,8 +22,8 @@ namespace :git_copy do
22
22
  desc 'Update the repo mirror to reflect the origin state'
23
23
  task update: :'git_copy:clone' do
24
24
  run_locally do
25
- within git_copy_plugin.repo_cache_path do
26
- git_copy_plugin.update
25
+ within fetch(:git_copy_plugin).repo_cache_path do
26
+ fetch(:git_copy_plugin).update
27
27
  end
28
28
  end
29
29
  end
@@ -31,21 +31,21 @@ namespace :git_copy do
31
31
  desc 'Copy repo to releases'
32
32
  task create_release: :'git_copy:update' do
33
33
  run_locally do
34
- within git_copy_plugin.repo_cache_path do
35
- git_copy_plugin.prepare_release
34
+ within fetch(:git_copy_plugin).repo_cache_path do
35
+ fetch(:git_copy_plugin).prepare_release
36
36
  end
37
37
  end
38
38
 
39
39
  on release_roles :all do
40
- git_copy_plugin.release
40
+ fetch(:git_copy_plugin).release
41
41
  end
42
42
  end
43
43
 
44
44
  desc 'Determine the revision that will be deployed'
45
45
  task set_current_revision: :'git_copy:update' do
46
46
  run_locally do
47
- within git_copy_plugin.repo_cache_path do
48
- set :current_revision, git_copy_plugin.fetch_revision
47
+ within fetch(:git_copy_plugin).repo_cache_path do
48
+ set :current_revision, fetch(:git_copy_plugin).fetch_revision
49
49
  end
50
50
  end
51
51
  end
@@ -53,7 +53,7 @@ namespace :git_copy do
53
53
  desc 'Clean repo cache'
54
54
  task :cleanup do
55
55
  run_locally do
56
- git_copy_plugin.cleanup
56
+ fetch(:git_copy_plugin).cleanup
57
57
  end
58
58
  end
59
59
  end
@@ -3,6 +3,6 @@ module Capistrano
3
3
  # GitCopy
4
4
  module GitCopy
5
5
  # gem version
6
- VERSION = '1.3.2'
6
+ VERSION = '1.4.0'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-git-copy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Schwab
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-30 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano