manifestly 2.2.0 → 2.2.1

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
2
  SHA1:
3
- metadata.gz: f0c315b69f70efd0a0a9fbb96b837ec5b8003651
4
- data.tar.gz: 252ae02ec9b3b53fe3f9022f5dac47be059d776f
3
+ metadata.gz: 7a07010d357d1a65507c6b7a8326b9db4b82814d
4
+ data.tar.gz: 01e562142d702cb0c91709e4118aa3522e0975c3
5
5
  SHA512:
6
- metadata.gz: ddb360f349ff360da7593cecf02e6e0bfc8d94f181844cf4068866e5794f07c290fc5914835158d6e4db67a77957cc8be81c9dbffd43a7d79670ef1ac7c4fc71
7
- data.tar.gz: b6a5647e87acad501c243acda516ff23a5f552f8c4439fc71bd0eefb64c3d798c84658042bbfc4689945f395ff4dc2d79d82fab4ca77523317b75a8b26bf99e2
6
+ metadata.gz: 6306bba1d20524ce11f7bf7ba112da59ae5eee735daf8185f6ba4f9875f5eb7046bfa48932b81c9d88f8b23e0d4a257df099f1da94458a2f4a3cc576057330d4
7
+ data.tar.gz: a1c736ab12d009589d19585e484e21ebdd62cc1a2bb9223b2940aecdff80f235a47345b59d10f937d5fb887360bc149ec4f0a3b5f56f0e24ac4d20f4b3c2c42b
@@ -12,6 +12,12 @@ module Manifestly
12
12
  include CommandLineReporter
13
13
  include Manifestly::Ui
14
14
 
15
+ # https://github.com/erikhuda/thor/issues/244
16
+ # http://stackoverflow.com/a/18490048/1664216
17
+ def self.exit_on_failure?
18
+ true
19
+ end
20
+
15
21
  #
16
22
  # Common command line options
17
23
  #
@@ -175,7 +181,7 @@ module Manifestly
175
181
  DESC
176
182
  def create
177
183
  manifest = if options[:based_on]
178
- load_manifest(file: options[:based_on]) || return
184
+ load_manifest(file: options[:based_on]) || error!
179
185
  else
180
186
  Manifest.new
181
187
  end
@@ -212,17 +218,17 @@ module Manifestly
212
218
  DESC
213
219
  def apply
214
220
  begin
215
- manifest = load_manifest(file: options[:file]) || return
221
+ manifest = load_manifest(file: options[:file]) || error!
216
222
  manifest.items.each{ |item| item.checkout_commit!(options[:update]) }
217
223
  rescue Manifestly::ManifestItem::MultipleSameNameRepositories => e
218
224
  say "Multiple repositories have the same name (#{e.message}) so we " +
219
225
  "can't apply the manifest. Try limiting the search_paths or " +
220
226
  "separate the duplicates."
221
- return
227
+ error!
222
228
  rescue Manifestly::Repository::CommitNotPresent => e
223
229
  say "Could not find commit #{e.sha} in repository #{e.repository.github_name_or_path}. " +
224
230
  "Try running again with the `--update` option."
225
- return
231
+ error!
226
232
  end
227
233
 
228
234
 
@@ -276,7 +282,7 @@ module Manifestly
276
282
  repository.get_commit_content(options[:sha])
277
283
  rescue Manifestly::Repository::CommitNotPresent
278
284
  say('That SHA is invalid')
279
- return
285
+ error!
280
286
  end
281
287
 
282
288
  save_as = options[:save_as]
@@ -419,7 +425,7 @@ module Manifestly
419
425
  if !from_manifest || !to_manifest
420
426
  say("Could not load the 'from' manifest so cannot continue with the diff.") if !from_manifest
421
427
  say("Could not load the 'to' manifest so cannot continue with the diff.") if !to_manifest
422
- return
428
+ error!
423
429
  end
424
430
 
425
431
  manifest_diff = ManifestDiff.new(from_manifest, to_manifest)
@@ -758,5 +764,9 @@ module Manifestly
758
764
  nil
759
765
  end
760
766
 
767
+ def error!
768
+ exit 1
769
+ end
770
+
761
771
  end
762
772
  end
@@ -122,7 +122,16 @@ module Manifestly
122
122
  end
123
123
 
124
124
  def get_commit_file(sha)
125
- diff_string = git.show(sha)
125
+ diff_string = begin
126
+ git.show(sha)
127
+ rescue Git::GitExecuteError => e
128
+ if is_commit_not_found_exception?(e)
129
+ raise CommitNotPresent.new(sha, self)
130
+ else
131
+ raise
132
+ end
133
+ end
134
+
126
135
  sha_diff = Diff.new(diff_string)
127
136
 
128
137
  raise(CommitContentError, "No content to retrieve for SHA #{sha}!") if sha_diff.num_files == 0
@@ -157,7 +166,8 @@ module Manifestly
157
166
  end
158
167
 
159
168
  def is_commit_not_found_exception?(e)
160
- e.message.include?("fatal: reference is not a tree")
169
+ e.message.include?("fatal: reference is not a tree") ||
170
+ e.message.include?("fatal: ambiguous argument")
161
171
  end
162
172
 
163
173
  def current_branch_name
@@ -1,3 +1,3 @@
1
1
  module Manifestly
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manifestly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Slavinsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
11
+ date: 2016-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor