Jumpup is a gem that provides a set of tasks to automate all steps of a synchronous continuous integration process for Ruby on Rails apps, that is, continuous integration without a server such as Travis.
Because that's the way we like it!
Add the gem to the development
section of your Gemfile
and run bundle install
:
group :development do
gem 'jumpup'
end
After installing the gem, you'll need to configure the set of tasks you'll want to run as part of your integration process before using it. The configuration is done by setting an array of Rake task names as the INTEGRATION_TASKS
constant on your lib/tasks/jumpup.rake
. For example:
INTEGRATION_TASKS = %w(
jumpup:start
jumpup:bundle_install
db:migrate
spec
jumpup:finish
)
With that in place, you can execute a single task in order to integrate your code safely:
rake integrate
For more information, please have a look at the "Integration Steps" section below.
Using Simplecov on your test suite will make your tests run slower. You can fix it using an environment variable called coverage
on your test / spec helper files to enable Simplecov when needed like:
# On your spec_helper.rb / test_helper.rb
if ENV['coverage'] == 'on'
require 'simplecov'
SimpleCov.start 'rails'
end
The coverage
variable is set to "on" automatically by the integration process. When running tests while you're developing, Simplecov will not run unless you set the coverage
environment variable yourself.
The integration process is composed of several Rake tasks that are explained below. It's possible to skip one or more steps and add other steps of your own. The complete set of tasks we normally use are:
Rake Task | Description |
---|---|
jumpup:integration:check |
Check if other user is already integrating, to avoid reject message from git after runing all tests. |
jumpup:integration:lock |
Lock the integration to current user. |
git:status_check |
Check if all local files have been commited to the local git repository. |
log:clear |
Remove log files. |
tmp:clear |
Remove temporary files. |
git:pull |
Update local files from the remote git repository. |
jumpup:start |
Run all the previous tasks on this order |
jumpup:bundle_install |
Run bundle install on quiet mode |
db:migrate |
Execute any new database migration created by other team members since the last integration. |
test or spec |
Set the rake task your test/spec suite needs to run. Use a command that generate the coverage files. |
git:push |
Push your changes. If any of the previous tasks break, because one test failed, for instance, the script won't push. Actually this task runs only if every checking done before work well. |
jumpup:integration:unlock |
Unlock the integration to current user. |
jumpup:finish |
Run tasks: git:push and jumpup:integration:unlock |
Using this almost paranoid sequence of steps it will be hard to check in bad code in your repository, which is good, very good. The idea is that you should treat your repository as a sacred place, where only good code should ever enter.
Let's say your project don't have tests but you still want to use jumpup. You might get away with this lib/tasks/jumpup.rake
:
INTEGRATION_TASKS = %w(
jumpup:start
jumpup:bundle_install
db:migrate
jumpup:finish
)
The fact that you can get away with this doesn't mean you should. Don't you think it's already time to grow up and become more professional about software development? I know you believe you have a great excuse to avoid writing those tests. Still it's just an excuse. Write tests and make a better world!
You haven't jumped on the BDD bandwagon yet. Instead, you write tests, which is good, but they don't cover all of your code yet, which is bad. We believe you will improve it and make sure your tests cover 100% of your code. In the meantime you might need to skip coverage checkings. Try this:
INTEGRATION_TASKS = %w(
jumpup:start
jumpup:bundle_install
db:migrate
spec
jumpup:finish
)
So you used to TDD all around but then someone told you that this is for gramma. The new wave has a name on it: BDD. So, of course, you now have specs covering 100% of your code and doesn't have any more tests. Great! Just change your test_helper.rb/spec_helper.rb with:
require 'simplecov'
SimpleCov.start 'rails' do
minimum_coverage 100
end
Jumpup follows the Semantic Versioning.
If you have problems, please create a Github Issue.
Please see CONTRIBUTING.md for details.
Follow this steps to release a new version of the gem.
- Test if everything is running ok;
- Change version of the gem on
VERSION
constant; - Add the release date on the
CHANGELOG
; - Do a commit "Bump version x.x.x", follow the semantic version;
- Run
$ rake release
, this will send the gem to the rubygems; - Check if the gem is on the rubygems and the tags are correct on the github;
This code is free to be used under the terms of the MIT license.
Comments are welcome.
Jumpup came from the idea of integration. Thanks to Improve It and the original authors:
This gem was created and is maintained by HE:labs.