ebm 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA512:
3
- metadata.gz: 32cdc9bf7adf801aa840816d489dccfc95cf2cdf134d9940eeaac7cb35c9b58e16667b5ef2526c91ada1bd58faced776163aa43d847b1cd48c0079297dce8210
4
- data.tar.gz: ed32c38a0fbb9ab7a24d71fd542cf788ff0f382cc5c8798c4d9116743e16996c82eef50caf4b6dce9bd113cf7e995e5b79db9ec56317e72245e7f5a828df4449
5
2
  SHA1:
6
- metadata.gz: ec8161d094ba53712e250bf0156f852e66135588
7
- data.tar.gz: d4c046c11db8cae90101d77d4c3e940a475ff40a
3
+ data.tar.gz: 0c725195aa2ea01b30175db0d8dccaf28cfd2a73
4
+ metadata.gz: c1170d96be399a05361ed6f12d00e6d26ea07b73
5
+ SHA512:
6
+ data.tar.gz: 4284c1187dfdd820e75aeb30866bf3c43c77ea99513b5ac712978838de8b2ebcbc54f48c98223e8c365b90d4b7acfec765d95cf1f1c60d39413f7e1cfe58e5a4
7
+ metadata.gz: 390cace7b072bdfebe5b2f055843f4fba7cc0de790dafd7a836acc4339ab37422f9e014deffa130825f959c38fc590151e2784167abf628f9385881d039c009f
data/lib/commands.rb CHANGED
@@ -18,3 +18,4 @@ require 'commands/prepare'
18
18
  require 'commands/list_configs'
19
19
  require 'commands/make_sample'
20
20
  require 'commands/tag'
21
+ require 'commands/status'
@@ -0,0 +1,64 @@
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 Status
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: status"
26
+ opts.description = "Shows the git status of all repos in the config. Expects to be called from within a top level repo."
27
+
28
+ end
29
+
30
+ def run(global_options)
31
+
32
+ # see if we can open the config file - we append the .config suffix
33
+ # the file is expected to be in JSON format
34
+
35
+ # determine config_name by extracting parent of our directory
36
+ config_name = "#{Dir.pwd}".split("/")[-2]
37
+ if config_name.nil?
38
+ raise "No version directory found. This command must be run from within one of your top level repos."
39
+ end
40
+
41
+ # try to make sure the repo is available
42
+ EbmSharedLib.prepare_config_repo
43
+ info = EbmSharedLib.read_repo_config(config_name)
44
+
45
+ # Back up to version parent dir. This directory contains the top level repos.
46
+ top_dir = File.expand_path("#{Dir.pwd}/..")
47
+
48
+ repos = info[:repos]
49
+ repos.each do |repo|
50
+ if repo[:create_dev_branch]
51
+ repo_name = EbmSharedLib.get_repo_name(repo[:git_path])
52
+ repo_path = "#{top_dir}/#{repo_name}"
53
+ puts("\n#{repo_name} status:\n");
54
+ cmd = "git status"
55
+ if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
56
+ raise "Git status failed for #{repo_name}. Make sure you run the command from within a top level repo directory."
57
+ end
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+ end
data/lib/commands/tag.rb CHANGED
@@ -18,7 +18,6 @@ module Commands
18
18
  # required options
19
19
  def required_options
20
20
  @required_options ||= Set.new [
21
- :config,
22
21
  :tag,
23
22
  ]
24
23
  end
@@ -27,10 +26,6 @@ module Commands
27
26
  opts.banner = "Usage: tag [options]"
28
27
  opts.description = "Apply or delete a tag for all taggable repos in a config"
29
28
 
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
29
  opts.on('-t', "--tag name", "Required - Name of the tag.") do |v|
35
30
  options[:tag] = v
36
31
  end
@@ -45,10 +40,12 @@ module Commands
45
40
 
46
41
  # see if we can open the config file - we append the .config suffix
47
42
  # the file is expected to be in JSON format
48
- config_name = options[:config]
49
43
  tag = options[:tag]
50
44
  delete_tag = options[:delete]
51
45
 
46
+ # determine config_name by extracting our directory
47
+ config_name = EbmSharedLib.config_name_from_dir(Dir.pwd)
48
+
52
49
  # try to make sure the repo is available
53
50
  EbmSharedLib.prepare_config_repo
54
51
  info = EbmSharedLib.read_repo_config(config_name)
@@ -69,7 +66,7 @@ module Commands
69
66
  cmd = "git tag #{tag} && git push origin refs/tags/#{tag}"
70
67
  end
71
68
  if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
72
- raise "Tagging operation failed for #{repo_name}."
69
+ raise "Tagging operation failed for #{repo_name}. Make sure you are in the top level #{config_name} directory."
73
70
  end
74
71
 
75
72
  end
data/lib/ebm.rb CHANGED
@@ -47,6 +47,7 @@ class Ebm
47
47
  sub_commands[:list_configs] = Commands::ListConfigs.new
48
48
  sub_commands[:make_sample] = Commands::MakeSample.new
49
49
  sub_commands[:tag] = Commands::Tag.new
50
+ sub_commands[:status] = Commands::Status.new
50
51
  end
51
52
 
52
53
  def setup
@@ -71,6 +71,13 @@ module EbmSharedLib
71
71
  end
72
72
  end
73
73
 
74
+ # expects us to be in the top level dir that has the same name
75
+ # as the config. Such as /Users/gseitz/Develop/ebay/iphone_3.1
76
+ # will extract the config_name of iphone_3.1
77
+ def self.config_name_from_dir(dir)
78
+ config_name = "#{Dir.pwd}".split("/").last
79
+ end
80
+
74
81
  def self.get_repo_name(git_path)
75
82
  repo_name = git_path.split("/").last.split(".git")[0]
76
83
  end
data/lib/info.rb CHANGED
@@ -7,6 +7,6 @@
7
7
  #
8
8
  class Info
9
9
  def self.version
10
- "0.0.6"
10
+ "0.0.7"
11
11
  end
12
12
  end
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.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Seitz
@@ -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/status.rb
56
57
  - lib/commands/tag.rb
57
58
  - lib/commands.rb
58
59
  - lib/ebm.rb