Skip to content

Instantly share code, notes, and snippets.

@mtheoryx
Created August 25, 2011 18:04
Show Gist options
  • Save mtheoryx/1171315 to your computer and use it in GitHub Desktop.
Save mtheoryx/1171315 to your computer and use it in GitHub Desktop.
trial by fire, rake and DSL issues
So, I cd into my repo, it auto-bundles, all seems good. Here's the Rakefile:
# encoding: utf-8
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
# require 'rake/dsl_definition'
require 'rake'
task :default do
puts "Hello World!"
end
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "gsaindexclean"
gem.homepage = "http://github.com/mtheoryx/gsaindexclean"
gem.license = "MIT"
gem.summary = %Q{Gem to automate the pruning of invalid urls in an index.}
gem.description = %Q{Parses an index dump from a Google Search Appliance, finds invalid URLs, and adds those to the Do Not Index list.}
gem.email = "drpoindexter@gmail.com"
gem.authors = ["David Poindexter"]
# dependencies defined in Gemfile
end
Jeweler::RubygemsDotOrgTasks.new
#
# require 'rspec/core'
# require 'rspec/core/rake_task'
# RSpec::Core::RakeTask.new(:spec) do |spec|
# spec.pattern = FileList['spec/**/*_spec.rb']
# end
#
# RSpec::Core::RakeTask.new(:rcov) do |spec|
# spec.pattern = 'spec/**/*_spec.rb'
# spec.rcov = true
# end
#
task :default => :spec
#
require 'rdoc'
# require 'rdoc/task'
# RDoc::Task.new do |rdoc|
# version = File.exist?('VERSION') ? File.read('VERSION') : ""
#
# rdoc.rdoc_dir = 'rdoc'
# rdoc.title = "gsaindexclean #{version}"
# rdoc.rdoc_files.include('README*')
# rdoc.rdoc_files.include('lib/**/*.rb')
# end
I run: rake, and I get:
davpoind @ DRP-iMac:~/dev/gsaindexclean [git:master]
→: rake
(in /Users/davpoind/dev/gsaindexclean)
rake aborted!
uninitialized constant Rake::DSL
/Users/davpoind/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rake.rb:2482:in `const_missing'
/Users/davpoind/.rvm/gems/ruby-1.9.2-head@global/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>'
/Users/davpoind/.rvm/gems/ruby-1.9.2-head@global/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:Rake>'
/Users/davpoind/.rvm/gems/ruby-1.9.2-head@global/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (required)>'
/Users/davpoind/.rvm/gems/ruby-1.9.2-head@global/gems/jeweler-1.6.4/lib/jeweler/tasks.rb:2:in `require'
/Users/davpoind/.rvm/gems/ruby-1.9.2-head@global/gems/jeweler-1.6.4/lib/jeweler/tasks.rb:2:in `<top (required)>'
/Users/davpoind/dev/gsaindexclean/Rakefile:21:in `<top (required)>'
/Users/davpoind/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rake.rb:2373:in `load'
/Users/davpoind/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile'
/Users/davpoind/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/Users/davpoind/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/Users/davpoind/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/Users/davpoind/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rake.rb:1991:in `run'
/Users/davpoind/.rvm/rubies/ruby-1.9.2-head/bin/rake:35:in `<main>'
Then, I uncomment line 13 of the rakefile:
require 'rake/dsl_definition'
And run her again, and I get:
davpoind @ DRP-iMac:~/dev/gsaindexclean [git:master]
→: rake
(in /Users/davpoind/dev/gsaindexclean)
/Users/davpoind/.rvm/gems/ruby-1.9.2-head@global/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
/Users/davpoind/.rvm/gems/ruby-1.9.2-head@global/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
Hello World!
Better, but still really frickin' odd and annoying. So I try another command:
davpoind @ DRP-iMac:~/dev/gsaindexclean [git:master]
→: bundle exec rake
Hello World!
Why on earth is this happening on my machine, but my machine at work, with the same stuff, is able to use just the plain old "rake" command just fine??
Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment