Sha256: abd38481bd270ba97c0cef43b45fa62d1e5110cd101036009a454659ba51c0fe

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 Bytes

Contents

# system deps
require "rubygems"

# gem deps
require 'jaysus'
require 'thor'

# lib deps
require 'kalipso/cli'
require 'highline/import'
require 'rest_client'
require 'pathname'

# models
require 'kalipso/site'

# app
Dir[File.expand_path('app/*/*.rb', __FILE__)].each do |file|
  require file
end

Jaysus::Local.store_dir = File.expand_path("~/.kalipso")

token_path = Jaysus::Local.store_dir.join('token')

if token_path.exist?
  token = token_path.read
else
  email = ask("Enter your email:  ") { |q| q.echo = true }
  password = ask("Enter your password:  ") { |q| q.echo = "*" }
  token = ActiveSupport::JSON.decode(RestClient.get("http://#{CGI.escape(email)}:#{CGI.escape(password)}@oncalypso.com/api/v1/users.json"))['token']
  token_path.open('w') do |file|
    file.write token
  end
end

Jaysus::Remote.base_url = "http://#{token}:x@oncalypso.com/api/v1"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kalipso-0.1.4 lib/kalipso.rb