ebm 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/commands/list_configs.rb +4 -0
- data/lib/commands/make_sample.rb +5 -3
- data/lib/commands/prepare.rb +10 -10
- data/lib/commands/tag.rb +81 -0
- data/lib/commands.rb +1 -0
- data/lib/ebm.rb +1 -2
- data/lib/ebmsharedlib/utilities.rb +17 -0
- data/lib/info.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA512:
|
3
|
-
|
4
|
-
|
3
|
+
data.tar.gz: a5288eddde61f146b76a5323777a2ffa4d48e14e54b64abd01304015269d7dd9b287fc5c7517bbf5828fc9be16af6bddb19c020bab0940fefc3531963d7f7fa1
|
4
|
+
metadata.gz: e0a5b7cc6803014087c90cb96a2c4a7da188c2d394108be89b5fa47ea9d04febaf57cff2684deda96d9d0abd5fb66c759e6f8b1ec2b105c42f5030c69baaee23
|
5
5
|
SHA1:
|
6
|
-
|
7
|
-
|
6
|
+
data.tar.gz: 953745eaba17febc3998f2d7845c20e307333635
|
7
|
+
metadata.gz: 26c13b28d3cb2c0f80a7d48de48c7d8db95efe4d
|
@@ -30,6 +30,10 @@ module Commands
|
|
30
30
|
def run(global_options)
|
31
31
|
puts # add empty line
|
32
32
|
# show contents of configs directory for files with .config extension
|
33
|
+
# try to make sure the repo is available
|
34
|
+
EbmSharedLib.prepare_config_repo
|
35
|
+
info = EbmSharedLib.read_repo_config(config_name)
|
36
|
+
|
33
37
|
config_path = "#{EbmSharedLib::CONFIG_PATH}/configs"
|
34
38
|
config_names = Pathname.glob("#{config_path}/*.config").map { |file_info|
|
35
39
|
if file_info.directory? == false
|
data/lib/commands/make_sample.rb
CHANGED
@@ -47,12 +47,14 @@ module Commands
|
|
47
47
|
{
|
48
48
|
:branch => "iphone_3.1",
|
49
49
|
:create_dev_branch => true,
|
50
|
-
:git_path => "git@github.scm.corp.ebay.com:eBayMobile/
|
50
|
+
:git_path => "git@github.scm.corp.ebay.com:eBayMobile/ios_iphone_core.git",
|
51
|
+
:taggable => true,
|
51
52
|
},
|
52
53
|
{
|
53
|
-
:branch => "
|
54
|
+
:branch => "nautilus_3.1",
|
54
55
|
:create_dev_branch => true,
|
55
|
-
:git_path => "git@github.scm.corp.ebay.com:eBayMobile/
|
56
|
+
:git_path => "git@github.scm.corp.ebay.com:eBayMobile/ios_nautilus.git",
|
57
|
+
:taggable => true,
|
56
58
|
},
|
57
59
|
{
|
58
60
|
:tag => "2.2.9",
|
data/lib/commands/prepare.rb
CHANGED
@@ -71,7 +71,7 @@ module Commands
|
|
71
71
|
end
|
72
72
|
|
73
73
|
# extract the directory name that this repo ended up in
|
74
|
-
repo_name =
|
74
|
+
repo_name = EbmSharedLib.get_repo_name(git_path)
|
75
75
|
repo_path = "#{top_dir}/#{repo_name}"
|
76
76
|
|
77
77
|
# now set up the remote tracking base branch if we have one
|
@@ -97,6 +97,12 @@ module Commands
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
# pull any submodules
|
101
|
+
cmd = "git submodule init && git submodule update"
|
102
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
103
|
+
raise "Cloning submodules in repo at #{git_path} failed."
|
104
|
+
end
|
105
|
+
|
100
106
|
end
|
101
107
|
|
102
108
|
def run(global_options)
|
@@ -106,15 +112,9 @@ module Commands
|
|
106
112
|
config_name = options[:config]
|
107
113
|
initials = options[:initials]
|
108
114
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
json = File.open(config_path, 'r') {|f| f.read }
|
113
|
-
info = JSON.parse(json)
|
114
|
-
info.recursively_symbolize_keys!
|
115
|
-
rescue
|
116
|
-
raise "Error opening config file JSON: #{config_path}"
|
117
|
-
end
|
115
|
+
# try to make sure the repo is available
|
116
|
+
EbmSharedLib.prepare_config_repo
|
117
|
+
info = EbmSharedLib.read_repo_config(config_name)
|
118
118
|
|
119
119
|
# Now that we have the json, prepare the world by creating a directory with the config name and placing
|
120
120
|
# the various repos beneath that. The directory is created relative to the current directory.
|
data/lib/commands/tag.rb
ADDED
@@ -0,0 +1,81 @@
|
|
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 Tag
|
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
|
+
:config,
|
22
|
+
:tag,
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
def register(opts, global_options)
|
27
|
+
opts.banner = "Usage: tag [options]"
|
28
|
+
opts.description = "Apply or delete a tag for all taggable repos in a config"
|
29
|
+
|
30
|
+
opts.on('-c', "--config name", "Required - Name of the config we are preparing from.") do |v|
|
31
|
+
options[:config] = v
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on('-t', "--tag name", "Required - Name of the tag.") do |v|
|
35
|
+
options[:tag] = v
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.on('-d', "--delete", "When set causes tag to be deleted.") do |v|
|
39
|
+
options[:delete] = v
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def run(global_options)
|
45
|
+
|
46
|
+
# see if we can open the config file - we append the .config suffix
|
47
|
+
# the file is expected to be in JSON format
|
48
|
+
config_name = options[:config]
|
49
|
+
tag = options[:tag]
|
50
|
+
delete_tag = options[:delete]
|
51
|
+
|
52
|
+
# try to make sure the repo is available
|
53
|
+
EbmSharedLib.prepare_config_repo
|
54
|
+
info = EbmSharedLib.read_repo_config(config_name)
|
55
|
+
|
56
|
+
# other than prepare, any commands that work across the repos expect you to start
|
57
|
+
# in the containing directory (i.e. if your config is named iphone_3.1, you are expected
|
58
|
+
# to be in that directory when you run the command).
|
59
|
+
top_dir = "#{Dir.pwd}"
|
60
|
+
|
61
|
+
repos = info[:repos]
|
62
|
+
repos.each do |repo|
|
63
|
+
if repo[:taggable]
|
64
|
+
repo_name = EbmSharedLib.get_repo_name(repo[:git_path])
|
65
|
+
repo_path = "#{top_dir}/#{repo_name}"
|
66
|
+
if delete_tag == true
|
67
|
+
cmd = "git tag -d #{tag} && git push origin :refs/tags/#{tag}"
|
68
|
+
else
|
69
|
+
cmd = "git tag #{tag} && git push origin refs/tags/#{tag}"
|
70
|
+
end
|
71
|
+
if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
|
72
|
+
raise "Tagging operation failed for #{repo_name}."
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
data/lib/commands.rb
CHANGED
data/lib/ebm.rb
CHANGED
@@ -46,12 +46,11 @@ class Ebm
|
|
46
46
|
sub_commands[:prepare] = Commands::Prepare.new
|
47
47
|
sub_commands[:list_configs] = Commands::ListConfigs.new
|
48
48
|
sub_commands[:make_sample] = Commands::MakeSample.new
|
49
|
+
sub_commands[:tag] = Commands::Tag.new
|
49
50
|
end
|
50
51
|
|
51
52
|
def setup
|
52
53
|
options.clear
|
53
|
-
# try to make sure the repo is available
|
54
|
-
EbmSharedLib.prepare_config_repo
|
55
54
|
# global options
|
56
55
|
global_options do |opts|
|
57
56
|
opts.banner = "Version: #{Info.version} - Usage: #{CMD} [options] [subcommand [options]]"
|
@@ -58,6 +58,23 @@ module EbmSharedLib
|
|
58
58
|
|
59
59
|
end
|
60
60
|
|
61
|
+
# read and return the config info for this repo
|
62
|
+
def self.read_repo_config(config_name)
|
63
|
+
config_path = "#{EbmSharedLib::CONFIG_PATH}/configs/#{config_name}#{EbmSharedLib::CONFIG_SUFFIX}"
|
64
|
+
|
65
|
+
begin
|
66
|
+
json = File.open(config_path, 'r') {|f| f.read }
|
67
|
+
info = JSON.parse(json)
|
68
|
+
info.recursively_symbolize_keys!
|
69
|
+
rescue
|
70
|
+
raise "Error opening config file JSON: #{config_path}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.get_repo_name(git_path)
|
75
|
+
repo_name = git_path.split("/").last.split(".git")[0]
|
76
|
+
end
|
77
|
+
|
61
78
|
def self.printer
|
62
79
|
@printer ||= Printer.new
|
63
80
|
end
|
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.5
|
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-05-
|
12
|
+
date: 2013-05-24 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: subcommand
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- lib/commands/list_configs.rb
|
54
54
|
- lib/commands/make_sample.rb
|
55
55
|
- lib/commands/prepare.rb
|
56
|
+
- lib/commands/tag.rb
|
56
57
|
- lib/commands.rb
|
57
58
|
- lib/ebm.rb
|
58
59
|
- lib/ebmsharedlib/monkey_patches.rb
|