Class: SmartlingXcode::Project

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#projectPathObject

Returns the value of attribute projectPath.



7
8
9
# File 'lib/smartling_xcode.rb', line 7

def projectPath
  @projectPath
end

#sandboxObject

Returns the value of attribute sandbox.



7
8
9
# File 'lib/smartling_xcode.rb', line 7

def sandbox
  @sandbox
end

#versionObject

Returns the value of attribute version.



7
8
9
# File 'lib/smartling_xcode.rb', line 7

def version
  @version
end

Instance Method Details

#extractObject



14
15
16
17
18
19
# File 'lib/smartling_xcode.rb', line 14

def extract
    project = Xcodeproj::Project.find(@projectPath)
    files = project.extract
    puts "\nOutput:"
    puts files
end

#getversionObject



33
34
35
36
37
# File 'lib/smartling_xcode.rb', line 33

def getversion
    project = Xcodeproj::Project.find(@projectPath)
    @version = project.getVersion
    puts "Version #{@version} will be used."
end

#initObject



9
10
11
12
# File 'lib/smartling_xcode.rb', line 9

def init
    api = API.new({:sandbox => @sandbox})
    api.requestCredentials
end

#pushObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/smartling_xcode.rb', line 21

def push
    api = API.new({:sandbox => @sandbox})
    api.loadCredentials()
    project = Xcodeproj::Project.find(@projectPath)
    files = project.extract
    if @version.nil?
        @version = project.getVersion
    end
    api.pushStringsFromFiles(files, @version)
    puts "\nYour files are now available in the Files section of your Smartling project."
end