capistrano-scm-git_with_submodule_and_resolv_symlinks 0.1.1 → 0.2.0

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: fbf4463bd116cb47728ae884d95521260d0b2b40
4
- data.tar.gz: 9edd09b97cbfca7669c534d0d570c510ed785a7a
3
+ metadata.gz: f7da55a4861e2193727eee4253092326821620a8
4
+ data.tar.gz: 685b30a1f1efb8685d35e9d069764ca6a354927c
5
5
  SHA512:
6
- metadata.gz: 015076cc211ead9655054c2d134065cac4ab46fb93e2fc470dec1b6754d25aacff1564c5e80ca08848d51b5f85edb63836d72047e5f63ff2332c9781a7f940f8
7
- data.tar.gz: 9bbffe2c8e55ea41c34ba4c8c7d58dbb5f6497c086ada726ba8f4727d2329d395c18a1001d844cb34dffdf010997215776a1e27d47dd11448b9f5a9ef5fc9808
6
+ metadata.gz: 0c6fc77bc0e8f3a0478ea083d4e0d29e0fb0d13247833907ab31c16eccaa274405f5a339a419e374031a96b0714b82573542f46c72804333d0e2aa1caf1cb61d
7
+ data.tar.gz: 815016db88fb94fe72eee9b97948b47f733e50b3d6ac57895e21cf09cd36d0a4de829cffb114a908fbbb912a30e8f42d3afb64b0e329f1e129e5f37abb822d61
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_dependency "capistrano", "~> 3.7.0"
22
+ spec.add_dependency "capistrano", ">= 3.7.0", "< 3.9.0"
23
23
  spec.add_development_dependency "bundler", "~> 1.12"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -1,5 +1,8 @@
1
1
  require 'capistrano/scm/plugin'
2
2
  require 'capistrano/scm/git_with_submodule_and_resolv_symlinks/version'
3
+ require 'cgi'
4
+ require 'shellwords'
5
+ require 'uri'
3
6
 
4
7
  module Capistrano
5
8
  class SCM
@@ -12,7 +15,7 @@ module Capistrano
12
15
  set_if_empty :"#{nsp}_wrapper_path", lambda {
13
16
  # Try to avoid permissions issues when multiple users deploy the same app
14
17
  # by using different file names in the same dir for each deployer and stage.
15
- suffix = [:application, :stage, :local_user].map { |key| fetch(key).to_s }.join("-").gsub(/\s+/, "-")
18
+ suffix = [:application, :stage, :local_user].map { |key| fetch(key).to_s }.join("-")
16
19
  "#{fetch(:tmp_dir)}/git-ssh-#{suffix}.sh"
17
20
  }
18
21
  set_if_empty :"#{nsp}_environmental_variables", lambda {
@@ -39,15 +42,15 @@ module Capistrano
39
42
  end
40
43
 
41
44
  def check_repo_is_reachable
42
- git :'ls-remote', repo_url, "HEAD"
45
+ git :'ls-remote', git_repo_url, "HEAD"
43
46
  end
44
47
 
45
48
  def clone_repo
46
- git :clone, repo_url, repo_path.to_s
49
+ git :clone, git_repo_url, repo_path.to_s
47
50
  end
48
51
 
49
52
  def update_mirror
50
- git :remote, "set-url", "origin", repo_url
53
+ git :remote, "set-url", "origin", git_repo_url
51
54
  git :remote, :update, "--prune"
52
55
  git :checkout, "--detach", real_branch
53
56
  git :submodule, :update, "--init"
@@ -77,6 +80,21 @@ module Capistrano
77
80
  args.unshift :git
78
81
  backend.execute(*args)
79
82
  end
83
+
84
+ def git_repo_url
85
+ if fetch(:git_http_username) && fetch(:git_http_password)
86
+ URI.parse(repo_url).tap do |repo_uri|
87
+ repo_uri.user = fetch(:git_http_username)
88
+ repo_uri.password = CGI.escape(fetch(:git_http_password))
89
+ end.to_s
90
+ elsif fetch(:git_http_username)
91
+ URI.parse(repo_url).tap do |repo_uri|
92
+ repo_uri.user = fetch(:git_http_username)
93
+ end.to_s
94
+ else
95
+ repo_url
96
+ end
97
+ end
80
98
  end
81
99
  end
82
100
  end
@@ -13,7 +13,7 @@ end
13
13
  module Capistrano
14
14
  class SCM
15
15
  class GitWithSubmoduleAndResolvSymlinks < ::Capistrano::SCM::Plugin
16
- VERSION = "0.1.1"
16
+ VERSION = "0.2.0"
17
17
  end
18
18
  end
19
19
  end
@@ -5,9 +5,9 @@ namespace scm.nsp do
5
5
  desc "Upload the git wrapper script, this script guarantees that we can script git without getting an interactive prompt"
6
6
  task :wrapper do
7
7
  on release_roles :all do
8
- execute :mkdir, "-p", File.dirname(fetch(:"#{scm.nsp}_wrapper_path"))
8
+ execute :mkdir, "-p", File.dirname(fetch(:"#{scm.nsp}_wrapper_path")).shellescape
9
9
  upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), fetch(:"#{scm.nsp}_wrapper_path")
10
- execute :chmod, "700", fetch(:"#{scm.nsp}_wrapper_path")
10
+ execute :chmod, "700", fetch(:"#{scm.nsp}_wrapper_path").shellescape
11
11
  end
12
12
  end
13
13
 
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-scm-git_with_submodule_and_resolv_symlinks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YAMADA Tsuyoshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.7.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 3.9.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 3.7.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 3.9.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement