Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nicely formatted irb output & prompt #28

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

CraigMorton
Copy link
Member

This PR adds some configuration files for IRB to format the output of IRB to be more colourful and readable.

I've also configured the prompt to take up less space in the terminal.

All @codeclan/instructors should probably configure their own IRB to be similar before students laptop's start having this config. You can run this section of the script to get it as I have set it up, or feel free to configure it however you like in ~/.irbrc and ~/.aprc (replacing gem_install_or_update - a helper function in the installation script, with simply gem install )

Before:
screen shot 2018-09-12 at 13 37 08

After:
screen shot 2018-09-18 at 15 02 16

This enables accessing history with the up cursor key even between irb
sessions
I did this initially because the pre-existing code to create the
~/.zshrc file was wrapped in a condition checking for the existance of
the file. However I don't see why this condition is necessary. `touch`
will only update the accessed and modified timestamps on a file if it
already exists, and in all cases we are modifying the files at this
time.
@keithdhd
Copy link
Member

keithdhd commented Sep 18, 2018

Nice. Can you copy n paste the part of the script that we can run pls? (to set it up)

@CraigMorton
Copy link
Member Author

@keithdhd shell script just for this part here: https://gist.github.com/CraigMorton/315d0f206e1414804e639cde731dba24

@abazlinton
Copy link

I'm a bit nervous about how much we're making the script do...and introducing more things that could go wrong or that makes it trickier for all instructors to understand what's going on.

It's getting beyond installation and into quite detailed configuration. Is this something we could add as an additional resource?

@CraigMorton
Copy link
Member Author

Those are both good points, and I agree that minimising what the script does, to maximise understanding and minimise complexity, is a good idea.

I think we need to take that to a more general discussion on what we want this script to be. I don't think this PR is the most egregious example of either incomprehensible, or complex / brittle code in the script.

If we're going to maintain this script based on minimising things that could go wrong, we could probably use the system version of ruby, macOS 10.14 comes with 2.3 now, that would cut out a lot of rbenv complexity which has caused failed installs in the past. Do we need oh-my-zsh? Do we even really need zsh? We could also consider ripping out the AppleScript for checking if GUI apps are already installed, because euw, AppleScript... - I'm not suggesting we do any of these, just saying this line of discussion will grow arms and legs pretty quickly.

This PR just makes IRB easier to use than it is by default, splash of colour, less irrelevant spam in the prompt. It creates config files in ~, which we already do in the script, the code uses heredocs and cat to populate the file contents, which we already use in the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants