Class: Luna::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/luna/binary/util/util.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUtil

Returns a new instance of Util.



12
13
14
# File 'lib/luna/binary/util/util.rb', line 12

def initialize
  super.initialize
end

Class Method Details

.versionUp(version) ⇒ Object



16
17
18
19
# File 'lib/luna/binary/util/util.rb', line 16

def self.versionUp(version)
  newVersion = "#{version.major}.#{version.minor}.#{version.patch + 1}"
  return Pod::Version.new(newVersion)
end

.writeVersionUp(path, version) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/luna/binary/util/util.rb', line 21

def self.writeVersionUp(path, version)
  newVersion = versionUp(version)
  buffer = ""
  File.open(path, 'r:utf-8') do  |f|
    f.each_line do |item|
      if item[".version"]
        buffer += item.gsub(/(\.version *= *')(.*')/, "\\1" + newVersion.to_s + "'")
      else
        buffer += item
      end
    end
  end

  File.open(path, 'w+') do |f|
    f.write(buffer)
  end
  return newVersion
end