Rvmpow
rvmpow
is usefull only if you:
Pow needs to know what ruby and gemset is being used. rvm users can provide this information manually or install rvmpow
and it'll handle it for you, including adding the new configuration file to .gitignore and linking the new app for immediate browsing.
Words of caution
I tested on newly created and updated rails apps, a bare minimal rack "app" and a bare minimal Sinatra app. Feedback is more than welcome.
If you are already specifying the ruby version and gemset via .rvmrc or .ruby-version/.ruby-gemset or in your Gemfile, be aware that rvmpow uses Gemfile (which is a good thing if you're going to deploy to heroku for instance). rvmpow
will not change the gemfile if ruby and gemset information is present. I advise to remove it prior to running rvmpow
. If you use one of the other metioned methods, move or delete the files prior to running rvmpow
.
Examples
Rails
~/Documents/Dev/Rails ∆2.1.1 ›rails
13:34 $ rvm-prompt
ruby-2.1.1@rails
~/Documents/Dev/Rails ∆2.1.1 ›rails
13:34 $ rails new newApp
...
13:35 $ cd newApp/
~/Documents/Dev/Rails/newApp ∆2.1.1 ›rails
13:35 $ rvmpow init
Done Create .powenv file
Done Create pow link
Done Touch restart file
Done Add .powenv to .gitignore
Done Add ruby and gemset info to Gemfile
~/Documents/Dev/Rails/newApp ∆2.1.1 ›rails
13:35 $ rvmpow clear
Done Remove rvmpow entries from .gitignore
Done Remove rvmpow entries from Gemfile
Done Delete .powenv file
Done Delete restart file
Done Delete pow link
~/Documents/Dev/Rails/newApp ∆2.1.1 ›rails
Sinatra
Minimal but working. (source)
Create a directory for your Sinatra app and do:
bundle init
Edit the Gemfile as follows:
source "https://rubygems.org"
gem "sinatra"
gem "rvmpow"
Back in the shell, run:
bundle install
Add the "app" file my_sinatra.rb :
require 'sinatra'
get '/' do
'Welcome to Sinatra'
end
Add the config.ru file:
require './my_sinatra'
run Sinatra::Application
And let rvmpow
do the rest:
~/Documents/Dev/Ruby/frank ∆2.1.1 ›sinatra
15:01 $ rvm-prompt
ruby-2.1.1@sinatra
~/Documents/Dev/Ruby/frank ∆2.1.1 ›sinatra
15:01 $ rvmpow init --rackdev --show
Done Add .powenv file
Done Add app link in ~/.pow
Done Touch restart.txt file in ./tmp/
Done Add '.powenv' to ./.gitignore
Done Add rvm ruby and gemset information to ./Gemfile
Done Touch always_restart.txt file in ./tmp/
Done Open app in default browser
~/Documents/Dev/Ruby/frank ∆2.1.1 ›sinatra
Rack
Minimal but working. (source)
Create a new directory for your Rack "app" with your app file my_app.rb:
class MyApp
def call env
[200, {"Content-Type" => "text/plain"}, ["Hi there!!! The time is #{Time.now}"]]
end
end
Create config.ru to launch your app.
require './my_app'
run MyApp.new
Then let rvmpow do the rest.
~/Documents/Dev/Ruby/Rack ∆2.1.1 ›rack
12:18 $ rvm-prompt
ruby-2.1.1@rack
~/Documents/Dev/Ruby/Rack ∆2.1.1 ›rails
12:18 $ rvmpow init --rackdev --show
Done Add .powenv file
Done Add app link in ~/.pow
Done Touch restart.txt file in ./tmp/
Done Add '.powenv' to ./.gitignore
Done Add rvm ruby and gemset information to ./Gemfile
Done Touch always_restart.txt file in ./tmp/
Done Open app in default browser
~/Documents/Dev/Ruby/Rack ∆2.1.1 ›rails
Installation
Add this line to your application's Gemfile:
gem 'rvmpow'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rvmpow
Usage
Make sure you are in the root directory of your Rack app before running rvmpow
$ rvmpow init
To open the app in your default browser directly after initialization, run:
$ rvmpow init --show
To open the app after initialization, run:
$ rvmpow open
If needed, you can pick individual actions via rvmpow add
or rvmpow remove
.
rvmpow comes with extensive help built in, just run:
$ rvmpow
Contributing
- Fork it ( http://github.com//rvmpow/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request