Class: Yesman::Yesman

Inherits:
Object
  • Object
show all
Defined in:
lib/yesman.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Yesman

Returns a new instance of Yesman.



10
11
12
13
14
15
# File 'lib/yesman.rb', line 10

def initialize options = {}
  create_defaults options
  @cp = ConfigProxy.new
  @log = Logger.new
  init
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



8
9
10
# File 'lib/yesman.rb', line 8

def params
  @params
end

Instance Method Details

#create_allObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/yesman.rb', line 34

def create_all
  @cp.create_config params
  p = CppCreator.new params
  p.create_project
  @log.log_message "Initial project files created"
  @log.line_break
  g = GTestInstaller.new params
  g.download_and_install
  @log.line_break
  @log.log_emphasis "Setup complete!", "You are clear for take off."
end

#create_defaults(hash) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/yesman.rb', line 17

def create_defaults hash
  @params = {}
  @params[:project_name] = hash.fetch(:project_name){"Project"}
  @params[:extension] = hash.fetch(:extension){"cpp"}
  @params[:source] = hash.fetch(:source){"src"}
  @params[:tests] = hash.fetch(:tests){"tests"}
  @params[:output] = hash.fetch(:output){"bin"}
end

#initObject



26
27
28
29
30
31
32
# File 'lib/yesman.rb', line 26

def init
  @log.line_break
  @log.log_heading "Creating initial directories and files"
  FileUtil.ensure_path params[:project_name]
  Dir.chdir( params[:project_name] )
  create_all
end