Sha256: 286f8c4a1f61fda9c16686e5a3f57bedf866d9d1e57aed1101a28e13108e9096
Contents?: true
Size: 1.1 KB
Versions: 11
Compression:
Stored size: 1.1 KB
Contents
module Gritano module CLI def CLI._execute(cmd, console) begin output = console.execute(cmd) if output[0] output[1].to_s else "error: #{output[1]}" end rescue console.execute(["help"])[1] end end def CLI.execute(cmd, stdin = STDIN, home_dir = Etc.getpwuid.dir, repo_dir = Etc.getpwuid.dir) Gritano::Console.remote_console(false) _execute(cmd, Gritano::Console::Gritano.new(stdin, home_dir, repo_dir)) end def CLI.check(cmd, login, stdin = STDIN, home_dir = Etc.getpwuid.dir, repo_dir = Etc.getpwuid.dir) Gritano::Console.remote_console(true) _execute(cmd + [login], Gritano::Console::Remote.new(stdin, home_dir, repo_dir)) end def CLI.check_pub_key(key, home_dir = Etc.getpwuid.dir) ActiveRecord::Base.establish_connection(YAML::load(File.open(File.join(home_dir, '.gritano', 'database.yml')))) k = Key.find_by_key(key) if k return "command=\"gritano-remote #{k.user.login}\" #{k.key}" else return "invalid" end end end end
Version data entries
11 entries across 11 versions & 1 rubygems