Class: PM::Recorder

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cocoapods-byte-panglem-beta/recorder.rb

Overview

记录方

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRecorder

Returns a new instance of Recorder.



324
325
326
327
328
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 324

def initialize()
  @adapter_list = []
  @is_debug = false
  @is_auto_update = false
end

Instance Attribute Details

#adapter_listObject

Returns the value of attribute adapter_list.



315
316
317
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 315

def adapter_list
  @adapter_list
end

#global_noteObject

Returns the value of attribute global_note.



309
310
311
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 309

def global_note
  @global_note
end

#is_auto_updateObject (readonly)

Returns the value of attribute is_auto_update.



320
321
322
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 320

def is_auto_update
  @is_auto_update
end

#is_debugObject (readonly)

Returns the value of attribute is_debug.



319
320
321
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 319

def is_debug
  @is_debug
end

#is_load_pluginObject (readonly)

Returns the value of attribute is_load_plugin.



316
317
318
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 316

def is_load_plugin
  @is_load_plugin
end

#lockfile_dataObject (readonly)

Returns the value of attribute lockfile_data.



318
319
320
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 318

def lockfile_data
  @lockfile_data
end

#plugin_versionObject (readonly)

Returns the value of attribute plugin_version.



317
318
319
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 317

def plugin_version
  @plugin_version
end

#rely_original_versionObject

Returns the value of attribute rely_original_version.



312
313
314
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 312

def rely_original_version
  @rely_original_version
end

#rely_target_versionObject

Returns the value of attribute rely_target_version.



314
315
316
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 314

def rely_target_version
  @rely_target_version
end

#sdk_original_versionObject

Returns the value of attribute sdk_original_version.



311
312
313
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 311

def sdk_original_version
  @sdk_original_version
end

#sdk_target_versionObject

Returns the value of attribute sdk_target_version.



313
314
315
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 313

def sdk_target_version
  @sdk_target_version
end

#target_infoObject

Returns the value of attribute target_info.



310
311
312
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 310

def target_info
  @target_info
end

Instance Method Details

#add_global_note(note) ⇒ Object



343
344
345
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 343

def add_global_note(note)
  @global_note = note
end

#find_global_note(option, is_force_update = false) ⇒ Object



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 347

def find_global_note(option, is_force_update = false)

  return @global_note if !is_force_update && @global_note != nil
  @global_note = GlobalNote.new(false, PM::BuildConfig.update_value_non, false)
  load_key        = PM::BuildConfig.get_load_key
  update_key      = PM::BuildConfig.get_update_key
  load_detect_key = PM::BuildConfig.get_load_detect_key
  auto_load_whitelist_key = PM::BuildConfig.get_load_whitelist_key
  is_release_key = PM::BuildConfig.get_is_release_key
  use_service_local_key = PM::BuildConfig.get_use_service_local_key

  case option
  when true, false
    @global_note =  PM::GlobalNote.new(option,option,option,{})
  when Hash
    load_value = option.has_key?(load_key) ? option[load_key] : true
    update_value = option.has_key?(update_key) ? option[update_key] : true
    detect_value = option.has_key?(load_detect_key) ? option[load_detect_key] : true
    auto_load_whitelist = option.has_key?(auto_load_whitelist_key)?option[auto_load_whitelist_key] : {}
    is_release =   option.has_key?(is_release_key)?option[is_release_key] : false
    @global_note =  PM::GlobalNote.new(load_value, update_value,detect_value,auto_load_whitelist, is_release)
    @global_note.use_service_local = option.has_key?(use_service_local_key)?option[use_service_local_key] : false
  else
    raise ArgumentError, "[cocoapods-byte-panglem][error] `#{option.inspect}`, should be a boolean or hash."
  end
  @global_note
end

#get_global_noteObject



375
376
377
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 375

def get_global_note
  @global_note
end

#get_target(label) ⇒ Object



379
380
381
382
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 379

def get_target(label)
  @target_info ||= {}
  @target_info[label] ||= Target.new(label)
end

#is_releaseObject



384
385
386
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 384

def is_release()
  @global_note.is_release
end

#set_is_auto_update(is_auto_update) ⇒ Object



339
340
341
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 339

def set_is_auto_update(is_auto_update)
  @is_auto_update = is_auto_update
end

#set_is_debug(is_debug) ⇒ Object



335
336
337
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 335

def set_is_debug(is_debug)
  @is_debug = is_debug
end

#set_plugin_load(is_load) ⇒ Object



330
331
332
333
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 330

def set_plugin_load(is_load)
  @is_load_plugin = is_load
  @plugin_version = CocoapodsBytePanglem::Version.version
end

#to_hashObject



392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 392

def to_hash
  hash = {}
  hash["IS_LOAD_PLUGIN"] = @is_load_plugin
  hash["PLUGIN_VERSION"] = @plugin_version
  hash["SDK_ORIGINAL_VERSION"] = @sdk_original_version
  hash["RELY_ORIGINAL_VERSION"] = @rely_original_version
  hash["SDK_TARGET_VERSION"] = @sdk_target_version
  hash["RELY_TARGET_VERSION"] = @rely_target_version
  hash["ADAPTER_LIST"] = @adapter_list
  checksum = Digest::SHA1.hexdigest(hash.inspect)
  checksum = checksum.encode('UTF-8') if checksum.respond_to?(:encode)
  hash["RECODER_CHECKSUM"] = checksum
  hash
end

#use_service_localObject



388
389
390
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 388

def use_service_local()
  @global_note.use_service_local
end