Class: GM::Recorder

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cocoapods-byte-csjm/gm.rb

Overview

记录方

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#global_noteObject

Returns the value of attribute global_note.



243
244
245
# File 'lib/cocoapods-byte-csjm/gm.rb', line 243

def global_note
  @global_note
end

#is_load_pluginObject (readonly)

Returns the value of attribute is_load_plugin.



245
246
247
# File 'lib/cocoapods-byte-csjm/gm.rb', line 245

def is_load_plugin
  @is_load_plugin
end

#lockfile_dataObject (readonly)

Returns the value of attribute lockfile_data.



247
248
249
# File 'lib/cocoapods-byte-csjm/gm.rb', line 247

def lockfile_data
  @lockfile_data
end

#plugin_versionObject (readonly)

Returns the value of attribute plugin_version.



246
247
248
# File 'lib/cocoapods-byte-csjm/gm.rb', line 246

def plugin_version
  @plugin_version
end

#target_infoObject

Returns the value of attribute target_info.



244
245
246
# File 'lib/cocoapods-byte-csjm/gm.rb', line 244

def target_info
  @target_info
end

Instance Method Details

#add_global_note(note) ⇒ Object



253
254
255
# File 'lib/cocoapods-byte-csjm/gm.rb', line 253

def add_global_note(note)
  @global_note = note
end

#find_global_note(option, is_force_update = false) ⇒ Object



257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/cocoapods-byte-csjm/gm.rb', line 257

def find_global_note(option, is_force_update = false)

  return @global_note if !is_force_update && @global_note != nil
  @global_note = GlobalNote.new(false, GM::BuildConfig.update_value_non, false)
  load_key        = GM::BuildConfig.get_load_key
  update_key      = GM::BuildConfig.get_update_key
  load_detect_key = GM::BuildConfig.get_load_detect_key
  auto_load_whitelist_key = GM::BuildConfig.get_load_whitelist_key
  case option
  when true, false
    @global_note =  GM::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] : {}
    @global_note =  GM::GlobalNote.new(load_value, update_value,detect_value,auto_load_whitelist)
  else
    raise ArgumentError, "CSJM error: `#{option.inspect}`, should be a boolean or hash."
  end
  @global_note
end

#get_global_noteObject



280
281
282
# File 'lib/cocoapods-byte-csjm/gm.rb', line 280

def get_global_note
  @global_note
end

#get_target(label) ⇒ Object



284
285
286
287
# File 'lib/cocoapods-byte-csjm/gm.rb', line 284

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

#set_plugin_load(is_load) ⇒ Object



248
249
250
251
# File 'lib/cocoapods-byte-csjm/gm.rb', line 248

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

#to_hashObject



289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/cocoapods-byte-csjm/gm.rb', line 289

def to_hash
  hash = {}
  hash["IS_LOAD_PLUGIN"] = @is_load_plugin
  hash["PLUGIN_VERSION"] = @plugin_version
  hash["GLOBAL_NOTE"] = @global_note.to_hash
  hash["TARGET_INFO"] = {}
  @target_info.each {|item, value|
    hash["TARGET_INFO"][item] = value.to_hash
  }
  checksum = Digest::SHA1.hexdigest(hash.inspect)
  checksum = checksum.encode('UTF-8') if checksum.respond_to?(:encode)
  hash["RECODER_CHECKSUM"] = checksum
  hash
end