idx
int64
0
24.9k
question
stringlengths
68
4.14k
target
stringlengths
9
749
8,300
def globally_paused? paused = false current_path = '/api/v1/variables?name=wip_pause_global' begin res = @conn . get ( current_path ) paused = res [ 'wip_pause_global' ] rescue SFRest :: SFError => error paused = false if error . message =~ / / end paused end
Gets the value of a vairable
8,301
def pause_task ( task_id , level = 'family' ) current_path = '/api/v1/pause/' << task_id . to_s payload = { 'paused' => true , 'level' => level } . to_json @conn . post ( current_path , payload ) end
Pauses a specific task identified by its task id . This can pause either the task and it s children or just the task
8,302
def resume_task ( task_id , level = 'family' ) current_path = '/api/v1/pause/' << task_id . to_s payload = { 'paused' => false , 'level' => level } . to_json @conn . post ( current_path , payload ) end
Resumes a specific task identified by its task id . This can resume either the task and it s children or just the task
8,303
def wait_until_state ( task_id , state , max_nap ) blink_time = 5 nap_start = Time . now state_method = method ( "task_#{state}?" . to_sym ) loop do break if state_method . call ( task_id ) raise TaskNotDoneError , "Task: #{task_id} has taken too long to complete!" if Time . new > ( nap_start + max_nap ) sleep blink_ti...
Blocks until a task reaches a specific status
8,304
def collection_list page = 1 not_done = true count = 0 while not_done current_path = '/api/v1/collections?page=' << page . to_s res = @conn . get ( current_path ) if res [ 'collections' ] == [ ] not_done = false elsif ! res [ 'message' ] . nil? return { 'message' => res [ 'message' ] } elsif page == 1 count = res [ 'co...
Gets the complete list of collections Makes multiple requests to the factory to get all the collections on the factory
8,305
def create ( name , sites , groups , internal_domain_prefix = nil ) sites = Array ( sites ) groups = Array ( groups ) current_path = '/api/v1/collections' payload = { 'name' => name , 'site_ids' => sites , 'group_ids' => groups , 'internal_domain_prefix' => internal_domain_prefix } . to_json @conn . post ( current_path...
create a site collection
8,306
def set_primary_site ( id , site ) payload = { 'site_id' => site } . to_json current_path = "/api/v1/collections/#{id}/set-primary" @conn . post ( current_path , payload ) end
sets a site to be a primary site in a site collection
8,307
def modify_status ( site_creation , site_duplication , domain_management , bulk_operations ) current_path = '/api/v1/status' payload = { 'site_creation' => site_creation , 'site_duplication' => site_duplication , 'domain_management' => domain_management , 'bulk_operations' => bulk_operations } . to_json @conn . put ( c...
Modifies the status information .
8,308
def start_update ( ref ) if update_version == 'v2' raise InvalidApiVersion , 'There is more than one codebase use sfrest.update.update directly.' end update_data = { scope : 'sites' , sites_type : 'code, db' , sites_ref : ref } update ( update_data ) end
Starts an update .
8,309
def group_list page = 1 not_done = true count = 0 while not_done current_path = '/api/v1/groups?page=' << page . to_s res = @conn . get ( current_path ) if res [ 'groups' ] == [ ] not_done = false elsif ! res [ 'message' ] . nil? return { 'message' => res [ 'message' ] } elsif page == 1 count = res [ 'count' ] groups =...
Gets a list of all site groups .
8,310
def get_user_id ( username ) pglimit = 100 res = @conn . get ( '/api/v1/users&limit=' + pglimit . to_s ) usercount = res [ 'count' ] . to_i id = user_data_from_results ( res , username , 'uid' ) return id if id pages = ( usercount / pglimit ) + 1 2 . upto ( pages ) do | i | res = @conn . get ( '/api/v1/users&limit=' + ...
gets the site ID for the site named sitename will page through all the sites available searching for the site
8,311
def user_data_from_results ( res , username , key ) users = res [ 'users' ] users . each do | user | return user [ key ] if user [ 'name' ] == username end nil end
Extract the user data for key based on the user result object
8,312
def create_user ( name , email , datum = nil ) current_path = '/api/v1/users' payload = { name : name , mail : email } payload . merge! ( datum ) unless datum . nil? @conn . post ( current_path , payload . to_json ) end
Creates a user .
8,313
def staging_versions possible_versions = [ 1 , 2 ] @versions ||= [ ] possible_versions . each do | version | begin @conn . get "/api/v#{version}/stage" @versions . push version rescue SFRest :: InvalidResponse nil end end @versions end
determine what version are available for staging
8,314
def put ( uri , payload ) headers = { 'Content-Type' => 'application/json' } res = Excon . put ( @base_url + uri . to_s , headers : headers , user : username , password : password , ssl_verify_peer : false , body : payload ) api_response res end
http request via put
8,315
def delete ( uri ) headers = { 'Content-Type' => 'application/json' } res = Excon . delete ( @base_url + uri . to_s , headers : headers , user : username , password : password , ssl_verify_peer : false ) api_response res end
http request via delete
8,316
def api_response ( res , return_status = false ) data = access_check JSON ( res . body ) , res . status return_status ? [ res . status , data ] : data rescue JSON :: ParserError message = "Invalid data, status #{res.status}, body: #{res.body}" raise SFRest :: InvalidResponse , message end
Confirm that the result looks adequate
8,317
def build_url_query ( current_path , datum = nil ) unless datum . nil? current_path += '?' current_path += URI . encode_www_form datum end current_path end
build a get query
8,318
def set_variable ( name , value ) current_path = '/api/v1/variables' payload = { 'name' => name , 'value' => value } . to_json @conn . put ( current_path , payload ) end
Sets the key and value of a variable .
8,319
def site_list ( show_incomplete = true ) page = 1 not_done = true count = 0 sites = [ ] while not_done current_path = '/api/v1/sites?page=' << page . to_s current_path <<= '&show_incomplete=true' if show_incomplete res = @conn . get ( current_path ) if res [ 'sites' ] == [ ] not_done = false elsif ! res [ 'message' ] ....
Gets the complete list of sites Makes multiple requests to the factory to get all the sites on the factory
8,320
def create_site ( sitename , group_id , install_profile = nil , codebase = nil ) current_path = '/api/v1/sites' payload = { 'site_name' => sitename , 'group_ids' => [ group_id ] , 'install_profile' => install_profile , 'codebase' => codebase } . to_json @conn . post ( current_path , payload ) end
Creates a site .
8,321
def get_role_id ( rolename ) pglimit = 100 res = @conn . get ( '/api/v1/roles&limit=' + pglimit . to_s ) rolecount = res [ 'count' ] . to_i id = role_data_from_results ( res , rolename ) return id if id pages = ( rolecount / pglimit ) + 1 2 . upto ( pages ) do | i | res = @conn . get ( '/api/v1/roles&limit=' + pglimit ...
gets the role ID for the role named rolename will page through all the roles available searching for the site
8,322
def role_data_from_results ( res , rolename ) roles = res [ 'roles' ] roles . each do | role | return role [ 0 ] . to_i if role [ 1 ] == rolename end nil end
Extract the role data for rolename based on the role result object
8,323
def duplicate enhance_settings p = self . dup p . category = 'COPY OF ' + category p . created_at = p . updated_at = nil p . url = url p . attachment = attachment p . send ( :duplicate_extra , self ) if p . respond_to? ( :duplicate_extra ) p . save! p end
for adding banner_boxes which are closely related to existing ones define duplicate_extra for site - specific actions eg for additional fields
8,324
def handle_missing_or_unknown_args if first_arg_not_a_flag_or_file? exit_with_unknown_command elsif has_output_flag? || has_format_flag? check_for_output_file if has_output_flag? check_for_format_type if has_format_flag? elsif only_has_flag_arguments? add_test_command else exit_with_cannot_understand end end
Arg manipulation methods
8,325
def between ( criterion = nil ) selection ( criterion ) do | selector , field , value | selector . store ( field , { "$gte" => value . min , "$lte" => value . max } ) end end
Add the range selection .
8,326
def not ( * criterion ) if criterion . empty? tap { | query | query . negating = true } else __override__ ( criterion . first , "$not" ) end end
Negate the next selection .
8,327
def text_search ( terms , opts = nil ) clone . tap do | query | if terms criterion = { :$text => { :$search => terms } } criterion [ :$text ] . merge! ( opts ) if opts query . selector = criterion end end end
Construct a text search selector .
8,328
def typed_override ( criterion , operator ) if criterion criterion . update_values do | value | yield ( value ) end end __override__ ( criterion , operator ) end
Force the values of the criterion to be evolved .
8,329
def selection ( criterion = nil ) clone . tap do | query | if criterion criterion . each_pair do | field , value | yield ( query . selector , field . is_a? ( Key ) ? field : field . to_s , value ) end end query . reset_strategies! end end
Take the provided criterion and store it as a selection in the query selector .
8,330
def initialize_copy ( other ) @options = other . options . __deep_copy__ @selector = other . selector . __deep_copy__ @pipeline = other . pipeline . __deep_copy__ end
Is this queryable equal to another object? Is true if the selector and options are equal .
8,331
def evolve ( entry ) aggregate = Selector . new ( aliases ) entry . each_pair do | field , value | aggregate . merge! ( field . to_s => value ) end aggregate end
Evolve the entry using the aliases .
8,332
def select_with ( receiver ) ( Selectable . forwardables + Optional . forwardables ) . each do | name | __forward__ ( name , receiver ) end end
Tells origin with method on the class to delegate to when calling an original selectable or optional method on the class .
8,333
def aggregation ( operation ) return self unless operation clone . tap do | query | unless aggregating? query . pipeline . concat ( query . selector . to_pipeline ) query . pipeline . concat ( query . options . to_pipeline ) query . aggregating = true end yield ( query . pipeline ) end end
Add the aggregation operation .
8,334
def storage_pair ( key ) field = key . to_s name = aliases [ field ] || field [ name , serializers [ name ] ] end
Get the pair of objects needed to store the value in a hash by the provided key . This is the database field name and the serializer .
8,335
def with_strategy ( strategy , criterion , operator ) selection ( criterion ) do | selector , field , value | selector . store ( field , selector [ field ] . send ( strategy , prepare ( field , operator , value ) ) ) end end
Add criterion to the selection with the named strategy .
8,336
def prepare ( field , operator , value ) unless operator =~ / / value = value . __expand_complex__ serializer = serializers [ field ] value = serializer ? serializer . evolve ( value ) : value end selection = { operator => value } negating? ? { "$not" => selection } : selection end
Prepare the value for merging .
8,337
def merge! ( other ) other . each_pair do | key , value | if value . is_a? ( Hash ) && self [ key . to_s ] . is_a? ( Hash ) value = self [ key . to_s ] . merge ( value ) do | _key , old_val , new_val | if in? ( _key ) new_val & old_val elsif nin? ( _key ) ( old_val + new_val ) . uniq else new_val end end end if multi_s...
Merges another selector into this one .
8,338
def store ( key , value ) name , serializer = storage_pair ( key ) if multi_selection? ( name ) super ( name , evolve_multi ( value ) ) else super ( normalized_key ( name , serializer ) , evolve ( serializer , value ) ) end end
Store the value in the selector for the provided key . The selector will handle all necessary serialization and localization in this step .
8,339
def evolve ( serializer , value ) case value when Hash evolve_hash ( serializer , value ) when Array evolve_array ( serializer , value ) else ( serializer || value . class ) . evolve ( value ) end end
Evolve a single key selection with various types of values .
8,340
def to_pipeline pipeline = [ ] pipeline . push ( { "$skip" => skip } ) if skip pipeline . push ( { "$limit" => limit } ) if limit pipeline . push ( { "$sort" => sort } ) if sort pipeline end
Convert the options to aggregation pipeline friendly options .
8,341
def key ( name , strategy , operator , additional = nil , & block ) :: Symbol . add_key ( name , strategy , operator , additional , & block ) end
Adds a method on Symbol for convenience in where queries for the provided operators .
8,342
def order_by ( * spec ) option ( spec ) do | options , query | spec . compact . each do | criterion | criterion . __sort_option__ . each_pair do | field , direction | add_sort_option ( options , field , direction ) end query . pipeline . push ( "$sort" => options [ :sort ] ) if aggregating? end end end
Adds sorting criterion to the options .
8,343
def skip ( value = nil ) option ( value ) do | options , query | val = value . to_i options . store ( :skip , val ) query . pipeline . push ( "$skip" => val ) if aggregating? end end
Add the number of documents to skip .
8,344
def slice ( criterion = nil ) option ( criterion ) do | options | options . __union__ ( fields : criterion . inject ( { } ) do | option , ( field , val ) | option . tap { | opt | opt . store ( field , { "$slice" => val } ) } end ) end end
Limit the returned results via slicing embedded arrays .
8,345
def without ( * args ) args = args . flatten option ( * args ) do | options | options . store ( :fields , args . inject ( options [ :fields ] || { } ) { | sub , field | sub . tap { sub [ field ] = 0 } } ) end end
Limits the results to only contain the fields not provided .
8,346
def add_sort_option ( options , field , direction ) if driver == :mongo1x sorting = ( options [ :sort ] || [ ] ) . dup sorting . push ( [ field , direction ] ) options . store ( :sort , sorting ) else sorting = ( options [ :sort ] || { } ) . dup sorting [ field ] = direction options . store ( :sort , sorting ) end end
Add a single sort option .
8,347
def option ( * args ) clone . tap do | query | unless args . compact . empty? yield ( query . options , query ) end end end
Take the provided criterion and store it as an option in the query options .
8,348
def sort_with_list ( * fields , direction ) option ( fields ) do | options , query | fields . flatten . compact . each do | field | add_sort_option ( options , field , direction ) end query . pipeline . push ( "$sort" => options [ :sort ] ) if aggregating? end end
Add multiple sort options at once .
8,349
def parse_url ( url , options ) url . gsub! ( / \s / , '' ) url . gsub! ( / \? / , '' ) if options . strip_query? url . gsub! ( / \# / , '' ) if options . strip_anchor? Addressable :: URI . parse ( url ) end
Parses and sanitizes a URL .
8,350
def add ( url , code = nil , options = nil ) sha = url_key url url_obj = @url_bucket . get_or_new sha , :r => 1 if url_obj . raw_data fix_url_object ( url_obj ) code = url_obj . data end code = get_code ( url , code , options ) code_obj = @code_bucket . get_or_new code code_obj . content_type = url_obj . content_type =...
Initializes the adapter .
8,351
def url_object ( code ) @code_bucket . get ( code , :r => 1 ) rescue Riak :: FailedRequest => err raise unless err . not_found? end
Retrieves a URL riak value from the code .
8,352
def code_object ( url ) sha = url_key url if o = @url_bucket . get ( sha , :r => 1 ) fix_url_object ( o ) end rescue Riak :: FailedRequest => err raise unless err . not_found? end
Retrieves the code riak value for a given URL .
8,353
def create_config ( name ) name = ConfigurationList . symbol_config_name_to_config_name [ name ] if ConfigurationList . symbol_config_name_to_config_name [ name ] new_config = @registry . add_object ( Configuration . default_properties ( name ) ) @properties [ 'buildConfigurations' ] << new_config . identifier yield ne...
Create a configuration for this ConfigurationList . This configuration needs to have a name .
8,354
def define_property name , value @properties [ name ] = value self . class . send :define_method , name . underscore do raw_value = @properties [ name ] if raw_value . is_a? ( Array ) Array ( raw_value ) . map do | sub_value | if Registry . is_identifier? sub_value Resource . new sub_value , @registry else sub_value en...
Definiing a property allows the creation of an alias to the actual value . This level of indirection allows for the replacement of values which are identifiers with a resource representation of it .
8,355
def file ( name_with_path ) path , name = File . split ( name_with_path ) group ( path ) . file ( name ) . first end
Return the file that matches the specified path . This will traverse the project s groups and find the file at the end of the path .
8,356
def products_group current_group = groups . group ( 'Products' ) . first current_group . instance_eval ( & block ) if block_given? and current_group current_group end
Most Xcode projects have a products group where products are placed . This will generate an exception if there is no products group .
8,357
def frameworks_group current_group = groups . group ( 'Frameworks' ) . first current_group . instance_eval ( & block ) if block_given? and current_group current_group end
Most Xcode projects have a Frameworks gorup where all the imported frameworks are shown . This will generate an exception if there is no Frameworks group .
8,358
def save ( path ) Dir . mkdir ( path ) unless File . exists? ( path ) project_filepath = "#{path}/project.pbxproj" Xcode :: PLUTILProjectParser . save "#{path}/project.pbxproj" , to_xcplist end
Saves the current project at the specified path .
8,359
def scheme ( name ) scheme = schemes . select { | t | t . name == name . to_s } . first raise "No such scheme #{name}, available schemes are #{schemes.map {|t| t.name}.join(', ')}" if scheme . nil? yield scheme if block_given? scheme end
Return the scheme with the specified name . Raises an error if no schemes match the specified name .
8,360
def target ( name ) target = targets . select { | t | t . name == name . to_s } . first raise "No such target #{name}, available targets are #{targets.map {|t| t.name}.join(', ')}" if target . nil? yield target if block_given? target end
Return the target with the specified name . Raises an error if no targets match the specified name .
8,361
def create_target ( name , type = :native ) target = @registry . add_object Target . send ( type ) @project . properties [ 'targets' ] << target . identifier target . name = name build_configuration_list = @registry . add_object ( ConfigurationList . configuration_list ) target . build_configuration_list = build_config...
Creates a new target within the Xcode project . This will by default not generate all the additional build phases configurations and files that create a project .
8,362
def remove_target ( name ) found_target = targets . find { | target | target . name == name } if found_target @project . properties [ 'targets' ] . delete found_target . identifier @registry . remove_object found_target . identifier end found_target end
Remove a target from the Xcode project .
8,363
def describe puts "Project #{name} contains" targets . each do | t | puts " + target:#{t.name}" t . configs . each do | c | puts " + config:#{c.name}" end end schemes . each do | s | puts " + scheme #{s.name}" puts " + targets: #{s.build_targets.map{|t| t.name}}" puts " + config: #{s.build_config}" end end
Prints to STDOUT a description of this project s targets configuration and schemes .
8,364
def parse_pbxproj registry = Xcode :: PLUTILProjectParser . parse "#{@path}/project.pbxproj" class << registry include Xcode :: Registry end registry end
Using the sytem tool plutil the specified project file is parsed and converted to JSON which is then converted to a hash object . This content contains all the data within the project file and is used to create the Registry .
8,365
def parse ( path ) registry = Plist . parse_xml open_project_file ( path ) raise "Failed to correctly parse the project file #{path}" unless registry registry end
Using the sytem tool plutil the specified project file is parsed and converted to XML and then converted into a ruby hash object .
8,366
def print_input message , level = :debug return if LEVELS . index ( level ) > LEVELS . index ( @@log_level ) puts format_lhs ( "" , "" , "<" ) + message , :default end
Print an IO input interaction
8,367
def print_output message , level = :debug return if LEVELS . index ( level ) > LEVELS . index ( @@log_level ) puts format_lhs ( "" , "" , ">" ) + message , :default end
Print an IO output interaction
8,368
def create_build_phases * base_phase_names base_phase_names . compact . flatten . map do | phase_name | build_phase = create_build_phase phase_name do | build_phase | yield build_phase if block_given? end build_phase . save! end end
Create multiple build phases at the same time .
8,369
def create_product_reference ( name ) product = project . products_group . create_product_reference ( name ) product_reference = product . identifier product end
Create a product reference file and add it to the product . This is by default added to the Products group .
8,370
def in_search_path ( & block ) keychains = Keychains . search_path begin Keychains . search_path = [ self ] + keychains yield ensure Keychains . search_path = keychains end end
Installs this keychain in the head of teh search path and restores the original on completion of the block
8,371
def import ( cert , password ) cmd = Xcode :: Shell :: Command . new "security" cmd << "import '#{cert}'" cmd << "-k \"#{@path}\"" cmd << "-P #{password}" cmd << "-T /usr/bin/codesign" cmd . execute end
Import the . p12 certificate file into the keychain using the provided password
8,372
def identities names = [ ] cmd = Xcode :: Shell :: Command . new "security" cmd << "find-certificate" cmd << "-a" cmd << "\"#{@path}\"" cmd . show_output = false cmd . execute . join ( "" ) . scan / \s / do | m | names << m [ 0 ] end names end
Returns a list of identities in the keychain .
8,373
def lock cmd = Xcode :: Shell :: Command . new "security" cmd << "lock-keychain" cmd << "\"#{@path}\"" cmd . execute end
Secure the keychain
8,374
def unlock ( password ) cmd = Xcode :: Shell :: Command . new "security" cmd << "unlock-keychain" cmd << "-p #{password}" cmd << "\"#{@path}\"" cmd . execute end
Unlock the keychain using the provided password
8,375
def config ( name ) config = configs . select { | config | config . name == name . to_s } . first raise "No such config #{name}, available configs are #{configs.map {|c| c.name}.join(', ')}" if config . nil? yield config if block_given? config end
Return a specific build configuration .
8,376
def create_configuration ( name ) created_config = build_configuration_list . create_config ( name ) do | config | yield config if block_given? end created_config end
Create a configuration for the target or project .
8,377
def create_configurations ( * configuration_names ) configuration_names . compact . flatten . map do | config_name | created_config = create_configuration config_name do | config | yield config if block_given? end created_config . save! end end
Create multiple configurations for a target or project .
8,378
def file ( name ) files . find { | file | file . file_ref . name == name or file . file_ref . path == name } end
Return the BuildFile given the file name .
8,379
def build_file ( name ) build_files . find { | file | file . name == name or file . path == name } end
Find the first file that has the name or path that matches the specified parameter .
8,380
def add_build_file ( file , settings = { } ) find_file_by = file . path || file . name unless build_file ( find_file_by ) new_build_file = @registry . add_object BuildFile . buildfile ( file . identifier , settings ) @properties [ 'files' ] << new_build_file . identifier end end
Add the specified file to the Build Phase .
8,381
def add_object ( object_properties ) new_identifier = SimpleIdentifierGenerator . generate :existing_keys => objects . keys objects [ new_identifier ] = object_properties Resource . new new_identifier , self end
Provides a method to generically add objects to the registry . This will create a unqiue identifier and add the specified parameters to the registry . As all objecst within a the project maintain a reference to this registry they can immediately query for newly created items .
8,382
def project ( name ) project = @projects . select { | c | c . name == name . to_s } . first raise "No such project #{name} in #{self}, available projects are #{@projects.map {|c| c.name}.join(', ')}" if project . nil? yield project if block_given? project end
Return the names project . Raises an error if no projects match the specified name .
8,383
def create_dependency_on ( target ) @properties [ 'target' ] = target . identifier container_item_proxy = ContainerItemProxy . default target . project . project . identifier , target . identifier , target . name container_item_proxy = @registry . add_object ( container_item_proxy ) @properties [ 'targetProxy' ] = cont...
Establish the Target that this Target Dependency is dependent .
8,384
def info_plist info = Xcode :: InfoPlist . new ( self , info_plist_location ) yield info if block_given? info . save info end
Opens the info plist associated with the configuration and allows you to edit the configuration .
8,385
def get ( name ) if respond_to? ( name ) send ( name ) elsif Configuration . setting_name_to_property ( name ) send Configuration . setting_name_to_property ( name ) else build_settings [ name ] end end
Retrieve the configuration value for the given name
8,386
def set ( name , value ) if respond_to? ( name ) send ( "#{name}=" , value ) elsif Configuration . setting_name_to_property ( name ) send ( "#{Configuration.setting_name_to_property(name)}=" , value ) else build_settings [ name ] = value end end
Set the configuration value for the given name
8,387
def append ( name , value ) if respond_to? ( name ) send ( "append_to_#{name}" , value ) elsif Configuration . setting_name_to_property ( name ) send ( "append_to_#{Configuration.setting_name_to_property(name)}" , value ) else if build_settings [ name ] . is_a? ( Array ) value = value . is_a? ( Array ) ? value : [ valu...
Append a value to the the configuration value for the given name
8,388
def group ( name ) groups . find_all { | group | group . name == name or group . path == name } end
Find all the child groups that have a name that matches the specified name .
8,389
def file ( name ) files . find_all { | file | file . name == name or file . path == name } end
Find all the files that have have a name that matches the specified name .
8,390
def exists? ( name ) children . find_all do | child | child . name ? ( child . name == name ) : ( File . basename ( child . path ) == name ) end end
Check whether a file or group is contained within this group that has a name that matches the one specified
8,391
def create_group ( name ) new_group = create_child_object Group . logical_group ( name ) new_group . supergroup = self new_group end
Adds a group as a child to current group with the given name .
8,392
def create_file ( file_properties ) file_properties = { 'path' => file_properties } if file_properties . is_a? String find_file_by = file_properties [ 'name' ] || file_properties [ 'path' ] found_or_created_file = exists? ( find_file_by ) . first unless found_or_created_file found_or_created_file = create_child_object ...
Add a file to the specified group . Currently the file creation requires the path to the physical file .
8,393
def remove! ( & block ) groups . each { | group | group . remove! ( & block ) } files . each { | file | file . remove! ( & block ) } yield self if block_given? child_identifier = identifier supergroup . instance_eval { remove_child_object ( child_identifier ) } @registry . remove_object identifier end
Remove the resource from the registry .
8,394
def find_or_create_child_object ( child_properties ) found_child = children . find { | child | child . name == child_properties [ 'name' ] or child . path == child_properties [ 'path' ] } found_child = create_child_object ( child_properties ) unless found_child found_child end
This method is used internally to find the specified object or add the object as a child of this group .
8,395
def remove_child_object ( identifier ) found_child = children . find { | child | child . identifier == identifier } @properties [ 'children' ] . delete identifier save! found_child end
This method is used internally to remove a child object from this and the registry .
8,396
def define_per_project_scheme_builder_tasks projects . each do | project | project . schemes . each do | scheme | builder_actions . each do | action | description = "#{action.capitalize} #{project.name} #{scheme.name}" task_name = friendlyname ( "#{name}:#{project.name}:scheme:#{scheme.name}:#{action}" ) define_task_wi...
Generate all the Builder Tasks for all the matrix of all the Projects and Schemes
8,397
def define_per_project_config_builder_tasks projects . each do | project | project . targets . each do | target | target . configs . each do | config | builder_actions . each do | action | description = "#{action.capitalize} #{project.name} #{target.name} #{config.name}" task_name = friendlyname ( "#{name}:#{project.na...
Generate all the Builder Tasks for all the matrix of all the Projects Targets and Configs
8,398
def group ( name , options = { } , & block ) options = { :create => true } . merge ( options ) current_group = main_group name . split ( "/" ) . each do | path_component | found_group = current_group . group ( path_component ) . first if options [ :create ] and found_group . nil? found_group = current_group . create_gr...
Returns the group specified . If any part of the group does not exist along the path the group is created . Also paths can be specified to make the traversing of the groups easier .
8,399
def run! ( interactive : false ) start_links! run_options = [ '--detach' ] @env . each_pair do | key , value | run_options . push '--env' , [ key , value ] . join ( '=' ) end @links . each do | link | run_options . push '--link' , [ link . id , link . name ] . join ( ':' ) end run_options . push '--name' , @id run_opti...
!!!! Don t call run twice !!!!