Class: LearnRepair

Inherits:
LearnBase show all
Defined in:
lib/learn-tool/learn-repair.rb

Constant Summary

Constants inherited from LearnBase

LearnBase::GITHUB_ORG, LearnBase::JAVASCRIPT_LAB_TEMPLATE, LearnBase::REACT_LAB_TEMPLATE, LearnBase::README_TEMPLATE, LearnBase::RUBY_LAB_TEMPLATE

Instance Method Summary collapse

Methods inherited from LearnBase

#cd_into_and, #create_new_repo, #end_message, #get_new_name, #name_new_repo, #repo_is_available

Constructor Details

#initialize(filepath) ⇒ LearnRepair

Returns a new instance of LearnRepair.



3
4
5
6
7
8
# File 'lib/learn-tool/learn-repair.rb', line 3

def initialize(filepath)
  super(filepath)
  cd_into_and(filepath, create_learn_file)
  cd_into_and(filepath, create_support_file("LICENSE.md"))
  cd_into_and(filepath, create_support_file("CONTRIBUTING.md"))
end

Instance Method Details

#create_learn_fileObject



10
11
12
# File 'lib/learn-tool/learn-repair.rb', line 10

def create_learn_file
  'echo "languages:" > .learn && echo "  - none" >> .learn'
end

#create_support_file(name_of_file) ⇒ Object



14
15
16
17
18
19
# File 'lib/learn-tool/learn-repair.rb', line 14

def create_support_file(name_of_file)
  # copies a template folder from the learn_create gem to a subfolder of the current directory
  gem_template_location = File.dirname(__FILE__)
  template_path = File.expand_path(gem_template_location) + "/support_files/#{name_of_file}"
  "cp #{template_path} #{@filepath}"
end