Skip to content

Instantly share code, notes, and snippets.

@brauliobo
brauliobo / gettext2rubyi18n.rb
Last active December 16, 2015 23:19
A script to convert your source code`s calls to _() (gettext) to t() (ruby i18n).
#!/usr/bin/env ruby
#
# https://gist.github.com/brauliobo/5512890
# Authors: Bráulio Bhavamitra <[email protected]> and Hugo Melo <[email protected]>
# License: GPLv3
#
# A script to convert your source code`s calls to _() (gettext) to t() (ruby i18n).
#
# Convert text string to a key along with the file path. Example:
# Call _('Name') into source views/profile/index.index output into config/locales/en.yml:
namespace :spork do
SPORK_PORT = (ENV['SPORK_PORT'] || 8988).to_i
FRAMEWORKS = %w[testunit rspec cucumber]
desc "Start all Spork frameworks"
task 'start' => FRAMEWORKS.map{ |f| "spork:#{f}:start" }
desc "Stop all Spork frameworks"
task 'stop' => FRAMEWORKS.map{ |f| "spork:#{f}:stop" }