hypriot / flash

Command line script to flash SD card images of any kind
MIT License
1.01k stars 173 forks source link

added brew #55

Closed RnbWd closed 8 years ago

RnbWd commented 8 years ago

This is my first attempt at making a brew - I just followed the instructions from their cookbook - https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md

brew create https://github.com/hypriot/flash/archive/0.2.0.tar.gz

that creates the formula - what I submitted works.. I literally have no idea what I'm doing.... but on my local machine typing brew install flash installs the library :)

edit: i did not submit a pull request to home-brew for this - just local

RnbWd commented 8 years ago

Also this file technically would go into home-brew's repo. I just submitted the pull request to pass along a working formula instead of just asking someone to make one.

fxstein commented 8 years ago

Awesome! I was just thinking about that. Are you creating a pull request for HomeBrew? Do you need help doing so? The name might have to change to something like hypriot-flash to make sure it does not conflict with other scripts or tools out here.

StefanScherer commented 8 years ago

@RnbWd This is awesome! Thank you for making this happen.

I think we have to update the flash script to show the version number and prepare a new release as the 0.2.0 is a little outdated.

RnbWd commented 8 years ago

This was my first time trying to create a brew :) There's an option to put the script on '--head' for latest, but I'm not sure how to pull the latest build because the API looks for a tar. I think they accept pull requests so it shouldn't matter who pushes it, but there's an option for tests that I skipped (I copied a random template from their Formulas).

There's no formula named 'flash', so the name's open. I think I've been using this since the first hypriot release, I just wanted to brew it - but I think it makes more sense for y'all to submit it.

StefanScherer commented 8 years ago

When we start to package the script we should use version numbers for both the flash script, download the right version in the brew etc. I think of adding a travis/circle yml for a build and release step that could create the brew (haven't looked at what steps are needed for that).

RnbWd commented 8 years ago

I could write an npm script really easily - it's much simpler than homebrew, easier to maintain and publish.

npm install -g hypriot-flash

it'll symlink flash in the cli path, I can also point to the head of this directory. I'm much better with node. It won't link the other libraries though, basically just automates these commands:

wget https://raw.githubusercontent.com/hypriot/flash/master/$(uname -s)/flash
chmod +x flash
sudo mv flash /usr/local/bin/flash

it'll also work on linux / OS X equally -

StefanScherer commented 8 years ago

@RnbWd Thanks for the suggestion, but using a npm package leads into a wrong direction. Not everybody has Node.js installed. Installing a bash script should not depend on other frameworks than a package manager itself.

So brew on Mac should be the right way.

There is another http://www.bpkg.io, but not very popular, I've just googled it. :smiley:

RnbWd commented 8 years ago

I totally agree - and I don't expect the npm-module to be the a main source for downloading flash - brew is definitely the way to go (which is why I started this pull request). But I don't know much about brew so I'm not sure I help much more on that front...

but I can publish an npm package cli-script for flash in 15 minutes using the bin-wrapper module. I've contributed to electron-prebuilt so I'm fairly component with how the process works, I've published 4-5 of these modules on npm already.Everything is basically automated on my part, so it'd be fairly trivial to do - just wanted feedback :)

node's path module isn't working on my computer for some reason - node 6.0.0 is about to be released so i'll wait for that before trying anymore

RnbWd commented 8 years ago

I was browsing through FB's repo and I noticed they have a homebrew-tap - then I realized it would make more sense to just create a hypriot tap for homebrew . There are so many libraries in this org can be hosted via brew - and taps are technically independent of homebrew, any github repo can become a tap. It makes sense, and I'd volunteer creating a seed tap repo as a proof of concept. I really like the repos here and use them all the time, so with all the change each month, it's nice to just brew upgrade sometimes :)

RnbWd commented 8 years ago

I hate home-brew I just wrote an npm script that works for linux and OS X - i'm going to take namespace while it's available - but I give you 100% credit. It links directly to this repo - it will always install the lastest version and is uses the global npm space to link the flash as a global method, npm install -g rpi-flash - but the method will be invoked with the name flash locally, not rbi-flash which is just used for downloading the file

StefanScherer commented 8 years ago

@RnbWd That's awesome!

Maybe after we have implemented #60 you may use the version number in your package.json to download the exact released version.

RnbWd commented 8 years ago

The npm library will link to these urls:

https://raw.githubusercontent.com/hypriot/flash/master/Linux/flash

https://raw.githubusercontent.com/hypriot/flash/master/Darwin/flash

So (for now) it'll download the latest file from master. with home-brew it's possible to declare wget as a dependency, but npm is simple / cross-platform. I'm basically copying what I wrote for nut, which was a similar situation