Module: Cleon::CLI

Extended by:
CLI
Included in:
CLI
Defined in:
lib/cleon/cli.rb

Constant Summary collapse

DIR_EXIST =
'Cannot clone Cleon into an existing folder'
CLEON_REQ =
'Cannot clone outside of Cleon\'s gem'
GEM_REQ =
'Cannot clone outside a gem'

Instance Method Summary collapse

Instance Method Details

#arguard(name) ⇒ Object

Helper for Cleon::Services::CloneGuard.()



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/cleon/cli.rb', line 24

def arguard(name)
  log = []
  guard_stderr do
    inside_home!
    puts "Create arguard '#{name}'..."
    log = CloneGuard.(name.downcase)
    print_log(log)
  end
  puts "ArGuard was created successfully"
  log
end


60
61
62
# File 'lib/cleon/cli.rb', line 60

def banner
  puts BANNER
end

#clone(name) ⇒ Object

Helper for CloneCleon.() (see Cleon::Services::CloneCleon.new)



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cleon/cli.rb', line 11

def clone(name)
  log = []
  guard_stderr do
    not_exist!(name.downcase)
    puts "Clone myself to '#{name}'..."
    log = CloneCleon.(name)
    print_log(log)
  end
  puts "Cleon was cloned successfully"
  log
end

#entity(model) ⇒ Object

Helper for CloneThing.() (see Cleon::Services::CloneThing.new)



37
38
39
40
41
42
43
44
45
46
# File 'lib/cleon/cli.rb', line 37

def entity(model)
  log = []
  guard_stderr do
    inside_home!
    puts "Create entity..."
    log = CloneEntity.(model)
    print_log(log)
  end
  log
end

#service(model) ⇒ Object

Helper for CloneThing.() (see Cleon::Services::CloneThing.new)



49
50
51
52
53
54
55
56
57
58
# File 'lib/cleon/cli.rb', line 49

def service(model)
  log = []
  guard_stderr do
    inside_home!
    puts "Create service..."
    log = CloneService.(model)
    print_log(log)
  end
  log
end