Class: Jarvis::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/jarvis/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/jarvis/cli.rb', line 6

def name
  @name
end

Instance Method Details

#generate(type, name) ⇒ Object



22
23
24
25
# File 'lib/jarvis/cli.rb', line 22

def generate(type, name)
  @name = Thor::Util.snake_case(name)
  generate_service(@name)
end

#new(name) ⇒ Object



9
10
11
12
# File 'lib/jarvis/cli.rb', line 9

def new(name)
  @name = Thor::Util.snake_case(name)
  directory(:project, @name)
end

#start(*args) ⇒ Object



15
16
17
18
19
# File 'lib/jarvis/cli.rb', line 15

def start(*args)
  port_option = args.include?('-p') ? '' : ' -p 3030'
  command = "rackup #{port_option}"
  run_command(command)
end