Class: Rigit::Commands::Build::BuildHandler

Inherits:
Object
  • Object
show all
Includes:
Colsole
Defined in:
lib/rigit/commands/build.rb

Overview

Internal class to handle scaffolding for the Rigit::CommandLine class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ BuildHandler

Returns a new instance of BuildHandler.



17
18
19
20
21
22
# File 'lib/rigit/commands/build.rb', line 17

def initialize(args)
  @args = args
  @rig_name = args['RIG']
  @force = args['--force'] || (config.has_key?(:force) && config.force)
  @target_dir = '.'
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



12
13
14
# File 'lib/rigit/commands/build.rb', line 12

def args
  @args
end

#forceObject (readonly)

Returns the value of attribute force.



12
13
14
# File 'lib/rigit/commands/build.rb', line 12

def force
  @force
end

#overwrite_allObject

Returns the value of attribute overwrite_all.



13
14
15
# File 'lib/rigit/commands/build.rb', line 13

def overwrite_all
  @overwrite_all
end

#rig_nameObject (readonly)

Returns the value of attribute rig_name.



12
13
14
# File 'lib/rigit/commands/build.rb', line 12

def rig_name
  @rig_name
end

#skip_allObject

Returns the value of attribute skip_all.



13
14
15
# File 'lib/rigit/commands/build.rb', line 13

def skip_all
  @skip_all
end

#target_dirObject (readonly)

Returns the value of attribute target_dir.



12
13
14
# File 'lib/rigit/commands/build.rb', line 12

def target_dir
  @target_dir
end

Instance Method Details

#executeObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/rigit/commands/build.rb', line 24

def execute
  say "Building g`#{rig_name}`"
  say config.intro if config.has_key? :intro
  verify_dirs
  arguments = prompt.get_input params

  scaffold arguments

  say config.has_key?(:outro) ? config.outro : 'Done'
end