OpenStack nova resize "ERROR: Resize requires a change in size"

If you get this error when you try to resize an OpenStack instance:

# nova resize example 23 --poll
ERROR: Resize requires a change in size. (HTTP 400)

You need to change your flavor to have a different memory size. It's a bug in an older OpenStack version:

        # /nova/compute/api.py
        if (current_memory_mb == new_memory_mb) and flavor_id:		
            raise exception.CannotResizeToSameSize()

which got fixed 2012-09-12 ([https://git.openstack.org/cgit/openstack/nova/commit/nova/compute/api.p...

Convert Haml to ERB

This is about converting Haml to ERB and not the other way round which you probably want!

This process can not be automated 100%, but you can still save time.

First do

script/plugin install http://github.com/cgoddard/haml2erb.git

Then in the console type

hamls = Dir["app/views/**/*.haml"] - ['app/views/layouts/screen.html.haml'];
hamls.each do |haml| 
  puts haml
  erb = haml.sub(/\.haml$/, '.erb')
  File.open(erb, 'w') do |file| 
    file.write Haml2Erb.convert(File.read(haml)) 
  end
end

After th...

Github: How to find the Readme for a certain version of a gem

When a gem author releases a new version to Rubygems, usually a tag with the version number (e.g. v1.2.0) is created an pushed to Github, so everyone can check out or take a look at the source code at this point version release at a later time.

If you'd like to take a look at the Readme of a specific Gem version, you can easily switch to that git tag on Github.

Github: Checkout Git Tag

Execution of shell code in Ruby scripts

Deprecated ways to execute shell code in Ruby

This is just a reference for legacy code. For new code, always use capture3.

%x{ } or backticks – quick and easy

Returns the standard output of running the given command in a subshell. This is an alias for `...`, and you can use string interpolation.

Example:

name = 'ls'
result = `which #{name}`

It does not escape anything you inject in the string, so be aware of possible security vulnerabilities...

Release gem; Deploy gem; Update a gem created with Jeweler

Until May 2011 our gems have been created with Jeweler, which is a helper library to package code into a gem. You know a gem was cut with Jeweler if you see the word jeweler in a gem project's Rakefile.

This note describes how to update a gem that was cut using Jeweler. Note that this can be traumatic the first time. It would be great to have an easier workflow for this. Jeweler is deprecated these days because you can

**now [cut gems more easily using Bundler](https://makandracards.com/makandra/1229-updat...

Rubymine provides a visual merge conflict resolution tool

RubyMine provides a visual tool for resolving merge conflicts locally.

Follow

Git > Resolve Conflicts

in the context menu to open RubyMine's merge conflict tool.

  • Left pane: local copy (read-only)
  • Right pane: checked in version from repository (read-only)
  • Central pane: base revision from which both conflicting versions are derived

You can also use a similar pane view to compare to files.
Mark two files and press Ctrl + D to compare.

Using Bumbler to Reduce Runtime Dependencies - The Lean Software Boutique

Tool to show you which gems are slow to load:

➜  git:(master) ✗ bundle exec bumbler
[#################################################                             ]
(49/65) travis-lint...
Slow requires:
    110.21  render_anywhere
    147.33  nokogiri
    173.83  haml
    179.62  sass-rails
    205.04  delayed_job_active_record
    286.76  rails
    289.36  mail
    291.98  capistrano
    326.05  delayed_job
    414.27  pry
    852.13  salesforce_bulk_api

Github Cheat Sheet

All the hidden and not hidden features of Git and GitHub.

Speeding up ssh session creation

Establishing a new SSH connection usually takes only a few seconds, but if you’re connecting to a server multiple times in succession the overhead starts to add up. If you do a lot of Git pushing and pulling or frequently need to SSH to a dev server, you’ve probably felt the pain of waiting for SSH to connect so you can get back to doing work.

Generate Puppet or Chef recipes from a Ubuntu system state

blueprint is DevStructure’s workhorse tool that looks inside popular package managers, finds changes you made to configuration files, and archives software you built from source to generate Puppet, Chef, or shell code.  Everything blueprint sees is stored in Git to be diffed and pushed.  It runs on Ubuntu Linux 10.04 and newer.

Heroku | How it Works

Heroku's architecture enables deployment with nothing but Git. Deployment is fast, simple, and just works – all you do is push code to your repo on Heroku.

metric_fu: A Ruby Gem for Easy Metric Report Generation

Metric_fu is a set of rake tasks that make it easy to generate metrics reports. It uses Saikuro, Flog, Flay, Rcov, Reek, Roodi, Subversion, Git, and Rails built-in stats task to create a series of reports. It's designed to integrate easily with CruiseControl.rb by placing files in the Custom Build Artifacts folder.

rubaidh's rubaidhstrano at master - GitHub

Capistrano recipes for database backups before migrations, passenger deployment strategy, release tagging in Git repos.

Capistrano + Rails: Automatically skipping asset compilation when assets have not changed

In medium-sized to large Rails applications, asset compilation can take several minutes. In order to speed up deployment, asset precompilation can be skipped. This card automates the process.

Capistrano 3

namespace :deploy do
  
  desc 'Automatically skip asset compile if possible'
  task :auto_skip_assets do
    asset_locations = %r(^(Gemfile\.lock|app/assets|lib/assets|vendor/asset))

    revisions = []
    on roles :app do
      within current_path do
        revisions << capture(:cat, 'REVISION').strip
      ...