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

#apply_languages(data) ⇒ Object



75
76
77
# File 'lib/applyrics/project.rb', line 75

def apply_languages(data)
  @project.apply_languages(data)
end

#default_languageString

Returns The language which are the default language in the project.

Returns:

  • (String)

    The language which are the default language in the project



55
56
57
# File 'lib/applyrics/project.rb', line 55

def default_language
  @project.default_language
end

#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

#language_filesObject



50
51
52
# File 'lib/applyrics/project.rb', line 50

def language_files
  @project.language_files()
end

#platformObject



79
80
81
# File 'lib/applyrics/project.rb', line 79

def platform
  @platform
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.



61
62
63
# File 'lib/applyrics/project.rb', line 61

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

#rebuild_filesObject

Rebuild the language files.



71
72
73
# File 'lib/applyrics/project.rb', line 71

def rebuild_files
  @project.rebuild_files()
end

#string_filesObject?

Returns the strings files found in the project.

Returns:

  • (Object, nil)

    the strings files found in the project



66
67
68
# File 'lib/applyrics/project.rb', line 66

def string_files
  @project.string_files()
end