Skip to content

Commit

Permalink
[Docs] Fixed yard warnings and removed old docs tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed Nov 27, 2012
1 parent c74490c commit 460d2b6
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 27 deletions.
44 changes: 22 additions & 22 deletions Rakefile
Expand Up @@ -55,28 +55,28 @@ namespace :ext do
task :cleanbuild => [:clean, :build]
end

begin
require 'rubygems'
require 'yard'
require 'yard/rake/yardoc_task'
require File.expand_path('../yard_extensions', __FILE__)

namespace :doc do
YARD::Rake::YardocTask.new(:generate) do |t|
t.options = %w{ --default-return=void --hide-void-return --no-private --markup=markdown }
lib_files = FileList['lib/**/*.rb'].exclude(/inflector\.rb/)
t.files = lib_files + ['ext/xcodeproj/xcodeproj_ext.c', '-', 'README.md', 'LICENSE']
end

desc "Starts a server which re-generates the docs on reload."
task :server do
sh "bundle exec yard server --reload --markup=markdown"
end
end

rescue LoadError
puts "[!] Install the required dependencies to generate documentation: $ bundle install"
end
# begin
# require 'rubygems'
# require 'yard'
# require 'yard/rake/yardoc_task'
# require File.expand_path('../yard_extensions', __FILE__)
#
# namespace :doc do
# YARD::Rake::YardocTask.new(:generate) do |t|
# t.options = %w{ --default-return=void --hide-void-return --no-private --markup=markdown }
# lib_files = FileList['lib/**/*.rb'].exclude(/inflector\.rb/)
# t.files = lib_files + ['ext/xcodeproj/xcodeproj_ext.c', '-', 'README.md', 'LICENSE']
# end
#
# desc "Starts a server which re-generates the docs on reload."
# task :server do
# sh "bundle exec yard server --reload --markup=markdown"
# end
# end
#
# rescue LoadError
# puts "[!] Install the required dependencies to generate documentation: $ bundle install"
# end

namespace :gem do
def gem_version
Expand Down
16 changes: 15 additions & 1 deletion lib/xcodeproj/project/object.rb
Expand Up @@ -116,6 +116,8 @@ def display_name
# @return [Array<ObjectList>] The list of the objects that have a
# reference to this object.
#
# @visibility private
#
attr_reader :referrers

# Informs the object that another object is referencing it. If the
Expand All @@ -124,6 +126,8 @@ def display_name
#
# @return [void]
#
# @visibility private
#
def add_referrer(referrer)
@referrers << referrer
@project.objects_by_uuid[uuid] = self
Expand All @@ -135,6 +139,8 @@ def add_referrer(referrer)
#
# @return [void]
#
# @visibility private
#
def remove_referrer(referrer)
@referrers.delete(referrer)
if @referrers.count == 0
Expand All @@ -146,6 +152,8 @@ def remove_referrer(referrer)
#
# @return [void]
#
# @visibility private
#
def remove_reference(object)
to_one_attributes.each do |attrb|
value = attrb.get_value(self)
Expand Down Expand Up @@ -173,6 +181,8 @@ def remove_reference(object)
#
# @return [void]
#
# @visibility private
#
def configure_with_plist(objects_by_uuid_plist)
object_plist = objects_by_uuid_plist[uuid].dup

Expand Down Expand Up @@ -241,6 +251,8 @@ def configure_with_plist(objects_by_uuid_plist)
#
# @return [AbstractObject] the initialized object.
#
# @visibility private
#
def object_with_uuid(uuid, objects_by_uuid_plist, attribute)
unless object = project.objects_by_uuid[uuid] || project.new_from_plist(uuid, objects_by_uuid_plist)
raise "`#{inspect}` attempted to initialize an object with an unknown UUID: "\
Expand Down Expand Up @@ -295,8 +307,10 @@ def to_plist
#
# @todo current implementation might cause infinite loops.
#
# @visibility private
#
# @return [Hash] a hash reppresentation of the project different from the
# plist one.
# plist one.
#
def to_tree_hash
hash = {}
Expand Down
2 changes: 1 addition & 1 deletion lib/xcodeproj/project/object/build_phase.rb
Expand Up @@ -179,7 +179,7 @@ def remove_file_reference(file)
# Removes a build file from the phase and clears its relationship to
# the file reference.
#
# @param [PBXBuildFile] file the file to remove
# @param [PBXBuildFile] build_file the file to remove
#
# @return [void]
#
Expand Down
22 changes: 21 additions & 1 deletion lib/xcodeproj/project/object_attributes.rb
Expand Up @@ -175,6 +175,8 @@ class << self
# an attribute of the superclass but for the method implementation
# they will duplicate them.
#
# @visibility private
#
def attributes
unless @full_attributes
attributes = @attributes || []
Expand All @@ -189,6 +191,8 @@ def attributes
# @return [Array<AbstractObjectAttribute>] the simple attributes
# associated with with the class.
#
# @visibility private
#
def simple_attributes
@simple_attributes ||= attributes.select { |a| a.type == :simple }
end
Expand All @@ -197,6 +201,8 @@ def simple_attributes
# representing a to one relationship associated with with the
# class.
#
# @visibility private
#
def to_one_attributes
@to_one_attributes ||= attributes.select { |a| a.type == :to_one }
end
Expand All @@ -205,10 +211,14 @@ def to_one_attributes
# representing a to many relationship associated with with the
# class.
#
# @visibility private
#
def to_many_attributes
@to_many_attributes ||= attributes.select { |a| a.type == :to_many }
end

# @visibility private
#
def references_by_keys_attributes
@references_by_keys_attributes ||= attributes.select { |a| a.type == :references_by_keys }
end
Expand Down Expand Up @@ -352,7 +362,7 @@ def has_many(plural_name, isas)
# @param [String] plural_name
# the name of the relationship.
#
# @param [Class, Array<Class>] isas
# @param [Class, Array<Class>] isas_hash
# the list of the classes corresponding to the accepted isas for
# this relationship.
#
Expand Down Expand Up @@ -400,30 +410,40 @@ def add_attribute(attribute)

# @return (see AbstractObject.attributes)
#
# @visibility private
#
def attributes
self.class.attributes
end

# @return (see AbstractObject.simple_attributes)
#
# @visibility private
#
def simple_attributes
self.class.simple_attributes
end

# @return (see AbstractObject.to_one_attributes)
#
# @visibility private
#
def to_one_attributes
self.class.to_one_attributes
end

# @return (see AbstractObject.to_many_attributes)
#
# @visibility private
#
def to_many_attributes
self.class.to_many_attributes
end

# @return (see AbstractObject.to_many_attributes)
#
# @visibility private
#
def references_by_keys_attributes
self.class.references_by_keys_attributes
end
Expand Down
2 changes: 1 addition & 1 deletion lib/xcodeproj/project/object_list.rb
Expand Up @@ -60,7 +60,7 @@ def objects

# Adds an array of objects to list and updates their references count.
#
# @param [Array<AbstractObject, ObjectDictionary>] object
# @param [Array<AbstractObject, ObjectDictionary>] objects
# an array of objects to add to the list.
#
# @return [void]
Expand Down
2 changes: 1 addition & 1 deletion rakelib/doc.rake
Expand Up @@ -29,7 +29,7 @@ namespace :doc do
end

task :generate => :load do
generator = Pod::Doc::Gem.new(ROOT + 'xcodeproj.gemspec')
generator = Pod::Doc::Gem.new(ROOT + 'xcodeproj.gemspec', 'Xcodeproj')
generator.render
sh "open '#{generator.output_file}'"
end
Expand Down

0 comments on commit 460d2b6

Please sign in to comment.