Rosey keeps your house clean!

Rosey is a robotic housekeeper for your HTML5 based apps.

Rosey

Installation

Add this line to your application's Gemfile:

gem 'rosey'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rosey

Usage

Add rosey to your Rakefile and set it up with your own configuration:

require 'rosey/tasks/all'

$GO = ENV['GO'] || "go"
$FOREMAN = ENV['FOREMAN'] || "foreman"
$PUBLIC_DIR ||= "public"
$COMPILED_ASSETS_DIR ||= "#{$PUBLIC_DIR}/assets"
$PRODUCTION_BRANCH ||= "production"

Now specify custom tasks you'd like to have:

desc "Starts application server."
task :server => :install do
  sh "#{$FOREMAN} start"
end

desc "Rebuilds backend application."
task :build do
  sh "#{$GO} build ."
end

desc "Runs all tests against backend."
task :test do
  sh "#{$GO} test ./..."
end

# *snip*

Specify your deployment strategy tasks too. Here's an example of deploying app to heroku.

namespace :deploy do
  task :push do
    sh "#{$GIT} push heroku #{$PRODUCTION_BRANCH}:master"
  end

  task :prepare => :default
end

Task prepare will be invoked just before creating new release, and push will be invoked just afterword.

Assets packaging

Rosey provides neat tasks for assets packaging and development. You can compile assets with the following task:

$ rake assets:precompile

This command reads assets configuration from config/assets.yml file, which is standard Jammit config file.

You can also specify DEV option to execute it in development mode:

$ rake assets:precompile DEV=1

This can be combined with ERb powered Jammit's configuration:

<% if ENV['DEV'] == '1' %>

compress_assets: off
embed_assets: off
gzip_assets: off

<% else %>

compress_assets: on
embed_assets: datauri
gzip_assets: true

<% end %>

# *snip*

To speed up development you can keep watching for assets changes. Add following Guardfile to your project:

guard :livereload do
  watch %r{public/.*$}
end

guard :shell do
  watch %r{^((assets/(.+/)?.+\.(js|jst|css))|(config/assets.yml))$} do |m|
    system 'rake assets:precompile DEV=1'
    n "Assets recompiled (changed files: #{m.join(', ')})"
  end
end

Now start guard with command:

$ rake assets:watch

Deployment

To start working with deployment features, you must create a production branch in your repo first:

$ git checkout -b production

Next, you must remove precompiled assets locations from your .gitignore and create a version file:

$ echo 0 > VERSION

Now just commit and push those changes, and go back to master.

$ git add .gitignore VERSION
$ git commit -m "prepared production branch"
$ git push production master

From now on you can use deployment tasks provided by Rosey:

$ rake deploy

This task will build your app (or run tests), precompile assets, commit changes to production branch and push them both to the repository and to the server.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request