vendorificator 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.
- data/.travis.yml +5 -2
- data/Gemfile +0 -1
- data/README.md +9 -0
- data/Rakefile +7 -1
- data/features/chef_cookbook.feature +4 -6
- data/features/deprecated.feature +4 -4
- data/features/git.feature +41 -2
- data/features/needed.feature +8 -7
- data/features/smoke.feature +7 -5
- data/features/status.feature +15 -15
- data/features/step_definitions/aruba_ext.rb +11 -0
- data/features/step_definitions/basic.rb +16 -43
- data/features/step_definitions/git.rb +11 -11
- data/features/step_definitions/vendorificator.rb +4 -6
- data/features/support/aruba_ext.rb +23 -0
- data/features/support/env.rb +13 -20
- data/features/support/minigit.rb +37 -0
- data/features/tarball.feature +7 -7
- data/features/tarball_edit.feature +1 -1
- data/features/vendor.feature +2 -2
- data/lib/vendorificator/cli.rb +36 -61
- data/lib/vendorificator/config.rb +5 -42
- data/lib/vendorificator/environment.rb +111 -0
- data/lib/vendorificator/hooks/chef_cookbook.rb +59 -23
- data/lib/vendorificator/vendor/archive.rb +2 -2
- data/lib/vendorificator/vendor/chef_cookbook.rb +2 -2
- data/lib/vendorificator/vendor/download.rb +44 -0
- data/lib/vendorificator/vendor/git.rb +9 -11
- data/lib/vendorificator/vendor.rb +105 -48
- data/lib/vendorificator/version.rb +1 -1
- data/lib/vendorificator.rb +2 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/vendorificator/vendor_spec.rb +15 -7
- data/vendorificator.gemspec +4 -4
- metadata +24 -21
- data/features/support/world_git.rb +0 -40
- data/features/support/world_runs.rb +0 -93
- data/lib/vendorificator/repo.rb +0 -69
data/lib/vendorificator/repo.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'grit'
|
2
|
-
|
3
|
-
module Vendorificator
|
4
|
-
class Repo < Grit::Repo
|
5
|
-
# True if repository doesn't contain uncommitted changes.
|
6
|
-
def clean?
|
7
|
-
# copy code from http://stackoverflow.com/a/3879077/16390
|
8
|
-
git.native :update_index, {}, '-q', '--ignore-submodules', '--refresh'
|
9
|
-
git.native :diff_files, {:raise => true}, '--quiet', '--ignore-submodules', '--'
|
10
|
-
git.native :diff_index, {:raise => true}, '--cached', '--quiet', 'HEAD', '--ignore-submodules', '--'
|
11
|
-
true
|
12
|
-
rescue Grit::Git::CommandFailed
|
13
|
-
false
|
14
|
-
end
|
15
|
-
|
16
|
-
# Update vendor branches & tags from an upstream repository
|
17
|
-
def pull(remote, options={})
|
18
|
-
raise RuntimeError, "Unknown remote #{remote}" unless remote_list.include?(remote)
|
19
|
-
|
20
|
-
git.fetch({}, remote)
|
21
|
-
git.fetch({:tags => true}, remote)
|
22
|
-
|
23
|
-
ref_rx = /^#{Regexp.quote(remote)}\//
|
24
|
-
remote_branches = Hash[remotes.map{|r| [$',r] if r.name =~ ref_rx }.compact]
|
25
|
-
|
26
|
-
# FIXME: should we depend on Vendorificator::Config here?
|
27
|
-
Vendorificator::Config.each_module do |mod|
|
28
|
-
remote_head = remote_branches[mod.branch_name]
|
29
|
-
ours = mod.head && mod.head.commit.sha
|
30
|
-
theirs = remote_head && remote_head.commit.sha
|
31
|
-
|
32
|
-
if remote_head
|
33
|
-
if not mod.head
|
34
|
-
say_status 'new', mod.branch_name, :yellow
|
35
|
-
git.branch({:track=>true}, mod.branch_name, remote_head.name) unless options[:dry_run]
|
36
|
-
elsif ours == theirs
|
37
|
-
say_status 'unchanged', mod.branch_name
|
38
|
-
elsif fast_forwardable?(theirs, ours)
|
39
|
-
say_status 'updated', mod.name, :yellow
|
40
|
-
unless options[:dry_run]
|
41
|
-
mod.in_branch do
|
42
|
-
git.merge({:ff_only => true}, remote_head.name)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
elsif fast_forwardable?(ours, theirs)
|
46
|
-
say_status 'older', mod.branch_name
|
47
|
-
else
|
48
|
-
say_status 'complicated', mod.branch_name, :red
|
49
|
-
indent do
|
50
|
-
say 'Merge it yourself.'
|
51
|
-
end
|
52
|
-
end
|
53
|
-
else
|
54
|
-
say_status 'unknown', mod.branch_name
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def conf
|
61
|
-
Vendorificator::Config
|
62
|
-
end
|
63
|
-
|
64
|
-
def say_status(*args)
|
65
|
-
conf[:shell].say_status(*args) if conf[:shell]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|