Installation refactor #400

Closed
tomlane opened this Issue Sep 11, 2012 · 42 comments

Projects

None yet
@tomlane
Contributor
tomlane commented Sep 11, 2012

Following discussions with @paulirish it has been decided that the installation script in it's current form (install.sh) with all the tweaks for different systems will not be sustainable.

We have therefore started drafting ideas on how to ensure the installation is kept as easy and as lightweight as possible.

  • Create a script that will audit the user's system, show them what they have setup and what they need to do if there are any unmet dependencies.
  • Provide documentation on how to prepare the dependencies for Yeoman manually.
  • Create a new repo (which I would be happy to maintain) with scripts for specific systems and linux distros (so users have the choice of an automated install).

We'd really like all your thoughts on this :)

Owner

I like all of the above options. We talked about splitting the install script into its own repo at some point pre-launch and I think we should go for it.

Owner

I agree with this.

Point 1 could be usable as a npm post-install script too. We could then just say:

"Run npm install yeoman -g and make sure you have all the required dependencies"

which will be shown to the user after the npm install.

daaain commented Sep 11, 2012

Would be nice if there was a --dry-run option as for example the Boot2Gecko emulator dependency installer does: https://github.com/mozilla-b2g/B2G/blob/master/scripts/bootstrap-mac.sh

Or even a separate script which only checks, but doesn't touch :)

I personally am scared to let a script run loose on my system (and too lazy to scrutinise every single line), so went for the manual install from the docs. On the other hand it would be nice to have a sort of brew doctor for yeoman which checks if everything is set up fine.

Owner

I personally am scared to let a script run loose on my system (and too lazy to scrutinise every single line), so went for the manual install from the docs. On the other hand it would be nice to have a sort of brew doctor for yeoman which checks if everything is set up fine.

That is the idea of 1.

@tomlane tomlane was assigned Sep 11, 2012

A +1 for this

Member

Just a sketch... I'm thinking some output like..

$ curl -L get.yeoman.io | bash

Wotcha! Well hi there. Below is a quick audit I've run on your system to see if you have everything you need for Yeoman.

✓ *curl* is present, phew.
✓ *git* is installed. nice one.
✓ *XCode CLI Tools* are installed, yippee!
✘ *Homebrew* is not installed, sad to say.
      Install Homebrew from the instructions at https://github.com/mxcl/homebrew/wiki/Installation
      For best results, after install, be sure to run `brew doctor` and follow the recommendations.
✓ *NodeJS* is installed.
✘ *NodeJS* is not >0.8. 
      I recommend you grab a fresh NodeJS install from http://nodejs.org/download/
✓ *Ruby* is installed.
✓ *RubyGems* is installed.
✘ *jpeg-turbo* is not installed.
     `brew install jpeg-turbo && brew link jpeg-turbo` should do the trick. 
✘ *PhantomJS* is not installed.
     http://phantomjs.org/download.html
✓ *Compass* is installed.
✓ *Compass* 0.12.2 is installed.
Owner

^ Exactly how imagined it too.

  • Ruby also needs version check, >=1.8.7
  • PhantomJS needs version check >=1.6

Also would like to combine the double entries:

✘ *NodeJS* 0.6 is installed, but Yeoman requires NodeJS >=0.8.
Rydgel commented Sep 12, 2012

This looks much better like this!
+1

Member
hemanth commented Sep 12, 2012

Still likes automated script, but would it be better if we list only those deps which did not meet the requirement?

Owner

+1 to the suggestion of minimizing double entries. I prefer the idea of us showing both those dependencies that are correctly installed with the version we require as well as those that aren't. If a user has further problems getting Yeoman installed, they can just share the list with us and we can more easily see what might have gone wrong/was missing/is available.

Member

I was thinking splitting the audit from the action might make more sense.. Thoughts?

$ curl -L get.yeoman.io | bash

Wotcha! Well, hello! Below is a quick audit I have run to see if everything is in place for Yeoman.

✓ *curl* is present, phew.
✓ *git* is installed. nice one.
✓ *XCode CLI Tools* are installed, yippee!*Homebrew* is not installed, sad to say.
✓ *NodeJS* is installed.
✘ *NodeJS* is not >0.8. 
✓ *Ruby* is installed.
✓ *Ruby* 1.8.7 is installed.
✓ *RubyGems* is installed.
✘ *jpeg-turbo* is not installed.
✘ *PhantomJS* is not installed.
✓ *Compass* is installed.
✓ *Compass* 0.12.2 is installed.
✘ *Yeoman* is not installed.

To get Yeoman in perfect working order, you should resolve these items:

✘ *Homebrew* is not installed, sad to say.
      Install Homebrew from the instructions at https://github.com/mxcl/homebrew/wiki/Installation
      For best results, after install, be sure to run `brew doctor` and follow the recommendations.
✘ *NodeJS* is not > 0.8. 
      I recommend you grab a fresh NodeJS install from http://nodejs.org/download/
✘ *jpeg-turbo* is not installed.
     `brew install jpeg-turbo && brew link jpeg-turbo` should do the trick. 
✘ *PhantomJS* is not installed.
     Head over here and grab PhantomJS >= 1.6 http://phantomjs.org/download.html
✘ *PhantomJS* is not installed.
     By jove, what about me? When you're ready: npm install -g yeoman

Having the double entries (separate app + app version checks) doesn't break my heart, but I'm more for whichever will make for a more readable and maintainable shell script.

Owner

^ Reviewing the separation, I find the above a little more clean and readable. It's easier to see what you're missing and what actions are required to resolve. I like it.

Member
hemanth commented Sep 12, 2012

How about?

$ curl -L get.yeoman.io | bash

Wotcha! Well, hello! Below is a quick audit I have run to see if everything is in place for Yeoman......
It will take some time, so please grab some coffee ;)

✓ *curl* is present, phew.
✓ *git* is installed. nice one.
✓ *XCode CLI Tools* are installed, yippee!
✓ *NodeJS* is installed.
✓ *Ruby* is installed.
✓ *Ruby* 1.8.7 is installed.
✓ *RubyGems* is installed.
✓ *Compass* is installed.
✓ *Compass* 0.12.2 is installed.

✘ *NodeJS* is not >0.8. Get it from http://nodejs.org/download/
✘ *Homebrew* is not installed, sad to say. Get it from https://github.com/mxcl/homebrew/wiki/Installation
✘ *jpeg-turbo* is not installed. `brew install jpeg-turbo && brew link jpeg-turbo` after getting brew! 
✘ *PhantomJS* is not installed. PhantomJS >= 1.6 from http://phantomjs.org/download.html
✘ *Yeoman* is not installed. `npm install -g yeoman` FTW! 

To get Yeoman up and running please make sure you install all the ✘ marked deps!

Member

works for me.

I like this new approach, because after unmet requirements are solved the user can rerun the audit script to double check everything is ok.

cowboy commented Sep 13, 2012

+1 for audit & docs instead of install

+1 It's not a good approach ask for the admin password to install a command line tool.

Just to throw in the same 2c I threw on the Windows issue.

I would personally prefer in the long-term to see as many of these (small) tool dependencies moved to NPM packages as possible. That would reduce installation friction.

From a build server perspective (having maintained a Jenkins server for a few years), relying on a bunch of global build tools (especially specific versions!) is problematic. For Ruby, Node or Git, global installs makes sense as these require large / expensive installs... but for things like jpeg-turbo, PhantomJS, etc -- I'd prefer local versions. PhantomJS strongly feels that they should not be a local tool -- maybe there's a technical reason for it shrug, but from a pragmatic standpoint it's a pain. I subscribe to the pull the source and build right away philosophy -- so that when new team members are brought on, they can just start coding w/out a lot of friction, etc.

Also, a note on the above. Running curl to check for the existence of curl ;0 I think more Linux distros ship with wget in the box -- but someone please correct me if I'm wrong.

Rydgel commented Sep 13, 2012

Homebrew is mandatory on Mac OS X for PhantomJS and jpeg-turbo dependencies?

@Iristyle: yes wget ships with most of Linux distribution, not necessarily curl. And if you want BSD support too, just replace wget with fetch. :)

cowboy commented Sep 13, 2012

@Iristyle yes, curl would need to be installed on an out-of-the-box Ubuntu install, for example.

@tomlane tomlane referenced this issue Sep 13, 2012
Closed

Audit script #418

BPScott commented Sep 13, 2012

+1 to a brew doctor style audit and docs and +1 to @Iristyle's request to move the small tool dependencies moved to NPM where possible.

For some precedent regarding the audit script, brew doctor only lists issues with an install. I prefer this approach as showing a list of ✓s when I'm working my way through resolving issues one-by-one feels very noisy as I want to focus on the failing items. Perhaps the script could show errors and warnings by default, then have a --verbose flag that would also list successful criteria. This would reduce the noise when auditing, while keeping @addyosmani's "list sharing" debugging requirement.

I would like it if this script could be ran as yeoman doctor post installation, though this would mean taking for granted that Yeoman is a node module and you'll have to go setup node manually prior to installing with npm install yeoman -g

Member
hemanth commented Sep 13, 2012

Pull Request #423: Audit script

I like @hemanth outputted version but with the list flipped so it says the stuff I don't have first e.g.

$ curl -L get.yeoman.io | bash

Wotcha! Well, hello! Below is a quick audit I have run to see if everything is in place for Yeoman......
It will take some time, so please grab some coffee ;)

To get Yeoman up and running please make sure you install all the ✘ marked deps!*NodeJS* is not >0.8. Get it from http://nodejs.org/download/
✘ *Homebrew* is not installed, sad to say. Get it from https://github.com/mxcl/homebrew/wiki/Installation
✘ *jpeg-turbo* is not installed. `brew install jpeg-turbo && brew link jpeg-turbo` after getting brew!*PhantomJS* is not installed. PhantomJS >= 1.6 from http://phantomjs.org/download.html
✘ *Yeoman* is not installed. `npm install -g yeoman` FTW!*curl* is present, phew.
✓ *git* is installed. nice one.
✓ *XCode CLI Tools* are installed, yippee!*NodeJS* is installed.
✓ *Ruby* is installed.
✓ *Ruby* 1.8.7 is installed.
✓ *RubyGems* is installed.
✓ *Compass* is installed.
✓ *Compass* 0.12.2 is installed.
Member
hemanth commented Sep 14, 2012

@ryanseddon Many to like to see the positive first ;) ? Anyway, just swapping the last two printf statements, will do the suggested :)

Owner

@hemanth Looking good.

Instead of star (*) around the component name, can you make them actually bold?

printf '✓ \e[1m%s\e[0m\n' ${installed[@]} to make the component name bold =D

Member
hemanth commented Sep 14, 2012

Cna be something like green for installed and red for not_installed, would be good? @sindresorhus @jorgeramirez

For me it's ok. BTW 32 is for green and 31 is for red.

Member

real bold and real green/red would be excellent, yes. I prefer X's after checks, as its friendlier to a shorter terminal.

Member

Okay I've pulled #429. It's now in master as audit.sh. We'll move it to install.sh when we're done.

What's left:

  • let's pull the OS detection bits from dc83fd35d428839fbe64c1928565e07d9425115b - some of hemanth's refactoring lowercased 'linux' and broke it..
  • coloring and bold on check,x, and program name
  • actual installation instructions (ill do this)

Hemanth can you do the first two? And test!

Member
hemanth commented Sep 14, 2012

@paulirish On it!

Member

Okay hemanth and I worked out some of the formatting and details and we're looking good.

Successful run:

Very very unsuccessful run:

feedback??

Contributor
tomlane commented Sep 14, 2012

Very nice!

Member

improved failure messages. much cleaner:

Member

Okay. audit.sh in master should be complete now. I'll be moving it to install.sh in an hour or so, completing this ticket.

Owner

Great work everyone!

Member
hemanth commented Sep 14, 2012

👍

Member

Results on two of my linux boxes:

We're looking good. Making the move now..

Member

Closed with the above commits.

Thanks everyone for your help and input here. Especially @tomlane and @hemanth !

@paulirish paulirish closed this Sep 14, 2012
Member

Lots of docs added to wiki: manual install as well as updated the site.

mr @tomlane is maintaining the legacy installer at https://github.com/tomlane/Yeoman-scripts and looks to be soliciting input if you'd like to assist.

Cheers

✌️

Really nice work!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment