Class: U3d::LinuxInstallation

Inherits:
Installation show all
Defined in:
lib/u3d/installation.rb

Constant Summary

Constants inherited from Installation

Installation::NOT_PLAYBACKENGINE_PACKAGES, Installation::PACKAGE_ALIASES

Instance Attribute Summary

Attributes inherited from Installation

#root_path

Instance Method Summary collapse

Methods inherited from Installation

create, #do_not_move!, #do_not_move?, #initialize, #package_installed?

Constructor Details

This class inherits a constructor from U3d::Installation

Instance Method Details

#build_numberObject



250
251
252
# File 'lib/u3d/installation.rb', line 250

def build_number
  @build_number ||= LinuxInstallationHelper.new.find_build_number(root_path)
end

#clean_install?Boolean

Returns:

  • (Boolean)


293
294
295
# File 'lib/u3d/installation.rb', line 293

def clean_install?
  do_not_move? || !(root_path =~ UNITY_DIR_CHECK_LINUX).nil?
end

#default_log_fileObject



254
255
256
# File 'lib/u3d/installation.rb', line 254

def default_log_file
  "#{ENV['HOME']}/.config/unity3d/Editor.log"
end

#exe_pathObject



258
259
260
# File 'lib/u3d/installation.rb', line 258

def exe_path
  "#{root_path}/Editor/Unity"
end

#module_name_pattern(module_name) ⇒ Object



279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/u3d/installation.rb', line 279

def module_name_pattern(module_name)
  # FIXME: we are not yet sure where these modules will end up yet
  case module_name
  when 'Documentation'
    return "#{root_path}/Editor/Data/Documentation/"
  when 'StandardAssets'
    return "#{root_path}/Editor/Standard Assets/"
  when 'MonoDevelop'
    return "#{root_path}/MonoDevelop/"
  else
    UI.crash! "No pattern is known for #{module_name} on Linux"
  end
end

#packagesObject



267
268
269
270
271
272
273
274
275
276
277
# File 'lib/u3d/installation.rb', line 267

def packages
  path = "#{root_path}/Editor/Data/"
  pack = []
  PlaybackEngineUtils.list_module_configs(path).each do |mpath|
    pack << PlaybackEngineUtils.module_name(mpath)
  end
  NOT_PLAYBACKENGINE_PACKAGES.each do |module_name|
    pack << module_name unless Dir[module_name_pattern(module_name)].empty?
  end
  pack
end

#pathObject



262
263
264
265
# File 'lib/u3d/installation.rb', line 262

def path
  UI.deprecated("path is deprecated. Use root_path instead")
  @root_path || @path
end

#versionObject



238
239
240
241
242
243
244
245
246
247
248
# File 'lib/u3d/installation.rb', line 238

def version
  # I don't find an easy way to extract the version on Linux
  path = "#{root_path}/Editor/Data/"
  package = PlaybackEngineUtils.list_module_configs(path).first
  raise "Couldn't find a module under #{path}" unless package
  version = PlaybackEngineUtils.unity_version(package)
  if (m = version.match(/^(.*)x(.*)Linux$/))
    version = "#{m[1]}#{m[2]}"
  end
  version
end