New to vim - MAC OSX Mountain Lion - ruby-on-rails

I am new to vim, and I just followed this setup tutorial, but something went wrong. I am a ruby developer and I am not getting a a ruby highlighting syntax. I have installed janus, before with pathogen I had syntax highlighting but not know.
Also I am using the solarized theme the guy suggested but there is no difference now (in color) between folders and files in my terminal when listing a directory.
Could somebody tell me if I can install pathogen with janus? WIll this break my vim?
Thanks!

Don't install anything (and don't install Janus).
Run $ vimtutor in your terminal. As many times as needed (and don't install Janus).
Once you feel ready to use Vim for day-to-day coding, install MacVim which is built with a better feature set than the default Vim. It comes with a CLI executable so you can use it in your terminal and in tmux (and don't install Janus).
Install the vim-ruby package for better, more up-to-date Ruby support (and don't install Janus).
Don't install Janus. This thing is a pile of crap that will make your life overly complicated, hook you on plugins that may or may not be the best for you needs and prevent you from actually learning Vim properly in exchange of an artificially flattened learning curve.
Decide for a plugin/runtimepath management solution (VAM, vundle or plain Pathogen) and choose your plugins yourself according to your needs (and don't install Janus).
If you have problems with Solarized, take a look at their issue tracker and their wiki. It is fragile and you need some work to set it up correctly (and… you know the rest).

Related

Do I Really need to install homebrew to install rails and why?

I hope this question is suitable for this forum, I'm still learning what's deemed fit and what isn't. Anyway here is my question, a lot of places seem to state I need to install homebrew on my mac to install rails, do I really need to and what benefits does it offer to do so and for the development environment?
This question is pretty bad but I remember when I started programming that I had a similar question, so here we go:
How do you install stuff on your computer? Obviously you use the Mac App Store if you want something from Apple, and if you want to install Chrome just go the Google Chrome website etc.
But when you want some kind of programmer tool, let's say a compiler. How do you install this? Either you go to their website, download a tarball with the source code, compile it from scratch and bind the necessary environment variables. Or you are unlucky and the compiler has a bunch of dependencies so you have to download them first.
Then some geniuses thought that "Oh damn, that's a pain", so instead they created so called package managers, so now when I want Rails on my computer, I just installed it through the "gem" ruby package/dependency manager.
So you can install rails through the command "gem" (just google "ruby gem") and you'll see what it is, but I advise you to if you want to have a nice development environment where it's easy to install and uninstall stuff, use brew or macports.

Dealing with a large c++ library in a Rails deployment

I have a Rails project that is going to be using OpenCV, and it depends on a certain version of it (2.4.6.1).
I'm looking for deployment advice. The Ubuntu opencv package is an earlier version and therefore not suitable.
I can see a number of possibilities, but I'm trying to think of what will work best.
Just write it up in a README and expect people to follow it: download this, apt-get that, etc...
Add opencv, tagged at the version we need, as a git subtree, and include a Rake task to build it.
Write a script to download and compile the needed code.
Something else ?
None of them seem all that great, to tell the truth.
Can your application be made to work with OpenCV 2.4.2? That is available in Ubuntu 13.04, and you could request it be backported to 12.04. If not, you could update the source package to 2.4.6.1 (which would require learning about debian packaging but might not be too difficult since you would be modifying an existing package instead of starting from scratch), upload it to a PPA, and instruct your users on Ubuntu to install OpenCV from there. You could also package your rails application and put it in the PPA, which would make overall installation even easier.

How to migrate a Homebrew environment to another computer?

What is the preferred method of exporting a homebrew environment so I can synchronize my workspace between computers? Seems like there should be something similar to composer.lock or pip freeze. Is there a better way than brew list > brews.txt?
There is a better way: brew leaves.
This command prints a simple list of installed formulae which are not dependencies of any other formulae. Essentially this lists everything that was manually installed or is a leftover dependency from a removed formula.
$ brew leaves
apple-gcc42
bash-completion
brew-cask
git
[...]
There's no built-in means of using brew leaves output to install, but just having a clean list of manually-installed formulae is a step in the right direction.
Thanks to this Gabe Berke-Williams for writing about this: http://robots.thoughtbot.com/brew-leaves
Homebrew Bundle seems like a pretty great solution.
There is not a better way, and there are no current plans to make one.
Source: https://github.com/mxcl/homebrew/issues/17771
Use git! Maintaining repos for environment setup scripts is a pretty slick approach.
I highly recommend using a script to set up a development environment in the first place. thoughtbot has a really lightweight approach that provisions a development environment, including a bunch of brew formulas. https://github.com/thoughtbot/laptop. GitHub just open sourced boxen for this (and much more), but it has a somewhat steeper learning curve.
As you can see from the thoughtbot/latop readme, the entire install is a one-liner. If you want different packages, fork the repo and add whatever you use. This only covers the initial install, but it is a fantastic start.
For ongoing synchronization of development environments, including updating your preferred homebrew setup, you might want to try a 'dotfiles' approach. Zach Holman has a great approach detailed here: https://github.com/holman/dotfiles
If you want to tweak or update anything, just make the appropriate changes to the script (holman's dot script does the ongoing update stuff). Commit, push, pull down from any other environments.

Need help configuring ImageMagick

I've directly downloaded the tar file from here onto my desktop for Mac OSX (which is what I'm using) and extracted its contents. Now I've read the following instructions on how to set it up, but honestly they're a bit too cryptic for me. I was wondering if anyone could please break down these instructions into simpler, bite size pieces for someone who typically has trouble configuring new things...
I'd truly appreciate any help! Thanks!
Btw, my end goal is to set this up for the Paperclip plugin.
The first step would be to install MacPorts if you don't have it already. Once MacPorts is installed it should be fairly straightforward based on the instructions listed at the link you provided.
sudo port install ImageMagick
For others interested in this topic, I might look into installing homebrew instead of MacPorts.

virtual ruby development environment

I mainly do ruby on rails development on my machine but from time to time I end up using other laptops for RoR development. It would be nice if there was something (maybe shell?) which basically bring all the gems installed on my machine to some other machine without leaving any footprints. It's basically a really light VM without the OS stuff.
If it matters, I'm using a mac. Ideally I would like to keep that virtual environment in my dropbox and basically when I use some other machine, I would just get it from my dropbox and start coding and not have to worry about setting up the environment.
Similar to Jacob's answer, I'd recommend using RVM, but I'll expand on it. Here's some brainstorming ideas:
RVM stores its sandbox in your home directory at ~/.rvm. All Ruby instances, plus the associated gems will be stored there. It's a simple addition to the ~/.bashrc file in your Mac to initialize RVM so it's known by the shell when you log into the account. It's also a simple rm -rf ~/.rvm from the commandline to remove the RVM sandbox from the account, followed by removing the line from the ~/.bashrc.
So, basically, by setting up RVM correctly and installing your Ruby installation on one machine, you're 90% of the way to having it available for multiple machines.
I'm pretty sure Ruby will install without any dependencies on a current Mac OS using RVM, but there's a couple libraries that can improve the experience. After installing RVM, but before installing any Rubies, run rvm notes. That will show you what else to install. You'll need the current XCode to compile a Ruby, but only on the machine you do the compiling on. Once it's installed you should be able to move a RVM controlled Ruby around to other Macs by copying the ~/.rvm directory. So, not only would you have the gems, you could have a particular version, or versions, of Ruby, plus the associated gems, so your regression tests could work too.
If you use MacVim you could install it in ~/bin and have the GUI version. I haven't tried running it from there, but it seems like it'd work. You might need to create an alias from /Applications to the one in ~/bin for double-clicking.
MacVim comes with a shell script called mvim to launch it from the command-line. I have a bunch of softlinks to mine letting me call it from the command-line in various ways: gvim, and the gvim varients like gvimdiff and gview. You could do the same by adding ~/bin to your PATH and making the links locally in that dir to MacVim's mvim.
You could build a tarball of the vim config, vim installation and RVM sandbox, copy that to another Mac, expand it, add ~/bin to your PATH and append the needed RVM initialization line in ~/.bashrc, open a new command-line, and have your editor plus Ruby sandboxes.
It's a minor variation on how my Mac and Linux boxes are set up. I haven't tried bundling everything together, but, on Macs that are the same OS version, it should work.
Consider using rvm to manage different gem configurations. If you want you can store your rvm configurations in your dropbox (rather than in ~/.rvm, where they go by default) so that your gemsets are synced across machines.

Resources