Class: MyCLI

Inherits:
Thor
  • Object
show all
Includes:
FactoryBot::Syntax::Methods
Defined in:
MyCLI.rb

Instance Method Summary collapse

Instance Method Details

#helloObject



10
11
12
# File 'MyCLI.rb', line 10

def hello
  puts "hellooooooo"
end

#load(file) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'MyCLI.rb', line 20

def load(file)
  JSONModel::init(:client_mode => true,
                  :url => options[:backend_url], :allow_other_unmapped => true,
                  :priority => :high)
  eval(File.open(File.expand_path(options[:definitions])).read)

  auth = JSONModel::HTTP.post_form('/users/admin/login', { password: 'admin' })
  JSONModel::HTTP.current_backend_session = JSON.parse(auth.body)['session']


  eval(File.open(File.expand_path(file)).read)
end