RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 

grosser — 56 posts

http://grosser.it

Maxitext
- Ctrl+c stops tests and prints failures
- pastable rerun snippet for failures
- multiple before & after blocks
- around blocks around { |t| Dir.chdir(...) { t.call } }
- red-green output
- mtest executable to run by line number and by folder
and more goodies :)
Fun fact: rails just swallows exceptions in after_commit hooks, never to be seen again ...
fix it via gem or monkeypatch
Test multiple rubies and gemfiles locally without Appraisal

ruby test/unit/alert_test.rb
... Failures as normal ...

ruby test/unit/alert_test.rb -n 'AlertTest#test: Alert raises on first

23 tests, 25 assertions, 2 failures, 0 errors, 0 skips
gem install minitest-rerun
require 'minitest/rerun'
We are using this for our crons since the unix timeout command does not support different kill signals

gem i multi_timeout
multi-timeout -INT 5m -KILL 6m rake foo:bar

Multi-Timeout
Simple timesaver: copy github for gem + gem-github {gem} = open github page for {gem} in browser
s3_meta_sync syncs folders efficiently by keeping a metadata-file with MD5s for quick comparison.
No more pushing and waiting for emails, instant results!
(Can also run multiple builds in parallel)
gem install wwtd && wwtd
with repo_dependency_graph

If you have objects bigger then 1MB try large_object_store!
Get notified when any error hits >100 notices/hour by AirMan
(Mails include detailed error and backtrace summary)
bundler-organization_audit audits all your projects for vulnerable gem version. Pro tip: Run it on your CI!
pre-commit comes with checks like missing-migrations/merge-conflicts/whitespace/jshint/... and now can also run project-specific checks via config/pre-commit.rb
If you want your Timezone-select translated try ruby-cldr-timezones
Faster startup + Rails 4 ready + obvious dependencies + it's easy = Kill ActiveRecord Observers
Have fun with redgreen minitest!
Airbrake search & summary of all backtraces for a given error: Airbrake backtrace summary
simple let for shoulda (without method generation magic)
revert any side-effects like require or memory leaks and still get a result fork_and_return
Stuck with Rails 2 and want some asset pipeline love? --> Rails 2 Asset pipeline
gem install testrbl
# alias t="testrbl"
testrbl test/test_xxx.rb:8
Distributed locking via e.g. memcache to ensure 1 and only 1 does e.g. updating of a shared cache.
gem_of_thrones
With parallel_split_test you can run chunks of one large test file in parallel processes, utilizing those lazy extra cores.
Manage and update jquery-extensions / rails plugins / etc. with Vendorer
(think 'bundler' for external files and folder)
matching_bundle looks into your Gemfile and picks the correct bundler version.
(pass any argument as you would pass to bundle, e.g. install, update, ...)
gem install matching_bundle && cd project && matching_bundle
Ruby YouTube Search a siple gem (no dependencies) for a simple task.
YoutubeSearch.search('lolcats', 'orderby' => 'viewCount', :per_page => 3, :page => 1)
Url-To-Media-Tag converts e.g. user-submitted urls into images and videos
UrlToMediaTag.convert('http://www.youtube.com/watch?v=kW-dS4otEZU') # -> <iframe ...>
A nice timesaver from jeweler days rake version:bump:*
Now as standalone drop-in for your Rakefile.
Linguist can do that ... but it requires lot of dependencies (including pygments, which needs python). If you just need plain language detection, check out the dependency free language sniffer
Why worry about a separate process when you can mount it...
(set user and password!)
Mountable resque-web
In IE cookies inside IFrames are not the same as on regular pages, to fix this great security feature, this plugin delivers P3P headers to marked IE users and does not give them 304 headers.
-> IE IFrame cookies plugin/gem
zombie passenger killer ensures your Rails stay free of zombie passengers :)
Prefilled/checked fields with values from params (e.g. params_check_box_tag 'search[user_ids][]', 1).. Check boxes/radio buttons with matching(clickable) labels (e.g. radio_button_with_label 'search[foo]', 1, true, 'Foo?') and more @ helpful_fields
/foo.jpg -> /asset-v123af/foo.jpg (or /foo.jpg?123af) - MD5 only changes on content-change and is identical on all servers. Folders are CDN/proxy/... cacheable and transparent via nginx/apache rewrite rule. For Rails 2 + 3.0: virtual asset paths
With key_value its easy as KeyValue['config'] = {:foo=>:bar} to persist e.g. configuration into your Sql store. And if you want to go 750k-qps-crazy you can activate MySql-HandlerSocket support! check out key_value on github
Ruco is a simplistic/intuitive editor written test-driven in Ruby. It can be configured/extended via .ruco.rb and aims to feels like your desktop editor (e.g. shift+arrow-keys=selecting, ctrl+c/v/x, ctrl+s=save, ctrl+w=close, ctrl+r=replace and much more). Take it for a ride via gem install ruco.
Be a instant-commandline-ninja without learning new tools, e.g. number of files by date:
ls -al | pru 'split(" ")[5]' 'grouped.map{|d, f| "#{d} : #{f.size}" }'
try Pipeable-Ruby (pru).
Short example setup for testing a gem/plugin against rails 2 and 3 using bundler.
If you are thinking about doing some fullscreen commandline stuff and also like games, this Ruby-Curses example gem tic_tac_toe is a nice starting point.
Get your mails from epost to the commandline or gmail with rube_post (using machanize + nokogiri)
gem-dependent will tell you!
Rspec-Instafail A RSpec formatter to see what exactly failed instead of the red F, and green dots for passing specs as usual. Great for long test suites.
Sent a mail, added a Resque job, but something failed and you got a rollback ?
Do it after the current transaction(s) have finished!
after transaction plugin/gem
e.g. MongoMapper
class MyDb
include Scopify
scope :foo, :order=>:foo # or lambda or other scope
end
MyDb.scoped(:limit=>10).foo.all == MyDb.all(:limit=>10, :order=>:foo)
Fallback to delegate if somethings fishy.
fallback :title, :to => :shop, :if => :title_to_short?
A light and hassle-free alternative to defining every resource/member/collection by hand. No more routing errors because a new action was not added to routes.rb
Try the Restful catch all route Rails plugin.
The new 'bitfields' Rails plugin and gem allows simple bitfield managements for ActiveRecord and others, produces fast(indexable) sql for query and bit-setting.
Parallel tests now suppots any kind of test-suite(Test/RSpec/Cucumber), speeds up e.g. action_pack test-suite by 200%. Finally a good excuse for buying Dual/Quad-Core. Speedup those tests, go parallel!
Encode click-tracking or payment requests with secure hashing (Rails cookie-store style) simple as UrlStore.encode(:cliked=>'bottom-right') UrlStore.decode(params[:data]), try the secure url store Rails-plugin/Gem.
With tracked_plugins installation stays the same and new meta information (url / installed_at / revision / ...) is stored used to update plugins, try it!
A standalone autotest fork of ZenTest now if you need autotest simply install/require autotest, and if you need any other of the ZenTest features install the ZenTest without autotest.
Just replace with and the whole page can be cached, but these partials will be freshly rendered. Easy ESI
try ARMerge Rails Plugin/Gem
Parallel processing for ruby allows to easily run any code in parallel Processes or Threads , no more piping/forking/serialisation knowledge required, just results = Parallel.in_processes(2){|i| expensive_computation(data[i]) }
--> parallel spec rails plugin
A helpful TATFT mousepad for programmers who always forget their tests, as permanent memory-aid ;)