brewdler 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,9 @@
1
+ ## Contributing
2
+ * Fork the project.
3
+ * Make your feature addition or bug fix.
4
+ * Add tests for it. This is important so I don't break it in a
5
+ future version unintentionally.
6
+ * Add documentation if necessary.
7
+ * Commit, do not mess with rakefile, version, or history.
8
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
9
+ * Send a pull request. Bonus points for topic branches.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Andrew Nesbitt
1
+ Copyright (c) 2013 Andrew Nesbitt
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Readme.mdown CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Bundler for non-ruby dependencies from homebrew
4
4
 
5
+ [![Gem Version](https://badge.fury.io/rb/brewdler.png)](http://badge.fury.io/rb/brewdler)
6
+ [![Dependency Status](https://gemnasium.com/andrew/brewdler.png)](https://gemnasium.com/andrew/brewdler)
7
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/andrew/brewdler)
8
+
5
9
  ## Requirements
6
10
 
7
11
  [Homebrew](http://github.com/mxcl/homebrew) is used for installing the dependencies, it only works on a mac and so does this gem.
@@ -53,4 +57,4 @@ Report Issues/Feature requests on [GitHub Issues](http://github.com/andrew/brewd
53
57
 
54
58
  ## Copyright
55
59
 
56
- Copyright (c) 2011 Andrew Nesbitt. See LICENSE for details.
60
+ Copyright (c) 2013 Andrew Nesbitt. See LICENSE for details.
data/bin/brewdle CHANGED
@@ -13,21 +13,21 @@ command :install do |c|
13
13
  c.action do |args, options|
14
14
 
15
15
  begin
16
- dependencies = []
17
- File.open(File.join(Dir.pwd, 'Brewfile')).each { |line|
16
+ dependencies = File.open(File.join(Dir.pwd, 'Brewfile')).find_all { |line|
18
17
  line.chomp!
19
- if line.length > 0 && !comment?(line)
20
- dependencies << line
21
- end
18
+ line.length > 0 && !comment?(line)
22
19
  }
23
20
  rescue
24
21
  puts 'No Brewfile found'
25
22
  end
26
23
 
27
24
  dependencies.each do |dependency|
28
- installed_version = installed?(dependency)
29
- puts "#{installed_version ? 'Using' : 'Installing'}: #{dependency} #{installed_version}"
30
- install(dependency) unless installed_version
25
+ if installed?(dependency)
26
+ puts "Using #{dependency} (#{installed_version(dependency)})"
27
+ else
28
+ puts "Installing #{dependency} (#{formula_version(dependency)})"
29
+ install(dependency)
30
+ end
31
31
  end
32
32
 
33
33
  puts "All dependencies installed"
@@ -44,10 +44,18 @@ def install(name)
44
44
  end
45
45
 
46
46
  def installed?(name)
47
- installed = `brew list #{name} -v`
48
- if installed.length > 0 && !installed.match(/\AError/)
49
- return installed.split(' ').last
50
- end
47
+ installed_version = `brew list --versions #{name}`.chomp
48
+ !installed_version.empty?
49
+ end
50
+
51
+ def installed_version(name)
52
+ installed_version = `brew list --versions #{name}`.chomp
53
+ installed_version.match(/#{name} ([^\s]+)/)[1]
54
+ end
55
+
56
+ def formula_version(name)
57
+ formula_version = `brew info #{name}`
58
+ formula_version.split($/).first.match(/#{name}: stable ([^\s,]+)/)[1]
51
59
  end
52
60
 
53
61
  def comment?(line)
@@ -1,3 +1,3 @@
1
1
  module Brewdler
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
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.2.1
4
+ version: 0.3.0
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: 2012-09-30 00:00:00.000000000 Z
12
+ date: 2013-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: commander
16
- requirement: &70125840636540 !ruby/object:Gem::Requirement
16
+ requirement: &70267521127940 !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: *70125840636540
24
+ version_requirements: *70267521127940
25
25
  description:
26
26
  email:
27
27
  - andrewnez@gmail.com
@@ -31,6 +31,7 @@ extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
33
  - .gitignore
34
+ - CONTRIBUTING.md
34
35
  - Gemfile
35
36
  - LICENSE
36
37
  - Rakefile
@@ -64,3 +65,4 @@ signing_key:
64
65
  specification_version: 3
65
66
  summary: Bundler for non-ruby dependencies from homebrew
66
67
  test_files: []
68
+ has_rdoc: