Class: LeanCloud::Installer

Inherits:
LeanObject show all
Includes:
ERB::Util
Defined in:
lib/leancloud/installer.rb

Overview

LeanCloud SDK installer

Constant Summary collapse

LEANFILE_PATH =
'Leanfile'
LEANCLOUD_SDK_ROOT =
'LeanCloud'
LEANCLOUD_SDK_GROUP =
'LeanCloud'
LEANCLOUD_SDK_PREFIX =
'AVOSCloud'

Instance Method Summary collapse

Methods inherited from LeanObject

#exit_with_error, #exit_with_info, #show_error, #show_message, #show_success

Constructor Details

#initializeInstaller

Returns a new instance of Installer.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/leancloud/installer.rb', line 24

def initialize
  @leanfile_path   = LEANFILE_PATH
  @root_path       = LEANCLOUD_SDK_ROOT
  @stash_name      = 'Stash'
  @stash_path      = File.join(@root_path, @stash_name)
  @sdk_path        = File.join(@stash_path, 'Frameworks.zip')
  @frameworks_path = File.join(@stash_path, 'Frameworks')
  @modules_path    = File.join(@stash_path, 'Modules')
  @lean_group      = LEANCLOUD_SDK_GROUP
  @sdk_prefix      = LEANCLOUD_SDK_PREFIX
  @sdk_url_prefix  = 'https://download.avoscloud.com/1/downloadSDK?'

  @system_frameworks = %w(
    CFNetwork
    SystemConfiguration
    MobileCoreServices
    CoreTelephony
    CoreLocation
    CoreGraphics
    QuartzCore
    Security
  )

  @system_libraries = %w(icucore)

  @lean_component_map = {
    'basic' => '基础模块',
    'SNS'   => '社交模块',
    'IM'    => '实时通信'
  }
end

Instance Method Details

#destroyObject



335
336
337
# File 'lib/leancloud/installer.rb', line 335

def destroy
  clean_stash
end

#install(file = nil) ⇒ Object



324
325
326
327
328
329
330
331
332
333
# File 'lib/leancloud/installer.rb', line 324

def install(file = nil)
  @leanfile_path = file if file

  read_leanfile
  make_validation
  create_directory_tree
  download_framework
  integrate_sdk
  finish
end