Inject SSH pub key to Vagrant image

Usually if you create a Vagrant VM an insecure private key gets injected into the VM, which is located at ~/.vagrant.d/insecure_private_key. In Ansible you can reference that key to ensure a passwordless login to the VM. Since Vagrant 1.8.5 this doesn’t work anymore, because of security reasons. That’s why I use now this shell provisionerContinue reading “Inject SSH pub key to Vagrant image”

MongoDB Map & Reduce with Date filter

We are using MongoDB as primary DB at VersionEye, together with MongoID. Software package is a document in the “products” collection. These products collections has a subcollection with “versions”. Assume we want to know how many versions/artifacts existed for a given language to a given time? That is not a simple query in MongoDB. ThisContinue reading “MongoDB Map & Reduce with Date filter”

PDFKit – invalid byte sequence in US-ASCII

I’m using PDFKit at VersionEye to generate the PDF invoices. It’s a really awesome project. The idea behind PDFKit is that you generate the documents as HTML and CSS and then convert it to PDF. That works really well. Generating a PDF works like this: The first parameter “html” is the HTML as string. InContinue reading “PDFKit – invalid byte sequence in US-ASCII”

Geek2Geek – Centralized Logging

Last week it happened again. Geek2Geek! This time we came together at Flyeralarm in Berlin to talk about centralized logging. That is an interesting topic for all companies which have to scale. As soon you have more than 1 server you need to think about how you collect and analyze your log files in aContinue reading “Geek2Geek – Centralized Logging”

Deployment with Capistrano 3

Capistrano is a ruby based deployment tool which executes commands in parallel on multiple remote machines, via the SSH protocol. With Capistrano you can deploy your Rails application on N servers with one single command from your dev machine. You even don’t need to login via SSH to your server. This command can rollout your application on NContinue reading “Deployment with Capistrano 3”

Configuring host and port for Selenium/Capybara

I’m using Capybara and Selenium together with RSpec to test the Web Interface for VersionEye. That works very well. For an integration test I needed a callback on localhost:3000/auth/*. By Default Capybara is starting the tests on an odd host and port name to avoid conflicts with locahost:3000, which is the default host and portContinue reading “Configuring host and port for Selenium/Capybara”

has_secure_password with Rails 4.1

I just started a new project with Rails 4.1 and explored the has_secure_password feature. Really awesome stuff! I hope you are not storing passwords in clear text to your database! You should always store some kind of hashed values instead of clear text passwords. In case somebody steals your database he/she still doesn’t has theContinue reading “has_secure_password with Rails 4.1”

Comparison of Application Level Package Managers

I have to work with a lot (9) of different package managers at my daily work at VersionEye. Part of our mission is it to make manual updating of dependencies extinct, because it’s a manual and time consuming task which nobody enjoys. That’s why we are building a notification system for open source software libraries to make ContinuousContinue reading “Comparison of Application Level Package Managers”

Semantic Versioning

Do you know semantic versioning? You should! It describes how to name version numbers. Check it out here: This is the pattern it describes: MAJOR.MINOR.PATCH MAJOR version when you make incompatible API changes  MINOR version when you add functionality in a backwards-compatible manner PATCH version when you make backwards-compatible bug fixes The cool thing hereContinue reading “Semantic Versioning”

HTTP_REFERER for RSpec is missing

Currently got this error message after executing my RSpec tests: ActionController::RedirectBackError: No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env[“HTTP_REFERER”]. The error message and Stackoverflow tells you to set request.env[“HTTP_REFERER”]. I did that: request.env[“HTTP_REFERER”] = “/signin”Continue reading “HTTP_REFERER for RSpec is missing”

Testing AJAX with Capybara and Selenium

In the past days I migrated my tests from WebRat to Capybara and I wrote a couple new acceptance tests with RSpec, Capybara and the selenium-webdriver. All in one it’s pretty cool. You can just keep writing your acceptance tests as usual with RSpec and Capybara. Here is a small example. This test is sendingContinue reading “Testing AJAX with Capybara and Selenium”

Moving Tests from Webrat to Capybara

I one of my applications I had a bunch of tests written with RSpec and Webrat. Unfortunately it seems that Webrat is not longer maintained actively anymore. That’s why it is a good decision to move to Capybara, an active Test Framework for Ruby. The Migration was so far pretty smooth. Most time it wasContinue reading “Moving Tests from Webrat to Capybara”

Testing SSL with Capybara and Selenium

I am using Capybara with Selenium as JS engine to write acceptance tests for a Ruby on Rails application. In some controllers I am forcing SSL with the “force_ssl” filter from Rails. By running the tests with Selenium this caused some problems. Selenium is launching Firefox and calls the URL Of course there isContinue reading “Testing SSL with Capybara and Selenium”

undefined method `visit’ for RSpec with Capybara

I just started to write an acceptance test with capybara. I followed the code example on the GitHub Page and I got this odd error: Failure/Error: visit ‘; NoMethodError: undefined method `visit’ for #<RSpec::Core::ExampleGroup::Nested_1::Nested_1:0x007fda48e0f680> I placed my test in “spec/requests”. After some research I found out that the new Capybara GEM expects the test to beContinue reading “undefined method `visit’ for RSpec with Capybara”

Determine scopes for given GitHub Token

If you have a given token from GitHub and you want to know which scopes it has you have to check the Headers. Just use the token for any resource on the GitHub API and double check the headers of the response. In the headers the “x-oauth-scopes” field tells you the which scopes the tokenContinue reading “Determine scopes for given GitHub Token”