brewdler 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.mdown +3 -0
- data/bin/brewdle +1 -12
- data/brewdler.gemspec +1 -0
- data/lib/brewdler.rb +2 -0
- data/lib/brewdler/brew_installer.rb +5 -1
- data/lib/brewdler/cask_installer.rb +5 -1
- data/lib/brewdler/commands/install.rb +18 -0
- data/lib/brewdler/dsl.rb +4 -0
- data/lib/brewdler/repo_installer.rb +11 -0
- data/lib/brewdler/version.rb +1 -1
- data/spec/dsl_spec.rb +2 -1
- data/spec/install_command_spec.rb +19 -0
- metadata +8 -3
data/Readme.mdown
CHANGED
@@ -12,6 +12,8 @@ Bundler for non-ruby dependencies from homebrew
|
|
12
12
|
|
13
13
|
[Homebrew](http://github.com/mxcl/homebrew) is used for installing the dependencies, it only works on a mac and so does this gem.
|
14
14
|
|
15
|
+
[Homebrew brew-tap](https://github.com/mxcl/homebrew/wiki/brew-tap) is new feature in Homebrew-0.9, add more Github repos to the list of formulae.
|
16
|
+
|
15
17
|
[Homebrew-cask](http://github.com/phinze/homebrew-cask) is optional and used for installing Mac applications.
|
16
18
|
|
17
19
|
## Usage
|
@@ -26,6 +28,7 @@ then create a `Brewfile` in the root of your project:
|
|
26
28
|
|
27
29
|
Then list your homebrew based dependencies in your `Brewfile`:
|
28
30
|
|
31
|
+
tap 'phinze/cask'
|
29
32
|
brew 'redis'
|
30
33
|
brew 'mongodb'
|
31
34
|
brew 'sphinx'
|
data/bin/brewdle
CHANGED
@@ -11,17 +11,6 @@ default_command :install
|
|
11
11
|
command :install do |c|
|
12
12
|
c.description = 'Install all homebrew based dependecies'
|
13
13
|
c.action do |args, options|
|
14
|
-
|
15
|
-
file = File.read(File.join(Dir.pwd, "Brewfile"))
|
16
|
-
Brewdler::Dsl.new(file).process
|
17
|
-
rescue Errno::ENOENT => e
|
18
|
-
raise "No Brewfile found\n#{e.message}"
|
19
|
-
rescue NameError
|
20
|
-
file = File.open(File.join(Dir.pwd, "Brewfile"))
|
21
|
-
file.find_all do |name|
|
22
|
-
name.chomp!
|
23
|
-
Brewdler::BrewInstaller.install(name) if name.length > 0 && name !~ /^ *#/
|
24
|
-
end
|
25
|
-
end
|
14
|
+
Brewdler::Commands::Install.run
|
26
15
|
end
|
27
16
|
end
|
data/brewdler.gemspec
CHANGED
@@ -5,6 +5,7 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.authors = ["Andrew Nesbitt", "James A. Anderson", "Amos King"]
|
6
6
|
gem.email = ["andrewnez@gmail.com", "me@jamesaanderson.com", "amos.l.king@gmail.com"]
|
7
7
|
gem.summary = %q{Bundler for non-ruby dependencies from homebrew}
|
8
|
+
gem.licenses = ['MIT']
|
8
9
|
|
9
10
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
10
11
|
gem.files = `git ls-files`.split("\n")
|
data/lib/brewdler.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
module Brewdler
|
2
2
|
class BrewInstaller
|
3
3
|
def self.install(name)
|
4
|
-
|
4
|
+
if system 'brew info'
|
5
|
+
`brew install #{name}`
|
6
|
+
else
|
7
|
+
raise "Unable to install #{name}. Homebrew is not currently installed on your system"
|
8
|
+
end
|
5
9
|
end
|
6
10
|
end
|
7
11
|
end
|
@@ -1,7 +1,11 @@
|
|
1
1
|
module Brewdler
|
2
2
|
class CaskInstaller
|
3
3
|
def self.install(name)
|
4
|
-
|
4
|
+
if system 'brew cask info'
|
5
|
+
`brew cask install #{name}`
|
6
|
+
else
|
7
|
+
raise "Unable to install #{name}. Homebrew-cask is not currently installed on your system"
|
8
|
+
end
|
5
9
|
end
|
6
10
|
end
|
7
11
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Brewdler::Commands
|
2
|
+
class Install
|
3
|
+
def self.run
|
4
|
+
begin
|
5
|
+
file = File.read(File.join(Dir.pwd, "Brewfile"))
|
6
|
+
Brewdler::Dsl.new(file).process
|
7
|
+
rescue Errno::ENOENT => e
|
8
|
+
raise "No Brewfile found"
|
9
|
+
rescue NameError
|
10
|
+
file = File.open(File.join(Dir.pwd, "Brewfile"))
|
11
|
+
file.find_all do |name|
|
12
|
+
name.chomp!
|
13
|
+
Brewdler::BrewInstaller.install(name) if name.length > 0 && name !~ /^ *#/
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/brewdler/dsl.rb
CHANGED
data/lib/brewdler/version.rb
CHANGED
data/spec/dsl_spec.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Brewdler::Dsl do
|
4
|
-
let(:dsl) { Brewdler::Dsl.new("
|
4
|
+
let(:dsl) { Brewdler::Dsl.new("tap 'phinze/cask'\nbrew 'git'\ncask 'google-chrome'") }
|
5
5
|
|
6
6
|
it "processes input" do
|
7
|
+
dsl.should_receive(:tap).with('phinze/cask')
|
7
8
|
dsl.should_receive(:brew).with('git')
|
8
9
|
dsl.should_receive(:cask).with('google-chrome')
|
9
10
|
dsl.process
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Brewdler::Commands::Install do
|
4
|
+
context "when a Brewfile is not found" do
|
5
|
+
it "raises an error" do
|
6
|
+
expect { Brewdler::Commands::Install.run }.to raise_error
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when a Brewfile is found" do
|
11
|
+
it "does not raise an error" do
|
12
|
+
File.stub(:read).and_return("tap 'phinze/cask'\nbrew 'git'\ncask 'google-chrome'")
|
13
|
+
expect { Brewdler::Commands::Install.run }.to_not raise_error('No Brewfile found')
|
14
|
+
|
15
|
+
File.stub(:read => 'git', :open => ['git'])
|
16
|
+
expect { Brewdler::Commands::Install.run }.to_not raise_error('No Brewfile found')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
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.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-08-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: commander
|
@@ -116,12 +116,16 @@ files:
|
|
116
116
|
- lib/brewdler.rb
|
117
117
|
- lib/brewdler/brew_installer.rb
|
118
118
|
- lib/brewdler/cask_installer.rb
|
119
|
+
- lib/brewdler/commands/install.rb
|
119
120
|
- lib/brewdler/dsl.rb
|
121
|
+
- lib/brewdler/repo_installer.rb
|
120
122
|
- lib/brewdler/version.rb
|
121
123
|
- spec/dsl_spec.rb
|
124
|
+
- spec/install_command_spec.rb
|
122
125
|
- spec/spec_helper.rb
|
123
126
|
homepage:
|
124
|
-
licenses:
|
127
|
+
licenses:
|
128
|
+
- MIT
|
125
129
|
post_install_message:
|
126
130
|
rdoc_options: []
|
127
131
|
require_paths:
|
@@ -146,5 +150,6 @@ specification_version: 3
|
|
146
150
|
summary: Bundler for non-ruby dependencies from homebrew
|
147
151
|
test_files:
|
148
152
|
- spec/dsl_spec.rb
|
153
|
+
- spec/install_command_spec.rb
|
149
154
|
- spec/spec_helper.rb
|
150
155
|
has_rdoc:
|