-
-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8a66ddc
Showing
7 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
source 'http://rubygems.org' | |||
|
|||
# Specify your gem's dependencies in brewdler.gemspec | |||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
#!/usr/bin/env rake | |||
require 'bundler/gem_tasks' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
require "brewdler/version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
module Brewdler | |||
VERSION = "0.0.1" | |||
end |