brewdler 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in brewdler.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Andrew Nesbitt
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
data/Readme.mdown ADDED
@@ -0,0 +1,47 @@
1
+ # Brewdler
2
+
3
+ Bundler for non-ruby dependencies from homebrew
4
+
5
+ ## Requirements
6
+
7
+ [Homebrew]()
8
+
9
+ ## Usage
10
+
11
+ Install using rubygems:
12
+
13
+ $ gem install brewdler
14
+
15
+ then create a `Brewfile` in the root of your project:
16
+
17
+ $ touch Brewfile
18
+
19
+ Then list your homebrew based dependencies in your `Brewfile`:
20
+
21
+ redis
22
+ mongodb
23
+ sphinx
24
+ imagemagick
25
+
26
+ You can then easily install all of the dependencies on a new mac like so:
27
+
28
+ $ brewdle install
29
+
30
+ ## Development
31
+
32
+ Source hosted at [GitHub](http://github.com/andrew/brewdler).
33
+ Report Issues/Feature requests on [GitHub Issues](http://github.com/andrew/brewdler/issues).
34
+
35
+ ### Note on Patches/Pull Requests
36
+
37
+ * Fork the project.
38
+ * Make your feature addition or bug fix.
39
+ * Add tests for it. This is important so I don't break it in a
40
+ future version unintentionally.
41
+ * Commit, do not mess with rakefile, version, or history.
42
+ (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)
43
+ * Send me a pull request. Bonus points for topic branches.
44
+
45
+ ## Copyright
46
+
47
+ Copyright (c) 2011 Andrew Nesbitt. See LICENSE for details.
data/bin/brewdle ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'brewdler'
4
+ require 'commander/import'
5
+
6
+ program :version, Brewdler::VERSION
7
+ program :description, 'CLI helper for brewdler'
8
+
9
+ default_command :install
10
+
11
+ command :install do |c|
12
+ c.description = 'Install all homebrew based dependecies'
13
+ c.action do |args, options|
14
+
15
+ begin
16
+ dependencies = []
17
+ File.open(File.join(Dir.pwd, 'Brewfile')).each { |line|
18
+ line.chomp!
19
+ if line.length > 0
20
+ dependencies << line
21
+ end
22
+ }
23
+ rescue
24
+ puts 'No Brewfile found'
25
+ end
26
+
27
+ dependencies.each do |dependency|
28
+ installed_version = installed?(dependency)
29
+ puts "#{installed_version ? 'Using' : 'Installing'}: #{dependency} #{installed_version}"
30
+ install(dependency) unless installed_version
31
+ end
32
+
33
+ puts "All dependencies installed"
34
+ end
35
+ end
36
+
37
+ def install(name)
38
+ brewable = `brew info #{name}`
39
+ if brewable[0..4] != 'Error'
40
+ system "brew install #{name}"
41
+ else
42
+ puts "Error: No available formula for #{name}"
43
+ end
44
+ end
45
+
46
+ def installed?(name)
47
+ installed = `brew list #{name} -v`
48
+ if installed.length > 0
49
+ return installed.split(' ').last
50
+ end
51
+ end
data/brewdler.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/brewdler/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Andrew Nesbitt"]
6
+ gem.email = ["andrewnez@gmail.com"]
7
+ gem.summary = %q{Bundler for non-ruby dependencies from homebrew}
8
+
9
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
10
+ gem.files = `git ls-files`.split("\n")
11
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
+ gem.name = "brewdler"
13
+ gem.require_paths = ['lib']
14
+ gem.version = Brewdler::VERSION
15
+
16
+ gem.add_dependency 'commander'
17
+ end
data/lib/brewdler.rb ADDED
@@ -0,0 +1 @@
1
+ require "brewdler/version"
@@ -0,0 +1,3 @@
1
+ module Brewdler
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brewdler
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Andrew Nesbitt
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-25 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: commander
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description:
36
+ email:
37
+ - andrewnez@gmail.com
38
+ executables:
39
+ - brewdle
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - .gitignore
46
+ - Gemfile
47
+ - LICENSE
48
+ - Rakefile
49
+ - Readme.mdown
50
+ - bin/brewdle
51
+ - brewdler.gemspec
52
+ - lib/brewdler.rb
53
+ - lib/brewdler/version.rb
54
+ has_rdoc: true
55
+ homepage:
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ hash: 3
69
+ segments:
70
+ - 0
71
+ version: "0"
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ requirements: []
82
+
83
+ rubyforge_project:
84
+ rubygems_version: 1.3.7
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Bundler for non-ruby dependencies from homebrew
88
+ test_files: []
89
+