idx int64 0 24.9k | question stringlengths 68 4.14k | target stringlengths 9 749 |
|---|---|---|
5,300 | def get_config ( url_prefix ) request = Net :: HTTP :: Get . new ( "#{@jenkins_path}#{url_prefix}/config.xml" ) @logger . debug "GET #{url_prefix}/config.xml" response = make_http_request ( request ) handle_exception ( response , "body" ) end | Obtains the configuration of a component from the Jenkins CI server |
5,301 | def exec_cli ( command , args = [ ] ) base_dir = File . dirname ( __FILE__ ) server_url = "http://#{@server_ip}:#{@server_port}/#{@jenkins_path}" cmd = "java -jar #{base_dir}/../../java_deps/jenkins-cli.jar -s #{server_url}" cmd << " -i #{@identity_file}" if @identity_file && ! @identity_file . empty? cmd << " #{comman... | Execute the Jenkins CLI |
5,302 | def symbolize_keys ( hash ) hash . inject ( { } ) { | result , ( key , value ) | new_key = case key when String then key . to_sym else key end new_value = case value when Hash then symbolize_keys ( value ) else value end result [ new_key ] = new_value result } end | Private method . Converts keys passed in as strings into symbols . |
5,303 | def handle_exception ( response , to_send = "code" , send_json = false ) msg = "HTTP Code: #{response.code}, Response Body: #{response.body}" @logger . debug msg case response . code . to_i when 200 , 201 , 302 if to_send == "body" && send_json return JSON . parse ( response . body ) elsif to_send == "body" return resp... | Private method that handles the exception and raises with proper error message with the type of exception and returns the required values if no exceptions are raised . |
5,304 | def add_tab ( name , value ) return if name . nil? if value . is_a? Hash meta_data [ name ] ||= { } meta_data [ name ] . merge! value else meta_data [ "custom" ] = { } unless meta_data [ "custom" ] meta_data [ "custom" ] [ name . to_s ] = value end end | Initializes a new report from an exception . |
5,305 | def as_json payload_event = { app : { version : app_version , releaseStage : release_stage , type : app_type } , context : context , device : { hostname : hostname } , exceptions : exceptions , groupingHash : grouping_hash , session : session , severity : severity , severityReason : severity_reason , unhandled : @unhan... | Builds and returns the exception payload for this notification . |
5,306 | def summary if exceptions . respond_to? ( :first ) && exceptions . first { :error_class => exceptions . first [ :errorClass ] , :message => exceptions . first [ :message ] , :severity => severity } else { :error_class => "Unknown" , :severity => severity } end end | Generates a summary to be attached as a breadcrumb |
5,307 | def valid_meta_data_type? ( value ) value . nil? || value . is_a? ( String ) || value . is_a? ( Numeric ) || value . is_a? ( FalseClass ) || value . is_a? ( TrueClass ) end | Tests whether the meta_data types are non - complex objects . |
5,308 | def call ( env ) Bugsnag . configuration . set_request_data ( :rack_env , env ) if Bugsnag . configuration . auto_capture_sessions Bugsnag . start_session end begin response = @app . call ( env ) rescue Exception => raised Bugsnag . notify ( raised , true ) do | report | report . severity = "error" report . severity_re... | Wraps a call to the application with error capturing |
5,309 | def start_session return unless Bugsnag . configuration . enable_sessions start_delivery_thread start_time = Time . now ( ) . utc ( ) . strftime ( '%Y-%m-%dT%H:%M:00' ) new_session = { :id => SecureRandom . uuid , :startedAt => start_time , :events => { :handled => 0 , :unhandled => 0 } } SessionTracker . set_current_s... | Initializes the session tracker . |
5,310 | def send_sessions sessions = [ ] counts = @session_counts @session_counts = Concurrent :: Hash . new ( 0 ) counts . each do | min , count | sessions << { :startedAt => min , :sessionsStarted => count } end deliver ( sessions ) end | Delivers the current session_counts lists to the session endpoint . |
5,311 | def event_subscription ( event ) ActiveSupport :: Notifications . subscribe ( event [ :id ] ) do | * , event_id , data | filtered_data = data . slice ( * event [ :allowed_data ] ) filtered_data [ :event_name ] = event [ :id ] filtered_data [ :event_id ] = event_id if event [ :id ] == "sql.active_record" binds = data [ ... | Subscribes to an ActiveSupport event leaving a breadcrumb when it triggers |
5,312 | def save Bugsnag . notify ( exception , true ) do | report | report . severity = "error" report . severity_reason = { :type => Bugsnag :: Report :: UNHANDLED_EXCEPTION_MIDDLEWARE , :attributes => FRAMEWORK_ATTRIBUTES } context = "#{payload['class']}@#{queue}" report . meta_data . merge! ( { :context => context , :paylo... | Notifies Bugsnag of a raised exception . |
5,313 | def insert_after ( after , new_middleware ) @mutex . synchronize do return if @disabled_middleware . include? ( new_middleware ) return if @middlewares . include? ( new_middleware ) if after . is_a? Array index = @middlewares . rindex { | el | after . include? ( el ) } else index = @middlewares . rindex ( after ) end i... | Inserts a new middleware to use after a given middleware already added . |
5,314 | def insert_before ( before , new_middleware ) @mutex . synchronize do return if @disabled_middleware . include? ( new_middleware ) return if @middlewares . include? ( new_middleware ) if before . is_a? Array index = @middlewares . index { | el | before . include? ( el ) } else index = @middlewares . index ( before ) en... | Inserts a new middleware to use before a given middleware already added . |
5,315 | def run ( report ) lambda_has_run = false notify_lambda = lambda do | notif | lambda_has_run = true yield if block_given? end begin middleware_procs . reverse . inject ( notify_lambda ) { | n , e | e . call ( n ) } . call ( report ) rescue StandardError => e raise if e . class . to_s == "RSpec::Expectations::Expectatio... | Runs the middleware stack . |
5,316 | def leave_mongo_breadcrumb ( event_name , event ) message = MONGO_MESSAGE_PREFIX + event_name meta_data = { :event_name => MONGO_EVENT_PREFIX + event_name , :command_name => event . command_name , :database_name => event . database_name , :operation_id => event . operation_id , :request_id => event . request_id , :dura... | Generates breadcrumb data from an event |
5,317 | def sanitize_filter_hash ( filter_hash , depth = 0 ) filter_hash . each_with_object ( { } ) do | ( key , value ) , output | output [ key ] = sanitize_filter_value ( value , depth ) end end | Removes values from filter hashes replacing them with ? |
5,318 | def sanitize_filter_value ( value , depth ) depth += 1 if depth >= MAX_FILTER_DEPTH '[MAX_FILTER_DEPTH_REACHED]' elsif value . is_a? ( Array ) value . map { | array_value | sanitize_filter_value ( array_value , depth ) } elsif value . is_a? ( Hash ) sanitize_filter_hash ( value , depth ) else '?' end end | Transforms a value element into a useful redacted version |
5,319 | def parse_proxy ( uri ) proxy = URI . parse ( uri ) self . proxy_host = proxy . host self . proxy_port = proxy . port self . proxy_user = proxy . user self . proxy_password = proxy . password end | Parses and sets proxy from a uri |
5,320 | def call ( mail ) begin Bugsnag . configuration . set_request_data :mailman_msg , mail . to_s yield rescue Exception => ex Bugsnag . notify ( ex , true ) do | report | report . severity = "error" report . severity_reason = { :type => Bugsnag :: Report :: UNHANDLED_EXCEPTION_MIDDLEWARE , :attributes => FRAMEWORK_ATTRIBU... | Calls the mailman middleware . |
5,321 | def render_navigation ( options = { } , & block ) container = active_navigation_item_container ( options , & block ) container && container . render ( options ) end | Renders the navigation according to the specified options - hash . |
5,322 | def active_navigation_item ( options = { } , value_for_nil = nil ) if options [ :level ] . nil? || options [ :level ] == :all options [ :level ] = :leaves end container = active_navigation_item_container ( options ) if container && ( item = container . selected_item ) block_given? ? yield ( item ) : item else value_for... | Returns the currently active navigation item belonging to the specified level . |
5,323 | def active_navigation_item_container ( options = { } , & block ) options = SimpleNavigation :: Helpers . apply_defaults ( options ) SimpleNavigation :: Helpers . load_config ( options , self , & block ) SimpleNavigation . active_item_container_for ( options [ :level ] ) end | Returns the currently active item container belonging to the specified level . |
5,324 | def html_options html_opts = options . fetch ( :html ) { Hash . new } html_opts [ :id ] ||= autogenerated_item_id classes = [ html_opts [ :class ] , selected_class , active_leaf_class ] classes = classes . flatten . compact . join ( ' ' ) html_opts [ :class ] = classes if classes && ! classes . empty? html_opts end | Returns the html - options hash for the item i . e . the options specified for this item in the config - file . It also adds the selected class to the list of classes if necessary . |
5,325 | def item ( key , name , url = nil , options = { } , & block ) return unless should_add_item? ( options ) item = Item . new ( self , key , name , url , options , & block ) add_item item , options end | Creates a new navigation item . |
5,326 | def level_for_item ( navi_key ) return level if self [ navi_key ] items . each do | item | next unless item . sub_navigation level = item . sub_navigation . level_for_item ( navi_key ) return level if level end return nil end | Returns the level of the item specified by navi_key . Recursively works its way down the item s sub_navigations if the desired item is not found directly in this container s items . Returns nil if item cannot be found . |
5,327 | def usable_for? ( purposes ) unless purposes . kind_of? Array purposes = [ purposes ] end return false if [ :revoked , :expired , :disabled , :invalid ] . include? trust return ( purposes - capability ) . empty? end | Checks if the key is capable of all of these actions . If empty array is passed then will return true . |
5,328 | def read ( length = nil ) if length GPGME :: gpgme_data_read ( self , length ) else buf = String . new loop do s = GPGME :: gpgme_data_read ( self , BLOCK_SIZE ) break unless s buf << s end buf end end | class << self Read at most + length + bytes from the data object or to the end of file if + length + is omitted or is + nil + . |
5,329 | def seek ( offset , whence = IO :: SEEK_SET ) GPGME :: gpgme_data_seek ( self , offset , IO :: SEEK_SET ) end | Seek to a given + offset + in the data object according to the value of + whence + . |
5,330 | def file_name = ( file_name ) err = GPGME :: gpgme_data_set_file_name ( self , file_name ) exc = GPGME :: error_to_exception ( err ) raise exc if exc file_name end | Sets the file name for this buffer . |
5,331 | def delete! ( allow_secret = false ) GPGME :: Ctx . new do | ctx | ctx . delete_key self , allow_secret end end | Delete this key . If it s public and has a secret one it will fail unless + allow_secret + is specified as true . |
5,332 | def protocol = ( proto ) err = GPGME :: gpgme_set_protocol ( self , proto ) exc = GPGME :: error_to_exception ( err ) raise exc if exc proto end | Getters and setters |
5,333 | def keylist_next rkey = [ ] err = GPGME :: gpgme_op_keylist_next ( self , rkey ) exc = GPGME :: error_to_exception ( err ) raise exc if exc rkey [ 0 ] end | Advance to the next key in the key listing operation . |
5,334 | def keylist_end err = GPGME :: gpgme_op_keylist_end ( self ) exc = GPGME :: error_to_exception ( err ) raise exc if exc end | End a pending key list operation . |
5,335 | def each_key ( pattern = nil , secret_only = false , & block ) keylist_start ( pattern , secret_only ) begin loop { yield keylist_next } rescue EOFError ensure keylist_end end end | Convenient method to iterate over keys . |
5,336 | def keys ( pattern = nil , secret_only = nil ) keys = [ ] each_key ( pattern , secret_only ) do | key | keys << key end keys end | Returns the keys that match the + pattern + or all if + pattern + is nil . Returns only secret keys if + secret_only + is true . |
5,337 | def get_key ( fingerprint , secret = false ) rkey = [ ] err = GPGME :: gpgme_get_key ( self , fingerprint , rkey , secret ? 1 : 0 ) exc = GPGME :: error_to_exception ( err ) raise exc if exc rkey [ 0 ] end | Get the key with the + fingerprint + . If + secret + is + true + secret key is returned . |
5,338 | def import_keys ( keydata ) err = GPGME :: gpgme_op_import ( self , keydata ) exc = GPGME :: error_to_exception ( err ) raise exc if exc end | Add the keys in the data buffer to the key ring . |
5,339 | def delete_key ( key , allow_secret = false ) err = GPGME :: gpgme_op_delete ( self , key , allow_secret ? 1 : 0 ) exc = GPGME :: error_to_exception ( err ) raise exc if exc end | Delete the key from the key ring . If allow_secret is false only public keys are deleted otherwise secret keys are deleted as well . |
5,340 | def edit_key ( key , editfunc , hook_value = nil , out = Data . new ) err = GPGME :: gpgme_op_edit ( self , key , editfunc , hook_value , out ) exc = GPGME :: error_to_exception ( err ) raise exc if exc end | Edit attributes of the key in the local key ring . |
5,341 | def edit_card_key ( key , editfunc , hook_value = nil , out = Data . new ) err = GPGME :: gpgme_op_card_edit ( self , key , editfunc , hook_value , out ) exc = GPGME :: error_to_exception ( err ) raise exc if exc end | Edit attributes of the key on the card . |
5,342 | def verify ( sig , signed_text = nil , plain = Data . new ) err = GPGME :: gpgme_op_verify ( self , sig , signed_text , plain ) exc = GPGME :: error_to_exception ( err ) raise exc if exc plain end | Verify that the signature in the data object is a valid signature . |
5,343 | def add_signer ( * keys ) keys . each do | key | err = GPGME :: gpgme_signers_add ( self , key ) exc = GPGME :: error_to_exception ( err ) raise exc if exc end end | Add _keys_ to the list of signers . |
5,344 | def sign ( plain , sig = Data . new , mode = GPGME :: SIG_MODE_NORMAL ) err = GPGME :: gpgme_op_sign ( self , plain , sig , mode ) exc = GPGME :: error_to_exception ( err ) raise exc if exc sig end | Create a signature for the text . + plain + is a data object which contains the text . + sig + is a data object where the generated signature is stored . |
5,345 | def encrypt ( recp , plain , cipher = Data . new , flags = 0 ) err = GPGME :: gpgme_op_encrypt ( self , recp , flags , plain , cipher ) exc = GPGME :: error_to_exception ( err ) raise exc if exc cipher end | Encrypt the plaintext in the data object for the recipients and return the ciphertext . |
5,346 | def encrypt ( plain , options = { } ) options = @default_options . merge options plain_data = Data . new ( plain ) cipher_data = Data . new ( options [ :output ] ) keys = Key . find ( :public , options [ :recipients ] ) keys = nil if options [ :symmetric ] flags = 0 flags |= GPGME :: ENCRYPT_ALWAYS_TRUST if options [ :... | Encrypts an element |
5,347 | def decrypt ( cipher , options = { } ) options = @default_options . merge options plain_data = Data . new ( options [ :output ] ) cipher_data = Data . new ( cipher ) GPGME :: Ctx . new ( options ) do | ctx | begin ctx . decrypt_verify ( cipher_data , plain_data ) rescue GPGME :: Error :: UnsupportedAlgorithm => exc exc... | Decrypts a previously encrypted element |
5,348 | def sign ( text , options = { } ) options = @default_options . merge options plain = Data . new ( text ) output = Data . new ( options [ :output ] ) mode = options [ :mode ] || GPGME :: SIG_MODE_NORMAL GPGME :: Ctx . new ( options ) do | ctx | if options [ :signer ] signers = Key . find ( :secret , options [ :signer ] ... | Creates a signature of a text |
5,349 | def verify ( sig , options = { } ) options = @default_options . merge options sig = Data . new ( sig ) signed_text = Data . new ( options [ :signed_text ] ) output = Data . new ( options [ :output ] ) unless options [ :signed_text ] GPGME :: Ctx . new ( options ) do | ctx | ctx . verify ( sig , signed_text , output ) c... | Verifies a previously signed element |
5,350 | def add ( path , data ) path = path . split ( '/' ) filename = path . pop current = self . tree path . each do | dir | current [ dir ] ||= { } node = current [ dir ] current = node end current [ filename ] = data end | Initialize a new Index object . |
5,351 | def write_tree ( tree = nil , now_tree = nil ) tree = self . tree if ! tree tree_contents = { } now_tree = read_tree ( now_tree ) if ( now_tree && now_tree . is_a? ( String ) ) now_tree . contents . each do | obj | sha = [ obj . id ] . pack ( "H*" ) k = obj . name k += '/' if ( obj . class == Grit :: Tree ) tmode = obj... | Recursively write a tree to the index . |
5,352 | def content_from_string ( repo , text ) mode , type , id , name = text . split ( / \t / , 4 ) case type when "tree" Tree . create ( repo , :id => id , :mode => mode , :name => name ) when "blob" Blob . create ( repo , :id => id , :mode => mode , :name => name ) when "link" Blob . create ( repo , :id => id , :mode => mo... | Parse a content item and create the appropriate object + repo + is the Repo + text + is the single line containing the items data in git ls - tree format |
5,353 | def / ( file ) if file =~ / \/ / file . split ( "/" ) . inject ( self ) { | acc , x | acc / x } rescue nil else self . contents . find { | c | c . name == file } end end | Find the named object in this tree s contents |
5,354 | def create_initialize ( repo , atts ) @repo = repo atts . each do | k , v | instance_variable_set ( "@#{k}" . to_sym , v ) end self end | Initializer for Submodule . create + repo + is the Repo + atts + is a Hash of instance variable data |
5,355 | def url ( ref ) config = self . class . config ( @repo , ref ) lookup = config . keys . inject ( { } ) do | acc , key | id = config [ key ] [ 'id' ] acc [ id ] = config [ key ] [ 'url' ] acc end lookup [ @id ] end | The url of this submodule + ref + is the committish that should be used to look up the url |
5,356 | def diff_files hsh = { } @base . git . diff_files . split ( "\n" ) . each do | line | ( info , file ) = line . split ( "\t" ) ( mode_src , mode_dest , sha_src , sha_dest , type ) = info . split hsh [ file ] = { :path => file , :mode_file => mode_src . to_s [ 1 , 7 ] , :mode_index => mode_dest , :sha_file => sha_src , :... | compares the index and the working directory |
5,357 | def output ( time ) offset = time . utc_offset / 60 "%s <%s> %d %+.2d%.2d" % [ @name , @email || "null" , time . to_i , offset / 60 , offset . abs % 60 ] end | Outputs an actor string for Git commits . |
5,358 | def recent_tag_name ( committish = nil , options = { } ) value = git . describe ( { :always => true } . update ( options ) , committish . to_s ) . to_s . strip value . size . zero? ? nil : value end | Finds the most recent annotated tag name that is reachable from a commit . |
5,359 | def refs_list refs = self . git . for_each_ref refarr = refs . split ( "\n" ) . map do | line | shatype , ref = line . split ( "\t" ) sha , type = shatype . split ( ' ' ) [ ref , sha , type ] end refarr end | returns an array of hashes representing all references |
5,360 | def commit_deltas_from ( other_repo , ref = "master" , other_ref = "master" ) repo_refs = self . git . rev_list ( { } , ref ) . strip . split ( "\n" ) other_repo_refs = other_repo . git . rev_list ( { } , other_ref ) . strip . split ( "\n" ) ( other_repo_refs - repo_refs ) . map do | refn | Commit . find_all ( other_re... | Returns a list of commits that is in + other_repo + but not in self |
5,361 | def log ( commit = 'master' , path = nil , options = { } ) default_options = { :pretty => "raw" } actual_options = default_options . merge ( options ) arg = path ? [ commit , '--' , path ] : [ commit ] commits = self . git . log ( actual_options , * arg ) Commit . list_from_string ( self , commits ) end | The commit log for a treeish |
5,362 | def alternates = ( alts ) alts . each do | alt | unless File . exist? ( alt ) raise "Could not set alternates. Alternate path #{alt} must exist" end end if alts . empty? self . git . fs_write ( 'objects/info/alternates' , '' ) else self . git . fs_write ( 'objects/info/alternates' , alts . join ( "\n" ) ) end end | Sets the alternates + alts + is the Array of String paths representing the alternates |
5,363 | def diffs ( options = { } ) if parents . empty? show else self . class . diff ( @repo , parents . first . id , @id , [ ] , options ) end end | Shows diffs between the commit s parent and the commit . |
5,364 | def fs_write ( file , contents ) path = File . join ( self . git_dir , file ) FileUtils . mkdir_p ( File . dirname ( path ) ) File . open ( path , 'w' ) do | f | f . write ( contents ) end end | Write a normal file to the filesystem . + file + is the relative path from the Git dir + contents + is the String content to be written |
5,365 | def fs_move ( from , to ) FileUtils . mv ( File . join ( self . git_dir , from ) , File . join ( self . git_dir , to ) ) end | Move a normal file + from + is the relative path to the current file + to + is the relative path to the destination file |
5,366 | def fs_chmod ( mode , file = '/' ) FileUtils . chmod_R ( mode , File . join ( self . git_dir , file ) ) end | Chmod the the file or dir and everything beneath + file + is the relative path from the Git dir |
5,367 | def check_applies ( options = { } , head_sha = nil , applies_sha = nil ) options , head_sha , applies_sha = { } , options , head_sha if ! options . is_a? ( Hash ) options = options . dup options [ :env ] &&= options [ :env ] . dup git_index = create_tempfile ( 'index' , true ) ( options [ :env ] ||= { } ) . merge! ( 'G... | Checks if the patch of a commit can be applied to the given head . |
5,368 | def get_patch ( options = { } , applies_sha = nil ) options , applies_sha = { } , options if ! options . is_a? ( Hash ) options = options . dup options [ :env ] &&= options [ :env ] . dup git_index = create_tempfile ( 'index' , true ) ( options [ :env ] ||= { } ) . merge! ( 'GIT_INDEX_FILE' => git_index ) native ( :dif... | Gets a patch for a given SHA using git diff . |
5,369 | def apply_patch ( options = { } , head_sha = nil , patch = nil ) options , head_sha , patch = { } , options , head_sha if ! options . is_a? ( Hash ) options = options . dup options [ :env ] &&= options [ :env ] . dup options [ :raise ] = true git_index = create_tempfile ( 'index' , true ) ( options [ :env ] ||= { } ) .... | Applies the given patch against the given SHA of the current repo . |
5,370 | def native ( cmd , options = { } , * args , & block ) args = args . first if args . size == 1 && args [ 0 ] . is_a? ( Array ) args . map! { | a | a . to_s } args . reject! { | a | a . empty? } env = options . delete ( :env ) || { } raise_errors = options . delete ( :raise ) process_info = options . delete ( :process_in... | Execute a git command bypassing any library implementation . |
5,371 | def run ( prefix , cmd , postfix , options , args , & block ) timeout = options . delete ( :timeout ) rescue nil timeout = true if timeout . nil? base = options . delete ( :base ) rescue nil base = true if base . nil? if input = options . delete ( :input ) block = lambda { | stdin | stdin . write ( input ) } end opt_ar... | DEPRECATED OPEN3 - BASED COMMAND EXECUTION |
5,372 | def transform_options ( options ) args = [ ] options . keys . each do | opt | if opt . to_s . size == 1 if options [ opt ] == true args << "-#{opt}" elsif options [ opt ] == false else val = options . delete ( opt ) args << "-#{opt.to_s} '#{e(val)}'" end else if options [ opt ] == true args << "--#{opt.to_s.gsub(/_/, '... | Transform Ruby style options into git command line options + options + is a hash of Ruby style options |
5,373 | def body if content_type_is_form && request . body . is_a? ( Hash ) URI . encode_www_form convert_hash_body_to_array_of_arrays else Pact :: Reification . from_term ( request . body ) end end | This feels wrong to be checking the class type of the body Do this better somehow . |
5,374 | def convert_hash_body_to_array_of_arrays arrays = [ ] request . body . keys . each do | key | [ * request . body [ key ] ] . each do | value | arrays << [ key , value ] end end Pact :: Reification . from_term ( arrays ) end | This probably belongs somewhere else . |
5,375 | def select_by_jobs_count ( proxies ) exclude = @tasks . keys + @offline @tasks . merge! ( get_counts ( proxies - exclude ) ) next_proxy = @tasks . select { | proxy , _ | proxies . include? ( proxy ) } . min_by { | _ , job_count | job_count } . try ( :first ) @tasks [ next_proxy ] += 1 if next_proxy . present? next_prox... | Get the least loaded proxy from the given list of proxies |
5,376 | def colliding_locks task_ids = task . self_and_parents . map ( & :id ) colliding_locks_scope = Lock . active . where ( Lock . arel_table [ :task_id ] . not_in ( task_ids ) ) colliding_locks_scope = colliding_locks_scope . where ( name : name , resource_id : resource_id , resource_type : resource_type ) unless exclusive... | returns a scope of the locks colliding with this one |
5,377 | def trigger ( proxy_action_name , input ) response = begin proxy . trigger_task ( proxy_action_name , input ) . merge ( 'result' => 'success' ) rescue RestClient :: Exception => e logger . warn "Could not trigger task on the smart proxy: #{e.message}" { } end update_from_batch_trigger ( response ) save! end | Triggers a task on the proxy the old way |
5,378 | def fill_continuous_output ( continuous_output ) failed_proxy_tasks . each do | failure_data | message = _ ( 'Initialization error: %s' ) % "#{failure_data[:exception_class]} - #{failure_data[:exception_message]}" continuous_output . add_output ( message , 'debug' , failure_data [ :timestamp ] ) end end | The proxy action is able to contribute to continuous output |
5,379 | def trigger_repeat ( execution_plan ) request_id = :: Logging . mdc [ 'request' ] :: Logging . mdc [ 'request' ] = SecureRandom . uuid if execution_plan . delay_record && recurring_logic_task_group args = execution_plan . delay_record . args logic = recurring_logic_task_group . recurring_logic logic . trigger_repeat_af... | Hook to be called when a repetition needs to be triggered . This either happens when the plan goes into planned state or when it fails . |
5,380 | def followers ( user_name , repo_name , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? normalize! params response = get_request ( "/1.0/repositories/#{user}/#{repo.downcase}/followers/" , params ) return response unless block_given? res... | List repo followers |
5,381 | def followed ( * args ) params = args . extract_options! normalize! params response = get_request ( "/1.0/user/follows" , params ) return response unless block_given? response . each { | el | yield el } end | List repos being followed by the authenticated user |
5,382 | def get ( user_name , repo_name , component_id , params = { } ) update_and_validate_user_repo_params ( user_name , repo_name ) normalize! params get_request ( "/2.0/repositories/#{user}/#{repo.downcase}/components/#{component_id}" , params ) end | Get a component by it s ID |
5,383 | def create ( user_name , repo_name , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? normalize! params assert_required_keys ( REQUIRED_KEY_PARAM_NAMES , params ) post_request ( "/1.0/repositories/#{user}/#{repo.downcase}/services" , para... | Create a service |
5,384 | def edit ( user_name , repo_name , service_id , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? _validate_presence_of ( service_id ) normalize! params put_request ( "/1.0/repositories/#{user}/#{repo.downcase}/services/#{service_id}" , pa... | Edit a service |
5,385 | def get ( user_name , repo_name , reviewer_username , params = { } ) update_and_validate_user_repo_params ( user_name , repo_name ) normalize! params get_request ( "/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}" , params ) end | Get a default reviewer s info |
5,386 | def add ( user_name , repo_name , reviewer_username , params = { } ) update_and_validate_user_repo_params ( user_name , repo_name ) normalize! params put_request ( "/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}" , params ) end | Add a user to the default - reviewers list for the repo |
5,387 | def remove ( user_name , repo_name , reviewer_username , params = { } ) update_and_validate_user_repo_params ( user_name , repo_name ) normalize! params delete_request ( "/2.0/repositories/#{user_name}/#{repo_name}/default-reviewers/#{reviewer_username}" , params ) end | Remove a user from the default - reviewers list for the repo |
5,388 | def get ( user_name , repo_name , component_id , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? _validate_presence_of component_id normalize! params get_request ( "/1.0/repositories/#{user}/#{repo.downcase}/issues/components/#{component... | Get a single component |
5,389 | def update ( user_name , repo_name , component_id , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? _validate_presence_of component_id normalize! params filter! VALID_COMPONENT_INPUTS , params assert_required_keys ( VALID_COMPONENT_INPUT... | Update a component |
5,390 | def delete ( user_name , repo_name , component_id , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? _validate_presence_of component_id normalize! params delete_request ( "/1.0/repositories/#{user}/#{repo.downcase}/issues/components/#{com... | Delete a component |
5,391 | def create ( user_name , repo_name , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? normalize! params filter! VALID_KEY_PARAM_NAMES , params assert_required_keys ( VALID_KEY_PARAM_NAMES , params ) options = { headers : { "Content-Type" ... | Create a key |
5,392 | def edit ( user_name , repo_name , key_id , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? _validate_presence_of key_id normalize! params filter! VALID_KEY_PARAM_NAMES , params put_request ( "/1.0/repositories/#{user}/#{repo.downcase}/d... | Edit a key |
5,393 | def members ( team_name ) response = get_request ( "/2.0/teams/#{team_name.to_s}/members" ) return response [ "values" ] unless block_given? response [ "values" ] . each { | el | yield el } end | List members of the provided team |
5,394 | def followers ( team_name ) response = get_request ( "/2.0/teams/#{team_name.to_s}/followers" ) return response [ "values" ] unless block_given? response [ "values" ] . each { | el | yield el } end | List followers of the provided team |
5,395 | def following ( team_name ) response = get_request ( "/2.0/teams/#{team_name.to_s}/following" ) return response [ "values" ] unless block_given? response [ "values" ] . each { | el | yield el } end | List accounts following the provided team |
5,396 | def repos ( team_name ) response = get_request ( "/2.0/repositories/#{team_name.to_s}" ) return response [ "values" ] unless block_given? response [ "values" ] . each { | el | yield el } end | List repos for provided team Private repos will only be returned if the user is authorized to view them |
5,397 | def list_repo ( user_name , repo_name , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? normalize! params filter! VALID_ISSUE_PARAM_NAMES , params assert_valid_values ( VALID_ISSUE_PARAM_VALUES , params ) response = get_request ( "/1.0/r... | List issues for a repository |
5,398 | def create ( user_name , repo_name , params = { } ) _update_user_repo_params ( user_name , repo_name ) _validate_user_repo_params ( user , repo ) unless user? && repo? normalize! params _merge_user_into_params! ( params ) unless params . has_key? ( 'user' ) filter! VALID_ISSUE_PARAM_NAMES , params assert_required_keys ... | Create an issue |
5,399 | def method_missing ( method , * args , & block ) case method . to_s when / \? / return ! self . send ( $1 . to_s ) . nil? when / / self . send ( "#{$1.to_s}=" , nil ) else super end end | Responds to attribute query or attribute clear |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.