Class: Gct::Command::Init::Unit

Inherits:
Gct::Command::Init show all
Defined in:
lib/gct/command/init/unit.rb

Instance Method Summary collapse

Methods inherited from Gct::Command

#auto_add_tag, #check_branch_can_be_update, #config_gitlab, #current_branch, #file_contents, #get_project, #gitlab_error, options, run

Constructor Details

#initialize(argv) ⇒ Unit

Returns a new instance of Unit.



15
16
17
18
19
# File 'lib/gct/command/init/unit.rb', line 15

def initialize(argv)
  @name = argv.shift_argument
  super
  @additional_args = argv.remainder!
end

Instance Method Details

#runObject



29
30
31
# File 'lib/gct/command/init/unit.rb', line 29

def run
  puts "new unit".green
end

#validate!Object



21
22
23
24
25
26
27
# File 'lib/gct/command/init/unit.rb', line 21

def validate!
  super
  help! 'A name for the Pod is required.' unless @name
  help! 'The Pod name cannot contain spaces.' if @name =~ /\s/
  help! 'The Pod name cannot contain plusses.' if @name =~ /\+/
  help! "The Pod name cannot begin with a '.'" if @name[0, 1] == '.'
end