Class: PM::Target

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

Overview

配置信息 (cocoapods target维度下)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label) ⇒ Target

Returns a new instance of Target.



245
246
247
248
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 245

def initialize(label)
  @label = label.clone
  @is_release_target = false
end

Instance Attribute Details

#is_release_targetObject

Returns the value of attribute is_release_target.



239
240
241
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 239

def is_release_target
  @is_release_target
end

#labelObject (readonly)

Returns the value of attribute label.



241
242
243
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 241

def label
  @label
end

#nots_infoObject

Returns the value of attribute nots_info.



243
244
245
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 243

def nots_info
  @nots_info
end

#PM_infoObject

Returns the value of attribute PM_info.



242
243
244
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 242

def PM_info
  @PM_info
end

#referenced_targetObject

Returns the value of attribute referenced_target.



240
241
242
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 240

def referenced_target
  @referenced_target
end

Class Method Details

.from_hash(hash) ⇒ Object



288
289
290
291
292
293
294
295
296
297
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 288

def self.from_hash(hash)
  target = Target.new(hash["LABEL"])
  target.is_release_target = true
  target.PM_info = PMInfo.from_hash hash["PM_INFO"] if hash.has_key?("PM_INFO")
  target.nots_info ||= {}
  hash["NOTS_INFO"].each do |name, note_info|
    target.nots_info[name] = AdnNote.from_hash note_info
  end
  target
end

Instance Method Details

#find_note(adn_name) ⇒ Object



250
251
252
253
254
255
256
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 250

def find_note(adn_name)
  @nots_info ||= {}
  global_note = PM::Recorder.instance.global_note
  note = (@nots_info.has_key?(adn_name) && @nots_info[adn_name]) || AdnNote.new(adn_name, global_note.auto_load, global_note.auto_update, global_note.load_detect)
  @nots_info[adn_name] = note unless @nots_info.has_key?(adn_name)
  note
end

#has_adn?(adn_name) ⇒ Boolean

Returns:

  • (Boolean)


258
259
260
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 258

def has_adn?(adn_name)
  PM::MapRelations.is_adn?(adn_name) && @nots_info.has_key?(adn_name)
end

#is_adn_detect?(adn_name) ⇒ Boolean

Returns:

  • (Boolean)


272
273
274
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 272

def is_adn_detect?(adn_name)
  has_adn?(adn_name) && @nots_info[adn_name].load_detect
end

#is_adn_update?(adn_name) ⇒ Boolean

Returns:

  • (Boolean)


267
268
269
270
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 267

def is_adn_update?(adn_name)
  result = has_adn?(adn_name) && @nots_info[adn_name].auto_update != PM::BuildConfig.update_value_non
  result
end

#is_adn_update_or_detect?(adn_name) ⇒ Boolean

Returns:

  • (Boolean)


262
263
264
265
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 262

def is_adn_update_or_detect?(adn_name)
  result =  is_adn_update?(adn_name) || is_adn_detect?(adn_name)
  result
end

#to_hashObject



276
277
278
279
280
281
282
283
284
285
286
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 276

def to_hash
  hash = {}
  hash["LABEL"] = @label
  hash["IS_RELEASE_TARGET"] = @is_release_target
  hash["PM_INFO"] = @pm_info.to_hash
  hash["NOTS_INFO"] = {}
  @nots_info.each {|key, value|
    hash["NOTS_INFO"][key] = value.to_hash
  }
  hash
end