Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 8a66ddc36d917cba9b0aee0ead352492adfec77e 0 parents
@andrew andrew authored
17 .gitignore
@@ -0,0 +1,17 @@
+*.gem
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
+coverage
+doc/
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
4 Gemfile
@@ -0,0 +1,4 @@
+source 'http://rubygems.org'
+
+# Specify your gem's dependencies in brewdler.gemspec
+gemspec
2  Rakefile
@@ -0,0 +1,2 @@
+#!/usr/bin/env rake
+require 'bundler/gem_tasks'
51 bin/brewdle
@@ -0,0 +1,51 @@
+#!/usr/bin/env ruby
+
+require 'brewdler'
+require 'commander/import'
+
+program :version, Brewdler::VERSION
+program :description, 'CLI helper for brewdler'
+
+default_command :install
+
+command :install do |c|
+ c.description = 'Install all homebrew based dependecies'
+ c.action do |args, options|
+
+ begin
+ dependencies = []
+ File.open(File.join(Dir.pwd, 'Brewfile')).each { |line|
+ line.chomp!
+ if line.length > 0
+ dependencies << line
+ end
+ }
+ rescue
+ puts 'No Brewfile found'
+ end
+
+ dependencies.each do |dependency|
+ installed_version = installed?(dependency)
+ puts "#{installed_version ? 'Using' : 'Installing'}: #{dependency} #{installed_version}"
+ install(dependency) unless installed_version
+ end
+
+ puts "All dependencies installed"
+ end
+end
+
+def install(name)
+ brewable = `brew info #{name}`
+ if brewable[0..4] != 'Error'
+ system "brew install #{name}"
+ else
+ puts "Error: No available formula for #{name}"
+ end
+end
+
+def installed?(name)
+ installed = `brew list #{name} -v`
+ if installed.length > 0
+ return installed.split(' ').last
+ end
+end
17 brewdler.gemspec
@@ -0,0 +1,17 @@
+# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/brewdler/version', __FILE__)
+
+Gem::Specification.new do |gem|
+ gem.authors = ["Andrew Nesbitt"]
+ gem.email = ["andrewnez@gmail.com"]
+ gem.summary = %q{Bundler for non-ruby dependencies from homebrew}
+
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ gem.files = `git ls-files`.split("\n")
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ gem.name = "brewdler"
+ gem.require_paths = ['lib']
+ gem.version = Brewdler::VERSION
+
+ gem.add_dependency 'commander'
+end
1  lib/brewdler.rb
@@ -0,0 +1 @@
+require "brewdler/version"
3  lib/brewdler/version.rb
@@ -0,0 +1,3 @@
+module Brewdler
+ VERSION = "0.0.1"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.