379 Commits (trunk)
 

Author SHA1 Message Date
jake romer fbb0d1fa81 Add compatibility for Bash 3.x
The `|&` is new in Bash 4, which is not the default on Macs.

Given that Laptop is meant to be run on a fresh machine, `2>&1 |` is preferable,
since it'll work on the Bash 3.x, which is what comes installed on new machines.
10 years ago
Dan Croak 2aa635f0e3 Clarify OS X support 10 years ago
Dan Croak 53783e6bc8 Link README to programs that Laptop installs
So that users can learn more about them.
10 years ago
Dan Croak dd88469ef9 Drop support for Snow Leopard
* Snow Leopard was released in August, 2009 (about five years ago).
* Yosemite will be released in a couple of months.
* We support the last three versions of Ubuntu, so this is a little more
  consistent.
* Use the same format as the Linux "Requirements" section for consistency.
10 years ago
Bassam Ismail 69fb5bc8b7 Upgrade to latest version of Node.js
We can future-proof the script little more by setting `node_version` to 0.10.
NVM will automatically install the latest 0.10.x version:

https://github.com/creationix/nvm#usage
10 years ago
Galen O'Hanlon c9f1ab1aec Add idempotent brew_launchctl_restart function
Fixes https://github.com/thoughtbot/laptop/issues/260

This is a soft error that occurs when Laptop is run and PostgreSQL isn't
currently loaded by `launchclt`, e.g. on the first run of Laptop:

    Starting Postgres ...
    /Users/wellmade/Library/LaunchAgents/homebrew.mxcl.postgresql.plist ->
    /usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist
    launchctl: Error unloading: homebrew.mxcl.postgresql

The fix would probably be to check `launchctl list` to see if the service is
already loaded before calling `launchctl unload`.

This small added complexity probably justifies a function for running
appropriate `launchctl` commands. Homebrew has a strong convention for the
naming of `launchd` plists: "homebrew.mxcl.FORMULA_NAME.plist", e.g.
"homebrew.mxcl.postgresql.plist" and "homebrew.mxcl.redis.plist". This likely
makes a function to do the `launchctl` work fairly straightforward.
10 years ago
Galen O'Hanlon 637f8d5f25 Fix warning when linking already-linked OpenSSL
Fixes https://github.com/thoughtbot/laptop/issues/259

Laptop raises the following warning on `brew link openssl ` when OpenSSL has
already been linked:

    Warning: Already linked: /usr/local/Cellar/openssl/1.0.1h
    To relink: brew unlink openssl && brew link openssl

I think the resolution is straightforward: follow Homebrew's recommendation and
`brew unlink` before `brew link`. I verified that `brew unlink` exits with
success even if the formula wasn't previously linked as would be the case the
first time Laptop is installed.
10 years ago
Galen O'Hanlon 9807bd8235 Test whether Homebrew formula is installed
More readable and testable this way.
10 years ago
Galen O'Hanlon 9e566c8ac8 Make brew_install_or_upgrade work with aliases
Fixes https://github.com/thoughtbot/laptop/issues/258

The following doesn't behave as intended:

    brew_install_or_upgrade 'postgres'

because "postgres" is an alias, not the full name of the formula. The actual
formula name is "postgresql".

The first time `brew_install_or_upgrade 'postgres'` is invoked it works as
expected — `brew install postgres` is run. Additional invocations result in
`brew install` instead of the expected `brew upgrade`.

The `brew_install_or_upgrade` function uses `brew list -1` to obtain a complete
list of installed packages, and these package names will be the actual package
names. So, grepping for an alias (with the `-x` option) won't match:

    $ brew list -1 | grep -Fx postgres

Note that there's no output, even though PostgreSQL is installed. Using the full
package name behaves as expected:

    $ brew list -1 | grep -Fx postgresql
    postgresql

Rather than passing on the first argument to `brew_install_or_upgrade` to the
`brew list` commands, the argument should first be expanded to the actual
package name.
10 years ago
Galen O'Hanlon 586b7e0934 Don't upgrade a brew that is already up to date
Fixes https://github.com/thoughtbot/laptop/issues/257

On a clean OS X Mavericks, Laptop outputs an error message towards the end of
the install script when `brew_install_or_upgrade` is invoked for OpenSSL:

    Upgrading and linking OpenSSL ...
    Error: openssl-1.0.1h already installed
    Linking /usr/local/Cellar/openssl/1.0.1h... 1139 symlinks created

The current version of OpenSSL was installed earlier as a dependency of
PostgreSQL. In general, a similar error will be logged whenever
`brew_install_or_upgrade` is called for an installed package that's already up
to date.

Currently, Laptop discards the error exit code of `brew upgrade` as follows:

    (brew upgrade "$@") || true

In addition to logging an error when there isn't truly an error, this approach
can cause real `brew upgrade` errors and potential bugs in Laptop to be masked
(e.g. Homebrew formula build failures or Laptop mistakenly invoking `brew
upgrade` for a package that isn't actually installed).

I think a better approach would be to check whether the installed package is the
same version as the current Homebrew formula before attempting `brew upgrade`.
10 years ago
Galen O'Hanlon 3106976ff3 Update prerequisites in README
Homebrew's install script checks whether the command line tools are installed,
and, only if necessary, will run `xcode-select --install`.

https://github.com/Homebrew/homebrew/blob/go/install#L162

The test they are using depends in part on a heuristic:

afa45493af

I confirmed that it works on a clean 10.9 install.

We also should not instruct the user to run `sudo xcodebuild -license` at all.

Here's why:

The `xcodebuild program` isn't included in OS X Mavericks. When you run
`xcodebuild`, you're actually finding one of 83 shims found in `/usr/bin` that
are included in Mavericks. These shims are an important part of how the
`xcode-select` mechanism works. When the command line developer tools have not
been installed, invoking any of these shims won't do anything other than prompt
you to install the command line developer tools:

    $ xcodebuild -license
    xcode-select: note: no developer tools were found at
    '/Applications/Xcode.app', requesting install.
    Choose an option in the dialog to download the command line developer tools.

(And, the GUI install dialog is presented.)

Of course, since the real `xcodebuild` program isn't actually available, it
doesn't make sense to try and use it to accept the Xcode License Agreement.

Instead, go straight to installing with `xcode-select --install` (xcode-select
comes with OS X Mavericks and is not a shim):

    $ xcode-select --install
    xcode-select: note: install requested for command line developer tools

And, the exact same GUI install dialog is presented (prompting the user to
either "Get Xcode" from the App Store or immediately "Install" the command line
developer tools).

For more about `xcode-select` and it's shims, see `man xcode-select`.

This also removes redundant Vagrant setup instructions and capitalize Vagrant.
10 years ago
Dan Croak 3db746d488 Log the output of the script to a file and stdout
Thanks for the implementation, @pbrisbin.
10 years ago
Dan Croak 15355e577a Switch to launchctl for Postgres
`brew services` is no longer supported:

c0b99c031f

* Fixes https://github.com/thoughtbot/laptop/issues/93
* Fixes https://github.com/thoughtbot/laptop/issues/243
* Idempotently creates Postgres database cluster and starts (or restarts)
  Postgres.
10 years ago
Mike Burns 49b8b3880b
Use root to run the installer(1) 10 years ago
Mike Burns ffde1b2a72
Install foreman on OS X
This uses installer(1).

On GNU we already install `heroku-toolbelt` using apt, and that package
has a dependency on the `foreman` package.

We install this via installer(1) instead of gem(1) so that it remains
regardless of the development Ruby setup.

We install this via installer(1) instead of from the `Gemfile` so that
it remains regardless of what other developers do on the project (as
described by David Dollar).
10 years ago
Sean Doyle 094e6e7f9e Installs `parity`
* `curl` / `heroku-toolbelt` / `pg_restore` should all
  already be available
10 years ago
Sarah GP 08806d7953 Fix rbenv initialization for zsh
Clean install on OSX Mavericks 10.9.4, I encountered an error similar to this:

https://github.com/sstephenson/rbenv/issues/487

Implemented same zsh fix, seemed to work alright. I think this is what needs to
be changed in the code.
10 years ago
Daniel Collis-Puro cd34c9e958 Merge pull request #241 from lodgem/fix-source-zsh
Fix nvm package install
10 years ago
Mathieu Allaire be03d4a703 Fix nvm package install 10 years ago
Dan Collis-Puro fdc9ba56c9 Be more careful about nvm init in zshrc 10 years ago
Dan Collis-Puro 4ad53bcda5 Remove ruby 2.1.1 conditional behavior for rbenv installation 10 years ago
Dan Collis-Puro 3162c5829c Extend and improve osx idempotency
Includes:

* Fix the "brew_install_or_upgrade" function, use it for all components
* Remove executable perms
* Skip installing an already installed ruby

Technically re-running laptop is not idempotent in that it will upgrade
brew-installed items and potentially install a new ruby. I feel this
is expected and wanted.
10 years ago
Chris dc7a4756bc Making brew installs commands work in idempotently 10 years ago
Alex Howington 6b0e55463c Remove spaces in node_version variable definition. 10 years ago
Dan Collis-Puro 747d998c33 Clarify the simpler "vagrant init" way to spin up a prerendered box 10 years ago
Dan Collis Puro and Dan Croak 3149bf9cc4 Install nvm and node on Mac laptops
Includes:

* Installing nvm via homebrew
* Adding node init stubs to .zshrc
* Installs node 0.10.28 and uses it by default
10 years ago
Daniel Collis-Puro b8da2e3f3f Merge pull request #236 from endSly/patch-1
brew-cask formula updated in README
10 years ago
Endika Gutiérrez b7df9ddaa8 brew-cask formula updated in README 10 years ago
Dan Collis-Puro 61c3a978ac Refactor automated laptop tests to use rspec
Includes:

* A minimal gem, rake, and rspec environment
* The Distro class wraps up commands to test and provision vagrant boxes
* Publishing boxes to s3 has been simplified and improved
* Significant documentation updates

New laptop specs should now be significantly easier to write and understand.
10 years ago
Daniel Collis-Puro b369d186bf Merge pull request #235 from ManageIQ/support_reruns_where_pg_is_started
Support rerunning the installation script by restarting postgresql.
10 years ago
Joe Rafaniello 4b778a2da2 Support rerunning the installation script by restarting postgresql.
If postgresql was installed and started in a previous run, start causes:
Error: Service `postgresql` already started, use `brew services restart postgresql`

When developing changes to these scripts, it's important to be able to run and rerun this script without removing applications.
10 years ago
Dan Collis-Puro 0db0892d3c Install silversearcher from apt when possible 10 years ago
Dan Collis-Puro b3b1ac2ee6 Remove the deprecated curl-ca-bundle
See: https://github.com/Homebrew/homebrew/commit/ab926db, thanks to
@wouterw
10 years ago
Dan Collis-Puro 808b8856d6 Automatically create laptopped vagrant boxes.
Vagrant boxes can be created automatically after a successful run of the
laptop test suite. These vagrant boxes are published to
[vagrantcloud](http://vagrantcloud.com/thoughtbot/) and should be a
solid start on a vagrant dev box suitable for modern ruby and
ruby-on-rails development.

Improvements include:

* Vagrantfiles fixed to have predictable names
* test/runner.sh now knows how to render vagrant boxes after tests are
  successful
* Error reporting improvements
* Full documentation on creating new base boxes

We now require vagrant >= 1.5.0 to use the automated test suite built
into laptop.
10 years ago
Daniel Collis-Puro c8a93221af Merge pull request #222 from wouterw/patch-1
Update github raw urls
10 years ago
Wouter Willaert a845aa8453 Update github raw urls
https://developer.github.com/changes/2014-04-25-user-content-security/
10 years ago
Dan Collis-Puro 85e2bbb3eb Ubuntu 14.04 LTS (Trusty Tahr) support 10 years ago
Dan Collis-Puro ae3983f521 Remove support for EOL'd ubuntus: 12.10 and 13.04 10 years ago
Dan Collis-Puro 3d5687044d Fix ruby-build errors with ruby 2.1.1
Apply mislav's patch
https://github.com/sstephenson/ruby-build/issues/526#issuecomment-37933242
against a readline bug in newer rubies. Should fix #219 and #218, and
we'll remove when a new ruby is released or if ruby-build patches this
bug itself.
10 years ago
Dan Croak caeada58a5 Make mac script run idempotently
Use preferred POSIX `command -v` test for command existence instead of
previous `which` technique. `which` exits with status `1` if nothing is
found. That would cause the script to abort because we use `set -e`.

http://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script

Remove GCC dependency in mac script

GCC is no longer necessary to compile Ruby. It was fixed in Ruby about
two years ago. LLVM has been supported since 1.9.3-p125.

https://bugs.ruby-lang.org/issues/5076
http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion-with-rvm-gcc-issues
10 years ago
Dan Croak bdf944378f Use command -v to test command existence
Use preferred POSIX `command -v` test for command existence instead of
previous `which` technique. `which` exits with status `1` if nothing is
found. That would cause the script to abort because we use `set -e`.

http://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script
10 years ago
Dan Croak c772e88162 Build "linking OpenSSL" change from 44a5266 10 years ago
Dan Croak 44a52663bd Fix "Could not verify the SSL certificate" errors
The error message indicates the connection failed because OpenSSL was
unable to verify the server certificate. The SSL certificates that comes
with Mac OS X 10.8 may be outdated.

http://bit.ly/ruby-ssl

This also should help avoid critical OpenSSL errors:

dc763ad98c
http://arstechnica.com/security/2014/04/critical-crypto-bug-in-openssl-opens-two-thirds-of-the-web-to-eavesdropping/
10 years ago
Dan Croak 16d86926c9 Don't hardcode Ruby version
* Use http://ruby.thoughtbot.com/latest endpoint.
* We'll update the file when necessary, which is stored on S3 and served
  via Fastly.
* Apply style guideline: "Use snake_case for variable names and ALLCAPS
  for environment variables."
  https://github.com/thoughtbot/guides/tree/master/style#shell
10 years ago
Dan Collis-Puro 8dc4137b2a Fix how we source personal additions to laptop
If the file ~/.laptop.local doesn't exist, the laptop script returns a
failing exit code. This doesn't really make sense, and gets in the way of our
test runner.  Wrap this in slightly more verbose `if` to ensure a
successful exit code.
10 years ago
Dan Collis-Puro 5fc2f85aaf Test all officially supported linux distros
Includes more thorough rails-level tests and docs for the
aforementioned.
10 years ago
Dan Croak 08938484b3 Allow personal customizations via ~/.laptop.local
Use same `.local` convention as https://github.com/thoughtbot/dotfiles.
10 years ago
Dan Croak 91ca7d69b3 Start Postgres after it is installed
* Set up plist so Postgres will start up at login.
* Create file for other potential `brew services start` lines. Redis?
10 years ago
Dan Croak 1528479bf8 Fix test broken by ddb17283d3 10 years ago
Dan Croak ddb17283d3 Upgrade Ruby to 2.1.1 10 years ago