Class: Applyrics::Project

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(platform = nil, path = "") ⇒ Project

Returns a new instance of Project.



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/applyrics/project.rb', line 31

def initialize(platform=nil, path="")

  if platform.nil?
    platform = self.class.detected_platform
  end

  @platform = platform

  if @platform == :ios
    @project = Applyrics::Project_iOS.new(path)
  end

end

Class Method Details

.detected_platformObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/applyrics/project.rb', line 18

def detected_platform
  if is_ios?
    :ios
  elsif is_android?
    :android
  elsif is_unity?
    :unity
  else
    nil
  end
end

.is_android?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/applyrics/project.rb', line 10

def is_android?
  Dir["*.gradle"].count > 0
end

.is_ios?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/applyrics/project.rb', line 6

def is_ios?
  (Dir["*.xcodeproj"] + Dir["*.xcworkspace"]).count > 0
end

.is_unity?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/applyrics/project.rb', line 14

def is_unity?
  false
end

Instance Method Details

#detected_languagesArray

Returns An array of languages detected in the project.

Returns:

  • (Array)

    An array of languages detected in the project.



46
47
48
# File 'lib/applyrics/project.rb', line 46

def detected_languages
  @project.detected_languages()
end

#platform_project_settings(name) ⇒ String?

Returns the value of the setting or nil if not found.

Parameters:

  • the (String)

    name of the setting to read.

Returns:

  • (String, nil)

    the value of the setting or nil if not found.



52
53
54
# File 'lib/applyrics/project.rb', line 52

def platform_project_settings(name)
  @project.platform_project_settings(name)
end

#rebuild_filesObject

Rebuild the language files.



57
58
59
# File 'lib/applyrics/project.rb', line 57

def rebuild_files
  @project.rebuild_files()
end