Sha256: 1f0e9a2277392eb3105a1640d42c09238944b8a5afeb5fda2362f8ef28591891

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
intelipost-api-1.0.7 Rakefile
intelipost-api-1.0.6 Rakefile
intelipost-api-1.0.5 Rakefile
intelipost-api-1.0.4 Rakefile
intelipost-api-1.0.3 Rakefile
intelipost-api-1.0.2 Rakefile