Class: Xcode::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/xcoder/rake_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :xcode) {|_self| ... } ⇒ RakeTask

By default this will generate rake tasks within the ‘xcode’ namespace for all the projects (within the current working directory), all their targets, and all their configs. This will also generate tasks for all of a projects schemes as well.

The task accepts a single parameter. This parameter allows you to change the root namespace that the tasks are generated within.

Additionally a block can be specified to provide additional configuration:

Often you do not want to generate rake tasks for all the projects. So you can specify the names of the projects you do want to have appear.

Examples:


rake xcode:hackbook:hackbook:debug:build   
rake xcode:hackbook:hackbook:debug:clean         
rake xcode:hackbook:hackbook:debug:package       
rake xcode:hackbook:hackbook:debug:test          
rake xcode:hackbook:hackbook:release:build       
rake xcode:hackbook:hackbook:release:clean       
rake xcode:hackbook:hackbook:release:package     
rake xcode:hackbook:hackbook:release:test        

Xcode::RakeTask.new :apple

rake apple:hackbook:hackbook:debug:build
# ...

specifying a directory parameter to search within a different folder


Xcode::RakeTask.new :apple do |xcoder|
  xcoder.directory = "~/dayjobprojects"
end

rake apple:dayjobproject1:moneytarget:debug:build
# ...

specifying projects to filter on by the name of a project


Xcode::RakeTask.new :apple do |xcoder|
  xcoder.directory = "~/dayjobprojects"
  xcoder.projects = "Dayjobproject2"
end

rake apple:dayjobproject2:socialtarget:debug:build
# ...

Yields:

  • (_self)

Yield Parameters:



107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/xcoder/rake_task.rb', line 107

def initialize(name = :xcode)
  
  @name = name
  
  yield self if block_given?
  
  define_all_projects_list_task
  define_project_list_tasks
  define_per_project_scheme_builder_tasks
  define_per_project_config_builder_tasks

end

Instance Attribute Details

#nameObject

The name of the prefixed namespace. By default this will by ‘xcode’



11
12
13
# File 'lib/xcoder/rake_task.rb', line 11

def name
  @name
end

Instance Method Details

#builder_actionsArray

TODO:

this should likely be generated from the Xcode::Builder object/class itself

Returns available actions of a Builder.

Returns:

  • (Array)

    available actions of a Builder



51
52
53
# File 'lib/xcoder/rake_task.rb', line 51

def builder_actions
  [ :build, :test, :clean, :package ]
end

#directoryObject

The default directory is the current working directory. This can be overriden to search for projects within a specified folder path.



42
43
44
# File 'lib/xcoder/rake_task.rb', line 42

def directory
  @directory ||= File.expand_path('.')
end

#directory=(value) ⇒ Object

Parameters:

  • value (String)

    file path to search for Xcode projects. Xcoder attempts to find all the projects recursively from this specified path.



34
35
36
# File 'lib/xcoder/rake_task.rb', line 34

def directory=(value)
  @directory = File.expand_path(value)
end

#projectsArray<Projects>

Returns all the projects found that match the filtering criteria at the specified directory or all projects at the specified directory.

Returns:

  • (Array<Projects>)

    all the projects found that match the filtering criteria at the specified directory or all projects at the specified directory.



26
27
28
# File 'lib/xcoder/rake_task.rb', line 26

def projects
  @projects ||= Xcode.find_projects(directory)
end

#projects=(project_names) ⇒ Object

Parameters:

  • project_names (String, Array<String>)

    names of the project and projects that are found in the specified directory.



17
18
19
# File 'lib/xcoder/rake_task.rb', line 17

def projects=(project_names)
  @projects = Xcode.find_projects(directory).find_all{|project| Array(project_names).include? project.name }
end