Class: Flor::Tools::Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/flor/tools/shell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv = nil) ⇒ Shell

Returns a new instance of Shell.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/flor/tools/shell.rb', line 15

def initialize(argv=nil)

  env = ENV['FLOR_ENV'] || 'shell'

  @root = File.directory?(env) ? env : "envs/#{env}"

  prepare_home

  over_conf = {}
    #
  c = ENV['FLOR_STO_URI']; over_conf['sto_uri'] = c if c

  @unit = Flor::Unit.new("#{@root}/etc/conf.json", over_conf)

  @unit.conf['unit'] = 'cli'
  #unit.hooker.add('journal', Flor::Journal)

  prepare_db
  prepare_hooks

  @hook = 'on'
  @mute = false
  @paging = true

  if ENV['FLOR_NO_START']
    @unit.check_migration_version
  else
    @unit.start
  end

  @flow_path = File.join(@root, 'home/scratch.flo')
  @ra_flow_path = File.join(@root, 'home/ra_scratch.flo')
  @payload_path = File.join(@root, 'home/payload.json')
  @variables_path = File.join(@root, 'home/variables.json')

  @c = Flor.colours({})

  load_floshrc

  if argv && argv.any?
    do_eval(argv.join(' '))
  else
    print_header
    do_loop
  end
end

Instance Attribute Details

#cObject (readonly)

Returns the value of attribute c.



62
63
64
# File 'lib/flor/tools/shell.rb', line 62

def c
  @c
end