Class: KStarter::Questions::BaseGem

Inherits:
BaseQuestion show all
Defined in:
lib/k_starter/questions/gem.rb

Overview

Ask code generations for a new GEM.

Direct Known Subclasses

CliGem, LibraryGem

Instance Attribute Summary collapse

Attributes inherited from BaseQuestion

#actor, #description, #github_key, #klue_template_active, #klue_template_name, #name, #problem, #root_path, #solution, #story_active, #sub_path, #type, #user_story, #variant

Instance Method Summary collapse

Methods inherited from BaseQuestion

#ask_actor, #ask_description, #ask_github_key, #ask_klue_template_active?, #ask_klue_template_name, #ask_problem, #ask_root_path, #ask_solution, #ask_story_active?, #ask_sub_path, #ask_user_story, #default_klue_template_active, #default_questions, #default_story_active, #infer_klue_template_name, #klue_template_questions, #show_story, #story_questions

Methods included from TtyHelpers

#command, #config, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which

Constructor Details

#initialize(**args) ⇒ BaseGem

Returns a new instance of BaseGem.



12
13
14
15
# File 'lib/k_starter/questions/gem.rb', line 12

def initialize(**args)
  args = { type: :gem }.merge(args)
  super(**args)
end

Instance Attribute Details

#cocObject (readonly)

has code of conduct



8
9
10
# File 'lib/k_starter/questions/gem.rb', line 8

def coc
  @coc
end

#exeObject (readonly)

has executable folder



7
8
9
# File 'lib/k_starter/questions/gem.rb', line 7

def exe
  @exe
end

#mitObject (readonly)

has MIT license



9
10
11
# File 'lib/k_starter/questions/gem.rb', line 9

def mit
  @mit
end

#rspecObject (readonly)

has rspec tests



10
11
12
# File 'lib/k_starter/questions/gem.rb', line 10

def rspec
  @rspec
end

Instance Method Details

#ask_questionsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/k_starter/questions/gem.rb', line 17

def ask_questions
  ask_name
  ask_root_path
  ask_github_key
  ask_description
  story_questions
  klue_template_questions

  ask_exe
  ask_coc
  ask_mit
  ask_rspec
end

#to_domObject



42
43
44
# File 'lib/k_starter/questions/gem.rb', line 42

def to_dom
  KStarter::Schema::GemProject.new(to_h)
end

#to_hObject



31
32
33
34
35
36
37
38
39
40
# File 'lib/k_starter/questions/gem.rb', line 31

def to_h
  super.merge(
    {
      exe: exe,
      coc: coc,
      mit: mit,
      rspec: rspec
    }
  )
end