-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepo.rb
More file actions
57 lines (44 loc) · 1.18 KB
/
Copy pathrepo.rb
File metadata and controls
57 lines (44 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require_relative "cmd_runner"
class Repo
include CmdRunner
attr_reader :path, :branch
def self.checkout(path, branch)
unless File.directory?(path)
log "Checking out repo #{path}/#{branch}"
run! "git clone --depth 1 --recursive --branch #{branch} git@github.com:cloudfoundry/#{path}.git"
end
raise "Failed to clone #{path}/#{branch}" unless File.directory?(path)
Dir.chdir(path) do
repo = new(path, branch)
repo.clean
repo.bundle_install
yield repo
end
end
def bundle_install
run! "bundle install --without development test"
end
def clean
log "Cleaning repo #{Dir.pwd}"
run! "git reset --hard"
run! "git clean -fd"
run! "git fetch"
run! "git checkout origin/$branch"
run! "git submodule update --init --recursive --depth 1"
end
def promote(branch)
log "Promoting #{Dir.pwd} to #{branch}"
end
def tag(tag_name)
log "Tagging repo #{Dir.pwd} with #{tag_name}"
end
def bump_version
version = "foo"
log "Bumping version #{Dir.pwd} to #{version}"
end
private
def initialize(path, branch)
@path = path
@branch = branch
end
end