Files
ubicloud/bin/pry

56 lines
1.1 KiB
Ruby
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env ruby
# frozen_string_literal: true
REPL = true
require_relative "../loader"
require "pry"
if Config.development?
require "awesome_print"
require "awesome_print/ext/sequel"
module AwesomePrint::Sequel
remove_method(:awesome_sequel_document)
def awesome_sequel_document(object)
"#{object} #{awesome_hash(object.values)}"
end
end
end
def dev_project
return unless Config.development?
ac = Account[email: "dev@ubicloud.com"] || Account.create_with_id(email: "dev@ubicloud.com")
ac.projects.first || ac.create_project_with_default_policy("default")
end
def udec(*)
UBID.decode(*)
end
opts = Pry::CLI.parse_options
Pry.config.prompt_name = if Config.production?
"\e[41m⚠ %s\e[0m" % "clover-#{Config.rack_env}"
else
"clover-#{Config.rack_env}"
end
if Config.development?
module PryReloader
def evaluate_ruby(code)
begin
Unreloader.reload!
rescue StandardError, ScriptError => e
puts "#{e.class}: #{e.message}"
puts e.backtrace[0...5]
end
super
end
end
Pry.prepend(PryReloader)
end
Pry::CLI.start(opts)