Class: Kata::Setup::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/kata/setup/base.rb

Direct Known Subclasses

Node, Php, Ruby

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kata_name = 'kata') ⇒ Base

Returns a new instance of Base.



12
13
14
15
# File 'lib/kata/setup/base.rb', line 12

def initialize(kata_name = 'kata')
  self.kata_name = kata_name
  self.repo_name = kata_name
end

Instance Attribute Details

#kata_nameObject

Returns the value of attribute kata_name.



9
10
11
# File 'lib/kata/setup/base.rb', line 9

def kata_name
  @kata_name
end

#repo_nameObject

Returns the value of attribute repo_name.



10
11
12
# File 'lib/kata/setup/base.rb', line 10

def repo_name
  @repo_name
end

Instance Method Details

#build_tree(type = 'ruby') ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/kata/setup/base.rb', line 27

def build_tree(type = 'ruby')
  case type
  when 'ruby'
    Kata::Setup::Ruby.new(kata_name).build_tree
  when 'node'
    Kata::Setup::Node.new(kata_name).build_tree
  when 'php'
    Kata::Setup::Php.new(kata_name).build_tree
  else
    raise(ArgumentError, "Invalid language type #{type}")
  end
end

#create_repo(options) ⇒ Object



17
18
19
20
21
# File 'lib/kata/setup/base.rb', line 17

def create_repo options
  create_remote_repo if options.repo

  push_local_repo(options.repo)
end