Class: Xanthus::Repository

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

Direct Known Subclasses

Dataverse, GitHub

Instance Method Summary collapse

Constructor Details

#initializeRepository

Returns a new instance of Repository.



4
5
# File 'lib/xanthus/repository.rb', line 4

def initialize
end

Instance Method Details

#prepare_readme_file(config) ⇒ Object



22
23
24
25
26
# File 'lib/xanthus/repository.rb', line 22

def prepare_readme_file config
  File.open('README.md', 'w+') do |f|
    f.write(config.to_readme_md)
  end
end

#prepare_xanthus_fileObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/xanthus/repository.rb', line 7

def prepare_xanthus_file
  script = ''
  File.readlines('../../.xanthus').each do |line|
    script += line unless line.include?('github.token') || line.include?('dataverse.token')

    # remove github token
    script += "\t\t# github.token = 'REMOVED'\n" unless !line.include? 'github.token'
    # remove dataverse token
    script += "\t\t# dataverse.token = 'REMOVED'\n" unless !line.include? 'dataverse.token'
  end
  File.open('.xanthus', 'w+') do |f|
    f.write(script)
  end
end