Class: Luna::Binary::Install

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(is_open) ⇒ Install

Returns a new instance of Install.



13
14
15
16
# File 'lib/luna/binary/install.rb', line 13

def initialize(is_open)
    @is_open = is_open
    run
end

Instance Attribute Details

#is_openObject (readonly)

Returns the value of attribute is_open.



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

def is_open
  @is_open
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/luna/binary/install.rb', line 18

def run
    buffer = ""
    podfile_path = Dir.pwd + "/Podfile"
    IO.foreach(podfile_path) { |line|
        if line.match(/@use_luna_frameworks =/)  || line.match(/@use_luna_frameworks=/)
            buffer += "@use_luna_frameworks = #{is_open}\n"
        else
            buffer += line
        end
    }   
    File.open(podfile_path, "w") { |source_file|
        source_file.write buffer
    }

    Common.instance.command("rm -rf #{Dir.pwd}/Pods")
    Common.instance.command("pod install")

end