capistrano-git-local 0.1.1 → 0.1.2

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.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "capistrano-git-local"
7
- gem.version = '0.1.1'
7
+ gem.version = '0.1.2'
8
8
  gem.authors = ["Boris Gorbylev"]
9
9
  gem.email = ["ekho@ekho.name"]
10
10
  gem.description = %q{Git scm which works on local host}
@@ -6,6 +6,14 @@ namespace :git_local do
6
6
  @strategy ||= Capistrano::Git.new(self, fetch(:git_strategy, Capistrano::Git::DefaultStrategy))
7
7
  end
8
8
 
9
+ def test_remote
10
+ remote = ''
11
+ within repo_path do
12
+ remote = capture(:git, 'remote', '-v').split("\n").select{ |i| i[/\(fetch\)$/] }[0].gsub(/^origin\s+(\S+)\s+\(fetch\)$/, '\1')
13
+ end
14
+ remote == repo_url
15
+ end
16
+
9
17
  desc 'Check that the repository is reachable'
10
18
  task :check do |task|
11
19
  run_locally do debug "Task #{task} start" end
@@ -23,10 +31,11 @@ namespace :git_local do
23
31
  run_locally do debug "Task #{task} start" end
24
32
 
25
33
  run_locally do
26
- if strategy.test
34
+ if strategy.test && test_remote
27
35
  info t(:mirror_exists, at: repo_path)
28
36
  else
29
37
  within deploy_path do
38
+ execute :rm, '-rf', repo_path if test :test, '-d', repo_path
30
39
  strategy.clone
31
40
  end
32
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-git-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-26 00:00:00.000000000 Z
12
+ date: 2014-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano