Skip to content

Commit

Permalink
Add a better prompt.
Browse files Browse the repository at this point in the history
  • Loading branch information
timdorr committed Jun 22, 2016
1 parent 3062a73 commit c7f8e54
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,33 @@ end

desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -I lib -r tesla_api.rb -rdotenv"
# Load all gems
require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)

# Load the envs
require 'dotenv'
Dotenv.load!

# Set up a global client
def client
@client ||= begin
client = TeslaApi::Client.new(ENV['TESLA_EMAIL'])
client.login!(ENV['TESLA_PASS'])
client
end
end

# Load IRB
require 'irb'
require 'irb/completion'

IRB.conf[:PROMPT_MODE] = :SIMPLE
IRB.conf[:AUTO_INDENT] = true

ARGV.clear
IRB.start
end

task default: :spec

0 comments on commit c7f8e54

Please sign in to comment.