homebrew_automation 0.1.8 → 0.1.10

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
  SHA256:
3
- metadata.gz: 8d054d038e31594b07be5051321a9a5f7dc18cc83031f416c9d00d9819dd979a
4
- data.tar.gz: 547b653fdabe4f93af5fd59c8a12dbbebfecc050d527b52f1ace51803f62c423
3
+ metadata.gz: 0a7e329d80eca725cc1e67b8b6adc44be6abcc8188a1667bf68d03221f7132d3
4
+ data.tar.gz: be1c89833487aea65a54fc4b87c5dfd2299469fd9cecc2739c5d44c4e0513c9f
5
5
  SHA512:
6
- metadata.gz: 26ad126d1240dc589cb75d4dc39e9bd10100e7ecc4856a61021e4c9a14daa644cf775aa82334402303214712a3ac5dc8658a9529e707a30593377f3f40873849
7
- data.tar.gz: 53328d7bfeba0e8cfcffd01d0fd494cd56e04bd7699b40afe94b65e87c37091750956e312b38aef1131962d2a01e1942118fb10c83208d7ef7883bc111c53332
6
+ metadata.gz: 30421bf2d3dfd26da1cbdbaedae7b37793533a587677aea855e6c7c01c5d3d0a522cd86703dc2d1abe02d02b14ff3213e7e01887ea6ee20f849d9f34be11768c
7
+ data.tar.gz: 4eb44efc9e0bcc0bb16bdc6c1c44a9804602a376e533e49bd2060aa75ba236142a00b726fa2c519f6a04d1d9d714da02e943fae618f541441da49da1f7e800bd
@@ -81,6 +81,10 @@ module HomebrewAutomation
81
81
  begin
82
82
  @brew.tap!(@tap_name, @tap_url)
83
83
  tapped = true
84
+ if @brew.list!([], fully_qualified_formula_name)
85
+ # passing `--force` to uninstall all versions
86
+ @brew.uninstall!(['--force'], fully_qualified_formula_name)
87
+ end
84
88
  @brew.install!(
85
89
  %w[--verbose --build-bottle] + if @keep_tmp then %w[--keep-tmp] else [] end,
86
90
  fully_qualified_formula_name)
@@ -35,6 +35,30 @@ module HomebrewAutomation
35
35
  raise OlderVersionAlreadyInstalled
36
36
  end
37
37
 
38
+ class UninstallFailed < StandardError
39
+ end
40
+
41
+ # +brew uninstall [opts] "$fully_qualified_formula_name"+
42
+ #
43
+ # @param opts [Array<String>]
44
+ # @param fully_qualified_formula_name [String]
45
+ def self.uninstall!(opts, fully_qualified_formula_name)
46
+ checked('brew', 'uninstall', *opts, fully_qualified_formula_name)
47
+ rescue Error
48
+ raise UninstallFailed
49
+ end
50
+
51
+ # +brew list [opts] "$fully_qualified_formula_name"+
52
+ #
53
+ # Good for checking whether a Formula is installed.
54
+ #
55
+ # @param opts [Array<String>]
56
+ # @param fully_qualified_formula_name [String]
57
+ # @return true iff the Formula is installed
58
+ def self.list!(opts, fully_qualified_formula_name)
59
+ system('brew', 'list', *opts, fully_qualified_formula_name)
60
+ end
61
+
38
62
  # +brew bottle [opts] "$fully_qualified_formula_name"+
39
63
  #
40
64
  # @param opts [Array<String>]
@@ -2,6 +2,6 @@
2
2
  module HomebrewAutomation
3
3
 
4
4
  # Yep.
5
- VERSION = '0.1.8'
5
+ VERSION = '0.1.10'
6
6
 
7
7
  end
@@ -85,6 +85,8 @@ module HomebrewAutomation
85
85
  "Caused by: #{e.cause}",
86
86
  (e.cause ? e.cause.backtrace.join("\n") : '')
87
87
  ].join("\n"))
88
+ rescue HomebrewAutomation::Brew::UninstallFailed => e
89
+ logger.error!("brew uninstall failed:\n" + e.backtrace.join("\n"))
88
90
  rescue HomebrewAutomation::Brew::Error => e
89
91
  logger.error!(
90
92
  "Something went wrong in this Homebrew command: " +
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homebrew_automation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - easoncxz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-25 00:00:00.000000000 Z
11
+ date: 2020-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '12.3'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '12.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry-byebug
43
43
  requirement: !ruby/object:Gem::Requirement