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.



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

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.



232
233
234
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 232

def is_release_target
  @is_release_target
end

#labelObject (readonly)

Returns the value of attribute label.



234
235
236
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 234

def label
  @label
end

#nots_infoObject

Returns the value of attribute nots_info.



236
237
238
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 236

def nots_info
  @nots_info
end

#PM_infoObject

Returns the value of attribute PM_info.



235
236
237
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 235

def PM_info
  @PM_info
end

#referenced_targetObject

Returns the value of attribute referenced_target.



233
234
235
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 233

def referenced_target
  @referenced_target
end

Class Method Details

.from_hash(hash) ⇒ Object



281
282
283
284
285
286
287
288
289
290
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 281

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



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

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)


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

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)


265
266
267
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 265

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)


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

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)


255
256
257
258
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 255

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

#to_hashObject



269
270
271
272
273
274
275
276
277
278
279
# File 'lib/cocoapods-byte-panglem-beta/recorder.rb', line 269

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