ebm 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/commands/pull.rb +89 -0
- data/lib/commands/status.rb +3 -2
- data/lib/commands.rb +1 -0
- data/lib/ebm.rb +1 -0
- data/lib/ebmsharedlib/utilities.rb +3 -2
- data/lib/info.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: 8ad007e4af3a408677cb93bc4df24416f14238a4
|
4
|
-
data.tar.gz: 2a7a8ed1badc38a107658cac981bb3a62e14d165
|
5
2
|
SHA512:
|
6
|
-
|
7
|
-
|
3
|
+
data.tar.gz: dfe1224e61bb17252599956595bc87af6bff06e26d7904e2cd061bbb81bbf3fe42f79b5180c484e629146b10c15224dcb6052f32d4895ee1ffbe470d2c26ebfd
|
4
|
+
metadata.gz: 57467a5d326b1c76f046b0c90ef6abbe6ae2674689facd201c055f2d3f5a63f530b1b07208f286e2dd426c7a3ead79ac892afc627a8fac5a0baa1c1087a005fd
|
5
|
+
SHA1:
|
6
|
+
data.tar.gz: ef8fcd209905525a617b89701640b0ef94b2e1a1
|
7
|
+
metadata.gz: d222c1df8e6aaaaf53206431c5b0397ed212c3b4
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#
|
2
|
+
# Greg Seitz
|
3
|
+
#
|
4
|
+
# Copyright 2013, eBay Inc.
|
5
|
+
# All rights reserved.
|
6
|
+
# http://www.ebay.com
|
7
|
+
#
|
8
|
+
module Commands
|
9
|
+
class Pull
|
10
|
+
|
11
|
+
# holds the options that were passed
|
12
|
+
# you can set any initial defaults here
|
13
|
+
def options
|
14
|
+
@options ||= {
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
# required options
|
19
|
+
def required_options
|
20
|
+
@required_options ||= Set.new [
|
21
|
+
]
|
22
|
+
end
|
23
|
+
|
24
|
+
def register(opts, global_options)
|
25
|
+
opts.banner = "Usage: pull [options]"
|
26
|
+
opts.description = "Prepare your build environment"
|
27
|
+
|
28
|
+
opts.on('-t', "--tag name", "Name of the remote tag that you want to checkout. Warning this will overwrite any local changes.") do |v|
|
29
|
+
options[:tag] = v
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def run(global_options)
|
35
|
+
|
36
|
+
# see if we can open the config file - we append the .config suffix
|
37
|
+
# the file is expected to be in JSON format
|
38
|
+
tag = options[:tag]
|
39
|
+
force = options[:force]
|
40
|
+
|
41
|
+
if ARGV.length > 0
|
42
|
+
raise "You must specify all arguments with their options. You probably meant to use -b for the branch"
|
43
|
+
end
|
44
|
+
|
45
|
+
# determine config_name by extracting parent of our directory
|
46
|
+
config_name = EbmSharedLib.config_name_from_dir(Dir.pwd)
|
47
|
+
|
48
|
+
# try to make sure the repo is available
|
49
|
+
EbmSharedLib.prepare_config_repo
|
50
|
+
info = EbmSharedLib.read_repo_config(config_name, "Config not found, make sure you are in the top level version directory.")
|
51
|
+
# Back up to version parent dir. This directory contains the top level repos.
|
52
|
+
top_dir = Dir.pwd
|
53
|
+
|
54
|
+
repos = info[:repos]
|
55
|
+
repos.each do |repo|
|
56
|
+
if repo[:create_dev_branch]
|
57
|
+
repo_name = EbmSharedLib.get_repo_name(repo[:git_path])
|
58
|
+
repo_path = "#{top_dir}/#{repo_name}"
|
59
|
+
puts("\n#{repo_name} pull:\n");
|
60
|
+
|
61
|
+
cmd = "git fetch --all"
|
62
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
63
|
+
raise "Git fetch failed for #{repo_name}."
|
64
|
+
end
|
65
|
+
|
66
|
+
if tag
|
67
|
+
# use git checkout to force changes from either tag or branch
|
68
|
+
cmd = "git checkout -f refs/tags/#{tag}"
|
69
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
70
|
+
raise "Git checkout failed for #{repo_name}."
|
71
|
+
end
|
72
|
+
else
|
73
|
+
# use a normal pull from the specified remote repo
|
74
|
+
cmd = "git pull"
|
75
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
76
|
+
raise "Git pull failed for #{repo_name}."
|
77
|
+
end
|
78
|
+
end
|
79
|
+
cmd = "git submodule update"
|
80
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
81
|
+
raise "Updating submodules for #{repo_name} failed."
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
end
|
data/lib/commands/status.rb
CHANGED
@@ -33,9 +33,10 @@ module Commands
|
|
33
33
|
# the file is expected to be in JSON format
|
34
34
|
|
35
35
|
# determine config_name by extracting parent of our directory
|
36
|
-
config_name =
|
36
|
+
config_name = EbmSharedLib.config_name_from_dir(Dir.pwd)
|
37
|
+
# config_name = "#{Dir.pwd}".split("/")[-2]
|
37
38
|
if config_name.nil?
|
38
|
-
raise "No version directory found. This command must be run from
|
39
|
+
raise "No version directory found. This command must be run from the top level directory (i.e. iphone_3.1)."
|
39
40
|
end
|
40
41
|
|
41
42
|
# try to make sure the repo is available
|
data/lib/commands.rb
CHANGED
data/lib/ebm.rb
CHANGED
@@ -59,7 +59,7 @@ module EbmSharedLib
|
|
59
59
|
end
|
60
60
|
|
61
61
|
# read and return the config info for this repo
|
62
|
-
def self.read_repo_config(config_name)
|
62
|
+
def self.read_repo_config(config_name, err_msg = nil)
|
63
63
|
config_path = "#{EbmSharedLib::CONFIG_PATH}/configs/#{config_name}#{EbmSharedLib::CONFIG_SUFFIX}"
|
64
64
|
|
65
65
|
begin
|
@@ -67,7 +67,8 @@ module EbmSharedLib
|
|
67
67
|
info = JSON.parse(json)
|
68
68
|
info.recursively_symbolize_keys!
|
69
69
|
rescue
|
70
|
-
|
70
|
+
msg = err_msg.nil? ? "Error opening config file JSON: #{config_path}" : err_msg
|
71
|
+
raise msg
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
data/lib/info.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Seitz
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-06-25 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: subcommand
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- lib/commands/make_sample.rb
|
55
55
|
- lib/commands/periodic.rb
|
56
56
|
- lib/commands/prepare.rb
|
57
|
+
- lib/commands/pull.rb
|
57
58
|
- lib/commands/status.rb
|
58
59
|
- lib/commands/tag.rb
|
59
60
|
- lib/commands.rb
|