ebm 0.0.35 → 0.0.36

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45fae87b7c177cd761ba24301d0122fee2cb12ef
4
- data.tar.gz: a18668eeea450ba475337bc90c22064ea528f8c1
3
+ metadata.gz: e01e34fd0e0fb60f1d0aa96ded8834191e50502c
4
+ data.tar.gz: df9abd77254e4141b25a7d2b63b678cb8d9619e0
5
5
  SHA512:
6
- metadata.gz: a9c96ae05d4ca446d9bc8ad634ec1e9c29a48fde16cd944449be26bde84d76217a15fb09261d31c802709199d011cd49b958b810df9a3689003d51caab19e71c
7
- data.tar.gz: 91d364cec191198fcb72bcb6f9d40abc8ba7ac3ecf00812cccf15ffc35046afff451478092761f7580218556c43e39b825acd156ee34d960e7a87da7d434c6be
6
+ metadata.gz: c0db7315f413799a57965c62508baf77ab2790ad8ab262297ef58457b84a598de56fb5a5ce2fecd2a1416a3aa29e33a6c2f66ec04d61c5a03ac9af66a031c365
7
+ data.tar.gz: e9a6ffde83a164d98530026d19c81e60d8c7a6ddac11b06f9d714875edccc59eb0e7d392ddb02b82c24834a8dc78b57c7cc5ba859b74b834e43a62bcb1c7e392
data/lib/commands.rb CHANGED
@@ -24,6 +24,7 @@ require 'commands/tag'
24
24
  require 'commands/status'
25
25
  require 'commands/periodic'
26
26
  require 'commands/pull'
27
+ require 'commands/format_helper'
27
28
  require 'commands/push'
28
29
  require 'commands/prune'
29
30
  require 'commands/commit'
@@ -0,0 +1,106 @@
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 FormatHelper
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: format_helper [options]"
26
+ opts.description = "Create checkouts and removes after format merge - only for android code reformat."
27
+ opts.on('-n', "--dry-run", "Perform a dry run.") do |v|
28
+ options[:dry_run] = true
29
+ end
30
+ end
31
+
32
+ # @param [Object] global_options
33
+ def run(global_options)
34
+
35
+ if ARGV.length > 0
36
+ raise "You must specify all arguments with their options."
37
+ end
38
+ dry_run = !!options[:dry_run]
39
+
40
+ # get config based on name of current dir
41
+ info = EbmSharedLib.get_config_from_top_dir
42
+
43
+ # Back up to version parent dir. This directory contains the top level repos.
44
+ top_dir = Dir.pwd
45
+
46
+ merge_failed = false
47
+ repos = info[:repos]
48
+ repos.each do |repo|
49
+ repo_name = EbmSharedLib.get_repo_name(repo[:git_path])
50
+ repo_path = "#{top_dir}/#{repo_name}"
51
+ branch = repo[:branch]
52
+ base_branch = repo[:base_branch]
53
+
54
+ puts("\n#{repo_name} format_helper:\n");
55
+
56
+ cmd = "git status --short"
57
+ result = EbmSharedLib::CL.do_cmd_output(cmd, repo_path)
58
+ if $?.exitstatus != 0
59
+ raise "Git status failed for #{repo_name}."
60
+ end
61
+
62
+ pairs = result.split
63
+
64
+ len = pairs.length
65
+ cur = 0
66
+ matches = 0
67
+ while true
68
+ if cur == len
69
+ break
70
+ end
71
+ code = pairs[cur]
72
+ cur += 1
73
+ path = pairs[cur]
74
+ cur += 1
75
+ if code == "UU"
76
+ matches +=1
77
+ #puts "#{code} - #{path}"
78
+ cmd = "git checkout --ours -- #{path}"
79
+ if dry_run
80
+ puts cmd
81
+ else
82
+ if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
83
+ raise "Git checkout failed for #{path}."
84
+ end
85
+ cmd = "git add #{path}"
86
+ if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
87
+ raise "Git add failed for #{path}."
88
+ end
89
+ end
90
+ elsif code == "DU"
91
+ matches += 1
92
+ cmd = "git rm #{path}"
93
+ if dry_run
94
+ puts cmd
95
+ else
96
+ if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0
97
+ raise "Git rm failed for #{path}."
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
104
+
105
+ end
106
+ end
data/lib/ebm.rb CHANGED
@@ -50,6 +50,7 @@ class Ebm
50
50
  sub_commands[:status] = Commands::Status.new
51
51
  sub_commands[:periodic] = Commands::Periodic.new
52
52
  sub_commands[:pull] = Commands::Pull.new
53
+ sub_commands[:format_helper] = Commands::FormatHelper.new
53
54
  sub_commands[:prune] = Commands::Prune.new
54
55
  sub_commands[:push] = Commands::Push.new
55
56
  sub_commands[:commit] = Commands::Commit.new
data/lib/info.rb CHANGED
@@ -7,6 +7,6 @@
7
7
  #
8
8
  class Info
9
9
  def self.version
10
- "0.0.35"
10
+ "0.0.36"
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ebm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Seitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-14 00:00:00.000000000 Z
11
+ date: 2013-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: subcommand
@@ -75,6 +75,7 @@ extra_rdoc_files: []
75
75
  files:
76
76
  - lib/commands/commit.rb
77
77
  - lib/commands/configs.rb
78
+ - lib/commands/format_helper.rb
78
79
  - lib/commands/make_sample.rb
79
80
  - lib/commands/periodic.rb
80
81
  - lib/commands/prepare.rb