capistrano-scm-gitcopy 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d35e2b43b2d196cc35eccfa170dcd701aacdd4e
4
- data.tar.gz: defb71f2f16a188a6206029c613103586269aaca
3
+ metadata.gz: 8e94b015b2dee31deae48e65ad6e9bc786766b8a
4
+ data.tar.gz: 730b078fbd172c6c644e9ace6b66496749ff80e8
5
5
  SHA512:
6
- metadata.gz: 8e1eb382e5054e69d52090b8ddc24651744f34a563c56c90e4ac314fe389d1b0a7e4ac71d08cdbf19318b51c344fa522438145d67987d9ed61682ac60f6aafd0
7
- data.tar.gz: de3ebff42cbc833879194ebc1f8486335bdabc65d5fb30d5de6bff9e278953be0ad40c35028b2f39c485e21d938aaa69342cb52bf20e43d49cd4b7c98f4de524
6
+ metadata.gz: 08f27643eb8b0235ca94e0ae76db50647c15d77d5dd24b27b5319d355c2ac1a0f630e8f455418337b70c3e8a5794e75c5c1ed9e027e729de0ef7564c3c3c46cc
7
+ data.tar.gz: 850fc3ba098b503873896fd68ba53c76435e1c7412ae233555a2a05493c119303e4f98623b63e268d32a4c58066fb4b2cb1cc1832023d8822c3af8a9daa5259a
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- [ capistrano-scm-gitcopy ](https://github.com/xuwupeng2000/capsitrano-scm-gitcopy)
1
+ [ capistrano-scm-gitcopy ](https://github.com/xuwupeng2000/capsitrano-scm-gitcopy)
2
2
  ===================
3
3
 
4
- Capistrano 3 :copy
4
+ Capistrano 3 :copy
5
5
 
6
6
  A copy strategy for Capistrano 3, which mimics the `:copy` scm of Capistrano 2.
7
7
  This Gem is inspired by and based on https://github.com/wercker/capistrano-scm-copy.
@@ -9,10 +9,6 @@ Thank wercker so much.
9
9
 
10
10
  This will make Capistrano tar the a specific git branch, upload it to the server(s) and then extract it in the release directory.
11
11
 
12
- There is `sub_directory` option.
13
- When specified, onthe the subtree of the checked-out repository will be deployed.
14
- This is useful when the rails application is not at the root of the repository.
15
-
16
12
  Requirements
17
13
  ============
18
14
 
@@ -26,6 +22,7 @@ Servers:
26
22
  - mktemp
27
23
  - tar
28
24
  - ruby
25
+ - bundler (if you allow cap to run bundle for you)
29
26
 
30
27
  Installation
31
28
  ============
@@ -37,7 +34,7 @@ First make sure you install the capistrano-scm-gitcopy by adding it to your `Gem
37
34
  Then switch the `:scm` option to `:gitcopy` in `config/deploy.rb`:
38
35
 
39
36
  set :scm, :gitcopy
40
-
37
+
41
38
  Finally, DO NOT ADD `require 'capistrano/gitcopy'` to `Capfile` because `capistrano/setup` already loads the scm module with the :scm value you specified.
42
39
 
43
40
 
@@ -45,5 +42,5 @@ Usage
45
42
  ============
46
43
 
47
44
  ```bash
48
- cap uat deploy -s branch=(your release branch)
45
+ cap staging deploy branch=(your release branch)
49
46
  ```
@@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'capistrano-scm-gitcopy'
6
- s.version = '0.1.2'
6
+ s.version = '0.1.4'
7
7
  s.licenses = ['MIT']
8
8
  s.authors = ['Jack Wu', 'Carl Douglas']
9
9
  s.email = ['xuwupeng2000@gmail.com']
@@ -2,7 +2,7 @@ load File.expand_path('../tasks/gitcopy.rake', __FILE__)
2
2
 
3
3
  require 'capistrano/scm'
4
4
 
5
- set_if_empty :repo_path, -> { "/tmp/#{fetch(:application)}-repository" }
5
+ set_if_empty :local_path, -> { "/tmp/#{fetch(:application)}-repository/#{Time.now.to_i}" }
6
6
 
7
7
  class Capistrano::GitCopy < Capistrano::SCM
8
8
 
@@ -15,19 +15,17 @@ class Capistrano::GitCopy < Capistrano::SCM
15
15
 
16
16
  module DefaultStrategy
17
17
 
18
- def test
19
- test! " [ -f #{repo_path}/HEAD ] "
20
- end
21
-
22
18
  def check
23
19
  git :'ls-remote --heads', repo_url
24
20
  end
25
21
 
26
22
  def clone
23
+ local_path = fetch(:local_path)
24
+
27
25
  if (depth = fetch(:git_shallow_clone))
28
- git :clone, '--verbose', '--mirror', '--depth', depth, '--no-single-branch', repo_url, repo_path
26
+ git :clone, '--verbose', '--mirror', '--depth', depth, '--no-single-branch', repo_url, local_path
29
27
  else
30
- git :clone, '--verbose', '--mirror', repo_url, repo_path
28
+ git :clone, '--verbose', '--mirror', repo_url, local_path
31
29
  end
32
30
  end
33
31
 
@@ -61,6 +59,6 @@ class Capistrano::GitCopy < Capistrano::SCM
61
59
  git :archive, fetch(:branch), '--format', 'tar', "|gzip > #{local_tarfile}"
62
60
  end
63
61
  end
64
- end
62
+ end
65
63
 
66
64
  end
@@ -15,16 +15,17 @@ namespace :gitcopy do
15
15
  task :wrapper do
16
16
  run_locally do
17
17
  execute :mkdir, "-p", "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
18
+
18
19
  File.open("#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh", "w") do |file|
19
20
  file.write ("#!/bin/sh -e\nexec /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n")
20
21
  end
22
+
21
23
  execute :chmod, "+x", "#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh"
22
24
  end
23
25
  end
24
26
 
25
27
  desc 'Check that the repository is reachable'
26
28
  task :check => :'gitcopy:wrapper' do
27
- fetch(:branch)
28
29
  run_locally do
29
30
  with fetch(:git_environmental_variables) do
30
31
  strategy.check
@@ -34,15 +35,14 @@ namespace :gitcopy do
34
35
 
35
36
  desc 'Clone the repo to the cache'
36
37
  task :clone => :'gitcopy:wrapper' do
38
+ local_path = fetch(:local_path)
39
+
37
40
  run_locally do
38
- execute :mkdir, '-p', repo_path
39
- if strategy.test
40
- info t(:mirror_exists, at: repo_path)
41
- else
42
- within repo_path do
43
- with fetch(:git_environmental_variables) do
44
- strategy.clone
45
- end
41
+ execute :mkdir, '-p', local_path
42
+
43
+ within local_path do
44
+ with fetch(:git_environmental_variables) do
45
+ strategy.clone
46
46
  end
47
47
  end
48
48
  end
@@ -50,8 +50,10 @@ namespace :gitcopy do
50
50
 
51
51
  desc 'Update the repo mirror to reflect the origin state'
52
52
  task :update => :'gitcopy:clone' do
53
+ local_path = fetch(:local_path)
54
+
53
55
  run_locally do
54
- within repo_path do
56
+ within local_path do
55
57
  with fetch(:git_environmental_variables) do
56
58
  strategy.update
57
59
  end
@@ -61,8 +63,10 @@ namespace :gitcopy do
61
63
 
62
64
  desc 'Create tarfile'
63
65
  task :create_tarfile => [:'gitcopy:update', :'gitcopy:set_current_revision'] do
66
+ local_path = fetch(:local_path)
67
+
64
68
  run_locally do
65
- within repo_path do
69
+ within local_path do
66
70
  with fetch(:git_environmental_variables) do
67
71
  strategy.release
68
72
  end
@@ -19,15 +19,6 @@ module Capistrano
19
19
  let(:context) { Class.new.new }
20
20
  subject { Capistrano::GitCopy.new(context, Capistrano::GitCopy::DefaultStrategy) }
21
21
 
22
- describe "#test" do
23
- it "should call test for repo HEAD" do
24
- context.expects(:repo_path).returns("/path/to/repo")
25
- context.expects(:test).with " [ -f /path/to/repo/HEAD ] "
26
-
27
- subject.test
28
- end
29
- end
30
-
31
22
  describe "#check" do
32
23
  it "should test the repo url" do
33
24
  context.expects(:repo_url).returns(:url)
@@ -40,19 +31,19 @@ module Capistrano
40
31
  describe "#clone" do
41
32
  it "should run git clone" do
42
33
  context.expects(:fetch).with(:git_shallow_clone).returns(nil)
34
+ context.expects(:fetch).with(:local_path).returns(:local_path)
43
35
  context.expects(:repo_url).returns(:url)
44
- context.expects(:repo_path).returns(:path)
45
- context.expects(:execute).with(:git, :clone, '--verbose', '--mirror', :url, :path)
36
+ context.expects(:execute).with(:git, :clone, '--verbose', '--mirror', :url, :local_path)
46
37
 
47
38
  subject.clone
48
39
  end
49
40
 
50
41
  it "should run git clone in shallow mode" do
51
42
  context.expects(:fetch).with(:git_shallow_clone).returns('1')
43
+ context.expects(:fetch).with(:local_path).returns(:local_path)
52
44
  context.expects(:repo_url).returns(:url)
53
- context.expects(:repo_path).returns(:path)
54
45
 
55
- context.expects(:execute).with(:git, :clone, '--verbose', '--mirror', "--depth", '1', '--no-single-branch', :url, :path)
46
+ context.expects(:execute).with(:git, :clone, '--verbose', '--mirror', "--depth", '1', '--no-single-branch', :url, :local_path)
56
47
 
57
48
  subject.clone
58
49
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-scm-gitcopy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Wu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-30 00:00:00.000000000 Z
12
+ date: 2016-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  version: '0'
92
92
  requirements: []
93
93
  rubyforge_project:
94
- rubygems_version: 2.2.2
94
+ rubygems_version: 2.4.5.1
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Gitcopy strategy for capistrano 3.x