brewdler 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/brewdle +21 -7
  2. data/lib/brewdler/version.rb +1 -1
  3. metadata +4 -4
data/bin/brewdle CHANGED
@@ -21,16 +21,25 @@ command :install do |c|
21
21
  puts 'No Brewfile found'
22
22
  end
23
23
 
24
- dependencies.each do |dependency|
25
- if installed?(dependency)
26
- puts "Using #{dependency} (#{installed_version(dependency)})"
27
- else
28
- puts "Installing #{dependency} (#{formula_version(dependency)})"
29
- install(dependency)
24
+ missing_formulae = dependencies.find_all { |dependency|
25
+ !formula_exists?(dependency)
26
+ }
27
+
28
+ if missing_formulae.empty?
29
+ dependencies.each do |dependency|
30
+ if installed?(dependency)
31
+ puts "Using #{dependency} (#{installed_version(dependency)})"
32
+ else
33
+ puts "Installing #{dependency} (#{formula_version(dependency)})"
34
+ install(dependency)
35
+ end
30
36
  end
37
+ puts "All dependencies installed"
38
+ else
39
+ puts "Non-existent formula/e: #{missing_formulae.join(', ')}"
40
+ puts "(please check spelling in Brewfile, and/or run 'brew update')"
31
41
  end
32
42
 
33
- puts "All dependencies installed"
34
43
  end
35
44
  end
36
45
 
@@ -43,6 +52,11 @@ def install(name)
43
52
  end
44
53
  end
45
54
 
55
+ def formula_exists?(name)
56
+ formula_location = File.join(`brew --prefix`.chomp, 'Library', 'Formula', name + ".rb")
57
+ File.exists? formula_location
58
+ end
59
+
46
60
  def installed?(name)
47
61
  installed_version = `brew list --versions #{name}`.chomp
48
62
  !installed_version.empty?
@@ -1,3 +1,3 @@
1
1
  module Brewdler
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brewdler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-23 00:00:00.000000000 Z
12
+ date: 2013-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
16
- requirement: &70267521127940 !ruby/object:Gem::Requirement
16
+ requirement: &70296410699500 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70267521127940
24
+ version_requirements: *70296410699500
25
25
  description:
26
26
  email:
27
27
  - andrewnez@gmail.com