Ich versuche, eine Rake-Aufgabe zu schreiben, die eine Umgebung einrichten wird, die mein Projekt widerspiegelt.Wie starte ich die IRB-Konsole von einer Rake-Aufgabe?
task :environment do
require 'rubygems'
require 'sequel'
# require 'my_projects_special_files'
end
task :foo => [:environment] do
require 'irb'
IRB.start
end
führt zu beschweren IRb dass „foo“ nicht existiert (der Name der Aufgabe)
10:28:01:irb_test >> rake foo --trace (in /Users/mwlang/projects/personal/rake/irb_test) ** Invoke foo (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute foo rake aborted! No such file or directory - foo /opt/local/lib/ruby/1.8/irb/input-method.rb:68:in `initialize' /opt/local/lib/ruby/1.8/irb/input-method.rb:68:in `open' /opt/local/lib/ruby/1.8/irb/input-method.rb:68:in `initialize' /opt/local/lib/ruby/1.8/irb/context.rb:80:in `new' /opt/local/lib/ruby/1.8/irb/context.rb:80:in `initialize' /opt/local/lib/ruby/1.8/irb.rb:92:in `new' /opt/local/lib/ruby/1.8/irb.rb:92:in `initialize' /opt/local/lib/ruby/1.8/irb.rb:57:in `new' /opt/local/lib/ruby/1.8/irb.rb:57:in `start' /Users/mwlang/projects/personal/rake/irb_test/Rakefile:9
Das war in der Tat das Problem! Danke für die Antwort –
Danke auch! @MichaelLang Du solltest diese Antwort schon annehmen. –
Es gibt eine einfachere Möglichkeit, dies in Ruby 2.4.0 zu tun; Sieh meine Antwort. –