forked from renatodex/intelipost-ruby-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
34 lines (29 loc) · 1.02 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require "bundler/gem_tasks"
require "colorize"
def load_irb
require 'irb'
require 'rspec'
require_relative 'spec/spec_helper'
ARGV.clear
IRB.start
end
def puts_header_text
puts "-------------------------------------"
puts "Intelipost::Api Console".on_blue
puts "-------------------------------------"
puts "This is a Irb Console including Intelipost Lib and Rspec environment.".yellow
puts "A method called ".yellow + " i ".on_red.white + " will instantiate Intelipost::Api and your key".yellow
puts "For your convenience, you can pass an ApiKey for this method.".yellow
puts "If you dont specify any ApiKey, we will generate the variable with a Fake ApiKey.".white
puts "-------------------------------------"
end
def i(apikey=nil)
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
o1 = (0...50).map { o[rand(o.length)] }.join
Intelipost::Api.new((apikey || o1))
end
desc "Open an irb session preloaded with this library"
task :console, [:apikey] do |t, apikey|
puts_header_text
load_irb
end