right_scraper 1.0.15 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,21 +58,28 @@ module RightScale
58
58
  is_tag = analysis[:tag]
59
59
  is_branch = analysis[:branch]
60
60
  on_branch = analysis[:on_branch]
61
- if !is_tag && !is_branch
61
+ checkout = is_tag && !is_branch
62
+ if is_tag && is_branch
63
+ @errors << 'Repository tag ambiguous: could be git tag or git branch'
64
+ elsif !is_tag && !is_branch
62
65
  current_sha = `git rev-parse HEAD`.chomp
63
66
  if current_sha == @repo.tag
64
67
  @callback.call("Nothing to update: already using #{@repo.tag}", is_step=false) if @callback
65
68
  return true
66
- else
67
- @callback.call("Current HEAD (#{current_sha}) differs from #{@repo.tag}, falling back to cloning", is_step=false) if @callback
69
+ else
70
+ checkout = true
68
71
  end
69
72
  end
70
- if is_tag && is_branch
71
- @errors << 'Repository tag ambiguous: could be git tag or git branch'
72
- elsif is_branch && !on_branch
73
- res = `git checkout #{@repo.tag} 2>&1`
73
+ if succeeded?
74
+ if checkout || is_branch && !on_branch
75
+ res = `git checkout #{@repo.tag} 2>&1`
76
+ action = 'checkout'
77
+ else # Pull latest commits on same branch
78
+ res = `git pull origin #{@repo.tag} 2>&1`
79
+ action = 'pull'
80
+ end
74
81
  if $? != 0
75
- @callback.call("Failed to checkout #{@repo.tag}: #{res}, falling back to cloning", is_step=false) if @callback
82
+ @callback.call("Failed to #{action} #{@repo.tag}: #{res}, falling back to cloning", is_step=false) if @callback
76
83
  FileUtils.rm_rf(@current_repo_dir)
77
84
  @incremental = false
78
85
  end
@@ -23,7 +23,7 @@ require 'rubygems'
23
23
 
24
24
  spec = Gem::Specification.new do |spec|
25
25
  spec.name = 'right_scraper'
26
- spec.version = '1.0.15'
26
+ spec.version = '1.0.16'
27
27
  spec.authors = ['Raphael Simon']
28
28
  spec.email = 'raphael@rightscale.com'
29
29
  spec.homepage = 'https://github.com/rightscale/right_scraper'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Simon
@@ -36,7 +36,6 @@ files:
36
36
  - lib/right_scraper/watcher.rb
37
37
  - lib/right_scraper/win32/process_monitor.rb
38
38
  - right_scraper.gemspec
39
- - spec/__destdir/test
40
39
  - spec/download_scraper_spec.rb
41
40
  - spec/git_scraper_spec.rb
42
41
  - spec/rcov.opts
data/spec/__destdir/test DELETED
@@ -1 +0,0 @@
1
- MORE THAN 2 CHARS