Skip to content

Instantly share code, notes, and snippets.

View arwagner's full-sized avatar

Andrew Wagner arwagner

  • Northern Virginia
View GitHub Profile
>> class Foo; def a; end; end
=> nil
>> class Bar < Foo; def a; super; end; end
=> nil
>> Bar.new.a
=> nil
@arwagner
arwagner / gist:1302751
Created October 21, 2011 00:02
rspec spec exclusion
require 'rspec'
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:core) do |t|
t.rspec_opts = "-t ~foo"
end
describe "foo", :foo => true do
it "should be awesome" do
puts "foooooo!"
@arwagner
arwagner / gist:1291220
Created October 16, 2011 18:11
rvm install rbx
new-host-3% rvm install rbx
rbx-head installing #dependencies
Cloning git://github.com/rubinius/rubinius.git
Copying from repo to source...
rbx-head - #configuring
rbx-head - #compiling
rbx-head - adjusting #shebangs for (erb ri rdoc).
rbx-head - #importing default gemsets (/Users/andrewwagner/.rvm/gemsets/)
WARN: rbx rbx-head-head is not installed.
To install do: 'rvm install rbx-head-head'
@arwagner
arwagner / gist:1291200
Created October 16, 2011 17:58
rvm install rbx error
new-host-3% rvm install rbx
rbx-head installing #dependencies
Cloning git://github.com/rubinius/rubinius.git
mkdir: /Users/andrewwagner/.rvm/log/rbx-head: Permission denied
touch: /Users/andrewwagner/.rvm/log/rbx-head/rbx.repo.log: No such file or directory
/Users/andrewwagner/.rvm/scripts/functions/utility: line 152: /Users/andrewwagner/.rvm/log/rbx-head/rbx.repo.log: No such file or directory
/Users/andrewwagner/.rvm/scripts/functions/utility: line 159: /Users/andrewwagner/.rvm/log/rbx-head/rbx.repo.log: No such file or directory
ERROR: Error running 'git clone --depth 1 git://github.com/rubinius/rubinius.git /Users/andrewwagner/.rvm/repos/rbx-head', please read /Users/andrewwagner/.rvm/log/rbx-head/rbx.repo.log
Could not fetch git://github.com/rubinius/rubinius.git - trying http://github.com/rubinius/rubinius.git
Cloning http://github.com/rubinius/rubinius.git
@arwagner
arwagner / gist:1291183
Created October 16, 2011 17:45
can't uninstall
rvm rubies
jruby-1.6.4 [ darwin-x86_64-java ]
rbx-master [ x86_64 ]
=> ruby-1.8.7-p352 [ x86_64 ]
ruby-1.9.2-p290 [ x86_64 ]
new-host-3% sudo uninstall rbx-master
sudo: uninstall: command not found
new-host-3% sudo rvm uninstall rbx-master
@arwagner
arwagner / gist:1291172
Created October 16, 2011 17:32
permission error
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Users/andrewwagner/.rvm/gems/rbx-head-head-master directory.
/Users/andrewwagner/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [minitest-1.6.0, rake-0.8.7, rdoc-2.5.8] (Gem::LoadError)
from /Users/andrewwagner/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/andrewwagner/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1195:in `gem'
from /Users/andrewwagner/.rvm/gems/ruby-1.9.2-p290/bin/bundle:18:in `<main>'
new-host-3%
# reek does this at the top level somewhere
# (which means you could define your own smell at the top level somewhere too)
smell :duplication do |code|
code.methods.where do |method|
method.method_calls.where do |call|
method.method_calls.where do |call2|
call2 == call
end.count > 1
end.count > 1
end
# YAML report
smell_results = {}
smells.each do |smell|
smell_results[smell.name] = smell.results
end
puts y smell_results
@arwagner
arwagner / gist:1262573
Created October 4, 2011 19:39
more fun
require 'reek2'
describe "smell detection" do
context "attribute" do
it "detects when there are 2 attr_readers in one class" do
pending
code_str = <<RUBY
class Foo
attr_reader :bar1
attr_reader :bar2