GithubHelp home page GithubHelp logo

marjanna / gogo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brianhempel/gogo

0.0 2.0 0.0 60 KB

Pseudo-shell hack with Rails environment preloaded for faster tests and faster generators and faster rake commands. Go go go go!

License: Other

gogo's Introduction

Screaming dude meme: FASTER ALL THE RAILS

GoGo

Yaknow how you're waiting for waiting for Rails to start and other people overhear you say "Go Go Go Go!" to your computer?

Install the gem (no need to put it in your Gemfile):

gem install gogo

Make sure you're in your Rails project and then run:

$ gogo

That will launch you into a pseudo-shell with the Rails test environment reloaded. If you want to use gogo for development commands such as rake db:seed, rake db:migrate, or rails console, launch a separate shell and run:

$ gogo d

Now, run some commands. Ruby scripts that load Rails should start astronomically faster.

Don't "bundle exec" inside gogo. It will really exec and Rails will start as slow as before.

For the nitty gritty, read the source and inspect the default Gofile that is created in your project.

Sounds fishy...

It is fishy. GoGo is a hack script.

I'm sharing it with the world because it's an incredibly useful hack, but I can't guarantee any level of maintenance on my part. If stuff breaks, you're probably on your own to fix it. Leave your experience in the wiki to help others.

GoGo is a lot like Spork. GoGo preloads your rails environment. When you run a ruby command, the gogo process is forked and the command is loaded into that environment. Here's a performance comparison for a large project:

$ time bundle exec cucumber features/admin/dashboard.feature:0
real  0m30.457s
user  0m27.300s
sys   0m2.941s

$ gogo
Creating default Gofile for Rails...
Loading application.rb...and environment.rb...and cucumber...and cucumber/rails...and webmock/cucumber...and ruby-debug...and factory_girl/step_definitions...and email_spec...and email_spec/cucumber...and capybara/firebug...and vcr...and rake...took 26.25 seconds.
test $ cucumber features/admin/dashboard.feature:0
cucumber took 3.65 seconds.
test $ cucumber features/admin/dashboard.feature:0
cucumber took 3.58 seconds.

The advantages over Spork are:

  1. No DRB weirdness
  2. Easy install -- little to no modification to test environment.
  3. Speeds up other rails commands: rake routes, rails g migration, rake db:seed
  4. Single tab, so you know when code reloads are complete.

General disadvantages:

  1. It's not a full shell. No aliases or boolean logic || && for commands.
  2. You're already in a bundled environment, so rake db:seed is going to apply to the test environment. You probably don't want that.
  3. Have to ctrl-D and reload after Gemfile changes.
  4. Uses some Mac OS X only features, but if you want to hack those out it shouldn't be too hard.

One advantage over even the shell is a per-project and per-environment command history.

Contributing

To fix a problem or add a feature, use the standard pull request workflow:

# fork it on github, then clone:
git clone [email protected]:YOUR_USERNAME/gogo.git
# hack away
git push
# then make a pull request

Once you get a pull request accepted, I'll add you so you can commit directly to the repository.

git clone [email protected]:brianhempel/gogo.git
# hack away
git push

License

Public domain; no restrictions.

And certainly: no warrantee of fitness for any purpose. It's a hack. Use at your own risk.

gogo's People

Contributors

brianhempel avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.