Module: Yanapiri::TransformacionWollok

Defined in:
lib/yanapiri/transformacion_wollok.rb

Class Method Summary collapse

Class Method Details

.aplica?(entrega) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/yanapiri/transformacion_wollok.rb', line 3

def self.aplica?(entrega)
  entrega.contiene_archivo? proyecto_wollok
end

.proyecto_wollokObject



16
17
18
# File 'lib/yanapiri/transformacion_wollok.rb', line 16

def self.proyecto_wollok
  '.project'
end

.transformar!(entrega, bot) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/yanapiri/transformacion_wollok.rb', line 7

def self.transformar!(entrega, bot)
  entrega.repo.chdir do
    xml = File.read proyecto_wollok
    File.open(proyecto_wollok, "w") {|file| file.puts xml.sub(/<name>.*<\/name>/, "<name>#{entrega.id}</name>") }
  end

  bot.commit! entrega.repo, 'Renombrado proyecto Wollok'
end