kdaigle / strapper

A simple tool to help bootstrap necessary resources for a project.
MIT License
8 stars 1 forks source link

Refactor Using Cocaine #1

Open simeonwillbanks opened 11 years ago

simeonwillbanks commented 11 years ago

Hi Kyle,

This gem is a great idea! Automate everything... and its more powerful than a Brewfile.

I'd love to contribute, and I have a suggestion. Would you consider a refactor using cocaine?

Here is an example refactor of Strapper::Brew#install.

def install
  Cocaine::CommandLine.new("brew", "install #{@name}").run if brewable?
rescue Cocaine::ExitStatusError
  puts "Error: Installing #{@name} has failed"
end

def brewable?
  !!Cocaine::CommandLine.new("brew", "info #{@name}").run
rescue Cocaine::ExitStatusError
  puts "Error: No available formula for #{@name}"
end

Thanks, Simeon

kdaigle commented 11 years ago

@simeonwillbanks sorry! I totally didn't see this until right now. Let me take a read at this on Sunday (at GoGaRuCo).

simeonwillbanks commented 11 years ago

No worries. Enjoy GoGaRuCo; its awesome!

kdaigle commented 10 years ago

@simeonwillbanks if you'd like to do this refactor and drop a PR, I'd definitely accept! Sorry for the super super long delay on this. I just started my :baby: leave and been poking through my OS projects.

It looks like you shouldn't pass user entered values into new though. 1 Granted, this is a file that is committed into the repository but might want to protect people from themselves I guess. :grinning:

simeonwillbanks commented 10 years ago

@kdaigle No worries and congrats! Boy or Girl?

I'm right behind you... my wife is due next month! It's our second, and it's another boy. :tada:

Nice catch and agreed. When I have some time, I'll put together a Pull Request. :smile:

kdaigle commented 10 years ago

@simeonwillbanks a boy! Still waiting over here... :grinning: :baby:

simeonwillbanks commented 10 years ago

@kdaigle Awesome. :baby:'s are so much fun. Good luck!!!