Class: D13n::Cli::Scaffold

Inherits:
Command
  • Object
show all
Defined in:
lib/d13n/cli/commands/scaffold.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

inherited, run

Constructor Details

#initialize(args) ⇒ Scaffold

Returns a new instance of Scaffold.



10
11
12
13
14
15
# File 'lib/d13n/cli/commands/scaffold.rb', line 10

def initialize(args)
  @bare = false
  @application = nil
  @ruby_version = '2.3.3'
  super(args)
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



8
9
10
# File 'lib/d13n/cli/commands/scaffold.rb', line 8

def application
  @application
end

#application_base=(value) ⇒ Object

Sets the attribute application_base

Parameters:

  • value

    the value to set the attribute application_base to.



8
9
10
# File 'lib/d13n/cli/commands/scaffold.rb', line 8

def application_base=(value)
  @application_base = value
end

#projectObject

Returns the value of attribute project.



8
9
10
# File 'lib/d13n/cli/commands/scaffold.rb', line 8

def project
  @project
end

#ruby_versionObject

Returns the value of attribute ruby_version.



8
9
10
# File 'lib/d13n/cli/commands/scaffold.rb', line 8

def ruby_version
  @ruby_version
end

Class Method Details

.commandObject



6
# File 'lib/d13n/cli/commands/scaffold.rb', line 6

def self.command; "scaffold"; end

Instance Method Details

#check_optionsObject



22
23
24
25
26
27
28
29
30
# File 'lib/d13n/cli/commands/scaffold.rb', line 22

def check_options
  if @application.nil?
    puts 'application name required'
    exit 1
  elsif @project.nil?
    puts 'project name required'
    exit 1
  end
end

#generate_scaffoldObject



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
61
62
63
64
65
66
67
# File 'lib/d13n/cli/commands/scaffold.rb', line 32

def generate_scaffold
  @template_home = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', '..', '..', 'templates')

  unless @bare
    puts "Setting up application [#{application_base}] directories..."
    Dir.mkdir(@application) unless File.directory?(@application)
    Dir.chdir(@application)
  end

  @current_home = Dir.pwd

  unless @bare
    application_scaffold
  end

  rake_scaffold

  migration_scaffold

  gem_scaffold

  makefile_scaffold

  application_yml_scaffold

  docker_scaffold

  docker_script_scaffold

  jekinsfile_scaffold

  ruby_version_scaffold

  spec_scaffold
    
end

#runObject



17
18
19
20
# File 'lib/d13n/cli/commands/scaffold.rb', line 17

def run
  check_options
  generate_scaffold
end