I understand that "bundle exec" is directing the bundler to execute something in the context of the given directory and gemfile.
But what is the difference between bundle exec rake and bundle exec rackup?
Also, in the case of bundle exec rackup what is the start of flow of execution?
They are different tools.
rake runs task scripts defined using a special DSL.rackup is a part of rack which is a minimal webserver interface.rackup is a useful tool for running Rack applications, which uses the Rack::Builder DSL to configure middleware and build up applications easily. rackup automatically figures out the environment it is run in, and runs your application as FastCGI, CGI, or WEBrick—all from the same configuration.
To run a Rack application you can pass a path to it as a parameter:
bundle exec rackup yourapp.ru
Or create config.ru file with your application initialization and just run bundle exec rackup.
Here is the minimal Rack application:
run ->(env) { [200, {'Content-Type' => 'text/html'}, ['Hi Mugen']] }
UPD
As @tadman mentioned in a comment below bundle exec just loads what's in the Gemfile and prepared the environment. Also, dependent on your setup you can run rake and rackup without the bundle exec command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With