capistrano-uptodate 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "capistrano-uptodate"
6
- s.version = "0.0.1"
6
+ s.version = "0.0.2"
7
7
  s.authors = ["Andriy Yanko"]
8
8
  s.email = ["andriy.yanko@gmail.com"]
9
9
  s.homepage = "https://github.com/railsware/capistrano-uptodate"
@@ -19,19 +19,26 @@ Capistrano::Configuration.instance.load do
19
19
  end
20
20
 
21
21
  task :git do
22
+ # skip if no git dir detected
22
23
  git_dir = fetch(:uptodate_local_reposytory, `#{scm_binary} rev-parse --git-dir`.strip)
23
- abort "Can't detect git repository" if git_dir.empty?
24
+ next if git_dir.empty?
24
25
 
25
- fetch_file = File.join(git_dir, "FETCH_HEAD")
26
+ # skip if remote is not yet configured
27
+ remote_reference_file = File.join(git_dir, 'refs', 'remotes', remote_repository, branch)
28
+ next unless File.exists?(remote_reference_file)
26
29
 
30
+ # fetch remote references and skip on error
31
+ fetch_file = File.join(git_dir, "FETCH_HEAD")
27
32
  unless File.exist?(fetch_file) && Time.now - File.mtime(fetch_file) < time
28
- Capistrano::CLI.ui.say "Fetching references from #{repository} repository ..."
29
- system("#{scm_binary} fetch #{remote_repository}")
33
+ Capistrano::CLI.ui.say "Fetching references from #{remote_repository} repository ..."
34
+ next unless system("#{scm_binary} fetch #{remote_repository}")
30
35
  end
31
36
 
37
+ # get commit for local and remote reference
32
38
  local_commit = `#{scm_binary} rev-parse #{branch}`.strip
33
39
  remote_commit = `#{scm_binary} rev-parse #{remote_repository}/#{branch}`.strip
34
40
 
41
+ # compare local and remote commit
35
42
  if local_commit != remote_commit
36
43
  Capistrano::CLI.ui.say "Local '#{branch}' branch is not synchronized with '#{remote_repository}' repository."
37
44
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-uptodate
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andriy Yanko
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-02 00:00:00 Z
18
+ date: 2011-12-09 00:00:00 +02:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: capistrano
@@ -48,6 +49,7 @@ files:
48
49
  - Rakefile
49
50
  - capistrano-uptodate.gemspec
50
51
  - lib/capistrano/uptodate.rb
52
+ has_rdoc: true
51
53
  homepage: https://github.com/railsware/capistrano-uptodate
52
54
  licenses: []
53
55
 
@@ -77,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
79
  requirements: []
78
80
 
79
81
  rubyforge_project: capistrano-uptodate
80
- rubygems_version: 1.8.6
82
+ rubygems_version: 1.5.2
81
83
  signing_key:
82
84
  specification_version: 3
83
85
  summary: Capistrano extension that automatically check local repository with remote repository