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.



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

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

Instance Attribute Details

#adapter_listObject

Returns the value of attribute adapter_list.



305
306
307
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 305

def adapter_list
  @adapter_list
end

#global_noteObject

Returns the value of attribute global_note.



299
300
301
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 299

def global_note
  @global_note
end

#is_debugObject (readonly)

Returns the value of attribute is_debug.



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

def is_debug
  @is_debug
end

#is_load_pluginObject (readonly)

Returns the value of attribute is_load_plugin.



306
307
308
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 306

def is_load_plugin
  @is_load_plugin
end

#lockfile_dataObject (readonly)

Returns the value of attribute lockfile_data.



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

def lockfile_data
  @lockfile_data
end

#plugin_versionObject (readonly)

Returns the value of attribute plugin_version.



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

def plugin_version
  @plugin_version
end

#rely_original_versionObject

Returns the value of attribute rely_original_version.



302
303
304
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 302

def rely_original_version
  @rely_original_version
end

#rely_target_versionObject

Returns the value of attribute rely_target_version.



304
305
306
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 304

def rely_target_version
  @rely_target_version
end

#sdk_original_versionObject

Returns the value of attribute sdk_original_version.



301
302
303
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 301

def sdk_original_version
  @sdk_original_version
end

#sdk_target_versionObject

Returns the value of attribute sdk_target_version.



303
304
305
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 303

def sdk_target_version
  @sdk_target_version
end

#target_infoObject

Returns the value of attribute target_info.



300
301
302
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 300

def target_info
  @target_info
end

Instance Method Details

#add_global_note(note) ⇒ Object



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

def add_global_note(note)
  @global_note = note
end

#find_global_note(option, is_force_update = false) ⇒ Object



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 330

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



358
359
360
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 358

def get_global_note
  @global_note
end

#get_target(label) ⇒ Object



362
363
364
365
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 362

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

#is_releaseObject



367
368
369
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 367

def is_release()
  @global_note.is_release
end

#set_is_debug(is_debug) ⇒ Object



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

def set_is_debug(is_debug)
  @is_debug = is_debug
end

#set_plugin_load(is_load) ⇒ Object



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

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

#to_hashObject



375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 375

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



371
372
373
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 371

def use_service_local()
  @global_note.use_service_local
end