Module: EPM

Extended by:
EPM
Included in:
EPM
Defined in:
lib/epm/rpc.rb,
lib/epm.rb,
lib/epm/query.rb,
lib/epm/utils.rb,
lib/epm/create.rb,
lib/epm/deploy.rb,
lib/epm/compile.rb,
lib/epm/transact.rb

Overview

General RPC command handler

Defined Under Namespace

Modules: FileHelpers, HexData, RPC, Server, Settings Classes: Compile, Create, Deploy, Query, Transact

Instance Method Summary collapse

Instance Method Details

#compile(args) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/epm.rb', line 17

def compile args
  output = []
  until args.empty?
    file = args.shift
    settings = setup
    output << EPM::Compile.new(file, settings).compile
  end
  output
end

#create(args) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/epm.rb', line 27

def create args
  output = []
  until args.empty?
    file = args.shift
    settings = setup
    output << EPM::Create.new(file, settings).deploy
  end
  output
end

#deploy(args) ⇒ Object



37
38
39
40
41
# File 'lib/epm.rb', line 37

def deploy args
  file     = args.shift
  settings = setup
  output   = EPM::Deploy.new(file, settings).deploy_package
end

#query(args) ⇒ Object



50
51
52
53
54
55
# File 'lib/epm.rb', line 50

def query args
  address = args.shift
  position = args.shift
  settings = setup
  EPM::Query.new(address, position, settings).query
end

#restart(opts) ⇒ Object



82
83
84
85
# File 'lib/epm.rb', line 82

def restart opts
  EPM::Server.stop
  EPM::Server.start opts.d
end

#rpc(args, opts) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/epm.rb', line 57

def rpc args, opts
  name = args.shift
  arg_list = EPM::RPC.rpc_arg_list name
  opt_vals = {
    'a' => opts.a, 'x' => opts.x,'s' => opts.s, 'aDest' => opts.aDest,
    'bData' => opts.bData, 'sec' => opts.sec, 'xGas' => opts.xGas,
    'xGasPrice' => opts.xGasPrice, 'xValue' => opts.xValue,
    'bCode' => opts.bCode,'xEndowment' => opts.xEndowment
  }
  params = EPM::RPC.rpc_from_args name, arg_list, args, opt_vals
  return EPM::RPC.post_rpc_with_params name, params
end

#setupObject



87
88
89
# File 'lib/epm.rb', line 87

def setup
  return EPM::Settings.check
end

#start(opts) ⇒ Object



74
75
76
# File 'lib/epm.rb', line 74

def start opts
  EPM::Server.start opts.d
end

#stopObject



78
79
80
# File 'lib/epm.rb', line 78

def stop
  EPM::Server.stop
end

#transact(args) ⇒ Object



43
44
45
46
47
48
# File 'lib/epm.rb', line 43

def transact args
  recipient = args.shift
  data = args
  settings = setup
  EPM::Transact.new(recipient, data, settings).transact
end

#versionObject



70
71
72
# File 'lib/epm.rb', line 70

def version
  return VERSION
end