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.



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

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

Instance Attribute Details

#adapter_listObject

Returns the value of attribute adapter_list.



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

def adapter_list
  @adapter_list
end

#global_noteObject

Returns the value of attribute global_note.



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

def global_note
  @global_note
end

#is_debugObject (readonly)

Returns the value of attribute is_debug.



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

def is_debug
  @is_debug
end

#is_load_pluginObject (readonly)

Returns the value of attribute is_load_plugin.



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

def is_load_plugin
  @is_load_plugin
end

#lockfile_dataObject (readonly)

Returns the value of attribute lockfile_data.



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

def lockfile_data
  @lockfile_data
end

#plugin_versionObject (readonly)

Returns the value of attribute plugin_version.



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

def plugin_version
  @plugin_version
end

#rely_original_versionObject

Returns the value of attribute rely_original_version.



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

def rely_original_version
  @rely_original_version
end

#rely_target_versionObject

Returns the value of attribute rely_target_version.



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

def rely_target_version
  @rely_target_version
end

#sdk_original_versionObject

Returns the value of attribute sdk_original_version.



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

def sdk_original_version
  @sdk_original_version
end

#sdk_target_versionObject

Returns the value of attribute sdk_target_version.



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

def sdk_target_version
  @sdk_target_version
end

#target_infoObject

Returns the value of attribute target_info.



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

def target_info
  @target_info
end

Instance Method Details

#add_global_note(note) ⇒ Object



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

def add_global_note(note)
  @global_note = note
end

#find_global_note(option, is_force_update = false) ⇒ Object



329
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
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 329

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



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

def get_global_note
  @global_note
end

#get_target(label) ⇒ Object



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

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

#is_releaseObject



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

def is_release()
  @global_note.is_release
end

#set_is_debug(is_debug) ⇒ Object



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

def set_is_debug(is_debug)
  @is_debug = is_debug
end

#set_plugin_load(is_load) ⇒ Object



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

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

#to_hashObject



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

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



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

def use_service_local()
  @global_note.use_service_local
end